/* =====================================================================
   style.css — paper, ink and pixels. Every box is notched at the
   corners like it was drawn on the same 16px grid as the world.
   ===================================================================== */

:root {
  --ink: #2b2135; --ink2: #46344f; --paper: #f6ead0; --paper2: #e4d1ac; --paper3: #c6ad8c; --white: #fff9ee;
  --teal: #206b69; --blue: #314a89; --navy: #202a55; --violet: #5b3f86; --red: #bb3f48; --gold: #cf812a;
  --green: #3e7c45; --brown: #8d573d; --brick: #934237; --sea: #22467d; --y: #fadb74;
  --px: 3px;
  --notch: polygon(0 6px, 3px 6px, 3px 3px, 6px 3px, 6px 0, calc(100% - 6px) 0, calc(100% - 6px) 3px, calc(100% - 3px) 3px, calc(100% - 3px) 6px, 100% 6px, 100% calc(100% - 6px), calc(100% - 3px) calc(100% - 6px), calc(100% - 3px) calc(100% - 3px), calc(100% - 6px) calc(100% - 3px), calc(100% - 6px) 100%, 6px 100%, 6px calc(100% - 3px), 3px calc(100% - 3px), 3px calc(100% - 6px), 0 calc(100% - 6px));
  --ui: 'Pixelify Sans', ui-monospace, monospace;
  --label: 'Silkscreen', 'Pixelify Sans', ui-monospace, monospace;
  --serif: 'Newsreader', Georgia, serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--sea); overflow: hidden; color: var(--ink); font-family: var(--ui); -webkit-tap-highlight-color: transparent; }
canvas#game { position: fixed; left: 0; top: 0; image-rendering: pixelated; image-rendering: crisp-edges; touch-action: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--blue); }

/* ---------- shared pixel button ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--label); font-size: 14px; letter-spacing: .02em;
  background: var(--y); color: var(--ink); border: 3px solid var(--ink); padding: 9px 14px 8px;
  box-shadow: inset -3px -3px 0 #d6892c, inset 3px 3px 0 #fdf0b4; clip-path: var(--notch);
  text-decoration: none; transition: transform .08s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(1px); box-shadow: inset 3px 3px 0 #d6892c; }
.btn.ghost { background: var(--paper); box-shadow: inset -3px -3px 0 var(--paper3), inset 3px 3px 0 #fff; }

/* ---------- title ---------- */
#title {
  position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: radial-gradient(ellipse at 50% 45%, rgba(27,47,92,.15), rgba(27,47,92,.62) 75%); text-align: center; padding: 24px; z-index: 30;
  transition: opacity .6s, visibility .6s;
}
body.playing #title { opacity: 0; visibility: hidden; pointer-events: none; }
#logo { height: auto; image-rendering: pixelated; filter: drop-shadow(0 6px 0 rgba(27,20,40,.35)); animation: bob 1.6s steps(1, end) infinite; }
/* the logo hops by exactly two of its own pixels — never a fraction of one */
@keyframes bob { 50% { transform: translateY(calc(var(--lp, 3px) * -2)); } }
body:not(.ready) #title > :not(.logo-wrap) { visibility: hidden; }
#title .sub { margin: 4px 0 0; font-family: var(--label); font-size: clamp(11px, 2.2vw, 15px); color: var(--white); text-shadow: 2px 2px 0 var(--ink); letter-spacing: .03em; }
#title .press { margin: 10px 0 2px; font-size: 18px; color: var(--y); text-shadow: 2px 2px 0 var(--ink); animation: blink 1.1s steps(2) infinite; }
#title .press .t { display: none; }
@media (hover: none) { #title .press .k { display: none; } #title .press .t { display: inline; } }
@keyframes blink { 50% { opacity: .35; } }
.title-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
#title .hint { position: absolute; bottom: 16px; left: 0; right: 0; margin: 0; font-size: 13px; color: rgba(255,249,238,.75); text-shadow: 1px 1px 0 var(--ink); }

/* ---------- HUD ---------- */
#zone, #hud { position: fixed; top: 12px; z-index: 10; opacity: 0; transition: opacity .5s .3s; pointer-events: none; }
body.playing #zone, body.playing #hud { opacity: 1; pointer-events: auto; }
#zone { left: 12px; display: flex; align-items: center; gap: 8px; background: var(--ink); color: var(--paper); font-family: var(--label); font-size: 12px; padding: 8px 12px 7px 10px; clip-path: var(--notch); }
#zone i { width: 9px; height: 9px; background: var(--red); box-shadow: inset -2px -2px 0 rgba(0,0,0,.25); }
#zone[data-city="istanbul"] i { background: #33988a; } #zone[data-city="london"] i { background: #4b74bf; } #zone[data-city="sea"] i { background: #93cfe2; }
#zone.pop { animation: pop .45s steps(4); }
@keyframes pop { 0% { transform: translateY(-8px); } 60% { transform: translateY(2px); } 100% { transform: none; } }
#hud { right: 12px; display: flex; gap: 6px; }
#hud button { font-family: var(--label); font-size: 12px; background: var(--paper); border: 3px solid var(--ink); min-width: 38px; height: 38px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; clip-path: var(--notch); box-shadow: inset -3px -3px 0 var(--paper3), inset 3px 3px 0 #fff; }
#hud button:hover { background: var(--white); }
#hud .secrets span { color: var(--gold); }
#hud .snd.off .w { display: none; }
#hud .snd.off { color: var(--paper3); }

/* ---------- toast ---------- */
#toast { position: fixed; top: 62px; left: 50%; transform: translate(-50%, -140%); z-index: 25; background: var(--paper); border: 3px solid var(--ink); clip-path: var(--notch); padding: 9px 14px 8px; font-size: 15px; max-width: min(92vw, 520px); text-align: center; transition: transform .35s steps(5); pointer-events: none; box-shadow: inset -3px -3px 0 var(--paper2); }
#toast.on { transform: translate(-50%, 0); }
#toast b { font-weight: 700; } #toast i { font-style: normal; color: var(--gold); margin-left: 6px; font-family: var(--label); font-size: 12px; }

/* ---------- dialogue ---------- */
#dlg {
  position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); width: min(680px, calc(100vw - 24px)); transform: translate(-50%, 140%);
  background: var(--paper); border: 3px solid var(--ink); clip-path: var(--notch); padding: 16px 18px 18px; min-height: 108px; z-index: 20;
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto 1fr auto; column-gap: 14px;
  box-shadow: inset -3px -3px 0 var(--paper2), inset 3px 3px 0 #fffaf0; transition: transform .25s steps(5); cursor: pointer;
}
#dlg.on { transform: translate(-50%, 0); }
#dlg .name { grid-column: 1 / 3; justify-self: start; font-family: var(--label); font-size: 12px; color: var(--white); padding: 4px 9px 3px; margin: -4px 0 8px; background: var(--teal); clip-path: var(--notch); }
#dlg .portrait { grid-row: 2 / 4; width: 64px; height: 60px; background: var(--paper2); border: 3px solid var(--ink); clip-path: var(--notch); display: grid; place-items: center; overflow: hidden; }
#dlg .portrait canvas { width: 64px; height: 60px; image-rendering: pixelated; }
#dlg .text { font-size: 18px; line-height: 1.42; min-height: 52px; }
#dlg .choices { display: none; grid-column: 2; flex-direction: column; gap: 2px; margin-top: 8px; }
#dlg .choices.on { display: flex; }
#dlg .choice { text-align: left; background: none; border: 0; padding: 4px 6px 4px 22px; font-size: 17px; position: relative; color: var(--ink2); }
#dlg .choice.sel { color: var(--ink); background: var(--paper2); }
#dlg .choice.sel::before { content: '▶'; position: absolute; left: 6px; font-size: 11px; top: 8px; color: var(--red); }
#dlg .next { position: absolute; right: 14px; bottom: 8px; font-size: 12px; color: var(--red); opacity: 0; }
#dlg .next.on { opacity: 1; animation: nudge .7s steps(2) infinite; }
@keyframes nudge { 50% { transform: translateY(3px); } }

/* ---------- panels ---------- */
#panel, #map { position: fixed; inset: 0; z-index: 22; display: grid; place-items: center; background: rgba(27,20,40,.55); opacity: 0; visibility: hidden; transition: opacity .2s, visibility .2s; padding: 16px; }
#panel.on, #map.on { opacity: 1; visibility: visible; }
.card { width: min(620px, 100%); max-height: min(84vh, 760px); display: flex; flex-direction: column; background: var(--paper); border: 3px solid var(--ink); clip-path: var(--notch); box-shadow: inset -3px -3px 0 var(--paper2), inset 3px 3px 0 #fffaf0; transform: translateY(12px); transition: transform .25s steps(4); }
#panel.on .card { transform: none; }
.card header, #map header { display: flex; align-items: center; justify-content: space-between; background: var(--accent, var(--teal)); color: var(--white); padding: 9px 10px 8px 16px; }
.card .kicker, #map .kicker { font-family: var(--label); font-size: 12px; letter-spacing: .04em; }
.x { background: var(--paper); color: var(--ink); border: 3px solid var(--ink); width: 34px; height: 32px; font-size: 14px; clip-path: var(--notch); }
.card .title { font-size: clamp(24px, 4.6vw, 32px); font-weight: 700; line-height: 1.05; margin: 16px 20px 6px; letter-spacing: -.01em; }
.card .body { overflow-y: auto; padding: 4px 20px 6px; font-size: 16.5px; line-height: 1.5; scrollbar-color: var(--ink2) var(--paper2); }
.card footer { font-family: var(--label); font-size: 11px; color: var(--paper3); padding: 8px 20px 12px; text-align: right; }
.card footer .esc { border: 2px solid var(--paper3); padding: 0 4px; }
.card[data-accent="teal"] { --accent: var(--teal); } .card[data-accent="blue"] { --accent: var(--blue); } .card[data-accent="navy"] { --accent: var(--navy); }
.card[data-accent="violet"] { --accent: var(--violet); } .card[data-accent="red"] { --accent: var(--red); } .card[data-accent="gold"] { --accent: var(--gold); }
.card[data-accent="green"] { --accent: var(--green); } .card[data-accent="brown"] { --accent: var(--brown); } .card[data-accent="brick"] { --accent: var(--brick); }
.body p { margin: .4em 0 .8em; }
.body .lead { font-size: 18.5px; line-height: 1.45; }
.body ul { list-style: none; padding: 0; margin: .4em 0 .8em; }
.body li { position: relative; padding-left: 20px; margin: .45em 0; }
.body li::before { content: ''; position: absolute; left: 3px; top: .55em; width: 7px; height: 7px; background: var(--accent, var(--teal)); box-shadow: 1px 1px 0 var(--ink); }
.body em { font-style: italic; }
.body b { font-weight: 700; }
.meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; font-family: var(--label); font-size: 12px; color: var(--ink2); padding: 8px 0 6px; border-bottom: 3px dotted var(--paper3); margin-bottom: 6px; }
.facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 14px 0; }
.facts div { background: var(--paper2); padding: 8px 10px; clip-path: var(--notch); }
.facts b { display: block; font-family: var(--label); font-size: 11px; font-weight: 400; color: var(--brown); }
.facts span { font-size: 15.5px; }
.links { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 6px; }
.links a { font-family: var(--label); font-size: 12px; text-decoration: none; color: var(--ink); background: var(--white); border: 3px solid var(--ink); padding: 7px 10px 6px; clip-path: var(--notch); }
.links a:hover { background: var(--y); }
.links.big a { font-size: 13px; padding: 10px 12px 9px; }
.aside { background: var(--paper2); padding: 10px 12px 10px 34px; position: relative; font-size: 15.5px; color: var(--ink2); clip-path: var(--notch); }
.aside::before { content: '✦'; position: absolute; left: 12px; top: 9px; color: var(--gold); }
.skills { display: grid; grid-template-columns: max-content 1fr; gap: 10px 16px; margin: 8px 0 12px; }
.skills dt { font-family: var(--label); font-size: 12px; color: var(--brown); padding-top: 3px; }
.skills dd { margin: 0; }

/* minigame bits */
canvas.mri, canvas.scope { display: block; margin: 8px auto 12px; width: min(280px, 70vw); height: auto; image-rendering: pixelated; border: 3px solid var(--ink); clip-path: var(--notch); background: #000; }
canvas.scope { width: min(330px, 76vw); }
.scopeLegend { text-align: center; font-size: 15px; color: var(--ink2); }
.mriNote { font-size: 15px; color: var(--ink2); min-height: 1.4em; text-align: center; }
.body > div > .btn, .body .btn { margin: 0 auto; display: flex; width: max-content; }
.react { margin: 12px auto; width: min(320px, 80vw); height: 150px; display: grid; place-items: center; font-family: var(--label); font-size: 16px; color: var(--white); background: var(--ink2); border: 3px solid var(--ink); clip-path: var(--notch); cursor: pointer; user-select: none; text-align: center; padding: 8px; }
.react.wait { background: #8a3561; } .react.go { background: #3e7c45; }
.nback { display: flex; flex-direction: column; align-items: center; gap: 14px; margin: 10px 0; }
.nl { width: 120px; height: 120px; display: grid; place-items: center; font-size: 64px; font-weight: 700; background: var(--white); border: 3px solid var(--ink); clip-path: var(--notch); }
.nl.pop { animation: pop .3s steps(3); }
.nback .btn.hit { background: #64c4a9; }

/* draw-a-mentor */
.drawpad { display: flex; gap: 14px; align-items: flex-start; justify-content: center; flex-wrap: wrap; margin: 6px 0 4px; }
.drawpad canvas { width: min(224px, 62vw); height: auto; aspect-ratio: 1; image-rendering: pixelated; border: 3px solid var(--ink); cursor: crosshair; touch-action: none; }
.pal { display: grid; grid-template-columns: repeat(2, 30px); gap: 6px; }
.pal .sw { width: 30px; height: 30px; border: 3px solid var(--ink); padding: 0; clip-path: var(--notch); }
.pal .sw.on { outline: 3px solid var(--gold); outline-offset: -9px; box-shadow: inset 0 0 0 3px var(--white); }
.body .row { display: flex; gap: 10px; justify-content: center; margin: 8px 0 4px; }
.body .row .btn { margin: 0; }
/* echo: a posterior, drawn as bars */
.bars { display: grid; gap: 6px; margin: 12px 0; }
.bar { display: grid; grid-template-columns: 112px 1fr 44px; align-items: center; gap: 10px; font-size: 15px; }
.bar span { font-family: var(--label); font-size: 11px; color: var(--ink2); }
.bar i { display: block; height: 12px; width: var(--w); background: var(--paper3); box-shadow: inset 0 -3px 0 rgba(43,33,53,.2); }
.bar.top i { background: #8664b6; } .bar.top span { color: var(--ink); }
.bar b { text-align: right; font-weight: 600; }
.cast { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 10px 0 12px; }
.cast canvas { width: 32px; height: 40px; image-rendering: pixelated; }
.cast .you { position: relative; padding: 0 4px; background: #b698df; clip-path: var(--notch); }
.cast .you::after { content: 'you'; position: absolute; left: 0; right: 0; bottom: -2px; text-align: center; font-family: var(--label); font-size: 9px; color: var(--ink); }

/* ---------- map ---------- */
#map .sheet { width: min(980px, 100%); max-height: 92vh; overflow: auto; background: var(--paper); border: 3px solid var(--ink); clip-path: var(--notch); display: grid; grid-template-columns: 1fr 230px; grid-template-rows: auto auto 1fr; }
#map header { grid-column: 1 / 3; --accent: var(--sea); }
.mapwrap { position: relative; margin: 14px 0 0 14px; border: 3px solid var(--ink); align-self: start; line-height: 0; }
.mapwrap canvas { width: 100%; height: auto; image-rendering: pixelated; }
.labels { position: absolute; inset: 0; }
.pin { position: absolute; transform: translate(-50%, -100%); font-family: var(--label); font-size: 10px; line-height: 1; white-space: nowrap; background: var(--paper); border: 2px solid var(--ink); padding: 3px 5px 2px; }
.pin:hover { background: var(--y); z-index: 2; }
.mapnote { grid-column: 1; margin: 8px 14px 14px; font-size: 14px; color: var(--ink2); }
.journal { grid-column: 2; grid-row: 2 / 4; padding: 14px; }
.journal h3 { margin: 0 0 8px; font-family: var(--label); font-size: 13px; font-weight: 400; }
.journal h3 b { color: var(--gold); }
.journal ul { list-style: none; padding: 0; margin: 0; font-size: 14px; display: grid; gap: 3px; }
.journal li { color: var(--paper3); letter-spacing: .1em; }
.journal li.got { color: var(--ink); letter-spacing: 0; }

/* ---------- recruiter mode ---------- */
#cv { position: fixed; inset: 0; z-index: 40; background: #efe4c8; overflow-y: auto; opacity: 0; visibility: hidden; transition: opacity .25s, visibility .25s; }
#cv.on { opacity: 1; visibility: visible; }
#cv > .x { position: fixed; top: 14px; right: 14px; z-index: 2; }
#cv .doc { max-width: 780px; margin: 0 auto; padding: 56px 28px 80px; font-family: var(--serif); font-size: 17.5px; line-height: 1.55; color: #241c2c; }
#cv .top h1 { font-family: var(--ui); font-size: clamp(38px, 7vw, 58px); font-weight: 700; margin: 0; letter-spacing: -.01em; }
#cv .top p { margin: 6px 0; }
#cv .top .contact { font-size: 16px; }
#cv .dl { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
#cv section { margin-top: 34px; }
#cv h2 { font-family: var(--label); font-weight: 400; font-size: 14px; letter-spacing: .08em; text-transform: uppercase; color: var(--brick); border-bottom: 3px solid var(--ink); padding-bottom: 6px; margin: 0 0 12px; }
#cv article { margin: 14px 0 18px; }
#cv article header { display: flex; justify-content: space-between; gap: 4px 16px; flex-wrap: wrap; align-items: baseline; }
#cv h3 { font-family: var(--ui); font-size: 19px; margin: 0; font-weight: 600; }
#cv article header span { font-size: 14.5px; color: #5a4a5e; font-style: italic; }
#cv .role { margin: 2px 0 4px; font-style: italic; }
#cv ul { margin: 6px 0; padding-left: 20px; }
#cv li { margin: 4px 0; }
#cv dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
#cv dt { font-family: var(--label); font-size: 12px; padding-top: 5px; color: var(--brick); }
#cv dd { margin: 0; }
#cv .foot { margin-top: 44px; font-family: var(--ui); font-size: 15px; color: #7a6a6e; text-align: center; }

/* ---------- phone controls ---------- */
:root { --pxround: polygon(32% 0, 68% 0, 68% 5%, 82% 5%, 82% 11%, 89% 11%, 89% 18%, 95% 18%, 95% 32%, 100% 32%, 100% 68%, 95% 68%, 95% 82%, 89% 82%, 89% 89%, 82% 89%, 82% 95%, 68% 95%, 68% 100%, 32% 100%, 32% 95%, 18% 95%, 18% 89%, 11% 89%, 11% 82%, 5% 82%, 5% 68%, 0 68%, 0 32%, 5% 32%, 5% 18%, 11% 18%, 11% 11%, 18% 11%, 18% 5%, 32% 5%); }
#pad { display: none; }
body.touch.playing #pad { display: block; }
body.touch.playing #pad.hide { display: none; }
#pad .joy { position: fixed; left: calc(16px + env(safe-area-inset-left)); bottom: calc(20px + env(safe-area-inset-bottom)); width: 128px; height: 128px; z-index: 12; touch-action: none; }
#pad .joy .base, #pad .joy .base::after, #pad .knob, #pad .knob::after, #pad .a, #pad .a::before, #pad .b, #pad .b::before { clip-path: var(--pxround); }
#pad .joy .base { position: absolute; inset: 0; background: rgba(43,33,53,.55); }
#pad .joy .base::after { content: ''; position: absolute; inset: 3px; background: rgba(246,234,208,.28); }
#pad .knob { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; background: var(--ink); pointer-events: none; }
#pad .knob::after { content: ''; position: absolute; inset: 3px; background: var(--paper); box-shadow: inset -4px -4px 0 var(--paper3); }
#pad .btns { position: fixed; right: calc(16px + env(safe-area-inset-right)); bottom: calc(22px + env(safe-area-inset-bottom)); z-index: 12; display: flex; align-items: flex-end; gap: 12px; }
#pad .a, #pad .b { position: relative; border: 0; padding: 0; background: var(--ink); touch-action: manipulation; -webkit-user-select: none; user-select: none; }
#pad .a::before, #pad .b::before { content: ''; position: absolute; inset: 3px; z-index: -1; }
#pad .a { width: 82px; height: 82px; isolation: isolate; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; font-family: var(--label); color: var(--ink); }
#pad .a::before { background: var(--y); box-shadow: inset -4px -4px 0 #d6892c, inset 4px 4px 0 #fdf0b4; }
#pad .a .k { font-size: 24px; line-height: 1; }
#pad .a .l { font-size: 9px; line-height: 1; max-width: 70px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#pad .a.idle::before { background: var(--paper); box-shadow: inset -4px -4px 0 var(--paper3); }
#pad .a.idle { opacity: .7; }
#pad .a.down { transform: translateY(2px); }
#pad .b { width: 52px; height: 52px; isolation: isolate; margin-bottom: 44px; font-family: var(--label); font-size: 10px; color: var(--ink); }
#pad .b::before { background: var(--paper); box-shadow: inset -3px -3px 0 var(--paper3); }
#pad .b.on::before { background: #64c4a9; box-shadow: inset -3px -3px 0 #33988a; }

#fade { position: fixed; inset: 0; background: var(--ink); opacity: 0; pointer-events: none; transition: opacity .4s; z-index: 35; }
#fade.on { opacity: 1; }

@media (max-width: 720px) {
  #zone { font-size: 10px; padding: 7px 9px 6px; max-width: 46vw; }
  #hud { gap: 4px; } #hud button { height: 34px; min-width: 32px; padding: 0 7px; font-size: 10px; }
  #hud [data-help] { display: none; }
  #dlg { padding: 12px 12px 14px; grid-template-columns: 1fr; }
  #dlg .portrait { display: none !important; }
  #dlg .text { font-size: 16.5px; } #dlg .choices { grid-column: 1; } #dlg .choice { font-size: 16px; }
  #map .sheet { grid-template-columns: 1fr; } .journal { grid-column: 1; grid-row: auto; } .mapwrap { margin: 10px; }
  .facts { grid-template-columns: 1fr; }
  #toast { top: 56px; font-size: 14px; }
}
@media (hover: none) { .card footer { display: none; } }
@media (prefers-reduced-motion: reduce) { #logo, #title .press, #dlg .next.on { animation: none; } }
