:root {
  --bg: #070a12; --panel: #0e1320; --panel2: #151b2b; --panel3: #1c2336; --line: rgba(255,255,255,.09); --line2: rgba(255,255,255,.16);
  --ink: #f3efe6; --muted: rgba(243,239,230,.62); --faint: rgba(243,239,230,.4);
  --gold: #d9b56b; --gold-ink: #1a1408; --gold-soft: rgba(217,181,107,.14);
  --ok: #7fd3a2; --warn: #f2c27b; --danger: #ff8a80; --radius: 14px;
  --font: Montserrat, system-ui, -apple-system, "Segoe UI", sans-serif;
  --topbar: rgba(7,10,18,.82); --glow: #18223a; --info-bg: rgba(127,167,217,.12); --info-line: rgba(127,167,217,.35); --info-ink: #aac6ec;
  color-scheme: dark;
}
/* light theme: follows the system unless the user picked one (data-theme on <html>) */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f5f2ea; --panel: #ffffff; --panel2: #f1ede3; --panel3: #e6dfd0; --line: rgba(30,25,15,.1); --line2: rgba(30,25,15,.2);
    --ink: #1d1b16; --muted: rgba(29,27,22,.64); --faint: rgba(29,27,22,.42);
    --gold: #94691d; --gold-ink: #ffffff; --gold-soft: rgba(148,105,29,.12);
    --ok: #217a4b; --warn: #9a5b00; --danger: #c0392b;
    --topbar: rgba(245,242,234,.86); --glow: #ece3cf; --info-bg: rgba(50,100,170,.08); --info-line: rgba(50,100,170,.3); --info-ink: #2a5a96;
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #f5f2ea; --panel: #ffffff; --panel2: #f1ede3; --panel3: #e6dfd0; --line: rgba(30,25,15,.1); --line2: rgba(30,25,15,.2);
  --ink: #1d1b16; --muted: rgba(29,27,22,.64); --faint: rgba(29,27,22,.42);
  --gold: #94691d; --gold-ink: #ffffff; --gold-soft: rgba(148,105,29,.12);
  --ok: #217a4b; --warn: #9a5b00; --danger: #c0392b;
  --topbar: rgba(245,242,234,.86); --glow: #ece3cf; --info-bg: rgba(50,100,170,.08); --info-line: rgba(50,100,170,.3); --info-ink: #2a5a96;
  color-scheme: light;
}
#lang-slot { display: flex; gap: 6px; align-items: center; }
.theme-toggle { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); cursor: pointer; font-size: 16px; display: grid; place-items: center; flex-shrink: 0; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.5;
  background: radial-gradient(ellipse at 70% -10%, var(--glow) 0%, var(--bg) 55%) fixed; background-color: var(--bg);
}
a { color: var(--gold); }
img, video { max-width: 100%; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 12px 20px;
  background: var(--topbar); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 800; font-size: 17px; white-space: nowrap; }
.brand .logo { width: 40px; height: 40px; border-radius: 10px; display: block; object-fit: cover; flex: none; box-shadow: 0 0 0 1px var(--line2); }
.topbar .spacer { flex: 1; }
.topbar .links { display: flex; gap: 8px; align-items: center; }
.lang-picker { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-weight: 600; font-size: 13px; cursor: pointer; }
@media (max-width: 560px) { .topbar { padding: 10px 14px; gap: 8px; } .brand span.name { display: none; } .topbar .links { gap: 6px; } .lang-picker { max-width: 118px; } }
@media (max-width: 420px) { .topbar > .badge { display: none; } .topbar .btn.small { padding: 6px 10px; } }
@media (max-width: 400px) { #days-left { display: none; } .lang-picker { max-width: 104px; } }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 12px; padding: 11px 18px; font-weight: 700; font-size: 14px;
  cursor: pointer; border: 1px solid var(--line2); background: var(--panel2); color: var(--ink); text-decoration: none; min-height: 44px; }
.btn:hover { border-color: var(--gold); }
.btn.primary { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn.danger { border-color: rgba(255,138,128,.5); color: var(--danger); }
.btn.small { min-height: 34px; padding: 6px 12px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: progress; }
.field { display: block; margin-top: 12px; }
.field > span { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.input, select.input, textarea.input { width: 100%; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; font-weight: 600; font-size: 14px; min-height: 44px; }
textarea.input { font-weight: 500; line-height: 1.5; resize: vertical; min-height: 96px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.label { font-size: 11px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--gold); margin-bottom: 10px; display: flex; justify-content: space-between; gap: 8px; }
.label small { color: var(--muted); letter-spacing: 0; text-transform: none; font-weight: 500; font-size: 12px; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg button { flex: 1 1 0; min-width: 72px; min-height: 42px; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 8px; font-weight: 600; font-size: 13px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 600; font-size: 14px; cursor: pointer; }
.toggle input { width: 44px; height: 24px; accent-color: var(--gold); flex-shrink: 0; }
input[type="range"] { width: 100%; accent-color: var(--gold); }
.hint { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ---------- cards ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 20px; }
.section + .section { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
.pill { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; background: var(--panel2); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--panel3); color: var(--muted); white-space: nowrap; }
.badge.ok { background: rgba(127,211,162,.14); color: var(--ok); }
.badge.warn { background: rgba(242,194,123,.14); color: var(--warn); }
.badge.err { background: rgba(255,138,128,.14); color: var(--danger); }
.banner { border-radius: 12px; padding: 12px 16px; font-weight: 600; font-size: 14px; background: rgba(242,194,123,.12); border: 1px solid rgba(242,194,123,.35); color: var(--warn); }
.banner.info { background: var(--info-bg); border-color: var(--info-line); color: var(--info-ink); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 100;
  background: var(--panel3); border: 1px solid var(--line2); border-radius: 12px; padding: 12px 18px; font-weight: 600; font-size: 14px;
  transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-color: rgba(255,138,128,.6); color: var(--danger); }

.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 50; display: none; align-items: center; justify-content: center; padding: 16px; }
.modal-back.open { display: flex; }
.modal { width: min(440px, 100%); background: var(--panel); border: 1px solid var(--line2); border-radius: 18px; padding: 22px; max-height: calc(100vh - 32px); overflow: auto; }
.modal h3 { font-size: 18px; margin-bottom: 6px; }

.spinner { width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--gold-soft); border-top-color: var(--gold); animation: spin 1s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } * { scroll-behavior: auto !important; } }

table.tbl { width: 100%; min-width: 760px; border-collapse: collapse; font-size: 13px; }
table.tbl th, table.tbl td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.tbl th { color: var(--muted); font-weight: 600; font-size: 12px; }
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; letter-spacing: .3px; }
.muted { color: var(--muted); }
