/* ── Self-hosted DM Sans (no Google Fonts request) ── */
@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('./fonts/dm-sans-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('./fonts/dm-sans-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'DM Sans';
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url('./fonts/dm-sans-italic-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'DM Sans';
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url('./fonts/dm-sans-italic-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
*:focus         { outline: none; }
*:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }

:root {
  --bg:           #F3F4F6;
  --surface:      #FFFFFF;
  --surface2:     #F9FAFB;
  --border:       #D1D5DB;
  --border2:      #E5E7EB;
  --text:         #111827;
  --muted:        #6B7280;
  --muted2:       #9CA3AF;
  --accent:       #0969DA;
  --accent-hover: #0550AE;
  --accent-dim:   rgba(9,105,218,0.07);
  --green:        #1A7F37;
  --green-dim:    rgba(26,127,55,0.07);
  --green-border: rgba(26,127,55,0.22);
  --amber-text:   #9A6700;
  --amber-bg:     #FFF8C5;
  --amber-border: rgba(154,103,0,0.22);
  --teams:        #5C5EA6;
  --red:          #CF222E;
  --red-bg:       #FFEBE9;
  --red-border:   rgba(207,34,46,0.2);
  --term-bg:      #161B22;
  --term-bar:     #21262D;
  --radius:       6px;
  --radius-sm:    4px;
  --shadow-sm:    0 1px 2px rgba(0,0,0,0.06);
  --shadow:       0 1px 4px rgba(0,0,0,0.07), 0 0 0 1px rgba(0,0,0,0.04);
  --font:         'DM Sans', system-ui, sans-serif;
  --mono:         ui-monospace, 'Cascadia Code', 'Fira Code', monospace;
  --header-h:     52px;
  --nav-h:        52px;
}

html {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
}

/* ── System header ── */
.sys-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  gap: 1rem;
}

.sys-logo {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.sys-logo-icon { width: 18px; height: 18px; color: var(--accent); flex-shrink: 0; }
.sys-logo-name { font-size: 0.82rem; font-weight: 700; color: var(--text); letter-spacing: -0.01em; }
.sys-logo-ver  {
  font: 0.62rem var(--mono);
  color: var(--muted2);
  padding: 0.1rem 0.35rem;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 3px;
}

.sys-header-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}
.sys-case { font: 0.7rem var(--mono); color: var(--muted); letter-spacing: 0.02em; }

.sys-badge {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 0.18rem 0.5rem;
  border-radius: 99px;
  border: 1px solid;
}
.sys-badge[data-s="pending"]    { background: var(--surface2); color: var(--muted);      border-color: var(--border); }
.sys-badge[data-s="triaging"]   { background: var(--amber-bg); color: var(--amber-text); border-color: var(--amber-border); }
.sys-badge[data-s="reviewing"]  { background: var(--accent-dim); color: var(--accent);   border-color: rgba(9,105,218,0.2); }
.sys-badge[data-s="escalating"] { background: var(--green-dim); color: var(--green);     border-color: var(--green-border); }

.sys-esc {
  font-size: 0.62rem;
  color: var(--muted2);
  letter-spacing: 0.04em;
  display: none;
}
.sys-esc.show { display: inline; }

.sys-xp {
  font: 600 0.7rem var(--mono);
  color: var(--green);
  letter-spacing: 0.04em;
  transition: color 0.2s;
  cursor: pointer;
}
.sys-xp.bump { animation: xpBump 0.45s ease; }
@keyframes xpBump {
  0%, 100% { transform: scale(1);    color: var(--green); }
  40%       { transform: scale(1.3); color: var(--accent); }
}

/* ── Step nav ── */
.sys-steps-nav {
  position: fixed;
  top: var(--header-h);
  left: 0; right: 0;
  height: var(--nav-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 199;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 1.5rem;
}
.sys-steps-inner {
  display: flex;
  align-items: center;
  max-width: 540px;
  width: 100%;
}
.sys-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.22rem;
  flex-shrink: 0;
}
.sys-step-dot {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.58rem;
  font-weight: 700;
  color: var(--muted2);
  transition: all 0.25s;
}
.sys-step.active .sys-step-dot { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 0 0 3px rgba(9,105,218,0.14); }
.sys-step.done   .sys-step-dot { background: var(--green);  border-color: var(--green);  color: #fff; }
.sys-step-lbl {
  font-size: 0.56rem;
  font-weight: 600;
  color: var(--muted2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.sys-step.active .sys-step-lbl { color: var(--accent); }
.sys-step.done   .sys-step-lbl { color: var(--green);  }
.sys-step-line {
  flex: 1;
  height: 2px;
  background: var(--border2);
  margin-bottom: 14px;
  transition: background 0.25s;
}
.sys-step-line.done { background: var(--green); }

/* ── Main & stages ── */
.sys-main {
  padding-top: calc(var(--header-h) + var(--nav-h));
  min-height: 100vh;
}
.stage {
  display: none;
  padding: 2.5rem 1.5rem 5rem;
}
.stage.active  { display: block; animation: stageIn  0.3s cubic-bezier(0.22,1,0.36,1) both; }
.stage.leaving {                 animation: stageOut 0.2s ease both; display: block; }

@keyframes stageIn  { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes stageOut { from { opacity: 1; } to { opacity: 0; } }

/* ── Panel & card ── */
.panel { max-width: 600px; margin: 0 auto; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 1.25rem;
  background: var(--surface2);
  border-bottom: 1px solid var(--border2);
}
.card-lbl {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.card-ref { font: 0.62rem var(--mono); color: var(--muted2); }

.card-header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.card-back {
  font-size: 0.65rem;
  color: var(--muted2);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.15s;
  flex-shrink: 0;
  white-space: nowrap;
}
.card-back:hover { color: var(--accent); }

.compliance-pill {
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0.15rem 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 99px;
  transition: all 0.2s;
  white-space: nowrap;
}
.compliance-pill.done { background: var(--green-dim); border-color: var(--green-border); color: var(--green); }

.card-body { padding: 1.75rem 1.5rem; }

/* ── Intro ── */
.big-emoji { font-size: 2.75rem; margin-bottom: 1rem; line-height: 1; display: block; }
h1 {
  font-size: clamp(1.45rem, 4vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin-bottom: 0.75rem;
}
.lead {
  font-size: 0.95rem;
  color: var(--muted);
  margin-bottom: 1.75rem;
  line-height: 1.65;
}
.section-lead {
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
  line-height: 1.6;
}
.field-hint {
  font-size: 0.75rem;
  color: var(--muted);
  font-style: italic;
  margin-bottom: 1rem;
  line-height: 1.55;
}

/* ── Terminal ── */
.terminal {
  background: var(--term-bg);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1.25rem;
  border: 1px solid rgba(255,255,255,0.07);
}
.terminal-bar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.9rem;
  background: var(--term-bar);
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.t-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.t-dot:nth-child(1) { background: #FF5F56; }
.t-dot:nth-child(2) { background: #FFBD2E; }
.t-dot:nth-child(3) { background: #27C93F; }
.terminal-title {
  font: 0.68rem var(--mono);
  color: rgba(255,255,255,0.35);
  flex: 1; text-align: center;
}
.terminal-pulse {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #27C93F;
  animation: termPulse 1.1s ease-in-out infinite;
}
@keyframes termPulse { 0%,100% { opacity:1; } 50% { opacity: 0.25; } }

.diag-list {
  list-style: none;
  padding: 0.8rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font: 0.78rem var(--mono);
}
.diag-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity 0.22s ease, transform 0.22s ease;
  color: rgba(255,255,255,0.45);
}
.diag-item.show { opacity: 1; transform: none; }
.diag-icon { flex-shrink: 0; width: 1em; }
.diag-ok   .diag-icon { color: #3FB950; }
.diag-fail .diag-icon { color: #F85149; }
.diag-ok   .diag-text { color: rgba(255,255,255,0.45); }
.diag-fail .diag-text { color: rgba(255,255,255,0.92); }
.diag-note { margin-left: auto; padding-left: 1rem; color: rgba(255,255,255,0.25); flex-shrink: 0; }
.diag-fail .diag-note { color: rgba(248,81,73,0.65); }

/* ── Triage verdict ── */
.triage-verdict {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--amber-bg);
  border: 1px solid var(--amber-border);
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
}
.verdict-icon { font-size: 0.95rem; color: var(--amber-text); flex-shrink: 0; padding-top: 0.1em; }
.verdict-lbl {
  font-size: 0.68rem; font-weight: 700;
  color: var(--amber-text);
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-bottom: 0.2rem;
}
.verdict-body { font-size: 0.82rem; color: #7A5200; line-height: 1.5; }

/* ── Checklist (form style) ── */
.checklist {
  list-style: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 0.5rem;
}
.checklist li label {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  background: var(--surface);
  cursor: pointer;
  font-size: 0.88rem;
  line-height: 1.5;
  transition: background 0.1s;
  border-bottom: 1px solid var(--border2);
}
.checklist li:last-child label { border-bottom: none; }
.checklist li label:hover { background: var(--surface2); }
.checklist li.checked label {
  background: var(--green-dim);
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: rgba(26,127,55,0.35);
}

/* Custom checkbox */
input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 1.05em; height: 1.05em;
  border: 1.5px solid var(--border);
  border-radius: 3px;
  background: var(--surface);
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 0.18em;
  transition: all 0.15s;
  background-size: 70%;
  background-position: center;
  background-repeat: no-repeat;
}
input[type="checkbox"]:checked {
  background-color: var(--green);
  border-color: var(--green);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M2.5 6l2.5 2.5 4.5-5'/%3E%3C/svg%3E");
}

/* ── Field groups ── */
.field-group { margin-bottom: 1.25rem; }
.field-lbl {
  display: block;
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 0.5rem;
}
.field-desc {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
  line-height: 1.55;
}

/* ── Oath ── */
.oath {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.88rem;
  line-height: 1.65;
  transition: all 0.15s;
}
.oath:has(input:checked) { background: var(--green-dim); border-color: var(--green-border); }
.oath input[type="checkbox"]:checked { background-color: var(--green); border-color: var(--green); }

/* ── Achievement ── */
.achievement {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  padding: 0.9rem 1rem;
  background: var(--green-dim);
  border: 1px solid var(--green-border);
  border-radius: var(--radius);
  margin-top: 1rem;
}
.ach-stamp {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(26,127,55,0.15);
}
.ach-title {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 0.2rem;
}
.ach-desc { font-size: 0.82rem; color: var(--muted); line-height: 1.5; }

/* ── AI primary card (ki.itelio.com) ── */
.ai-card-primary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.1rem;
  width: 100%;
  background: var(--accent-dim);
  border: 1.5px solid var(--accent);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  margin-bottom: 0.85rem;
  transition: background 0.15s, box-shadow 0.15s, transform 0.12s;
}
.ai-card-primary:hover {
  background: color-mix(in srgb, var(--accent-dim) 100%, transparent);
  box-shadow: 0 0 0 3px rgba(9,105,218,0.12);
  transform: translateY(-1px);
}
[data-theme="dark"] .ai-card-primary:hover {
  box-shadow: 0 0 0 3px rgba(56,139,253,0.15);
}
.ai-primary-left { display: flex; align-items: center; gap: 0.75rem; }
.ai-primary-emoji { font-size: 1.5rem; line-height: 1; flex-shrink: 0; }
.ai-primary-name {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: -0.01em;
}
.ai-primary-sub { font-size: 0.72rem; color: var(--muted); margin-top: 0.1rem; }
.ai-primary-badge {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--accent);
  background: var(--surface);
  border: 1px solid rgba(9,105,218,0.25);
  border-radius: 99px;
  padding: 0.2rem 0.6rem;
  flex-shrink: 0;
  white-space: nowrap;
}

/* ── AI alternative cards row ── */
.ai-alt-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.ai-alt-label {
  font-size: 0.72rem;
  color: var(--muted2);
  white-space: nowrap;
  flex-shrink: 0;
}
.ai-alt-cards { display: flex; gap: 0.5rem; }
.ai-card-sm {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
  transition: border-color 0.15s, color 0.15s;
}
.ai-card-sm:hover { border-color: var(--accent); color: var(--accent); }

/* ── Contact box ── */
.contact-box {
  margin-top: 1rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.contact-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }

/* ── SLA timer ── */
.sla-row {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.65rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.sla-time {
  font: 600 0.95rem var(--mono);
  color: var(--text);
  letter-spacing: 0.06em;
  flex-shrink: 0;
}
.sla-row.urgent .sla-time { color: #B45309; animation: urgentPulse 1.5s ease-in-out infinite; }
.sla-row.expired .sla-time { color: var(--red); animation: none; }
.sla-note { font-size: 0.72rem; color: var(--muted); line-height: 1.4; }
@keyframes urgentPulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

/* ── Expired note ── */
.expired-note {
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.82rem;
  color: var(--red);
  line-height: 1.55;
}
.expired-note p { margin-bottom: 0.5rem; }

/* ── Case stats ── */
.case-stats {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border2);
}
.stat-lbl {
  font-size: 0.58rem;
  font-weight: 700;
  color: var(--muted2);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 0.4rem;
}
.stat-time,
.stat-fact {
  font-size: 0.75rem;
  color: var(--muted);
  font-style: italic;
  line-height: 1.6;
  margin-bottom: 0.2rem;
}

/* ── Typing box ── */
.typing-box {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.6rem;
  font-size: 0.7rem;
  color: var(--muted2);
  opacity: 0;
  transition: opacity 0.5s;
}
.typing-dots { display: flex; gap: 3px; align-items: center; }
.typing-dot {
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--muted2);
  animation: typingBounce 1.2s ease infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce { 0%,100% { transform: translateY(0); opacity: 0.4; } 50% { transform: translateY(-3px); opacity: 1; } }

/* ── Contact extras (secondary zone) ── */
.contact-extras { border-top: 1px solid var(--border2); margin-top: 1rem; padding-top: 1rem; }

/* ── Hall of shame ── */
.hall-of-shame {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
}
.hall-of-shame summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.85rem;
  min-height: 44px;
  cursor: pointer;
  list-style: none;
  transition: background 0.1s;
}
.hall-of-shame summary::-webkit-details-marker { display: none; }
.hall-of-shame summary:hover { background: var(--surface2); }
.hall-lbl {
  font-size: 0.62rem; font-weight: 700;
  color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.07em;
}
.hall-arrow { width: 14px; height: 14px; color: var(--muted2); transition: transform 0.2s; flex-shrink: 0; }
.hall-of-shame[open] .hall-arrow { transform: rotate(180deg); }
.hall-of-shame ul { list-style: none; border-top: 1px solid var(--border2); }
.hall-of-shame li {
  display: grid;
  grid-template-columns: 2.75rem 1fr auto;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.5rem 0.85rem;
  font-size: 0.75rem;
  border-bottom: 1px solid var(--border2);
  line-height: 1.4;
}
.hall-of-shame li:last-child { border-bottom: none; }
.hall-of-shame .q { font: 700 0.58rem var(--mono); color: var(--muted2); text-transform: uppercase; letter-spacing: 0.05em; }
.hall-of-shame li > span:nth-child(2) { color: var(--muted); }
.hall-of-shame .a { font-size: 0.72rem; font-weight: 600; color: var(--green); text-align: right; }

/* ── Konami message ── */
.konami-msg {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.6rem 0.85rem;
  background: var(--accent-dim);
  border: 1px solid rgba(9,105,218,0.18);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  color: var(--accent-hover);
  margin-bottom: 1rem;
  line-height: 1.4;
}

/* ── Buttons ── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--accent);
  color: #fff;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.6rem 1.1rem;
  font: 600 0.88rem/1 var(--font);
  cursor: pointer;
  margin-top: 1.25rem;
  text-decoration: none;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  box-shadow: 0 1px 3px rgba(9,105,218,0.25);
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 3px 8px rgba(9,105,218,0.25); }
.btn-primary svg { width: 13px; height: 13px; flex-shrink: 0; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 1.1rem;
  font: 500 0.88rem/1 var(--font);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, background 0.15s;
}
.btn-secondary:hover { border-color: var(--accent); background: var(--accent-dim); }
.btn-secondary.done { border-color: var(--green-border); color: var(--green); background: var(--green-dim); pointer-events: none; }

.btn-teams {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--teams);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.6rem 1.1rem;
  font: 600 0.88rem/1 var(--font);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: opacity 0.15s, transform 0.1s;
}
.btn-teams:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-icon { width: 16px; height: 16px; flex-shrink: 0; }

.btn-outline-sm {
  display: inline-flex;
  align-items: center;
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.9rem;
  font: 500 0.82rem/1 var(--font);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, color 0.15s;
}
.btn-outline-sm:hover { border-color: var(--accent); color: var(--accent); }
.btn-outline-sm.copied { border-color: var(--green-border); color: var(--green); pointer-events: none; }

.btn-link {
  background: none; border: none;
  color: var(--red);
  font: 0.78rem var(--font);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 0; display: block;
  opacity: 0.8;
}
.btn-link:hover { opacity: 1; }

.btn-share {
  display: block;
  width: 100%;
  margin-top: 0.75rem;
  background: none; border: none;
  font: 0.75rem var(--font);
  color: var(--muted);
  cursor: pointer;
  text-align: left;
  padding: 0;
  transition: color 0.15s;
  line-height: 1.4;
}
.btn-share:hover  { color: var(--accent); }
.btn-share.copied { color: var(--green); pointer-events: none; }

/* ── XP float ── */
.xp-float {
  position: fixed;
  bottom: 6rem;
  font: 700 0.95rem var(--font);
  color: var(--green);
  pointer-events: none;
  z-index: 700;
  white-space: nowrap;
  animation: xpRise 1.8s cubic-bezier(0.22,1,0.36,1) forwards;
}
@keyframes xpRise {
  0%   { opacity: 0;   transform: translateY(0); }
  15%  { opacity: 1; }
  70%  { opacity: 1;   transform: translateY(-30px); }
  100% { opacity: 0;   transform: translateY(-60px); }
}

/* ── Confetti ── */
#confetti {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 999;
  overflow: hidden;
}
.cp {
  position: absolute;
  top: -12px;
  animation: confettiFall linear both;
}
@keyframes confettiFall {
  0%   { transform: translateY(0)     translateX(0)           rotate(0deg);   opacity: 1; }
  100% { transform: translateY(110vh) translateX(var(--drift)) rotate(600deg); opacity: 0; }
}

/* ── Toast ── */
#toast {
  position: fixed;
  bottom: 2rem; left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--text);
  color: var(--bg);
  border-radius: 99px;
  padding: 0.6rem 1.2rem;
  font-size: 0.82rem;
  z-index: 600;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.22,1,0.36,1), opacity 0.3s;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Theme toggle button ── */
.theme-toggle {
  width: 28px; height: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface2);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle svg { width: 13px; height: 13px; }

/* Show moon in light mode, sun in dark mode */
.icon-sun  { display: none; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun  { display: block; }

/* ── Dark mode variables ── */
[data-theme="dark"] {
  --bg:           #0D1117;
  --surface:      #161B22;
  --surface2:     #1C2128;
  --border:       #30363D;
  --border2:      #21262D;
  --text:         #E6EDF3;
  --muted:        #8B949E;
  --muted2:       #6E7681;
  --accent:       #388BFD;
  --accent-hover: #58A6FF;
  --accent-dim:   rgba(56,139,253,0.12);
  --green:        #3FB950;
  --green-dim:    rgba(63,185,80,0.08);
  --green-border: rgba(63,185,80,0.28);
  --amber-text:   #D29922;
  --amber-bg:     rgba(210,153,34,0.08);
  --amber-border: rgba(210,153,34,0.28);
  --teams:        #7B83EB;
  --red:          #F85149;
  --red-bg:       rgba(248,81,73,0.08);
  --red-border:   rgba(248,81,73,0.22);
  --term-bg:      #010409;
  --term-bar:     #0D1117;
  --shadow-sm:    0 1px 2px rgba(0,0,0,0.4);
  --shadow:       0 1px 4px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.04);
}

/* ── Utilities ── */
.hidden { display: none !important; }
.sr-only { position: absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
.slide-in { animation: slideUp 0.35s cubic-bezier(0.22,1,0.36,1) both; }
@keyframes slideUp { from { opacity:0; transform: translateY(8px); } to { opacity:1; transform: none; } }

/* ── Responsive ── */
@media (max-width: 520px) {
  .sys-step-lbl  { display: none; }
  .sys-case      { display: none; }
  .sys-xp        { display: none; }
  #toast         { white-space: normal; text-align: center; width: calc(100% - 3rem); }
}

/* ── GIF side panel ── */
#gif-panel {
  position: fixed;
  /* needs relative context for the button */
  top: 50%;
  left: calc(50% + 330px);
  transform: translateY(-50%);
  width: 220px;
  z-index: 50;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}
#gif-panel.visible { opacity: 1; pointer-events: auto; }

#gif-img {
  width: 100%;
  border-radius: 8px;
  display: block;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  background: var(--surface2);
  min-height: 80px;
  pointer-events: none; /* let clicks pass through to the button */
}

.gif-refresh {
  position: absolute;
  top: 8px; right: 8px;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.9);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  opacity: 0.35; /* always subtly visible */
  transition: opacity 0.2s, transform 0.25s, background 0.15s;
}
.gif-refresh svg { width: 13px; height: 13px; }
#gif-panel:hover .gif-refresh,
.gif-refresh:focus-visible { opacity: 1; }
.gif-refresh:hover { transform: rotate(180deg); background: rgba(0,0,0,0.78); }

/* Hide on narrow viewports where there's no room */
@media (max-width: 1080px) { #gif-panel { display: none; } }

/* Respect reduced motion — hide animated content */
@media (prefers-reduced-motion: reduce) { #gif-panel { display: none; } }

/* ── Site footer ── */
.site-footer {
  border-top: 1px solid var(--border2);
  padding: 1rem 1.5rem;
  margin-top: 2rem;
}
.site-footer-inner {
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.72rem;
  color: var(--muted2);
}
.footer-nav { display: flex; gap: 1.25rem; }
.footer-nav a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}
.footer-nav a:hover { color: var(--accent); }

/* ── Legal pages ── */
.legal-main {
  padding: calc(var(--header-h) + 2.5rem) 1.5rem 4rem;
}
.legal-doc {
  max-width: 600px;
  margin: 0 auto;
}
.legal-doc h1 {
  font-size: clamp(1.4rem, 4vw, 1.9rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 2rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}
.legal-doc h2 {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 0.75rem;
}
.legal-doc section {
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border2);
}
.legal-doc section:last-of-type { border-bottom: none; }
.legal-doc p {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 0.75rem;
}
.legal-doc p:last-child { margin-bottom: 0; }
.legal-doc ul {
  margin: 0.5rem 0 0.75rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.legal-doc li { font-size: 0.9rem; color: var(--muted); line-height: 1.6; }
.legal-doc strong { color: var(--text); font-weight: 600; }
.legal-doc a { color: var(--accent); text-underline-offset: 3px; }
.legal-doc a:hover { color: var(--accent-hover); }
.legal-doc code {
  font: 0.82rem var(--mono);
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 3px;
  padding: 0.1em 0.35em;
}
.legal-contact {
  font-family: var(--mono);
  font-size: 0.85rem !important;
  color: var(--text) !important;
  padding: 0.6rem 0.9rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: inline-block;
  margin: 0.25rem 0 0.75rem;
}
.legal-date {
  font-size: 0.75rem !important;
  color: var(--muted2) !important;
  margin-top: 1.5rem !important;
}
.legal-back {
  font-size: 0.78rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}
.legal-back:hover { color: var(--accent); }

/* ── Skill tree modal ── */
.st-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 800;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
}
.st-modal {
  background: var(--surface);
  border: none;
  border-radius: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.st-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 1.25rem;
  border-bottom: 1px solid var(--border2);
  flex-shrink: 0;
}
.st-hdr-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  margin-bottom: 0.15rem;
}
.st-hdr-sub {
  font: 0.65rem var(--mono);
  color: var(--muted2);
  letter-spacing: 0.02em;
}
.st-close {
  width: 26px; height: 26px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface2);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.75rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: border-color 0.15s, color 0.15s;
  line-height: 1;
}
.st-close:hover { border-color: var(--red); color: var(--red); }
.st-scroll {
  overflow: hidden;
  flex: 1;
  position: relative;
  user-select: none;
  -webkit-user-select: none;
}
.st-svg {
  display: block;
  width: 100%;
  height: 100%;
}
.st-foot {
  border-top: 1px solid var(--border2);
  padding: 0.85rem 1.25rem;
  flex-shrink: 0;
  background: var(--surface2);
  min-height: 90px;
}
.st-foot-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.25rem;
}
.st-foot-desc {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 0.2rem;
}
.st-foot-meta { font: 0.62rem var(--mono); color: var(--muted2); }

/* SVG tree elements */
.st-edge-on   { stroke: var(--green);  stroke-width: 1.5; opacity: 0.5;  fill: none; }
.st-edge-semi { stroke: var(--accent); stroke-width: 1.5; opacity: 0.35; fill: none; stroke-dasharray: 4 3; }
.st-edge-off  { stroke: var(--border); stroke-width: 1;   opacity: 0.5;  fill: none; }
.st-glow {
  fill: var(--accent-dim);
  stroke: var(--accent);
  stroke-width: 1;
  opacity: 0.6;
  animation: stPulse 1.8s ease-in-out infinite;
}
@keyframes stPulse { 0%,100% { opacity: 0.35; r: 36; } 50% { opacity: 0.75; r: 44; } }
.st-circ { stroke-width: 1.5; }
.st-circ-purchased  { fill: var(--green-dim);  stroke: var(--green); }
.st-circ-purchasable{ fill: var(--accent-dim); stroke: var(--accent); stroke-width: 2; }
.st-circ-locked     { fill: var(--surface2);   stroke: var(--border); }
.st-check-purchased { font-size: 15px; font-family: var(--font); fill: var(--green); }
.st-cost { font-size: 11px; font-family: var(--mono); font-weight: 700; fill: var(--accent); }
.st-lbl { font-size: 8px; font-family: var(--font); }
.st-lbl-purchased  { fill: var(--text);   font-weight: 600; }
.st-lbl-purchasable{ fill: var(--accent); font-weight: 700; }
.st-lbl-locked     { fill: var(--muted2); font-weight: 400; }
.st-g { cursor: pointer; }
.st-g:hover .st-circ-purchased  { stroke-width: 2.5; }
.st-g:hover .st-circ-purchasable{ stroke: var(--accent-hover); stroke-width: 2.5; }
.st-g:hover .st-circ-locked     { stroke: var(--muted); }

/* Skill tree header right controls */
.st-hdr-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}
.st-zoom-controls {
  display: flex;
  gap: 2px;
}
.st-zoom-btn {
  width: 26px; height: 26px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface2);
  color: var(--muted);
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.15s, color 0.15s;
  font-family: var(--font);
  padding: 0;
}
.st-zoom-btn:hover { border-color: var(--accent); color: var(--accent); }
.st-zoom-reset { font-size: 0.75rem; }
.st-zoom-hint {
  font: 0.6rem var(--mono);
  color: var(--muted2);
  white-space: nowrap;
  letter-spacing: 0.02em;
}

/* Settings menu */
.settings-wrap {
  position: relative;
}
.settings-btn {
  width: 28px; height: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface2);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.15s, color 0.15s;
}
.settings-btn:hover { border-color: var(--accent); color: var(--accent); }
.settings-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  min-width: 215px;
  z-index: 700;
  padding: 0.3rem 0;
}
.settings-label {
  font: 0.6rem var(--mono);
  color: var(--muted2);
  letter-spacing: 0.06em;
  padding: 0.35rem 0.85rem 0.2rem;
  text-transform: uppercase;
}
.settings-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.85rem;
  font-size: 0.78rem;
  font-family: var(--font);
  color: var(--text);
  background: none;
  border: none;
  cursor: pointer;
  transition: background 0.1s;
  line-height: 1.3;
}
.settings-item:hover { background: var(--surface2); }
.settings-item-danger { color: var(--red, #ef4444); }
.settings-item-danger:hover { background: rgba(239,68,68,0.07); }

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .terminal-pulse, .typing-dot, .cp { animation: none !important; }
}
