* { box-sizing: border-box; }
:root {
  --ink: #eef2ee; --muted: #a9b5ab; --panel: rgba(10, 16, 12, .88); --line: rgba(255,255,255,.12);
  --accent: #ffe14d; --up: #7fe08a; --down: #ff8a7a;
}
html, body { margin: 0; height: 100%; background: #0d1410; color: var(--ink); font-family: system-ui, -apple-system, "Hiragino Sans", sans-serif; overflow: hidden; }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

#hud { position: fixed; inset: 0; pointer-events: none; }
#camLabel { position: absolute; top: calc(16px + env(safe-area-inset-top)); left: 16px; font: 600 13px/1 ui-monospace, Menlo, monospace; letter-spacing: .08em; padding: 6px 8px; background: rgba(0,0,0,.45); border-radius: 4px; }
#camLabel:empty { display: none; }
#camLabel.rec::before { content: "●"; color: #ff4d4d; margin-right: 6px; }
#flash { position: absolute; left: 50%; top: 18%; transform: translateX(-50%); font-weight: 700; font-size: clamp(18px, 4vw, 28px); text-shadow: 0 2px 8px rgba(0,0,0,.7); opacity: 0; transition: opacity .2s; white-space: nowrap; }
#flash.show { opacity: 1; }
#skip { position: absolute; right: 16px; bottom: calc(20px + env(safe-area-inset-bottom)); font-size: 12px; padding: 6px 10px; background: rgba(0,0,0,.45); border-radius: 14px; color: #dfe6df; }
#skip[hidden] { display: none; }
#mute { position: fixed; top: calc(12px + env(safe-area-inset-top)); right: 12px; width: 40px; height: 40px; font-size: 18px; line-height: 1; border: 0; border-radius: 50%; background: rgba(0,0,0,.45); color: #fff; cursor: pointer; touch-action: manipulation; z-index: 5; }

#loading { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); margin: 0; padding: 10px 16px; background: var(--panel); border-radius: 8px; }

/* ---- 進行カード ---- */
#card {
  position: fixed; left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); max-width: 600px;
  max-height: calc(100% - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); overflow-y: auto; -webkit-overflow-scrolling: touch;
  margin: 0 auto; padding: 18px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; backdrop-filter: blur(6px);
  line-height: 1.6;
}
#card[hidden] { display: none; }
#card h1 { font-size: clamp(20px, 5vw, 26px); margin: 4px 0 10px; }
#card h2 { font-size: 18px; margin: 4px 0 12px; font-weight: 600; }
#card h3 { font-size: 12px; margin: 0 0 4px; color: var(--muted); font-weight: 600; letter-spacing: .06em; }
#card p { margin: 0 0 10px; }
.vs { font-size: .6em; color: var(--muted); margin: 0 6px; }
.kicker { font-size: 12px; color: var(--muted); letter-spacing: .08em; }
.hint { font-size: 13px; color: var(--muted); }
.lead { font-size: 15px; }
.call { font-weight: 700; color: var(--accent); }

.choices { display: grid; gap: 8px; margin-top: 12px; }
.choices button {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left;
  min-height: 48px; padding: 10px 14px; touch-action: manipulation; font: inherit; color: #0d1410; background: #e8f0e4; border: 0; border-radius: 8px; cursor: pointer;
}
.choices button span { font-weight: 700; }
.choices button small { font-size: 12px; opacity: .75; line-height: 1.5; }
.choices button:hover { background: #fff; }

.timer { height: 6px; background: rgba(255,255,255,.15); border-radius: 3px; overflow: hidden; }
.timer > div { height: 100%; width: 100%; background: var(--accent); }

.score { display: flex; align-items: baseline; gap: 10px; font-size: 18px; margin-bottom: 10px; }
.score strong { font-size: 24px; font-variant-numeric: tabular-nums; }
.clock { font: 600 13px ui-monospace, Menlo, monospace; padding: 2px 6px; background: rgba(255,255,255,.12); border-radius: 4px; }
.cardnote { display: flex; align-items: center; gap: 8px; }
.yellow { display: inline-block; width: 12px; height: 16px; background: #f5d020; border-radius: 2px; }
.points strong { font-size: 20px; }

.notice, .gauges { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; }

/* ニュース：紙面ふう */
.news { margin-top: 12px; padding: 10px 12px 4px; background: #f3efe4; color: #1b1b1b; border-radius: 6px; font-family: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif; }
.masthead { display: flex; justify-content: space-between; align-items: baseline; padding-bottom: 6px; margin-bottom: 8px; border-bottom: 3px double #1b1b1b; }
.masthead span { font-weight: 800; font-size: 15px; letter-spacing: .12em; }
.masthead small { font-family: system-ui, sans-serif; font-size: 11px; color: #6b665a; }
#card .news .headline { font-weight: 700; font-size: 14px; line-height: 1.5; margin: 0 0 8px; padding-bottom: 8px; border-bottom: 1px solid #d8d1bf; }
#card .news .headline:last-child { border-bottom: 0; }
#card .news .headline.top { font-size: 17px; font-weight: 800; }

/* SNS：タイムラインふう */
.sns { margin-top: 12px; padding: 10px; background: #15202b; border: 1px solid #2c3a47; border-radius: 10px; }
.sns h3 { color: #8899a6 !important; }
.post { display: grid; grid-template-columns: 34px 1fr; gap: 10px; font-size: 14px; padding: 10px 0; border-bottom: 1px solid #2c3a47; }
.post:last-child { border-bottom: 0; padding-bottom: 2px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px; color: #fff; }
.who { display: block; font-size: 13px; font-weight: 700; color: #e7ecf0; }
.who small { font-weight: 400; color: #8899a6; }
#card .post p { margin: 2px 0 6px; line-height: 1.5; color: #e7ecf0; }
.meta { display: flex; gap: 18px; font-size: 12px; color: #8899a6; }

.gauge { display: grid; grid-template-columns: 9em 1fr; align-items: center; gap: 10px; font-size: 13px; margin: 6px 0; }
.bar { height: 8px; background: rgba(255,255,255,.12); border-radius: 4px; overflow: hidden; }
.bar > div { height: 100%; background: #9fc6ff; transition: width .6s; }
.g-eye .bar > div { background: #ff9f6b; }
.g-public .bar > div { background: #c6a7ff; }
.up { color: var(--up); } .down { color: var(--down); }

.verdict { font-size: clamp(22px, 6vw, 30px); font-weight: 800; margin: 6px 0 12px !important; }
.verdict.error { color: #ff8a7a; } .verdict.correct { color: #7fe08a; } .verdict.ambiguous { color: var(--accent); }
blockquote { margin: 0 0 12px; padding: 8px 12px; border-left: 3px solid var(--line); font-size: 14px; color: #dfe6df; }

/* ---- 開発用 ---- */
#dev { position: fixed; left: 16px; right: 16px; bottom: 16px; max-width: 560px; margin: 0 auto; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-size: 13px; }
#dev[hidden] { display: none; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
#dev button { flex: 1 1 160px; min-height: 40px; font: inherit; font-weight: 600; color: #0d1410; background: #e8f0e4; border: 0; border-radius: 8px; cursor: pointer; }
.grow { flex: 1; display: flex; gap: 8px; align-items: center; }
.grow input { flex: 1; }
#vis { margin: 0; font-size: 12px; }
#vis .hidden { color: #ffb347; }
#vis .seen { color: #7fe08a; }

/* ---- 順位表 ---- */
.standings { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; }
.standings ol { list-style: none; margin: 0 0 6px; padding: 0; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: repeat(6, auto); grid-auto-flow: column; column-gap: 16px; font-size: 13px; }
.standings li { display: grid; grid-template-columns: 1.6em 1fr auto; gap: 6px; padding: 2px 4px; border-radius: 4px; }
.standings li.us { background: rgba(200, 56, 47, .35); font-weight: 700; }
.standings li.line { box-shadow: inset 0 -2px 0 var(--accent); }
.standings .pos { color: var(--muted); text-align: right; }
.standings .pts { font-variant-numeric: tabular-nums; }
@media (max-width: 420px) { .standings ol { grid-template-columns: 1fr; grid-template-rows: none; grid-auto-flow: row; } }
.warn { color: var(--down); font-weight: 600; }

/* ---- 遊び方 ---- */
.howto { margin: 0 0 14px; padding-left: 1.4em; font-size: 14px; }
.howto li { margin-bottom: 6px; }
.howto-gauges { margin: 0 0 12px; display: grid; gap: 8px; font-size: 13px; }
.howto-gauges dt { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.howto-gauges dd { margin: 2px 0 0 26px; color: var(--muted); }
.chip { width: 18px; height: 8px; border-radius: 4px; background: #9fc6ff; }
.g-public .chip { background: #c6a7ff; }
.g-eye .chip { background: #ff9f6b; }

/* これまでの記録（タイトル）と、エンディングの「初めて」「自己最高」 */
.records { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 4px; }
.records ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 13px; }
.records li::before { content: "✓"; color: var(--accent); margin-right: 8px; }
.records li.unseen { color: var(--muted); }
.records li.unseen::before { content: "・"; color: var(--muted); }
.badge { display: inline-block; vertical-align: middle; margin-left: 8px; padding: 2px 8px; font-size: 11px; font-weight: 700; color: #1b1b1b; background: var(--accent); border-radius: 10px; }
