:root {
  color-scheme: dark;
  --bg: #09030f;
  --bg-2: #12061d;
  --panel: rgba(19, 7, 31, 0.82);
  --panel-solid: #140921;
  --panel-soft: rgba(31, 12, 49, 0.74);
  --line: rgba(0, 240, 255, 0.24);
  --line-strong: rgba(255, 196, 251, 0.42);
  --text: #f8f4ff;
  --muted: #b8a1ca;
  --soft: #e8d8f6;
  --accent: #2CFF05;
  --accent-2: #FFC4FB;
  --violet: #51158C;
  --cyan: #00F0FF;
  --hot: #FFC4FB;
  --good: #2CFF05;
  --shadow: 0 26px 80px rgba(0, 0, 0, 0.52);
  --glow-cyan: 0 0 0 1px rgba(0, 240, 255, 0.18), 0 0 18px rgba(0, 240, 255, 0.14), 0 0 36px rgba(0, 240, 255, 0.08);
  --glow-pink: 0 0 0 1px rgba(255, 196, 251, 0.18), 0 0 20px rgba(255, 196, 251, 0.16), 0 0 42px rgba(255, 196, 251, 0.08);
  --radius: 24px;
  font-family: "OpenDyslexic", "OpenDyslexicAlta", "Atkinson Hyperlegible", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

::selection {
  background: rgba(0, 240, 255, 0.22);
  color: #fff;
}

body {
  margin: 0;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
  letter-spacing: 0.01em;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 12%, rgba(0, 240, 255, 0.16), transparent 24rem),
    radial-gradient(circle at 85% 10%, rgba(255, 196, 251, 0.18), transparent 28rem),
    radial-gradient(circle at 50% 85%, rgba(44, 255, 5, 0.10), transparent 32rem),
    linear-gradient(135deg, #05020a 0%, #0c0414 30%, #140625 70%, #09030f 100%);
  color: var(--text);
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.018) 1px, transparent 1px);
  background-size: 100% 28px, 28px 100%;
  mask-image: linear-gradient(to bottom, rgba(255,255,255,0.2), transparent 90%);
  opacity: 0.26;
}

button,
input,
select {
  font: inherit;
}

button { cursor: pointer; }

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 64px;
}

.topbar {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px;
}

.topbar a {
  color: var(--soft);
  text-decoration: none;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(10, 3, 17, 0.68), rgba(33, 10, 53, 0.55));
  padding: 9px 13px;
  border-radius: 999px;
  transition: 150ms ease;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.03);
}

.topbar a:hover,
.topbar a:focus-visible {
  border-color: rgba(0, 240, 255, 0.68);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: var(--glow-cyan);
}

.hero {
  position: relative;
  overflow: hidden;
  min-height: 460px;
  border: 1px solid var(--line);
  border-radius: 34px;
  background:
    linear-gradient(135deg, rgba(20, 7, 33, 0.80), rgba(8, 2, 13, 0.94)),
    repeating-linear-gradient(120deg, rgba(0, 240, 255, 0.06) 0 1px, transparent 1px 22px),
    linear-gradient(180deg, rgba(255, 196, 251, 0.06), transparent 40%);
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(255,255,255,0.03), 0 0 0 1px rgba(0,240,255,0.08);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, transparent 0%, rgba(0, 240, 255, 0.08) 18%, transparent 36%),
    linear-gradient(180deg, rgba(255,255,255,0.03), transparent 28%);
  mix-blend-mode: screen;
  opacity: 0.7;
  pointer-events: none;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -12% -48% 28%;
  height: 420px;
  transform: rotate(-8deg);
  background:
    radial-gradient(circle, rgba(255, 196, 251, 0.26), transparent 46%),
    linear-gradient(90deg, transparent, rgba(0, 240, 255, 0.36), transparent),
    linear-gradient(180deg, transparent, rgba(44, 255, 5, 0.14));
  filter: blur(10px);
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
  width: min(720px, 100%);
  padding: 64px 44px 72px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--cyan);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-shadow: 0 0 14px rgba(0, 240, 255, 0.36);
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  margin-bottom: 18px;
  font-size: clamp(2.4rem, 7vw, 5.2rem);
  line-height: 0.92;
  letter-spacing: -0.075em;
  text-shadow: 0 0 28px rgba(255, 196, 251, 0.14);
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.5rem, 3vw, 2.15rem);
  letter-spacing: -0.04em;
}

h3 {
  margin-bottom: 14px;
  font-size: 1.1rem;
}

.hero-copy {
  max-width: 620px;
  color: var(--soft);
  font-size: 1.08rem;
  line-height: 1.7;
}

.hero-actions,
.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 11px 18px;
  color: var(--text);
  text-decoration: none;
  background: linear-gradient(135deg, rgba(18, 7, 29, 0.88), rgba(34, 12, 52, 0.72));
  transition: 150ms ease;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.03);
}

.button:hover,
.button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(0, 240, 255, 0.56);
  box-shadow: var(--glow-cyan);
}

.button.primary {
  border-color: rgba(0, 240, 255, 0.76);
  background: linear-gradient(135deg, #2CFF05 0%, #00F0FF 45%, #FFC4FB 100%);
  color: #13061f;
  font-weight: 900;
  box-shadow: 0 14px 38px rgba(0, 240, 255, 0.20), 0 0 24px rgba(255, 196, 251, 0.10);
}

.button.ghost {
  background: linear-gradient(135deg, rgba(23, 7, 36, 0.86), rgba(81, 21, 140, 0.32));
}
.button.quiet {
  background: transparent;
  color: var(--muted);
}

main {
  display: grid;
  gap: 22px;
  margin-top: 24px;
}

.panel,
.result-hero,
.result-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(255,255,255,0.025);
  backdrop-filter: blur(18px);
}

.panel {
  padding: 24px;
  position: relative;
}

.panel::before,
.result-card::before,
.result-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,0.03), transparent 24%);
}

.section-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(0, 240, 255, 0.30);
  border-radius: 999px;
  background: rgba(0, 240, 255, 0.08);
  color: #d8fbff;
  padding: 8px 12px;
  font-size: 0.85rem;
  white-space: nowrap;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.03);
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.option-card,
.option-chip,
.fix-button,
.saved-actions button {
  border: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(18, 7, 29, 0.84), rgba(42, 12, 66, 0.56));
  color: var(--text);
  transition: 150ms ease;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.025);
}

.option-card {
  display: grid;
  gap: 6px;
  min-height: 132px;
  text-align: left;
  padding: 18px;
  border-radius: 22px;
}

.option-card span {
  color: var(--cyan);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
}

.option-card strong {
  font-size: 1.15rem;
}

.option-card small {
  color: var(--muted);
}

.option-card:hover,
.option-card:focus-visible,
.option-chip:hover,
.option-chip:focus-visible,
.fix-button:hover,
.fix-button:focus-visible,
.saved-actions button:hover,
.saved-actions button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(255, 196, 251, 0.58);
  box-shadow: var(--glow-pink);
}

.option-card.active,
.option-chip.active {
  border-color: rgba(0, 240, 255, 0.95);
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.14), rgba(81, 21, 140, 0.42), rgba(255, 196, 251, 0.18));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.05), 0 0 0 1px rgba(0,240,255,0.08), 0 18px 45px rgba(0, 240, 255, 0.10);
}

.surface-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.option-chip {
  min-width: 110px;
  padding: 11px 14px;
  border-radius: 999px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
}

label span {
  color: var(--soft);
  font-size: 0.9rem;
}

input,
select {
  width: 100%;
  border: 1px solid rgba(0, 240, 255, 0.16);
  border-radius: 16px;
  padding: 12px 13px;
  background: rgba(6, 2, 10, 0.68);
  color: var(--text);
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.02);
}

input::placeholder { color: rgba(232, 216, 246, 0.42); }

input:focus,
select:focus {
  border-color: rgba(0, 240, 255, 0.76);
  box-shadow: 0 0 0 4px rgba(0, 240, 255, 0.10), 0 0 18px rgba(0, 240, 255, 0.10);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  grid-column: span 2;
  align-self: end;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid rgba(0, 240, 255, 0.14);
  border-radius: 16px;
  background: rgba(6, 2, 10, 0.44);
}

.checkbox-label input { width: auto; accent-color: var(--accent); }
.checkbox-label span { font-size: 0.95rem; }

.results-anchor {
  scroll-margin-top: 18px;
}

.result-hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 28px;
  margin-bottom: 18px;
  background:
    linear-gradient(135deg, rgba(0, 240, 255, 0.10), rgba(81, 21, 140, 0.18) 40%, rgba(255, 196, 251, 0.08)),
    var(--panel);
}

.result-hero h2 {
  margin-bottom: 8px;
  font-size: clamp(1.8rem, 4vw, 3.3rem);
}

.result-hero p:last-child { margin-bottom: 0; color: var(--soft); }

.speed-badge {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 138px;
  height: 138px;
  border: 1px solid rgba(0, 240, 255, 0.36);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 240, 255, 0.18), rgba(9, 3, 15, 0.94) 65%);
  box-shadow: var(--glow-cyan);
}

.speed-badge span {
  display: block;
  font-size: 2.7rem;
  font-weight: 900;
  line-height: 1;
  color: var(--accent);
  text-shadow: 0 0 18px rgba(44, 255, 5, 0.30);
}

.speed-badge small {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.68rem;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.result-card {
  position: relative;
  padding: 20px;
}

.result-card dl {
  display: grid;
  gap: 10px;
  margin: 0;
}

.result-card dl div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 9px;
  border-bottom: 1px solid rgba(0, 240, 255, 0.10);
}

.result-card dt { color: var(--muted); }
.result-card dd { margin: 0; font-weight: 800; text-align: right; }
.result-card p { margin: 16px 0 0; color: var(--muted); line-height: 1.5; }

.gear-panel,
.notes-panel {
  margin-top: 18px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid rgba(0, 240, 255, 0.16);
  border-radius: 18px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 430px;
}

th,
td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(0, 240, 255, 0.10);
}

th {
  color: #fef6ff;
  background: linear-gradient(135deg, rgba(81, 21, 140, 0.46), rgba(0, 240, 255, 0.08));
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

tr:last-child td { border-bottom: 0; }

.muted {
  color: var(--muted);
  line-height: 1.6;
}

.formula {
  display: inline-block;
  margin: 8px 0 0;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(6, 2, 10, 0.65);
  color: var(--soft);
  border: 1px solid rgba(255, 196, 251, 0.12);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86rem;
}

.notes-panel ul {
  margin-bottom: 0;
  color: var(--soft);
  line-height: 1.65;
}

.fix-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.fix-button {
  min-height: 70px;
  padding: 14px;
  border-radius: 18px;
  text-align: left;
}

.correction-output {
  margin-top: 18px;
  border: 1px solid rgba(255, 196, 251, 0.20);
  border-radius: 20px;
  padding: 18px;
  background: linear-gradient(135deg, rgba(81, 21, 140, 0.24), rgba(255, 196, 251, 0.06));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.02);
}

.correction-output h3 { margin-bottom: 10px; }
.correction-output ol { margin-bottom: 0; line-height: 1.65; }

.saved-list {
  display: grid;
  gap: 12px;
}

.saved-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(0, 240, 255, 0.14);
  border-radius: 18px;
  background: rgba(8, 3, 13, 0.46);
}

.saved-item div:first-child {
  display: grid;
  gap: 3px;
}

.saved-item span {
  color: var(--muted);
  font-size: 0.9rem;
}

.saved-actions {
  display: flex;
  gap: 8px;
}

.saved-actions button {
  padding: 8px 10px;
  border-radius: 999px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  border: 1px solid rgba(0, 240, 255, 0.42);
  border-radius: 999px;
  background: rgba(12, 4, 20, 0.94);
  color: var(--text);
  padding: 12px 16px;
  box-shadow: var(--shadow), 0 0 16px rgba(0, 240, 255, 0.12);
  transition: 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 980px) {
  .mode-grid,
  .result-grid,
  .fix-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .app-shell { width: min(100% - 20px, 1180px); padding-top: 10px; }
  .topbar { justify-content: flex-start; overflow-x: auto; }
  .hero { min-height: auto; border-radius: 24px; }
  .hero-content { padding: 42px 22px 52px; }
  .panel { padding: 18px; }
  .mode-grid,
  .result-grid,
  .fix-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }
  .checkbox-label { grid-column: auto; }
  .result-hero { align-items: flex-start; flex-direction: column; }
  .speed-badge { width: 112px; height: 112px; }
  .section-title-row { flex-direction: column; }
  .saved-item { align-items: flex-start; flex-direction: column; }
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.guide-grid article {
  display: grid;
  gap: 8px;
  min-height: 108px;
  padding: 16px;
  border: 1px solid rgba(0, 240, 255, 0.16);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(18, 7, 29, 0.78), rgba(81, 21, 140, 0.22));
}

.guide-grid strong {
  color: var(--accent);
  text-shadow: 0 0 14px rgba(44, 255, 5, 0.22);
}

.guide-grid span {
  color: var(--soft);
  line-height: 1.45;
}

.gear-graph {
  display: grid;
  gap: 9px;
  margin: 2px 0 18px;
  padding: 14px;
  border: 1px solid rgba(0, 240, 255, 0.16);
  border-radius: 18px;
  background: rgba(6, 2, 10, 0.42);
}

.gear-bar-row {
  display: grid;
  grid-template-columns: 34px minmax(120px, 1fr) 68px;
  align-items: center;
  gap: 10px;
}

.gear-bar-row span {
  color: var(--cyan);
  font-weight: 900;
  font-size: 0.76rem;
  letter-spacing: 0.12em;
}

.gear-bar-row b {
  color: var(--soft);
  font-size: 0.84rem;
  text-align: right;
}

.gear-bar-track {
  height: 10px;
  overflow: hidden;
  border: 1px solid rgba(0, 240, 255, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
}

.gear-bar-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2CFF05, #00F0FF, #FFC4FB);
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.18);
}

@media (max-width: 980px) {
  .guide-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .guide-grid {
    grid-template-columns: 1fr;
  }
  .gear-bar-row {
    grid-template-columns: 30px minmax(90px, 1fr) 58px;
  }
}
