:root {
  color-scheme: dark;
  --bg: #070a07;
  --bg-soft: #0c120c;
  --panel: #0a0f0a;
  --line: #16241a;
  --line-bright: #1f3a26;
  --text: #b9f5c6;
  --fg: #b9f5c6;
  --muted: #5f7a64;
  --fg-dim: #5f7a64;
  --accent: #39ff6a;
  --accent-soft: #1f7a3a;
  --easy: #3fd6a0;
  --med: #e8c14a;
  --hard: #ff5d6c;
  --radius: 2px;
  --mono: "JetBrains Mono", "SF Mono", "Cascadia Code", Menlo, Consolas, "Liberation Mono", monospace;
  --glow: 0 0 6px rgba(57, 255, 106, 0.35);
  --uiux-skill-pass: "design-taste-frontend high-end-visual-design stitch-design-taste impeccable";
  --android-theme-source: "AndroidPrep";
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; min-width: 320px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  letter-spacing: 0;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

#scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .18) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply;
}

::selection { background: var(--accent); color: var(--bg); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button {
  font-family: var(--mono);
  font-size: 12px;
  cursor: pointer;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line-bright);
  padding: 3px 9px;
  border-radius: var(--radius);
}
button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: var(--glow);
}
button:disabled { opacity: .45; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible, .node:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.spacer { flex: 1; }

#app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

#topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
  white-space: nowrap;
}
#topbar .prompt { color: var(--accent); text-shadow: var(--glow); }
#topbar .sep { color: var(--muted); }
#topbar .path { color: var(--text); }
#topbar .cursor {
  color: var(--accent);
  margin-left: 1px;
  animation: blink 1.05s steps(1) infinite;
}
#topbar a {
  color: var(--text);
  border: 1px solid var(--line-bright);
  padding: 3px 9px;
  border-radius: var(--radius);
}
#topbar a:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }
@keyframes blink { 50% { opacity: 0; } }

.web-ad {
  display: none;
  flex: 0 0 0;
  height: 0;
  min-height: 0;
  max-height: 0;
  margin: 0;
  padding: 0;
  color: var(--muted);
  background: var(--bg-soft);
  border: 0;
  opacity: 0;
  overflow: hidden;
  visibility: hidden;
  pointer-events: none;
}
.web-ad[data-ad-state="requesting"] {
  display: block;
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 0;
  min-height: 0;
  max-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  overflow: hidden;
}
.web-ad[data-ad-state="filled"] {
  display: block;
  position: static;
  flex: 0 0 auto;
  height: auto;
  max-height: none;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  border: 1px dashed var(--line-bright);
}
.web-ad ins.adsbygoogle { display: block; min-height: 0; max-height: 100%; overflow: hidden; }
.web-ad--horizontal { height: 92px; min-height: 92px; max-height: 92px; border-width: 0 0 1px; }
.web-ad--side { height: 250px; min-height: 250px; max-height: 250px; margin: 8px 10px; }
.web-ad--bottom { height: 92px; min-height: 92px; max-height: 92px; border-width: 1px 0 0; }
.web-ad:not([data-ad-state="filled"]).web-ad--horizontal,
.web-ad:not([data-ad-state="filled"]).web-ad--side,
.web-ad:not([data-ad-state="filled"]).web-ad--bottom {
  height: 0;
  min-height: 0;
  max-height: 0;
  margin: 0;
}
.web-ad--horizontal[data-ad-state="filled"] { height: 92px; min-height: 92px; max-height: 92px; border-width: 0 0 1px; }
.web-ad--side[data-ad-state="filled"] { height: 250px; min-height: 250px; max-height: 250px; margin: 8px 10px; }
.web-ad--bottom[data-ad-state="filled"] { height: 92px; min-height: 92px; max-height: 92px; border-width: 1px 0 0; }
.web-ad.web-ad--hidden,
.premium-no-ads .web-ad,
.premium-no-ads ins.adsbygoogle {
  display: none !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
}

#main {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}
#graph-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border-right: 1px solid var(--line);
  overflow: hidden;
}
#graph-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  height: 100%;
  padding: 24px;
}
#graph-scroll::-webkit-scrollbar,
#side-body::-webkit-scrollbar,
#card-scroll::-webkit-scrollbar,
#premium-panel::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}
#graph-scroll::-webkit-scrollbar-thumb,
#side-body::-webkit-scrollbar-thumb,
#card-scroll::-webkit-scrollbar-thumb,
#premium-panel::-webkit-scrollbar-thumb {
  background: var(--line-bright);
}
#graph-scroll::-webkit-scrollbar-track,
#side-body::-webkit-scrollbar-track,
#card-scroll::-webkit-scrollbar-track,
#premium-panel::-webkit-scrollbar-track {
  background: transparent;
}
svg#graph { display: block; }

.edge { fill: none; stroke: var(--line-bright); stroke-width: 1.4; }
.edge.lit { stroke: var(--accent); stroke-width: 1.8; filter: drop-shadow(0 0 3px var(--accent)); }
.node { cursor: pointer; outline: none; }
.node rect {
  fill: var(--panel);
  stroke: var(--line-bright);
  stroke-width: 1.4;
  transition: transform .16s ease, stroke .16s ease, fill .16s ease;
}
.node .nm { fill: var(--text); font: 600 11px var(--mono); }
.node .ct { fill: var(--muted); font: 11px var(--mono); }
.node .bar-bg { fill: var(--line); }
.node .bar-fg { fill: var(--accent-soft); }
.node:hover rect { stroke: var(--accent); }
.node:hover .nm { fill: var(--accent); }
.node.sel rect { fill: #0e1a10; stroke: var(--accent); stroke-width: 2; }
.node.sel .nm { fill: var(--accent); }
.node.done rect { stroke: var(--accent); }
.node.done .bar-fg { fill: var(--accent); }
.node.dim rect { stroke: var(--line); }
.node.dim .nm { fill: var(--muted); }
.node .corner { fill: var(--accent); }

#legend {
  flex: 0 0 auto;
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 6px 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}
.muted { color: var(--muted); }
.credit { color: #3a4a3d; font-size: 10.5px; }
.credit a { color: #4f6a54; }
.credit a:hover { color: var(--accent); }

#side-pane {
  flex: 0 0 50%;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--bg-soft);
  overflow: hidden;
}
#side-head {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 8px;
  align-items: center;
  padding: 8px 12px 6px;
  border-bottom: 1px solid var(--line);
}
#side-back[hidden] { display: none; }
#side-back { grid-row: 1 / span 2; align-self: center; }
#side-head .cmd { color: var(--accent); }
#side-head .cmd::before { content: "$ "; color: var(--muted); }
#side-head .sub { color: var(--muted); font-size: 11px; margin-top: 2px; }
#side-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 6px 0 24px;
}
.welcome pre {
  margin: 0;
  color: var(--muted);
  padding: 10px 14px;
  font-size: 12px;
  white-space: pre-wrap;
}
.summary {
  padding: 8px 14px;
  color: var(--muted);
  font-size: 11px;
  border-bottom: 1px solid var(--line);
}
.summary b { color: var(--accent); }
.question-list { list-style: none; margin: 0; padding: 0; }
.question-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 4px 14px;
  border-left: 2px solid transparent;
}
.question-row:hover { background: #0e150e; border-left-color: var(--accent); }
.question-row.known .question-button { color: var(--muted); text-decoration: line-through; }
.status-dot {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  line-height: 12px;
  text-align: center;
  border: 1px solid var(--line-bright);
  color: var(--accent);
  font-size: 11px;
  border-radius: var(--radius);
  user-select: none;
}
.question-row.known .status-dot {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}
.question-button {
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  color: var(--text);
  text-align: left;
  line-height: 1.35;
  box-shadow: none;
  transform: none;
}
.question-button:hover:not(:disabled) {
  color: var(--accent);
  transform: none;
  box-shadow: none;
}

#card[hidden], #premium-panel[hidden] { display: none; }
#card {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.card-toolbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}
#card-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 14px 16px 18px;
}
#card-question {
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 12px;
}
#card-answer {
  color: var(--text);
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
#card-answer h3 { color: var(--accent); font-size: 13px; margin: 16px 0 6px; }
.card-actions {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  border-top: 1px solid var(--line);
}

#premium-panel {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: min(440px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  z-index: 50;
  border: 1px solid var(--line-bright);
  background: var(--bg-soft);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--glow);
}
.premium-head { display: flex; gap: 8px; align-items: center; }
.premium-head button { margin-left: auto; }
.premium-note, #premium-status { color: var(--muted); font-size: 13px; line-height: 1.5; }
.premium-actions, .premium-email, .premium-plan {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 10px;
}
.premium-email input {
  flex: 1;
  min-width: 180px;
  border: 1px solid var(--line-bright);
  background: var(--panel);
  color: var(--text);
  padding: 7px 8px;
  border-radius: var(--radius);
}
.premium-plan {
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
.premium-plan div { display: grid; }

#bottom-meta {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 4px 12px;
  border-top: 1px solid var(--line);
  background: #070b07;
  color: var(--muted);
  font-size: 10.5px;
  white-space: nowrap;
}
.bottom-links { display: flex; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }
.bottom-links a { color: var(--muted); }
.bottom-links a:hover, .bottom-links a:focus-visible { color: var(--accent); text-decoration: underline; }

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: dark;
    --bg: #070a07;
    --bg-soft: #0c120c;
    --panel: #0a0f0a;
    --line: #16241a;
    --line-bright: #1f3a26;
    --text: #b9f5c6;
    --fg: #b9f5c6;
    --muted: #5f7a64;
    --fg-dim: #5f7a64;
    --accent: #39ff6a;
    --accent-soft: #1f7a3a;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}

@media (max-width: 860px) {
  body { overflow: hidden; }
  #app { height: 100%; min-height: 0; }
  #topbar { flex-wrap: wrap; align-items: flex-start; white-space: normal; }
  #topbar .spacer { flex-basis: 100%; height: 0; }
  #main { flex-direction: column; min-height: 0; overflow: hidden; }
  #graph-pane {
    flex: 1 1 0;
    min-height: 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  #graph-scroll { padding: 14px; }
  #side-pane { flex: 1 1 0; min-height: 0; }
  #legend { flex-wrap: wrap; }
  #bottom-meta { flex-wrap: wrap; justify-content: flex-start; white-space: normal; }
}

@media (max-width: 420px) {
  #topbar a, #topbar button, #premium-panel button, .card-actions button { max-width: 100%; }
  .web-ad--horizontal, .web-ad--bottom { height: 72px; min-height: 72px; max-height: 72px; }
  .web-ad--side { height: 96px; min-height: 96px; max-height: 96px; }
  .web-ad--horizontal[data-ad-state="filled"], .web-ad--bottom[data-ad-state="filled"] { height: 72px; min-height: 72px; max-height: 72px; }
  .web-ad--side { height: 96px; min-height: 96px; max-height: 96px; }
  .web-ad--side[data-ad-state="filled"] { height: 96px; min-height: 96px; max-height: 96px; }
  #premium-panel { right: 10px; bottom: 10px; width: calc(100vw - 20px); }
}

.satisfaction-prompt {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 60;
  width: min(320px, calc(100vw - 24px));
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--line-bright);
  border-radius: 6px;
  box-shadow: var(--glow);
  font-family: var(--mono);
}
.satisfaction-prompt__title { margin: 0 0 6px; color: var(--accent); font-size: 13px; }
.satisfaction-prompt__body { margin: 0 0 10px; color: var(--fg-dim); font-size: 12px; line-height: 1.5; }
.satisfaction-prompt__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.satisfaction-prompt__send,
.satisfaction-prompt__later {
  font-family: var(--mono);
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 4px;
  border: 1px solid var(--line-bright);
  background: var(--bg-soft);
  color: var(--fg);
  cursor: pointer;
  text-decoration: none;
}
.satisfaction-prompt__send { border-color: var(--accent-soft); color: var(--accent); }
.satisfaction-prompt__send:hover,
.satisfaction-prompt__later:hover { border-color: var(--accent); color: var(--accent); }
.satisfaction-prompt__send:focus-visible,
.satisfaction-prompt__later:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  .satisfaction-prompt { box-shadow: none; }
}
