:root {
  /* Base */
  --bg: #0a0a0f;
  --bg-card: rgba(22, 23, 32, 0.7);
  --bg-card-solid: #16171f;
  --text: #ededf2;
  --muted: #8a8d9b;
  --muted-2: #5d606e;
  --border: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.1);

  /* Status colors */
  --offline: #6b7280;
  --green: #34d399;
  --blue: #60a5fa;
  --yellow: #fbbf24;
  --red: #f43f5e;

  /* Active = drives the glow */
  --active: var(--offline);
  --active-glow: rgba(107, 114, 128, 0.45);
}

[data-status="offline"]     { --active: var(--offline); --active-glow: rgba(107, 114, 128, 0.35); }
[data-status="game_closed"] { --active: var(--green);   --active-glow: rgba(52, 211, 153, 0.55); }
[data-status="menu"]        { --active: var(--blue);    --active-glow: rgba(96, 165, 250, 0.55); }
[data-status="queue"]       { --active: var(--yellow);  --active-glow: rgba(251, 191, 36, 0.55); }
[data-status="in_match"]    { --active: var(--red);     --active-glow: rgba(244, 63, 94, 0.65); }

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv11";
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px 16px;
  padding-top: max(24px, env(safe-area-inset-top));
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  position: relative;
  overflow-x: hidden;
}

/* Animated background blobs */
.bg-blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  z-index: -1;
  pointer-events: none;
  transition: background 0.8s ease;
}
.bg-blob-1 {
  width: 420px;
  height: 420px;
  top: -100px;
  left: -150px;
  background: var(--active);
  animation: float-1 18s ease-in-out infinite;
}
.bg-blob-2 {
  width: 380px;
  height: 380px;
  bottom: -120px;
  right: -120px;
  background: var(--active);
  animation: float-2 22s ease-in-out infinite;
}
@keyframes float-1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, 60px) scale(1.1); }
}
@keyframes float-2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-50px, -40px) scale(0.92); }
}

/* ── Card ─────────────────────────────────────────────────── */

.card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  backdrop-filter: blur(40px) saturate(140%);
  -webkit-backdrop-filter: blur(40px) saturate(140%);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 22px 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* ── Header ───────────────────────────────────────────────── */

.head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.head-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.2px;
}
.logo-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--active);
  box-shadow: 0 0 12px var(--active-glow);
  transition: background 0.4s, box-shadow 0.4s;
}
.title { color: var(--text); }
.sep { color: var(--muted-2); }
.sub-title { color: var(--muted); font-weight: 500; }
.clock {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.5px;
}

/* ── Hero ─────────────────────────────────────────────────── */

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 8px 0 4px;
}

.dot-wrap {
  position: relative;
  width: 180px;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dot-halo {
  position: absolute;
  inset: -20px;
  border-radius: 50%;
  background: radial-gradient(circle at center, var(--active-glow) 0%, transparent 65%);
  filter: blur(10px);
  opacity: 0.9;
  transition: background 0.4s;
}
[data-status="in_match"] .dot-halo {
  animation: halo-pulse 2.2s ease-in-out infinite;
}
@keyframes halo-pulse {
  0%, 100% { transform: scale(1);   opacity: 0.85; }
  50%      { transform: scale(1.18); opacity: 1; }
}

.dot {
  position: relative;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, rgba(255,255,255,0.18), transparent 50%),
    radial-gradient(circle at center, var(--active), color-mix(in srgb, var(--active) 60%, black));
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.08) inset,
    0 20px 50px var(--active-glow),
    0 0 80px var(--active-glow);
  transition: background 0.4s, box-shadow 0.4s;
}
.dot-inner {
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 38%, rgba(255,255,255,0.12), transparent 55%);
}

.status {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -1.2px;
  text-align: center;
  line-height: 1;
  background: linear-gradient(180deg, var(--text) 0%, color-mix(in srgb, var(--text) 75%, var(--active)) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sub {
  color: var(--muted);
  font-size: 15px;
  text-align: center;
  font-weight: 500;
  letter-spacing: 0.1px;
  min-height: 22px;
}

.score {
  display: flex;
  align-items: baseline;
  gap: 14px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-top: 4px;
}
.score-self, .score-enemy {
  font-size: 64px;
  letter-spacing: -3px;
  line-height: 1;
}
.score-self { color: var(--text); }
.score-enemy { color: var(--muted); }
.score-sep {
  font-size: 32px;
  color: var(--muted-2);
  font-weight: 400;
  transform: translateY(-8px);
}

.ranks {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 6px;
  width: 100%;
  list-style: none;
  padding: 0;
}
.ranks li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 12px;
  color: var(--muted);
}
.ranks li .rank-acct { color: var(--text); font-weight: 500; }
.ranks li .rank-val  { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 11.5px; }
.ranks li .rank-val .rank-tier { color: var(--active); font-weight: 600; }
.ranks.compact li { font-size: 11.5px; padding: 6px 10px; }

/* ── CTA Section ──────────────────────────────────────────── */

.cta-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.msg-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 13.5px;
  transition: border-color 0.2s, background 0.2s;
}
.msg-input::placeholder { color: var(--muted-2); }
.msg-input:focus {
  outline: none;
  border-color: var(--blue);
  background: rgba(96, 165, 250, 0.04);
}

/* ── CTA Button ───────────────────────────────────────────── */

.cta {
  position: relative;
  width: 100%;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.05), transparent 60%),
    linear-gradient(135deg, #5b6cff, #8366f8);
  color: white;
  border: none;
  border-radius: 16px;
  padding: 17px 20px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.2px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform 0.08s, box-shadow 0.2s, opacity 0.2s, filter 0.2s;
  box-shadow:
    0 10px 30px rgba(91, 108, 255, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  font-family: inherit;
}
.cta:hover { filter: brightness(1.08); }
.cta:active { transform: scale(0.98); }
.cta:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.3);
}
.cta.success {
  background: linear-gradient(135deg, #10b981, #059669);
  box-shadow: 0 10px 30px rgba(16, 185, 129, 0.4);
}
.cta.error {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  box-shadow: 0 10px 30px rgba(239, 68, 68, 0.4);
}
.cta-icon { font-size: 17px; }

/* ── History ──────────────────────────────────────────────── */

.history {
  border-top: 1px solid var(--border);
  padding-top: 16px;
}
.history summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  list-style: none;
  padding: 4px 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.1px;
}
.history summary::-webkit-details-marker,
.history summary::marker { display: none; }
.history-chevron {
  font-size: 14px;
  color: var(--muted-2);
  transition: transform 0.2s;
}
.history[open] .history-chevron { transform: rotate(180deg); }

.history ul {
  list-style: none;
  padding: 12px 0 0 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.history li {
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  color: var(--text);
}
.history li .hist-time { color: var(--muted); flex: 0 0 auto; font-size: 11.5px; }
.history li .hist-map  { font-weight: 600; }
.history li .hist-score { color: var(--muted); font-size: 11.5px; }
.history li .hist-result { font-weight: 700; padding: 2px 8px; border-radius: 6px; font-size: 11px; letter-spacing: 0.5px; }
.history li .res-W { background: rgba(52, 211, 153, 0.15); color: var(--green); }
.history li .res-L { background: rgba(244, 63, 94, 0.15); color: var(--red); }
.history li .res-D { background: rgba(139, 142, 155, 0.15); color: var(--muted); }

/* ── Footer ───────────────────────────────────────────────── */

.foot {
  color: var(--muted-2);
  font-size: 11px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.3px;
  padding-top: 4px;
  position: relative;
}
.gear {
  position: absolute;
  right: 0;
  top: -4px;
  background: transparent;
  border: none;
  color: var(--muted-2);
  font-size: 14px;
  cursor: pointer;
  opacity: 0.35;
  transition: opacity 0.2s, transform 0.2s;
  padding: 4px 6px;
  line-height: 1;
}
.gear:hover, .gear:focus { opacity: 0.85; transform: rotate(45deg); outline: none; }

/* ── Drawer ──────────────────────────────────────────────── */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10;
  animation: fade-in 0.2s ease;
}
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 460px;
  margin: 0 auto;
  background: var(--bg-card-solid);
  border: 1px solid var(--border-strong);
  border-bottom: none;
  border-radius: 24px 24px 0 0;
  padding: 22px 22px max(22px, env(safe-area-inset-bottom));
  z-index: 11;
  animation: slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.5);
}
@keyframes slide-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.drawer-head h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.4px;
}
.drawer-close {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-strong);
  color: var(--muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.2s, color 0.2s;
}
.drawer-close:hover { background: rgba(255,255,255,0.1); color: var(--text); }

.drawer-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.drawer-section h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.btn-add {
  background: rgba(91, 108, 255, 0.12);
  color: #a3b0ff;
  border: 1px solid rgba(91, 108, 255, 0.25);
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s;
}
.btn-add:hover { background: rgba(91, 108, 255, 0.2); }
.form-hint {
  font-size: 11.5px;
  color: var(--muted-2);
  line-height: 1.4;
}
.input-text {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 11px 12px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.2s, background 0.2s;
}
.input-text:focus {
  outline: none;
  border-color: var(--blue);
  background: rgba(96, 165, 250, 0.05);
}
.accounts {
  display: flex;
  flex-direction: column;
  gap: 6px;
  list-style: none;
  padding: 0;
  margin: 0;
}
.account-row {
  display: flex;
  gap: 6px;
  align-items: stretch;
}
.account-pseudo {
  flex: 1;
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 0 10px;
  transition: border-color 0.2s;
}
.account-pseudo:focus-within { border-color: var(--blue); background: rgba(96, 165, 250, 0.05); }
.acc-name, .acc-tag {
  background: transparent;
  border: none;
  color: var(--text);
  padding: 11px 0;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  min-width: 0;
}
.acc-name { flex: 1; }
.acc-tag { width: 56px; }
.acc-hash { color: var(--muted-2); padding: 0 2px; }

.acc-region {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
  padding: 0 28px 0 10px;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a8d9b' stroke-width='2'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 12px;
  width: 74px;
}
.acc-region:focus { border-color: var(--blue); }

.acc-del {
  background: rgba(244, 63, 94, 0.08);
  border: 1px solid rgba(244, 63, 94, 0.2);
  color: var(--red);
  width: 38px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  transition: background 0.15s;
}
.acc-del:hover { background: rgba(244, 63, 94, 0.18); }

.btn-save {
  margin-top: 6px;
  background: linear-gradient(135deg, #5b6cff, #8366f8);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 13px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: -0.2px;
  transition: filter 0.2s, transform 0.05s;
  box-shadow: 0 8px 24px rgba(91, 108, 255, 0.35);
}
.btn-save:hover { filter: brightness(1.08); }
.btn-save:active { transform: scale(0.98); }
.btn-save:disabled { opacity: 0.5; cursor: not-allowed; }

.form-status {
  font-size: 12px;
  text-align: center;
  color: var(--muted);
  min-height: 16px;
}
.form-status.ok    { color: var(--green); }
.form-status.error { color: var(--red); }

/* Subtle fade-in on load */
.card { animation: fade-up 0.6s cubic-bezier(0.16, 1, 0.3, 1) backwards; }
@keyframes fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Mobile tweaks */
@media (max-width: 380px) {
  .dot-wrap { width: 150px; height: 150px; }
  .dot      { width: 140px; height: 140px; }
  .status   { font-size: 28px; }
  .score-self, .score-enemy { font-size: 52px; letter-spacing: -2px; }
}
