:root {
  --bg: #e8eaed;
  --surface: #eef0f3;
  --text: #4a5159;
  --text-soft: #8b939c;
  --accent-hue: 41;
  --accent: oklch(0.75 0.10 var(--accent-hue));
  --accent-deep: oklch(0.62 0.12 var(--accent-hue));
  --accent-soft: oklch(0.94 0.03 var(--accent-hue));
  --shadow-light: rgba(255, 255, 255, 0.95);
  --shadow-dark: rgba(163, 177, 198, 0.55);
  --error: oklch(0.62 0.18 28);
  --key-radius: 18px;
  --calc-radius: 32px;
  --display-font-size: 52px;
}

body.dark {
  --bg: #23272b;
  --surface: #2b2f34;
  --text: #dde1e5;
  --text-soft: #8a939c;
  --shadow-light: rgba(60, 66, 73, 0.7);
  --shadow-dark: rgba(0, 0, 0, 0.55);
}

.result { font-size: var(--display-font-size) !important; }
.key { border-radius: var(--key-radius) !important; }
.calc { border-radius: var(--calc-radius) !important; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }

body {
  background: var(--bg);
  font-family: "Inter", system-ui, sans-serif;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: 0;
  overflow-x: hidden;
}

/* ---- Page Header ---- */

.page-header {
  width: 100%;
  padding: 50px 32px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  position: relative;
}

.page-header h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text);
  margin: 0;
}

.page-header h1 span {
  color: var(--accent-deep);
}

.page-header .logo-icon {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: var(--surface);
  display: grid;
  place-items: center;
  color: var(--accent);
  box-shadow:
    -3px -3px 6px var(--shadow-light),
    3px 3px 8px var(--shadow-dark);
}

.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: none;
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow:
    -3px -3px 6px var(--shadow-light),
    3px 3px 8px var(--shadow-dark);
  transition: box-shadow 0.12s ease, color 0.15s ease;
  flex-shrink: 0;
}

.theme-toggle:hover { color: var(--accent-deep); }
.theme-toggle:active {
  box-shadow:
    inset 2px 2px 5px var(--shadow-dark),
    inset -2px -2px 5px var(--shadow-light);
}

/* ---- Page Content ---- */

.page-content {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
}

/* ---- Stage & Cat ---- */

.stage {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: relative;
  z-index: 1;
  padding-top: 175px;
  padding-bottom: 55px;
}

.cat-frame {
  position: absolute;
  width: 195%;
  left: 50%;
  top: 48%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: -1;
}

/* ---- Calculator Body ---- */

.calc {
  background: transparent;
  border-radius: 32px;
  padding: 14px;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ---- Display ---- */

.display {
  background: var(--bg);
  border-radius: 22px;
  padding: 14px 18px 12px;
  box-shadow:
    inset 4px 4px 10px var(--shadow-dark),
    inset -4px -4px 10px var(--shadow-light);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  min-height: 90px;
  overflow: hidden;
}

.mem-indicator {
  font-size: 10px;
  color: var(--accent);
  letter-spacing: 0.08em;
  text-align: right;
  min-height: 13px;
  font-family: "Inter", sans-serif;
  font-weight: 600;
}

.expr {
  font-family: "JetBrains Mono", monospace;
  font-size: 14px;
  color: var(--text-soft);
  min-height: 18px;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  direction: rtl;
  letter-spacing: 0.02em;
}

.result-wrap {
  width: 100%;
  overflow: hidden;
  display: flex;
  justify-content: flex-end;
  min-height: 56px;
  transform-origin: right center;
}

.result {
  font-family: "JetBrains Mono", monospace;
  font-weight: 500;
  font-size: 52px;
  line-height: 1;
  color: var(--accent-deep);
  letter-spacing: -0.01em;
  white-space: nowrap;
  direction: ltr;
  transform-origin: right center;
  transition: transform .18s ease, color .2s ease;
  will-change: transform;
}

.result.error { color: var(--error); font-size: 32px; }

.result-wrap.pop { animation: pop .22s ease; }

@keyframes pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

/* ---- Keypad ---- */

.pad {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}

.key {
  height: 34px;
  border: none;
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  font-family: "JetBrains Mono", monospace;
  font-size: 18px;
  font-weight: 500;
  cursor: pointer;
  box-shadow:
    -4px -4px 8px var(--shadow-light),
    5px 5px 12px var(--shadow-dark);
  transition: box-shadow .1s ease, transform .08s ease, color .15s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  display: grid;
  place-items: center;
}

.key:hover { color: var(--accent-deep); }

.key:active, .key.pressed {
  box-shadow:
    inset 3px 3px 7px var(--shadow-dark),
    inset -3px -3px 7px var(--shadow-light);
  color: var(--accent-deep);
}

.key.op {
  color: var(--accent);
  font-weight: 600;
}

.key.op.active {
  box-shadow:
    inset 3px 3px 7px var(--shadow-dark),
    inset -3px -3px 7px var(--shadow-light);
  color: var(--accent-deep);
}

.key.fn {
  font-family: "Inter", sans-serif;
  color: var(--text-soft);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.key.mem {
  font-family: "Inter", sans-serif;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.key.mem.has-mem { color: var(--accent); }

.key.sci {
  font-family: "Inter", sans-serif;
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 600;
}

.key.eq {
  grid-column: span 1;
  background: linear-gradient(145deg, var(--accent), var(--accent-deep));
  color: #fff;
  font-weight: 700;
  box-shadow:
    -4px -4px 8px var(--shadow-light),
    5px 5px 14px var(--shadow-dark),
    inset 1px 1px 2px rgba(255, 255, 255, 0.25);
}

.key.eq:hover { color: #fff; filter: brightness(1.04); }

.key.eq:active, .key.eq.pressed {
  box-shadow:
    inset 3px 3px 7px rgba(0, 0, 0, 0.25),
    inset -2px -2px 5px rgba(255, 255, 255, 0.18);
  color: #fff;
}

/* ---- Copy / Paste Buttons ---- */

.copy-paste-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  margin-left: auto;
  width: fit-content;
}

.copy-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 12px;
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
  box-shadow:
    -3px -3px 6px var(--shadow-light),
    3px 3px 8px var(--shadow-dark);
  transition: box-shadow .1s ease, color .15s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.copy-btn:hover { color: var(--accent-deep); }

.copy-btn:active {
  box-shadow:
    inset 2px 2px 5px var(--shadow-dark),
    inset -2px -2px 5px var(--shadow-light);
}

.copy-btn.copied { color: var(--accent); }

/* ---- Keyboard Hint Footer ---- */

.footer {
  text-align: center;
  font-size: 11px;
  color: var(--text-soft);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 4px 8px 0;
}

.footer kbd {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  padding: 2px 5px;
  margin: 0 2px;
  background: var(--surface);
  border-radius: 5px;
  box-shadow:
    -1px -1px 2px var(--shadow-light),
    1px 1px 2px var(--shadow-dark);
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
}

/* ---- Ad Container ---- */

.ad-container {
  width: 100%;
  max-width: 728px;
  margin: 0 auto;
  padding: 0 16px;
  text-align: center;
}

.ad-container ins {
  border-radius: 12px;
  overflow: hidden;
}

/* ---- Blurb ---- */

.blurb {
  max-width: 420px;
  margin: 0 auto;
  padding: 80px 24px 60px;
  text-align: left;
  font-size: 15px;
  line-height: 1.65;
  color: var(--text-soft);
  letter-spacing: 0.01em;
}

.blurb strong {
  color: var(--text);
  font-weight: 600;
}

/* ---- Page Footer ---- */

.page-footer {
  width: 100%;
  padding: 24px 32px;
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

body.dark .page-footer {
  border-top-color: rgba(255, 255, 255, 0.06);
}

.page-footer a {
  font-size: 13px;
  color: var(--text-soft);
  text-decoration: none;
  letter-spacing: 0.02em;
  transition: color 0.15s ease;
}

.page-footer a:hover {
  color: var(--accent-deep);
}

.page-footer .sep {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text-soft);
  opacity: 0.4;
}

/* ---- Prose pages (legal, terms) ---- */

.prose-page {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

.prose-page h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 32px;
}

.prose-page h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 32px 0 8px;
}

.prose-page p,
.prose-page li {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-soft);
  margin: 0 0 12px;
}

.prose-page ul {
  padding-left: 20px;
  margin: 0 0 12px;
}

.prose-page a {
  color: var(--accent-deep);
  text-decoration: none;
}

.prose-page a:hover {
  text-decoration: underline;
}

/* ---- Tweaks Panel ---- */

.tweaks-panel {
  position: fixed;
  top: 24px;
  right: 24px;
  width: 280px;
  background: var(--surface);
  border-radius: 18px;
  padding: 18px;
  box-shadow:
    -6px -6px 14px var(--shadow-light),
    8px 8px 22px var(--shadow-dark);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 13px;
  color: var(--text);
  z-index: 1000;
  display: none;
}

.tweaks-panel.open { display: block; }

.tweaks-title {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-soft);
}

.tweaks-close {
  background: none;
  border: none;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.tweak-row {
  margin-bottom: 14px;
}

.tweak-row label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-soft);
  margin-bottom: 6px;
}

.tweak-row input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.tweak-row .row-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tweak-toggle {
  position: relative;
  width: 36px;
  height: 20px;
  background: var(--bg);
  border-radius: 10px;
  cursor: pointer;
  box-shadow: inset 2px 2px 4px var(--shadow-dark), inset -2px -2px 4px var(--shadow-light);
  transition: background 0.2s;
}

.tweak-toggle::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 1px 1px 3px var(--shadow-dark);
  transition: left 0.2s;
}

.tweak-toggle.on { background: var(--accent); }
.tweak-toggle.on::after { left: 18px; }

.tweak-value {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: var(--accent-deep);
}

/* ============================================
   Calculator Pages — shared components
   ============================================ */

/* ---- Hero with Cat Image ---- */

.calc-hero {
  position: relative;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding-top: 180px;
  padding-bottom: 24px;
  z-index: 1;
}

.calc-hero-cat {
  position: absolute;
  width: 160%;
  left: 50%;
  top: 38%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: -1;
  opacity: 0.92;
}

.calc-hero h2 {
  text-align: center;
  margin-bottom: 24px;
}

/* ---- Calc Page Container ---- */

.calc-page {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding: 0 24px 40px;
}

.calc-page h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 24px;
}

.calc-page h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 32px 0 12px;
}

.calc-page p,
.calc-page li {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-soft);
  margin: 0 0 12px;
}

.calc-page ul { padding-left: 20px; margin: 0 0 12px; }
.calc-page strong { color: var(--text); font-weight: 600; }
.calc-page a { color: var(--accent-deep); text-decoration: none; }
.calc-page a:hover { text-decoration: underline; }

/* ---- Neumorphic Card ---- */

.calc-card {
  background: var(--surface);
  border-radius: 22px;
  padding: 28px;
  margin-bottom: 28px;
  box-shadow:
    -6px -6px 14px var(--shadow-light),
    8px 8px 22px var(--shadow-dark);
}

.calc-card h3 {
  margin-top: 0;
}

/* ---- Form Layout ---- */

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-soft);
  margin-bottom: 8px;
  font-weight: 600;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
}

.form-inline {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ---- Neumorphic Inputs ---- */

.calc-input {
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-radius: 14px;
  background: var(--bg);
  color: var(--text);
  font-family: "JetBrains Mono", monospace;
  font-size: 16px;
  box-shadow:
    inset 3px 3px 6px var(--shadow-dark),
    inset -3px -3px 6px var(--shadow-light);
  outline: none;
  transition: box-shadow 0.15s ease;
}

.calc-input:focus {
  box-shadow:
    inset 3px 3px 6px var(--shadow-dark),
    inset -3px -3px 6px var(--shadow-light),
    0 0 0 2px var(--accent);
}

.calc-input::placeholder {
  color: var(--text-soft);
  opacity: 0.5;
}

.calc-input-sm {
  padding: 10px 14px;
  font-size: 14px;
}

/* ---- Neumorphic Select ---- */

.calc-select {
  width: 100%;
  padding: 12px 36px 12px 16px;
  border: none;
  border-radius: 14px;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", sans-serif;
  font-size: 14px;
  box-shadow:
    inset 3px 3px 6px var(--shadow-dark),
    inset -3px -3px 6px var(--shadow-light);
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b939c' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 14px;
}

.calc-select:focus {
  box-shadow:
    inset 3px 3px 6px var(--shadow-dark),
    inset -3px -3px 6px var(--shadow-light),
    0 0 0 2px var(--accent);
}

.calc-select-sm {
  padding: 10px 32px 10px 14px;
  font-size: 13px;
}

/* ---- Radio Pill Group ---- */

.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.radio-pill input { display: none; }

.radio-pill span {
  display: inline-block;
  padding: 9px 16px;
  border-radius: 12px;
  background: var(--surface);
  color: var(--text-soft);
  font-family: "Inter", sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  box-shadow:
    -3px -3px 6px var(--shadow-light),
    3px 3px 8px var(--shadow-dark);
  transition: box-shadow 0.15s ease, color 0.15s ease;
  user-select: none;
}

.radio-pill span:hover { color: var(--accent-deep); }

.radio-pill input:checked + span {
  box-shadow:
    inset 3px 3px 6px var(--shadow-dark),
    inset -3px -3px 6px var(--shadow-light);
  color: var(--accent-deep);
  font-weight: 600;
}

/* ---- Neumorphic Checkbox ---- */

.calc-checkbox {
  position: relative;
  width: 40px;
  height: 22px;
  background: var(--bg);
  border-radius: 11px;
  cursor: pointer;
  display: inline-block;
  vertical-align: middle;
  box-shadow:
    inset 2px 2px 4px var(--shadow-dark),
    inset -2px -2px 4px var(--shadow-light);
  transition: background 0.2s;
}

.calc-checkbox::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 1px 1px 3px var(--shadow-dark);
  transition: left 0.2s;
}

.calc-checkbox.on { background: var(--accent); }
.calc-checkbox.on::after { left: 20px; }

/* ---- Buttons ---- */

.calc-btn {
  padding: 12px 28px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--accent), var(--accent-deep));
  color: #fff;
  font-family: "Inter", sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow:
    -4px -4px 8px var(--shadow-light),
    5px 5px 14px var(--shadow-dark),
    inset 1px 1px 2px rgba(255, 255, 255, 0.25);
  transition: box-shadow 0.12s ease, filter 0.12s ease;
}

.calc-btn:hover { filter: brightness(1.04); }

.calc-btn:active {
  box-shadow:
    inset 3px 3px 7px rgba(0, 0, 0, 0.25),
    inset -2px -2px 5px rgba(255, 255, 255, 0.18);
}

.calc-btn-secondary {
  padding: 10px 22px;
  border: none;
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  font-family: "Inter", sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  box-shadow:
    -3px -3px 6px var(--shadow-light),
    3px 3px 8px var(--shadow-dark);
  transition: box-shadow 0.12s ease, color 0.15s ease;
}

.calc-btn-secondary:hover { color: var(--accent-deep); }

.calc-btn-secondary:active {
  box-shadow:
    inset 2px 2px 5px var(--shadow-dark),
    inset -2px -2px 5px var(--shadow-light);
}

.btn-row {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}

/* ---- Results Table ---- */

.results-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--bg);
  border-radius: 14px;
  box-shadow:
    inset 3px 3px 6px var(--shadow-dark),
    inset -3px -3px 6px var(--shadow-light);
  overflow: hidden;
  margin: 16px 0;
}

.results-table th,
.results-table td {
  padding: 12px 16px;
  text-align: left;
  font-size: 14px;
}

.results-table th {
  font-family: "Inter", sans-serif;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-soft);
  font-weight: 600;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

body.dark .results-table th {
  border-bottom-color: rgba(255, 255, 255, 0.06);
}

.results-table td {
  font-family: "JetBrains Mono", monospace;
  color: var(--accent-deep);
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

body.dark .results-table td {
  border-bottom-color: rgba(255, 255, 255, 0.04);
}

.results-table td.label-cell {
  font-family: "Inter", sans-serif;
  color: var(--text);
  font-weight: 500;
}

.results-table tr:last-child td { border-bottom: none; }

/* ---- Result Highlight ---- */

.result-box {
  background: var(--bg);
  border-radius: 14px;
  padding: 20px 24px;
  box-shadow:
    inset 3px 3px 6px var(--shadow-dark),
    inset -3px -3px 6px var(--shadow-light);
  text-align: center;
  margin: 16px 0;
}

.result-box .result-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-soft);
  font-weight: 600;
  margin-bottom: 8px;
}

.result-box .result-value {
  font-family: "JetBrains Mono", monospace;
  font-size: 28px;
  font-weight: 600;
  color: var(--accent-deep);
}

.result-box .result-detail {
  font-size: 13px;
  color: var(--text-soft);
  margin-top: 8px;
}

/* ---- Tabs ---- */

.calc-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.calc-tab {
  padding: 10px 20px;
  border: none;
  border-radius: 14px;
  background: var(--surface);
  color: var(--text-soft);
  font-family: "Inter", sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow:
    -3px -3px 6px var(--shadow-light),
    3px 3px 8px var(--shadow-dark);
  transition: box-shadow 0.15s ease, color 0.15s ease;
}

.calc-tab:hover { color: var(--accent-deep); }

.calc-tab.active {
  box-shadow:
    inset 3px 3px 6px var(--shadow-dark),
    inset -3px -3px 6px var(--shadow-light);
  color: var(--accent-deep);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---- Dynamic Rows (GPA / Grade) ---- */

.dynamic-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.dynamic-row .calc-input,
.dynamic-row .calc-select {
  flex: 1;
  min-width: 0;
}

.dynamic-row .calc-input.name-col { flex: 2; }
.dynamic-row .calc-input.num-col { flex: 0.8; }

.row-remove {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
  font-size: 16px;
  display: grid;
  place-items: center;
  box-shadow:
    -2px -2px 4px var(--shadow-light),
    2px 2px 6px var(--shadow-dark);
  flex-shrink: 0;
  transition: color 0.15s ease;
}

.row-remove:hover { color: var(--error); }

.add-row-btn {
  width: 100%;
  padding: 10px;
  border: 2px dashed var(--text-soft);
  border-radius: 14px;
  background: transparent;
  color: var(--text-soft);
  font-family: "Inter", sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  opacity: 0.4;
  transition: opacity 0.15s ease;
  margin-top: 8px;
}

.add-row-btn:hover { opacity: 1; }

.row-headers {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
  padding-right: 40px;
}

.row-headers span {
  flex: 1;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-soft);
  font-weight: 600;
}

.row-headers span.name-col { flex: 2; }
.row-headers span.num-col { flex: 0.8; }

/* ---- Conversion Layout ---- */

.conversion-layout {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: start;
}

.conversion-col { display: flex; flex-direction: column; gap: 12px; }

.conversion-arrow {
  align-self: center;
  color: var(--accent);
  font-size: 24px;
  margin-top: 44px;
}

.unit-list {
  max-height: 300px;
  overflow-y: auto;
  background: var(--bg);
  border-radius: 14px;
  box-shadow:
    inset 3px 3px 6px var(--shadow-dark),
    inset -3px -3px 6px var(--shadow-light);
  padding: 6px;
}

.unit-item {
  padding: 8px 12px;
  border-radius: 10px;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-family: "Inter", sans-serif;
  font-size: 13px;
  color: var(--text-soft);
  transition: background 0.1s ease, color 0.1s ease;
}

.unit-item:hover { background: var(--surface); color: var(--text); }

.unit-item.selected {
  background: var(--surface);
  color: var(--accent-deep);
  font-weight: 600;
  box-shadow:
    -2px -2px 4px var(--shadow-light),
    2px 2px 6px var(--shadow-dark);
}

/* ---- Calc Nav (above footer) ---- */

.calc-nav {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding: 32px 24px 0;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

body.dark .calc-nav {
  border-top-color: rgba(255, 255, 255, 0.06);
}

.calc-nav-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-deep);
  font-weight: 600;
  margin-bottom: 12px;
}

.calc-nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
}

.calc-nav-links a {
  font-size: 13px;
  color: var(--accent-deep);
  text-decoration: none;
  transition: color 0.15s ease;
}

.calc-nav-links a:hover { color: var(--accent-deep); }

/* ---- Info Table (content sections) ---- */

.info-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 16px 0;
  font-size: 13px;
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface);
  box-shadow:
    -3px -3px 6px var(--shadow-light),
    3px 3px 8px var(--shadow-dark);
}

.info-table th,
.info-table td {
  padding: 10px 16px;
  text-align: left;
}

.info-table th {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-soft);
  font-weight: 600;
  background: var(--bg);
}

.info-table td {
  color: var(--text);
  border-top: 1px solid rgba(0, 0, 0, 0.04);
}

body.dark .info-table td {
  border-top-color: rgba(255, 255, 255, 0.04);
}

/* ---- Responsive ---- */

@media (max-width: 768px) {
  .page-header { padding: 36px 24px; }
  .calc-card { padding: 24px 20px; }
  .blurb { padding: 48px 20px 40px; }
  .calc-hero-cat { width: 140%; }
}

@media (max-width: 600px) {
  :root { --display-font-size: 38px; }

  .page-header { padding: 28px 16px; }
  .page-header h1 { font-size: 22px; }
  .theme-toggle { right: 16px; width: 40px; height: 40px; }

  .stage { padding-top: 120px; }
  .cat-frame { width: 160%; }

  .key { height: 44px; font-size: 16px; }
  .pad { gap: 6px; }

  .calc-hero { padding-top: 140px; }
  .calc-hero-cat { width: 120%; }
  .calc-card { padding: 20px 16px; }
  .calc-page h2 { font-size: 18px; }
  .dynamic-row { flex-wrap: wrap; }
  .calc-tabs { gap: 6px; }
  .calc-tab { padding: 8px 14px; font-size: 12px; }
  .conversion-layout { grid-template-columns: 1fr; }
  .conversion-arrow { transform: rotate(90deg); justify-self: center; margin-top: 0; }
  .results-table th,
  .results-table td { padding: 10px 12px; font-size: 13px; }
  .row-headers { padding-right: 0; }
  .form-row { grid-template-columns: 1fr; }

  .footer { display: none; }

  .tweaks-panel {
    right: 8px;
    left: 8px;
    width: auto;
    top: 16px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
  }

  .calc-nav-links { gap: 12px 20px; }
  .calc-nav-links a { font-size: 14px; padding: 6px 0; }
  .page-footer { flex-wrap: wrap; gap: 16px; padding: 24px 16px; }
}

@media (max-width: 420px) {
  :root { --display-font-size: 32px; }
  .page-header { padding: 20px 12px; }
  .page-header h1 { font-size: 20px; }
  .stage { padding-top: 90px; }
  .cat-frame { width: 140%; }
  .calc-card { padding: 16px 12px; }
  .results-table th,
  .results-table td { padding: 8px 10px; font-size: 12px; }
  .calc-tab { padding: 8px 12px; font-size: 11px; }
  .calc-nav-links a { font-size: 14px; padding: 4px 0; }
  .form-row { gap: 10px; }
  .calc-hero { padding-top: 90px; }
  .calc-hero-cat { width: 110%; }
}
