* {
  box-sizing: border-box;
}

html {
  /* 連打でズームさせない(iPhone対策)。ピンチズームは残す。 */
  touch-action: manipulation;
}

:root {
  --cream: #fff6e5;
  --cream-deep: #f7e6c8;
  --wood: #c8925a;
  --wood-soft: #e2c39b;
  --wood-deep: #8b5a2b;
  --ink: #4a3423;
  --ink-soft: #7d6450;
  --tomato: #e2574c;
  --tomato-bg: #fbe3df;
  --leaf: #6f9a5c;
  --leaf-deep: #4f7742;
  --leaf-bg: #e8f1e1;
  --butter: #ffd66b;
  --butter-bg: #fff2c4;
  --white: #fffdf8;
  --font-rounded: "Zen Maru Gothic", -apple-system, "Hiragino Sans", "Yu Gothic", sans-serif;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-rounded);
  background: var(--cream);
  color: var(--ink);
  padding-bottom: 92px; /* 常時表示フッターの高さぶん確保する */
}

button {
  font-family: inherit;
}

.hidden {
  display: none !important;
}

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

/* .screen は min-height なので伸びる(align-items:center を fixed 全面の箱に使わない)。 */
.screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px 16px;
}

.panel {
  width: 100%;
  max-width: 640px;
  background: var(--white);
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 8px 24px rgba(74, 52, 35, 0.12);
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 14px;
  margin-top: 8px;
  border: none;
  border-radius: 999px;
  background: var(--tomato);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.primary-button:hover {
  background: #c9463c;
}

.primary-button:disabled {
  opacity: 0.5;
  cursor: default;
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 20px;
  margin-top: 12px;
  border: 2px solid var(--wood-soft);
  border-radius: 999px;
  background: #ffffff;
  color: var(--wood-deep);
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
}

.secondary-button:hover {
  border-color: var(--wood);
  background: var(--cream);
}

.secondary-button:disabled {
  opacity: 0.4;
  cursor: default;
  background: #ffffff;
  border-color: var(--wood-soft);
}

/* ---- 参加画面 --------------------------------------------------------- */

.join-panel {
  text-align: center;
}

.hero-quokka {
  width: 120px;
  height: 120px;
  margin: 0 auto 8px;
}

.game-title {
  margin: 0 0 4px;
  font-size: 24px;
}

.catch-copy {
  margin: 0 0 20px;
  color: var(--ink-soft);
  font-size: 14px;
}

.field {
  display: block;
  text-align: left;
  margin-bottom: 12px;
}

.field span {
  display: block;
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 4px;
}

.field input {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--wood-soft);
  border-radius: 12px;
  font-size: 16px;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
}

.join-notice {
  background: var(--butter-bg);
  border: 2px solid var(--wood-soft);
  border-radius: 12px;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.7;
  margin: 0 0 12px;
  padding: 10px 12px;
  text-align: left;
}

.link-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 16px 0;
}

.rules-link,
.link-row .home-link,
.share-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border: 2px solid var(--wood-soft);
  border-radius: 999px;
  background: #ffffff;
  color: var(--wood-deep);
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
}

.rules-link:hover,
.link-row .home-link:hover,
.share-button:hover {
  border-color: var(--wood);
  background: var(--cream);
}

@media (max-height: 700px) {
  .hero-quokka {
    width: 64px;
    height: 64px;
    margin-bottom: 4px;
  }
  .game-title {
    font-size: 20px;
  }
  .catch-copy {
    margin-bottom: 10px;
    font-size: 12px;
  }
  .screen {
    padding-top: 12px;
  }
  .panel {
    padding: 16px;
  }
  .link-row {
    margin: 10px 0;
  }
}

@media (max-height: 560px) {
  .hero-quokka {
    width: 48px;
    height: 48px;
    margin-bottom: 2px;
  }
  .catch-copy {
    display: none;
  }
  .screen {
    padding-top: 8px;
  }
}

/* ランキング: シリーズ共通のクラス構造(.ranking-row / .ranking-rank / .ranking-name / .ranking-value) */
.ranking-groups {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.ranking-group {
  background: var(--cream);
  border: 2px solid var(--wood-soft);
  border-radius: 14px;
  padding: 12px 14px;
  text-align: left;
}

.ranking-group-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--wood-deep);
  margin-bottom: 6px;
}

.ranking-group-sub {
  display: block;
  font-size: 10px;
  font-weight: 500;
  color: var(--ink-soft);
}

.ranking-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 3px 0;
  border-bottom: 1px dashed var(--wood-soft);
}

.ranking-row:last-child {
  border-bottom: none;
}

.ranking-rank {
  width: 22px;
  flex-shrink: 0;
  text-align: center;
  color: var(--ink-soft);
}

.ranking-name {
  flex: 1;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranking-value {
  font-weight: 800;
  color: var(--wood-deep);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.ranking-empty {
  color: var(--ink-soft);
  font-size: 12px;
  padding: 4px 0;
}

/* ---- 難易度選択 ---------------------------------------------------------- */

.mode-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 12px 0;
}

.mode-option {
  border: 2px solid var(--wood-soft);
  border-radius: 14px;
  background: #fff;
  padding: 10px 6px;
  cursor: pointer;
  text-align: center;
  font-family: inherit;
  color: var(--ink);
}

.mode-option .mode-name {
  display: block;
  font-size: 13px;
  font-weight: 800;
}

.mode-option .mode-sub {
  display: block;
  font-size: 11px;
  color: var(--ink-soft);
  margin-top: 4px;
}

.mode-option.active {
  border-color: var(--tomato);
  background: var(--tomato-bg);
  box-shadow: 0 0 8px rgba(226, 87, 76, 0.3);
}

.difficulty-choice-panel h2 {
  margin-top: 0;
}

.difficulty-note {
  font-size: 12px;
  color: var(--ink-soft);
  margin: 4px 0 8px;
  line-height: 1.6;
}

/* ---- 営業日画面 ------------------------------------------------------- */

#game-screen {
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
  padding-top: 12px;
}

.hud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-bottom: 10px;
  width: 100%;
  /* 右上に固定表示している音量ボタン(🔊/⚙️を縦積み、幅36px+右余白)と重ならないよう右側に余白を確保する。 */
  padding-right: 64px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--white);
  border: 2px solid var(--wood-soft);
  font-size: 12px;
  white-space: nowrap;
}

/* HUDの数値は等幅数字にして、桁が変わっても隣のピルが動かないようにする(最大桁ぶんの min-width も併用)。 */
.pill strong {
  font-variant-numeric: tabular-nums;
  display: inline-block;
  text-align: right;
}

#v-cust-order,
#v-cust-total {
  min-width: 2ch;
}

#v-gauge,
#v-gauge-max {
  min-width: 3ch;
}

#v-score {
  min-width: 5ch;
}

/* 経過時間(決定事項25)。m:ss で最大 "99:59" を想定 */
#v-elapsed {
  min-width: 4ch;
}

.gauge-bar {
  display: inline-block;
  width: 44px;
  height: 8px;
  border-radius: 999px;
  background: var(--cream-deep);
  overflow: hidden;
  vertical-align: middle;
}

.gauge-fill {
  display: block;
  height: 100%;
  width: 0;
  background: var(--tomato);
  border-radius: 999px;
  transition: width 0.3s;
}

.game-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

/* 客カウンター(上段)。スマホ縦では sticky で固定し、下の作業エリアだけがスクロールする。 */
.counter {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--white);
  border: 2px solid var(--wood-soft);
  border-radius: 18px;
  padding: 10px 12px;
  box-shadow: 0 4px 12px rgba(74, 52, 35, 0.1);
}

.counter-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.counter-face {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border-radius: 999px;
  border: 2px solid var(--wood-soft);
  background: var(--cream);
  font-size: 38px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.counter-face:hover {
  border-color: var(--wood);
}

/* 客の顔と天気バッジをひとまとめに。天気は好みの抽選に効くので、顔のすぐそばに置く */
.counter-face-wrap {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.counter-weather {
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--cream);
  border: 1px solid var(--wood-soft);
  white-space: nowrap;
}

.bubble {
  position: relative;
  flex: 1;
  min-width: 0;
  background: #fff;
  border: 2px solid var(--wood-soft);
  border-radius: 16px;
  padding: 8px 12px;
  font-size: 14px;
  line-height: 1.5;
  min-height: 2.6em;
}

.bubble::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 18px;
  border: 6px solid transparent;
  border-right-color: var(--wood-soft);
  border-left: 0;
}

.bubble.pop {
  animation: bubble-pop 0.25s ease-out;
}

@keyframes bubble-pop {
  0% {
    transform: scale(0.94);
  }
  60% {
    transform: scale(1.03);
  }
  100% {
    transform: scale(1);
  }
}

.hint-slots {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.hint-slot {
  flex: 1 1 0;
  min-width: 70px;
  text-align: center;
  padding: 6px 8px;
  border-radius: 12px;
  border: 2px solid var(--wood-soft);
  background: var(--cream);
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
}

.hint-slot.empty {
  color: var(--ink-soft);
  border-style: dashed;
  background: transparent;
  font-weight: 700;
}

.hint-slot.revealed {
  background: var(--butter-bg);
  border-color: var(--butter);
  animation: hint-flip 0.35s ease-out;
}

.hint-slot.blurred {
  border-style: dotted;
  background: #fff;
}

.hint-slot.blurred::after {
  content: " たぶん";
  font-size: 10px;
  color: var(--ink-soft);
  font-weight: 500;
}

@keyframes hint-flip {
  0% {
    transform: rotateX(90deg);
  }
  100% {
    transform: rotateX(0);
  }
}

.dislike-line {
  margin: 8px 0 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--tomato);
}

/* 傾向と見た目(決定事項22): 見出しつきのカード2枚。傾向はチップ、見た目は吹き出し風の1行 */
.cust-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.info-card {
  border: 2px solid var(--wood-soft);
  border-radius: 12px;
  background: var(--cream);
  padding: 6px 10px 8px;
}

.info-title {
  font-size: 12px;
  font-weight: 900;
  color: var(--wood-deep);
  margin-bottom: 4px;
}

.info-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: 3px;
}

.info-label {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 800;
  line-height: 22px;
  width: 4.2em;
  color: var(--ink-soft);
}

.info-label.like {
  color: var(--leaf-deep);
}

.info-label.dislike {
  color: var(--tomato);
}

.info-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
}

.info-chip {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1.5px solid var(--leaf);
  background: var(--leaf-bg);
  color: var(--leaf-deep);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.3;
}

.info-chip.dislike {
  border-color: #f0b1aa;
  background: var(--tomato-bg);
  color: var(--tomato);
}

.info-cue {
  margin: 0;
  position: relative;
  background: #fff;
  border: 1.5px solid var(--wood-soft);
  border-radius: 12px;
  padding: 6px 10px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
}

.info-cue::before {
  content: "";
  position: absolute;
  left: 14px;
  top: -7px;
  border: 6px solid transparent;
  border-bottom-color: var(--wood-soft);
  border-top: 0;
}

/* 作業エリア(下段) */
.workarea {
  background: var(--white);
  border: 2px solid var(--wood-soft);
  border-radius: 18px;
  padding: 12px;
}

.steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin-bottom: 10px;
}

.step {
  border: 2px solid var(--wood-soft);
  border-radius: 10px;
  background: #fff;
  padding: 6px 2px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
  cursor: pointer;
}

.step.active {
  border-color: var(--tomato);
  background: var(--tomato-bg);
  color: var(--tomato);
}

.step.done {
  color: var(--leaf-deep);
  border-color: var(--leaf);
}

.hear-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 10px;
  margin-bottom: 10px;
  border: 2px solid var(--leaf);
  border-radius: 999px;
  background: var(--leaf-bg);
  color: var(--leaf-deep);
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
}

.hear-button:hover {
  background: #dbe9d1;
}

.hear-button.exhausted {
  border-color: var(--wood-soft);
  background: #fff;
  color: var(--ink-soft);
}

.hear-left {
  font-size: 12px;
  font-weight: 700;
}

/* 決定事項41: 客アイコンの真下に置くときは小さく畳む(横幅いっぱいにはしない) */
.counter-face-wrap .hear-button {
  width: auto;
  max-width: 108px;
  margin-bottom: 0;
  padding: 4px 8px;
  font-size: 11px;
  gap: 2px;
  flex-direction: column;
  line-height: 1.2;
}
.counter-face-wrap .hear-left {
  font-size: 9px;
}

.panel-help {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--ink-soft);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border: 2px solid var(--wood-soft);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  min-height: 44px;
}

.chip:hover {
  border-color: var(--wood);
  background: var(--cream);
}

.chip.selected {
  border-color: var(--tomato);
  background: var(--tomato-bg);
}

.chip:disabled {
  opacity: 0.45;
  cursor: default;
}

.chip .order {
  position: absolute;
  top: -8px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--tomato);
  color: #fff;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chip .chip-emoji {
  font-size: 18px;
  line-height: 1;
}

.stack-row,
.preview-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  min-width: 0;
}

.stack-label {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 800;
  color: var(--ink-soft);
  width: 3.2em;
}

.process-stack {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 4px 0;
  font-size: 13px;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
}

.stack-item {
  flex-shrink: 0;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--cream-deep);
  color: var(--ink);
}

.stack-empty {
  color: var(--ink-soft);
}

.undo-button {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 2px solid var(--wood-soft);
  background: #fff;
  color: var(--tomato);
  font-weight: 800;
  cursor: pointer;
}

.undo-button:disabled {
  opacity: 0.35;
  cursor: default;
}

.tag-preview {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tag {
  padding: 2px 8px;
  border-radius: 999px;
  border: 1.5px solid var(--wood-soft);
  background: #fff;
  font-size: 12px;
  color: var(--ink);
}

.tag.match {
  border-color: var(--leaf);
  background: var(--leaf-bg);
  color: var(--leaf-deep);
  font-weight: 800;
  box-shadow: 0 0 6px rgba(111, 154, 92, 0.5);
}

.tag.negative {
  border-color: var(--tomato);
  background: var(--tomato-bg);
  color: var(--tomato);
  font-weight: 800;
}

.tag.dislike {
  border-color: var(--tomato);
  color: var(--tomato);
  animation: dislike-blink 0.9s steps(2, start) infinite;
}

@keyframes dislike-blink {
  to {
    opacity: 0.5;
  }
}

.tag.origin::after {
  content: attr(data-origin);
  margin-left: 4px;
  font-size: 10px;
  color: var(--ink-soft);
  font-weight: 500;
}

.dish-name-preview {
  margin: 10px 0 0;
  font-size: 15px;
  font-weight: 800;
  color: var(--wood-deep);
  line-height: 1.5;
  /* 長い連結語は途中で折れてよい(2行まで想定) */
  overflow-wrap: anywhere;
}

.nav-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  align-items: center;
}

.nav-row .secondary-button {
  margin-top: 0;
  flex: 1;
}

.nav-row .primary-button {
  margin-top: 0;
  flex: 2;
}

.quit-button {
  display: flex;
  margin: 12px auto 0;
  font-size: 12px;
  padding: 6px 16px;
}

/* ---- 実食オーバーレイ・モーダル ---------------------------------------------- */

/* fixed全面の箱は align-items: flex-start + overflow-y:auto、カード側にも max-height + overflow-y:auto
   (中身が画面より高くなっても上端がスクロールで届くように)。 */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background: rgba(74, 52, 35, 0.45);
  padding: 16px;
  overflow-y: auto;
}

.modal-card {
  background: var(--white);
  border-radius: 24px;
  padding: 24px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  margin: auto 0;
}

.modal-overlay {
  z-index: 60;
}

.modal-title {
  margin: 0 0 8px;
  font-size: 18px;
}

.modal-message {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-soft);
}

.modal-buttons {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.modal-buttons .secondary-button {
  align-self: center;
}

/* ---- 加工ミニ操作(決定事項33): まな板/すり鉢/フライパン/フライヤー/鍋 ---- */
.mini-card {
  max-width: 340px;
  user-select: none;
}

.mini-title {
  margin: 0 0 10px;
  font-size: 16px;
}

.mini-stage {
  position: relative;
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 10px;
  touch-action: manipulation;
}

/* 決定事項39: 切る・つぶすは道具を持って動かすジェスチャー操作。ドラッグ中にスクロールが割り込まないよう固定する */
.mini-stage-cut,
.mini-stage-mash {
  touch-action: none;
  cursor: grab;
  border-radius: 14px;
  background: rgba(74, 52, 35, 0.04);
}
.mini-stage-cut:active,
.mini-stage-mash:active {
  cursor: grabbing;
}

.mini-tool {
  font-size: 40px;
  line-height: 1;
}

.mini-target {
  font-size: 52px;
  line-height: 1;
  transition: transform 0.12s ease-out;
}

.mini-stage-cut .mini-target,
.mini-stage-mash .mini-target {
  transform-origin: center;
}

.mini-progress {
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.mini-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--cream-deep);
  border: 2px solid var(--wood-soft);
  display: inline-block;
}

.mini-dot.good {
  background: var(--leaf);
  border-color: var(--leaf-deep);
}

.mini-dot.over {
  background: var(--tomato);
  border-color: var(--tomato);
}

.mini-group-count {
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-left: 6px;
}

.mini-timed-bar {
  position: relative;
  height: 18px;
  width: 100%;
  border-radius: 9px;
  background: linear-gradient(90deg, var(--cream-deep) 0%, var(--leaf-bg) 25%, var(--leaf-bg) 55%, var(--tomato-bg) 100%);
  overflow: hidden;
}

.mini-timed-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 0%;
  background: rgba(74, 52, 35, 0.55);
}

.mini-timed-fill.sweet {
  background: rgba(58, 140, 60, 0.7);
}

.mini-timed-fill.burnt {
  background: rgba(139, 42, 34, 0.75);
}

.mini-timed-mark {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 2px;
  background: var(--wood-deep);
}

.mini-status {
  margin: 0 0 10px;
  font-size: 13px;
  min-height: 18px;
  color: var(--ink-soft);
}

.mini-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.taste-face {
  font-size: 64px;
  line-height: 1;
  margin-bottom: 6px;
  transition: transform 0.2s;
}

.taste-face.reveal {
  animation: face-pop 0.4s ease-out;
}

@keyframes face-pop {
  0% {
    transform: scale(0.6);
  }
  70% {
    transform: scale(1.15);
  }
  100% {
    transform: scale(1);
  }
}

.taste-verdict {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 800;
}

.taste-dish-name {
  margin: 0 0 8px;
  font-size: 18px;
  color: var(--wood-deep);
  overflow-wrap: anywhere;
}

.taste-tags {
  justify-content: center;
  margin-bottom: 10px;
}

.taste-points {
  margin: 0;
  font-size: 22px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.taste-breakdown {
  margin: 2px 0 10px;
  font-size: 12px;
  color: var(--ink-soft);
}

.taste-wanted {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-bottom: 10px;
}

.taste-wanted .label {
  width: 100%;
  font-size: 12px;
  color: var(--ink-soft);
}

.taste-answer {
  background: var(--cream);
  border: 2px dashed var(--wood-soft);
  border-radius: 14px;
  padding: 10px 12px;
  margin-bottom: 10px;
  font-size: 13px;
  text-align: left;
  line-height: 1.6;
}

.taste-answer .answer-name {
  font-weight: 800;
  color: var(--wood-deep);
  overflow-wrap: anywhere;
}

/* ---- 結果画面 --------------------------------------------------------- */

.result-panel {
  text-align: center;
}

.result-total {
  font-size: 28px;
  margin: 8px 0;
  font-variant-numeric: tabular-nums;
}

.result-sub {
  color: var(--ink-soft);
  font-size: 13px;
}

.result-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 16px;
  font-size: 13px;
  margin: 8px 0;
}

.result-stats strong {
  font-variant-numeric: tabular-nums;
}

.result-customer-list {
  list-style: none;
  margin: 16px 0;
  padding: 0;
  text-align: left;
  font-size: 13px;
}

.result-customer-list li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border-bottom: 1px dashed var(--wood-soft);
}

.result-customer-list .dish {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.result-customer-list .pts {
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

/* ---- サウンドパネル ----------------------------------------------------- */

.sound-controls {
  position: fixed;
  top: 12px;
  /* iPhone横画面のノッチ側や端ぎりぎりで欠ける端末への配慮 */
  right: max(24px, env(safe-area-inset-right) + 10px);
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.mute-btn {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 2px solid var(--wood-soft);
  background: var(--white);
  font-size: 16px;
  cursor: pointer;
}

.mute-btn.settings-btn {
  width: 30px;
  height: 30px;
  font-size: 13px;
}

.sound-panel {
  position: absolute;
  top: 76px;
  right: 0;
  background: var(--white);
  border: 2px solid var(--wood-soft);
  border-radius: 16px;
  padding: 12px;
  width: 210px;
  box-shadow: 0 8px 20px rgba(74, 52, 35, 0.15);
}

.sound-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  margin-bottom: 8px;
}

/* ラベル("BGM"/"効果音")はスライダーに押されて縮むと日本語が縦積みになるので、縮めない・折り返さない。 */
.sound-row-label {
  flex-shrink: 0;
  white-space: nowrap;
}

.sound-row:last-child {
  margin-bottom: 0;
}

.sound-row input[type="range"] {
  flex: 1;
  min-width: 0;
}

.sound-mute-btn {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 14px;
  padding: 0;
}

.sound-row.hide-slider input[type="range"] {
  display: none;
}

/* ---- 常時表示フッター ---------------------------------------------------- */

.site-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 55;
  background: var(--white);
  border-top: 2px solid var(--wood-soft);
  padding: 6px 12px calc(6px + env(safe-area-inset-bottom));
  text-align: center;
  font-size: 11px;
  color: var(--ink-soft);
}

.site-footer a {
  color: var(--ink-soft);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--wood-deep);
}

.footer-links,
.footer-meta {
  margin: 2px 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px 4px;
}

.version-link {
  font-size: 10px;
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px dotted currentColor;
}

.version-link:hover {
  color: var(--wood-deep);
}

/* ---- 法務モーダル ------------------------------------------------------- */

.legal-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.legal-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(74, 52, 35, 0.5);
}

.legal-modal-body {
  position: relative;
  background: var(--white);
  border-radius: 16px;
  width: 100%;
  max-width: 640px;
  height: 80vh;
  padding: 12px;
}

.legal-modal-close {
  position: absolute;
  top: 8px;
  right: 8px;
  border: none;
  background: var(--cream);
  border-radius: 999px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  z-index: 1;
}

.legal-modal-body iframe {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 10px;
  background: #fff;
}

/* ---- 通信エラー -------------------------------------------------------- */

.disconnect-banner {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(74, 52, 35, 0.9);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  padding: 24px;
}

.disconnect-banner button {
  padding: 10px 20px;
  border-radius: 999px;
  border: none;
  background: var(--tomato);
  color: #fff;
  cursor: pointer;
  font-family: inherit;
}

/* ---- レスポンシブ: 900px以上は左右2カラム(客カウンター | 作業エリア) --------- */

@media (min-width: 900px) {
  /* 左カラム: 客カウンター(上)+ 傾向/見た目(下)。右カラム: 作業エリア(2行ぶん) */
  .game-body {
    display: grid;
    grid-template-columns: 340px minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    align-items: start;
  }
  .counter {
    position: static;
    grid-column: 1;
    grid-row: 1;
    width: 340px;
  }
  .cust-info {
    grid-column: 1;
    grid-row: 2;
  }
  .workarea {
    grid-column: 2;
    grid-row: 1 / 3;
  }
  .counter-top {
    flex-direction: column;
    align-items: stretch;
  }
  .counter-face {
    width: 96px;
    height: 96px;
    font-size: 60px;
    margin: 0 auto;
  }
  .counter-face-wrap {
    margin: 0 auto;
  }
  .counter-weather {
    font-size: 14px;
  }
  .bubble::before {
    left: 50%;
    top: -10px;
    margin-left: -6px;
    border: 6px solid transparent;
    border-bottom-color: var(--wood-soft);
    border-top: 0;
  }
  .workarea {
    flex: 1;
    min-width: 0;
  }
  .hud {
    justify-content: flex-start;
  }
}

@media (max-width: 480px) {
  .panel {
    padding: 16px;
  }
  .chip {
    padding: 8px 12px;
    font-size: 14px;
  }
  .hud {
    gap: 4px;
  }
  .pill {
    padding: 4px 8px;
    font-size: 11px;
  }
}

/* ---- スペシャルレシピ・レシピ帳(決定事項20) ------------------------------ */

.hear-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin-bottom: 10px;
}

.hear-row .hear-button {
  flex: 1;
  min-width: 0;
  width: auto;
  margin-bottom: 0;
}

.recipe-book-inline {
  flex-shrink: 0;
  white-space: nowrap;
  margin-top: 0;
  padding: 8px 12px;
}

.dish-name-preview.special {
  color: var(--tomato);
}

.special-preview,
.taste-special {
  margin: 4px 0 0;
  padding: 6px 10px;
  border-radius: 12px;
  background: #fff6d6;
  border: 1.5px solid #e6c65a;
  color: #7a5a00;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  overflow-wrap: anywhere;
}

.taste-special {
  margin: 6px 0 4px;
  font-size: 14px;
}

.recipe-book-card {
  text-align: left;
}

/* 材料ピッカー(決定事項34): レシピ帳と同じ幅広カード。中のグリッドはそのまま .ingredient-grid を使う */
.ingredient-picker-card {
  max-width: 480px;
  text-align: center;
}

.ingredient-picker-button {
  width: 100%;
  font-size: 15px;
  font-weight: 700;
}

.recipe-book-card .modal-title {
  text-align: center;
}

.recipe-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.recipe-item {
  border: 2px solid var(--wood-soft);
  border-radius: 14px;
  padding: 8px 10px;
  background: var(--cream);
}

.recipe-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.recipe-emoji {
  font-size: 22px;
  line-height: 1;
}

.recipe-name {
  font-weight: 900;
  font-size: 15px;
  color: var(--wood-deep);
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.recipe-bonus {
  font-weight: 900;
  font-size: 13px;
  color: #7a5a00;
  background: #fff6d6;
  border: 1.5px solid #e6c65a;
  border-radius: 999px;
  padding: 1px 8px;
  white-space: nowrap;
}

.recipe-steps {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.recipe-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1.5px solid var(--wood-soft);
  background: #fff;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
}

.recipe-chip .chip-emoji {
  font-size: 13px;
}

.recipe-chip.proc {
  border-color: #e0a060;
  background: #fff1e0;
}

.recipe-chip.seas {
  border-color: #8fb0d8;
  background: #eef4fb;
}

.recipe-chip.plat {
  border-color: var(--leaf);
  background: var(--leaf-bg);
}

.recipe-chip.any {
  border-style: dashed;
  color: var(--ink-soft);
  font-weight: 500;
}

.recipe-arrow,
.recipe-or {
  font-size: 11px;
  color: var(--ink-soft);
  font-weight: 800;
}

/* ---- v0.4.0: 材料12種のグリッド(決定事項23)、材料ごとの加工・味付けカード(決定事項21) ---- */

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

.ingredient-grid .chip {
  width: 100%;
  justify-content: center;
  padding: 10px 6px;
  font-size: 14px;
}

@media (min-width: 480px) {
  .ingredient-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 900px) {
  .ingredient-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

.item-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.item-card {
  border: 2px solid var(--wood-soft);
  border-radius: 14px;
  background: var(--cream);
  padding: 8px 10px;
}

.item-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  min-width: 0;
}

.item-order {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--tomato);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.item-emoji {
  flex-shrink: 0;
  font-size: 18px;
  line-height: 1;
}

.item-name {
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 900;
  color: var(--wood-deep);
}

.item-stack {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 3px;
  overflow-x: auto;
  white-space: nowrap;
  font-size: 12px;
  color: var(--ink-soft);
  -webkit-overflow-scrolling: touch;
}

.item-stack .stack-item {
  padding: 2px 8px;
  font-size: 12px;
}

.stack-arrow {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--ink-soft);
}

.item-undo {
  width: 30px;
  height: 30px;
}

.item-chips {
  gap: 6px;
}

.chip.small {
  padding: 6px 10px;
  font-size: 13px;
  min-height: 36px;
  gap: 4px;
}

.chip.small .chip-emoji {
  font-size: 15px;
}

@media (max-width: 480px) {
  .chip.small {
    padding: 5px 8px;
    font-size: 12px;
    min-height: 34px;
  }
  .item-name {
    font-size: 13px;
  }
}

/* レシピ帳: 材料ごとに1行、最後に盛り付けの行 */
.recipe-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  width: 100%;
}

.recipe-plating {
  margin-top: 2px;
}

.recipe-plating-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--ink-soft);
}

/* 結果画面の経過時間 */
#result-elapsed {
  font-variant-numeric: tabular-nums;
}

/* ================= v0.5.0 ================= */

/* 決定事項26: 1画面のキッチンカウンター。行ごとに「材料/調理中/加工/味付け/お皿/盛付」を並べる */
.kitchen-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 12px;
  min-width: 0;
}

.kitchen-row:first-of-type {
  margin-top: 0;
}

.kitchen-row .chips {
  flex: 1;
  min-width: 0;
}

/* 材料チップ: raw(未使用)/selected(調理中 or 皿)/plated(皿に乗った=もう変えられない) */
.ingredient-grid .chip.plated {
  opacity: 0.5;
  border-color: var(--wood-soft);
  background: var(--cream-deep);
  cursor: default;
}

.ingredient-grid .chip.selected:not(.plated) {
  border-color: var(--leaf);
  background: var(--leaf-bg);
  color: var(--leaf-deep);
}

/* 「調理中」トレー: アクティブな材料は目立たせる */
.tray-item,
.plate-item {
  position: relative;
  padding-right: 32px;
}

.tray-item.active {
  border-color: var(--tomato);
  background: var(--tomato-bg);
  box-shadow: 0 0 0 2px rgba(226, 87, 76, 0.25);
  cursor: pointer;
}

.tray-item:not(.active) {
  cursor: pointer;
}

.plate-item {
  border-color: var(--leaf);
  background: var(--leaf-bg);
  color: var(--leaf-deep);
  cursor: default;
}

/* ================= v0.10.0 ================= */

/* 進捗メモ #45: 「お皿(に乗ったもの)」に関する行(お皿・属性・盛付・料理名・ヒント)を1つの見た目のブロックにまとめ、
   盛り付けが「皿に効く」ことを一目でわかるようにする。調理中(#active-ingredient-stage)とは見た目で区別する */
.plate-area {
  margin-top: 12px;
  padding: 10px 10px 4px;
  border: 2px solid var(--leaf);
  border-radius: 16px;
  background: var(--leaf-bg);
}

.plate-area .kitchen-row:first-of-type {
  margin-top: 0;
}

/* ================= v0.8.0 ================= */

/* 決定事項36/37: 調理中に入れられる材料は常に0か1個。作業エリアはその材料そのものになる */
.active-ingredient-stage {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 10px;
  border: 2px dashed var(--wood-soft);
  border-radius: 16px;
  background: var(--cream);
  text-align: center;
}

.active-ingredient-stage.active {
  border-style: solid;
  border-color: var(--tomato);
  background: var(--tomato-bg);
}

.active-ingredient-idle {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
}

.active-ingredient-emoji {
  font-size: 44px;
  line-height: 1;
}

.active-ingredient-name {
  font-size: 16px;
  font-weight: 800;
}

.active-ingredient-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
}

/* v0.8.0時点は単一クラスの上書きだったため、後続の .chip-remove(position: absolute)にCSS成文順で負けて
   ボタンが画面端に飛ぶ不具合があった(v0.10.0で修正)。子孫セレクタにして詳細度を上げ、順序に依存しないようにする */
.active-ingredient-stage .active-ingredient-remove {
  position: static;
  width: auto;
  height: auto;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.chip-remove {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1.5px solid var(--wood-soft);
  background: #fff;
  color: var(--tomato);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* 🔥加工・🧂味付けの道具チップ: アクティブな材料が無ければ押せない */
.tool-chip {
  padding: 8px 12px;
  font-size: 14px;
  min-height: 40px;
}

.tool-chip:disabled,
.tool-chip.disabled {
  opacity: 0.35;
  cursor: default;
}

.plate-button {
  width: 100%;
  margin-top: 12px;
}

.hint-row {
  align-items: center;
}

.hint-chip {
  cursor: default;
  padding: 6px 12px;
  font-size: 13px;
  min-height: 32px;
  border-color: var(--butter);
  background: var(--butter-bg);
  color: var(--wood-deep);
  animation: hint-glow 2s ease-in-out infinite;
}

@keyframes hint-glow {
  0%,
  100% {
    box-shadow: 0 0 0 rgba(255, 214, 107, 0);
  }
  50% {
    box-shadow: 0 0 8px rgba(255, 214, 107, 0.7);
  }
}

@media (max-width: 480px) {
  .kitchen-row {
    flex-direction: column;
    gap: 4px;
  }
  .kitchen-row .stack-label {
    width: auto;
  }
}

/* 決定事項29: 属性チップの色分け。軸ごとに系統立てる(実色寄せ・食感は紫〜青グラデ・温度は赤/青・味は専用パレット・悪い属性は警告色) */
.tag-color-yellow {
  border-color: #e0c34a;
  background: #fdf6d8;
  color: #8a6d0a;
}
.tag-color-white {
  border-color: #c9c2b4;
  background: #f7f5ef;
  color: #6b6455;
}
.tag-color-red {
  border-color: #e2857c;
  background: #fbe3df;
  color: #b23327;
}
.tag-color-brown {
  border-color: #b98a55;
  background: #f0e0c8;
  color: #7a4e1f;
}
.tag-color-green {
  border-color: #8fb87a;
  background: #e8f1e1;
  color: #3f6a30;
}
.tag-color-orange {
  border-color: #e8a662;
  background: #fdeed9;
  color: #a85f10;
}
.tag-color-texture-1 {
  border-color: #b6a6e0;
  background: #f1ecfa;
  color: #5c4a94;
}
.tag-color-texture-2 {
  border-color: #a8a2e6;
  background: #eeecfb;
  color: #55499a;
}
.tag-color-texture-3 {
  border-color: #9aa0ea;
  background: #ecedfc;
  color: #4a4fa0;
}
.tag-color-texture-4 {
  border-color: #8c9aec;
  background: #eaeefc;
  color: #4048a2;
}
.tag-color-texture-5 {
  border-color: #7e97ee;
  background: #e8effd;
  color: #3a4ba6;
}
.tag-color-texture-6 {
  border-color: #7094f0;
  background: #e6f0fd;
  color: #2f47aa;
}
.tag-color-texture-7 {
  border-color: #6291f2;
  background: #e4f1fe;
  color: #2544ae;
}
.tag-color-hot {
  border-color: var(--tomato);
  background: var(--tomato-bg);
  color: #a83226;
}
.tag-color-cold {
  border-color: #6fa0d6;
  background: #e2eefb;
  color: #2b5a92;
}
.tag-color-taste {
  border-color: #d99a4f;
  background: #fbecd6;
  color: #8a5410;
}
.tag-color-bad {
  border-color: var(--tomato);
  background: #f9d9d3;
  color: #a3251a;
  font-weight: 800;
}

/* 決定事項31: 天気のポップオーバー */
.weather-popover-card {
  max-width: 340px;
}

/* 決定事項27: 傾向の好き/苦手ラベルを見やすく(390px でも折り返してよい) */
.info-label {
  width: 8.5em;
}

@media (max-width: 360px) {
  .info-row {
    flex-direction: column;
  }
  .info-label {
    width: auto;
  }
}

/* ================= v0.9.0 ================= */

/* 決定事項42: 皿+調理中がそのままスペシャルレシピになったら、属性チップではなく料理の見た目に切り替える */
.active-ingredient-stage.revealed {
  border-color: var(--butter);
  background: var(--butter-bg);
}

.active-ingredient-stage.revealed .recipe-emoji {
  font-size: 56px;
}

.active-ingredient-stage.revealed .recipe-name {
  font-size: 20px;
  color: var(--wood-deep);
}

.active-ingredient-recipe-note {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--wood-deep);
}

/* 決定事項43: 材料ピッカーの中の「選んだ材料のプレビュー」(属性を見てから決定する) */
.picker-preview {
  margin: 12px 0;
  padding: 10px;
  border: 2px dashed var(--wood-soft);
  border-radius: 14px;
  background: var(--cream);
  text-align: center;
}

.picker-preview.selected {
  border-style: solid;
  border-color: var(--leaf);
  background: var(--leaf-bg);
}

.picker-preview-idle {
  margin: 0;
  font-size: 13px;
  color: var(--ink-soft);
}

.picker-preview-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 6px;
}

.picker-preview-emoji {
  font-size: 28px;
  line-height: 1;
}

.picker-preview-name {
  font-size: 16px;
  font-weight: 800;
}

.picker-preview-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
}
