: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;
  --moon-gold: #f2c14e;
  --tide-blue: #7fd0ff;
  --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: 2.4rem 1rem 2.1rem;
  background: radial-gradient(circle at top center, rgba(32,103,231,.22), transparent 34%),
              linear-gradient(135deg, #151515, #000);
  color: #fff;
}

header.site-header img.vst-logo {
  width: min(280px, 70vw);
  height: auto;
  margin: 0 auto .9rem;
  display: block;
}

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

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

.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: 1180px;
  margin: 0 auto;
  padding: 1rem 0.9rem 2rem;
}

/* SIM CARD */
.sim-card {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  grid-template-areas:
    "simgrid simgrid"
    "now now"
    "chips chips"
    "controls controls";
  gap: 10px 12px;
  background: linear-gradient(135deg, #151515, #000);
  border-radius: var(--vst-radius);
  padding: 1rem 1rem 1.05rem;
  box-shadow: var(--vst-shadow-md);
}

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

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

select {
  font: inherit;
  font-size: .86rem;
  font-weight: 600;
  color: #fff;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: .5rem;
  padding: .46rem 1.85rem .46rem .65rem;
  cursor: pointer;
}

select:focus-visible {
  outline: var(--focus);
  outline-offset: 2px;
}

select option {
  color: #111;
  background: #fff;
}

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

.cycle-note {
  flex-basis: 100%;
  margin: -2px 0 0 60px;
  color: #9fb0cc;
  font-size: .74rem;
  line-height: 1.35;
}

.model-note {
  flex-basis: 100%;
  margin: 0 0 0 60px;
  color: #c5d3e8;
  font-size: .74rem;
  line-height: 1.35;
}

.model-note strong {
  color: #ffffff;
}

@media (max-width: 640px) {
  .cycle-note, .model-note { margin-left: 0; }
}

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; }

button.ghost {
  background: rgba(255,255,255,.12);
  box-shadow: none;
}
button.ghost:hover { background: rgba(255,255,255,.22); }
button.ghost.selected { background: var(--vst-blue); }

.sim-grid {
  grid-area: simgrid;
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 12px;
  align-items: center;
}

@media (max-width: 640px) {
  .sim-grid {
  grid-area: simgrid; grid-template-columns: 1fr; }
}

.sim-cell { text-align: center; }

.inline-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  justify-content: center;
  margin-top: .45rem;
}

.inline-note,
.sim-note {
  margin: 0;
  color: #9fb0cc;
  font-size: .78rem;
  line-height: 1.35;
}

.inline-note { max-width: 42ch; text-align: left; }
.sim-note {
  max-width: 52ch;
  margin: .45rem auto 0;
  text-align: left;
}



.phase-panel {
  display: grid;
  grid-template-columns: minmax(205px, 235px) minmax(255px, 320px);
  gap: 10px;
  align-items: start;
  justify-content: center;
}
.phase-panel .sim-label {
  grid-column: 1 / -1;
  text-align: center;
}
.now-toggle[aria-expanded="true"] .now-toggle-right { color: #ffffff; }

@media (max-width: 980px) {
  .now-toggle {
    flex-direction: column;
    align-items: flex-start;
  }

  .now-toggle-right {
    white-space: normal;
  }
  .phase-panel { grid-template-columns: 1fr; justify-items: center; }
  .phase-panel .sim-label { grid-column: auto; }
}

.phase-box {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 205px;
  min-height: 246px;
  padding: .8rem .75rem;
  margin-top: .25rem;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(159,176,204,.28);
  border-radius: .9rem;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.02);
}


.graph-box {
  width: 100%;
  max-width: 300px;
  padding: .65rem .7rem .55rem;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(159,176,204,.28);
  border-radius: .9rem;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.02);
}

.graph-title {
  margin: 0 0 .35rem;
  font-size: .78rem;
  color: #9fb0cc;
}

.graph-box svg {
  display: block;
}

.sim-label {
  font-size: .78rem;
  color: #9fb0cc;
  margin: 0 0 .2rem;
}

.phase-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--tide-blue);
  margin: .4rem 0 0;
}

.phase-sub { font-size: .82rem; color: #9fb0cc; margin: 0; }

.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: .9rem;
  justify-content: center;
}

.presets button { font-size: .78rem; padding: .45rem .7rem; }

/* EXPANDABLE INFO CARDS */
.info-cards {
  display: grid;
  gap: 12px;
  margin-top: 1.4rem;
}

details.info {
  background: var(--vst-card-bg);
  border: 1px solid var(--vst-card-border);
  border-radius: var(--vst-radius);
  box-shadow: var(--vst-shadow-sm);
  overflow: hidden;
  transition: box-shadow .2s ease;
}

details.info[open] { box-shadow: var(--vst-shadow-md); }

details.info summary {
  list-style: none;
  cursor: pointer;
  padding: 1rem 1.15rem;
  font-weight: 700;
  color: var(--vst-blue-dark);
  font-size: 1.02rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

details.info summary::-webkit-details-marker { display: none; }

details.info summary::after {
  content: "+";
  font-size: 1.4rem;
  line-height: 1;
  color: var(--vst-blue);
  transition: transform .2s ease;
}

details.info[open] summary::after { content: "\2212"; }

details.info summary:focus-visible { outline: var(--focus); outline-offset: -3px; }

.info-body {
  padding: 0 1.15rem 1.1rem;
  font-size: .93rem;
  color: #333;
}

.info-body p { margin: 0 0 .6rem; }
.info-body p:last-child { margin-bottom: 0; }

.info-body .mini-sim {
  background: linear-gradient(135deg, #151515, #000);
  border-radius: .75rem;
  padding: .85rem;
  margin-top: .6rem;
}

.mini-sim .controls {
  grid-area: controls; margin-bottom: .5rem; }
.mini-sim .sim-label { text-align: center; margin-top: .4rem; }

.callout {
  background: var(--vst-light-blue);
  border: 1px solid #dbe6ff;
  border-radius: .75rem;
  padding: .7rem .9rem;
  font-size: .9rem;
}

/* 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;
}

.score-line {
  text-align: right;
  font-size: .88rem;
  font-weight: 700;
  color: var(--vst-blue-dark);
  margin: 0 0 .6rem;
}

.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.correct { background: var(--ok-bg); color: var(--ok-ink); border-color: #9cc38f; }
.quiz-opts button.wrong { background: var(--bad-bg); color: var(--bad-ink); border-color: #dfa19a; }

.explain {
  font-size: .82rem;
  color: #555;
  margin: .6rem 0 0;
  padding-top: .55rem;
  border-top: 1px dashed var(--vst-card-border);
}

.submit-row { text-align: center; margin-top: .5rem; }

.result {
  border-radius: var(--vst-radius);
  padding: 1rem 1.15rem;
  margin-top: .9rem;
  display: none;
  text-align: center;
  font-size: .95rem;
}

.result.pass { display: block; background: var(--ok-bg); color: var(--ok-ink); }
.result.fail { display: block; background: var(--bad-bg); color: var(--bad-ink); }
.result strong { font-size: 1.1rem; }

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; }
}

/* PHASE CHIPS */
.chips {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  gap: 8px;
  margin-top: 1rem;
}

button.chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  background: rgba(255,255,255,.07);
  border: 1.5px solid rgba(255,255,255,.14);
  border-radius: .75rem;
  padding: .6rem .35rem .5rem;
  box-shadow: none;
  color: #cfd6e4;
  font-size: .72rem;
  font-weight: 600;
  line-height: 1.15;
}

button.chip:hover {
  background: rgba(32,103,231,.25);
  border-color: rgba(110,163,255,.55);
  transform: translateY(-1px);
}

button.chip.active {
  background: rgba(32,103,231,.35);
  border-color: var(--vst-blue);
  color: #fff;
  box-shadow: 0 0 0 2px rgba(32,103,231,.35), 0 6px 16px rgba(32,103,231,.3);
}

button.chip svg { display: block; }

/* 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 .2rem;
  font-size: .98rem;
  color: var(--vst-blue-dark);
}

.learn-block p {
  margin: 0;
  font-size: .9rem;
  color: #333;
}

.learn-block .mini-sim { margin-top: .6rem; }

/* CHIPS: single row */
.chips {
  grid-template-columns: repeat(5, minmax(92px, 1fr));
  gap: 6px;
  align-content: start;
}

button.chip {
  font-size: .67rem;
  padding: .45rem .18rem .4rem;
  gap: 4px;
  border-radius: .6rem;
}

@media (max-width: 700px) {
  .chips {
    display: flex;
    overflow-x: auto;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
  }
  button.chip { flex: 0 0 108px; }
}

/* QUIZ: one at a time */
.progress {
  text-align: center;
  font-size: .85rem;
  font-weight: 700;
  color: var(--vst-blue-dark);
  margin: 0 0 .7rem;
}

.feedback {
  border-radius: .65rem;
  padding: .65rem .85rem;
  font-size: .85rem;
  font-weight: 600;
  margin-top: .7rem;
}

.feedback.good { background: var(--ok-bg); color: var(--ok-ink); }
.feedback.hint { background: #fdf3dc; color: #7a5a10; }

.feedback .explain-inline {
  display: block;
  font-weight: 400;
  font-size: .82rem;
  margin-top: .3rem;
}

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

/* RESULTS CARD (screenshot friendly) */
.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;
}

.attempt-list {
  list-style: none;
  margin: 0 auto 1rem;
  padding: 0;
  max-width: 340px;
  text-align: left;
  font-size: .86rem;
  display: grid;
  gap: 5px;
}

.attempt-list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  background: var(--vst-light-blue);
  border: 1px solid #dbe6ff;
  border-radius: .55rem;
  padding: .4rem .7rem;
}

.attempt-list li .mark { font-weight: 700; }
.attempt-list li .mark.first { color: var(--ok-ink); }
.attempt-list li .mark.retry { color: #7a5a10; }

.name-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: .5rem;
  flex-wrap: wrap;
}

.name-row label { font-size: .88rem; font-weight: 600; color: #333; }

.name-row input {
  font-family: inherit;
  font-size: .95rem;
  padding: .5rem .75rem;
  border: 1.5px solid var(--vst-card-border);
  border-radius: .55rem;
  min-width: 200px;
}

.name-row input:focus-visible { outline: var(--focus); outline-offset: 1px; border-color: var(--vst-blue); }

.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; }

/* Selected (not yet graded) answer */
.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);
}

/* WCAG refinements */
.name-row input::placeholder { color: #767676; }

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

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


#playBtn:disabled {
  background: #4b5568;
  color: #d5d9e2;
  box-shadow: none;
  opacity: 1;
}

button.chip .chip-hour {
  color: #9fc1ff;
  font-size: .68rem;
  font-weight: 700;
}
button.chip.active .chip-hour { color: #fff; }


/* AUTOMATIC TIDE EXPLANATION */
.now-wrap { grid-area: now; margin-top: 0; align-self: start; }

.now-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .8rem;
  padding: .8rem 1rem;
  border: 1px solid rgba(127, 184, 255, .42);
  border-radius: .8rem;
  background: linear-gradient(135deg, rgba(32,103,231,.18), rgba(255,255,255,.045));
  color: #dce9ff;
  text-align: left;
  cursor: pointer;
}

.now-toggle:hover,
.now-toggle:focus-visible {
  outline: none;
  border-color: rgba(127, 184, 255, .72);
  box-shadow: 0 0 0 3px rgba(77,157,255,.18);
}

.now-toggle-left {
  display: flex;
  align-items: center;
  gap: .55rem;
  color: #9fc1ff;
  font-size: .88rem;
  font-weight: 700;
}

.now-toggle-right {
  color: #c9d8ef;
  font-size: .8rem;
  font-weight: 600;
  white-space: nowrap;
}

.now-panel {
  margin-top: .55rem;
  padding: .85rem 1rem;
  border: 1px solid rgba(127, 184, 255, .42);
  border-left: 5px solid #4d9dff;
  border-radius: .8rem;
  background: linear-gradient(135deg, rgba(32,103,231,.18), rgba(255,255,255,.045));
  color: #dce9ff;
  text-align: left;
}

.now-panel-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-radius: 50%;
  background: #e0603a;
  border: 1px solid #fff;
}

.now-panel strong {
  display: block;
  color: #fff;
  font-size: .98rem;
  margin-bottom: .15rem;
}

.now-panel p {
  margin: 0;
  color: #c9d8ef;
  font-size: .86rem;
  line-height: 1.48;
}
.chips { grid-area: chips; margin-top: 0; align-self: start; }
.now-toggle[aria-expanded="true"] .now-toggle-right { color: #ffffff; }

@media (max-width: 980px) {
  .sim-card {
    grid-template-columns: 1fr;
    grid-template-areas: "controls" "now" "simgrid" "chips";
  }
}
