:root {
  --bg: #0b1020;
  --bg2: #111936;
  --panel: #161f45;
  --panel2: #1b2553;
  --line: #2a376b;
  --text: #e8ecff;
  --muted: #98a2d8;
  --accent: #5b8cff;
  --accent2: #22d3ee;
  --good: #34d399;
  --bad: #fb7185;
  --warn: #fbbf24;
  --radius: 14px;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --sans: 'Inter', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

/* hidden must always win over any CSS display rule */
[hidden] { display: none !important; }
body {
  font-family: var(--sans);
  background:
    radial-gradient(1000px 500px at 85% -10%, rgba(91, 140, 255, 0.18), transparent 60%),
    radial-gradient(800px 400px at -10% 10%, rgba(34, 211, 238, 0.12), transparent 55%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------------- top bar ---------------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 26px;
  max-width: 1080px;
  margin: 0 auto;
  width: 100%;
}
.brand { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.logo { font-size: 40px; }
.brand-name { font-weight: 800; font-size: 32px; letter-spacing: 0.3px; }
.donate {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #0b1020;
  font-weight: 700;
  padding: 9px 16px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 14px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.donate:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(91,140,255,.35); }

/* ---------------- layout ---------------- */
.container { max-width: 1080px; width: 100%; margin: 0 auto; padding: 10px 26px 60px; flex: 1; }
.view { animation: fade 0.3s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.hero { text-align: center; padding: 48px 0 20px; }
.hero h1 { font-size: clamp(30px, 5vw, 52px); line-height: 1.12; margin: 0 0 18px; letter-spacing: -0.5px; }
.hero h1 em { font-style: normal; background: linear-gradient(120deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lede { color: var(--muted); font-size: 17px; line-height: 1.6; max-width: 640px; margin: 0 auto 40px; }

.hero-cards { display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; }
.choice-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
  width: 280px;
  text-align: left;
  color: var(--text);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.choice-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 12px 30px rgba(91, 140, 255, 0.15);
}
.choice-icon { font-size: 30px; }
.choice-title { font-weight: 800; font-size: 19px; }
.choice-sub { color: var(--muted); font-size: 13.5px; line-height: 1.5; }

/* ---------------- panels ---------------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-top: 12px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.panel-head h2 { margin: 0; font-size: 22px; }
.pill { font-size: 12px; font-weight: 700; padding: 5px 12px; border-radius: 999px; letter-spacing: .3px; }
.pill-accent { background: rgba(34, 211, 238, 0.14); color: var(--accent2); border: 1px solid rgba(34,211,238,.3); }

.link-btn { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 14px; padding: 6px 2px; }
.link-btn:hover { color: var(--text); }

/* ---------------- session ---------------- */
.session-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 20px; }
@media (max-width: 760px) { .session-grid { grid-template-columns: 1fr; } }
.session-id-box, .session-meta-box { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 18px; }
.label { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin: 14px 0 6px; }
.label:first-child { margin-top: 0; }
.code-row { display: flex; align-items: center; gap: 10px; }
.code {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 26px;
  letter-spacing: 3px;
  color: var(--accent2);
  background: rgba(34, 211, 238, 0.08);
  border: 1px dashed rgba(34, 211, 238, 0.35);
  border-radius: 10px;
  padding: 8px 14px;
}
.link-text { font-family: var(--mono); font-size: 12px; color: var(--muted); word-break: break-all; }
.mini-btn {
  background: var(--accent);
  border: none;
  color: #fff;
  border-radius: 8px;
  padding: 8px 12px;
  font-weight: 700;
  font-size: 12.5px;
  cursor: pointer;
}
.mini-btn:hover { filter: brightness(1.1); }
.qr { width: 160px; height: 160px; border-radius: 8px; background: #fff; padding: 6px; margin-top: 4px; }

.meta-row { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; margin-bottom: 8px; color: var(--muted); }
.countdown { font-family: var(--mono); font-size: 22px; font-weight: 700; color: var(--text); }
.countdown.warn { color: var(--warn); }
.countdown.critical { color: var(--bad); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.55; } }

.progressbar { height: 10px; background: rgba(255,255,255,.06); border-radius: 999px; overflow: hidden; margin-bottom: 18px; }
.progressbar .bar { height: 100%; border-radius: 999px; width: 0%; transition: width .4s ease; }
.progressbar .bar.fill { background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.progressbar .bar.danger { background: linear-gradient(90deg, var(--warn), var(--bad)); }

.hint { color: var(--muted); font-size: 13px; line-height: 1.5; }
.warn { color: var(--warn); }

/* ---------------- dropzone ---------------- */
.dropzone {
  margin-top: 20px;
  border: 2px dashed var(--line);
  border-radius: 12px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.dropzone.dragover { border-color: var(--accent); background: rgba(91,140,255,.07); }
.dz-icon { font-size: 34px; }
.dz-click { color: var(--accent); text-decoration: underline; }
.dropzone p { margin: 6px 0; }

/* ---------------- file list ---------------- */
.file-list { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.file-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
}
.file-row .ficon { font-size: 20px; }
.file-row .fmeta { flex: 1; min-width: 0; }
.file-row .fname { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-row .fsub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.file-row .fstatus { font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.st-done { color: var(--good); }
.st-work { color: var(--accent2); }
.st-bad { color: var(--bad); }
.st-warn { color: var(--warn); }
.file-row .fbtn {
  background: var(--accent);
  border: none;
  color: #fff;
  border-radius: 8px;
  padding: 9px 14px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.file-row .fbtn:disabled { opacity: .5; cursor: not-allowed; }
.file-row .fbtn.remove { background: rgba(251,113,133,.15); color: var(--bad); border: 1px solid rgba(251,113,133,.35); }

.empty-state { text-align: center; color: var(--muted); padding: 30px 10px; }

/* ---------------- join ---------------- */
.join-box { max-width: 480px; margin: 10px auto; text-align: center; }
.join-row { display: flex; gap: 10px; justify-content: center; }
.code-input {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 20px;
  letter-spacing: 2px;
  padding: 12px 16px;
  width: 230px;
  text-align: center;
  text-transform: uppercase;
}
.code-input:focus { outline: none; border-color: var(--accent); }
.primary-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none;
  color: #0b1020;
  font-weight: 800;
  font-size: 14px;
  border-radius: 10px;
  padding: 12px 20px;
  cursor: pointer;
}
.primary-btn:disabled { opacity: .55; cursor: not-allowed; }
.ghost-btn { background: transparent; border: 1px solid var(--line); color: var(--muted); border-radius: 10px; padding: 12px 20px; font-weight: 700; cursor: pointer; }
.ghost-btn:hover { color: var(--text); border-color: var(--muted); }
.ghost-btn.danger { border-color: rgba(251,113,133,.4); color: var(--bad); margin-top: 14px; }
.ghost-btn.danger:hover { background: rgba(251,113,133,.08); border-color: var(--bad); }
.link-like { color: var(--accent); text-decoration: underline; cursor: pointer; }

.center-block { padding: 30px 10px; text-align: center; }
.spinner {
  width: 34px; height: 34px;
  border: 3px solid rgba(255,255,255,.12);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 12px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- modals ---------------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(4, 8, 20, 0.72);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 50;
  backdrop-filter: blur(3px);
}
.modal {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 26px;
  max-width: 460px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.modal h3 { margin: 0 0 10px; }
.modal p { line-height: 1.55; color: var(--muted); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }

/* ---------------- footer ---------------- */
.footer {
  border-top: 1px solid var(--line);
  padding: 26px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.7;
}
.footer a { color: var(--accent2); }
.footer .dim { opacity: .7; font-size: 12px; }

@media (max-width: 560px) {
  .container { padding: 6px 14px 40px; }
  .code { font-size: 20px; letter-spacing: 2px; }
  .join-row { flex-direction: column; align-items: center; }
  .code-input { width: 100%; }
}
