:root {
  --bg: #fbf7f2; --card: #fff; --ink: #1f1a17; --muted: #5f5650; --line: #e6ddd4;
  --red: #9f1d2b; --red-ink: #fff; --green: #1f6b45; --soft: #f4ece3; --danger: #a4161a; --focus: #1a5fb4;
  --radius: 14px; --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.06);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink); background: var(--bg);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #161312; --card: #221d1b; --ink: #f3ece6; --muted: #b9aea6; --line: #3a322e; --red: #d9475a; --red-ink: #1a0b0d; --green: #5fc191; --soft: #2b2421; --danger: #ff8a8a; --focus: #8ab4ff; }
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; line-height: 1.5; font-size: 17px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px max(16px, env(safe-area-inset-left)); border-bottom: 1px solid var(--line); background: var(--card); position: sticky; top: 0; z-index: 2; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.2rem; color: var(--ink); text-decoration: none; min-height: 44px; }
#nav { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
main { max-width: 760px; margin: 0 auto; padding: 20px 16px 64px; outline: none; }
h1 { font-size: 1.6rem; margin: 8px 0 4px; line-height: 1.25; }
h2 { font-size: 1.2rem; margin: 0 0 10px; }
h3 { font-size: 1.05rem; margin: 0; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 16px 0; box-shadow: var(--shadow); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1 1 180px; min-width: 0; }
.stack > * + * { margin-top: 10px; }
label { display: block; font-weight: 600; margin-bottom: 4px; }
input, textarea { width: 100%; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: 44px; }
textarea { min-height: 96px; resize: vertical; }
input:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
button, .btn { font: inherit; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; min-width: 44px; padding: 8px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--soft); color: var(--ink); cursor: pointer; text-decoration: none; }
button.primary, .btn.primary { background: var(--red); border-color: var(--red); color: var(--red-ink); }
button.danger { color: var(--danger); }
button.link { background: none; border: none; color: var(--muted); padding: 8px 10px; }
button:disabled { opacity: .55; cursor: default; }
.token { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .06em; font-size: 1.05rem; }
input.token { text-transform: uppercase; text-align: center; font-size: 1.25rem; }
.hero { text-align: center; padding: 26px 18px; }
.hero h1 { font-size: 1.8rem; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 99px; background: var(--soft); color: var(--muted); font-size: .9rem; }
.badge.ok { color: var(--green); }
.reveal { width: 100%; min-height: 140px; border: 2px dashed var(--red); background: var(--soft); border-radius: var(--radius); font-size: 1.1rem; flex-direction: column; }
.match-name { font-size: 2.2rem; font-weight: 800; color: var(--red); margin: 4px 0 12px; overflow-wrap: anywhere; }
ul.wishes { list-style: none; padding: 0; margin: 0; }
ul.wishes li { padding: 10px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
ul.wishes li:last-child { border-bottom: 0; }
ul.wishes a { color: var(--focus); }
.wish-edit { border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: var(--bg); }
.wish-edit input { background: var(--card); }
.people { list-style: none; padding: 0; margin: 0; }
.people li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.people li:last-child { border-bottom: 0; }
.people .name { font-weight: 700; overflow-wrap: anywhere; }
.rounds a.round { display: block; color: inherit; text-decoration: none; }
.rounds a.round:hover h3 { text-decoration: underline; }
.error { color: var(--danger); font-weight: 600; }
details summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 600; }
#toast { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 99px; box-shadow: var(--shadow); max-width: calc(100% - 32px); z-index: 5; }
@media (max-width: 420px) { body { font-size: 16px; } .match-name { font-size: 1.8rem; } }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
select { width: 100%; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; min-height: 44px; }
select:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.btn.quiet { background: none; border-color: transparent; color: var(--muted); font-weight: 500; text-decoration: underline; }
.notice { background: var(--soft); border-left: 4px solid var(--red); padding: 8px 12px; border-radius: 8px; font-weight: 600; }
.badge.new { background: var(--red); color: var(--red-ink); font-weight: 700; margin-left: 6px; vertical-align: middle; }
ol.chat { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 360px; overflow-y: auto; }
ol.chat li { max-width: 85%; padding: 8px 12px; border-radius: 14px; background: var(--soft); align-self: flex-start; overflow-wrap: anywhere; white-space: pre-wrap; }
ol.chat li.mine { align-self: flex-end; background: var(--green); color: var(--card); }
ol.chat li.empty { background: none; color: var(--muted); padding-left: 0; }
ol.chat .who { display: block; font-size: .8rem; opacity: .85; white-space: normal; }
ol.chat li.mine .who { color: inherit; }
.chat-box textarea { min-height: 64px; }
[hidden] { display: none !important; }
