/* Dota2Wisdom — dark theme design system
   Palette pulled from the logo: deep navy base, arcane-cyan (insight) + wisdom-gold. */
:root {
  /* surfaces */
  --bg: #0a0f1e;
  --bg-2: #0d1426;
  --surface: #111a30;
  --surface-2: #16203a;
  --border: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(61, 214, 230, 0.22);

  /* brand accents */
  --cyan: #3dd6e6;
  --cyan-soft: #74e7f2;
  --gold: #ebbf54;
  --gold-soft: #f7d888;

  /* text */
  --text: #e8eef8;
  --muted: #97a4be;
  --dim: #61708c;

  /* status */
  --danger: #ff7a7a;

  --radius: 14px;
  --radius-sm: 9px;
  --maxw: 960px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  line-height: 1.6;
  background:
    radial-gradient(1100px 520px at 50% -160px, rgba(61, 214, 230, 0.10), transparent 62%),
    radial-gradient(820px 460px at 88% -60px, rgba(235, 191, 84, 0.06), transparent 58%),
    linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 46%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

/* layout */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px 72px; }
.wrap--narrow { max-width: 620px; }

/* top bar + brand */
.topbar {
  display: flex; align-items: center; gap: 12px;
  max-width: var(--maxw); margin: 0 auto; padding: 18px 20px;
}
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; }
.brand img { width: 38px; height: 38px; filter: drop-shadow(0 0 9px rgba(61, 214, 230, 0.35)); }
.brand .name {
  font-size: 1.12rem; font-weight: 800; letter-spacing: 0.2px;
  background: linear-gradient(92deg, var(--gold), var(--gold-soft) 32%, var(--cyan));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.spacer { flex: 1; }

/* hero */
.hero { text-align: center; padding: 44px 0 8px; }
.hero .mark { width: 150px; height: 150px; filter: drop-shadow(0 0 34px rgba(61, 214, 230, 0.35)); }
.hero h1 {
  margin: 20px 0 8px; font-size: 2.6rem; font-weight: 800; letter-spacing: -0.5px;
  background: linear-gradient(92deg, var(--gold), var(--gold-soft) 35%, var(--cyan));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero .tagline { color: var(--muted); font-size: 1.12rem; margin: 0 auto 28px; max-width: 34ch; }

/* headings + text */
h1 { color: var(--text); font-size: 2rem; font-weight: 800; letter-spacing: -0.4px; line-height: 1.2; }
h2 {
  color: #cdd7e8; font-size: 1.15rem; font-weight: 700;
  margin: 42px 0 14px; padding-bottom: 10px; border-bottom: 1px solid var(--border);
}
h2 .count { color: var(--dim); font-weight: 500; font-size: 0.82em; margin-left: 6px; }
p { margin: 0 0 14px; }
a { color: var(--cyan); text-decoration: none; }
a:hover { color: var(--cyan-soft); text-decoration: underline; }
.muted { color: var(--muted); }
.muted-sm { color: var(--muted); font-size: 0.9rem; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 12px 22px; border-radius: var(--radius-sm);
  font-weight: 700; font-size: 0.98rem; cursor: pointer; border: 0;
  text-decoration: none; transition: transform .12s ease, box-shadow .2s ease, filter .2s ease, background .2s ease;
}
.btn:hover { text-decoration: none; }
.btn-primary {
  color: #0a0f1e;
  background: linear-gradient(135deg, var(--gold-soft), var(--gold));
  box-shadow: 0 6px 22px rgba(235, 191, 84, 0.26);
}
.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.05); box-shadow: 0 10px 30px rgba(235, 191, 84, 0.36); }
.btn-ghost { color: var(--cyan); background: rgba(61, 214, 230, 0.06); border: 1px solid var(--border-glow); }
.btn-ghost:hover { background: rgba(61, 214, 230, 0.13); transform: translateY(-1px); }

/* cards */
.card {
  background: linear-gradient(180deg, var(--surface), rgba(17, 26, 48, 0.72));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px 24px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}
.coach { border-left: 3px solid var(--gold); }
.coach-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.analyze-prompt { text-align: center; padding: 10px 0 4px; }

/* wisdom balance chip + admin panel */
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 11px; border-radius: 999px;
  font-size: 0.82rem; font-weight: 700; color: var(--gold-soft);
  background: rgba(235, 191, 84, 0.12); border: 1px solid rgba(235, 191, 84, 0.32);
}
.avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; display: block; }
.wisdom-form { display: flex; gap: 8px; align-items: center; }
.wisdom-input {
  width: 80px; padding: 6px 9px; border-radius: 8px;
  background: var(--surface-2); border: 1px solid var(--border); color: #dbe4f2; font-size: 0.85rem;
}
.mt-16 { margin-top: 16px; }
.section { margin-top: 34px; }
.stats { display: flex; flex-wrap: wrap; gap: 12px; }
.stat {
  flex: 1 1 150px;
  background: linear-gradient(180deg, var(--surface), rgba(17, 26, 48, 0.72));
  border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px;
}
.stat-value { font-size: 1.4rem; font-weight: 800; color: var(--gold-soft); font-variant-numeric: tabular-nums; }
.stat-label { font-size: 0.8rem; color: var(--muted); margin-top: 2px; }
.prompt-box {
  max-height: 420px; overflow: auto; margin: 16px 0 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; color: #cdd7e8; font-size: 0.85rem; line-height: 1.5;
  white-space: pre-wrap; word-break: break-word;
}
.chip-empty { color: #ffb3b3; background: rgba(255, 122, 122, 0.12); border-color: rgba(255, 122, 122, 0.34); }

/* out-of-wisdom inline notice */
.notice {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px; border-radius: var(--radius-sm);
  background: rgba(255, 122, 122, 0.10); border: 1px solid rgba(255, 122, 122, 0.30);
  color: #ffc2c2; font-size: 0.9rem; font-weight: 600;
}

/* confirm / info modal */
.modal-open { overflow: hidden; }
.modal-overlay {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(6, 10, 20, 0.72); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  opacity: 0; visibility: hidden; transition: opacity .18s ease, visibility .18s ease;
}
.modal-overlay.is-open { opacity: 1; visibility: visible; }
.modal {
  width: 100%; max-width: 400px; text-align: center;
  background: linear-gradient(180deg, var(--surface), rgba(17, 26, 48, 0.97));
  border: 1px solid var(--border-glow); border-radius: var(--radius);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  padding: 26px 24px 22px;
  transform: translateY(10px) scale(0.97); transition: transform .2s ease;
}
.modal-overlay.is-open .modal { transform: none; }
.modal-icon { font-size: 2.1rem; line-height: 1; margin-bottom: 10px; }
.modal-title { margin: 0 0 8px; font-size: 1.18rem; color: #fff; border: 0; padding: 0; }
.modal-text { margin: 0 0 20px; color: var(--muted); line-height: 1.55; font-size: 0.95rem; }
.modal-text strong { color: var(--gold-soft); }
.modal-actions { display: flex; gap: 10px; justify-content: center; }
.modal-actions .btn { min-width: 112px; justify-content: center; }

/* match detail scoreboard */
.teams { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 620px) { .teams { grid-template-columns: 1fr; } }
.team { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.team-head { display: flex; justify-content: space-between; align-items: center; font-weight: 700; color: #cdd7e8; margin-bottom: 8px; }
.score { display: grid; grid-template-columns: 34px 1fr auto auto; align-items: center; gap: 10px; padding: 5px 6px; border-radius: 8px; }
.score + .score { margin-top: 2px; }
.score.you { background: rgba(235, 191, 84, 0.10); outline: 1px solid rgba(235, 191, 84, 0.35); }
.hero-img { width: 34px; height: 20px; object-fit: cover; border-radius: 3px; }
.hero-cell { display: inline-flex; align-items: center; gap: 9px; }
.score-hero { font-size: 0.9rem; color: #d6deec; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score.you .score-hero { color: var(--gold-soft); font-weight: 700; }
.score-kda { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 0.85rem; }
.score-nw { font-variant-numeric: tabular-nums; color: var(--gold-soft); font-size: 0.82rem; min-width: 64px; text-align: right; }
.score-nw::before {
  content: ""; display: inline-block; width: 13px; height: 13px; margin-right: 4px; vertical-align: -2px;
  background: url("https://cdn.cloudflare.steamstatic.com/apps/dota2/images/dota_react/icons/gold.png") center/contain no-repeat;
}

/* coaching loading state */
.loading { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 24px 0; gap: 14px; }
.loading .muted-sm { line-height: 1.6; }
.spinner {
  width: 42px; height: 42px; border-radius: 50%;
  border: 3px solid rgba(61, 214, 230, 0.18); border-top-color: var(--cyan);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.coach-body { line-height: 1.65; color: #dbe4f2; font-size: 0.97rem; }
.coach-body h2 { color: var(--gold-soft); font-size: 1.15rem; margin: 1.4rem 0 .6rem; border: 0; padding: 0; }
.coach-body h2:first-child { margin-top: .3rem; }
.coach-body h3 { color: #cdd7e8; font-size: 1.02rem; margin: 1.1rem 0 .4rem; }
.coach-body p { margin: 0 0 .7rem; }
.coach-body ul, .coach-body ol { margin: 0 0 .8rem; padding-left: 1.4rem; }
.coach-body li { margin: .3rem 0; }
.coach-body strong { color: #fff; }
.coach-body code { background: var(--surface-2); }

/* code chip */
code {
  font-family: var(--mono); font-size: 0.9em;
  background: var(--surface-2); color: var(--cyan-soft);
  padding: 2px 7px; border-radius: 6px; border: 1px solid var(--border);
}

/* tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
thead th {
  text-align: left; padding: 11px 14px; background: var(--surface-2);
  color: #b9c6dd; font-weight: 600; border-bottom: 1px solid var(--border);
}
tbody td { padding: 9px 14px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); color: #d6deec; }
tbody tr:hover { background: rgba(61, 214, 230, 0.045); }
tbody tr:last-child td { border-bottom: 0; }
.time { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }

/* alert */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.alert-error { color: #ffd6d6; background: rgba(255, 122, 122, 0.08); border-color: rgba(255, 122, 122, 0.3); }

.row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.mt-24 { margin-top: 24px; }

/* small button (in-table action) */
.btn-sm { padding: 7px 15px; font-size: 0.85rem; }

/* match-type tag (Ranked / Unranked / Turbo …) */
.tag {
  display: inline-block; padding: 1px 9px; border-radius: 999px;
  font-size: 0.75rem; font-weight: 600; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--border);
}

/* win/loss pills */
.pill { display: inline-block; padding: 2px 11px; border-radius: 999px; font-size: 0.78rem; font-weight: 700; }
.pill-win { color: #7ff0c4; background: rgba(79, 214, 160, 0.14); border: 1px solid rgba(79, 214, 160, 0.32); }
.pill-loss { color: #ffb3b3; background: rgba(255, 122, 122, 0.12); border: 1px solid rgba(255, 122, 122, 0.32); }

/* pager */
.pager { display: flex; gap: 6px; justify-content: center; align-items: center; flex-wrap: wrap; margin-top: 30px; }
.pager a, .pager span {
  min-width: 40px; height: 40px; padding: 0 11px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9px; border: 1px solid var(--border);
  color: var(--text); text-decoration: none; font-size: 0.92rem; transition: background .15s ease, border-color .15s ease;
}
.pager a:hover { background: rgba(61, 214, 230, 0.10); border-color: var(--border-glow); text-decoration: none; }
.pager .current { background: linear-gradient(135deg, var(--gold-soft), var(--gold)); color: #0a0f1e; border: 0; font-weight: 800; }
.pager .gap { border: 0; color: var(--dim); min-width: 22px; }
.pager .disabled { opacity: 0.4; }
