:root {
  --bg: #111a29;
  --panel: #1a2639;
  --panel2: #22324a;
  --line: #36506a;
  --gold: #f4d394;
  --gold2: #e5a965;
  --text: #f5f1e7;
  --muted: #a9b8c6;
  --mint: #8fdcc6;
  --rose: #f29a9a;
  --aspect: 1; /* カード画像の縦横比（幅/高さ）。GPT画像は正方形 */
  --gap: 8px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  background: radial-gradient(ellipse at 25% -10%, #2c4562 0%, #141f31 55%, #0d1420 100%) fixed;
  color: var(--text);
  font-family: system-ui, -apple-system, 'Hiragino Sans', 'Noto Sans JP', sans-serif;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:disabled { opacity: .38; cursor: default; }

.app {
  height: 100vh; height: 100dvh;
  max-width: 1100px; margin: 0 auto;
  display: flex; flex-direction: column;
  padding: max(8px, env(safe-area-inset-top)) 10px calc(8px + var(--safe-b));
  overflow: hidden;
}

/* ---------- ヘッダー・得点 ---------- */
.top { display: flex; align-items: center; gap: 8px; min-height: 30px; }
.brand { font: 700 17px/1 Georgia, 'Hiragino Mincho ProN', serif; color: var(--gold); letter-spacing: .04em; }
.round { margin-left: auto; font-size: 12px; background: #22364b; border: 1px solid #456077; border-radius: 99px; padding: 4px 10px; }
.iconbtn { width: 34px; height: 30px; border-radius: 9px; background: #22364b; font-size: 16px; }
.scores { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin: 6px 0; }
.chip {
  position: relative; background: var(--panel); border: 1px solid #2d445a; border-radius: 10px;
  padding: 4px 2px 3px; text-align: center; min-width: 0;
}
.chip .nm { font-size: 10.5px; color: #c6d2dc; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.chip .sc { font-size: 18px; font-weight: 800; color: #f7dca8; line-height: 1.15; }
.chip.narr { border-color: var(--gold2); background: #33382f; }
.chip.narr .nm::before { content: '✦ '; color: var(--gold); }
.chip.me .nm { color: #fff; font-weight: 700; }
.chip .delta {
  position: absolute; top: -7px; right: -2px; font-size: 12px; font-weight: 800; padding: 1px 6px;
  border-radius: 99px; background: var(--mint); color: #10261f; animation: pop .5s ease-out;
}
.chip .delta.zero { background: #3a4b5d; color: #c9d5df; }
@keyframes pop { from { transform: scale(.3); opacity: 0 } 70% { transform: scale(1.2) } to { transform: scale(1); opacity: 1 } }

/* ---------- お題・案内 ---------- */
.stagebar {
  text-align: center; padding: 6px 8px 7px; border-radius: 14px;
  background: linear-gradient(180deg, rgba(36, 50, 74, .9), rgba(24, 35, 54, .9)); border: 1px solid #3a5069;
}
.stagebar .who { font-size: 11px; color: var(--mint); letter-spacing: .06em; }
.stagebar .prompt {
  font: 700 clamp(24px, 7.5vw, 36px)/1.25 Georgia, 'Hiragino Mincho ProN', 'Yu Mincho', serif;
  color: #ffe3b5; margin: 2px 0 1px; text-shadow: 0 2px 12px rgba(255, 190, 110, .25); word-break: keep-all;
}
.stagebar .prompt.small { font-size: clamp(18px, 5vw, 24px); }
.stagebar .guide { font-size: 12.5px; color: #d2dde5; }

/* ---------- 盤面 ---------- */
.board { flex: 1; min-height: 0; position: relative; margin: 7px 0 6px; display: flex; flex-direction: column; }
.fit { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.cards { display: grid; gap: var(--gap); grid-template-columns: repeat(var(--cols, 3), var(--cw, 100px)); justify-content: center; align-content: center; }
.tile {
  position: relative; width: var(--cw, 100px); border-radius: 12px; padding: 4px; background: #24364c;
  border: 2px solid transparent; transition: transform .12s, border-color .12s, box-shadow .12s, opacity .2s;
}
.tile.tap { cursor: pointer; }
.tile.tap:active { transform: scale(.97); }
.tile.sel { border-color: #ffd083; box-shadow: 0 0 0 3px rgba(255, 196, 110, .35), 0 6px 18px rgba(0, 0, 0, .4); }
.tile.dim { opacity: .45; }
.tile.correct { border-color: var(--mint); box-shadow: 0 0 0 3px rgba(143, 220, 198, .35); }
.tile .lbl { font-size: 11px; text-align: center; color: #c5d6e2; padding: 3px 1px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .num {
  position: absolute; top: 8px; left: 8px; z-index: 2; min-width: 24px; height: 24px; border-radius: 99px;
  background: rgba(14, 26, 40, .82); font-size: 13px; font-weight: 800; display: grid; place-items: center;
}
.tile .zoom {
  position: absolute; top: 8px; right: 8px; z-index: 2; width: 30px; height: 30px; border-radius: 99px;
  background: rgba(14, 26, 40, .82); font-size: 15px; display: grid; place-items: center;
}
.tile .prov {
  position: absolute; z-index: 2; right: 8px; bottom: 8px; font-size: 10px; font-weight: 700; color: #1b2533;
  background: rgba(240, 230, 210, .85); border-radius: 5px; padding: 0 4px; line-height: 16px;
}
.tile .mine {
  position: absolute; left: 8px; right: 8px; bottom: 8px; z-index: 2; text-align: center; font-size: 11px;
  background: rgba(14, 26, 40, .85); border-radius: 7px; padding: 2px 0;
}

.art {
  position: relative; width: 100%; aspect-ratio: var(--aspect); border-radius: 8px; overflow: hidden;
  background: radial-gradient(circle at 35% 28%, hsl(var(--h1) 55% 52%), hsl(var(--h2) 55% 16%));
}
.art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.art .ph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.art .ph .m { font-size: calc(var(--cw, 100px) * .42); filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .35)); }
.art .ph .s { position: absolute; right: 9%; bottom: 8%; font-size: calc(var(--cw, 100px) * .2); opacity: .9; }
.art.night .ph::before, .art.dusk .ph::before, .art.mist .ph::before, .art.day .ph::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
}
.art.night .ph::before {
  background-image: radial-gradient(1.5px 1.5px at 20% 25%, #fff, transparent), radial-gradient(1px 1px at 70% 15%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 85% 40%, #ffe9b0, transparent), radial-gradient(1px 1px at 40% 10%, #fff, transparent),
    radial-gradient(1px 1px at 12% 60%, #cfe0ff, transparent);
}
.art.dusk .ph::before { background: linear-gradient(180deg, transparent 50%, rgba(255, 150, 90, .35)); }
.art.mist .ph::before { background: linear-gradient(180deg, rgba(255, 255, 255, .12), transparent 40%, rgba(255, 255, 255, .14)); }
.art.day .ph::before { background: radial-gradient(circle at 80% 15%, rgba(255, 245, 200, .55), transparent 35%); }
.art.has-img .ph { display: none; }
.art.has-img.broken .ph { display: flex; }
.art.has-img.broken img { display: none; }

/* 開票の演出 */
.vote-token {
  position: fixed; z-index: 40; pointer-events: none; font-size: 12px; font-weight: 800; padding: 3px 9px;
  border-radius: 99px; background: #f4d394; color: #1b2533; box-shadow: 0 4px 14px rgba(0, 0, 0, .45), 0 0 0 2px rgba(255, 255, 255, .35);
}
.vote-token.me { background: #8fdcc6; }
.voters span.landed { animation: land .3s ease-out; }
@keyframes land { from { transform: scale(1.6); } to { transform: scale(1); } }
.tile.spot { animation: spot 1.1s ease-out both; z-index: 3; }
@keyframes spot {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 220, 140, 0); }
  35% { transform: scale(1.09) rotate(-1.2deg); box-shadow: 0 0 0 6px rgba(255, 215, 130, .55), 0 0 40px 10px rgba(255, 200, 110, .55); }
  60% { transform: scale(1.05) rotate(.8deg); }
  100% { transform: scale(1); box-shadow: 0 0 0 3px rgba(143, 220, 198, .5), 0 0 26px 4px rgba(255, 200, 110, .35); }
}
.tile.dim { transition: opacity .5s, filter .5s; }
.tile.dim .art { filter: grayscale(.5) brightness(.7); }
.who-own.show { animation: fadeup .45s ease-out both; }
.fadein { animation: fadeup .45s ease-out both; }
@keyframes fadeup { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.chip .sc.bump { display: inline-block; animation: bump .6s ease-out; }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.35); color: #fff; } 100% { transform: scale(1); } }

/* 投票結果（誰の札・誰が投票） */
.who-own { font-size: 11px; text-align: center; padding-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-own b { color: var(--gold); }
.voters { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; min-height: 18px; padding-top: 2px; }
.voters span { font-size: 10px; background: #36506a; border-radius: 99px; padding: 1px 6px; }
.voters span.ok { background: #2f6b5a; }

/* お題の選択 */
.promptpick { display: flex; gap: 10px; flex: 1; min-height: 0; }
.promptpick .fit { flex: 1; }
.opts { display: flex; flex-direction: column; gap: 7px; justify-content: center; }
.opt {
  border: 1.5px solid #6f879b; background: #24384c; border-radius: 12px; padding: 10px 12px;
  font-size: 16px; text-align: left; min-height: 44px; line-height: 1.25;
}
.opt.sel { background: #7a6440; border-color: #ffd795; color: #fff; }
.opt .used { font-size: 10.5px; color: var(--muted); margin-left: 6px; }
.opt .kind { font-size: 10.5px; color: var(--muted); display: block; }
@media (max-aspect-ratio: 4/5) {
  .promptpick { flex-direction: column; }
  .opts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .opt { font-size: 15px; padding: 8px 10px; text-align: center; }
  .opt:last-child:nth-child(odd) { grid-column: span 2; }
}

/* 出題：カードのお題候補（上部に表示） */
.stagebar .chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 5px; }
.stagebar .chips .opt { font-size: 15px; padding: 6px 12px; min-height: 38px; border-radius: 99px; text-align: center; }
.stagebar .chips .opt.sel { font-weight: 700; }
.stagebar .chips .opt:disabled { text-decoration: line-through; }

/* 結果のひとこと */
.reasons { font-size: 11.5px; color: #d5e2ea; background: rgba(27, 46, 64, .9); border-radius: 10px; padding: 6px 9px; margin-top: 6px; line-height: 1.55; }
.reasons div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- 操作バー ---------- */
.actions { display: flex; gap: 8px; align-items: center; min-height: 50px; }
.actions .hint { flex: 1; font-size: 12px; color: var(--muted); line-height: 1.35; }
.cta {
  border-radius: 13px; background: linear-gradient(135deg, var(--gold), var(--gold2)); color: #1b2533;
  font-weight: 800; padding: 0 20px; min-height: 48px; font-size: 16px; box-shadow: 0 4px 14px rgba(229, 169, 101, .25);
}
.cta.wide { flex: 1; }
.cta.sub { background: #2c4458; color: #fff; border: 1px solid #5b7488; box-shadow: none; font-weight: 700; }
.thinking { display: flex; align-items: center; gap: 8px; font-size: 14px; color: #dfe9ef; }
.dots span { display: inline-block; width: 6px; height: 6px; margin: 0 2px; border-radius: 99px; background: var(--mint); animation: blink 1s infinite; }
.dots span:nth-child(2) { animation-delay: .15s; } .dots span:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 100% { opacity: .25 } 50% { opacity: 1 } }

/* ---------- タイトル・終了 ---------- */
.title { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 12px; padding: 10px 6px; overflow-y: auto; }
.title .logo { font: 700 clamp(38px, 12vw, 58px)/1.1 Georgia, 'Hiragino Mincho ProN', 'Yu Mincho', serif; color: var(--gold); text-shadow: 0 4px 24px rgba(255, 190, 110, .3); }
.title .tag { font-size: 14px; color: #d6e1e8; line-height: 1.6; }
.title .hero { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; width: min(100%, 420px); }
.title .hero .art { border-radius: 10px; box-shadow: 0 6px 16px rgba(0, 0, 0, .35); }
.title .play { font-size: 20px; min-height: 60px; width: min(100%, 360px); border-radius: 16px; }
.title .cont { width: min(100%, 360px); min-height: 46px; }
.coms { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; width: min(100%, 420px); }
.coms div { background: var(--panel); border: 1px solid #2f465c; border-radius: 10px; padding: 6px 4px; font-size: 11px; color: var(--muted); line-height: 1.4; }
.coms b { display: block; font-size: 12.5px; color: #fff; }
.links { display: flex; gap: 14px; justify-content: center; font-size: 13px; }
.links button { color: var(--mint); text-decoration: underline; text-underline-offset: 3px; }
.end-rank { display: grid; gap: 6px; width: min(100%, 380px); }
.end-rank div { display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid #2f465c; border-radius: 12px; padding: 8px 12px; font-size: 15px; }
.end-rank div.me { border-color: var(--gold2); }
.end-rank .r { font-weight: 800; color: var(--gold); width: 2.2em; }
.end-rank .s { margin-left: auto; font-weight: 800; font-size: 20px; color: #f7dca8; }
.end-note { font-size: 12.5px; color: #cad7e0; line-height: 1.6; }

/* ---------- モーダル ---------- */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(5, 10, 18, .82); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal .box { background: #18263a; border: 1px solid #3d5670; border-radius: 16px; width: min(100%, 520px); max-height: 88dvh; overflow-y: auto; padding: 16px; font-size: 13.5px; line-height: 1.7; color: #d9e4eb; }
.modal .box h3 { margin: 0 0 6px; color: var(--gold); font-size: 17px; }
.modal .box h4 { margin: 12px 0 2px; font-size: 14px; color: #fff; }
.modal .box p, .modal .box ul { margin: 4px 0; }
.modal .box ul { padding-left: 20px; }
.modal .zoombox { width: min(92vw, 70dvh, 560px); text-align: center; }
.modal .zoombox .art { border-radius: 14px; box-shadow: 0 10px 40px rgba(0, 0, 0, .6); --cw: min(92vw, 70dvh, 560px); }
.modal .zoombox .nm { margin-top: 10px; font: 700 20px Georgia, 'Hiragino Mincho ProN', serif; color: var(--gold); }
.modal .zoombox .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.modal .close { margin-top: 12px; }

@media (min-width: 700px) {
  .app { padding-left: 18px; padding-right: 18px; }
  .brand { font-size: 20px; }
  .chip .nm { font-size: 12px; }
  .chip .sc { font-size: 20px; }
  .tile .lbl { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* いまやること・目的 */
.stagebar .todo { display: inline-block; font-size: 11px; font-weight: 800; color: #10261f; background: var(--mint); border-radius: 99px; padding: 1px 8px; margin-right: 6px; vertical-align: 1px; }
.stagebar .guide { font-size: 13.5px; line-height: 1.5; }
.stagebar .guide small { font-size: 11.5px; color: var(--muted); }
.top .iconbtn + .iconbtn { margin-left: 2px; }
.howto ol { padding-left: 22px; margin: 6px 0; }
.howto li { margin: 3px 0; }
.modal .zoombox .zimg { display: block; max-width: 100%; max-height: 72dvh; margin: 0 auto; border-radius: 14px; box-shadow: 0 10px 40px rgba(0, 0, 0, .6); }

/* 得点が飛ぶ */
.point-token {
  position: fixed; z-index: 41; pointer-events: none; font-size: 20px; font-weight: 900; color: #fff6dc;
  text-shadow: 0 2px 8px rgba(0, 0, 0, .6), 0 0 14px rgba(255, 200, 110, .8);
}
.point-token.p3 { font-size: 26px; color: #ffe08a; }
.point-token.p2 { font-size: 22px; color: #bff0e0; }

/* ラウンドの進み具合（全8ラウンドで終了） */
.round { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 3px 10px 4px; line-height: 1.1; font-weight: 700; }
.round small { font-weight: 400; color: var(--muted); }
.round .segs { display: flex; gap: 2px; }
.round .segs i { width: 8px; height: 4px; border-radius: 2px; background: #3a5068; }
.round .segs i.done { background: var(--gold2); }
.round .segs i.now { background: var(--mint); }
.round.last { border-color: var(--rose); color: #ffd2d2; }
.lastflag { display: inline-block; font-size: 10.5px; font-weight: 800; color: #3a1010; background: var(--rose); border-radius: 99px; padding: 0 7px; margin-right: 6px; }
.goalline { background: rgba(244, 211, 148, .12); border-radius: 10px; padding: 6px 10px; }
/* カードが集まる演出（裏向き） */
.backs { display: grid; grid-template-columns: repeat(4, minmax(0, 90px)); gap: 10px; }
.back { aspect-ratio: var(--aspect); border-radius: 10px; opacity: .18; transform: translateY(12px) scale(.92);
  background: var(--back-img, radial-gradient(circle at 50% 40%, #3b5677, #1a2639 70%)) center / cover; border: 2px solid #4b6580; transition: all .35s ease-out; }
.back.in { opacity: 1; transform: none; box-shadow: 0 6px 16px rgba(0, 0, 0, .4); }
body:not(.has-back) .back::after { content: '✦'; display: grid; place-items: center; height: 100%; color: var(--gold); font-size: 28px; }
/* GPT画像（public/ui/）があるとき */
body.has-bg { background: linear-gradient(rgba(10, 16, 28, .35), rgba(10, 16, 28, .55)), var(--bg-img) center / cover no-repeat fixed, #111a29; }
body.has-bg .tile { background: rgba(36, 54, 76, .82); }
.chip { display: flex; align-items: center; justify-content: center; gap: 5px; }
.chip .nmsc { display: flex; flex-direction: row; align-items: baseline; justify-content: center; gap: 6px; min-width: 0; }
.chip .nmsc .nm { flex: 0 1 auto; min-width: 0; }
.chip .av { width: 30px; height: 30px; border-radius: 99px; object-fit: cover; flex: none; }
.chip .av.emo { font-size: 20px; width: auto; height: auto; }
.chip.narr .av { box-shadow: 0 0 0 2px var(--gold); }
@media (max-width: 360px) { .chip .av { width: 24px; height: 24px; } .chip { gap: 3px; } }
.av-s { width: 18px; height: 18px; border-radius: 99px; vertical-align: -4px; }
.av-m { width: 30px; height: 30px; border-radius: 99px; }
.av-t { width: 18px; height: 18px; border-radius: 99px; vertical-align: -4px; margin-right: 4px; }
.howto-logo { display: block; width: 72px; height: 72px; margin: 0 auto 2px; }
.title-logo { width: 96px; height: 96px; filter: drop-shadow(0 4px 16px rgba(255, 200, 110, .35)); }
.top .logo-img { height: 26px; width: auto; }

/* 🔍（すべてのカードに常に表示。選択中は目立たせる） */
.tile .zoom { width: 30px; height: 30px; font-size: 14px; opacity: .85; }
.tile .zoom.on { opacity: 1; background: rgba(244, 211, 148, .95); }
/* 大きく見るビューア */
.viewer { width: min(94vw, 560px); display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.viewer .vtop { display: flex; align-items: center; gap: 10px; font-size: 14px; color: #dbe5ec; }
.viewer .vtop .vcount { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--muted); }
.viewer .vimg { cursor: zoom-out; display: flex; align-items: center; justify-content: center; touch-action: pan-y; }
.viewer .zimg { display: block; max-width: 100%; max-height: 62dvh; border-radius: 14px; box-shadow: 0 10px 40px rgba(0, 0, 0, .6); user-select: none; -webkit-user-drag: none; }
.viewer .vimg .art { width: min(90vw, 62dvh); --cw: min(90vw, 62dvh); }
.viewer .vnav { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.iconbtn.big { width: 52px; height: 44px; font-size: 26px; line-height: 1; }
.viewer .vdots { display: flex; gap: 6px; }
.viewer .vdots i { width: 9px; height: 9px; border-radius: 99px; background: #3d546c; }
.viewer .vdots i.sel { background: var(--gold2); }
.viewer .vdots i.now { outline: 2px solid #fff; outline-offset: 1px; }
.viewer .vpick { display: flex; }
.viewer .vpick .cta { flex: 1; }
.viewer .hint { text-align: center; font-size: 12px; color: var(--muted); }

/* 4枚の場面は高さを固定（場面が変わってもカードが動かない） */
.stagebar.fixed .prompt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stagebar.fixed .guide { height: 2.9em; display: flex; flex-direction: column; justify-content: center; overflow: hidden; line-height: 1.45; }
.stagebar.fixed .guide .g1, .stagebar.fixed .guide .g2 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stagebar .hl { color: #ffe3b5; font-size: 15px; }
.tile .foot { display: flex; align-items: center; gap: 4px; height: 20px; padding-top: 3px; overflow: hidden; }
.tile .foot .who-own { flex: 1; min-width: 0; text-align: left; padding: 0 2px; height: auto; line-height: 1.2; }
.tile .foot .voters { display: flex; gap: 2px; flex: none; min-height: 0; padding: 0; height: auto; }
.tile .foot .voters span { font-size: 9.5px; padding: 1px 5px; }
.rs { font-size: 13px; line-height: 1.6; padding: 3px 0; border-top: 1px solid #2c3e52; }
.subttl { margin: -4px 0 6px; font-size: 12.5px; color: var(--mint); }
.viewer .vinfo { background: rgba(27, 46, 64, .95); border-radius: 10px; padding: 6px 10px; font-size: 13px; color: #dce7ee; }
.howto .subttl { margin: -4px 0 6px; font-size: 12.5px; color: var(--mint); }
.brand { white-space: nowrap; }
.tile:has(.foot) .mine { bottom: 30px; }
.stagebar .prompt .pending { color: var(--muted); font-size: .7em; font-weight: 600; letter-spacing: .1em; }
.stagebar.pick { height: 134px; display: flex; flex-direction: column; justify-content: center; gap: 2px; overflow: hidden; }
.stagebar.pick .chips { margin-top: 3px; gap: 5px; }
.stagebar.pick .chips .opt { font-size: 13.5px; padding: 3px 10px; min-height: 30px; }
.errlist { text-align: left; font-size: 12px; color: #f2c4b8; max-width: 90vw; margin: 8px auto; }
/* 投票者は小さな顔で（持ち主の名前の幅を確保） */
.tile .foot .voters span.vav { padding: 0; width: 18px; height: 18px; border-radius: 99px; display: grid; place-items: center; font-size: 11px; background: #2b3f55; overflow: hidden; }
.tile .foot .voters span.vav.ok { box-shadow: 0 0 0 2px var(--mint); }
.tile .foot .voters .av-v { width: 18px; height: 18px; border-radius: 99px; object-fit: cover; display: block; }
.tile .foot .voters .av-v.emo { font-size: 12px; width: auto; height: auto; }
.viewer .vnote { text-align: center; font-size: 11.5px; color: var(--muted); margin-top: 4px; }
/* 指で押しやすいように、見た目は小さくても押せる範囲は44px以上 */
.iconbtn::before { content: ''; position: absolute; inset: -8px; }
.iconbtn { position: relative; }
.top .iconbtn { width: 38px; height: 34px; }
.tile[data-act] { cursor: zoom-in; }
.viewer .vpick { flex-wrap: wrap; }
.viewer .vpick .vnote { flex-basis: 100%; }
.viewer .vpick .vwho { flex-basis: 100%; text-align: center; font-size: 12px; color: var(--mint); letter-spacing: .1em; }
.viewer .vpick .chips { flex-basis: 100%; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.viewer .vpick .chips .opt { font-size: 14.5px; padding: 4px 12px; min-height: 36px; }
.viewer.withchips .zimg { max-height: calc(100dvh - 360px); }
.viewer .vact { display: flex; z-index: 2; }
.viewer .vact .cta { flex: 0 0 auto; }
.viewer .vact .hint { text-align: left; }
.viewer .vstate { flex-basis: 100%; text-align: center; font-size: 14px; font-weight: 700; padding: 6px; border-radius: 10px; }
.viewer .vstate.on { color: var(--gold); background: rgba(244, 211, 148, .12); }
.viewer .vstate.off { color: var(--muted); }
/* お題の札（チップ）：明朝体＋金の細枠、選ぶと金箔のように光る */
.chips .opt {
  position: relative; font-family: 'Hiragino Mincho ProN', 'Yu Mincho', 'Noto Serif JP', Georgia, serif; font-weight: 600; letter-spacing: .06em;
  color: #f6e7c4; border-radius: 8px; border: 1px solid transparent;
  background:
    linear-gradient(180deg, rgba(34, 44, 74, .96), rgba(22, 28, 52, .96)) padding-box,
    linear-gradient(135deg, #f4d394, #8b6a3a 45%, #f4d394 70%, #a07c45) border-box;
  box-shadow: inset 0 1px 0 rgba(255, 236, 190, .18), 0 2px 8px rgba(0, 0, 0, .35);
  text-shadow: 0 1px 0 rgba(0, 0, 0, .5);
  transition: transform .12s, box-shadow .2s, background .2s;
}
.chips .opt::before, .chips .opt::after { content: '✦'; font-size: .55em; color: #d9b675; opacity: .75; vertical-align: middle; }
.chips .opt::before { margin-right: .45em; }
.chips .opt::after { margin-left: .45em; }
.chips .opt:active { transform: scale(.96); }
.chips .opt.sel {
  color: #2a1d0a; text-shadow: 0 1px 0 rgba(255, 245, 220, .6);
  background:
    linear-gradient(180deg, #fbe7b5, #e9bf6e 55%, #d9a74f) padding-box,
    linear-gradient(135deg, #fff3d0, #b8893f) border-box;
  box-shadow: 0 0 0 2px rgba(244, 211, 148, .35), 0 0 16px rgba(244, 211, 148, .55), inset 0 1px 0 #fff6dc;
}
.chips .opt.sel::before, .chips .opt.sel::after { color: #7a5420; opacity: 1; }
.chips .opt:disabled { opacity: .38; filter: grayscale(.6); text-decoration: line-through; text-decoration-color: rgba(246, 231, 196, .5); }
/* 押せる範囲を上下に少し広げる（見た目の大きさはそのまま） */
.chips .opt > .hit { position: absolute; inset: -5px -2px; }
.stagebar.pick .chips .opt::before, .stagebar.pick .chips .opt::after { content: none; }
.stagebar.pick .chips .opt { letter-spacing: .02em; }
.chips .opt .usedtag { font-family: sans-serif; font-size: 9.5px; margin-left: 4px; text-decoration: none; display: inline-block; }
.box.confirm { text-align: center; max-width: 340px; }
.box.confirm .row { display: flex; gap: 8px; margin-top: 12px; }
.box.confirm .row .cta { flex: 1; }
.title h1.logo, .title p.tag { margin: 0; }
/* 選んだカードにだけ出る「拡大」ボタン */
.tile .zbtn { position: absolute; right: 8px; bottom: 8px; z-index: 3; padding: 6px 11px; min-height: 34px; border-radius: 99px; border: 1px solid rgba(255, 236, 190, .8);
  background: rgba(20, 26, 46, .82); color: #fbe7b5; font-size: 13px; font-weight: 700; letter-spacing: .05em; box-shadow: 0 2px 10px rgba(0, 0, 0, .45); backdrop-filter: blur(4px); cursor: zoom-in; }
.tile .zbtn::before { content: ''; position: absolute; inset: -6px; }
.tile:has(.foot) .zbtn { bottom: 30px; }
.tile.tap { cursor: pointer; }
/* 絵が並ぶ演出（裏からくるっと回って表に） */
.cards.deal { perspective: 900px; }
.cards.deal .tile { animation: dealIn .62s cubic-bezier(.2, .8, .25, 1) both; animation-delay: calc(var(--i, 0) * 85ms + var(--dealt, 0ms)); }
.cards.deal .tile::after { content: ''; position: absolute; inset: 0; border-radius: inherit; z-index: 6; pointer-events: none;
  background: var(--back-img, radial-gradient(circle at 50% 40%, #3b5677, #1a2639 70%)) center / cover; border: 2px solid #4b6580;
  animation: dealBack .62s linear both; animation-delay: calc(var(--i, 0) * 85ms + var(--dealt, 0ms)); }
.cards.deal .tile:nth-child(2) { --i: 1; } .cards.deal .tile:nth-child(3) { --i: 2; } .cards.deal .tile:nth-child(4) { --i: 3; }
.cards.deal .tile:nth-child(5) { --i: 4; } .cards.deal .tile:nth-child(6) { --i: 5; }
@keyframes dealIn { 0% { transform: translateY(26px) rotateY(180deg) scale(.9); opacity: 0; } 18% { opacity: 1; } 100% { transform: none; opacity: 1; } }
@keyframes dealBack { 0%, 48% { opacity: 1; } 52%, 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cards.deal .tile, .cards.deal .tile::after { animation: none; } .cards.deal .tile::after { display: none; } }
.cards.deal-wait .tile::after { content: ''; position: absolute; inset: 0; border-radius: inherit; z-index: 6; background: var(--back-img, #24384c) center / cover; border: 2px solid #4b6580; }
/* ---- GPTのUI画像 ---- */
/* お題の札：藍の和紙＋金の縁（端の飾りは伸ばさない） */
body.has-tag .chips .opt { border-style: solid; border-color: transparent; border-width: 0 15px; border-image: var(--tag-img) 0 105 fill / 0 15px stretch; background: none; box-shadow: 0 2px 6px rgba(0, 0, 0, .35); border-radius: 0; padding-left: 6px; padding-right: 6px; }
body.has-tag .chips .opt::before, body.has-tag .chips .opt::after { content: none; }
body.has-tag .chips .opt.sel { filter: brightness(1.35) saturate(1.25); color: #fff6dc; text-shadow: 0 0 8px rgba(244, 211, 148, .9), 0 1px 0 #000; box-shadow: 0 0 14px rgba(244, 211, 148, .55); }
body.has-tag .chips .opt:disabled { filter: grayscale(.8) brightness(.7); }
/* ほんものの光 */
body.has-glow .tile.correct::before { content: ''; position: absolute; inset: -26%; z-index: -1; pointer-events: none; background: var(--glow-img) center / contain no-repeat; animation: glowIn .9s ease-out both; }
@keyframes glowIn { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: none; } }
/* 最終結果の背景 */
body.end-screen.has-endbg { background: linear-gradient(rgba(10, 16, 28, .2), rgba(10, 16, 28, .35)), var(--end-img) center / cover no-repeat fixed, #111a29; }
/* ラウンドの区切り */
.round-intro { position: fixed; left: 50%; top: 42%; transform: translate(-50%, -50%); width: min(92vw, 560px); z-index: 40; pointer-events: none; text-align: center; animation: riFade 1.7s ease-out both; }
.round-intro img { width: 100%; display: block; filter: drop-shadow(0 2px 8px rgba(0, 0, 0, .6)); }
.round-intro .ri-text { position: absolute; inset: 0; display: grid; place-items: center; font: 700 clamp(26px, 8vw, 40px) 'Hiragino Mincho ProN', 'Yu Mincho', 'Noto Serif JP', Georgia, serif; color: #fbe7b5; letter-spacing: .12em; text-shadow: 0 2px 10px rgba(0, 0, 0, .9), 0 0 18px rgba(244, 211, 148, .5); }
.round-intro::before { content: ''; position: absolute; inset: 18% -10%; background: radial-gradient(closest-side, rgba(12, 18, 34, .78), transparent); z-index: -1; }
@keyframes riFade { 0% { opacity: 0; transform: translate(-50%, -46%) scale(.96); } 18% { opacity: 1; transform: translate(-50%, -50%); } 72% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -54%); } }
@media (prefers-reduced-motion: reduce) { .round-intro { animation-duration: .01s; } }
body.has-tag .stagebar.pick .chips .opt { border-width: 0 11px; border-image-width: 0 11px; padding-left: 3px; padding-right: 3px; }
.tile .zbtn.mini { top: 8px; right: 8px; bottom: auto; padding: 0; width: 34px; min-height: 34px; height: 34px; font-size: 16px; display: grid; place-items: center; }
.tile:has(.foot) .zbtn.mini { bottom: auto; }
