/* 本棚ページ・訪問ページ・3D画面に重なる操作リンクのスタイル。
   ベースはスマートフォン幅。広い画面は min-width で拡張します。 */

.shelf-page {
  max-width: 1240px;
  margin: auto;
  padding: 24px 16px 40px;
}

.shelf-page-heading {
  padding: 16px 0 24px;
}

.shelf-page-heading h1 {
  font-size: 29px;
  line-height: 1.45;
  margin: 14px 0;
  overflow-wrap: anywhere;
}

.shelf-page-heading > p:not(.eyebrow) {
  color: var(--muted);
  max-width: 660px;
  white-space: pre-line;
}

.shelf-topline,
.shelf-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.shelf-toolbar {
  margin-top: 24px;
  gap: 10px;
}

.shelf-count {
  font-size: 14px;
  white-space: nowrap;
  margin-right: 8px;
  width: 100%;
}

.shelf-count b {
  font-family: Georgia, serif;
  font-weight: 400;
  font-size: 36px;
}

.privacy-badge {
  font-size: 11px;
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--green);
}

.shelf-instruction {
  font-size: 12px;
  margin-top: 22px;
}

.shelf-sections {
  display: grid;
  gap: 34px;
}

.shelf-section {
  background: #eee9dc;
  border: 1px solid #dcd3bf;
  border-radius: 8px;
  padding: 14px 10px;
}

.section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.section-label > span {
  font-family: Georgia, serif;
  color: #968366;
}

.section-label h2 {
  font-size: 19px;
  overflow-wrap: anywhere;
}

.section-label small {
  color: var(--muted);
  width: 100%;
  margin-left: 25px;
  font-size: 10px;
}

.shelf-slots {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.shelf-slot {
  position: relative;
  min-width: 0;
  min-height: 125px;
  border: 0;
  border-bottom: 6px solid #ae8f64;
  border-radius: 3px;
  background: #e2dac8;
  padding: 16px 4px 8px;
  color: var(--ink);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 7px;
}

.shelf-slot.filled {
  background: #f7f3e8;
}

.shelf-slot img {
  width: 52px;
  height: 70px;
  object-fit: cover;
  box-shadow: 3px 4px 0 #cbc2af;
}

.slot-title {
  font-size: 10px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 30px;
}

.slot-number {
  position: absolute;
  top: 3px;
  left: 6px;
  font: 10px Georgia, serif;
  color: #7f735e;
}

.note-mark {
  position: absolute;
  right: 4px;
  top: 2px;
  font-size: 12px;
}

.shelf-slot.empty > span:not(.slot-number) {
  font-size: 22px;
  color: #72816a;
}

.shelf-slot.empty small {
  font-size: 10px;
  color: #65745e;
}

.shelf-slot:hover {
  outline: 2px solid #82937a;
  outline-offset: 2px;
}

.shelf-slot.vacant {
  opacity: .55;
}

.shelf-reason {
  margin-top: 24px;
}

.shelf-reason blockquote {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.mock-note {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.9;
  margin: 24px 0 8px;
}

.people-shelves {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

.person-shelf {
  display: block;
  background: #fffdf6;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 22px;
}

.person-shelf h2 {
  font-size: 23px;
  margin: 12px 0;
  line-height: 1.5;
}

.person-shelf p {
  font-size: 12px;
  color: var(--muted);
}

.person-shelf .eyebrow {
  font-size: 10px;
}

.mini-shelf {
  height: 140px;
  background: #e2e7d9;
  border-bottom: 8px solid #ac926a;
  margin: -22px -22px 24px;
  padding: 28px 18px 10px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 6px;
  overflow: hidden;
}

.mini-shelf img {
  width: 45px;
  height: auto;
  max-height: 95px;
  box-shadow: 2px 1px 0 #c4c0ad;
}

.mini-shelf img:nth-child(2n) {
  transform: rotate(-5deg);
}

#discover-random {
  margin-top: 24px;
}

.shelf-form {
  display: grid;
  gap: 18px;
}

.shelf-form label,
.search-label {
  display: grid;
  gap: 6px;
  font-size: 12px;
}

/* 16px 未満だと iOS が入力時に画面を拡大するため、狭い画面では 16px を基準にします。 */
.shelf-form input:not([type=radio]),
.shelf-form textarea,
.shelf-form select,
.search-label input {
  width: 100%;
  min-height: 44px;
  border: 1px solid #b9c2b3;
  background: #fffdf8;
  padding: 10px 12px;
  border-radius: 4px;
  color: var(--ink);
  font: 16px var(--sans);
}

.shelf-form textarea {
  resize: vertical;
}

.shelf-form fieldset {
  border: 1px solid var(--line);
  padding: 14px;
  min-width: 0;
}

.shelf-form legend {
  font-size: 12px;
  padding: 0 7px;
}

.shelf-form .radio-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
}

.radio-label input {
  margin-top: 5px;
  accent-color: var(--green);
}

.radio-label small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.section-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.search-label {
  margin: 16px 0;
}

.picker-results {
  max-height: 42dvh;
  overflow: auto;
  border-block: 1px solid var(--line);
}

.rakuten-search{min-width:0}.search-fields{display:flex;gap:16px;margin:12px 0 4px;padding:0;border:0}.search-fields legend{font-size:11px;color:var(--muted);margin-bottom:4px}.search-fields label{min-height:44px;display:flex;align-items:center;gap:7px;font-size:13px}.search-fields input{width:18px;height:18px}.search-state,.search-error{padding:26px 12px;text-align:center;color:var(--muted)}.search-error .button{margin-top:12px}.picker-cover{width:46px;height:64px;display:grid;place-items:center;flex:none;background:var(--surface)}.picker-cover img{width:46px;height:64px;object-fit:cover}.rakuten-commerce{display:grid;gap:8px;margin:18px 0;padding:14px;border-block:1px solid var(--line);font-size:12px}.rakuten-commerce .book-price{font-family:var(--serif);font-size:18px;color:var(--ink)}.rakuten-commerce .shop-button{width:100%;min-height:44px}.rakuten-commerce small{color:var(--muted);font-size:10px}body[data-capture-ui="hidden"] [data-capture-ui="hidden"]{display:none!important}

.picker-book {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  background: transparent;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.picker-book img {
  width: 38px;
  height: 51px;
  object-fit: cover;
}

.picker-book > span:nth-child(2) {
  flex: 1;
  min-width: 0;
}

.picker-book strong {
  font-size: 13px;
  font-weight: 500;
  display: block;
}

.picker-book small {
  font-size: 10px;
  color: var(--muted);
}

.custom-book {
  margin-top: 22px;
}

.custom-book summary {
  min-height: 44px;
  cursor: pointer;
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 5px;
}

.custom-book .shelf-form {
  padding-top: 12px;
}

.account-intro,.account-profile{display:grid;gap:16px}.account-google{width:100%}.account-divider{display:flex;align-items:center;gap:12px;color:var(--muted);font-size:11px}.account-divider::before,.account-divider::after{content:"";height:1px;background:var(--line);flex:1}.account-profile{grid-template-columns:48px minmax(0,1fr);align-items:center;margin-bottom:20px}.account-profile img{width:48px;height:48px;border-radius:50%}.account-profile strong,.account-profile small{display:block;overflow-wrap:anywhere}.account-profile small,.account-caution{color:var(--muted);font-size:11px}.form-error{min-height:1.8em;color:#8b3c2f;font-size:12px}

.entry-editor-heading {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
}

.entry-editor-heading img {
  width: 64px;
  height: auto;
}

.entry-editor-heading h3 {
  font-size: 22px;
}

.entry-editor-heading p {
  font-size: 12px;
  color: var(--muted);
}

.entry-options {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.entry-options button {
  font-size: 12px;
}

.invite-code {
  font: 25px Georgia, serif;
  letter-spacing: .12em;
  text-align: center;
  background: var(--surface);
  padding: 22px;
  margin: 20px 0;
}

.form-error {
  color: #963f30;
  font-size: 12px;
}

.entry-actions {
  display: grid;
  gap: 12px;
  margin-top: 26px;
  max-width: 340px;
}

.entry-actions .button {
  font-size: 14px;
}

.entrance-smalllinks {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 22px;
  margin-top: 10px;
}

.entrance-smalllinks button {
  font-size: 12px;
}

.welcome-copy h1 {
  font-size: 32px;
}

/* 3D画面に重なるリンク。狭い画面ではスティックと重ならない高さに置きます。 */
.room-links {
  position: absolute;
  left: 18px;
  bottom: calc(245px + env(safe-area-inset-bottom));
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  max-width: calc(100% - 36px);
  pointer-events: auto;
}

.room-links a,
.room-links button {
  font-size: 10px;
  padding: 7px 10px;
  background: #17362ce6;
  color: #f7f4eb;
  border: 1px solid #bdc4a466;
  border-radius: 4px;
  min-height: 44px;
  display: flex;
  align-items: center;
}

/* 狭い画面では店名の帯が操作ボタンに重ならないよう、幅を制限して2行で省略します。 */
.store-top > div {
  min-width: 0;
  max-width: calc(100% - 100px);
}

.store-top .open-label {
  letter-spacing: 0;
}

.store-top p {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ヘッダーの見出しとナビは、狭い画面では base.css の既定より小さくします。 */
.site-header .brand {
  font-size: 18px;
  gap: 8px;
}

.site-header .nav-link {
  display: flex;
  font-size: 11px;
  padding: 0 5px;
  /* 狭い画面でもタップ領域を 44px 四方以上に保ちます。 */
  min-width: 44px;
  justify-content: center;
}

.site-header .nav-link[aria-current=page] {
  text-decoration: underline;
  text-underline-offset: 8px;
  text-decoration-color: #81917b;
}

.shelf-toolbar .button {
  font-size: 11px;
  padding: 10px 12px;
}

.entry-editor-heading > div {
  min-width: 0;
}

.entry-editor-heading h3,
.book-meta h3,
.store-top p,
.store-top .open-label {
  overflow-wrap: anywhere;
}

.sheet-actions {
  flex-wrap: wrap;
}

.sheet-actions #add-shelf-book {
  flex-basis: 100%;
}

.shelf-slot.vacant:hover {
  outline: none;
}

@media (min-width: 680px) {
  .shelf-page {
    padding: 40px 24px 64px;
  }

  .shelf-page-heading {
    padding-bottom: 32px;
  }

  .shelf-page-heading h1 {
    font-size: clamp(28px, 4vw, 44px);
  }

  .shelf-toolbar {
    gap: 14px;
  }

  .shelf-count {
    width: auto;
  }

  .shelf-section {
    padding: 20px;
  }

  .section-label {
    gap: 14px;
  }

  .section-label h2 {
    font-size: 22px;
  }

  .section-label small {
    width: auto;
    margin-left: auto;
    font-size: smaller;
  }

  .shelf-slots {
    gap: 12px;
  }

  .shelf-slot {
    min-height: 150px;
    padding: 14px 8px 8px;
  }

  .shelf-slot img {
    width: 72px;
    height: 96px;
  }

  .people-shelves {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .shelf-form input:not([type=radio]),
  .shelf-form textarea,
  .shelf-form select,
  .search-label input {
    font-size: 14px;
  }

  .section-fields {
    grid-template-columns: 1fr 1fr;
  }

  .room-links {
    left: 32px;
    bottom: 180px;
    max-width: calc(100% - 64px);
  }

  .room-links a,
  .room-links button {
    font-size: 11px;
    padding: 8px 12px;
  }

  .store-top > div {
    min-width: auto;
    max-width: none;
  }

  .store-top .open-label {
    letter-spacing: .1em;
  }

  .store-top p {
    display: block;
    -webkit-line-clamp: none;
    overflow: visible;
  }

  .welcome-copy h1 {
    font-size: clamp(30px, 3.2vw, 46px);
  }

  .site-header .brand {
    font-size: 25px;
    gap: 14px;
  }

  .site-header .nav-link {
    font-size: 12px;
    padding: 0 10px;
  }

  .shelf-toolbar .button {
    font-size: 12px;
    padding: 12px 16px;
  }
}

@media (min-width: 1000px) {
  .shelf-slots {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }

  .people-shelves {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* 長い本棚でも現在地を見失わない、コンパクトな棚の目次です。 */
.shelf-jump {
  display: grid;
  gap: 6px;
  margin: 0 0 18px;
  font-size: 11px;
  color: var(--muted);
}

.shelf-jump select {
  width: 100%;
  min-height: 44px;
  border: 1px solid #b9c2b3;
  border-radius: 4px;
  padding: 9px 12px;
  background: #fffdf8;
  color: var(--ink);
}

.first-book-callout {
  display: grid;
  gap: 18px;
  margin-top: 26px;
  padding: 22px;
  border: 1px solid #cfd8c6;
  border-radius: 8px;
  background: #e8eddf;
}

.first-book-callout > div > .icon {
  float: left;
  width: 34px;
  height: 34px;
  margin: 2px 14px 20px 0;
  color: var(--green);
}

.first-book-callout h2 {
  margin: 5px 0 3px;
  font-size: 20px;
}

.first-book-callout p:not(.eyebrow) {
  color: var(--muted);
  font-size: 12px;
}

.first-book-callout .button {
  width: 100%;
}

@media (min-width: 680px) {
  .shelf-jump {
    grid-template-columns: auto minmax(260px, 420px);
    align-items: center;
    justify-content: end;
  }

  .first-book-callout {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    padding: 24px 28px;
  }

  .first-book-callout .button {
    width: auto;
  }
}

/* スマートフォンでは主要機能を親指で届く下部に集約します。 */
@media (max-width: 679px) {
  body:not(.in-store) {
    padding-bottom: calc(68px + env(safe-area-inset-bottom));
  }

  .site-header {
    height: 72px;
    padding: 0 16px;
  }

  .site-header nav {
    position: fixed;
    z-index: 20;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    height: calc(68px + env(safe-area-inset-bottom));
    padding: 5px 8px env(safe-area-inset-bottom);
    border-top: 1px solid var(--line);
    background: #f7f4ebf5;
    box-shadow: 0 -8px 24px #293d340d;
    backdrop-filter: blur(12px);
  }

  .site-header .nav-link,
  .site-header .wishlist-button {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 0;
    min-height: 56px;
    padding: 4px 2px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    font-size: 10px;
    line-height: 1.2;
  }

  .site-header .nav-link[aria-current=page] {
    background: #e8eddf;
    text-decoration: none;
  }

  .site-header .wishlist-button > span:first-child {
    font-size: inherit;
    line-height: inherit;
  }

  .site-header .count-badge {
    position: absolute;
    top: 2px;
    left: calc(50% + 7px);
    width: 17px;
    height: 17px;
    line-height: 17px;
    font-size: 9px;
  }

  body.in-store .site-header nav {
    display: none;
  }

  .store {
    height: calc(100dvh - 72px);
  }
}
