/* Mobile-first flashcard styles */
:root {
  --bg: #0d1220;
  --card: #17203a;
  --card-edge: #26335c;
  --text: #eef2ff;
  --muted: #96a1c0;
  --accent: #6c8cff;
  --accent-deep: #4a63d8;
  --easy: #34d399;
  --medium: #fbbf24;
  --hard: #f87171;
  --radius: 20px;
  --code-bg: #0a0f1e;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(1100px 520px at 50% -8%, #1c2650 0%, rgba(28, 38, 80, 0) 70%) fixed,
    var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  overscroll-behavior-y: none;
  animation: pageIn .3s ease;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 10px;
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  display: grid; place-items: center;
  width: 42px; height: 42px; border-radius: 13px;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  font-weight: 800; font-size: 17px; color: #fff;
  box-shadow: 0 6px 18px rgba(108, 140, 255, .35);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.brand h1 { margin: 0; font-size: 19px; letter-spacing: .2px; }
.subtitle { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.icon-btn {
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--card-edge);
  background: rgba(255, 255, 255, .04);
  color: var(--text); font-size: 20px; cursor: pointer;
  transition: transform .25s ease, background .2s;
}
.icon-btn:active { transform: scale(.94); }
#shuffleBtn:active { transform: rotate(120deg) scale(.94); }

/* Stage */
.stage {
  flex: 1;
  display: flex; flex-direction: column; align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 6px 16px;
  width: 100%; max-width: 560px; margin: 0 auto;
}
.counter { font-size: 13px; color: var(--muted); letter-spacing: 1.5px; font-variant-numeric: tabular-nums; }

/* Card + 3D flip */
.card {
  width: min(94vw, 480px);
  height: min(62vh, 560px);
  height: min(62dvh, 560px);
  min-height: 400px;
  perspective: 1400px;
  cursor: pointer;
  outline: none;
  touch-action: pan-y;
}
.card:focus-visible .card-inner { box-shadow: 0 0 0 3px var(--accent); border-radius: var(--radius); }
.card-inner {
  position: relative; width: 100%; height: 100%;
  transform-style: preserve-3d;
  transition: transform .55s cubic-bezier(.25, .8, .3, 1.15);
}
.card.flipped .card-inner { transform: rotateY(180deg); }
.face {
  position: absolute; inset: 0;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border-radius: var(--radius);
  background: linear-gradient(160deg, #1d2745 0%, var(--card) 55%, #141c33 100%);
  border: 1px solid var(--card-edge);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .06);
  overflow: hidden;
}
.face-back { transform: rotateY(180deg); overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* Front face */
.face-front {
  display: flex; flex-direction: column; align-items: stretch;
  text-align: left; padding: 24px 22px; gap: 10px;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.face-front > * { position: relative; }
.face-front::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(420px 220px at 50% 0%, rgba(108, 140, 255, .16), transparent 70%);
  pointer-events: none;
}
.p-num {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px; color: var(--muted); letter-spacing: 2px;
}
.p-diff {
  font-size: 12px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase;
  padding: 6px 14px; border-radius: 999px;
  border: 1px solid currentColor;
}
.diff-easy { color: var(--easy); background: rgba(52, 211, 153, .1); }
.diff-medium { color: var(--medium); background: rgba(251, 191, 36, .1); }
.diff-hard { color: var(--hard); background: rgba(248, 113, 113, .1); }
.p-top { display: flex; align-items: center; justify-content: space-between; }
.p-title { margin: 2px 0; font-size: clamp(21px, 5.6vw, 27px); line-height: 1.2; letter-spacing: -.3px; }
.p-desc { margin: 4px 0 2px; font-size: 14.5px; line-height: 1.62; color: #cdd6ef; }
.p-example {
  background: var(--code-bg);
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 12px; padding: 12px 14px;
}
.ex-label {
  display: block; font-size: 10.5px; font-weight: 700;
  letter-spacing: 1.6px; text-transform: uppercase;
  color: var(--muted); margin-bottom: 6px;
}
.p-example pre {
  margin: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px; line-height: 1.6; color: #dbe2f7; white-space: pre-wrap;
}
.tags { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.tag {
  font-size: 12px; color: var(--muted);
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .08);
  padding: 5px 11px; border-radius: 999px;
}
.flip-hint {
  margin-top: auto; padding-top: 12px;
  font-size: 12.5px; color: var(--muted);
  display: flex; align-items: center; justify-content: center; gap: 7px;
  animation: hint-pulse 2.4s ease-in-out infinite;
}
@keyframes hint-pulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }

/* Back face */
.face-back { padding: 24px 22px 28px; text-align: left; }
.b-label {
  font-size: 11px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase;
  color: var(--accent); margin-bottom: 6px;
}
.b-approach { margin: 0 0 10px; font-size: 21px; letter-spacing: -.2px; }
.b-intuition { margin: 0 0 16px; font-size: 14.5px; line-height: 1.6; color: #cdd6ef; }
.b-sec {
  font-size: 11.5px; font-weight: 700; letter-spacing: 1.6px; text-transform: uppercase;
  color: var(--muted); margin: 16px 0 8px;
  padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .08);
}
.b-steps { margin: 0; padding-left: 20px; font-size: 14px; line-height: 1.55; color: #dbe2f7; }
.b-steps li { margin-bottom: 7px; }
.b-steps li::marker { color: var(--accent); font-weight: 700; }
.complexity { display: flex; gap: 10px; margin-top: 4px; }
.cx {
  flex: 1; background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 12px; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 2px;
}
.cx span { font-size: 11px; color: var(--muted); letter-spacing: 1px; text-transform: uppercase; }
.cx strong { font-size: 16px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.code {
  margin: 0; background: var(--code-bg);
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 12px; padding: 42px 14px 14px; /* top clears the overlaid copy button */
  overflow-x: auto; overflow-y: hidden; /* never show vertical scrollbars: the block grows with content */
  -webkit-overflow-scrolling: touch;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px; line-height: 1.65; color: #dbe2f7;
}
.tok-k { color: #8fa6ff; }   /* keyword */
.tok-s { color: #7ee2a8; }   /* string */
.tok-n { color: #f5b96b; }   /* number */
.tok-c { color: #5f6b8a; font-style: italic; } /* comment */
.code-wrap { position: relative; }
.copy-btn-overlay {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  font-size: 11.5px;
  padding: 6px 12px;
  background: rgba(23, 32, 58, .92);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.copy-btn {
  border: 1px solid var(--card-edge);
  background: rgba(255, 255, 255, .05);
  color: var(--text);
  font-size: 12px; font-weight: 700; letter-spacing: .4px;
  padding: 7px 14px; border-radius: 999px;
  cursor: pointer;
  transition: background .2s, transform .12s;
  touch-action: manipulation;
}
.copy-btn:active { transform: scale(.95); }
.copy-btn.ok {
  background: rgba(52, 211, 153, .18);
  border-color: rgba(52, 211, 153, .5);
  color: var(--easy);
}
.b-note {
  margin-top: 14px; font-size: 12.5px; line-height: 1.55; color: var(--muted);
  border-left: 3px solid var(--accent); padding-left: 10px;
}

/* Dots */
.dots { display: flex; gap: 9px; }
.dot {
  width: 9px; height: 9px; border-radius: 50%;
  border: none; background: rgba(255, 255, 255, .18);
  cursor: pointer; padding: 0; transition: all .25s;
}
.dot.active { background: var(--accent); transform: scale(1.35); box-shadow: 0 0 10px rgba(108, 140, 255, .7); }

/* Controls */
.controls {
  display: flex; gap: 12px; justify-content: center;
  padding: 12px 18px calc(16px + env(safe-area-inset-bottom));
  width: 100%; max-width: 560px; margin: 0 auto;
}
.btn {
  flex: 1; padding: 15px 0; border-radius: 16px;
  border: 1px solid var(--card-edge);
  background: rgba(255, 255, 255, .05);
  color: var(--text); font-size: 16px; font-weight: 600;
  cursor: pointer; transition: transform .12s, background .2s;
  touch-action: manipulation;
}
.btn:active { transform: scale(.96); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  border: none; color: #fff; flex: 1.25;
  box-shadow: 0 8px 22px rgba(108, 140, 255, .35);
}

.kbd-hint { display: none; text-align: center; color: var(--muted); font-size: 12.5px; margin: 0 0 14px; }
@media (hover: hover) and (pointer: fine) {
  .kbd-hint { display: block; }
  .card { height: 540px; }
}

/* Question picker bottom sheet */
.header-actions { display: flex; gap: 10px; }
.icon-btn-sm { width: 36px; height: 36px; font-size: 22px; line-height: 1; }

.sheet-overlay {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(4, 7, 16, .62);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .25s ease, visibility .25s ease;
}
.sheet-overlay.show { opacity: 1; visibility: visible; pointer-events: auto; }

.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  max-width: 560px; margin: 0 auto;
  max-height: 78vh; max-height: 78dvh;
  background: #141b31;
  border: 1px solid var(--card-edge); border-bottom: none;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -18px 50px rgba(0, 0, 0, .5);
  padding-bottom: env(safe-area-inset-bottom);
  display: flex; flex-direction: column;
  transform: translateY(105%); visibility: hidden;
  transition: transform .32s cubic-bezier(.2, .8, .3, 1), visibility .32s;
}
.sheet.open { transform: translateY(0); visibility: visible; }

.sheet-handle {
  width: 44px; height: 5px; border-radius: 999px;
  background: rgba(255, 255, 255, .18);
  margin: 10px auto 2px; flex: none;
}
.sheet-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 18px 10px; flex: none;
}
.sheet-header h2 { margin: 0; font-size: 18px; letter-spacing: -.2px; }
.sheet-list {
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 2px 12px 16px;
}

.q-row {
  display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: left;
  background: rgba(255, 255, 255, .03);
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 14px; padding: 13px 14px; margin-bottom: 8px;
  color: var(--text); cursor: pointer; font-size: 15px;
  transition: background .15s, border-color .15s, transform .1s;
  touch-action: manipulation;
}
.q-row:active { transform: scale(.98); }
.q-row.current { border-color: var(--accent); background: rgba(108, 140, 255, .12); }
.q-num {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px; color: var(--muted); min-width: 30px;
}
.q-title { flex: 1; font-weight: 600; }
.q-diff {
  font-size: 10.5px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase;
  padding: 4px 10px; border-radius: 999px; border: 1px solid currentColor; flex: none;
}
.q-chev { color: var(--muted); font-size: 18px; flex: none; }

/* Page-load + entrance motion */
@keyframes pageIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes riseIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

/* ---------- Desktop: persistent sidebar layout ---------- */
@media (min-width: 1024px) {
  body { padding-left: 340px; }

  /* Question list becomes a fixed sidebar instead of a bottom sheet */
  #listBtn { display: none; }
  .sheet {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: 340px; max-width: 340px;
    margin: 0;
    transform: none;
    visibility: visible;
    max-height: none;
    border-radius: 0;
    border: none;
    border-right: 1px solid rgba(255, 255, 255, .08);
    background: #10162b;
    box-shadow: none;
    z-index: 60;
  }
  .sheet-overlay { display: none; }
  .sheet-handle { display: none; }
  #sheetClose { display: none; }
  .sheet-header { padding: 20px 18px 12px; }
  .sheet-list { padding: 2px 14px 24px; }

  /* Roomier content column */
  .app-header { max-width: 880px; padding: 22px 30px 12px; }
  .stage { max-width: 880px; padding: 10px 30px; }
  .controls { max-width: 880px; padding: 14px 30px calc(18px + env(safe-area-inset-bottom)); }

  /* Bigger card */
  .card { width: min(100%, 700px); height: min(70vh, 640px); min-height: 440px; }
  .face-front { padding: 34px 36px; }
  .face-back { padding: 34px 36px 40px; }
  .p-title { font-size: 28px; }
  .p-desc { font-size: 15.5px; }
  .b-intuition { font-size: 15px; }
  .code { font-size: 13.5px; }
}

/* ---------- Section tab bar ---------- */
[hidden] { display: none !important; }

body {
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
}

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 100;
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: rgba(13, 18, 34, .97);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-top: 1px solid rgba(255, 255, 255, .14);
  box-shadow: 0 -8px 28px rgba(0, 0, 0, .45);
}
.tab {
  flex: 1;
  max-width: 200px;
  min-height: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 0 7px;
  background: none;
  border: none;
  color: #c2cde9;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .4px;
  cursor: pointer;
  border-radius: 14px;
  transition: color .2s, background .2s;
  touch-action: manipulation;
}
.tab:active { transform: scale(.96); }
.tab svg { width: 24px; height: 24px; display: block; }
.tab.active {
  color: #fff;
  background: rgba(108, 140, 255, .22);
  box-shadow: inset 0 0 0 1px rgba(108, 140, 255, .45);
}
.tab.active svg { color: #a9bcff; }

/* ---------- Card status + mark buttons ---------- */
.p-status {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .8px;
  text-transform: uppercase;
  padding: 4px 11px;
  border-radius: 999px;
  margin: 2px 0;
  align-self: flex-start;
}
.st-known { color: var(--easy); background: rgba(52, 211, 153, .12); border: 1px solid rgba(52, 211, 153, .4); }
.st-review { color: var(--medium); background: rgba(251, 191, 36, .12); border: 1px solid rgba(251, 191, 36, .4); }

.mark-row {
  display: flex;
  gap: 10px;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, .08);
}
.mark-btn {
  flex: 1;
  padding: 13px 0;
  border-radius: 14px;
  border: 1px solid var(--card-edge);
  background: rgba(255, 255, 255, .04);
  color: var(--text);
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .12s, background .2s, border-color .2s;
  touch-action: manipulation;
}
.mark-btn:active { transform: scale(.96); }
.mark-btn.on-known {
  background: rgba(52, 211, 153, .16);
  border-color: rgba(52, 211, 153, .55);
  color: var(--easy);
}
.mark-btn.on-review {
  background: rgba(251, 191, 36, .14);
  border-color: rgba(251, 191, 36, .55);
  color: var(--medium);
}

/* ---------- Progress view ---------- */
.progress-view {
  flex: 1;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 6px 16px 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.prog-head h2 { margin: 14px 0 4px; font-size: 24px; letter-spacing: -.3px; }
.prog-sub { margin: 0 0 6px; font-size: 13.5px; color: var(--muted); line-height: 1.5; }
.prog-sub strong { color: var(--text); }

.prog-card {
  background: linear-gradient(160deg, #1d2745 0%, var(--card) 55%, #141c33 100%);
  border: 1px solid var(--card-edge);
  border-radius: var(--radius);
  padding: 20px 18px;
  margin: 14px 0;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .35);
}
.prog-top { display: flex; align-items: center; gap: 18px; }
.prog-ring-wrap { position: relative; width: 104px; height: 104px; flex: none; }
.ring { width: 104px; height: 104px; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: rgba(255, 255, 255, .08); stroke-width: 11; }
.ring-fg {
  fill: none; stroke: var(--accent); stroke-width: 11; stroke-linecap: round;
  transition: stroke-dashoffset .6s ease;
  filter: drop-shadow(0 0 6px rgba(108, 140, 255, .6));
}
.prog-pct {
  position: absolute; inset: 0;
  display: flex; align-items: baseline; justify-content: center;
  padding-top: 36px;
  font-size: 24px; font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.prog-pct span { font-size: 13px; color: var(--muted); margin-left: 2px; }
.prog-meta h3 { margin: 0 0 6px; font-size: 18px; }
.prog-meta p { margin: 0 0 12px; font-size: 14px; color: var(--muted); }
.prog-meta p strong { color: var(--text); }
.weak-btn {
  border: 1px solid var(--accent);
  background: rgba(108, 140, 255, .14);
  color: #fff;
  font-size: 13.5px; font-weight: 700;
  padding: 10px 16px; border-radius: 999px;
  cursor: pointer; transition: transform .12s, opacity .2s;
  touch-action: manipulation;
}
.weak-btn:active { transform: scale(.95); }
.weak-btn:disabled { opacity: .35; cursor: default; }

.diff-rows { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.diff-row { display: flex; align-items: center; gap: 12px; }
.diff-name { min-width: 62px; font-size: 12px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; }
.bar { flex: 1; height: 8px; border-radius: 999px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; transition: width .5s ease; }
.bar-fill.diff-easy { background: var(--easy); }
.bar-fill.diff-medium { background: var(--medium); }
.bar-fill.diff-hard { background: var(--hard); }
.diff-count { font-size: 12.5px; color: var(--muted); min-width: 44px; text-align: right; font-variant-numeric: tabular-nums; }

.queue-list { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.queue-row .q-title { font-size: 14.5px; }
.q-chip {
  font-size: 10.5px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase;
  padding: 4px 10px; border-radius: 999px; flex: none;
}
.chip-review { color: var(--medium); background: rgba(251, 191, 36, .12); border: 1px solid rgba(251, 191, 36, .4); }
.chip-new { color: var(--muted); background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .12); }
.queue-more { font-size: 12.5px; color: var(--muted); margin: 8px 2px 0; }
.queue-done { font-size: 14px; color: var(--easy); margin: 10px 2px 0; }

.reset-btn {
  width: 100%;
  margin: 6px 0 10px;
  border-color: rgba(248, 113, 113, .4);
  color: var(--hard);
  font-size: 14px;
}

/* ---------- System design card extras ---------- */
.req-list { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.6; color: #dbe2f7; }
.req-list li { margin-bottom: 5px; }
.req-list li::marker { color: var(--accent); }
.comp-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.comp-list li {
  background: rgba(255, 255, 255, .03);
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 12px;
  padding: 11px 13px;
  font-size: 13.5px; line-height: 1.55; color: #cdd6ef;
}
.comp-list li strong { display: block; color: var(--text); font-size: 14px; margin-bottom: 3px; }
.comp-list li span { display: block; }

/* ---------- Sheet status dots ---------- */
.q-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.dot-known { background: var(--easy); box-shadow: 0 0 6px rgba(52, 211, 153, .7); }
.dot-review { background: var(--medium); box-shadow: 0 0 6px rgba(251, 191, 36, .7); }

/* ---------- Desktop: tab bar + progress ---------- */
@media (min-width: 1024px) {
  .tabbar { justify-content: center; }
  .progress-view { max-width: 880px; padding: 10px 30px 30px; }
  .prog-head h2 { font-size: 28px; }
}

/* ---------- Deck sub-tabs (segmented control) ---------- */
.deck-switch {
  display: flex;
  width: 100%;
  max-width: 420px;
  margin: 2px auto 12px;
  padding: 4px;
  gap: 4px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 999px;
}
.deck-tab {
  flex: 1;
  border: none;
  background: none;
  color: #c2cde9;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: .3px;
  padding: 10px 0;
  border-radius: 999px;
  cursor: pointer;
  transition: background .2s, color .2s, box-shadow .2s;
  touch-action: manipulation;
}
.deck-tab:active { transform: scale(.97); }
.deck-tab.active {
  background: rgba(108, 140, 255, .28);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(108, 140, 255, .55);
}

/* ---------- Jobs section (merged from jobs site) ---------- */
.icon-link { display: grid; place-items: center; text-decoration: none; }
.jobs-view { width: 100%; }

.hero {
  max-width: 640px; margin: 0 auto;
  padding: 26px 22px 8px;
}
.hero > * { animation: riseIn .5s ease both; }
.hero > *:nth-child(2) { animation-delay: .07s; }
.hero > *:nth-child(3) { animation-delay: .14s; }
.hero-badge {
  display: inline-block;
  font-size: 11.5px; font-weight: 700; letter-spacing: 1.6px; text-transform: uppercase;
  color: var(--accent);
  border: 1px solid rgba(108, 140, 255, .4);
  background: rgba(108, 140, 255, .08);
  padding: 7px 13px; border-radius: 999px; margin-bottom: 16px;
}
.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(38px, 10vw, 56px);
  line-height: 1.02; letter-spacing: -1.2px;
}
.lede { margin: 0; font-size: 16px; line-height: 1.6; color: var(--muted); max-width: 46ch; }

.jobs {
  max-width: 640px; margin: 0 auto;
  padding: 22px 16px 8px;
  display: flex; flex-direction: column; gap: 18px;
}
.job {
  background: linear-gradient(160deg, #1d2745 0%, var(--card) 55%, #141c33 100%);
  border: 1px solid var(--card-edge);
  border-radius: var(--radius);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .06);
  padding: 24px 22px;
  animation: riseIn .55s ease both;
}
.jobs .job:nth-child(2) { animation-delay: .1s; }
.jobs .job:nth-child(3) { animation-delay: .2s; }
.job-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.pick {
  font-size: 11.5px; font-weight: 800; letter-spacing: 1.8px; text-transform: uppercase;
  color: #0d1220; background: linear-gradient(135deg, #8fa6ff, var(--accent));
  padding: 6px 12px; border-radius: 999px;
}
.mark {
  display: grid; place-items: center;
  width: 46px; height: 46px; border-radius: 14px;
  font-weight: 800; font-size: 13px; color: #fff; letter-spacing: .5px;
}
.mark--snow { background: linear-gradient(135deg, #62a9ff, #1f6feb); }
.mark--viasat { background: linear-gradient(135deg, #f59e0b, #b45309); }
.mark--shield { background: linear-gradient(135deg, #8b5cf6, #4c1d95); }

.company { font-size: 13px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.job h2 { margin: 0 0 8px; font-size: clamp(22px, 6vw, 28px); letter-spacing: -.4px; line-height: 1.2; }
.meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 13.5px; color: var(--muted); margin-bottom: 14px; }
.dot-sep { opacity: .5; }

.pay {
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 17px; font-weight: 700; color: var(--easy);
  background: rgba(52, 211, 153, .1);
  border: 1px solid rgba(52, 211, 153, .35);
  padding: 9px 15px; border-radius: 12px; margin-bottom: 18px;
}
.pay span { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; font-size: 12.5px; font-weight: 500; color: var(--muted); margin-left: 6px; }
.pay--na { color: var(--muted); background: rgba(255,255,255,.04); border-color: rgba(255,255,255,.12); }

.job h3 {
  font-size: 12px; font-weight: 800; letter-spacing: 1.6px; text-transform: uppercase;
  color: var(--accent); margin: 18px 0 10px;
}
.fit { margin: 0; padding-left: 20px; font-size: 14.5px; line-height: 1.62; color: #dbe2f7; }
.fit li { margin-bottom: 9px; }
.fit li::marker { color: var(--accent); font-weight: 700; }
.fit strong { color: #fff; }

.caveat {
  margin-top: 14px; font-size: 13px; line-height: 1.55; color: #f5c66b;
  background: rgba(251, 191, 36, .07);
  border: 1px solid rgba(251, 191, 36, .3);
  border-radius: 12px; padding: 11px 14px;
}

.reqs { display: flex; flex-wrap: wrap; gap: 8px; }
.reqs span {
  font-size: 12.5px; color: #cdd6ef;
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .1);
  padding: 6px 12px; border-radius: 999px;
}

.apply {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 20px; padding: 15px;
  border-radius: 16px; text-decoration: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fff; font-size: 16px; font-weight: 700;
  box-shadow: 0 8px 22px rgba(108, 140, 255, .35);
  transition: transform .12s;
  touch-action: manipulation;
}
.apply:active { transform: scale(.97); }
.apply span { font-size: 18px; }

/* Job search letters */
.letters { max-width: 640px; margin: 0 auto; padding: 26px 16px 8px; }
.letters h2 {
  margin: 0 0 14px 6px;
  font-size: 12px; font-weight: 800; letter-spacing: 1.6px; text-transform: uppercase;
  color: var(--accent);
}
.letter-card {
  display: flex; align-items: center; gap: 16px;
  background: linear-gradient(160deg, #1d2745 0%, var(--card) 60%, #141c33 100%);
  border: 1px solid var(--card-edge);
  border-radius: var(--radius);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .06);
  padding: 16px;
  text-decoration: none; color: inherit;
  animation: riseIn .55s ease both;
  touch-action: manipulation;
}
.letter-card:active { transform: scale(.98); }
.letter-card img {
  width: 84px; height: 84px; flex: none;
  border-radius: 14px; object-fit: cover;
  border: 1px solid rgba(255, 255, 255, .12);
}
.letter-body { flex: 1; min-width: 0; }
.letter-body h3 { margin: 0 0 6px; font-size: 17px; letter-spacing: -.2px; color: var(--text); }
.letter-body p { margin: 0 0 8px; font-size: 13.5px; line-height: 1.55; color: var(--muted); }
.letter-date { font-size: 12px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--accent); }
.letter-chev { font-size: 26px; color: var(--muted); flex: none; }

.jobs-footer {
  max-width: 640px; margin: 0 auto;
  padding: 22px 22px calc(28px + env(safe-area-inset-bottom));
  font-size: 12.5px; line-height: 1.6; color: var(--muted);
}
.jobs-footer p { margin: 0 0 8px; }
.sig { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 1px; }

/* Back-to-top */
.to-top {
  position: fixed;
  right: 16px;
  bottom: calc(96px + env(safe-area-inset-bottom));
  width: 48px; height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(108, 140, 255, .5);
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fff; font-size: 20px; font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(74, 99, 216, .5);
  opacity: 0; transform: translateY(8px); pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 30;
  touch-action: manipulation;
}
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }
.to-top:active { transform: scale(.93); }
