/* games.labtoso.de · v2 · Regeln siehe STYLEGUIDE.md */
:root {
  --paper: #f1eadb;
  --paper-2: #e5dcc8;
  --ink: #221f2b;
  --ink-soft: #5f5967;
  --line: rgba(34, 31, 43, 0.18);
  --pink: #f2457f;
  --blue: #2a5fc4;
  --yellow: #f6bf31;
  --green: #139a63;
  --orange: #f2702f;
  --card: #f8f3e8;
  --grain-opacity: 0.4;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1a1820; --paper-2: #242029; --ink: #eee6d6; --ink-soft: #a39cab; --line: rgba(238, 230, 214, 0.16);
    --pink: #ff6a9c; --blue: #6f96ff; --yellow: #ffd056; --green: #3dcc8c; --orange: #ff8d58; --card: #211e27;
    --grain-opacity: 0.22; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #1a1820; --paper-2: #242029; --ink: #eee6d6; --ink-soft: #a39cab; --line: rgba(238, 230, 214, 0.16);
  --pink: #ff6a9c; --blue: #6f96ff; --yellow: #ffd056; --green: #3dcc8c; --orange: #ff8d58; --card: #211e27;
  --grain-opacity: 0.22; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 50;
  opacity: var(--grain-opacity); mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.13 0 0 0 0 0.12 0 0 0 0 0.17 0 0 0 .6 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) body::before { mix-blend-mode: screen; } }
:root[data-theme="dark"] body::before { mix-blend-mode: screen; }
a { color: inherit; }
kbd {
  font-family: var(--mono); font-size: 0.78em; color: var(--ink);
  border: 1px solid var(--ink-soft); border-bottom-width: 2px; border-radius: 3px; padding: 0 4px;
}

/* ---------- Startseite ---------- */
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.mast { padding: 40px 0 26px; border-bottom: 3px double var(--ink); }
.mast .row { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.mast h1 { font-family: var(--serif); font-weight: 700; font-size: clamp(56px, 11vw, 132px); line-height: 0.9; letter-spacing: -0.02em; margin: 0; }
.mast h1 span { color: var(--pink); }
.mast .domain { font-family: var(--mono); font-size: 13px; color: var(--ink-soft); }
.mast p { max-width: 48ch; margin: 18px 0 0; color: var(--ink-soft); }

.toc { list-style: none; margin: 0; padding: 0; }
.toc li { border-bottom: 1px solid var(--line); }
.game {
  display: grid; grid-template-columns: 1fr minmax(260px, 440px); gap: 36px; align-items: center;
  padding: 30px 0; text-decoration: none;
}
.game .no { display: block; font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; color: var(--pink); margin-bottom: 8px; }
.game h2 { font-family: var(--serif); font-weight: 700; font-size: clamp(32px, 4.4vw, 48px); line-height: 1; margin: 0 0 10px; }
.game p { margin: 0 0 12px; color: var(--ink-soft); max-width: 52ch; }
.game .meta { font-family: var(--mono); font-size: 12px; color: var(--ink-soft); display: flex; gap: 18px; flex-wrap: wrap; }
.game .meta b { color: var(--ink); font-weight: 600; }
.game .shot { position: relative; display: block; border: 2px solid var(--ink); aspect-ratio: 16 / 10; overflow: hidden; background: var(--paper-2); }
.game .shot img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.5s cubic-bezier(.2,.8,.2,1); }
.game .shot::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 0 6px var(--paper); pointer-events: none; }
.game .play { display: inline-block; margin-top: 2px; font-weight: 700; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.game:hover .shot img { transform: scale(1.035); }
.game:hover h2 { color: var(--pink); }
.game:focus-visible { outline: 3px solid var(--blue); outline-offset: 6px; }

.colophon { padding: 26px 0 48px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 14px; color: var(--ink-soft); }
.colophon a { text-underline-offset: 3px; }

@media (max-width: 820px) {
  .game { grid-template-columns: 1fr; gap: 16px; padding: 24px 0; }
  .game .shot { grid-row: 1; }
}
@media (max-width: 520px) {
  .wrap { padding: 0 16px; }
  .mast { padding-top: 28px; }
}

/* ---------- Spielseiten ---------- */
body.game-page { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; font-size: 15px; }
.bar { display: flex; align-items: center; gap: 18px; padding: 9px 16px; border-bottom: 2px solid var(--ink); }
.bar .back { text-decoration: none; font-weight: 700; white-space: nowrap; }
.bar .back:hover { text-decoration: underline; text-underline-offset: 3px; }
.bar h1 { font-family: var(--serif); font-weight: 700; font-size: 24px; margin: 0; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.mute { margin-left: auto; font: inherit; font-size: 13px; cursor: pointer; color: var(--ink-soft); background: none; border: 0; padding: 4px 2px; text-decoration: underline; text-underline-offset: 3px; }
.mute[aria-pressed="false"] { text-decoration: line-through; }
.bar .scores { display: flex; gap: 16px; white-space: nowrap; font-family: var(--mono); font-size: 13px; }
.bar .scores b { font-weight: 600; font-variant-numeric: tabular-nums; }
.stage { position: relative; flex: 1; min-height: 0; }
.stage canvas { position: absolute; inset: 0; display: block; touch-action: none; user-select: none; -webkit-user-select: none; }
.hint { padding: 7px 16px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-soft); display: flex; justify-content: space-between; gap: 12px; }

.overlay { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; background: color-mix(in srgb, var(--paper) 62%, transparent); overflow: auto; }
.overlay[hidden] { display: none; }
.overlay .card { max-width: 440px; width: 100%; background: var(--card); border: 2px solid var(--ink); padding: 26px 26px 24px; position: relative; }
.overlay .card::before { content: ""; position: absolute; left: 10px; right: 10px; top: 10px; height: 0; border-top: 1px solid var(--line); }
.overlay h2 { font-family: var(--serif); font-weight: 700; font-size: 40px; line-height: 1; margin: 8px 0 14px; }
.overlay p { margin: 0 0 18px; color: var(--ink-soft); font-size: 15px; }
.overlay p b { color: var(--ink); }
.overlay ul { margin: 10px 0 0; padding-left: 18px; }
.overlay li { margin: 3px 0; }
.btn {
  font: inherit; font-weight: 700; font-size: 15px; cursor: pointer;
  background: var(--ink); color: var(--paper); border: 2px solid var(--ink); border-radius: 0; padding: 10px 22px;
}
.btn:hover { background: var(--pink); border-color: var(--pink); color: #1a1820; }
.btn:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.overlay .extra { margin: -4px 0 18px; }
.overlay .choice { display: flex; align-items: center; gap: 0; flex-wrap: wrap; margin: 0 0 10px; font-size: 13px; }
.overlay .choice span { width: 70px; color: var(--ink-soft); }
.overlay .choice button { font: inherit; font-size: 13px; cursor: pointer; color: var(--ink); background: transparent; border: 2px solid var(--ink); margin-left: -2px; padding: 4px 12px; }
.overlay .choice button:first-of-type { margin-left: 0; }
.overlay .choice button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.overlay .shop { display: grid; gap: 6px; }
.overlay .shop.two { grid-template-columns: 1fr 1fr; max-height: 52vh; overflow: auto; }
.overlay .card:has(.shop.two) { max-width: 640px; }
.overlay .shop button {
  font: inherit; font-size: 14px; text-align: left; cursor: pointer; color: var(--ink);
  display: flex; justify-content: space-between; gap: 10px; align-items: center;
  background: var(--paper); border: 1.5px solid var(--ink); padding: 8px 12px;
}
.overlay .shop button:hover:not(:disabled) { background: var(--paper-2); }
.overlay .shop button:disabled { opacity: 0.42; cursor: default; }
.overlay .shop small { color: var(--ink-soft); display: block; font-size: 12px; }
.overlay .shop .pips { font-size: 10px; letter-spacing: 1px; color: var(--ink-soft); }

.debug-hud { position: fixed; right: 10px; bottom: 44px; z-index: 60; background: #0d0b1a; color: #6ef2c4; font: 600 11px var(--mono); padding: 5px 10px; border: 1px solid #6ef2c4; }
.debug-hud a { color: #ffc93c; }
.debug-hud kbd { color: #6ef2c4; border-color: #6ef2c4; }

@media (max-width: 640px) {
  .bar { gap: 12px; padding: 8px 12px; }
  .bar .back { font-size: 0; } .bar .back::before { content: "←"; font-size: 18px; }
  .bar h1 { font-size: 19px; }
  .hint .keys { display: none; }
  .overlay .shop.two { grid-template-columns: 1fr; }
  .overlay h2 { font-size: 32px; }
}
@media (max-width: 420px) { .bar .scores span:last-child { display: none; } }

/* ---------- Debug-Seite ---------- */
.debug { max-width: 760px; margin: 0 auto; padding: 32px 24px 60px; }
.debug h1 { font-family: var(--serif); font-weight: 700; font-size: 56px; margin: 0 0 8px; }
.debug fieldset { border: 2px solid var(--ink); margin: 22px 0; padding: 16px 18px; }
.debug legend { font-family: var(--serif); font-size: 22px; padding: 0 8px; }
.debug label { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.debug input[type="number"], .debug input[type="range"] { accent-color: var(--pink); }
.debug input[type="number"] { width: 70px; font: inherit; padding: 3px 6px; border: 1.5px solid var(--ink); background: var(--card); color: var(--ink); }
.debug .links { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.debug .links a { border: 1.5px solid var(--ink); padding: 8px 12px; text-decoration: none; font-weight: 700; }
.debug .links a:hover { background: var(--ink); color: var(--paper); }
.debug .status { font-family: var(--mono); font-size: 13px; padding: 8px 12px; background: var(--paper-2); }
.overlay .shop-head { display: flex; justify-content: center; margin: 0 0 10px; }
.overlay .ship-preview { position: static; display: block; width: 180px; height: 120px; border: 2px solid var(--ink); background: #0d0b1a; }
@media (max-height: 640px) { .overlay .ship-preview { width: 120px; height: 80px; } .overlay .shop.two { max-height: 44vh; } }
.game p.how { font-size: 15px; color: var(--ink-soft); border-left: 2px solid var(--pink); padding-left: 10px; }
.game p.how b { color: var(--ink); }
