/* テーマはライブ会場。残り回答数はペンライト、判定は「塗り+記号」で区別する */
:root {
  --bg:#e9edfb; --card:#ffffff; --ink:#1c1f4d; --sub:#585d86; --line:#cdd3ee;
  --accent:#d6246e; --on-accent:#ffffff;
  --hit:#8ee6b4; --hit-edge:#0f8a55;
  --part:#ffd966; --part-edge:#b97f00;
  --miss:#c5cadb; --miss-edge:#8c93ad; --miss-ink:#2c3052;
  --stick-off:#c3c9e6;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg:#191d42; --card:#2a3064; --ink:#f1f2ff; --sub:#b4b9e4; --line:#454c8c;
    --accent:#ff6aa9; --on-accent:#23102a;
    --hit:#13764a; --hit-edge:#5ff0a8;
    --part:#8a6100; --part-edge:#ffce4a;
    --miss:#0f1230; --miss-edge:#5a6094; --miss-ink:#b9bddb;
    --stick-off:#3b4178;
  }
}
* { box-sizing:border-box; }
[hidden] { display:none !important; }
body { margin:0; background:var(--bg); color:var(--ink);
  font:16px/1.6 "Zen Kaku Gothic New", "Hiragino Sans", "Yu Gothic UI", system-ui, sans-serif; }
main { max-width:640px; margin:0 auto; padding:20px 16px 32px; }
h1, h2, .count { font-family:"Zen Maru Gothic", "Hiragino Maru Gothic ProN", system-ui, sans-serif; }
h1 { font-size:clamp(1.35rem, 6vw, 1.9rem); font-weight:900; line-height:1.3; margin:0; }
h1 small { display:inline-block; font-size:.75rem; font-weight:700; color:var(--sub); margin-left:8px; }
.lead { margin:4px 0 8px; color:var(--sub); font-size:.9rem; }
a { color:inherit; }
:focus-visible { outline:3px solid var(--accent); outline-offset:2px; }

/* 判定の凡例 */
.legend { display:flex; flex-wrap:wrap; gap:8px; margin:0 0 16px; }
.key { font-size:.8rem; font-weight:700; padding:2px 12px; border-radius:6px; border:2px solid; }
.key.hit { background:var(--hit); border-color:var(--hit-edge); }
.key.part { background:var(--part); border-color:var(--part-edge); }
.key.miss { background:var(--miss); border-color:var(--miss-edge); color:var(--miss-ink); }

/* 入力まわり */
input, button, select { font:inherit; color:var(--ink); background:var(--card); border:2px solid var(--line); border-radius:10px; }
button { padding:6px 16px; font-weight:700; font-size:.9rem; border-radius:99px; cursor:pointer; }
button:hover:not(:disabled) { border-color:var(--accent); }
button:disabled, input:disabled { opacity:.5; cursor:default; }
.search { position:relative; }
#q { width:100%; padding:12px 16px; font-size:1.05rem; border-color:var(--accent); }
#suggest { position:absolute; z-index:2; left:0; right:0; max-height:320px; overflow:auto; margin:4px 0 0; padding:4px;
  list-style:none; background:var(--card); border:2px solid var(--accent); border-radius:10px; }
#suggest li { display:flex; justify-content:space-between; gap:12px; padding:8px 12px; border-radius:6px; cursor:pointer; }
#suggest li.active, #suggest li:hover { background:var(--accent); color:var(--on-accent); }
#suggest li span:last-child { font-size:.8rem; white-space:nowrap; opacity:.8; }
#notice:not(:empty) { margin:8px 0 0; font-size:.9rem; font-weight:700; color:var(--accent); }

/* 回数、ペンライト、ボタン */
.status { display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin:12px 0 16px; }
.count { font-weight:700; margin-right:auto; }
#timer:not(:empty) { font-weight:700; color:var(--accent); font-variant-numeric:tabular-nums; }
#start { display:block; width:100%; margin-bottom:12px; padding:18px; font-size:1.6rem; font-weight:900;
  font-family:"Zen Maru Gothic", "Hiragino Maru Gothic ProN", system-ui, sans-serif;
  background:var(--accent); border-color:var(--accent); color:var(--on-accent); }
#lights { flex-basis:100%; order:-1; display:flex; justify-content:space-between; height:44px; padding:0 4px; }
#lights i { position:relative; width:10px; height:30px; border-radius:99px; background:var(--stick-off); transition:background-color .3s, box-shadow .3s; }
#lights i::after { content:""; position:absolute; left:2px; top:31px; width:6px; height:12px; border-radius:2px; background:var(--miss-edge); }
#lights i.on { background:var(--accent); box-shadow:0 0 10px 2px var(--accent); }
#lights i.won { background:var(--hit-edge); box-shadow:0 0 10px 2px var(--hit-edge); }

/* 回答カード */
#guesses { list-style:none; margin:0; padding:0; }
.card { background:var(--card); border:1px solid var(--line); border-radius:14px; padding:12px; margin-bottom:14px; }
.card h2 { font-size:1.1rem; line-height:1.4; margin:0 0 8px; overflow-wrap:anywhere; }
.card h2 small { display:inline-block; font-size:.75rem; font-weight:700; color:var(--sub); margin-left:8px; }
.card.sample { border:2px dashed var(--miss-edge); }
.card dl { margin:0; display:grid; gap:4px; }
.row { display:grid; grid-template-columns:6.2em 1fr; gap:8px; align-items:center; padding:6px 8px; border-radius:8px; border-left:8px solid; }
.row.hit { background:var(--hit); border-color:var(--hit-edge); }
.row.part { background:var(--part); border-color:var(--part-edge); }
.row.miss { background:var(--miss); border-color:var(--miss-edge); color:var(--miss-ink); }
.row dt { font-size:.8rem; font-weight:700; white-space:nowrap; }
.row dd { margin:0; min-width:0; display:flex; flex-wrap:wrap; gap:4px; align-items:center; overflow-wrap:anywhere; }
.year { margin-left:4px; white-space:nowrap; font-size:.9rem; }
.chip { display:inline-block; padding:0 8px; font-size:.85rem; border:1px solid currentColor; border-radius:6px; }
.chip.hit { background:var(--card); color:var(--ink); border:2px solid var(--hit-edge); font-weight:700; }
.row details { font-size:.85rem; }
.row details[open] { flex-basis:100%; }

/* 結果 */
#result:not(:empty) { margin-bottom:16px; }
#result .card { border:3px solid var(--accent); }
#result .card.won { border-color:var(--hit-edge); }
#result .card h2 { font-size:1.3rem; }
#result p { margin:4px 0; }
.share { display:inline-block; margin-top:8px; padding:10px 24px; border-radius:99px; font-weight:700;
  background:var(--accent); color:var(--on-accent); text-decoration:none; }

/* カスタム */
#custom { background:var(--card); border:1px solid var(--line); border-radius:14px; padding:10px 14px; margin-bottom:12px; }
#custom summary { cursor:pointer; font-weight:700; }
#custom fieldset { border:0; border-top:1px solid var(--line); margin:10px 0 0; padding:8px 0 0; }
#custom legend { float:left; width:100%; padding:0; margin-bottom:4px; font-size:.85rem; font-weight:700; }
#custom legend + * { clear:both; }
#custom input { accent-color:var(--accent); }
#custom select { padding:2px 6px; }
#summary, .note { color:var(--sub); font-size:.8rem; font-weight:400; }
.note { margin:2px 0 6px; }
.checks { display:flex; flex-wrap:wrap; gap:4px 16px; }

/* 遊び方ページ */
.lead a { display:inline-block; margin-left:8px; font-weight:700; }
.howto h2 { font-size:1.1rem; margin:24px 0 8px; padding-left:10px; border-left:6px solid var(--accent); }
.howto .card h2, .howto .card { margin-bottom:8px; }
.howto ul, .howto ol { margin:0; padding-left:1.4em; }
.howto li { margin-bottom:4px; }

footer { margin-top:24px; color:var(--sub); font-size:.8rem; }
@media (prefers-reduced-motion: reduce) { * { transition:none !important; } }
