/* Vibecoding ile oyun geliştirme — oyun.oktaydak.com
   The guide plays like a handheld game: a title screen, levels in order, a HUD that
   fills as you read, quests that award badges. The memorable part is the dialogue
   boxes: real prompts and agent replies, RPG style. Everything else stays quiet. */

:root {
  --paper: #f6f5ff;
  --paper-2: #ecebfb;
  --ink: #1b1640;
  --ink-2: #4a4573;
  --ink-3: #7c78a3;
  --line: #d6d3f0;
  --blue: #3d5afe;
  --coin: #ffc928;
  --boss: #ff4f8b;
  --mint: #19c39a;
  /* Each game wears its own colour. */
  --pixel: #19c39a;
  --elevator: #ffc928;
  --after: #ff4f8b;

  --display: "Pixelify Sans", ui-monospace, monospace;
  --text: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", system-ui, sans-serif;
  --mono: "Spline Sans Mono", ui-monospace, monospace;

  --step: 4px;             /* the pixel grid everything snaps to */
  --hud: 288px;
  --measure: 68ch;
  --shadow: 4px 4px 0 var(--ink);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--text); font-size: 18px; line-height: 1.62; text-rendering: optimizeLegibility; }
img { max-width: 100%; display: block; }
a { color: var(--blue); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
::selection { background: var(--coin); color: var(--ink); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 50; padding: 10px 14px; background: var(--ink); color: var(--paper); font-family: var(--display); }
.skip:focus { top: 12px; }

/* ------------------------------------------------------------------ title screen */
.title {
  position: relative; min-height: 100vh; min-height: 100svh; display: grid; place-items: center;
  padding: 56px 20px; background: var(--ink); color: var(--paper); overflow: hidden;
}
/* A faint scanline and pixel grid, like a lit LCD. */
.title::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(rgba(246,245,255,.04) 1px, transparent 1px) 0 0 / 100% 4px,
    radial-gradient(ellipse at 50% 38%, rgba(61,90,254,.35), transparent 60%);
}
.title__inner { position: relative; width: min(920px, 100%); text-align: center; }
.title__kicker { margin: 0 0 20px; font-family: var(--display); font-size: 18px; color: var(--coin); }
.title h1 {
  margin: 0; font-family: var(--display); font-weight: 700; font-size: clamp(46px, 9.2vw, 112px);
  line-height: .92; letter-spacing: -.01em;
  /* A hard, stepped drop shadow: the one place the type gets loud. */
  text-shadow: 4px 4px 0 var(--blue), 8px 8px 0 var(--boss);
}
.title__lead { max-width: 40ch; margin: 30px auto 0; color: #cfcbf2; font-size: 20px; line-height: 1.5; }

.carts { display: flex; justify-content: center; gap: clamp(14px, 3vw, 28px); margin: 48px 0 0; padding: 0; list-style: none; }
.cart {
  --c: var(--blue);
  position: relative; width: clamp(92px, 20vw, 150px); padding: 12px 12px 14px;
  background: var(--paper); color: var(--ink); border: 4px solid var(--ink); box-shadow: 0 0 0 4px var(--c), 8px 8px 0 4px var(--c);
  text-align: left; transform: translateY(16px); opacity: 0;
  animation: cart-in .7s steps(6) forwards; animation-delay: calc(.35s + var(--i) * .18s);
}
.cart img { width: 100%; aspect-ratio: 1; image-rendering: auto; border: 3px solid var(--ink); }
.cart b { display: block; margin-top: 10px; font-family: var(--display); font-size: clamp(13px, 1.7vw, 17px); line-height: 1.1; }
.cart small { display: block; margin-top: 4px; color: var(--ink-3); font-size: 13px; line-height: 1.3; }
.cart--pixel { --c: var(--pixel); }
.cart--elevator { --c: var(--elevator); }
.cart--after { --c: var(--after); }
@keyframes cart-in { to { transform: none; opacity: 1; } }

.press {
  display: inline-flex; align-items: center; gap: 12px; margin-top: 56px; padding: 16px 26px;
  background: var(--coin); color: var(--ink); border: 4px solid var(--paper); box-shadow: 6px 6px 0 var(--boss);
  font-family: var(--display); font-size: 22px; text-decoration: none;
  transition: transform .12s steps(2), box-shadow .12s steps(2);
}
.press:hover { color: var(--ink); transform: translate(3px, 3px); box-shadow: 3px 3px 0 var(--boss); }
.press i { width: 0; height: 0; border-left: 12px solid currentColor; border-top: 8px solid transparent; border-bottom: 8px solid transparent; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.title__meta { margin: 28px 0 0; color: var(--ink-3); font-size: 15px; }
.title__meta a { color: #cfcbf2; }

/* ------------------------------------------------------------------ frame: HUD + main */
.frame { display: grid; grid-template-columns: var(--hud) minmax(0, 1fr); align-items: start; }
.hud {
  position: sticky; top: 0; height: 100vh; height: 100svh; overflow-y: auto; padding: 24px 20px 28px;
  border-right: 4px solid var(--ink); background: var(--paper-2); display: flex; flex-direction: column; gap: 22px;
}
.hud__body { display: flex; flex-direction: column; gap: 22px; flex: 1; min-height: 0; }
.hud__player { display: grid; grid-template-columns: 48px 1fr; gap: 12px; align-items: center; }
.hud__player canvas, .hud__player svg { width: 48px; height: 48px; border: 3px solid var(--ink); background: var(--paper); image-rendering: pixelated; }
.hud__player b { display: block; font-family: var(--display); font-size: 17px; line-height: 1.1; }
.hud__player span { color: var(--ink-2); font-size: 14px; }
.xp { display: grid; gap: 6px; }
.xp__row { display: flex; justify-content: space-between; font-family: var(--display); font-size: 15px; }
.xp__bar { height: 18px; border: 3px solid var(--ink); background: var(--paper); padding: 2px; }
.xp__fill { height: 100%; width: 0; background: repeating-linear-gradient(90deg, var(--blue) 0 8px, #6a80ff 8px 12px); transition: width .4s steps(8); }

.levels { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.levels a {
  display: grid; grid-template-columns: 34px 1fr 18px; gap: 8px; align-items: center; padding: 7px 8px;
  border: 3px solid transparent; color: var(--ink-2); text-decoration: none; font-size: 15px; line-height: 1.25;
}
.levels a:hover { background: var(--paper); color: var(--ink); }
.levels .n { font-family: var(--display); font-size: 14px; text-align: center; padding: 2px 0; border: 2px solid currentColor; }
.levels .s { width: 14px; height: 14px; justify-self: end; }
.levels li[data-state="done"] .s { background: var(--mint); box-shadow: inset 0 0 0 2px var(--ink); }
.levels li[data-state="here"] a { border-color: var(--ink); background: var(--paper); color: var(--ink); font-weight: 700; }
.levels li[data-state="here"] .n { background: var(--coin); border-color: var(--ink); }
.levels li[data-state="todo"] .s { border: 2px dashed var(--ink-3); }

.badges h2 { margin: 0 0 10px; font-family: var(--display); font-size: 16px; font-weight: 600; }
.badges ul { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 0; padding: 0; list-style: none; }
.badge { aspect-ratio: 1; display: grid; place-items: center; border: 3px solid var(--line); background: var(--paper); font-family: var(--display); font-size: 15px; color: var(--line); }
.badge.is-won { border-color: var(--ink); background: var(--coin); color: var(--ink); box-shadow: 2px 2px 0 var(--ink); }
.badge.is-won.pop { animation: pop .5s steps(4); }
@keyframes pop { 0% { transform: scale(.4); } 60% { transform: scale(1.25); } 100% { transform: none; } }
.hud__foot { margin-top: auto; color: var(--ink-3); font-size: 13px; line-height: 1.45; }
.hud__foot button { margin-top: 8px; padding: 4px 8px; border: 2px solid var(--ink-3); background: none; color: var(--ink-2); font: inherit; cursor: pointer; }

.hud-toggle { display: none; }

/* ------------------------------------------------------------------ levels (main column) */
main { min-width: 0; }
.level { padding: 96px clamp(20px, 6vw, 88px) 72px; border-bottom: 4px solid var(--ink); }
.level:nth-of-type(even) { background: #fbfaff; }
.level > * { max-width: var(--measure); }
.level__head { display: grid; grid-template-columns: auto 1fr; gap: 6px 18px; align-items: end; max-width: 860px; margin-bottom: 32px; }
.level__no {
  grid-row: span 2; display: grid; place-items: center; width: 84px; height: 84px; background: var(--ink); color: var(--paper);
  font-family: var(--display); font-size: 40px; line-height: 1; box-shadow: 6px 6px 0 var(--blue);
}
.level__no small { display: block; font-size: 12px; color: var(--coin); margin-bottom: 2px; }
.level__name { margin: 0; color: var(--ink-2); font-family: var(--display); font-size: 18px; }
.level h2 { margin: 0; font-family: var(--display); font-weight: 700; font-size: clamp(34px, 4.6vw, 58px); line-height: 1; letter-spacing: -.01em; }
.level--boss .level__no { background: var(--boss); box-shadow: 6px 6px 0 var(--ink); }

.goal { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 0 0 32px; padding: 14px 16px; border: 3px solid var(--ink); background: var(--paper); font-size: 16px; }
.goal b { font-family: var(--display); font-weight: 600; }

.level h3 { margin: 48px 0 12px; font-family: var(--display); font-weight: 600; font-size: 26px; line-height: 1.15; }
.level p { margin: 0 0 18px; }
.level ul:not([class]), .level ol:not([class]) { padding-left: 22px; margin: 0 0 20px; }
.level li { margin-bottom: 6px; }
.lead { font-size: 21px; line-height: 1.55; color: var(--ink); }
code { font-family: var(--mono); font-size: .86em; padding: 1px 5px; background: var(--paper-2); border: 1px solid var(--line); }

/* Commands */
.term { max-width: 760px; margin: 22px 0 26px; border: 3px solid var(--ink); background: var(--ink); color: #e9e7ff; box-shadow: var(--shadow); }
.term__bar { display: flex; justify-content: space-between; padding: 6px 12px; background: #2a2459; font-family: var(--display); font-size: 14px; color: #b9b4e8; }
.term pre { margin: 0; padding: 14px 16px; overflow-x: auto; font-family: var(--mono); font-size: 14.5px; line-height: 1.6; }
.term .c { color: #8f89c4; }
.term .p { color: var(--coin); user-select: none; }

/* ------------------------------------------------------------------ the dialogue box */
.talk { max-width: 780px; margin: 28px 0 32px; display: grid; gap: 14px; }
.say { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 14px; align-items: start; }
.say__face { width: 64px; height: 64px; border: 3px solid var(--ink); background: var(--paper); image-rendering: pixelated; }
.say__box {
  position: relative; padding: 14px 18px 16px; background: #fff; border: 3px solid var(--ink); box-shadow: var(--shadow);
}
/* The double frame of a handheld RPG text box. */
.say__box::before { content: ""; position: absolute; inset: 3px; border: 2px solid var(--line); pointer-events: none; }
.say__who { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; margin-bottom: 6px; font-family: var(--display); font-size: 16px; }
.say__who em { font-style: normal; font-family: var(--text); font-size: 13px; color: var(--ink-3); }
.say__text { margin: 0; font-size: 18px; line-height: 1.55; white-space: pre-line; }
.say--me .say__box { background: #fffbe8; }
.say--agent .say__box { background: #fff; }
.say--agent .say__who { color: var(--blue); }
.say__box .more { position: absolute; right: 12px; bottom: 6px; width: 0; height: 0; border-top: 8px solid var(--ink); border-left: 6px solid transparent; border-right: 6px solid transparent; animation: blink 1.1s steps(1) infinite; }
.tag { display: inline-block; padding: 0 6px; border: 2px solid var(--ink); font-family: var(--display); font-size: 13px; line-height: 1.5; }
.tag--pixel { background: var(--pixel); }
.tag--elevator { background: var(--elevator); }
.tag--after { background: var(--after); }
.tag--all { background: var(--paper-2); }

/* ------------------------------------------------------------------ boss fight: what broke */
.boss { max-width: 780px; margin: 30px 0; border: 3px solid var(--ink); background: #fff; box-shadow: 6px 6px 0 var(--boss); }
.boss__head { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 10px 16px; background: var(--boss); color: var(--ink); border-bottom: 3px solid var(--ink); font-family: var(--display); font-size: 18px; }
.boss__hp { display: flex; gap: 3px; }
.boss__hp i { width: 12px; height: 12px; background: var(--ink); }
.boss__hp i.lost { background: transparent; box-shadow: inset 0 0 0 2px var(--ink); }
.boss__body { display: grid; grid-template-columns: 1fr 1fr; }
.boss__body > div { padding: 14px 16px; }
.boss__body > div + div { border-left: 3px dashed var(--line); }
.boss__body h4 { margin: 0 0 6px; font-family: var(--display); font-weight: 600; font-size: 16px; }
.boss__body p { margin: 0; font-size: 16.5px; line-height: 1.55; }

/* ------------------------------------------------------------------ inventory tables */
.inv { width: 100%; max-width: 860px; margin: 22px 0 28px; border-collapse: collapse; border: 3px solid var(--ink); background: #fff; font-size: 16px; }
.inv th, .inv td { padding: 10px 12px; text-align: left; vertical-align: top; border-bottom: 2px solid var(--line); }
.inv th { background: var(--ink); color: var(--paper); font-family: var(--display); font-weight: 500; font-size: 15px; }
.inv td:first-child { font-weight: 700; }
.inv .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.inv-wrap { overflow-x: auto; }

/* Tip / warning callouts, kept to two kinds. */
.note { max-width: var(--measure); margin: 24px 0; padding: 14px 16px 14px 56px; position: relative; border: 3px solid var(--ink); background: #eefcf7; }
.note::before { content: "i"; position: absolute; left: 14px; top: 14px; width: 28px; height: 28px; display: grid; place-items: center; background: var(--mint); border: 3px solid var(--ink); font-family: var(--display); font-weight: 700; font-size: 18px; line-height: 1; }
.note--warn { background: #fff0f5; }
.note--warn::before { content: "!"; background: var(--boss); }
.note p:last-child { margin: 0; }

/* ------------------------------------------------------------------ quests */
.quest { max-width: 780px; margin: 40px 0 0; border: 4px solid var(--ink); background: var(--paper); box-shadow: var(--shadow); }
.quest__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 16px; background: var(--coin); border-bottom: 4px solid var(--ink); font-family: var(--display); font-size: 19px; }
.quest__head span { font-size: 15px; }
.quest ul { margin: 0; padding: 8px 16px 12px; list-style: none; }
.quest li { margin: 0; }
.quest label { display: grid; grid-template-columns: 26px 1fr; gap: 12px; align-items: start; padding: 8px 0; cursor: pointer; font-size: 17px; line-height: 1.45; }
.quest input { appearance: none; width: 22px; height: 22px; margin: 2px 0 0; border: 3px solid var(--ink); background: #fff; cursor: pointer; display: grid; place-items: center; }
.quest input:checked { background: var(--mint); }
.quest input:checked::after { content: ""; width: 6px; height: 10px; border: solid var(--ink); border-width: 0 3px 3px 0; transform: translateY(-1px) rotate(45deg); }
.quest input:checked + span { color: var(--ink-3); text-decoration: line-through; text-decoration-thickness: 2px; }
.quest.is-done .quest__head { background: var(--mint); }

/* ------------------------------------------------------------------ game select (the three games) */
.roster { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; max-width: 980px; margin: 28px 0 10px; }
.unit { --c: var(--blue); border: 3px solid var(--ink); background: #fff; box-shadow: 6px 6px 0 var(--c); display: flex; flex-direction: column; }
.unit--pixel { --c: var(--pixel); }
.unit--elevator { --c: var(--elevator); }
.unit--after { --c: var(--after); }
.unit header { display: grid; grid-template-columns: 56px 1fr; gap: 12px; align-items: center; padding: 12px; border-bottom: 3px solid var(--ink); background: var(--c); }
.unit header img { width: 56px; height: 56px; border: 3px solid var(--ink); }
.unit h3 { margin: 0; font-size: 20px; }
.unit header p { margin: 0; font-size: 14px; line-height: 1.3; }
.unit dl { margin: 0; padding: 12px; display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 15px; }
.unit dt { font-family: var(--display); color: var(--ink-2); }
.unit dd { margin: 0; }
.unit .stat { display: flex; gap: 2px; }
.unit .stat i { width: 10px; height: 12px; background: var(--c); box-shadow: inset 0 0 0 2px var(--ink); }
.unit .stat i.off { background: transparent; box-shadow: inset 0 0 0 2px var(--line); }
.unit footer { margin-top: auto; padding: 0 12px 12px; font-size: 15px; }

/* ------------------------------------------------------------------ metrics (sample data for now) */
.sample {
  position: relative; max-width: 900px; margin: 26px 0; padding: 18px; border: 3px dashed var(--ink);
  background: repeating-linear-gradient(-45deg, #fff 0 14px, #f4f2ff 14px 28px);
}
.sample__flag { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 16px; padding: 4px 10px; background: var(--ink); color: var(--coin); font-family: var(--display); font-size: 16px; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0 0 16px; }
.kpi { padding: 12px; border: 3px solid var(--ink); background: #fff; }
.kpi dt { font-size: 14px; color: var(--ink-2); }
.kpi dd { margin: 4px 0 0; font-family: var(--display); font-size: 30px; line-height: 1; }
.kpi dd small { display: block; margin-top: 6px; font-family: var(--text); font-size: 13px; color: var(--ink-3); }
.bars { display: grid; gap: 8px; margin: 0; padding: 12px; border: 3px solid var(--ink); background: #fff; }
.bars figcaption { font-family: var(--display); font-size: 16px; margin-bottom: 4px; }
.bar { display: grid; grid-template-columns: 140px 1fr 60px; gap: 10px; align-items: center; font-size: 15px; }
.bar__track { height: 18px; border: 2px solid var(--ink); }
.bar__track i { display: block; height: 100%; background: var(--c, var(--blue)); }
.bar b { font-family: var(--display); font-weight: 500; text-align: right; }

/* ------------------------------------------------------------------ ending */
.ending { padding: 96px clamp(20px, 6vw, 88px); background: var(--ink); color: var(--paper); }
.ending > * { max-width: var(--measure); }
.ending h2 { margin: 0 0 18px; font-family: var(--display); font-size: clamp(36px, 5vw, 64px); line-height: 1; text-shadow: 4px 4px 0 var(--blue); }
.ending a { color: var(--coin); }
.credits { margin-top: 40px; color: #b9b4e8; font-size: 15px; }

/* ------------------------------------------------------------------ toast */
.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 40; display: grid; grid-template-columns: 44px 1fr; gap: 12px; align-items: center;
  max-width: 320px; padding: 12px 14px; background: var(--ink); color: var(--paper); border: 3px solid var(--coin); box-shadow: 6px 6px 0 var(--boss);
  transform: translateY(24px); opacity: 0; visibility: hidden; transition: transform .35s steps(5), opacity .2s, visibility 0s .35s;
}
.toast.is-on { transform: none; opacity: 1; visibility: visible; transition: transform .35s steps(5), opacity .2s; }
.toast .badge { width: 44px; }
.toast b { display: block; font-family: var(--display); font-size: 16px; color: var(--coin); }
.toast span { font-size: 14px; }

/* ------------------------------------------------------------------ phones */
@media (max-width: 980px) {
  .frame { grid-template-columns: 1fr; }
  .hud {
    position: fixed; inset: auto 0 0 0; z-index: 30; height: auto; max-height: 80vh; transform: translateY(calc(100% - 58px));
    border-right: 0; border-top: 4px solid var(--ink); padding: 0 16px; overflow: hidden; transition: transform .3s steps(5);
  }
  .hud__body { max-height: calc(80vh - 58px); overflow-y: auto; padding-bottom: 20px; }
  .hud:not(.is-open) .hud__body { visibility: hidden; }
  .hud.is-open { transform: none; box-shadow: 0 -12px 0 rgba(27,22,64,.12); }
  .hud-toggle {
    flex: none; display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; height: 54px; margin: 0 -16px; padding: 0 16px;
    border: 0; border-bottom: 3px solid var(--ink); background: var(--coin); color: var(--ink); font-family: var(--display); font-size: 16px; text-align: left; cursor: pointer;
  }
  .hud-toggle .xp__bar { height: 14px; padding: 1px; }
  .hud__player { padding-top: 16px; }
  .level { padding: 64px 18px 56px; }
  body { padding-bottom: 58px; }
  .roster { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toast { bottom: 76px; left: 16px; right: 16px; max-width: none; }
}
@media (max-width: 620px) {
  body { font-size: 17px; }
  .level__head { grid-template-columns: 1fr; }
  .level__no { grid-row: auto; width: 64px; height: 64px; font-size: 30px; }
  .say { grid-template-columns: 44px minmax(0, 1fr); gap: 10px; }
  .say__face { width: 44px; height: 44px; }
  .boss__body { grid-template-columns: 1fr; }
  .boss__body > div + div { border-left: 0; border-top: 3px dashed var(--line); }
  .bar { grid-template-columns: 96px 1fr 48px; }
  .carts { gap: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .cart { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}
