:root {
  --vst-bg: #fff;
  --vst-text: #111;
  --vst-card-bg: #fff;
  --vst-card-border: #e9e9e9;
  --vst-shadow-sm: 0 2px 6px rgba(0,0,0,0.05);
  --vst-shadow-md: 0 8px 24px rgba(0,0,0,0.08);
  --vst-blue: #2067e7;
  --vst-blue-dark: #174bb3;
  --vst-light-blue: #eaf1ff;
  --vst-radius: 1rem;
  --focus: 3px solid #2067e7;
  --wave1: #1565a0;
  --wave2: #a85800;
  --result: #10395c;
  --ok-bg: #e4f2e0;
  --ok-ink: #2c5e22;
  --bad-bg: #fbe6e4;
  --bad-ink: #8f2a22;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--vst-bg);
  color: var(--vst-text);
  font-family: 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  line-height: 1.6;
}

/* HEADER */
header.site-header {
  text-align: center;
  padding: 1.2rem 1rem 1rem;
  background: radial-gradient(circle at top center, rgba(32,103,231,.22), transparent 40%),
              linear-gradient(135deg, #151515, #000);
  color: #fff;
}

header.site-header h1 {
  font-size: clamp(1.5rem, 3.4vw, 2.1rem);
  margin: 0 auto .25rem;
  line-height: 1.1;
  font-weight: 800;
  color: #fff;
}

header.site-header p {
  margin: 0 auto;
  max-width: 60ch;
  opacity: .92;
  font-size: clamp(.9rem, 1.9vw, 1rem);
  color: #fff;
}

header.site-header p.model-note {
  margin-top: .4rem;
  font-size: .8rem;
  opacity: 1;
  color: #9fb0cc;
}

.gradient-bar {
  height: 6px;
  background: linear-gradient(90deg, #174bb3 0%, #2067e7 25%, #3b82f6 50%, #2067e7 75%, #174bb3 100%);
  box-shadow: 0 1px 6px rgba(0,0,0,0.15), inset 0 -1px 0 rgba(255,255,255,0.25);
}

main {
  max-width: 900px;
  margin: 0 auto;
  padding: 1rem 1rem 3rem;
}

/* SIM CARD */
.sim-card {
  background: linear-gradient(135deg, #151515, #000);
  border-radius: var(--vst-radius);
  padding: .85rem .9rem 1rem;
  box-shadow: var(--vst-shadow-md);
}

.controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: .6rem;
  color: #cfd6e4;
  font-size: .9rem;
}

.controls label { font-weight: 600; }

input[type="range"] {
  flex: 1;
  min-width: 140px;
  accent-color: var(--vst-blue);
  height: 26px;
}

.readout {
  font-weight: 700;
  color: #fff;
  min-width: 52px;
  text-align: right;
}

button {
  font-family: inherit;
  font-size: .88rem;
  font-weight: 700;
  padding: .55rem .9rem;
  border: none;
  border-radius: .55rem;
  background: var(--vst-blue);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(32,103,231,.25);
  transition: background .2s ease, transform .15s ease;
  line-height: 1.1;
}

button:hover { background: var(--vst-blue-dark); transform: translateY(-1px); }
button:focus-visible { outline: var(--focus); outline-offset: 2px; }
button:disabled { opacity: .55; cursor: default; transform: none; }

/* WAVE PANELS (light panels on the dark card for crisp graphs) */
.wave-panel {
  background: #ffffff;
  border-radius: .7rem;
  padding: .35rem .7rem .4rem;
  margin-bottom: 7px;
}

.panel-top {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: .1rem;
}
.sim-label { font-size: .82rem; font-weight: 700; margin: 0; }
.sw1-text { color: var(--wave1); }
.sw2-text { color: var(--wave2); }
.swr-text { color: var(--result); }
.panel-hint { font-size: .72rem; color: #5f6772; }

canvas { display: block; width: 100%; height: auto; border-radius: 4px; }

/* STATUS BANNER */
.status {
  border-radius: .7rem;
  padding: .6rem .85rem;
  margin-bottom: .7rem;
  font-size: .88rem;
  background: rgba(255,255,255,.07);
  border-left: 5px solid #9fb0cc;
  color: #eaf0f8;
}
.status.constructive { background: rgba(96,196,120,.16); border-left-color: #57c07a; }
.status.destructive { background: rgba(96,150,255,.16); border-left-color: #6ea3ff; }
.status.partial { background: rgba(240,180,80,.16); border-left-color: #f0b450; }
.status strong { font-size: .96rem; color: #fff; }
.status #statusBody { color: #dbe3ef; }
.status .meter { display: block; margin-top: .2rem; font-size: .78rem; color: #b9c4d6; }

/* BOTTOM CONTROL BAR: amplitudes + presets in one compact row */
.bottom-bar {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 12px 18px;
}
.amp-ctrl { flex: 1 1 150px; min-width: 140px; }
.amp-ctrl label {
  display: block;
  color: #cfd6e4;
  font-size: .8rem;
  font-weight: 600;
  margin-bottom: .1rem;
}
.amp-ctrl .val { color: #ffd76b; font-weight: 700; }

/* PRESET CHIPS */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  flex: 1 1 100%;
}
@media (min-width: 640px) { .chips { flex: 0 0 auto; } }

button.chip {
  background: rgba(255,255,255,.1);
  border: 1.5px solid rgba(255,255,255,.16);
  border-radius: .6rem;
  padding: .55rem .95rem;
  box-shadow: none;
  color: #eaf0f8;
  font-size: .82rem;
  font-weight: 700;
}
button.chip:hover {
  background: rgba(32,103,231,.28);
  border-color: rgba(110,163,255,.55);
  transform: translateY(-1px);
}

/* LEARN MORE PANEL */
details.learn-more { margin-top: 1.2rem; }

details.learn-more summary {
  list-style: none;
  cursor: pointer;
  display: block;
  text-align: center;
  background: var(--vst-blue);
  color: #fff;
  font-weight: 700;
  font-size: .98rem;
  padding: .85rem 1.2rem;
  border-radius: .65rem;
  box-shadow: 0 8px 22px rgba(32,103,231,.3);
  transition: background .2s ease, transform .15s ease;
}

details.learn-more summary::-webkit-details-marker { display: none; }
details.learn-more summary:hover { background: var(--vst-blue-dark); transform: translateY(-1px); }
details.learn-more summary:focus-visible { outline: var(--focus); outline-offset: 3px; }
details.learn-more[open] summary { border-radius: .65rem .65rem 0 0; transform: none; }

.learn-body {
  background: var(--vst-card-bg);
  border: 1px solid var(--vst-card-border);
  border-top: none;
  border-radius: 0 0 var(--vst-radius) var(--vst-radius);
  box-shadow: var(--vst-shadow-md);
  padding: 1.1rem 1.25rem 1.25rem;
  display: grid;
  gap: 1rem;
}

.learn-block h3 { margin: 0 0 .3rem; font-size: .98rem; color: var(--vst-blue-dark); }
.learn-block p { margin: 0; font-size: .9rem; color: #333; }

.learn-block ul {
  margin: .4rem 0 0;
  padding-left: 1.2rem;
  font-size: .9rem;
  color: #333;
}
.learn-block li { margin-bottom: .2rem; }

.learn-figure { margin: 0; max-width: 360px; }

.figure-zoom {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 1px solid var(--vst-card-border);
  border-radius: .7rem;
  overflow: hidden;
  background: none;
  box-shadow: var(--vst-shadow-sm);
  cursor: zoom-in;
  position: relative;
  transition: transform .15s ease, box-shadow .15s ease;
}
.figure-zoom:hover { transform: translateY(-2px); box-shadow: var(--vst-shadow-md); }
.figure-zoom:focus-visible { outline: var(--focus); outline-offset: 3px; }

.figure-zoom img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: .7rem;
}

.zoom-hint {
  position: absolute;
  right: 8px;
  bottom: 8px;
  background: rgba(0,0,0,.72);
  color: #fff;
  font-size: .72rem;
  font-weight: 600;
  padding: .25rem .55rem;
  border-radius: .4rem;
  pointer-events: none;
}

.learn-figure figcaption {
  margin-top: .5rem;
  font-size: .8rem;
  color: #555;
  line-height: 1.5;
}

/* FULL-SCREEN LIGHTBOX */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 3.5rem 1.25rem 1.5rem;
}
.lightbox[hidden] { display: none; }

.lightbox-img {
  max-width: 100%;
  max-height: 74vh;
  width: auto;
  height: auto;
  border-radius: .5rem;
  box-shadow: 0 10px 40px rgba(0,0,0,.5);
}

.lightbox-imgbtn {
  padding: 0;
  border: none;
  background: none;
  box-shadow: none;
  cursor: zoom-out;
  line-height: 0;
  border-radius: .5rem;
}
.lightbox-imgbtn:hover { transform: none; }
.lightbox-imgbtn:focus-visible { outline: 3px solid #fff; outline-offset: 4px; }

.lightbox-caption {
  color: #eaf0f8;
  font-size: .85rem;
  line-height: 1.5;
  max-width: 70ch;
  text-align: center;
  margin: 0;
}

.lightbox-dismiss {
  color: #c7d0de;
  font-size: .82rem;
  text-align: center;
  margin: 0;
}
.lightbox-dismiss kbd {
  background: rgba(255,255,255,.16);
  border-radius: .3rem;
  padding: .05rem .35rem;
  font-family: inherit;
  font-size: .78rem;
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  height: 2.6rem;
  padding: 0 1.1rem 0 .8rem;
  border-radius: 1.4rem;
  background: #ffffff;
  color: #14203a;
  font-size: 1rem;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(0,0,0,.4);
}
.lightbox-close:hover { background: #eef2ff; transform: none; }
.lightbox-close:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.lightbox-close-x { font-size: 1.5rem; line-height: 1; }
.lightbox-close-word { font-size: .95rem; }

/* QUIZ */
.quiz-section { margin-top: 2rem; }

.quiz-section h2 {
  text-align: center;
  font-size: clamp(1.3rem, 3vw, 1.7rem);
  margin: 0 0 .35rem;
  position: relative;
  padding-top: 16px;
}

.quiz-section h2::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 72px;
  height: 3px;
  background: var(--vst-blue);
  border-radius: 3px;
}

.quiz-lead { text-align: center; color: #444; font-size: .9rem; margin: 0 0 1rem; }

.progress {
  text-align: center;
  font-size: .85rem;
  font-weight: 700;
  color: var(--vst-blue-dark);
  margin: 0 0 .7rem;
}

.quiz-q {
  background: var(--vst-card-bg);
  border: 1px solid var(--vst-card-border);
  border-radius: var(--vst-radius);
  padding: 1rem 1.15rem;
  margin-bottom: 12px;
  box-shadow: var(--vst-shadow-sm);
}

.quiz-q h3 { margin: 0 0 .6rem; font-size: .98rem; }

.quiz-opts { display: flex; flex-direction: column; gap: 7px; }

.quiz-opts button {
  text-align: left;
  width: 100%;
  background: var(--vst-light-blue);
  color: #1a2b4a;
  box-shadow: none;
  font-weight: 600;
  font-size: .88rem;
  border: 1px solid #dbe6ff;
}

.quiz-opts button:hover { background: #dde9ff; transform: none; }

.quiz-opts button.selected {
  background: #dbe8ff;
  border-color: var(--vst-blue);
  color: var(--vst-blue-dark);
  box-shadow: 0 0 0 2px rgba(32,103,231,.25);
}

.quiz-opts button.selected::before {
  content: "\25CF\00a0";
  color: var(--vst-blue-dark);
}

.next-row { text-align: center; margin-top: .8rem; }

/* RESULTS CARD */
.result-card {
  background: var(--vst-card-bg);
  border: 2px solid var(--vst-blue);
  border-radius: var(--vst-radius);
  box-shadow: var(--vst-shadow-md);
  padding: 1.5rem 1.4rem;
  text-align: center;
}

.result-card h3 { margin: 0 0 .2rem; font-size: 1.25rem; color: var(--vst-blue-dark); }

.result-score {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--vst-blue);
  margin: .2rem 0 0;
  line-height: 1.1;
}

.result-sub { font-size: .85rem; color: #555; margin: .15rem 0 1rem; }
.result-date { font-size: .8rem; color: #666; margin: 0 0 1rem; }

.screenshot-note {
  background: var(--vst-light-blue);
  border: 1px solid #dbe6ff;
  border-radius: .65rem;
  padding: .6rem .9rem;
  font-size: .85rem;
  color: #1a2b4a;
  margin: 0 0 1rem;
}

.restart {
  background: none;
  border: none;
  box-shadow: none;
  color: #666;
  font-size: .82rem;
  font-weight: 600;
  text-decoration: underline;
  padding: .5rem .6rem;
}
.restart:hover { background: none; color: var(--vst-blue-dark); transform: none; }

.quiz-q h3:focus, .result-card:focus { outline: none; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

footer.site-footer {
  text-align: center;
  font-size: .78rem;
  color: #666;
  padding: 1.4rem 1rem 2rem;
  border-top: 1px solid var(--vst-card-border);
}

footer.site-footer a { color: var(--vst-blue); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
  button:hover { transform: none !important; }
}
