:root {
  --bg1: #1a1240;
  --bg2: #3a1d72;
  --ink: #fff8e8;
  --muted: #b9addf;
  --panel: rgba(255, 255, 255, 0.08);
  --panel-line: rgba(255, 255, 255, 0.14);
  --tile: #fff4d6;
  --tile-edge: #d9b779;
  --tile-ink: #3b2a10;
  --yellow: #ffd23f;
  --yellow-d: #c99a00;
  --pink: #ff4f8b;
  --pink-d: #b8285b;
  --cyan: #3ee0d0;
  --cyan-d: #1a9a8e;
  --down: #4f8bff;
  --across: #ff8a3d;
  --ok: #3ee07a;
  --ng: #ff5a5a;
  --radius: 18px;
  --display: "Dela Gothic One", "M PLUS Rounded 1c", sans-serif;
  font-family: "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", "Hiragino Sans", "Yu Gothic", sans-serif;
  color-scheme: dark;
  font-synthesis: none; /* 極太フォントをさらに太らせない */
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg1);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  font-weight: 700;
}
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.bg {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(circle at 15% 10%, rgba(255, 79, 139, 0.35), transparent 40%),
    radial-gradient(circle at 90% 30%, rgba(62, 224, 208, 0.25), transparent 40%),
    radial-gradient(circle at 50% 100%, rgba(255, 210, 63, 0.18), transparent 50%),
    linear-gradient(160deg, var(--bg1), var(--bg2));
}
.bg::after {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.5) 1px, transparent 1.5px);
  background-size: 28px 28px;
  opacity: 0.12;
}

#app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: max(16px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
}

.screen { display: none; flex-direction: column; gap: 14px; position: relative; }
.screen.active { display: flex; animation: enter 0.35s ease-out; }
@keyframes enter { from { opacity: 0; transform: translateY(12px); } }

.heading {
  font-family: var(--display); font-weight: 400; letter-spacing: 0.05em;
  text-align: center;
  font-size: 26px;
  margin: 12px 0 4px;
  color: var(--yellow);
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
}
.panel {
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: var(--radius);
  padding: 16px;
  backdrop-filter: blur(6px);
}
.note { font-size: 13px; color: var(--muted); margin: 4px 0 0; font-weight: 500; }
.center { text-align: center; }

/* ---- タイトル ---- */
.logo { margin: 48px 0 28px; text-align: center; }
.logo-sub {
  display: block;
  font-family: var(--display); font-weight: 400; letter-spacing: 0.05em;
  font-size: clamp(30px, 10vw, 44px);
  color: var(--yellow);
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.45);
  letter-spacing: 0.08em;
  transform: rotate(-3deg);
  margin-bottom: 12px;
}
.logo-tiles { display: inline-flex; gap: 4px; }
.logo-tiles i {
  font-style: normal;
  font-family: var(--display); font-weight: 400; letter-spacing: 0.05em;
  width: clamp(40px, 13vw, 54px);
  aspect-ratio: 1;
  display: grid; place-items: center;
  font-size: clamp(24px, 8vw, 32px);
  background: var(--tile);
  color: var(--tile-ink);
  border-radius: 10px;
  box-shadow: 0 5px 0 var(--tile-edge), 0 8px 16px rgba(0, 0, 0, 0.3);
  animation: bob 2.4s ease-in-out infinite;
}
.logo-tiles i:nth-child(2) { animation-delay: 0.15s; }
.logo-tiles i:nth-child(3) { animation-delay: 0.3s; }
.logo-tiles i:nth-child(4) { animation-delay: 0.45s; }
.logo-tiles i:nth-child(5) { animation-delay: 0.6s; }
.logo-tiles i:nth-child(6) { animation-delay: 0.75s; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

.menu { display: flex; flex-direction: column; gap: 14px; }
.icon-btn {
  position: absolute; top: 0; right: 0;
  width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: var(--panel); font-size: 20px; cursor: pointer;
}

/* ---- ボタン（ぷっくりした押せる感じ） ---- */
.btn {
  border: 0;
  border-radius: 16px;
  padding: 12px 18px;
  background: #fff;
  color: #2a1d55;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: 0 5px 0 #b7add6;
  transition: transform 0.05s, box-shadow 0.05s;
}
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #b7add6; }
.btn.primary { background: var(--yellow); color: #3b2a00; box-shadow: 0 5px 0 var(--yellow-d); }
.btn.primary:active { box-shadow: 0 1px 0 var(--yellow-d); }
.btn.secondary { background: var(--cyan); color: #053b36; box-shadow: 0 5px 0 var(--cyan-d); }
.btn.secondary:active { box-shadow: 0 1px 0 var(--cyan-d); }
.btn.ghost, .btn.back { background: transparent; color: var(--muted); box-shadow: none; }
.btn.big { padding: 18px; font-size: 20px; }
.btn:disabled { opacity: 0.45; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---- 設定 ---- */
.options { display: flex; flex-direction: column; gap: 14px; }
fieldset { border: 0; margin: 0; padding: 0; }
legend { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
fieldset label { display: inline-block; margin: 0 6px 6px 0; }
fieldset input { position: absolute; opacity: 0; pointer-events: none; }
fieldset span {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid transparent;
  cursor: pointer;
}
fieldset input:checked + span { background: var(--pink); border-color: #ffd0e0; box-shadow: 0 3px 0 var(--pink-d); }
fieldset input:focus-visible + span { outline: 2px solid var(--yellow); outline-offset: 2px; }
.best { text-align: center; color: var(--yellow); margin: 0; min-height: 1em; }

.name-field { display: flex; align-items: center; gap: 12px; }
.name-field span { font-size: 13px; color: var(--muted); }
.name-field input, .field input {
  flex: 1; min-width: 0;
  font-size: 20px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 3px solid transparent;
  background: var(--tile);
  color: var(--tile-ink);
  outline: none;
  box-shadow: inset 0 3px 0 rgba(0, 0, 0, 0.08);
}
.name-field input:focus, .field input:focus { border-color: var(--yellow); }

/* ---- あそびかた ---- */
.example { text-align: center; }
.example-clues { line-height: 2.1; margin: 10px 0 0; }
.demo-grid {
  display: grid;
  grid-template-columns: repeat(3, 44px);
  justify-content: center;
  gap: 4px;
}
.demo-grid .c { width: 44px; height: 44px; }
.demo-grid .c.on {
  display: grid; place-items: center;
  font-size: 22px; font-weight: 800;
  background: var(--tile); color: var(--tile-ink);
  border-radius: 8px; box-shadow: 0 4px 0 var(--tile-edge);
}
.demo-grid .c.on.x { background: var(--yellow); }
.rules { margin: 0; padding-left: 32px; line-height: 1.8; font-weight: 500; }
.rules b { color: var(--yellow); }

/* ---- ゲーム ---- */
.hud { display: flex; justify-content: space-between; align-items: center; }
.chip {
  background: var(--panel); border: 1px solid var(--panel-line);
  border-radius: 999px; padding: 6px 14px; font-variant-numeric: tabular-nums;
}
.chip.score { color: var(--yellow); font-size: 18px; }
.chip.score::after { content: " pt"; font-size: 12px; color: var(--muted); }

.timer { display: flex; align-items: center; gap: 10px; }
.timebar { flex: 1; height: 14px; background: rgba(0, 0, 0, 0.3); border-radius: 999px; overflow: hidden; border: 2px solid var(--panel-line); }
#timebar-fill {
  height: 100%; width: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--yellow));
  transform-origin: left;
  border-radius: 999px;
}
.timer.warn #timebar-fill { background: var(--ng); }
.time {
  font-family: var(--display); font-weight: 400; letter-spacing: 0.05em;
  font-size: 30px; min-width: 2.2ch; text-align: right;
  font-variant-numeric: tabular-nums;
}
.timer.warn .time { color: var(--ng); animation: throb 0.5s ease-in-out infinite; }
.timer.paused .time { color: var(--muted); }
@keyframes throb { 50% { transform: scale(1.15); } }

.loading { display: grid; place-items: center; gap: 14px; padding: 64px 0; color: var(--muted); }
.spinner {
  width: 48px; height: 48px; border-radius: 12px;
  background: var(--tile);
  box-shadow: 0 5px 0 var(--tile-edge);
  animation: flip 1.1s ease-in-out infinite;
}
@keyframes flip { 50% { transform: rotateY(180deg) rotate(90deg); background: var(--yellow); } }

.board { display: flex; flex-direction: column; gap: 14px; }
.grid-wrap { display: flex; justify-content: center; padding: 8px 0; }
.grid {
  --size: 52px;
  display: grid;
  gap: 4px;
}
.grid .cell { width: var(--size); height: var(--size); position: relative; }
.grid .cell.on {
  display: grid; place-items: center;
  background: var(--tile);
  color: var(--tile-ink);
  border-radius: calc(var(--size) * 0.18);
  box-shadow: 0 calc(var(--size) * 0.09) 0 var(--tile-edge), 0 8px 18px rgba(0, 0, 0, 0.25);
  font-size: calc(var(--size) * 0.52);
  font-weight: 800;
  animation: drop 0.4s backwards cubic-bezier(0.3, 1.6, 0.5, 1);
  animation-delay: var(--d, 0ms);
}
@keyframes drop { from { transform: translateY(-24px) scale(0.6); opacity: 0; } }
.grid .cell.on.typed { color: #a8946d; }
.grid .cell.on.revealed { background: var(--yellow); box-shadow: 0 calc(var(--size) * 0.09) 0 var(--yellow-d); }
.grid .cell.on.pop { animation: pop 0.45s cubic-bezier(0.3, 1.8, 0.5, 1); }
.grid .cell.on.solved { background: var(--ok); color: #053b1a; box-shadow: 0 calc(var(--size) * 0.09) 0 #1f9a4e; animation: hop 0.5s var(--d) both; }
.grid .cell.on.answer { background: #ffd6d6; color: #8a1111; box-shadow: 0 calc(var(--size) * 0.09) 0 #d99; }
.grid .cell .num {
  position: absolute; top: 2px; left: 4px;
  font-size: 10px; font-weight: 800; line-height: 1;
}
.grid .cell .num.down { color: var(--down); }
.grid .cell .num.across { color: var(--across); left: auto; right: 4px; }
@keyframes pop { 0% { transform: scale(1.5) rotate(-8deg); } 100% { transform: none; } }
@keyframes hop { 40% { transform: translateY(-14px); } }

.clues { display: flex; flex-direction: column; gap: 8px; }
.clue {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel); border: 1px solid var(--panel-line);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 21px;
}
.clue .len { margin-left: auto; font-size: 13px; color: var(--muted); white-space: nowrap; }
.tag {
  flex: none;
  font-size: 12px; font-weight: 800;
  padding: 4px 9px; border-radius: 8px;
  color: #fff;
}
.tag.down { background: var(--down); }
.tag.across { background: var(--across); }

.answers { display: flex; flex-direction: column; gap: 10px; }
.field { display: flex; align-items: center; gap: 8px; }
.mic {
  flex: none;
  width: 52px; height: 52px;
  border-radius: 50%;
  border: 0;
  background: var(--cyan);
  box-shadow: 0 4px 0 var(--cyan-d);
  font-size: 22px;
  cursor: pointer;
}
.mic.listening { background: var(--ng); box-shadow: 0 4px 0 #a22; animation: throb 0.8s ease-in-out infinite; }
.actions { display: grid; grid-template-columns: 1fr; gap: 10px; }
.answers.shake { animation: shake 0.4s; }
@keyframes shake {
  20%, 60% { transform: translateX(-10px); }
  40%, 80% { transform: translateX(10px); }
}

.verdict { text-align: center; display: flex; flex-direction: column; gap: 10px; }
.verdict-title { font-family: var(--display); font-weight: 400; letter-spacing: 0.05em; font-size: 34px; margin: 0; }
.verdict-title.ok { color: var(--ok); }
.verdict-title.ng { color: var(--ng); }
.verdict-detail { margin: 0; color: var(--muted); line-height: 1.8; font-weight: 500; }
.verdict-detail b { color: var(--ink); font-size: 18px; }

.btn.like { align-self: center; padding: 10px 22px; border-radius: 999px; }
.btn.like[aria-pressed="true"] { background: var(--pink); color: #fff; box-shadow: 0 5px 0 var(--pink-d); }
.btn.like .count { font-variant-numeric: tabular-nums; margin-left: 2px; }
.btn.like.small { padding: 6px 12px; font-size: 13px; box-shadow: 0 3px 0 #b7add6; }
.btn.like.small[aria-pressed="true"] { box-shadow: 0 3px 0 var(--pink-d); }

.puzzle-no { margin: 0 0 -8px; text-align: center; color: var(--muted); font-size: 13px; letter-spacing: 0.1em; min-height: 1em; }
.verdict-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.gate { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.gate p { margin: 0; }
.gate-widget { min-height: 65px; }

.ai-cost { text-align: center; color: var(--muted); font-size: 12px; font-weight: 500; margin: 8px 0 0; line-height: 1.6; }
.ai-cost p { margin: 0 0 4px; }
.ai-cost table { width: 100%; border-collapse: collapse; font-size: 11px; font-variant-numeric: tabular-nums; }
.ai-cost th, .ai-cost td { padding: 3px 4px; border-top: 1px solid var(--panel-line); text-align: right; white-space: nowrap; }
.ai-cost th { font-weight: 700; color: var(--ink); opacity: 0.8; }
.ai-cost th:first-child, .ai-cost td:first-child { text-align: left; }
.ai-cost td:first-child { color: var(--ink); }

/* ---- 番号入力（テンキー） ---- */
.numpad {
  border: 0; padding: 0; background: transparent; color: var(--ink);
  width: min(360px, calc(100% - 32px)); max-height: calc(100dvh - 32px);
}
.numpad::backdrop { background: rgba(10, 6, 30, 0.7); backdrop-filter: blur(4px); }
.numpad[open] { animation: rise 0.25s cubic-bezier(0.3, 1.4, 0.5, 1); }
@keyframes rise { from { transform: translateY(40px) scale(0.95); opacity: 0; } }
.numpad-inner {
  display: flex; flex-direction: column; gap: 12px;
  background: linear-gradient(160deg, #2d1b69, #1a1240);
  border: 2px solid var(--panel-line); border-radius: 24px; padding: 20px 16px 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.numpad-title { margin: 0; text-align: center; color: var(--muted); font-size: 14px; }
.numpad-display {
  margin: 0; display: flex; align-items: baseline; justify-content: center; gap: 6px;
  background: var(--tile); color: var(--tile-ink); border-radius: 16px; padding: 10px 16px;
  box-shadow: inset 0 3px 0 rgba(0, 0, 0, 0.1); min-height: 76px;
}
.numpad-display .no-prefix { font-size: 22px; color: #a8946d; }
.numpad-value { font-family: var(--display); font-size: 48px; letter-spacing: 0.08em; font-variant-numeric: tabular-nums; }
.numpad-value:empty::before { content: "–"; color: #c9b88f; }
.caret { width: 3px; height: 40px; background: var(--pink); align-self: center; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.keys button {
  border: 0; border-radius: 16px; height: 62px;
  font-family: var(--display); font-size: 28px;
  background: #fff; color: #2a1d55; box-shadow: 0 5px 0 #b7add6;
  cursor: pointer; touch-action: manipulation;
}
.keys button.fn { background: rgba(255, 255, 255, 0.15); color: var(--ink); box-shadow: 0 5px 0 rgba(0, 0, 0, 0.3); font-size: 24px; }
.keys button:active { transform: translateY(4px); box-shadow: 0 1px 0 #b7add6; }
.history .no { color: var(--muted); font-size: 11px; font-weight: 500; }

/* ---- 対戦 ---- */
.solo-only, .versus-only { display: none; }
#screen-game.solo .solo-only { display: revert; }
#screen-game.versus .versus-only { display: revert; }
#screen-game.solo .vs-hud.solo-only, #screen-game.versus .vs-hud.versus-only { display: grid; }

.vs-hud { grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; }
.pl {
  background: var(--panel); border: 2px solid var(--panel-line);
  border-radius: 14px; padding: 6px 10px;
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.pl.right { text-align: right; }
.pl .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.pl .stars { color: var(--yellow); letter-spacing: 1px; font-size: 14px; }
.pl.me { border-color: var(--cyan); }
.pl.answering { border-color: var(--pink); background: rgba(255, 79, 139, 0.25); animation: throb 0.8s ease-in-out infinite; }
.pl.used .nm::after { content: " ✕"; color: var(--ng); }
.pl.off { opacity: 0.4; }
.vs-q { justify-self: center; }

.vs-status { text-align: center; margin: 0; min-height: 1.4em; color: var(--yellow); }
.buzz {
  align-self: center;
  width: 150px; height: 150px;
  border-radius: 50%;
  border: 6px solid #ffd0e0;
  background: radial-gradient(circle at 35% 30%, #ff8db3, var(--pink) 55%, var(--pink-d));
  box-shadow: 0 10px 0 #7d1739, 0 16px 30px rgba(0, 0, 0, 0.4);
  font-family: var(--display); font-weight: 400; letter-spacing: 0.05em;
  font-size: 28px;
  color: #fff;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.3);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.05s, box-shadow 0.05s;
}
.buzz:active:not(:disabled) { transform: translateY(8px); box-shadow: 0 2px 0 #7d1739, 0 6px 14px rgba(0, 0, 0, 0.4); }
.buzz:disabled { filter: grayscale(1) brightness(0.6); cursor: not-allowed; }

.answer-timer { height: 8px; background: rgba(0, 0, 0, 0.3); border-radius: 999px; overflow: hidden; }
.answer-timer div { height: 100%; background: var(--pink); transform-origin: left; }

/* ---- 待合室 ---- */
.room-code {
  font-family: var(--display); font-weight: 400; letter-spacing: 0.05em;
  font-size: 48px; letter-spacing: 0.15em;
  margin: 4px 0 12px; color: var(--yellow);
}
.waiting-dots { display: flex; justify-content: center; gap: 10px; padding: 16px 0; }
.waiting-dots span {
  width: 18px; height: 18px; border-radius: 5px;
  background: var(--tile); box-shadow: 0 4px 0 var(--tile-edge);
  animation: bob 1.2s ease-in-out infinite;
}
.waiting-dots span:nth-child(2) { animation-delay: 0.2s; }
.waiting-dots span:nth-child(3) { animation-delay: 0.4s; }

/* ---- 演出 ---- */
.splash {
  position: fixed; left: 50%; top: 40%;
  transform: translate(-50%, -50%) scale(0.4);
  font-family: var(--display); font-weight: 400; letter-spacing: 0.05em;
  font-size: clamp(48px, 18vw, 96px);
  color: var(--yellow);
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.5), 0 0 12px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  opacity: 0;
  white-space: nowrap;
  z-index: 10;
}
.splash.ok { color: var(--ok); }
.splash.ng { color: var(--ng); }
.splash.small { font-size: clamp(28px, 10vw, 52px); }
.splash.show { animation: splash 1.1s cubic-bezier(0.3, 1.6, 0.5, 1) forwards; }
@keyframes splash {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.4); }
  25% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
  70% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -60%) scale(1); }
}

.toast {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: #fff; color: #2a1d55;
  padding: 10px 18px; border-radius: 999px;
  font-size: 14px; max-width: calc(100% - 32px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
  z-index: 11;
}
.toast.show { opacity: 1; }

/* ---- 結果 ---- */
.result-banner {
  font-family: var(--display); font-weight: 400; letter-spacing: 0.05em;
  text-align: center; font-size: 34px; margin: 28px 0 0;
  color: var(--yellow); text-shadow: 0 3px 0 rgba(0, 0, 0, 0.45);
}
.final { text-align: center; font-family: var(--display); font-weight: 400; letter-spacing: 0.05em; font-size: 72px; margin: 0; color: var(--ink); }
.final small { font-size: 24px; margin-left: 4px; color: var(--muted); }
.final-sub { text-align: center; margin: -8px 0 0; color: var(--muted); }
.history { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.history li {
  background: var(--panel); border: 1px solid var(--panel-line);
  border-radius: 14px;
  padding: 10px 14px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 4px 10px;
  align-items: center;
  font-size: 14px;
}
.history .mark { font-size: 20px; grid-row: span 2; }
.history .side { grid-row: span 2; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.history .pair { font-weight: 500; }
.history .pair b { font-size: 16px; font-weight: 800; }
.history .pair small { color: var(--muted); }

/* ---- ランキング ---- */
.ranking { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; counter-reset: rank; }
.ranking li { counter-increment: rank; }
.ranking button {
  width: 100%;
  display: grid;
  grid-template-columns: 2em 1fr auto;
  gap: 4px 10px;
  align-items: center;
  text-align: left;
  border: 1px solid var(--panel-line);
  border-radius: 14px;
  background: var(--panel);
  padding: 12px 14px;
  cursor: pointer;
}
.ranking button::before {
  content: counter(rank);
  grid-row: span 2;
  font-family: var(--display); font-weight: 400; letter-spacing: 0.05em;
  font-size: 22px; color: var(--yellow); text-align: center;
}
.ranking li:nth-child(1) button::before { color: #ffd700; font-size: 28px; }
.ranking .clues-line { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.ranking .meta { font-size: 12px; color: var(--muted); grid-column: 2; font-weight: 500; }
.ranking .likes { grid-row: 1 / span 2; grid-column: 3; white-space: nowrap; color: var(--pink); }
.ranking .empty { text-align: center; color: var(--muted); padding: 24px 0; }

/* ---- ゲーム画面は1画面に収める（スクロールさせない） ----
   画面の高さいっぱいに並べ、盤面（.grid-wrap）が残りの高さを使う。マスの大きさは JS が残りに合わせて決める */
#app:has(#screen-game.active) { height: 100dvh; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
#screen-game.active { flex: 1; min-height: 0; gap: 8px; }
#screen-game .hud, #screen-game .vs-hud { flex: none; }
#screen-game .timer { flex: none; gap: 8px; }
#screen-game .timebar { height: 12px; }
#screen-game .time { font-size: 26px; }
#screen-game .loading { flex: 1; padding: 0; }
#screen-game .board { flex: 1; min-height: 0; gap: 8px; }
#screen-game .grid-wrap {
  flex: 1 1 0; min-height: 0; padding: 0; position: relative;
  display: flex; align-items: center; justify-content: center;
}
#screen-game .puzzle-no { position: absolute; top: 0; left: 0; margin: 0; z-index: 1; }
#screen-game .clues { flex: none; gap: 6px; }
#screen-game .clue { padding: 8px 12px; font-size: 19px; border-radius: 12px; }
#screen-game .answers { flex: none; gap: 8px; }
#screen-game .field input { font-size: 19px; padding: 8px 12px; }
#screen-game .mic { width: 46px; height: 46px; font-size: 20px; }
#screen-game .actions .btn { padding: 11px 16px; }
#screen-game .verdict { flex: none; gap: 6px; padding: 12px; }
#screen-game .verdict-title { font-size: 28px; }
#screen-game .verdict-detail { line-height: 1.6; font-size: 14px; }
#screen-game .verdict-detail b { font-size: 16px; }
#screen-game .btn.like { padding: 8px 16px; }
#screen-game .verdict .btn.primary { padding: 11px 16px; }
#screen-game .vs-status { flex: none; font-size: 14px; min-height: 1.3em; }
#screen-game .pl { padding: 4px 10px; }
/* 結果が出ている間は、結果欄にヒントと答えが出るので、上のヒント欄は隠して盤面を大きくする */
#screen-game .board:has(.verdict:not([hidden])) .clues { display: none; }
/* 対戦の「回答！」は横長の大きなボタンにして、高さを取りすぎないようにする */
#screen-game .buzz {
  flex: none; align-self: stretch; width: auto; height: 76px;
  border-radius: 24px; border-width: 4px; font-size: 30px;
  box-shadow: 0 8px 0 #7d1739, 0 12px 24px rgba(0, 0, 0, 0.4);
}
#screen-game .buzz:active:not(:disabled) { transform: translateY(6px); box-shadow: 0 2px 0 #7d1739; }

#screen-game .btn.pass { flex: none; padding: 2px; margin-top: -4px; font-size: 13px; }

/* 縦が狭い画面では、さらに詰める */
@media (max-height: 640px) {
  #screen-game.active, #screen-game .board { gap: 6px; }
  #screen-game .clue { padding: 6px 10px; font-size: 17px; }
  #screen-game .field input { font-size: 17px; padding: 6px 10px; }
  #screen-game .mic { width: 40px; height: 40px; }
  #screen-game .actions .btn { padding: 9px 14px; }
  #screen-game .buzz { height: 64px; font-size: 26px; }
  #screen-game .verdict-title { font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
