:root {
  --bg: #0F2E24; --card: #16392D; --soft: #1C4436; --line: #24493B;
  --ink: #F3EBDD; --muted: #A9B8AE; --gold: #C9A24A; --gold-text: #D4B060;
  --gold-soft: #2B3F2C; --gain: #5FD39A; --gain-soft: #1F4A38; --loss: #FF8A7A;
  color-scheme: dark;
}
* { box-sizing: border-box; min-width: 0; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 16px/1.5 Heebo, system-ui, sans-serif; overflow-x: clip; }
button, input, textarea, select { font: inherit; }
a { color: var(--gold-text); }
.center { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.splash-logo { width: 72px; opacity: .9; }

/* layout */
.top { position: sticky; top: 0; z-index: 4; background: var(--bg);
  padding: calc(env(safe-area-inset-top) + 10px) 18px 10px; display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--line); }
.top img { width: 26px; height: 38px; object-fit: contain; }
.top .brand { flex: 1; line-height: 1.15; }
.top .brand b { display: block; font-weight: 800; font-size: 16px; }
.top .brand span { font-size: 12px; color: var(--gold); letter-spacing: .08em; }
.iconbtn { background: none; border: 0; color: var(--muted); min-width: 44px; min-height: 44px; border-radius: 12px; cursor: pointer; font-size: 14px; }
main { max-width: 760px; margin: 0 auto; padding: 18px 18px calc(96px + env(safe-area-inset-bottom)); }
h1 { font-size: 28px; line-height: 1.15; margin: 4px 0 14px; font-weight: 800; }
h2 { font-size: 18px; margin: 24px 0 10px; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

nav.tabs { position: fixed; bottom: 0; inset-inline: 0; z-index: 5; background: var(--card); border-top: 1px solid var(--line);
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding-bottom: env(safe-area-inset-bottom); }
nav.tabs a { color: var(--muted); text-decoration: none; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; min-height: 62px; font-size: 12px; font-weight: 600; }
nav.tabs a svg { width: 22px; height: 22px; }
nav.tabs a[aria-current=page] { color: var(--gold-text); }
@media (min-width: 900px) {
  nav.tabs { position: sticky; top: 0; bottom: auto; max-width: 760px; margin: 0 auto; background: none; border: 0; }
  main { padding-bottom: 40px; }
}

/* cards & lists */
.list { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: start; background: var(--card);
  border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; color: inherit; text-decoration: none; cursor: pointer; font: inherit; }
.row .main { flex: 1; }
.row .t { font-weight: 700; }
.row .s { color: var(--muted); font-size: 14px; }
.row.hl { background: var(--gold-soft); border-color: transparent; }
.check { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; flex: none; color: var(--bg); font-weight: 800; font-size: 14px; }
.check.on { background: var(--gain); border-color: var(--gain); }
.empty { background: var(--card); border: 1px dashed var(--gold); border-radius: 14px; padding: 20px; text-align: center; color: var(--muted); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.bar { height: 8px; background: var(--soft); border-radius: 9px; overflow: hidden; margin-top: 8px; }
.bar i { display: block; height: 100%; background: var(--gold); }
.tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 1px 9px; border-radius: 999px; background: var(--soft); color: var(--muted); }
.tag.gold { background: var(--gold-soft); color: var(--gold-text); }
.tag.green { background: var(--gain-soft); color: var(--gain); }
.tag.red { background: #3D2A24; color: var(--loss); }

/* buttons & forms */
.btn { min-height: 46px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; }
.btn.pri { background: var(--gold); border-color: var(--gold); color: #0F2E24; }
.btn.danger { color: var(--loss); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
label { display: block; font-size: 14px; font-weight: 600; margin: 12px 0 4px; }
input, textarea, select { width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--soft); color: var(--ink); font-size: 16px; }
textarea { min-height: 90px; resize: vertical; }
input[type=checkbox] { width: 22px; min-height: 22px; height: 22px; accent-color: var(--gold); }
.checkline { display: flex; align-items: center; gap: 10px; margin: 12px 0; font-weight: 600; }
.err { color: var(--loss); font-size: 14px; min-height: 1.2em; margin-top: 6px; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* login */
.login { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; max-width: 420px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 24px) 24px 24px; }
.login .logo { width: 86px; display: block; margin: 0 auto 14px; }
.login h1 { text-align: center; margin-bottom: 4px; }
.login .sub { text-align: center; color: var(--gold); letter-spacing: .1em; font-size: 14px; margin-bottom: 26px; }

/* video */
.video { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: 14px; overflow: hidden; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* chat */
.chat { display: flex; flex-direction: column; height: calc(100vh - 120px); height: calc(100dvh - 120px); }
.chat-head { padding: 12px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.chat-head .t { font-weight: 800; flex: 1; }
.msgs { flex: 1; overflow-y: auto; padding: 14px 18px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 82%; align-self: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 8px 12px; }
.msg.me { align-self: flex-end; background: var(--gold-soft); border-color: transparent; }
.msg .who { font-size: 13px; font-weight: 700; color: var(--gold-text); display: flex; gap: 8px; align-items: center; }
.msg .who .time { color: var(--muted); font-weight: 400; margin-inline-start: auto; }
.msg .body { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg .more { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0 4px; min-width: 32px; min-height: 28px; font-size: 18px; line-height: 1; }
.msg.deleted .body { color: var(--muted); font-style: italic; }
.composer { display: flex; gap: 8px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--bg); }
.composer textarea { min-height: 46px; max-height: 140px; }
.composer .btn { flex: none; }
@media (max-width: 899px) { .chat { height: calc(100dvh - 62px - env(safe-area-inset-bottom) - 64px); } }

/* sheet & toast */
.sheet { position: fixed; inset: 0; background: rgba(5, 15, 11, .65); display: none; align-items: flex-end; justify-content: center; z-index: 20; }
.sheet.open { display: flex; }
.panel { background: var(--bg); width: 100%; max-width: 620px; max-height: 92vh; overflow: auto; border-radius: 22px 22px 0 0;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); border: 1px solid var(--line); }
.panel h2 { margin-top: 0; }
@media (min-width: 700px) { .sheet { align-items: center; } .panel { border-radius: 22px; } }
.toast { position: fixed; bottom: calc(80px + env(safe-area-inset-bottom)); inset-inline: 0; margin: auto; width: max-content; max-width: 90vw;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 30; }
.toast.on { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }
