/* おいしい闇鍋をつくろう: 全画面の 3D(暗い部屋の鍋)と、その上に重ねるパネル(大人向け・スマホ縦持ちが基本) */
:root {
  --ink: #f4ece0;
  --muted: #b9ab98;
  --panel: rgba(28, 21, 18, 0.9);
  --line: rgba(244, 236, 224, 0.16);
  --accent: #e9a63a;
  --accent-ink: #2a1a08;
  --umami: #e9a63a;
  --sweet: #e58ab3;
  --salt: #82a9ca;
  --sour: #d9c24a;
  --bitter: #b89a7c;
  --fat: #f0d7a0;
  --koku: #5cc2bd;
  --bad: #ef7d7d;
  --ssr: linear-gradient(90deg, #ef7aa0, #f2c24a, #6fd09a, #7aa6f2, #b88af0);
}

/* display を指定した要素(.btn など)にも hidden を効かせる */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #120d0b;
  color: var(--ink);
  font-family: 'Hiragino Sans', 'BIZ UDPGothic', 'Noto Sans JP', system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

#app {
  position: fixed;
  inset: 0;
}
#app canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: manipulation;
}

#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.status {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  right: 64px;
  font-size: 13px;
  color: var(--muted);
  pointer-events: none;
}
.status b {
  color: var(--ink);
}

.combo {
  position: absolute;
  top: max(56px, 10%);
  left: 50%;
  translate: -50% 0;
  display: grid;
  justify-items: center;
  gap: 2px;
  pointer-events: none;
  text-align: center;
  color: #f2c24a;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.7);
  z-index: 5;
}
.combo b {
  font-size: clamp(34px, 10vw, 56px);
  font-weight: 900;
  letter-spacing: 0.02em;
}
.combo .gain {
  font-size: 26px;
  font-weight: 900;
  color: #fff3c4;
}
.combo .gain small {
  font-size: 15px;
  color: #f2c24a;
}
.combo .chain {
  font-size: 20px;
  font-weight: 800;
  color: #f6e7c0;
}
.combo small {
  white-space: nowrap;
  font-size: 13px;
  color: var(--ink);
}
.combo.pop {
  animation: combo-pop 1.6s ease-out both;
}
@keyframes combo-pop {
  0% {
    opacity: 0;
    transform: scale(0.6);
  }
  15% {
    opacity: 1;
    transform: scale(1.12);
  }
  30% {
    transform: scale(1);
  }
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-16px);
  }
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  padding: max(56px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right))
    max(14px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  box-sizing: border-box;
}
.screen[hidden] {
  display: none;
}
.screen[data-pos='center'] {
  align-items: center;
}
.screen[data-pos='bottom'] {
  align-items: flex-end;
}
.screen[data-pos='full'] {
  align-items: stretch;
}

.panel {
  pointer-events: auto;
  width: min(460px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  box-sizing: border-box;
  display: grid;
  gap: 12px;
  align-content: start;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}
.panel.wide {
  width: min(720px, 100%);
}
.panel.scroll {
  overflow-y: auto;
  max-height: 100%;
}

h1,
h2,
h3,
p {
  margin: 0;
}
h1,
h2,
h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.35;
}
.logo {
  font-size: clamp(24px, 6.5vw, 32px);
  letter-spacing: 0.02em;
}
h2 {
  font-size: 20px;
}
h3 {
  font-size: 15px;
  color: var(--muted);
  margin-top: 6px;
}
.eyebrow {
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--accent);
  font-weight: 700;
}
.lead {
  line-height: 1.75;
  font-size: 15px;
}
.small {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.6;
}

.btn {
  font: inherit;
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
  background: rgba(244, 236, 224, 0.08);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
}
.btn:hover {
  border-color: var(--accent);
}
.btn:focus-visible,
.card:focus-visible,
.seg-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn.primary:disabled {
  opacity: 0.4;
  cursor: default;
}
.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}
.btn.small {
  min-height: 40px;
  min-width: 40px;
  padding: 6px 12px;
}
.btn-col {
  display: grid;
  gap: 10px;
}
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.btn-row .btn {
  flex: 1 1 180px;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.count {
  min-width: 2em;
  text-align: center;
  font-size: 20px;
  font-weight: 700;
}
.names {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.names input,
.search {
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: rgba(244, 236, 224, 0.06);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  min-width: 0;
}
/* 自由に選ぶ: 220 種から探す */
.free {
  display: grid;
  gap: 8px;
}
.free[hidden] {
  display: none;
}
/* 売り場の絞り込みは 1 段の横スクロール(折り返すとスマホで手札の場所がなくなる) */
.free .chips {
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 4px;
}
.free .chip {
  flex: none;
}
/* ひとり鍋: 鍋の中身(押すと取り出す) */
.pot-list .chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.pot-list .chip b {
  color: var(--muted);
  font-weight: 400;
}
.hand.free-list {
  max-height: 38vh;
  overflow-y: auto;
  padding-right: 2px;
}
.seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.seg-btn {
  font: inherit;
  color: var(--ink);
  background: transparent;
  border: none;
  padding: 8px 14px;
  min-height: 40px;
  cursor: pointer;
}
.seg-btn[aria-pressed='true'] {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}

.theme-name {
  font-size: clamp(26px, 7vw, 34px);
  color: var(--accent);
}
.pass-name {
  font-size: clamp(28px, 8vw, 38px);
}

.pick-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.smell {
  font-size: 14px;
  background: rgba(233, 166, 58, 0.12);
  border-radius: 10px;
  padding: 8px 12px;
  line-height: 1.6;
}
.hand {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(124px, 1fr));
  gap: 8px;
}
.card {
  font: inherit;
  text-align: left;
  color: var(--ink);
  background: rgba(244, 236, 224, 0.06);
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  display: grid;
  gap: 6px;
  align-content: start;
  cursor: pointer;
  min-width: 0;
}
.card[aria-selected='true'] {
  border-color: var(--accent);
  background: rgba(233, 166, 58, 0.16);
}
.card-name {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.3;
}
.card-cat {
  font-size: 11px;
  color: var(--muted);
}
.dots {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 6px;
  font-size: 10.5px;
  align-items: center;
}
.dots span:nth-child(odd) {
  color: var(--muted);
}
.dot-bar {
  display: flex;
  gap: 2px;
}
.dot-bar i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(244, 236, 224, 0.14);
}
.dot-bar i.on {
  background: var(--c);
}
.card-tags {
  font-size: 10.5px;
  color: var(--muted);
}

.reveal-list {
  margin: 0;
  padding-left: 1.4em;
  display: grid;
  gap: 6px;
  max-height: 46vh;
  overflow-y: auto;
  font-size: 15px;
}
.reveal-list li {
  animation: pop 0.35s ease-out both;
}
.reveal-list small {
  color: var(--muted);
}
@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.score-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.rank {
  font-size: clamp(22px, 6vw, 30px);
  font-weight: 800;
}
.score {
  display: grid;
  justify-items: end;
  font-size: clamp(30px, 9vw, 48px);
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.score .score-label {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.1em;
}
.score small {
  font-size: 16px;
  margin-left: 2px;
}
.meters {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  font-size: 12.5px;
  align-items: center;
}
.meter-track {
  height: 10px;
  border-radius: 5px;
  background: rgba(244, 236, 224, 0.1);
  position: relative;
  overflow: hidden;
}
.meter-track i {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 5px;
  background: var(--c);
}
.meter-track b {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 2px;
  background: var(--bad);
}

.pairs {
  display: grid;
  gap: 8px;
}
.pair {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  display: grid;
  gap: 4px;
}
.pair-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.pair-title {
  font-weight: 800;
  font-size: 16px;
}
.pair-who {
  font-size: 12px;
  color: var(--muted);
}
.pair ul {
  margin: 0;
  padding-left: 1.1em;
  font-size: 13px;
  line-height: 1.6;
}
.badge {
  font-size: 11px;
  font-weight: 800;
  border-radius: 4px;
  padding: 0 6px;
  border: 1px solid currentColor;
  white-space: nowrap;
}
.badge.ssr {
  background: var(--ssr);
  color: #241404;
  border-color: transparent;
}
.badge.sr {
  color: var(--accent);
}
.badge.r {
  color: var(--salt);
}
.badge.n {
  color: var(--muted);
}
.badge.new {
  background: var(--bad);
  color: #fff;
  border-color: transparent;
}
.badge.world {
  color: var(--koku);
}
.badge.boost {
  color: var(--sour);
}
.bad {
  font-size: 13px;
  color: var(--bad);
  line-height: 1.6;
}

.players {
  margin: 0;
  padding-left: 1.4em;
  display: grid;
  gap: 6px;
}
.players li {
  font-size: 15px;
}
.players .pts {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  margin-left: 6px;
}
.players .note {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.book-list {
  display: grid;
  gap: 8px;
}

/* 解説 */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  min-height: 36px;
  cursor: pointer;
}
.chip[aria-pressed='true'] {
  background: rgba(233, 166, 58, 0.2);
  border-color: var(--accent);
}
.chip:focus-visible,
.why:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
#learn-tab-tastes,
#learn-tab-kinds,
#learn-tab-rx {
  display: grid;
  gap: 10px;
}
#learn-tab-tastes[hidden],
#learn-tab-kinds[hidden],
#learn-tab-rx[hidden] {
  display: none;
}
.stage {
  position: relative;
  aspect-ratio: 16 / 10;
  max-width: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(244, 236, 224, 0.05);
  touch-action: pan-y;
}
@media (max-width: 560px) {
  .stage {
    aspect-ratio: 4 / 3;
  }
}
.stage canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.stage-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.tag3d {
  position: absolute;
  left: 0;
  top: 0;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.4;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(20, 15, 12, 0.85);
  color: var(--ink);
  border: 1px solid var(--line);
  white-space: nowrap;
  transition: opacity 0.3s;
}
.tag3d.glu {
  color: #5dba86;
  border-color: #5dba86;
}
.tag3d.imp {
  color: #e27a8f;
  border-color: #e27a8f;
}
.tag3d.sweet {
  color: var(--sweet);
  border-color: var(--sweet);
}
.tag3d.bitter {
  color: var(--bitter);
  border-color: var(--bitter);
}
.tag3d.salt {
  color: var(--salt);
  border-color: var(--salt);
}
.tag3d.sour {
  color: var(--sour);
  border-color: var(--sour);
}
.tag3d.kokumi {
  color: var(--koku);
  border-color: var(--koku);
}
.tag3d.no {
  background: var(--bad);
  color: #fff;
  border-color: var(--bad);
}
.burst {
  position: absolute;
  left: 0;
  top: 0;
  font-weight: 800;
  font-size: clamp(20px, 5vw, 30px);
  pointer-events: none;
  white-space: nowrap;
}
.taste-title {
  color: var(--ink);
  font-size: 17px;
}
.sig {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
}
.kinds {
  display: grid;
  gap: 10px;
}
.kind-card {
  border: 1px solid var(--line);
  border-left: 4px solid var(--c, var(--line));
  border-radius: 12px;
  padding: 12px 14px;
  display: grid;
  gap: 6px;
  font-size: 14px;
  line-height: 1.7;
  scroll-margin-top: 12px;
  transition: background 0.3s;
}
.kind-card.focus {
  background: rgba(233, 166, 58, 0.14);
}
.kind-card.dim {
  opacity: 0.6;
}
.kind-card h3 {
  color: var(--ink);
  margin: 0;
}
.kind-card .btn {
  justify-self: start;
}
.kind-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--c);
  flex: none;
  display: inline-block;
}
.kind-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--c);
}
.kind-game {
  font-size: 13px;
  color: var(--accent);
}
.kind-list {
  margin: 0;
  padding-left: 1.2em;
}
.rx-first {
  border-left: 3px solid var(--salt);
  padding: 6px 12px;
  font-size: 14px;
  line-height: 1.7;
}
.rx-first b {
  display: block;
  color: var(--salt);
  font-size: 12px;
}
.rx-dl {
  display: grid;
  grid-template-columns: 5.5em minmax(0, 1fr);
  gap: 2px 8px;
  margin: 0;
  font-size: 13.5px;
}
.rx-dl dt {
  color: var(--muted);
  font-size: 12px;
  padding-top: 2px;
}
.rx-dl dd {
  margin: 0;
}
.why {
  font: inherit;
  font-weight: 800;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}

.noscript {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
}

@media (prefers-reduced-motion: reduce) {
  .reveal-list li,
  .combo.pop {
    animation: none;
  }
}
