:root {
  /* 背景の茶色 */
  --bg-light: #8a6658;
  --bg-mid: #5a3f37;
  --bg-dark: #2f2320;
  /* 文字とアクセント */
  --cream: #fbf3e6;
  --cream-dim: rgba(251, 243, 230, 0.72);
  --champagne: #ecd3a0;
  --gold: #f0c869;
  --peach: #eab893;
  --cocoa: #33211b;
  /* すりガラス風の面 */
  --glass: rgba(34, 23, 20, 0.46);
  --glass-strong: rgba(26, 17, 15, 0.62);
  --glass-line: rgba(255, 238, 214, 0.24);
  --shadow: 0 10px 28px rgba(18, 10, 8, 0.32);
  --radius: 14px;
  /* ボタンを画面の下端から持ち上げる量 */
  --lift: 60px;
  /* 画面の端からの余白 */
  --edge-top: calc(env(safe-area-inset-top) + 24px);
  --edge-side: 20px;
  --edge-bottom: calc(env(safe-area-inset-bottom) + 16px);

  /* 設定画面（従来のデザインのまま） */
  --line: #f4efe9;
  --panel: rgba(52, 36, 32, 0.8);
  --panel-strong: rgba(40, 28, 25, 0.92);
  --rose: #b0756d;
}

* {
  box-sizing: border-box;
}

/* スマホで長押ししたときの文字選択・虫眼鏡・保存メニューを出さない（iPhone は要素ごとに指定が要る） */
*,
*::before,
*::after {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

img,
svg,
canvas {
  -webkit-user-drag: none;
}

/* ダブルタップでの拡大を止める */
html,
body,
button,
a,
label {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  color: var(--cream);
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

/* 左上から柔らかい光が差す、マットな茶色の背景。細かな粒子と周辺の陰りで質感を出す */
body {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.5 0 0 0 0 0.4 0 0 0 0 0.35 0 0 0 0.09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    radial-gradient(120% 90% at 50% 45%, rgba(0, 0, 0, 0) 55%, rgba(12, 7, 5, 0.38) 100%),
    radial-gradient(90% 55% at 0% 0%, rgba(255, 228, 186, 0.42), rgba(255, 228, 186, 0) 70%),
    radial-gradient(130% 95% at 50% 38%, var(--bg-light) 0%, var(--bg-mid) 55%, var(--bg-dark) 100%);
  background-color: var(--bg-mid);
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

#stage {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* ---- 完成演出 ---- */

/* 背景を暗く落とす（3D より奥） */
#dim {
  position: fixed;
  inset: 0;
  background: #070504;
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

/* カットごとの色味。写真の色を壊さないようソフトライトで薄く重ねる */
#grade {
  --grade: 255, 255, 255;
  position: fixed;
  inset: 0;
  background: rgb(var(--grade));
  mix-blend-mode: soft-light;
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

#vignette {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse 75% 65% at 50% 50%, rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, 0.7) 100%);
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

/* 白い閃光。強さは --fx-flash で変える */
#flash {
  position: fixed;
  inset: 0;
  background: #fff6e6;
  opacity: 0;
  pointer-events: none;
}

#flash.on {
  animation: flash var(--fx-time, 0.4s) cubic-bezier(0.1, 0.6, 0.3, 1) both;
}

@keyframes flash {
  from {
    opacity: var(--fx-flash, 0.8);
  }
  to {
    opacity: 0;
  }
}

/* 上下の黒帯 */
#letterbox i {
  position: fixed;
  left: 0;
  right: 0;
  height: 11vh;
  background: #000;
  transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
  pointer-events: none;
}

#letterbox i:first-child {
  top: 0;
  transform: translateY(-100%);
}

#letterbox i:last-child {
  bottom: 0;
  transform: translateY(100%);
}

body.cinema #dim {
  opacity: 0.82;
}

/* 目隠しモードのプレイ中は、持っているパーツ以外を真っ暗にする */
body.blind #dim {
  opacity: 1;
  transition: none;
}

body.cinema #grade {
  opacity: 0.5;
}

body.cinema #vignette {
  opacity: 1;
}

body.cinema #letterbox i {
  transform: none;
}

/* 強い一撃までは色を抜く */
/* 画面の色調。カット切り替えのブラーなどはこの上に重ねる */
#stage {
  --tone: brightness(1);
}

#stage.mono {
  --tone: grayscale(1) contrast(1.12);
  filter: var(--tone);
}

/* カットの切り替わり：一瞬強いブラーをかけ、わずかに寄った画からすぐ戻す */
#stage.cut {
  animation: cut 0.28s cubic-bezier(0.15, 0.7, 0.3, 1);
}

@keyframes cut {
  from {
    filter: var(--tone) blur(12px);
    transform: scale(1.05);
  }
  to {
    filter: var(--tone) blur(0);
    transform: none;
  }
}

/* 完成画に着地した瞬間に走る光の筋 */
#sheen {
  position: fixed;
  inset: 0;
  background: linear-gradient(115deg, rgba(255, 255, 255, 0) 35%, rgba(255, 244, 220, 0.55) 50%, rgba(255, 255, 255, 0) 65%);
  background-size: 300% 100%;
  background-position: 100% 0;
  mix-blend-mode: overlay;
  opacity: 0;
  pointer-events: none;
}

#sheen.on {
  animation: sheen 0.9s cubic-bezier(0.3, 0, 0.2, 1);
}

@keyframes sheen {
  from {
    background-position: 100% 0;
    opacity: 1;
  }
  to {
    background-position: 0% 0;
    opacity: 1;
  }
}

/* 強い一撃で一瞬だけ露出を上げる */
#stage.punch {
  animation: punch 0.45s cubic-bezier(0.15, 0.7, 0.3, 1);
}

@keyframes punch {
  from {
    filter: var(--tone) brightness(1.7) contrast(1.15) blur(14px);
    transform: scale(1.07);
  }
  to {
    filter: var(--tone) brightness(1) contrast(1) blur(0);
    transform: none;
  }
}

/* 演出中のスキップ案内は下の黒帯の中に控えめに出す */
body.cinema #hint {
  bottom: calc(5.5vh - 10px);
  border-color: transparent;
  background: none;
  color: rgba(251, 243, 230, 0.45);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

/* ---- ボタン ---- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  min-height: 54px;
  padding: 12px 14px;
  border-radius: var(--radius);
  font: inherit;
  font-size: clamp(14px, 4.4vw, 17px);
  font-weight: 700;
  letter-spacing: 0.06em;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.12s ease, filter 0.12s ease;
}

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

/* X の投稿画面へのリンクもボタンと同じ見た目にする */
a.btn {
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.btn:focus-visible {
  outline: 2px solid var(--champagne);
  outline-offset: 3px;
}

.btn .icon {
  flex: none;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* 主な操作：つや消しのシャンパンゴールド */
.btn-primary {
  border: 1px solid rgba(255, 248, 232, 0.55);
  background: linear-gradient(180deg, #f1dcb0 0%, #e4c48c 100%);
  box-shadow: var(--shadow), inset 0 -2px 0 rgba(120, 80, 40, 0.18);
  color: var(--cocoa);
}

.btn-primary:active {
  filter: brightness(0.94);
}

/* そのほかの操作：すりガラス */
.btn-glass {
  border: 1px solid var(--glass-line);
  background: var(--glass);
  box-shadow: var(--shadow);
  color: var(--cream);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  backdrop-filter: blur(12px) saturate(1.2);
}

.btn-glass:active {
  background: var(--glass-strong);
}

.btn-main {
  min-height: 68px;
  font-size: clamp(24px, 7vw, 32px);
  font-weight: 800;
  letter-spacing: 0.1em;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
  max-width: 420px;
}

.actions .btn-main,
.actions .btn-wide {
  grid-column: 1 / -1;
}

/* ---- HUD ---- */

#hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--edge-top) var(--edge-side) 0;
  pointer-events: none;
}

.hud-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid var(--glass-line);
  border-radius: 999px;
  background: var(--glass);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  backdrop-filter: blur(12px) saturate(1.2);
}

/* 置いたパーツの数を点で見せる */
#hud-dots {
  display: flex;
  gap: 7px;
}

#hud-dots i {
  width: 9px;
  height: 9px;
  border: 1.5px solid rgba(251, 243, 230, 0.45);
  border-radius: 50%;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}

#hud-dots i.done {
  border-color: var(--champagne);
  background: var(--champagne);
}

#hud-dots i.now {
  border-color: var(--champagne);
  transform: scale(1.25);
}

/* いま落とすパーツ。点の並びの右に区切り線を挟んで置く */
.hud-part {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-left: 4px;
  padding-left: 12px;
  border-left: 1px solid var(--glass-line);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

/* 一時停止ボタン。HUD の中で、これだけは押せる */
.hud-pause {
  justify-content: center;
  width: 44px;
  min-height: 44px;
  padding: 0;
  color: var(--cream);
  font: inherit;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
}

.hud-pause:active {
  transform: scale(0.94);
}

.hud-pause .icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
}

.hud-part small {
  color: var(--cream-dim);
  font-size: 11px;
  font-weight: 600;
}

#hint {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 28px);
  margin: 0;
  padding: 8px 18px;
  border: 1px solid var(--glass-line);
  border-radius: 999px;
  background: var(--glass);
  color: var(--cream-dim);
  font-size: clamp(11px, 3.4vw, 13px);
  font-weight: 600;
  letter-spacing: 0.08em;
  white-space: nowrap;
  transform: translateX(-50%);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  pointer-events: none;
}

/* ---- 画面共通 ---- */

.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: var(--edge-top) var(--edge-side) var(--edge-bottom);
  text-align: center;
  pointer-events: none;
}

.overlay > * {
  pointer-events: auto;
}

/* ---- タイトル ---- */

#title-screen {
  transition: opacity 0.3s ease;
}

#title-screen.leaving {
  opacity: 0;
}

#title-screen.leaving > * {
  pointer-events: none;
}

#title-logo {
  margin: 0;
  width: min(100%, 560px);
  pointer-events: none;
}

#title-logo img {
  display: block;
  width: 100%;
  height: auto;
}

.title-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.title-bottom .actions {
  margin-bottom: var(--lift);
}

#credit {
  align-self: flex-end;
  margin: 0;
  color: var(--cream-dim);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.08em;
  text-align: right;
}

/* 作者の X へのリンク。指で押しやすいよう、見た目より押せる範囲を広げる */
#credit a {
  display: inline-block;
  margin: -8px -6px;
  padding: 8px 6px;
  color: inherit;
  text-decoration: underline;
  text-decoration-color: currentColor;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

#credit a:active {
  color: var(--cream);
}

/* ---- 結果 ---- */

/* 結果のシート。結果カードの画像と同じ構成で、真ん中の窓から後ろの 3D の完成画を見せる */
.sheet {
  --sheet-line: rgba(236, 211, 160, 0.38);
  --sheet-bg: rgba(30, 21, 18, 0.92);
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 460px;
  margin-bottom: 14px;
  border: 1px solid var(--sheet-line);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow);
  animation: fade-in 0.4s ease-out both;
}

/* 窓のまわりをシートの地の色で塗る（窓の中だけ透けて 3D が見える） */
.sheet-window {
  position: relative;
  flex: 1;
  min-height: 0;
  align-self: center;
  aspect-ratio: 540 / 600;
  max-width: calc(100% - 28px);
  outline: 1px solid var(--sheet-line);
  box-shadow: 0 0 0 4000px var(--sheet-bg);
}

.sheet-head,
.sheet-body {
  position: relative;
  z-index: 1;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px 10px;
}

.sheet-logo {
  display: block;
  height: 44px;
  width: auto;
  object-fit: cover;
  /* ロゴ画像の上下の透明な余白を切る */
  aspect-ratio: 686 / 254;
  object-position: 50% 52%;
}

.sheet-tags {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sheet-kind {
  white-space: nowrap;
  color: var(--cream-dim);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
}

/* 目隠しモードの印が出るときは、狭い画面では種類の表記を省く */
@media (max-width: 480px) {
  #result-mode:not([hidden]) + .sheet-kind {
    display: none;
  }
}

#result-mode {
  white-space: nowrap;
  margin: 0;
  padding: 4px 12px;
  border-radius: 999px;
  background: #c9473d;
  color: var(--cream);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.sheet-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 16px 14px;
}

#result-score {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 0;
  color: var(--cream);
}

#result-score .label {
  margin-right: 6px;
  color: var(--cream-dim);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3em;
}

#result-points {
  font-size: 30px;
  font-weight: 800;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

#result-score .unit {
  color: var(--cream-dim);
  font-size: 14px;
  font-weight: 700;
}

#result-rank {
  margin: 0;
  color: var(--gold);
  /* 称号は途中で折り返さず、1 行に収まる大きさにする */
  font-size: clamp(19px, 6.2vw, 32px);
  font-weight: 900;
  line-height: 1.25;
  letter-spacing: 0.04em;
  white-space: nowrap;
  text-shadow: 0 2px 16px rgba(240, 200, 105, 0.25);
}

#result-comment {
  margin: 2px 0 0;
  color: var(--peach);
  font-size: clamp(11px, 3.4vw, 15px);
  font-weight: 700;
  line-height: 1.55;
  letter-spacing: 0.04em;
  text-align: center;
}

/* 決めた位置以外では改行しない */
#result-comment .line {
  display: block;
  white-space: nowrap;
}

/* パーツごとの一致度。2 列に並べる */
.sheet-parts {
  width: 100%;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--sheet-line);
}

.sheet-caption {
  margin: 0 0 4px;
  color: var(--cream-dim);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-align: left;
}

#result-parts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}

#result-parts li {
  display: grid;
  grid-template-columns: 2.3em 1fr 2.6em;
  align-items: center;
  gap: 6px;
  color: var(--cream);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
}

#result-parts .bar {
  height: 5px;
  border-radius: 3px;
  background: rgba(251, 243, 230, 0.12);
  overflow: hidden;
}

#result-parts .bar i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 3px;
  background: var(--gold);
  transition: width 0.7s 0.1s cubic-bezier(0.2, 0.8, 0.2, 1);
}

#result-parts .pct {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* 点数を数え上げている間は称号・コメント・一致度を隠し、止まったら出す */
#result-rank,
#result-comment,
.sheet-parts {
  visibility: hidden;
}

#result-band.revealed #result-rank,
#result-band.revealed #result-comment,
#result-band.revealed .sheet-parts {
  visibility: visible;
}

#result-band.revealed #result-rank {
  animation: rank-pop 0.45s cubic-bezier(0.2, 1.5, 0.4, 1) both;
}

#result-band.revealed #result-comment,
#result-band.revealed .sheet-parts {
  animation: fade-in 0.4s 0.15s ease-out both;
}

#result-band.revealed #result-parts .bar i {
  width: var(--p);
}

@keyframes rank-pop {
  from {
    transform: scale(1.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

#result-actions,
#save-choice {
  margin-bottom: var(--lift);
}

#save-choice {
  animation: notice-in 0.25s cubic-bezier(0.2, 1.3, 0.4, 1) both;
}

/* 縦が短い画面では一致度を詰める */
@media (max-height: 720px) {
  .sheet-parts {
    margin-top: 6px;
    padding-top: 4px;
  }

  #result-parts li {
    font-size: 11px;
    line-height: 1.35;
  }

  #result-points {
    font-size: 26px;
  }
}

/* さらに縦が短い画面（X などのアプリ内ブラウザを半分の高さで開いたときなど）では、
   完成画の窓が潰れないよう、見出し・ボタン・余白を詰める */
@media (max-height: 640px) {
  #result-screen {
    padding-top: calc(env(safe-area-inset-top) + 10px);
  }

  #result-screen .sheet {
    margin-bottom: 10px;
  }

  .sheet-head {
    padding: 8px 14px 4px;
  }

  .sheet-logo {
    height: 30px;
  }

  #result-actions,
  #save-choice {
    gap: 8px;
    margin-bottom: 12px;
  }

  #result-actions .btn,
  #save-choice .btn {
    min-height: 42px;
    padding: 8px 12px;
  }
}

/* 縦長でそれより短い画面では、一致度を省く（保存する結果カードには載っている） */
@media (max-height: 560px) and (max-aspect-ratio: 4 / 3) {
  .sheet-parts {
    display: none;
  }
}

/* 横長の画面では、結果カードと同じく左に完成画、右に評価を並べ、ボタンを 1 列にする */
@media (min-aspect-ratio: 4 / 3) {
  .sheet {
    display: grid;
    grid-template-columns: auto minmax(280px, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    max-width: 920px;
  }

  .sheet-head {
    grid-column: 1 / -1;
  }

  .sheet-window {
    height: calc(100% - 16px);
    max-width: none;
    margin: 0 0 16px 16px;
    align-self: start;
  }

  .sheet-body {
    justify-content: center;
    padding: 0 28px 16px;
  }

  #result-actions {
    grid-template-columns: repeat(4, 1fr);
    max-width: 760px;
  }
}

/* 完成画を拡大して見られることを示す印。完成画の下のほうに重ねる */
#result-window {
  cursor: zoom-in;
}

.zoom-hint {
  position: absolute;
  left: 50%;
  bottom: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px 4px 8px;
  border: 1px solid var(--glass-line);
  border-radius: 999px;
  background: rgba(26, 17, 15, 0.66);
  color: var(--cream-dim);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  white-space: nowrap;
  transform: translateX(-50%);
  pointer-events: none;
}

.zoom-hint .icon {
  flex: none;
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
}

/* 拡大表示。画面全体で指の動きを受ける */
#viewer {
  position: fixed;
  inset: 0;
  touch-action: none;
  cursor: grab;
  animation: fade-in 0.3s ease-out both;
}

#viewer:active {
  cursor: grabbing;
}

#viewer-hint {
  position: absolute;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 28px);
  margin: 0;
  padding: 8px 18px;
  border: 1px solid var(--glass-line);
  border-radius: 999px;
  background: var(--glass);
  color: var(--cream-dim);
  font-size: clamp(11px, 3.4vw, 13px);
  font-weight: 600;
  letter-spacing: 0.08em;
  white-space: nowrap;
  transform: translateX(-50%);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  pointer-events: none;
}

/* 下から弾むように出す */
@keyframes notice-in {
  from {
    opacity: 0;
    translate: 0 12px;
  }
  to {
    opacity: 1;
    translate: 0 0;
  }
}

/* ---- モード選択 ---- */

.mode-heading {
  grid-column: 1 / -1;
  margin: 0 0 2px;
  color: var(--cream-dim);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3em;
}

.btn-mode {
  min-height: 60px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.btn-blind {
  border-color: rgba(201, 71, 61, 0.7);
}

.btn-text {
  grid-column: 1 / -1;
  justify-self: center;
  padding: 8px 20px;
  border: 0;
  background: none;
  color: var(--cream-dim);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.1em;
  cursor: pointer;
}

#mode-select {
  animation: notice-in 0.3s cubic-bezier(0.2, 1.3, 0.4, 1) both;
}

/* 縦が短い画面では持ち上げる量を控えめにする */
@media (max-height: 700px) {
  :root {
    --lift: 36px;
  }
}

/* ---- 設定（従来のデザインのまま） ---- */

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(20, 14, 12, 0.6);
}

.modal-panel {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: min(100%, 360px);
  padding: 20px 20px 16px;
  border: 3px solid var(--line);
  border-radius: 4px;
  background: #3e2c27;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.modal-panel h2 {
  margin: 0 0 8px;
  font-size: 24px;
  text-align: center;
}

.btn-classic {
  margin-top: 12px;
  padding: 12px 10px;
  border: 3px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  color: #fff;
  font: inherit;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
  touch-action: manipulation;
}

.btn-classic:active {
  transform: translateY(2px);
  background: var(--panel-strong);
}

.toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid rgba(244, 239, 233, 0.2);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
}

.toggle small {
  display: block;
  font-size: 12px;
  font-weight: 400;
  opacity: 0.75;
}

.toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* スイッチ */
.toggle i {
  position: relative;
  flex: none;
  width: 52px;
  height: 30px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.25);
  transition: background 0.15s;
}

.toggle i::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--line);
  transition: transform 0.15s;
}

.toggle input:checked + i {
  background: var(--rose);
}

.toggle input:checked + i::after {
  transform: translateX(22px);
}

.toggle input:disabled + i {
  opacity: 0.4;
}

.toggle input:focus-visible + i {
  outline: 2px solid #fff;
  outline-offset: 2px;
}
