:root {
  color-scheme: dark light;
  --bg: #0e1118; --fg: #eef1f8; --muted: #8f99b3; --accent: #79a9ff; --panel: #161a25; --border: #272d3c; --danger: #d64545; --good: #3dbb5d;
  --warn-bg: #3b2f12; --warn-fg: #f3d58a;
}
@media (prefers-color-scheme: light) {
  :root { --bg: #f4f5f9; --fg: #12163a; --muted: #667089; --panel: #ffffff; --border: #e3e6ee; --accent: #2563eb; --danger: #c62828; --warn-bg: #fff4d6; --warn-fg: #6b4e00; }
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--fg); font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif; }
.top { display: flex; align-items: center; justify-content: space-between; padding: .7rem 1.25rem; background: color-mix(in srgb, var(--panel) 75%, transparent); color: var(--fg); border-bottom: 1px solid var(--border); backdrop-filter: blur(16px) saturate(1.25); -webkit-backdrop-filter: blur(16px) saturate(1.25); }
.brand { color: var(--fg); font-weight: 700; font-size: 1.45rem; letter-spacing: -.02em; text-decoration: none; }
.brand { display: inline-flex; align-items: center; gap: .55rem; }
.brand .logo { width: 2.6rem; height: 2.6rem; flex: none; }
.top-note { font-size: .85rem; opacity: .8; }
main { width: min(100% - 2rem, 56rem); margin: 1.5rem auto 3rem; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 1.6rem; margin-bottom: 1rem; }
h1 { margin: 0 0 .5rem; font-size: 1.6rem; letter-spacing: -.01em; }
h2 { margin: 0 0 .6rem; font-size: 1.05rem; }
h3 { margin: 1rem 0 .35rem; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.lead { margin: 0 0 1rem; color: var(--muted); font-size: 1.02rem; }
.points { margin: 0 0 1rem; padding-left: 1.2rem; color: var(--muted); }
.points li { margin: .25rem 0; }
.warning { margin: 0 0 1.25rem; padding: .8rem 1rem; border-radius: 10px; background: var(--warn-bg); color: var(--warn-fg); }
.error { margin: 1rem 0 0; color: var(--danger); font-weight: 600; }
.note { margin: 0 0 .75rem; color: var(--muted); font-size: .85rem; }
.status { margin: 1rem 0; color: var(--muted); }
button { font: inherit; font-size: .9rem; padding: .55rem 1rem; border-radius: 9px; border: 1px solid var(--border); background: color-mix(in srgb, var(--fg) 8%, var(--panel)); color: var(--fg); cursor: pointer; }
button:hover { background: color-mix(in srgb, var(--fg) 15%, var(--panel)); }
button:disabled { opacity: .55; cursor: default; }
button.primary { background: var(--accent); border-color: transparent; color: #fff; font-weight: 600; }
button.primary:hover { filter: brightness(1.1); }
button.danger { background: var(--danger); border-color: transparent; color: #fff; font-weight: 600; }
button.danger:hover { filter: brightness(1.1); }
button.small { padding: .3rem .7rem; font-size: .8rem; }
[hidden] { display: none !important; }
.codes { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: .9rem; margin: 1rem 0; }
.code-box { display: flex; flex-direction: column; align-items: flex-start; gap: .3rem; padding: 1rem 1.1rem; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); }
.label { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.digits { font-size: 2.2rem; font-variant-numeric: tabular-nums; letter-spacing: .06em; line-height: 1.1; }
.buttons { display: flex; flex-wrap: wrap; gap: .6rem; }
.live .banner { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem; padding: .85rem 1.1rem; margin-bottom: 1rem; border-radius: 12px; background: color-mix(in srgb, var(--good) 18%, var(--panel)); border: 1px solid color-mix(in srgb, var(--good) 55%, var(--border)); }
.banner .dot { width: .7rem; height: .7rem; border-radius: 50%; background: var(--good); animation: pulse 1.6s ease-in-out infinite; }
.banner .timer { color: var(--muted); font-variant-numeric: tabular-nums; }
.banner button { margin-left: auto; }
@keyframes pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .banner .dot { animation: none; } }
.live-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); gap: 1rem; }
.live-grid .card { margin: 0; }
.chat { display: flex; flex-direction: column; min-height: 22rem; }
.chat-log { flex: 1; min-height: 12rem; max-height: 26rem; overflow-y: auto; display: flex; flex-direction: column; gap: .4rem; padding: .25rem 0 .75rem; }
.chat-log div { max-width: 85%; padding: .4rem .7rem; border-radius: 12px; overflow-wrap: anywhere; }
.chat-log .me { align-self: flex-end; background: var(--accent); color: #fff; }
.chat-log .them { align-self: flex-start; background: color-mix(in srgb, var(--fg) 12%, var(--panel)); }
#chat-form { display: flex; gap: .5rem; }
#chat-input { flex: 1; min-width: 0; font: inherit; padding: .5rem .7rem; border-radius: 9px; border: 1px solid var(--border); background: var(--bg); color: var(--fg); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .45rem 0; border-bottom: 1px solid var(--border); }
.list li.empty { color: var(--muted); border-bottom: 0; }
.list .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .size { color: var(--muted); font-size: .8rem; margin-left: .4rem; }
.list .actions { display: flex; gap: .35rem; flex: none; }
.row { display: flex; gap: .5rem; }
@media (max-width: 520px) { .digits { font-size: 1.8rem; } .card { padding: 1.2rem; } }

a.button { display: inline-block; font: inherit; font-size: .9rem; padding: .55rem 1rem; border-radius: 9px; border: 1px solid var(--border); color: var(--fg); text-decoration: none; }
a.button.primary { background: var(--accent); border-color: transparent; color: #fff; font-weight: 600; }
.row { align-items: center; flex-wrap: wrap; }
.how { margin-top: 1rem; }
.how summary { cursor: pointer; color: var(--accent); }
.how ol { margin: .6rem 0; padding-left: 1.2rem; color: var(--muted); }
.how li { margin: .35rem 0; }

button.give { margin-left: auto; }
.banner button.give { margin-left: auto; }
.banner button.give + button { margin-left: 0; }
.buttons button.give { margin-left: 0; }
dialog { width: min(100% - 2rem, 40rem); border: 1px solid var(--border); border-radius: 14px; background: var(--panel); color: var(--fg); padding: 1.5rem; }
dialog::backdrop { background: rgba(0, 0, 0, .55); }
dialog h2 { font-size: 1.3rem; margin: 0 0 .5rem; }
.steps { margin: 1rem 0; padding-left: 1.2rem; }
.steps li { margin: .8rem 0; }
.steps .note { margin: .4rem 0 0; }

.top-right { display: flex; align-items: center; gap: 1rem; }
a.top-button { color: var(--fg); text-decoration: none; font-size: .88rem; font-weight: 600; padding: .4rem .85rem; border: 1px solid var(--border); border-radius: 11px; background: transparent; white-space: nowrap; }
a.top-button:hover, a.top-button:focus-visible { background: color-mix(in srgb, var(--fg) 7%, transparent); }
@media (max-width: 520px) { .top-note { display: none; } }

.ask-note { color: var(--warn-fg); background: var(--warn-bg); padding: .2rem .6rem; border-radius: 999px; font-size: .85rem; font-weight: 600; }
button.give.ask { animation: ask 1s ease-in-out infinite; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 45%, transparent); }
@keyframes ask { 50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--accent) 15%, transparent); } }
@media (prefers-reduced-motion: reduce) { button.give.ask { animation: none; } }
