:root {
  --bg: #0a0a0a;
  --fg: #f0f0f0;
  --dim: #888;
  --accent: #ff2d20;
  --ok: #35e07a;
  --line: rgba(240, 240, 240, 0.08);
  --panel: #111113;
}

@font-face {
  font-family: 'Matricha';
  src: url('matricha.ttf') format('truetype');
  font-display: swap;
}

@property --pct {
  syntax: '<number>';
  inherits: false;
  initial-value: 0;
}

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

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  cursor: none;
}

@media (hover: none), (pointer: coarse) {
  body { cursor: auto; }
  .cursor, .cursor-dot { display: none; }
}

/* --- custom cursor --- */
.cursor, .cursor-dot {
  position: fixed; top: 0; left: 0; pointer-events: none; z-index: 10003;
  mix-blend-mode: difference;
}
.cursor {
  width: 26px; height: 26px; border: 1px solid #fff;
  border-radius: 50%; transform: translate(-50%, -50%);
  transition: width .15s, height .15s, border-color .15s;
}
.cursor-dot {
  width: 5px; height: 5px; background: #fff; border-radius: 50%;
  transform: translate(-50%, -50%);
}

/* --- confetti --- */
#confetti {
  position: fixed; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 10000;
}

/* --- layout --- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px clamp(16px, 5vw, 48px);
  border-bottom: 1px solid var(--line);
  background: rgba(10, 10, 10, 0.82);
  backdrop-filter: blur(10px);
}
.brand {
  font-family: 'Matricha', 'Inter', sans-serif;
  font-size: 20px; letter-spacing: 0.08em; font-weight: 600;
}
.brand-accent { color: var(--accent); }

.quota { display: flex; align-items: center; gap: 10px; }
.quota-label { font-size: 13px; color: var(--dim); font-variant-numeric: tabular-nums; }
.quota-dots { display: flex; gap: 5px; }
.quota-dots .qdot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--line); border: 1px solid var(--dim);
  transition: background .3s, transform .3s;
}
.quota-dots .qdot.used { background: var(--accent); border-color: var(--accent); }
.quota-dots .qdot.bonus { background: var(--ok); border-color: var(--ok); }

.stage {
  max-width: 720px;
  margin: 0 auto;
  padding: clamp(28px, 6vw, 64px) clamp(16px, 5vw, 24px) 96px;
}

.screen { display: none; animation: fadeUp .45s ease both; }
.screen.is-active { display: block; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.h1 {
  font-family: 'Matricha', 'Inter', sans-serif;
  font-size: clamp(36px, 8vw, 64px);
  line-height: 1.02;
  letter-spacing: -0.01em;
  margin-bottom: 20px;
}
.h2 {
  font-family: 'Matricha', 'Inter', sans-serif;
  font-size: clamp(22px, 5vw, 32px);
  line-height: 1.1;
  margin-bottom: 10px;
}
.accent { color: var(--accent); }
.sub { color: var(--dim); font-size: 15px; margin-bottom: 24px; max-width: 46ch; }
.dim { color: var(--dim); }

/* --- input --- */
.input-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  transition: border-color .2s, box-shadow .2s;
}
.input-wrap:focus-within { border-color: rgba(255, 45, 32, 0.5); box-shadow: 0 0 0 3px rgba(255,45,32,0.08); }
textarea {
  width: 100%; min-height: 160px; resize: vertical;
  background: transparent; border: none; outline: none;
  color: var(--fg); font-family: inherit; font-size: 16px; line-height: 1.6;
}
textarea::placeholder { color: #555; }
.input-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.counter { font-size: 12px; font-variant-numeric: tabular-nums; }

/* --- buttons --- */
.btn {
  font-family: 'Matricha', 'Inter', sans-serif;
  font-size: 15px; letter-spacing: 0.03em;
  padding: 13px 22px; border-radius: 12px;
  border: 1px solid transparent; cursor: pointer;
  transition: transform .12s, background .2s, border-color .2s, opacity .2s;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #ff4438; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--fg); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--dim); }
.btn-ok { background: var(--ok); color: #04220f; }

/* --- spinner --- */
.spinner {
  width: 44px; height: 44px; margin: 0 auto 20px;
  border: 3px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { text-align: center; color: var(--dim); font-size: 15px; }

/* --- score ring --- */
.score-wrap { text-align: center; margin-bottom: 28px; }
.ring {
  --pct: 0;
  width: 148px; height: 148px; margin: 0 auto 20px;
  border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--pct) * 1%), var(--line) 0);
  display: flex; align-items: center; justify-content: center;
  transition: --pct 1.2s cubic-bezier(.2,.7,.2,1);
}
.ring.ring-ok { background: conic-gradient(var(--ok) calc(var(--pct) * 1%), var(--line) 0); }
.ring-inner {
  width: 120px; height: 120px; border-radius: 50%;
  background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.ring-inner span { font-family: 'Matricha', sans-serif; font-size: 40px; line-height: 1; }
.ring-inner small { color: var(--dim); font-size: 12px; margin-top: 4px; }

/* --- weaknesses --- */
.weak-list { list-style: none; margin-bottom: 28px; display: grid; gap: 10px; }
.weak-list li {
  padding: 14px 16px; border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 10px; font-size: 15px; animation: fadeUp .4s ease both;
}
.weak-list li::before { content: '⚠ '; color: var(--accent); }

/* --- questions --- */
.progress { height: 4px; background: var(--line); border-radius: 4px; margin-bottom: 18px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--accent); transition: width .3s ease; }
.step { font-size: 13px; margin-bottom: 6px; font-variant-numeric: tabular-nums; }
.options { display: grid; gap: 10px; margin: 18px 0; }
.option {
  display: block; width: 100%; text-align: left;
  padding: 15px 18px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--panel);
  color: var(--fg); font-size: 15px; cursor: pointer;
  transition: border-color .15s, transform .12s, background .15s;
}
.option:hover { border-color: var(--dim); }
.option.selected { border-color: var(--accent); background: rgba(255,45,32,0.06); }
.option .opt-key { color: var(--accent); font-family: 'Matricha', sans-serif; margin-right: 10px; }
.open-input {
  width: 100%; padding: 14px 16px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--panel);
  color: var(--fg); font-size: 15px; outline: none;
}
.open-input:focus { border-color: var(--dim); }
.qnav { display: flex; justify-content: space-between; gap: 12px; margin-top: 22px; }

/* --- result --- */
.badge {
  display: inline-block; padding: 6px 14px; border-radius: 999px;
  background: var(--accent); color: #fff;
  font-family: 'Matricha', sans-serif; font-size: 13px; letter-spacing: 0.12em;
  margin-bottom: 16px;
}
.badge-ok { background: var(--ok); color: #04220f; }
.result-box { margin-top: 8px; }
.result-actions { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.result-md {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 22px; white-space: pre-wrap; word-break: break-word;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 14px; line-height: 1.65;
  color: #e6e6e6;
}

/* --- overlay / modal --- */
.overlay {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.overlay[hidden] { display: none; }
.modal {
  background: var(--panel); border: 1px solid var(--line); border-radius: 20px;
  padding: 28px; max-width: 440px; width: 100%; text-align: center;
}
.modal .sub { max-width: none; margin: 0 auto 20px; }
.promo-area { border-top: 1px solid var(--line); margin-top: 20px; padding-top: 20px; }
.promo-code {
  font-family: 'Matricha', monospace; font-size: 26px; letter-spacing: 0.1em;
  color: var(--ok); margin: 8px 0 18px;
}
.promo-activate { display: flex; gap: 10px; margin: 10px 0 8px; }
.promo-activate input {
  flex: 1; padding: 13px 16px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--bg);
  color: var(--fg); font-size: 15px; outline: none; text-transform: uppercase;
}
.promo-activate input:focus { border-color: var(--ok); }

/* --- footer --- */
.foot { text-align: center; padding: 20px 16px 32px; font-size: 12px; }

/* --- mobile --- */
@media (max-width: 480px) {
  .h1 { font-size: 38px; }
  .promo-activate { flex-direction: column; }
  .promo-code { font-size: 22px; }
}
