@font-face {
  font-family: "Minecraft";
  src: url("/fonts/minecraft.woff2") format("woff2"),
       url("/fonts/minecraft.woff") format("woff");
  font-display: swap;
}

:root {
  --bg: #eef3ea;
  --fg: #16281a;
  --muted: #4f6b52;
  --accent: #2e6d3a;      /* forest green */
  --accent-fg: #f2f7ef;
  --border: #cdddc6;
  --splash: #d4a017;      /* muted gold, readable on light */
  --splash-shadow: #7a5c00;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1a12;        /* deep forest */
    --fg: #dcead9;
    --muted: #8aa88d;
    --accent: #5cba5f;
    --accent-fg: #0b1410;
    --border: #223a28;
    --splash: #ffff44;    /* classic Minecraft yellow */
    --splash-shadow: #3f3f00;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: "Minecraft", "Courier New", monospace;
  font-size: 15px;
  line-height: 1.9;
  letter-spacing: 0.02em;
}

/* The glow orb replaces the native cursor (added by JS on fine pointers only,
   so touch devices keep their normal behavior). */
body.custom-cursor, body.custom-cursor * { cursor: none; }

.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 12vh 24px 10vh;
}

.hero { position: relative; }

.hero h1 {
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  line-height: 1.15;
  margin: 0 0 0.5rem;
  letter-spacing: 0;
}

.tagline {
  color: var(--muted);
  margin: 0 0 2rem;
  font-size: 1.05rem;
}

.resume-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--accent);
  color: var(--accent-fg);
  border: 0;
  font: inherit;
  text-decoration: none;
  font-weight: 600;
  padding: 0.75rem 1.4rem;
  border-radius: 8px;
  transition: transform 0.08s ease, opacity 0.15s ease;
}

.resume-btn:hover { opacity: 0.92; }
.resume-btn:active { transform: translateY(1px); }
.resume-btn:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.links {
  margin-top: 1.25rem;
  color: var(--muted);
}

.links a {
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
}

.links a:hover { border-bottom-color: var(--accent); }

.dot { margin: 0 0.6rem; color: var(--muted); }

.bio {
  margin-top: 3.5rem;
  border-top: 1px solid var(--border);
  padding-top: 2rem;
  color: var(--fg);
}

.bio p { margin: 0 0 1.1rem; }

/* --- Minecraft splash text --- */
.splash {
  position: absolute;
  top: -0.4rem;
  right: -1.5rem;
  width: 46%;
  max-width: 260px;
  text-align: center;
  pointer-events: none;
  transform: rotate(-14deg);
  transform-origin: center;
  z-index: 5;
}

.splash-inner {
  display: inline-block;
  color: var(--splash);
  text-shadow: 2px 2px 0 var(--splash-shadow);
  /* --fit is set by JS so long splashes shrink to fit the box */
  font-size: calc(1.15rem * var(--fit, 1));
  line-height: 1.1;
  white-space: nowrap;
  animation: splash-bob 0.6s ease-in-out infinite alternate;
}

@keyframes splash-bob {
  from { transform: scale(1); }
  to   { transform: scale(1.08); }
}

@media (max-width: 560px) {
  .splash {
    position: static;
    width: auto;
    max-width: none;
    margin: 0.5rem 0 1.25rem;
    transform: rotate(-6deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .splash-inner { animation: none; }
}

/* --- Cursor glow orb (the cursor itself; tracks the pointer 1:1, no lag) --- */
.cursor-trail {
  position: fixed;
  top: 0;
  left: 0;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
  opacity: 0.6;
  pointer-events: none;
  z-index: 60;
  mix-blend-mode: multiply;
  will-change: transform;
  /* Only size/brightness animate — position is set instantly so there's no drag. */
  transition: width 0.12s ease, height 0.12s ease, margin 0.12s ease,
              opacity 0.12s ease, background 0.12s ease;
}

/* Over a clickable: swell and brighten to gold. */
.cursor-trail.hot {
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  opacity: 0.9;
  background: radial-gradient(circle, var(--splash) 0%, transparent 70%);
}

@media (prefers-color-scheme: dark) {
  .cursor-trail { mix-blend-mode: screen; opacity: 0.7; }
  .cursor-trail.hot { opacity: 0.95; }
}

@media (prefers-reduced-motion: reduce) {
  .cursor-trail { transition: none; }
}

/* --- Leaderboard --- */
.board {
  margin-top: 3rem;
  border-top: 1px solid var(--border);
  padding-top: 2rem;
}

.board h2 {
  font-size: 1.15rem;
  margin: 0 0 0.25rem;
  letter-spacing: -0.01em;
}

.board-sub {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 1rem;
}

.board-list {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: rank;
}

.board-row {
  counter-increment: rank;
  display: grid;
  grid-template-columns: 2rem 1fr auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}

.board-row::before {
  content: counter(rank);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.board-name { font-weight: 600; letter-spacing: 0.03em; }

.board-score {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--accent);
}

/* --- Daily word board game --- */
.game {
  margin-top: 3rem;
  border-top: 1px solid var(--border);
  padding-top: 2rem;
}

.game h2 {
  font-size: 1.15rem;
  margin: 0 0 0.25rem;
  letter-spacing: -0.01em;
}

.game-sub {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 1.25rem;
}

.board-grid {
  --size: 9;
  display: grid;
  grid-template-columns: repeat(var(--size), 1fr);
  gap: 3px;
  width: 100%;
  max-width: 420px;
  margin: 0 0 1.25rem;
  aspect-ratio: 1;
  background: var(--border);
  padding: 3px;
  border-radius: 8px;
}

.cell {
  position: relative;
  background: var(--bg);
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(0.6rem, 2.6vw, 0.95rem);
  line-height: 1;
  user-select: none;
  aspect-ratio: 1;
}

/* Premium squares (empty) — tinted by type. */
.cell.b-dl { background: color-mix(in srgb, var(--accent) 16%, var(--bg)); }
.cell.b-tl { background: color-mix(in srgb, var(--accent) 30%, var(--bg)); }
.cell.b-dw { background: color-mix(in srgb, var(--splash) 22%, var(--bg)); }
.cell.b-tw { background: color-mix(in srgb, var(--splash) 40%, var(--bg)); }

.bonus-tag {
  font-size: clamp(0.42rem, 1.7vw, 0.6rem);
  color: var(--muted);
  letter-spacing: 0.02em;
  opacity: 0.85;
}

/* A tile — used both on the board (filled cells) and in the rack. */
.tile,
.cell.filled {
  position: relative;
  background: var(--accent);
  color: var(--accent-fg);
  border: 0;
  border-radius: 4px;
  font: inherit;
}

.cell.filled { border-radius: 3px; }

/* Seed tiles (pre-placed) read as the board's given letters — muted vs. yours. */
.cell.seed {
  background: color-mix(in srgb, var(--accent) 62%, var(--fg) 8%);
}

/* Your just-placed tiles pop in gold so they stand out from the board. */
.cell.placed {
  background: var(--splash);
  color: var(--splash-shadow);
  cursor: pointer;
}

.tile-letter {
  font-weight: 700;
  text-transform: uppercase;
}

.tile-value {
  position: absolute;
  right: 2px;
  bottom: 0;
  font-size: 0.5em;
  font-weight: 700;
  opacity: 0.8;
}

.rack {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 1rem;
  min-height: 2.6rem;
  align-items: center;
}

.rack-tile {
  width: 2.4rem;
  height: 2.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.12s ease;
  box-shadow: 0 2px 0 color-mix(in srgb, var(--accent) 60%, #000 40%);
}

.rack-tile:hover { transform: translateY(-2px); }

.rack-tile.selected {
  background: var(--splash);
  color: var(--splash-shadow);
  box-shadow: 0 2px 0 var(--splash-shadow);
  transform: translateY(-2px);
}

.rack-empty { color: var(--muted); font-size: 0.9rem; }

.game-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.name-input {
  font: inherit;
  padding: 0.55rem 0.7rem;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  width: 9rem;
}

.name-input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.game-btn {
  font: inherit;
  font-weight: 600;
  padding: 0.55rem 1rem;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--fg);
  cursor: pointer;
}

.game-btn:hover:not(:disabled) { border-color: var(--accent); }

.game-btn.primary {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
}

.game-btn:disabled { opacity: 0.5; cursor: default; }

.game-btn:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.game-msg {
  margin: 1rem 0 0;
  min-height: 1.4rem;
  font-size: 0.95rem;
}

.game-msg.ok { color: var(--accent); font-weight: 700; }
.game-msg.err { color: #c0392b; font-weight: 600; }

@media (prefers-color-scheme: dark) {
  .game-msg.err { color: #ff8a7a; }
}

/* --- Résumé preview modal --- */
.modal[hidden] { display: none; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4vh 3vw;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
}

.modal-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(900px, 100%);
  height: 92vh;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.modal-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.modal-title { font-weight: 700; }

.modal-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-btn {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.4rem 0.7rem;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--fg);
  text-decoration: none;
  white-space: nowrap;
}

.modal-btn:hover { border-color: var(--accent); }

.modal-btn.primary {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
}

.modal-btn.close { line-height: 1; padding: 0.4rem 0.55rem; }

.modal-btn:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.modal-doc {
  flex: 1;
  min-height: 0;
  background: #525659; /* neutral PDF-viewer gutter */
}

.modal-doc iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

@media (max-width: 520px) {
  .modal { padding: 0; }
  .modal-panel { height: 100vh; width: 100%; border-radius: 0; border: 0; }
  .modal-btn { font-size: 0.8rem; padding: 0.4rem 0.55rem; }
}