@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,600;9..144,700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;600;700&display=swap');
@font-face {
  font-family: 'SGA';
  src: url('https://cdn.jsdelivr.net/gh/standardgalactic/alphabet@core/Sga-Regular.ttf') format('truetype');
  font-display: swap;
}

:root {
  --bg: #14171c;
  --bg-panel: #1c2029;
  --bg-panel-hover: #232836;
  --ink: #f1ede4;
  --ink-dim: #a8aab0;
  --accent: #e8a33d;
  --accent-2: #5fa8a0;    
  --line: #333844;
  --danger: #c96a4f;
  --correct: #5fb87a;
  --present: #e3c04c;

  --font-display: 'Fraunces', Georgia, serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
  --font-body: 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-font-smoothing: antialiased; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.5;
}

a { color: inherit; }

a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

.wrap {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 24px;
}

.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 64px;
  padding: 28px 0 48px;
  color: var(--ink-dim);
  font-size: 14px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.02em;
  color: var(--ink-dim);
  text-decoration: none;
  padding: 20px 0 0;
}
.back-link:hover { color: var(--accent); }

.hero {
  padding: 72px 0 40px;
}
.back-link + .hero {
  padding-top: 24px;
}

.tile-title {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 18px;
}

.tile {
  --delay: 0s;
  width: 54px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 26px;
  border: 2px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
  background: var(--bg-panel);
  animation: flip 0.5s ease-in var(--delay) both;
}
.tile.gray  { --tile-color: #3a3f4a; }
.tile.teal  { --tile-color: var(--accent-2); }
.tile.gold  { --tile-color: var(--accent); }

@keyframes flip {
  0%   { transform: rotateX(0deg); background: var(--bg-panel); border-color: var(--line); }
  49%  { transform: rotateX(90deg); }
  50%  { transform: rotateX(90deg); background: var(--tile-color); border-color: var(--tile-color); color: #14171c; }
  100% { transform: rotateX(0deg); background: var(--tile-color); border-color: var(--tile-color); color: #14171c; }
}

@media (prefers-reduced-motion: reduce) {
  .tile { animation: none; background: var(--tile-color); border-color: var(--tile-color); color: #14171c; }
}

.tagline {
  font-family: var(--font-body);
  color: var(--ink-dim);
  font-size: 17px;
  max-width: 46ch;
  margin: 0;
}

.site-name {
  font-family: var(--font-display);
  font-size: 44px;
  font-weight: 600;
  margin: 0 0 14px;
}

/* ---------- game Library ---------- */

.shelf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
  margin: 36px 0;
}

.ticket {
  position: relative;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px 20px 18px;
  text-decoration: none;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.ticket.live:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  background: var(--bg-panel-hover);
}

.ticket.soon {
  opacity: 0.5;
  cursor: default;
}

.ticket-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-2);
}
.ticket.soon .ticket-eyebrow { color: var(--ink-dim); }

.ticket-name {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  margin: 0;
}

.ticket-desc {
  font-size: 14px;
  color: var(--ink-dim);
  margin: 0;
  flex-grow: 1;
}

.mini-grid {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}
.mini-cell {
  width: 16px;
  height: 16px;
  border-radius: 2px;
  border: 1px solid var(--line);
}
.mini-cell.gold { background: var(--accent); border-color: var(--accent); }
.mini-cell.teal { background: var(--accent-2); border-color: var(--accent-2); }
.mini-cell.gray { background: #3a3f4a; }

/* ============================================================
   GAME SCREEN (wordle + future games share this)
   ============================================================ */

.game-shell {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 20px 60px;
  text-align: center;
}

.game-header h1 {
  font-family: var(--font-display);
  font-size: 32px;
  margin: 18px 0 4px;
}

.game-header p {
  color: var(--ink-dim);
  font-size: 14px;
  margin: 0 0 24px;
}

.game-header-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
}

.icon-btn {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink-dim);
  font-size: 16px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.icon-btn:hover { color: var(--ink); border-color: var(--accent); }

.grid {
  display: grid;
  grid-template-rows: repeat(6, 1fr);
  gap: 6px;
  margin: 0 auto 22px;
  width: min(320px, 90vw);
}

.grid-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.cell {
  aspect-ratio: 1;
  border: 2px solid var(--line);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 24px;
  background: var(--bg-panel);
  color: var(--ink);
  text-transform: uppercase;
  transition: transform 0.15s ease;
}

.cell.filled { border-color: #565c6b; }
.cell.pop { transform: scale(1.06); }

.cell.correct { background: var(--correct); border-color: var(--correct); color: #14171c; }
.cell.present { background: var(--present); border-color: var(--present); color: #14171c; }
.cell.absent  { background: #2a2e38; border-color: #2a2e38; color: var(--ink-dim); }

.cell.flip {
  animation: flip 0.45s ease-in both;
}

.nerdle-grid {
  width: min(400px, 94vw);
}
.nerdle-grid .grid-row {
  grid-template-columns: repeat(8, 1fr);
}
.nerdle-grid .cell {
  font-size: 18px;
}

.letterle-grid {
  width: 62px;
  grid-template-rows: none;
  grid-auto-rows: min-content;
}
.letterle-grid .grid-row {
  grid-template-columns: 1fr;
}

.keyboard {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.key-row {
  display: flex;
  gap: 6px;
}

.key {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 13px;
  border: none;
  border-radius: 4px;
  background: var(--bg-panel-hover);
  color: var(--ink);
  padding: 14px 10px;
  min-width: 34px;
  cursor: pointer;
  transition: background 0.15s ease;
  text-transform: uppercase;
}
.key:hover { background: #2c3140; }
.key.wide { min-width: 54px; font-size: 11px; }

.key.correct { background: var(--correct); color: #14171c; }
.key.present { background: var(--present); color: #14171c; }
.key.absent  { background: #22252d; color: var(--ink-dim); }

.status-msg {
  min-height: 26px;
  font-family: var(--font-mono);
  font-size: 14px;
  margin-bottom: 14px;
  color: var(--accent);
}

.status-msg.error { color: var(--danger); }

.play-again {
  display: none;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--accent);
  color: #14171c;
  border: none;
  border-radius: 4px;
  padding: 10px 18px;
  cursor: pointer;
  font-weight: 700;
}
.play-again.show { display: inline-block; }

/* ============================================================
   FLAGLE
   ============================================================ */

.flag-viewport {
  width: 280px;
  height: 187px;
  margin: 0 auto 10px;
  overflow: hidden;
  position: relative;
  border: 2px solid var(--line);
  border-radius: 6px;
  background: var(--bg-panel);
}

.mode-select {
  display: inline-flex;
  gap: 4px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
  margin-bottom: 18px;
}

.mode-btn {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: var(--ink-dim);
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.mode-btn:hover { color: var(--ink); }
.mode-btn.active { background: var(--accent); color: #14171c; }

.flag-viewport.mystery img { opacity: 0; }

.flag-viewport img {
  position: absolute;
  top: var(--oy, 50%);
  left: var(--ox, 50%);
  transform: translate(-50%, -50%) scale(var(--zoom, 4));
  max-width: none;
  width: 100%;
  transition: transform 0.5s ease;
}

.attempts-left {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-dim);
  margin-bottom: 18px;
}

.guess-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
  align-items: flex-start;
}

.guess-form .play-again {
  margin-top: 0;
  height: 41px;
  flex-shrink: 0;
  align-self: flex-start;
}

.autocomplete {
  position: relative;
  flex: 1;
  text-align: left;
}

.autocomplete input {
  width: 100%;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
  padding: 10px 12px;
  font-family: var(--font-body);
  font-size: 14px;
}
.autocomplete input:focus-visible { outline: 2px solid var(--accent); }

.autocomplete-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow-y: auto;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  z-index: 20;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.autocomplete-list.hidden { display: none; }

.autocomplete-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  cursor: pointer;
  font-size: 14px;
}
.autocomplete-option:hover,
.autocomplete-option.active { background: var(--bg-panel-hover); }

.ac-flag-wrap {
  display: block;
  width: 24px;
  height: 16px;
  overflow: hidden;
  border-radius: 2px;
  flex-shrink: 0;
}

.autocomplete-flag {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.guess-form button {
  background: var(--accent);
  color: #14171c;
  border: none;
  border-radius: 4px;
  padding: 10px 16px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 13px;
  height: 41px;
  flex-shrink: 0;
  align-self: flex-start;
}

.settings-panel {
  text-align: left;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px 14px;
  margin: 0 0 16px;
  font-size: 13px;
}
.settings-panel.hidden { display: none; }

.settings-row {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--ink-dim);
}

.win-badge {
  display: inline-block;
  background: color-mix(in srgb, var(--accent-2) 25%, var(--bg-panel));
  color: var(--accent-2);
  border: 1px solid var(--accent-2);
  border-radius: 6px;
  padding: 6px 14px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 10px;
}
.win-badge.hidden { display: none; }

.guess-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.flagle-row {
  display: grid;
  grid-template-columns: 40px 1fr auto auto;
  align-items: center;
  gap: 10px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
}

.flagle-thumb {
  width: 32px;
  height: 22px;
  object-fit: cover;
  border-radius: 2px;
}

.flagle-name { font-weight: 600; }
.flagle-dist { font-family: var(--font-mono); color: var(--ink-dim); }
.flagle-arrow { color: var(--accent-2); display: flex; }
.flagle-pct {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent);
}
.flagle-correct {
  grid-column: 2 / -1;
  font-family: var(--font-mono);
  color: var(--accent);
  font-weight: 700;
}

/* Color Match mode guess rows: name / % / masked flag icon - see cm-mode below */
.flagle-row.cm-mode {
  grid-template-columns: 1fr auto 44px;
}

.cm-pct {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--ink-dim);
}

.cm-icon-wrap {
  display: block;
  width: 40px;
  height: 27px;
  overflow: hidden;
  border-radius: 3px;
  border: 1px solid var(--line);
  background: var(--bg-panel);
  flex-shrink: 0;
}

.cm-icon {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.flagle-row.cm-mode.correct .flagle-name,
.flagle-row.cm-mode.correct .cm-pct {
  color: var(--accent-2);
}


/* ============================================================
   RULE34DLE
   ============================================================ */

.r34-shell {
  max-width: 640px;
}

.r34-stats {
  display: flex;
  justify-content: center;
  gap: 28px;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--ink-dim);
  margin-bottom: 12px;
}
.r34-stats strong {
  color: var(--accent);
  font-weight: 700;
}

.r34-pair {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: stretch;
  margin: 8px 0 18px;
}

.r34-vs {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  color: var(--ink-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.r34-card {
  background: var(--bg-panel);
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 28px 16px;
  cursor: pointer;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 140px;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
  font: inherit;
}
.r34-card:hover:not(:disabled) {
  transform: translateY(-3px);
  border-color: var(--accent);
  background: var(--bg-panel-hover);
}
.r34-card:disabled {
  cursor: default;
}
.r34-card.winner {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 18%, var(--bg-panel));
}
.r34-card.loser {
  border-color: var(--danger);
  opacity: 0.75;
}

.r34-name {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.2;
}

.r34-count {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
}
.r34-count.hidden {
  visibility: hidden;
}

.r34-hint {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.r34-note {
  margin-top: 28px;
  font-size: 12px;
  color: var(--ink-dim);
  line-height: 1.45;
  max-width: 42ch;
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 520px) {
  .r34-pair {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }
  .r34-vs {
    padding: 4px 0;
  }
  .r34-name { font-size: 18px; }
}

/* ============================================================
   COLORFLE
   ============================================================ */

.cf-main-swatch {
  width: 220px;
  height: 220px;
  margin: 0 auto 10px;
  border-radius: 10px;
  border: 2px solid var(--line);
}

.cf-main-hex {
  font-family: var(--font-mono);
  letter-spacing: 0.2em;
  color: var(--ink-dim);
  font-size: 14px;
  margin-bottom: 18px;
}

.colorfle-row {
  display: grid;
  grid-template-columns: 32px auto 1fr auto;
  align-items: center;
  gap: 10px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
}
.colorfle-row.correct { border-color: var(--correct); }

.cf-swatch {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  border: 1px solid var(--line);
}

.cf-hex {
  font-family: var(--font-mono);
  font-weight: 600;
}

.cf-channels {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.cf-channel {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 4px;
  background: #22252d;
  color: var(--ink-dim);
  white-space: nowrap;
}
.cf-channel.cf-correct { background: var(--correct); color: #14171c; }
.cf-channel.cf-close   { background: var(--present); color: #14171c; }
.cf-channel.cf-warm    { background: var(--accent);  color: #14171c; }
.cf-channel.cf-cold    { background: #2a2e38; color: var(--ink-dim); }

.cf-pct {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-2);
}

.hidden { display: none; }

/* ---- Colorfle: Normal/Hard mix modes ---- */

.mix-slots {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 18px 0 14px;
}

.mix-slot {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  border: 2px dashed var(--line);
  cursor: pointer;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 4px;
}
.mix-slot.filled { border-style: solid; border-color: var(--line); cursor: pointer; }

.mix-slot-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--ink);
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
  background: rgba(20,23,28,0.55);
  border-radius: 3px;
  padding: 1px 4px;
}

.mix-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-bottom: 22px;
}
.mix-actions .play-again {
  margin-top: 0;
  height: 41px;
}

.mix-guess-btn {
  background: var(--accent);
  color: #14171c;
  border: none;
  border-radius: 4px;
  padding: 10px 22px;
  font-weight: 700;
  font-family: var(--font-mono);
  font-size: 13px;
  cursor: pointer;
  height: 41px;
}
.mix-guess-btn:disabled { opacity: 0.4; cursor: default; }

.mix-palette {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  max-width: 340px;
  margin: 0 auto 24px;
}

.mix-palette-swatch {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 5px;
  border: 1px solid var(--line);
  cursor: pointer;
  padding: 0;
}
.mix-palette-swatch.used { opacity: 0.25; cursor: default; }

.mix-guess-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px;
}
.mix-guess-row.correct { border-color: var(--correct); }

.mix-guess-tiles {
  display: flex;
  gap: 6px;
}

.mix-tile {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  border: 2px solid var(--line);
}
.mix-tile.mix-correct { border-color: var(--correct); }
.mix-tile.mix-present { border-color: var(--present); }
.mix-tile.mix-absent  { border-color: #2a2e38; opacity: 0.55; }

/* ============================================================
   ANGLE
   ============================================================ */

.angle-diagram {
  width: min(360px, 92vw);
  aspect-ratio: 1;
  margin: 0 auto 10px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: var(--bg-panel);
}

.angle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
}
.angle-row.correct { border-color: var(--correct); }

.angle-value {
  font-family: var(--font-mono);
  font-weight: 700;
  min-width: 44px;
}

/* ============================================================
   CUTLE
   ============================================================ */

.cutle-diagram {
  width: min(360px, 92vw);
  aspect-ratio: 1;
  margin: 0 auto 10px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: var(--bg-panel);
  cursor: crosshair;
}

.cutle-actions {
  text-align: center;
  margin-bottom: 18px;
}

.cutle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
}
.cutle-row.correct { border-color: var(--correct); }

.cutle-value {
  font-family: var(--font-mono);
  font-weight: 700;
}

/* ============================================================
   CONNECTIONS
   ============================================================ */

.conn-solved {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 480px;
  margin: 0 auto 8px;
}

.conn-solved-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 12px 10px;
  border-radius: 6px;
  color: #14171c;
  text-align: center;
}
.conn-solved-name {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.03em;
}
.conn-solved-words {
  font-family: var(--font-mono);
  font-size: 12px;
}

.conn-cat-1 { background: var(--accent-2); }
.conn-cat-2 { background: var(--present); }
.conn-cat-3 { background: var(--accent); }
.conn-cat-4 { background: var(--danger); }

.conn-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  max-width: 480px;
  margin: 0 auto 14px;
}

.conn-tile {
  aspect-ratio: 1.3;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6px 6px;
  background: var(--bg-panel-hover);
  border: none;
  border-radius: 6px;
  color: var(--ink);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
.conn-tile:hover { background: #2c3140; }
.conn-tile.selected { background: var(--ink); color: #14171c; }
.conn-tile.shake { animation: conn-shake 0.4s ease; }

@keyframes conn-shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(3px); }
  30%, 50%, 70% { transform: translateX(-5px); }
  40%, 60% { transform: translateX(5px); }
}

.conn-mistakes {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-dim);
  text-align: center;
  margin-bottom: 14px;
  display: flex;
  gap: 6px;
  justify-content: center;
  align-items: center;
}
.conn-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ink-dim);
  display: inline-block;
}
.conn-dot.used { background: transparent; border: 1px solid var(--line); }

.conn-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.conn-btn {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--line);
  background: var(--bg-panel);
  color: var(--ink);
  border-radius: 20px;
  padding: 8px 16px;
  cursor: pointer;
}
.conn-btn:hover:not(:disabled) { border-color: var(--accent); }
.conn-btn:disabled { opacity: 0.4; cursor: default; }
.conn-btn.primary { background: var(--ink); color: #14171c; border-color: var(--ink); }
.conn-btn.primary:disabled { background: var(--bg-panel); color: var(--ink-dim); border-color: var(--line); }

.conn-end-actions {
  text-align: center;
  margin-bottom: 18px;
}

/* ============================================================
   GLOBLE
   ============================================================ */

.globle-map {
  width: min(500px, 94vw);
  aspect-ratio: 2 / 1;
  margin: 0 auto 10px;
  border: 2px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-panel);
}

.globle-map-3d {
  aspect-ratio: 1 / 1;
  border: none;
  background: transparent;
  cursor: grab;
}
.globle-map-3d:active { cursor: grabbing; }
.globle-map-3d canvas { display: block; border-radius: 8px; }

.globle-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 10px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
}
.globle-row.correct { border-color: var(--correct); }

.globle-dist {
  font-family: var(--font-mono);
  color: var(--ink-dim);
  font-size: 12px;
  white-space: nowrap;
}

.globle-borders {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  background: var(--present);
  color: #14171c;
  border-radius: 4px;
  padding: 2px 6px;
  white-space: nowrap;
}

/* ============================================================
   SGA TRAINER
   ============================================================ */

.sga-svg { display: block; }

.mode-arrow {
  display: inline-block;
  color: var(--ink-dim);
  opacity: 0.7;
  padding: 0 2px;
  transform: scaleY(1.3);
}
.mode-btn.active .mode-arrow { color: #14171c; opacity: 0.6; }

.sga-prompt {
  width: 140px;
  height: 140px;
  margin: 4px auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-panel);
  border: 2px solid var(--line);
  border-radius: 12px;
  transition: border-color 0.15s ease;
  color: var(--ink);
}

.sga-prompt.sga-glyph .sga-svg { width: 68%; height: 68%; }

.sga-prompt.sga-letter {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 64px;
  text-transform: uppercase;
}

.sga-reveal-btn {
  display: block;
  margin: 0 auto 18px;
  background: none;
  border: none;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-dim);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  padding: 4px;
}
.sga-reveal-btn:hover { color: var(--accent); }

.status-stats {
  min-height: 20px;
  font-family: var(--font-mono);
  font-size: 12px;
  margin-top: -6px;
  margin-bottom: 14px;
  color: var(--ink-dim);
}

.sga-answers { margin-top: 8px; }

.sga-answers .key-row { gap: 6px; }

.sga-answers .key {
  min-width: 38px;
  height: 44px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  box-shadow: 0 2px 0 var(--line);
  transition: transform 0.1s ease, box-shadow 0.1s ease, border-color 0.15s ease, background 0.15s ease;
}
.sga-answers .key:hover {
  background: var(--bg-panel-hover);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 3px 0 var(--line);
}
.sga-answers .key:active {
  transform: translateY(2px);
  box-shadow: 0 0 0 var(--line);
}
.sga-answers .key.correct,
.sga-answers .key.wrong {
  border-color: transparent;
  box-shadow: none;
  transform: none;
}

.key .sga-svg { width: 22px; height: 22px; }

.key.wrong { background: var(--danger); color: #14171c; }

.sga-chart {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
  gap: 8px;
  padding: 4px 0;
}

.sga-chart-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: var(--bg-panel-hover);
  border-radius: 6px;
  padding: 10px 4px 6px;
}

.sga-chart-glyph {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 26px;
  color: var(--ink);
}
.sga-chart-glyph .sga-svg { width: 26px; height: 26px; }

.sga-chart-letter {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-dim);
  text-transform: uppercase;
}

/* ============================================================
   MORSE CODE TRAINER
   ============================================================ */

.reveal-btn {
  display: block;
  margin: 0 auto 18px;
  background: none;
  border: none;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-dim);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  padding: 4px;
}
.reveal-btn:hover { color: var(--accent); }

.morse-prompt {
  min-width: 140px;
  min-height: 140px;
  margin: 4px auto 16px;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-panel);
  border: 2px solid var(--line);
  border-radius: 12px;
  transition: border-color 0.15s ease;
  color: var(--ink);
}

.morse-prompt-letter {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 64px;
  text-transform: uppercase;
}

.morse-prompt-code { gap: 10px; flex-wrap: wrap; max-width: 320px; }
.morse-prompt-code .morse-symbol.dot { width: 16px; height: 16px; }
.morse-prompt-code .morse-symbol.dash { width: 52px; height: 16px; }

.morse-play-btn {
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 16px;
  margin-bottom: 20px;
  font-size: 13px;
}
.morse-play-btn:hover { border-color: var(--accent); background: var(--bg-panel-hover); }

.morse-symbol {
  display: inline-block;
  background: currentColor;
  border-radius: 3px;
  vertical-align: middle;
}
.morse-symbol.dot { width: 10px; height: 10px; border-radius: 50%; }
.morse-symbol.dash { width: 34px; height: 10px; }
.morse-symbol.slot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: none;
  border: 1px dashed var(--line);
}

.morse-build-area { margin-bottom: 10px; }

.morse-build-display {
  min-height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  color: var(--ink);
  transition: color 0.15s ease;
}
.morse-build-display.correct { color: var(--correct); }
.morse-build-display.wrong { color: var(--danger); }

.morse-input-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 4px;
}

.morse-symbol-btn {
  font-family: var(--font-mono);
  background: var(--bg-panel);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 8px;
  width: 56px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  box-shadow: 0 2px 0 var(--line);
  transition: transform 0.1s ease, box-shadow 0.1s ease, border-color 0.15s ease, background 0.15s ease;
}
.morse-symbol-btn .morse-symbol.dash { width: 26px; }
.morse-symbol-btn:hover { border-color: var(--accent); background: var(--bg-panel-hover); transform: translateY(-1px); box-shadow: 0 3px 0 var(--line); }
.morse-symbol-btn:active { transform: translateY(2px); box-shadow: 0 0 0 var(--line); }
.morse-symbol-btn.ghost { color: var(--ink-dim); font-size: 12px; }

.morse-answers { margin-top: 8px; }
.morse-answers .key-row { gap: 6px; }
.morse-answers .key {
  min-width: 38px;
  height: 44px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  box-shadow: 0 2px 0 var(--line);
  transition: transform 0.1s ease, box-shadow 0.1s ease, border-color 0.15s ease, background 0.15s ease;
}
.morse-answers .key:hover {
  background: var(--bg-panel-hover);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 3px 0 var(--line);
}
.morse-answers .key:active { transform: translateY(2px); box-shadow: 0 0 0 var(--line); }
.morse-answers .key.correct,
.morse-answers .key.wrong { border-color: transparent; box-shadow: none; transform: none; }
.morse-answers .key.wrong { background: var(--danger); color: #14171c; }

.morse-chart {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 8px;
  padding: 4px 0;
}

.morse-chart-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: var(--bg-panel-hover);
  border-radius: 6px;
  padding: 12px 6px 8px;
}

.morse-chart-code {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 12px;
  color: var(--ink);
}
.morse-chart-code .morse-symbol.dot { width: 6px; height: 6px; }
.morse-chart-code .morse-symbol.dash { width: 16px; height: 6px; }

.morse-chart-letter {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-dim);
  text-transform: uppercase;
}

/* ============================================================
   MAGNITUDLE
   ============================================================ */

.magnitudle-shell {
  max-width: 640px;
  position: relative;
}

.magnitudle-glow {
  position: absolute;
  top: -80px;
  left: 50%;
  width: 520px;
  height: 320px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(201, 106, 79, 0.28), rgba(232, 163, 61, 0.12) 45%, transparent 72%);
  filter: blur(10px);
  pointer-events: none;
  z-index: 0;
}

.magnitudle-card {
  position: relative;
  z-index: 1;
  background: linear-gradient(180deg, var(--bg-panel) 0%, var(--bg) 100%);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 36px 40px 40px;
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}
@media (max-width: 640px) {
  .magnitudle-card { padding: 28px 22px 32px; border-radius: 18px; }
}

.magnitudle-title {
  font-family: var(--font-display);
  font-size: 32px;
  margin: 4px 0;
}

.help-icon {
  background: none;
  border: 1px solid var(--line);
  color: var(--ink-dim);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.help-icon:hover { color: var(--accent); border-color: var(--accent); }

.magnitudle-help-text {
  color: var(--ink-dim);
  line-height: 1.6;
  margin: 0;
}
.magnitudle-help-text strong { color: var(--ink); }

.magnitudle-rule {
  border: none;
  border-top: 1px solid var(--line);
  margin: 18px 0;
}

.magnitudle-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-dim);
  text-transform: uppercase;
  margin-bottom: 14px;
}

.magnitudle-question {
  font-family: var(--font-display);
  font-size: 30px;
  line-height: 1.32;
  margin: 0 0 12px;
}

.magnitudle-subtitle {
  color: var(--ink-dim);
  font-size: 14px;
  margin: 0 0 18px;
}

.magnitudle-preview {
  text-align: center;
  margin-bottom: 8px;
}
.magnitudle-preview.hidden { display: none; }

.magnitudle-preview-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--ink-dim);
  text-transform: uppercase;
  margin-bottom: 2px;
}

.magnitudle-preview-value {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 16px;
  color: var(--ink);
}

.magnitudle-input {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-panel-hover);
  border: 2px solid var(--danger);
  border-radius: 14px;
  color: var(--ink);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 26px;
  text-align: center;
  padding: 22px 14px;
  margin-bottom: 14px;
  box-shadow: 0 4px 0 rgba(201, 106, 79, 0.25), 0 12px 28px -14px rgba(201, 106, 79, 0.5);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}
.magnitudle-input::placeholder {
  color: var(--ink-dim);
  font-weight: 400;
  text-transform: lowercase;
}
.magnitudle-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 4px 0 rgba(232, 163, 61, 0.25), 0 12px 28px -14px rgba(232, 163, 61, 0.55);
}
.magnitudle-input[readonly] { cursor: pointer; }
.magnitudle-input[readonly]:hover { transform: translateY(-1px); }

.magnitudle-mag-row {
  display: flex;
  gap: 8px;
  margin-bottom: 22px;
}

.magnitudle-mag-btn {
  flex: 1;
  background: var(--bg-panel-hover);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink-dim);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  padding: 12px 0;
  cursor: pointer;
  box-shadow: 0 2px 0 var(--line);
  transition: transform 0.1s ease, box-shadow 0.1s ease, border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.magnitudle-mag-btn:hover {
  color: var(--ink);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 3px 0 var(--line);
}
.magnitudle-mag-btn:active { transform: translateY(2px); box-shadow: none; }
.magnitudle-mag-btn.active {
  background: linear-gradient(180deg, var(--danger), #a8543b);
  color: #14171c;
  border-color: transparent;
  box-shadow: 0 3px 0 #7a3a28;
  transform: translateY(-1px);
}

.magnitudle-lock-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  background: var(--line);
  color: rgba(241, 237, 228, 0.35);
  border: none;
  border-radius: 30px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 15px;
  padding: 16px 0;
  cursor: not-allowed;
  transition: background 0.2s ease, color 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
}
.magnitudle-lock-btn:not(:disabled) {
  background: linear-gradient(135deg, var(--danger), #d97a56);
  color: #14171c;
  cursor: pointer;
  box-shadow: 0 6px 20px -6px rgba(201, 106, 79, 0.7);
}
.magnitudle-lock-btn:not(:disabled):hover { transform: translateY(-2px); box-shadow: 0 10px 24px -6px rgba(201, 106, 79, 0.8); }
.magnitudle-lock-btn:not(:disabled):active { transform: translateY(1px); }
.lock-arrow { display: inline-block; transition: transform 0.15s ease; }
.magnitudle-lock-btn:not(:disabled):hover .lock-arrow { transform: translateX(3px); }

/* ---------- result phase ---------- */

.magnitudle-verdict {
  text-align: center;
  color: var(--ink-dim);
  font-family: var(--font-mono);
  font-size: 15px;
  letter-spacing: 0.02em;
  margin-bottom: 8px;
}

.magnitudle-ring-wrap {
  position: relative;
  width: min(240px, 62vw);
  height: min(240px, 62vw);
  margin: 4px auto 28px;
}

.magnitudle-ring { width: 100%; height: 100%; transform: rotate(-90deg); }

.magnitudle-ring-track {
  fill: none;
  stroke: var(--bg-panel-hover);
  stroke-width: 14;
}

.magnitudle-ring-fill {
  fill: none;
  stroke: var(--correct);
  stroke-width: 14;
  stroke-linecap: round;
  stroke-dasharray: 552.9;
  stroke-dashoffset: 552.9;
  transition: stroke-dashoffset 0.9s cubic-bezier(0.22, 1, 0.36, 1), stroke 0.4s ease;
}

.magnitudle-ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#score-value {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 72px;
  line-height: 1;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.magnitudle-score-max {
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--ink-dim);
  font-weight: 600;
  margin-top: 4px;
}

.magnitudle-compare {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.magnitudle-compare-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  background: var(--bg-panel-hover);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 12px 16px;
}
.magnitudle-compare-card.guess { border-color: rgba(201, 106, 79, 0.45); }

.magnitudle-compare-icon {
  font-size: 18px;
  line-height: 1;
  margin-bottom: 2px;
}

.magnitudle-compare-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--ink-dim);
  text-transform: uppercase;
}

.magnitudle-compare-value {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 17px;
  color: var(--ink);
  line-height: 1.3;
}
.magnitudle-compare-card.guess .magnitudle-compare-value { color: var(--danger); }

.magnitudle-compare-arrow {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink-dim);
  font-size: 14px;
}

.magnitudle-badge {
  text-align: center;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
  background: var(--bg-panel-hover);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 0;
  margin-bottom: 22px;
}

.magnitudle-share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  background: linear-gradient(135deg, var(--danger), #d97a56);
  color: #14171c;
  border: none;
  border-radius: 30px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 15px;
  padding: 16px 0;
  cursor: pointer;
  margin-bottom: 22px;
  box-shadow: 0 6px 20px -6px rgba(201, 106, 79, 0.7);
  transition: transform 0.1s ease, box-shadow 0.2s ease;
}
.magnitudle-share-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 24px -6px rgba(201, 106, 79, 0.8); }
.magnitudle-share-btn:active { transform: translateY(1px); }

.magnitudle-fact-box,
.magnitudle-source-box {
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.magnitudle-fact-box { border-color: rgba(201, 106, 79, 0.4); }

.magnitudle-fact-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--danger);
  margin-bottom: 8px;
}

.magnitudle-fact-text {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.55;
}

.magnitudle-source-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-bottom: 6px;
}

.magnitudle-source-text {
  margin: 0;
  color: var(--ink-dim);
  font-size: 12px;
}

.magnitudle-footer {
  text-align: center;
  color: var(--ink-dim);
  font-size: 12px;
  font-style: italic;
  margin-top: 4px;
}