/* 部品（DESIGN.md の「部品のクラス名」）: ボタン（.btn--primary / --ghost / --dark）・切り替え（.seg）・タブ（.tabs）・
   チップ・罫で区切った行（.list-rows）・種類の札（.fmt）とステッカー（.sticker）・半券（.ticket）・座席番号の札（.seat-badge）・
   棚（.shelf）・節の見出し（.section-title）・メニュー・ダイアログ・お知らせ・立体の上のボタン。
   画面ごとの CSS はこれらを組み合わせ、同じものを作り直さない */

/* ---- ボタン（押すと少し縮む） */
.btn {
  height: 46px;
  padding: 0 20px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: var(--surface);
  font-family: var(--font-head);
  letter-spacing: var(--head-tracking);
  font-weight: 700;
  transition:
    transform 0.15s var(--ease-pop),
    box-shadow 0.15s,
    background 0.15s;
}

.btn:hover {
  border-color: var(--ink);
}

.btn:active {
  transform: scale(0.97);
}

/* 主役（赤）。.btn.primary は前からある書き方 */
.btn--primary,
.btn.primary {
  border-color: var(--red);
  background: var(--red);
  color: var(--text-on-dark);
  box-shadow: var(--shadow-accent);
}

.btn--primary:hover,
.btn.primary:hover {
  border-color: var(--red-ink);
  background: var(--red-ink);
}

/* 控えめ（枠だけ） */
.btn--ghost {
  border-color: var(--line-strong);
  background: transparent;
  color: var(--ink);
}

/* 墨（白い文字） */
.btn--dark {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--text-on-dark);
}

.btn--dark:hover {
  border-color: #000;
  background: #000;
}

.btn.wide {
  width: 100%;
}

/* ---- 切り替え（丸い枠の中で、選んだものだけ白く浮く。押されているものが .on） */
.seg {
  display: flex;
  gap: 2px;
  min-width: 0;
  padding: 3px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: var(--tint);
}

.seg button {
  flex: 1 0 auto;
  padding: 7px 14px;
  border: 0;
  border-radius: var(--radius-pill);
  background: none;
  color: var(--sub);
  font-size: 14px;
  white-space: nowrap;
  transition:
    background 0.18s,
    color 0.18s,
    transform 0.15s var(--ease-pop);
}

.seg button:hover {
  color: var(--ink);
}

.seg button:active {
  transform: scale(0.96);
}

.seg button.on {
  background: var(--surface);
  color: var(--accent-ink);
  font-weight: 500;
  box-shadow: var(--shadow);
}

/* 横にスクロールする切り替え（スクリーンのタブ） */
.seg-scroll {
  overflow-x: auto;
  overscroll-behavior-x: none;
  scrollbar-width: none;
}

.seg-scroll::-webkit-scrollbar {
  display: none;
}

.seg-scroll button {
  flex: 0 0 auto;
}

/* スクリーンのタブ: 番号の下に IMAX などを小さく */
.scr-switch {
  border-radius: var(--radius-xl);
}

.scr-switch button {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 48px;
  padding: 6px 12px;
  border-radius: var(--radius-lg);
  line-height: 1.3;
}

.scr-switch small {
  color: var(--sub);
  font-size: 10px;
  font-weight: 400;
}

/* ---- タブ（文字だけ。選んだものの下に赤い線） */
.tabs {
  display: flex;
  gap: 4px;
  min-width: 0;
  overflow-x: auto;
  /* 端まで来たら止める（iPhone で端からさらに引っぱると、列ごとずれて見える） */
  overscroll-behavior-x: none;
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

/* スマホ: 横にスクロールできることが分かるよう、右端を薄くする */
@media (max-width: 959.98px) {
  .tabs {
    padding-right: 28px;
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent);
  }
}

.tabs button {
  position: relative;
  flex: none;
  padding: 10px 12px 12px;
  border: 0;
  background: none;
  color: var(--sub);
  font-size: 14.5px;
  white-space: nowrap;
  transition: color 0.15s;
}

.tabs button::after {
  content: '';
  position: absolute;
  right: 10px;
  bottom: -1px;
  left: 10px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform 0.25s var(--ease-pop);
}

.tabs button:hover {
  color: var(--ink);
}

.tabs button.on {
  color: var(--ink);
  font-weight: 500;
}

.tabs button.on::after {
  transform: scaleX(1);
}

/* ---- 絞り込みのチップ（横に流れる） */
.chips {
  display: flex;
  gap: 8px;
  margin: 0 -2px;
  padding: 2px 2px 6px;
  overflow-x: auto;
  overscroll-behavior-x: none;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chips button {
  display: inline-flex;
  flex: none;
  align-items: baseline;
  gap: 6px;
  padding: 8px 15px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--tint);
  color: var(--ink);
  font-size: 14px;
  white-space: nowrap;
  transition:
    background 0.15s,
    transform 0.15s var(--ease-pop);
}

.chips button:hover {
  background: var(--line);
}

.chips button:active {
  transform: scale(0.95);
}

.chips button small {
  color: var(--sub);
  font-family: var(--font-num);
  font-size: 11.5px;
}

.chips button.on {
  background: var(--accent);
  color: var(--text-on-dark);
}

.chips button.on small {
  color: var(--on-dark-muted);
}

.chips.small button {
  padding: 6px 13px;
  font-size: 12.5px;
}

/* ---- 罫で区切った行（.list-rows。映画館・スクリーンの一覧の .list も同じ）: 枠を付けず、細い線で区切る */
.list-rows,
.list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.list-rows > li + li,
.list li + li {
  border-top: 1px solid var(--line);
}

.list button {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 2px 12px;
  width: 100%;
  padding: 13px 4px;
  border: 0;
  border-radius: var(--radius-md);
  background: none;
  text-align: left;
  transition: background 0.15s;
}

.list button:hover {
  background: var(--accent-tint);
}

.list .nm {
  min-width: 0;
  font-weight: 500;
}

.list .mt {
  grid-column: 1;
  min-width: 0;
  color: var(--sub);
  font-size: 12.5px;
}

.list .mt .fmt {
  margin: 0 2px 0 4px;
}

.list .rt {
  grid-row: 1 / span 2;
  grid-column: 2;
  color: var(--sub);
  font-size: 11.5px;
  text-align: right;
  white-space: nowrap;
}

.list .rt b {
  display: block;
  color: var(--ink);
  font-family: var(--font-num);
  font-size: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

/* 都道府県の一覧も同じ行の並び（以前の「カード」は使わない） */
.list.cards .nm {
  font-size: 16px;
}

/* ---- スクリーンの種類: 小さな札（.fmt）と、ひとまわり大きい札（.sticker）。data-k で種類ごとの色
   （IMAX=空色・Dolby=墨・ScreenX=黄・4DX と MX4D=赤・ほかは淡い空色。キーは ui/fmt.js の formatColorKey） */
.fmt,
.sticker {
  display: inline-block;
  background: var(--tint);
  color: var(--ink);
  font-family: var(--font-num);
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.fmt {
  margin-right: 4px;
  padding: 0 6px;
  border-radius: var(--radius-xs);
  font-size: 11px;
  line-height: 1.7;
  vertical-align: 1px;
}

.sticker {
  padding: 3px 9px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
}

:is(.fmt, .sticker)[data-k='imax'] {
  background: var(--fmt-imax);
  color: var(--fmt-imax-ink);
}

:is(.fmt, .sticker):is([data-k='dolby-cinema'], [data-k='dolby-atmos']) {
  background: var(--fmt-dolby);
  color: var(--fmt-dolby-ink);
}

:is(.fmt, .sticker)[data-k='screenx'] {
  background: var(--fmt-screenx);
  color: var(--fmt-screenx-ink);
}

:is(.fmt, .sticker):is([data-k='4dx'], [data-k='mx4d']) {
  background: var(--fmt-4d);
  color: var(--fmt-4d-ink);
}

:is(.fmt, .sticker):is([data-k='ultira'], [data-k='bestia']) {
  background: var(--fmt-other);
  color: var(--fmt-other-ink);
}

/* ---- 座席番号の札（「K 12」。上辺が背もたれのように丸い） */
.seat-badge {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3em;
  padding: 3px 10px 2px;
  border-radius: 10px 10px 4px 4px;
  background: var(--red-soft);
  color: var(--red-ink);
  font-family: var(--font-num);
  font-size: 14px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
  letter-spacing: 0;
  white-space: nowrap;
}

.seat-badge--solid {
  background: var(--red);
  color: var(--text-on-dark);
}

/* ---- 節の見出し（飾りは付けず、太い文字と余白だけで区切る。後ろの <small> は件数など） */
.section-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 10px;
}

/* ---- 棚（.shelf）: スマホは横にスクロール、PC は並べる（列の数は --shelf-cols） */
.shelf {
  display: grid;
  grid-auto-columns: 74%;
  grid-auto-flow: column;
  gap: 14px;
  margin: 0 calc(-1 * var(--gutter-right)) 0 calc(-1 * var(--gutter-left));
  padding: 6px var(--gutter-right) 12px var(--gutter-left);
  overflow-x: auto;
  overscroll-behavior-x: none;
  scroll-padding-left: var(--gutter-left);
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  list-style: none;
}

.shelf::-webkit-scrollbar {
  display: none;
}

.shelf > li {
  min-width: 0;
  scroll-snap-align: start;
}

@media (min-width: 960px) {
  .shelf {
    grid-template-columns: repeat(var(--shelf-cols, 3), minmax(0, 1fr));
    grid-auto-flow: row;
    gap: 28px 24px;
    margin: 0;
    padding: 8px 0 0;
    overflow: visible;
  }

  /* PC でも横に流す棚（ポスター） */
  .shelf.shelf--scroll {
    grid-template-columns: none;
    grid-auto-flow: column;
    padding-bottom: 12px;
    overflow-x: auto;
  }
}

/* ---- チケット（左右に切り欠き、左に小さな札、点線のミシン目） */
.ticket {
  --notch: 7px;
  display: inline-flex;
  align-items: stretch;
  min-width: 0;
  border-radius: var(--radius-md);
  background: var(--pop-yellow);
  color: var(--ink);
  -webkit-mask:
    radial-gradient(circle var(--notch) at 0 50%, #0000 97%, #000) left / 51% 100% no-repeat,
    radial-gradient(circle var(--notch) at 100% 50%, #0000 97%, #000) right / 51% 100% no-repeat;
  mask:
    radial-gradient(circle var(--notch) at 0 50%, #0000 97%, #000) left / 51% 100% no-repeat,
    radial-gradient(circle var(--notch) at 100% 50%, #0000 97%, #000) right / 51% 100% no-repeat;
}

.ticket-tag {
  display: grid;
  place-items: center;
  padding: 0 10px 0 14px;
  border-right: 2px dashed rgba(20, 22, 28, 0.28);
  font-family: var(--font-num);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}

.ticket-main {
  overflow: hidden;
  padding: 6px 16px 6px 12px;
  font-family: var(--font-head);
  letter-spacing: var(--head-tracking);
  font-weight: 700;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ---- メニュー（右から出るパネル） */
.menu {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  justify-content: flex-end;
  background: var(--backdrop-light);
}

.menu-panel {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: min(86vw, 360px);
  height: 100%;
  overflow: auto;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px calc(24px + env(safe-area-inset-bottom, 0px));
  border-radius: var(--radius-3xl) 0 0 var(--radius-3xl);
  background: var(--surface);
  animation: slide-in-right 0.25s var(--ease-out);
}

.menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 2px 8px;
}

.menu-head b {
  font-family: var(--font-head);
  letter-spacing: var(--head-tracking);
  font-size: 16px;
  font-weight: 700;
}

.menu-x {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--tint);
  font-size: 22px;
  line-height: 1;
}

.menu-item {
  display: block;
  padding: 12px 8px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-family: var(--font-head);
  letter-spacing: var(--head-tracking);
  font-size: 16px;
  font-weight: 500;
  text-decoration: none;
}

.menu-item:active,
.menu-item:hover {
  color: var(--accent-ink);
}

.menu-item.sm {
  padding: 10px 4px;
  border-bottom: 0;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
}

.menu-sec {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.menu-sec > span {
  color: var(--sub);
  font-size: 12px;
  font-weight: 500;
}

.menu-regions,
.menu-langs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.menu-regions button,
.menu-langs button {
  padding: 9px 4px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--tint);
  font-size: 13px;
}

.menu-regions button.on,
.menu-langs button[aria-pressed='true'] {
  background: var(--accent);
  color: var(--text-on-dark);
  font-weight: 500;
}

/* 言語の切り替えはメニューのいちばん下 */
.menu-lang {
  border-bottom: 0;
}

.menu-prefs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  padding: 2px 4px;
}

.menu-prefs:empty {
  display: none;
}

.menu-pref {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 6px 0;
  color: var(--ink);
  font-size: 14px;
  text-decoration: none;
}

.menu-pref small {
  color: var(--sub);
  font-family: var(--font-num);
  font-size: 11.5px;
}

/* ---- ダイアログ（シェア・推し席診断） */
.modal {
  position: fixed;
  inset: 0;
  z-index: 65;
  display: grid;
  place-items: center;
  padding: 16px;
  background: var(--backdrop);
}

.modal-box {
  position: relative;
  width: min(440px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 24px 20px 20px;
  border-radius: var(--radius-3xl);
  background: var(--surface);
  animation: pop-in 0.3s var(--ease-pop);
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* 右上の × と重ならないよう、最初の行は右をあける */
.modal-body > :first-child {
  padding-right: 44px;
}

.modal-body h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.45;
}

.modal-x {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--tint);
  font-size: 20px;
  transition: transform 0.15s var(--ease-pop);
}

.modal-x:hover {
  transform: rotate(90deg);
}

/* ダイアログの下のボタンの並び */
.share-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.share-row .btn {
  display: inline-flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  height: 46px;
  padding: 0 14px;
  color: inherit;
  font-size: 14px;
  white-space: nowrap;
  text-decoration: none;
}

.share-row .btn.primary {
  flex-basis: 100%;
  color: var(--text-on-dark);
}

.share-img {
  display: block;
  width: 100%;
  border-radius: var(--radius-lg);
}

/* ---- 下に出るお知らせ */
.toast {
  position: fixed;
  bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  z-index: 80;
  max-width: calc(100vw - 32px);
  padding: 12px 20px;
  border-radius: var(--radius-pill);
  background: var(--ink);
  color: var(--text-on-dark);
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  box-shadow: var(--shadow-toast);
  transform: translateX(-50%);
}

.toast.show {
  animation: toast-in 0.35s var(--ease-pop);
}

/* ---- 立体の上に重ねる部品（見え方の画面） */
.stage-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--overlay-line);
  border-radius: var(--radius-pill);
  background: var(--overlay);
  color: var(--overlay-ink);
  font-size: 12px;
  transition: transform 0.15s var(--ease-pop);
}

.stage-btn:active {
  transform: scale(0.95);
}

.stage-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stage-btn svg .fill {
  fill: currentColor;
  stroke: none;
}

/* 「〇〇から」の札（暗い立体の上に置く、小さなチケット） */
.pill {
  position: absolute;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 16px;
  border-radius: var(--radius-sm);
  background: var(--pop-yellow);
  color: var(--ink);
  font-family: var(--font-head);
  letter-spacing: var(--head-tracking);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
  -webkit-mask:
    radial-gradient(circle 5px at 0 50%, #0000 97%, #000) left / 51% 100% no-repeat,
    radial-gradient(circle 5px at 100% 50%, #0000 97%, #000) right / 51% 100% no-repeat;
  mask:
    radial-gradient(circle 5px at 0 50%, #0000 97%, #000) left / 51% 100% no-repeat,
    radial-gradient(circle 5px at 100% 50%, #0000 97%, #000) right / 51% 100% no-repeat;
}
