:root {
  --ink: #161a33;
  --ink-2: #232850;
  --paper: #f6f1e3;
  --paper-2: #fffdf6;
  --muted: #4a4e66;
  --brick: #c2532f;
  --brick-d: #6b2414;
  --brick-text: #a33d1d;
  --coin: #f2c14e;
  --grass: #3fa34d;
  --pixel: "Press Start 2P", "Courier New", monospace;
  --sans: "DM Sans", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--sans); background: var(--ink); color: var(--paper); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
.screen { min-height: 100vh; min-height: 100dvh; }
button { font: inherit; cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--coin); outline-offset: 3px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--pixel); font-size: 14px; line-height: 1.2; letter-spacing: 0.5px;
  padding: 16px 20px; border: 4px solid var(--ink); text-decoration: none;
  box-shadow: 6px 6px 0 var(--ink); transition: transform 0.08s, box-shadow 0.08s;
}
.btn:hover { transform: translate(-2px, -2px); box-shadow: 8px 8px 0 var(--ink); }
.btn:active { transform: translate(4px, 4px); box-shadow: 2px 2px 0 var(--ink); }
.btn-primary { background: var(--coin); color: var(--ink); }
.btn-secondary { background: var(--paper-2); color: var(--ink); }
.btn-sm { font-size: 11px; padding: 12px 14px; box-shadow: 4px 4px 0 var(--ink); }
.btn-sm:hover { box-shadow: 6px 6px 0 var(--ink); }

/* ---------- title ---------- */
#title {
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  padding: 40px 20px 170px;
  background: linear-gradient(180deg, #11142a 0%, #232850 75%);
}
.title-stars {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    radial-gradient(2px 2px at 12% 18%, #fffdf6 99%, transparent),
    radial-gradient(2px 2px at 28% 62%, #f2c14e 99%, transparent),
    radial-gradient(2px 2px at 44% 10%, #fffdf6 99%, transparent),
    radial-gradient(3px 3px at 71% 24%, #fffdf6 99%, transparent),
    radial-gradient(2px 2px at 86% 52%, #f2c14e 99%, transparent),
    radial-gradient(2px 2px at 92% 12%, #fffdf6 99%, transparent),
    radial-gradient(2px 2px at 6% 70%, #fffdf6 99%, transparent),
    radial-gradient(2px 2px at 60% 70%, #fffdf6 99%, transparent);
}
.title-inner { position: relative; z-index: 2; text-align: center; max-width: 820px; }
.eyebrow { font-family: var(--pixel); font-size: 11px; line-height: 1.8; color: var(--coin); margin: 0 0 28px; }
#title-avatar {
  display: block; width: 112px; height: 140px; margin: 0 auto 28px;
  image-rendering: pixelated; image-rendering: crisp-edges;
  animation: bob 1.2s steps(2) infinite;
}
.pixel-title {
  font-family: var(--pixel); font-weight: 400; font-size: clamp(36px, 8vw, 72px); line-height: 1.3;
  margin: 0 0 22px; color: var(--paper); text-shadow: 6px 6px 0 var(--brick);
}
.title-role { font-size: clamp(17px, 2.4vw, 22px); color: #c9cce0; margin: 0 0 34px; }
.title-actions { display: flex; gap: 22px; justify-content: center; flex-wrap: wrap; margin-bottom: 28px; }
.title-hint { color: #c9cce0; font-size: 16px; margin: 0 0 10px; }
.title-controls { font-family: var(--pixel); font-size: 10px; line-height: 1.8; color: #9ca1c6; margin: 0; }
.title-ground {
  position: absolute; left: 0; right: 0; bottom: 0; height: 128px;
  background:
    linear-gradient(var(--grass), var(--grass)) top / 100% 10px no-repeat,
    repeating-linear-gradient(180deg, transparent 0 26px, var(--brick-d) 26px 30px),
    repeating-linear-gradient(90deg, var(--brick) 0 56px, var(--brick-d) 56px 60px);
}
@media (max-width: 560px) { .pixel-title { text-shadow: 3px 3px 0 var(--brick); } }
.blink { animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
@keyframes bob { 50% { transform: translateY(-6px); } }

/* ---------- game ---------- */
#game { position: fixed; inset: 0; overflow: hidden; background: #4f86d9; touch-action: none; user-select: none; -webkit-user-select: none; }
#game-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; outline: none; }
.hud {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
  padding: 14px 18px; padding-top: max(14px, env(safe-area-inset-top));
  pointer-events: none; font-family: var(--pixel); color: #fffdf6; text-shadow: 2px 2px 0 rgba(22, 26, 51, 0.85);
}
.hud-stats { display: flex; gap: 28px; flex-wrap: wrap; }
.hud-stats > div { display: flex; flex-direction: column; gap: 7px; font-size: 14px; }
.hud-label { font-size: 9px; }
.hud-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; pointer-events: auto; }
.hud-btn {
  font-family: var(--pixel); font-size: 10px; line-height: 1.2; padding: 10px 12px;
  background: rgba(22, 26, 51, 0.85); color: #fffdf6; border: 3px solid #fffdf6;
  text-decoration: none; text-shadow: none;
}
.hud-btn:hover { background: var(--ink); }
.hud-btn-hot { background: var(--coin); color: var(--ink); border-color: var(--ink); }
.hud-btn-hot:hover { background: #ffd56b; }
.hud-hint {
  position: absolute; left: 50%; bottom: 28px; transform: translateX(-50%); margin: 0;
  font-family: var(--pixel); font-size: 11px; line-height: 1.6; text-align: center; white-space: nowrap;
  background: rgba(22, 26, 51, 0.9); color: #fffdf6; border: 3px solid #fffdf6; padding: 10px 14px;
  pointer-events: none;
}
.touch {
  position: absolute; left: 0; right: 0; bottom: 0; display: none;
  justify-content: space-between; align-items: flex-end;
  padding: 16px 18px calc(18px + env(safe-area-inset-bottom)); pointer-events: none;
}
body.is-touch .touch { display: flex; }
.touch-pad { display: flex; gap: 14px; align-items: flex-end; }
.touch button {
  pointer-events: auto; width: 66px; height: 66px; border-radius: 50%;
  border: 4px solid var(--ink); background: rgba(255, 253, 246, 0.92); color: var(--ink);
  font-family: var(--pixel); font-size: 16px; touch-action: none; user-select: none; -webkit-user-select: none;
  box-shadow: 0 5px 0 var(--ink);
}
.touch button.on { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.touch .touch-a { width: 78px; height: 78px; background: var(--coin); }
.touch .touch-b { background: #9cc6f5; }
body.is-touch .hud-hint { bottom: 140px; font-size: 9px; white-space: normal; width: max-content; max-width: 86vw; }
@media (max-width: 760px) {
  .hud { padding: 10px 12px; }
  .hud-stats { gap: 14px; }
  .hud-stats > div { font-size: 11px; }
  .hud-label { font-size: 8px; }
  .hud-opt { display: none !important; }
  .hud-btn { font-size: 8px; padding: 8px 9px; }
}

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 18px; background: rgba(10, 12, 28, 0.72); }
.modal-box {
  width: min(680px, 100%); max-height: calc(100dvh - 36px); overflow: auto;
  background: var(--paper); color: var(--ink); border: 4px solid var(--ink); box-shadow: 10px 10px 0 #0a0c1c;
}
.modal-bar {
  position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: var(--ink); color: var(--coin); font-family: var(--pixel); font-size: 10px; padding: 10px 12px 10px 16px;
}
.modal-x { background: var(--brick); color: #fffdf6; border: 3px solid var(--paper); font-family: var(--pixel); font-size: 11px; padding: 6px 9px; }
.modal-body { padding: 28px; }
.modal-body h2 { font-family: var(--pixel); font-weight: 400; font-size: clamp(16px, 3vw, 22px); line-height: 1.45; margin: 0 0 12px; }
.m-meta { color: var(--muted); font-size: 16px; font-weight: 700; margin: 0 0 14px; }
.m-lede { font-size: 18px; line-height: 1.5; margin: 0 0 16px; }
.m-list { padding-left: 20px; margin: 0 0 20px; font-size: 16px; line-height: 1.55; }
.m-list li + li { margin-top: 8px; }
.m-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 8px; }
.m-actions-2 { margin-top: 18px; }
.m-hint { font-family: var(--pixel); font-size: 9px; color: var(--muted); margin: 20px 0 0; }
.m-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 0 0 24px; }
.m-stats div { background: var(--ink); color: var(--paper); padding: 12px 10px; text-align: center; }
.m-stats dt { font-family: var(--pixel); font-size: 8px; color: var(--coin); margin-bottom: 8px; }
.m-stats dd { font-family: var(--pixel); font-size: 13px; margin: 0; }
@media (max-width: 520px) { .m-stats { grid-template-columns: repeat(2, 1fr); } .modal-body { padding: 22px 18px; } }

/* ---------- shared bits ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; padding: 0; list-style: none; }
.chip { font-size: 13px; font-weight: 700; padding: 5px 10px; background: var(--paper-2); color: var(--ink); border: 2px solid var(--ink); }
.r-links { display: flex; flex-wrap: wrap; gap: 18px; margin: 0; }
.text-link { font-weight: 700; color: var(--brick-text); text-underline-offset: 3px; text-decoration-thickness: 2px; }

/* ---------- recruiter mode ---------- */
.recruiter { background: var(--paper); color: var(--ink); }
.r-nav {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px clamp(18px, 5vw, 56px); background: rgba(246, 241, 227, 0.95);
  backdrop-filter: blur(6px); border-bottom: 4px solid var(--ink);
}
.r-brand { display: flex; align-items: center; gap: 12px; font-family: var(--pixel); font-size: 12px; text-decoration: none; }
.avatar-mini { width: 32px; height: 40px; image-rendering: pixelated; }
.r-navlinks { display: flex; gap: 22px; align-items: center; }
.r-navlinks > a:not(.btn) { font-weight: 700; font-size: 16px; text-decoration: none; }
.r-navlinks > a:not(.btn):hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.r-wrap { max-width: 1080px; margin: 0 auto; padding: 0 clamp(18px, 5vw, 56px); }
.r-hero { display: grid; grid-template-columns: auto 1fr; gap: clamp(28px, 5vw, 60px); align-items: center; padding: 72px 0 60px; }
.r-avatar {
  width: clamp(132px, 17vw, 184px); aspect-ratio: 4 / 5; display: flex; align-items: flex-end; justify-content: center;
  background: linear-gradient(180deg, #6fa8e8 0%, #a9ccf2 78%, var(--grass) 78%, var(--grass) 82%, var(--brick) 82%);
  border: 4px solid var(--ink); box-shadow: 8px 8px 0 var(--ink); padding-bottom: 18%;
}
.avatar-big { width: 64%; height: auto; aspect-ratio: 16 / 20; image-rendering: pixelated; }
.r-status { display: inline-flex; align-items: center; gap: 10px; font-family: var(--pixel); font-size: 10px; color: #1d6b31; margin: 0; }
.dot { width: 10px; height: 10px; background: #2fa04a; box-shadow: 0 0 0 3px rgba(47, 160, 74, 0.25); }
.r-hero h1 { font-family: var(--pixel); font-weight: 400; font-size: clamp(26px, 4.6vw, 46px); line-height: 1.3; margin: 16px 0 14px; }
.r-role { font-size: clamp(18px, 2.2vw, 22px); font-weight: 700; margin: 0 0 12px; }
.r-tag { font-size: 17px; line-height: 1.65; color: var(--muted); max-width: 640px; margin: 0 0 26px; }
.r-actions { display: flex; gap: 14px; flex-wrap: wrap; }
.r-sec { padding: 52px 0; border-top: 4px dashed rgba(22, 26, 51, 0.16); }
.r-sec h2 { font-family: var(--pixel); font-weight: 400; font-size: 16px; line-height: 1.5; margin: 0 0 28px; display: flex; align-items: center; gap: 14px; }
.r-sec h2 span { color: var(--brick-text); }
.r-stack { display: grid; gap: 26px; }
.r-card { background: var(--paper-2); border: 4px solid var(--ink); box-shadow: 6px 6px 0 var(--ink); padding: 26px; }
.r-card-head { display: flex; justify-content: space-between; gap: 6px 16px; flex-wrap: wrap; align-items: baseline; margin-bottom: 10px; }
.r-card h3 { font-size: 21px; line-height: 1.3; margin: 0; }
.r-date { font-family: var(--pixel); font-size: 10px; color: var(--brick-text); margin: 0; }
.r-summary { font-size: 17px; line-height: 1.6; margin: 0 0 12px; }
.r-list { padding-left: 20px; margin: 0 0 18px; font-size: 16px; line-height: 1.6; color: #2b2f4a; }
.r-list li + li { margin-top: 6px; }
.r-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 26px; }
.r-proj h3 { font-family: var(--pixel); font-weight: 400; font-size: 14px; line-height: 1.6; margin: 0 0 12px; }
.r-skills { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px 28px; }
.r-skill-h { font-size: 15px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin: 0 0 12px; }
.r-two { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
.r-edu { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; }
.r-edu li { display: flex; flex-direction: column; gap: 4px; font-size: 16px; line-height: 1.5; }
.r-edu span { color: var(--muted); }
.r-foot { background: var(--ink); color: var(--paper); padding: 64px 0 56px; margin-top: 20px; border-top: 10px solid var(--grass); }
.r-foot h2 { font-family: var(--pixel); font-weight: 400; font-size: clamp(18px, 3vw, 26px); margin: 0 0 14px; color: var(--coin); }
.r-foot p { font-size: 18px; line-height: 1.6; margin: 0 0 24px; color: #c9cce0; }
.r-foot .r-fine { font-size: 15px; margin: 28px 0 0; }
.r-foot .r-fine a { color: var(--coin); }
@media (max-width: 720px) {
  .r-hero { grid-template-columns: 1fr; padding-top: 44px; }
  .r-two { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
  .r-brand span { font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .blink, #title-avatar { animation: none; }
  .btn { transition: none; }
}
