:root {
  --bg: #0b1117;
  --bg-soft: #0f171f;
  --panel: #131d26;
  --panel-2: #17232d;
  --line: #263746;
  --line-soft: #1e2c37;
  --text: #edf4f8;
  --muted: #8fa2b1;
  --muted-2: #667b8b;
  --cyan: #5bd8ff;
  --green: #72e0b4;
  --yellow: #f1c763;
  --red: #ff7b84;
  --radius: 14px;
  --shadow: 0 24px 80px rgba(0,0,0,.28);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 80% 15%, rgba(78, 205, 255, .045), transparent 32rem),
    var(--bg);
  color: var(--text);
}

button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
a { color: inherit; text-decoration: none; }
noscript { display:block; padding:1rem; background:#7b1e25; text-align:center; }

.site-header {
  max-width: 1440px;
  margin: 0 auto;
  padding: 26px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .15em;
}
.brand-mark { width: 28px; height: 2px; background: var(--cyan); }
.header-actions { display:flex; align-items:center; gap:14px; }

.privacy-pill {
  display:inline-flex; align-items:center; gap:8px;
  color: var(--muted);
  border: 1px solid var(--line-soft);
  background: rgba(13,22,29,.75);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12px;
}
.privacy-dot { width:7px; height:7px; border-radius:50%; background:var(--green); box-shadow:0 0 12px var(--green); }

main { max-width: 1440px; margin: 0 auto; padding: 0 40px 72px; }
.view { display:none; animation: view-in .25s ease; }
.view.active { display:block; }
@keyframes view-in { from { opacity:0; transform: translateY(5px); } }

.hero {
  min-height: 610px;
  display:grid;
  grid-template-columns:minmax(0, 1.25fr) minmax(320px, .75fr);
  align-items:center;
  gap: clamp(50px, 9vw, 150px);
  padding: 50px 0 70px;
}
.hero-copy { max-width:780px; }
.eyebrow {
  margin:0 0 18px;
  color: var(--cyan);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .14em;
}
h1, h2, h3, p { margin-top:0; }
h1 { font-size:clamp(54px, 7vw, 96px); line-height:.93; letter-spacing:-.055em; margin-bottom:25px; }
h2 { font-size:clamp(34px, 4vw, 56px); line-height:.98; letter-spacing:-.04em; }
h3 { font-size:26px; line-height:1; letter-spacing:-.035em; }
.gradient-text {
  display:block;
  background: linear-gradient(90deg, var(--cyan), var(--green));
  color:transparent;
  background-clip:text;
  -webkit-background-clip:text;
}
.hero-text { max-width:680px; color:var(--muted); line-height:1.65; font-size:15px; }
.hero-buttons { display:flex; gap:12px; margin-top:30px; flex-wrap:wrap; }

.button {
  border:1px solid var(--line);
  border-radius:7px;
  padding:12px 15px;
  background:var(--panel);
  color:var(--text);
  font-size:13px;
  font-weight:750;
  transition:transform .15s ease, border-color .15s ease, background .15s ease;
}
.button:hover { transform:translateY(-1px); border-color:#3d5669; }
.button-primary { background:linear-gradient(135deg, var(--cyan), #5fcfe5); border-color:transparent; color:#061017; }
.button-secondary { background:#121b23; }
.button-quiet { background:transparent; }
.button-danger { background:var(--red); border-color:transparent; color:#170609; }
.button-danger-quiet { color:#ff9ca3; background:transparent; border-color:#472a31; }
.button.large { padding:15px 22px; }

.index-panel {
  border:1px solid var(--line);
  border-radius:12px;
  background:linear-gradient(160deg, rgba(20,31,40,.96), rgba(11,18,24,.96));
  box-shadow:var(--shadow);
  overflow:hidden;
}
.panel-label {
  display:flex; justify-content:space-between; padding:17px 19px;
  color:var(--muted-2); border-bottom:1px solid var(--line-soft);
  font-size:10px; letter-spacing:.08em;
}
.bucket-index { list-style:none; padding:0; margin:0; }
.bucket-index li {
  display:grid; grid-template-columns:36px 1fr auto; gap:12px; align-items:center;
  padding:16px 19px; border-bottom:1px solid var(--line-soft); font-size:13px;
}
.bucket-index li:last-child { border-bottom:0; }
.bucket-num { color:var(--cyan); font-size:10px; font-weight:800; }
.bucket-count { color:var(--muted); }

.section-block { padding:72px 0 20px; }
.section-block.compact { padding-top:90px; }
.section-heading { display:grid; grid-template-columns:minmax(260px,.65fr) 1fr; gap:60px; align-items:end; margin-bottom:28px; }
.section-heading h2 { margin-bottom:0; }
.section-heading p { margin:0; max-width:690px; color:var(--muted); line-height:1.6; font-size:13px; }

.deck-grid, .feature-grid {
  display:grid;
  grid-template-columns:repeat(3, minmax(0,1fr));
  gap:18px;
}
.deck-card, .feature-card {
  min-height:360px;
  display:flex; flex-direction:column;
  padding:25px;
  border:1px solid var(--line);
  border-radius:var(--radius);
  background:
    linear-gradient(145deg, rgba(19,29,38,.98), rgba(18,29,37,.92));
  position:relative;
  overflow:hidden;
}
.deck-card::after {
  content:""; position:absolute; inset:auto -20% -45% 35%; height:60%;
  background:radial-gradient(circle, rgba(91,216,255,.10), transparent 65%);
  pointer-events:none;
}
.deck-card-top { display:flex; justify-content:space-between; align-items:center; margin-bottom:50px; }
.deck-code, .feature-code { color:var(--muted-2); font-size:9px; font-weight:800; letter-spacing:.12em; text-transform:uppercase; }
.status-badge { color:var(--green); border:1px solid rgba(114,224,180,.45); border-radius:999px; padding:5px 8px; font-size:9px; font-weight:800; letter-spacing:.08em; }
.deck-card h3 { margin-bottom:12px; }
.deck-card-description { color:var(--muted); line-height:1.55; font-size:13px; min-height:60px; }
.mini-progress { height:5px; border-radius:99px; background:#0b1218; overflow:hidden; margin:20px 0 11px; }
.mini-progress span { display:block; height:100%; width:0; background:linear-gradient(90deg,var(--cyan),var(--green)); }
.deck-stats { display:flex; justify-content:space-between; color:var(--muted); font-size:11px; margin-bottom:20px; }
.deck-card-actions { margin-top:auto; display:flex; gap:9px; position:relative; z-index:1; }
.feature-card { min-height:240px; }
.feature-card h3 { margin:45px 0 12px; }
.feature-card p { color:var(--muted); line-height:1.6; font-size:13px; }

.empty-state {
  border:1px dashed #334655;
  border-radius:var(--radius);
  min-height:260px; padding:35px;
  display:flex; align-items:center; justify-content:space-between;
  background:rgba(15,23,31,.6);
}
.empty-state[hidden] { display:none; }
.empty-icon { color:var(--cyan); font-size:30px; }
.empty-state h3 { margin:12px 0 8px; }
.empty-state p { color:var(--muted); margin:0; }

.page-topline { display:flex; justify-content:space-between; align-items:center; padding:34px 0; }
.page-actions { display:flex; gap:10px; }
.text-button { color:var(--muted); background:none; border:0; padding:8px 0; }
.text-button:hover { color:var(--text); }

.deck-hero {
  display:grid; grid-template-columns:1fr 180px; align-items:center; gap:50px;
  padding:45px 0 55px;
}
.deck-hero h1 { font-size:clamp(52px, 6vw, 86px); max-width:950px; }
.mastery-ring { width:150px; height:150px; position:relative; justify-self:end; }
.mastery-ring svg { width:100%; transform:rotate(-90deg); }
.mastery-ring circle { fill:none; stroke-width:8; }
.ring-bg { stroke:#16232c; }
.ring-value { stroke:url(#none); stroke:var(--green); stroke-linecap:round; stroke-dasharray:314.16; stroke-dashoffset:314.16; transition:stroke-dashoffset .5s ease; }
.mastery-ring div { position:absolute; inset:0; display:flex; flex-direction:column; justify-content:center; align-items:center; }
.mastery-ring strong { font-size:29px; }
.mastery-ring span { color:var(--muted); font-size:11px; }

.bucket-strip { display:grid; grid-template-columns:repeat(5,1fr); gap:10px; margin-bottom:35px; }
.bucket-box { border:1px solid var(--line); background:var(--panel); border-radius:9px; padding:15px; }
.bucket-box span { color:var(--muted); font-size:10px; display:block; margin-bottom:12px; }
.bucket-box strong { font-size:27px; }
.bucket-box em { color:var(--muted-2); font-size:10px; font-style:normal; margin-left:5px; }

.study-builder {
  display:grid; grid-template-columns:.65fr 1fr; gap:60px;
  border:1px solid var(--line); border-radius:var(--radius);
  background:linear-gradient(145deg,#111b23,#14212a);
  padding:35px;
}
.study-builder h2 { margin-bottom:0; }
.study-controls { display:grid; grid-template-columns:repeat(3,1fr); gap:12px; }
.study-controls label { color:var(--muted); font-size:11px; }
.study-controls select {
  width:100%; margin-top:8px; padding:12px;
  background:#0c141b; color:var(--text); border:1px solid var(--line); border-radius:7px;
}
.study-controls .large { grid-column:1/-1; }

.module-list { display:flex; flex-direction:column; border-top:1px solid var(--line-soft); }
.module-row { display:grid; grid-template-columns:70px 1fr 150px 60px; gap:20px; align-items:center; padding:22px 4px; border-bottom:1px solid var(--line-soft); }
.module-number { color:var(--cyan); font-size:11px; font-weight:800; }
.module-row h3 { font-size:21px; margin:0 0 5px; }
.module-row p { color:var(--muted); font-size:12px; margin:0; }
.module-progress { height:5px; border-radius:99px; background:#121b22; overflow:hidden; }
.module-progress span { display:block; height:100%; background:linear-gradient(90deg,var(--cyan),var(--green)); }
.module-percent { color:var(--muted); font-size:11px; text-align:right; }

.study-view { min-height:calc(100vh - 100px); }
.study-topbar {
  display:grid; grid-template-columns:180px 1fr 260px; align-items:center; gap:30px;
  padding:20px 0 35px;
}
.study-progress-meta { display:flex; justify-content:space-between; color:var(--muted); font-size:11px; margin-bottom:8px; }
.progress-track { height:4px; background:#17242d; border-radius:999px; overflow:hidden; }
.progress-track span { display:block; height:100%; width:0; background:linear-gradient(90deg,var(--cyan),var(--green)); transition:width .2s; }
.keyboard-note { color:var(--muted-2); font-size:10px; text-align:right; }

.study-stage { max-width:980px; margin:0 auto; }
.flashcard {
  min-height:550px;
  border:1px solid var(--line);
  border-radius:18px;
  background:
    radial-gradient(circle at 75% 25%, rgba(91,216,255,.06), transparent 26rem),
    linear-gradient(150deg,#131e27,#0e171e);
  box-shadow:var(--shadow);
  overflow:hidden;
  display:flex; flex-direction:column;
}
.flashcard-meta { display:flex; justify-content:space-between; padding:21px 25px; border-bottom:1px solid var(--line-soft); color:var(--muted-2); font-size:10px; font-weight:800; letter-spacing:.1em; }
#cardBucketBadge { color:var(--cyan); }
.flashcard-body { flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; padding:55px clamp(30px,8vw,110px); }
.card-type { color:var(--cyan); font-size:10px; font-weight:800; letter-spacing:.14em; }
.flashcard-body h1 { font-size:clamp(34px,5vw,58px); line-height:1.08; letter-spacing:-.04em; margin:15px 0 30px; }
.hint-button { background:none; color:var(--muted); border:0; border-bottom:1px solid var(--line); padding:7px; }
.hint-text { max-width:650px; color:var(--yellow); line-height:1.6; margin:18px 0 0; }
.answer-panel { border-top:1px solid var(--line); background:#0d151c; padding:30px clamp(30px,7vw,85px); }
.answer-label, .explanation-block span { color:var(--green); font-size:10px; font-weight:800; letter-spacing:.14em; }
#answerText { font-size:20px; line-height:1.55; margin-top:12px; white-space:pre-wrap; }
.explanation-block { border-top:1px solid var(--line-soft); margin-top:22px; padding-top:20px; }
.explanation-block p { color:var(--muted); margin:9px 0 0; line-height:1.55; }
.study-actions { margin:18px 0; }
.reveal-button { width:100%; padding:17px; }
.grade-buttons { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.grade-buttons button { min-height:72px; display:flex; align-items:center; justify-content:center; gap:10px; }
.grade-buttons span { opacity:.7; font-size:11px; font-weight:500; }
.button-wrong { border-color:#5b3035; color:#ffadb2; background:#24161a; }
.button-correct { border-color:#2f5749; color:#a9f0d4; background:#14231e; }
kbd { border:1px solid currentColor; border-radius:4px; padding:2px 6px; font:inherit; font-size:10px; }

.results-card { max-width:850px; margin:90px auto 0; text-align:center; border:1px solid var(--line); border-radius:18px; background:var(--panel); padding:60px; }
.results-card h1 { font-size:70px; }
.results-card .hero-text { margin-left:auto; margin-right:auto; }
.results-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:10px; margin:45px 0; }
.results-grid div { border:1px solid var(--line-soft); border-radius:10px; padding:23px 10px; }
.results-grid strong { display:block; font-size:30px; }
.results-grid span { color:var(--muted); font-size:10px; }
.results-actions { display:flex; justify-content:center; gap:12px; }

.modal { border:0; padding:0; background:transparent; color:var(--text); }
.modal::backdrop { background:rgba(2,7,11,.78); backdrop-filter:blur(5px); }
.modal-card { width:min(620px, calc(100vw - 30px)); border:1px solid var(--line); background:#111a22; border-radius:16px; padding:28px; box-shadow:var(--shadow); }
.modal-card.small { width:min(480px, calc(100vw - 30px)); }
.modal-top { display:flex; justify-content:space-between; gap:30px; }
.modal-card h2 { font-size:38px; }
.icon-button { border:0; background:none; color:var(--muted); font-size:28px; align-self:flex-start; }
.privacy-notice { border-left:3px solid var(--green); background:#0d1716; padding:14px 16px; margin:10px 0 18px; }
.privacy-notice strong { color:var(--green); }
.privacy-notice p { color:var(--muted); font-size:12px; line-height:1.5; margin:6px 0 0; }
.file-drop { min-height:180px; display:flex; flex-direction:column; align-items:center; justify-content:center; border:1px dashed #3d5667; border-radius:12px; background:#0d151c; color:var(--muted); }
.file-drop.dragover { border-color:var(--cyan); background:#0c1b23; }
.file-drop input { display:none; }
.file-drop-icon { color:var(--cyan); font-size:28px; margin-bottom:8px; }
.file-drop strong { color:var(--text); margin-bottom:5px; }
.import-preview { margin-top:15px; border:1px solid var(--line-soft); border-radius:9px; padding:15px; color:var(--muted); font-size:12px; line-height:1.6; }
.error-message { color:#ffadb2; background:#25171b; border:1px solid #5b3035; padding:12px; border-radius:8px; margin-top:15px; }
.modal-actions { display:flex; justify-content:flex-end; gap:10px; margin-top:20px; }

@media (max-width: 980px) {
  .hero { grid-template-columns:1fr; min-height:auto; }
  .index-panel { max-width:620px; }
  .deck-grid, .feature-grid { grid-template-columns:1fr 1fr; }
  .study-builder { grid-template-columns:1fr; gap:25px; }
  .study-topbar { grid-template-columns:110px 1fr; }
  .keyboard-note { display:none; }
}
@media (max-width: 680px) {
  .site-header, main { padding-left:20px; padding-right:20px; }
  .privacy-pill { display:none; }
  h1 { font-size:52px; }
  .hero { padding-top:30px; }
  .deck-grid, .feature-grid, .section-heading { grid-template-columns:1fr; gap:20px; }
  .deck-card { min-height:320px; }
  .empty-state { flex-direction:column; align-items:flex-start; gap:25px; }
  .deck-hero { grid-template-columns:1fr; }
  .mastery-ring { justify-self:start; }
  .bucket-strip { grid-template-columns:1fr 1fr; }
  .study-controls { grid-template-columns:1fr; }
  .study-controls .large { grid-column:auto; }
  .module-row { grid-template-columns:45px 1fr 45px; }
  .module-progress { display:none; }
  .study-topbar { grid-template-columns:1fr; gap:12px; }
  .study-topbar > .text-button { justify-self:start; }
  .grade-buttons { grid-template-columns:1fr; }
  .flashcard { min-height:480px; }
  .results-card { padding:35px 20px; margin-top:35px; }
  .results-card h1 { font-size:52px; }
  .results-grid { grid-template-columns:1fr 1fr; }
}


/* Deck creation helper */
.helper-modal { width:min(900px, calc(100vw - 30px)); }
.helper-steps {
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:10px;
  margin:18px 0;
}
.helper-steps div {
  border:1px solid var(--line-soft);
  border-radius:9px;
  padding:14px;
  background:#0d151c;
}
.helper-steps span {
  display:block;
  color:var(--cyan);
  font-size:10px;
  font-weight:800;
  letter-spacing:.12em;
  margin-bottom:8px;
}
.helper-steps p {
  color:var(--muted);
  font-size:12px;
  line-height:1.5;
  margin:0;
}
.helper-label {
  display:block;
  color:var(--muted);
  font-size:11px;
}
.helper-prompt {
  width:100%;
  min-height:360px;
  resize:vertical;
  margin-top:8px;
  padding:16px;
  border:1px solid var(--line);
  border-radius:9px;
  background:#091117;
  color:#dceaf1;
  font:12px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.helper-options {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
  margin:14px 0;
}
.helper-options label {
  color:var(--muted);
  font-size:11px;
}
.helper-options input,
.helper-options select {
  width:100%;
  margin-top:7px;
  padding:11px 12px;
  color:var(--text);
  background:#0c141b;
  border:1px solid var(--line);
  border-radius:7px;
}
.schema-details {
  border:1px solid var(--line-soft);
  border-radius:9px;
  background:#0d151c;
  margin-top:14px;
}
.schema-details summary {
  cursor:pointer;
  padding:13px 15px;
  color:var(--muted);
  font-size:12px;
}
.schema-details pre {
  overflow:auto;
  max-height:320px;
  margin:0;
  padding:0 15px 15px;
  color:#cfe5ee;
  font:11px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.helper-actions { flex-wrap:wrap; }
.copy-status {
  min-height:18px;
  margin:8px 0 0;
  color:var(--green);
  text-align:right;
  font-size:11px;
}
code {
  font-family:ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color:#cfe5ee;
}

@media (max-width: 680px) {
  .helper-steps, .helper-options { grid-template-columns:1fr; }
  .helper-prompt { min-height:440px; }
}


/* MEGA PLAY */
.button-mega {
  position:relative;
  overflow:hidden;
  background:
    linear-gradient(135deg, rgba(255,91,104,.28), rgba(104,20,30,.68)),
    #281319;
  border-color:rgba(255,123,132,.68);
  color:#ffd9dc;
  text-shadow:0 0 16px rgba(255,123,132,.36);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,.025),
    0 0 22px rgba(255,70,83,.10);
  letter-spacing:.055em;
}
.button-mega::before {
  content:"";
  position:absolute;
  inset:-40% auto -40% -35%;
  width:34%;
  transform:skewX(-18deg);
  background:linear-gradient(90deg, transparent, rgba(255,255,255,.14), transparent);
  transition:left .42s ease;
}
.button-mega:hover {
  border-color:#ff929a;
  background:
    linear-gradient(135deg, rgba(255,91,104,.40), rgba(117,22,34,.78)),
    #30151c;
  box-shadow:0 0 30px rgba(255,70,83,.18);
}
.button-mega:hover::before { left:115%; }

.study-view.mega-active .flashcard {
  border-color:rgba(255,123,132,.36);
  background:
    radial-gradient(circle at 78% 22%, rgba(255,91,104,.07), transparent 26rem),
    radial-gradient(circle at 20% 80%, rgba(91,216,255,.035), transparent 28rem),
    linear-gradient(150deg,#1c171d,#0f151b);
}
.study-view.mega-active #cardBucketBadge,
.study-view.mega-active .study-progress-meta span:first-child {
  color:#ff9ba2;
}
.study-view.mega-active .progress-track span {
  background:linear-gradient(90deg,#ff6f7a,#ffab77);
}
