/* Designsprache „Kino“ – siehe DESIGN.md */
:root {
  --ink: #03050b;
  --ground: #070b16;
  --surface: #0c1222;
  --surface-raised: #111a2e;
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: #e8edf6;
  --muted: #8c97ad;
  --amber: #ffb547;
  --amber-hover: #ffc56e;
  --cyan: #4fd6ff;
  --danger: #ff6b4a;
  --radius: 10px;
  --radius-small: 4px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --font-display: "Sora", "Inter", system-ui, sans-serif;
  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --nav-height: 60px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--ink);
}

body {
  margin: 0;
  min-height: 100svh;
  font-family: var(--font-ui);
  color: var(--text);
  background: radial-gradient(120% 70% at 50% 0%, #0b1328 0%, var(--ink) 62%) fixed, var(--ink);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
}

button {
  font: inherit;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

kbd {
  display: inline-block;
  min-width: 1.7em;
  padding: 0.1em 0.4em;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-small);
  font-family: var(--font-ui);
  font-size: 0.8em;
  font-weight: 600;
  text-align: center;
  color: var(--text);
  background: var(--surface-raised);
}

.eyebrow,
.overlay-kicker {
  margin: 0;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

/* ---------- Buttons ---------- */

.btn,
.btn-play,
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: var(--radius);
  font-family: var(--font-ui);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 180ms var(--ease), border-color 180ms var(--ease), color 180ms var(--ease),
    transform 180ms var(--ease);
}

.btn {
  min-height: 46px;
  padding: 0.7rem 1.3rem;
  border: 1px solid transparent;
}

.btn-primary,
.btn-play {
  border: 1px solid var(--amber);
  background: var(--amber);
  color: #1a1204;
}

.btn-primary:hover,
.btn-play:hover {
  background: var(--amber-hover);
  border-color: var(--amber-hover);
}

.btn-play {
  width: 100%;
  min-height: 52px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: 0.01em;
}

.btn-play:active,
.btn:active,
.btn-ghost:active {
  transform: translateY(1px);
}

.btn-ghost {
  min-height: 42px;
  padding: 0.5rem 1.1rem;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text);
}

.btn-ghost:hover {
  border-color: rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.04);
}

/* ---------- Spielbühne ---------- */

.play {
  width: min(100% - 1.5rem, 1180px);
  margin: 0 auto;
  display: grid;
  gap: 0.75rem;
  padding-bottom: 1rem;
}

.play-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 1.1rem;
  padding-top: 0.6rem;
}

.play-header .eyebrow {
  flex-basis: 100%;
}

.play-header h1 {
  margin: 0;
  font-size: clamp(1.7rem, 4.5vw, 2.5rem);
  font-weight: 700;
  line-height: 1;
}

.play-lead {
  margin: 0;
  color: var(--muted);
  font-size: clamp(0.95rem, 2.2vw, 1.02rem);
}

.stage {
  position: relative;
  height: clamp(520px, calc(100svh - var(--nav-height) - 7rem), 980px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--ink);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.stage:fullscreen,
.stage:-webkit-full-screen {
  height: 100vh;
  border-radius: 0;
  border: 0;
}

.stage-canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
}

.stage-toolbar {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  display: flex;
  gap: 0.35rem;
  z-index: 3;
}

.tool-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: color 180ms var(--ease), border-color 180ms var(--ease);
}

.tool-btn:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.tool-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tool-btn.is-muted .sound-wave {
  opacity: 0.15;
}

.stage:not([data-state="playing"]) [data-action="pause"] {
  visibility: hidden;
}

/* Menüs über dem Spielfeld: ruhige Abdunklung, deckende Karte */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(3, 5, 11, 0.62);
  animation: overlayIn 240ms var(--ease) both;
}

.overlay[hidden] {
  display: none;
}

.overlay-card {
  position: relative;
  width: min(100%, 420px);
  display: grid;
  gap: 0.9rem;
  justify-items: center;
  padding: clamp(1.3rem, 4vw, 2rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: center;
  animation: cardIn 320ms var(--ease) both;
}

/* Eckmarken wie im Spielfeld */
.overlay-card::before,
.overlay-card::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border: 0 solid var(--amber);
  pointer-events: none;
}

.overlay-card::before {
  top: -5px;
  left: -5px;
  border-top-width: 1.5px;
  border-left-width: 1.5px;
}

.overlay-card::after {
  right: -5px;
  bottom: -5px;
  border-right-width: 1.5px;
  border-bottom-width: 1.5px;
}

.overlay-title {
  margin: 0;
  font-size: clamp(1.9rem, 6vw, 2.6rem);
  font-weight: 700;
  line-height: 1.05;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.overlay-text,
.overlay-best,
.overlay-hint {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.92rem;
}

.overlay-best {
  color: var(--amber);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.overlay-hint {
  font-size: 0.8rem;
  line-height: 1.9;
}

.overlay-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.segmented {
  display: flex;
  width: 100%;
  padding: 3px;
  gap: 3px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--ground);
}

.segmented button {
  flex: 1;
  min-height: 38px;
  padding: 0.4rem 0.4rem;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background-color 180ms var(--ease), color 180ms var(--ease), border-color 180ms var(--ease);
}

.segmented button:hover {
  color: var(--text);
}

.segmented button[aria-checked="true"] {
  border-color: var(--line-strong);
  background: var(--surface-raised);
  color: var(--text);
}

.segmented button:disabled {
  opacity: 0.35;
  cursor: default;
}

.segmented-small button {
  min-height: 32px;
  font-size: 0.8rem;
}

.record-badge {
  margin: 0;
  padding: 0.25rem 0.7rem;
  border: 1px solid var(--amber);
  border-radius: var(--radius-small);
  color: var(--amber);
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.result-grid {
  width: 100%;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.result-grid div {
  padding: 0.7rem 0.3rem;
}

.result-grid div + div {
  border-left: 1px solid var(--line);
}

.result-grid dt {
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.result-grid dd {
  margin: 0.25rem 0 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}

.touch-only,
.touch-pad {
  display: none;
}

/* Touch-Bedienung */
@media (pointer: coarse) {
  .keys-only {
    display: none;
  }

  .touch-only {
    display: block;
  }

  .touch-pad {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.35rem;
  }

  .touch-pad button {
    min-height: 58px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 4px;
    padding: 0.3rem 0.1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    touch-action: manipulation;
  }

  .touch-pad svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .touch-pad button span {
    color: var(--muted);
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }

  .touch-pad button:active {
    border-color: var(--amber);
    background: var(--surface-raised);
  }

  .touch-resonance,
  .touch-resonance span {
    color: var(--cyan) !important;
  }

  .stage {
    height: clamp(440px, calc(100svh - var(--nav-height) - 9.5rem), 900px);
  }
}

/* ---------- Erklärung unter dem Spiel ---------- */

.how {
  width: min(100% - 2rem, 1180px);
  margin: 2.5rem auto 0;
}

.how h2 {
  margin: 0 0 1.2rem;
  font-size: clamp(1.4rem, 4vw, 1.9rem);
}

.how-grid {
  display: grid;
  border-top: 1px solid var(--line);
}

.how-grid article {
  padding: 1.3rem 0;
  border-bottom: 1px solid var(--line);
}

.how-grid h3 {
  margin: 0 0 0.45rem;
  font-size: 1.02rem;
}

.how-grid h3::before {
  content: attr(data-step);
  display: block;
  margin-bottom: 0.5rem;
  color: var(--amber);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
}

.how-grid p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.how-grid strong {
  color: var(--text);
  font-weight: 600;
}

@media (max-width: 520px) {
  .play-lead {
    display: none;
  }
}

@media (min-width: 760px) {
  .how-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border-bottom: 1px solid var(--line);
  }

  .how-grid article {
    padding: 1.4rem 1.6rem 1.6rem 0;
    border-bottom: 0;
  }

  .how-grid article + article {
    padding-left: 1.6rem;
    border-left: 1px solid var(--line);
  }
}

/* Mac-App: nur die Spielbühne, randlos im Fenster */
.is-mac-app body {
  background: var(--ink);
}

.is-mac-app .play {
  width: 100%;
  padding: 0;
}

.is-mac-app .stage {
  height: 100vh;
  border: 0;
  border-radius: 0;
}

@keyframes overlayIn {
  from {
    opacity: 0;
  }
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  html {
    scroll-behavior: auto;
  }
}

/* ---------- Website-Rahmen: Navigation, Downloads, Fußzeile ---------- */

.is-mac-app .site-only,
.is-mac-app [data-game-install] {
  display: none !important;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 10;
  padding: 0.6rem 1rem;
  border-radius: var(--radius);
  background: var(--amber);
  color: #1a1204;
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus-visible {
  top: 1rem;
}

.site-nav {
  width: min(100% - 2rem, 1180px);
  margin: 0 auto;
  padding: 1rem 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.site-brand img {
  border-radius: 6px;
}

.site-nav-links {
  display: flex;
  gap: 0.15rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav-links a,
.site-footer a {
  display: inline-block;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  color: var(--muted);
  font-weight: 500;
  font-size: 0.9rem;
  text-decoration: none;
  transition: color 180ms var(--ease);
}

.site-nav-links a:hover,
.site-nav-links a:focus-visible,
.site-footer a:hover,
.site-footer a:focus-visible {
  color: var(--text);
}

.downloads {
  padding: 3.5rem 1rem 2rem;
  scroll-margin-top: 1rem;
}

.downloads-inner {
  width: min(100%, 1180px);
  margin: 0 auto;
  display: grid;
  gap: 1.2rem;
}

.downloads-header h2 {
  margin: 0.5rem 0 0.4rem;
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  line-height: 1.05;
}

.downloads-header p:last-child {
  margin: 0;
  color: var(--muted);
}

.download-grid {
  display: grid;
  gap: 1rem;
}

.download-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 1rem 1.2rem;
  align-items: start;
  padding: 1.3rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.download-icon {
  width: 72px;
  height: 72px;
  border-radius: 16px;
}

.download-body h3 {
  margin: 0 0 0.4rem;
  font-size: 1.15rem;
}

.download-body p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.download-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.9rem 0 0;
  padding: 0;
  list-style: none;
}

.download-facts li {
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  color: var(--muted);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.download-btn {
  grid-column: 1 / -1;
  justify-self: stretch;
}

.download-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.install-help {
  padding: 1rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--ground);
}

.install-help summary {
  cursor: pointer;
  font-weight: 600;
  border-radius: var(--radius-small);
}

.install-help ol {
  margin: 0.9rem 0 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 0.5rem;
  color: var(--muted);
  line-height: 1.55;
}

.install-help strong {
  color: var(--text);
  font-weight: 600;
}

.install-help code {
  font-size: 0.9em;
  color: var(--amber);
}

.arcade-teaser {
  position: relative;
  display: grid;
  gap: 0.3rem;
  padding: 1.3rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(90deg, rgba(79, 214, 255, 0.06), transparent 60%), var(--surface);
  color: var(--text);
  text-decoration: none;
  transition: border-color 180ms var(--ease);
}

.arcade-teaser:hover {
  border-color: rgba(79, 214, 255, 0.45);
}

.arcade-teaser strong {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.2rem;
}

.arcade-teaser__text {
  display: grid;
  gap: 0.3rem;
}

.arcade-teaser__text > span:last-child {
  color: var(--muted);
}

.arcade-teaser__art {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.arcade-teaser__art img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius-small);
  border: 1px solid var(--line);
}

@media (min-width: 720px) {
  .arcade-teaser {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
    align-items: center;
    gap: 1.4rem;
  }
}

.arcade-teaser strong::after {
  content: " →";
  color: var(--cyan);
}

.site-footer {
  width: min(100% - 2rem, 1180px);
  margin: 0 auto;
  padding: 1.5rem 0 2rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.88rem;
}

@media (min-width: 720px) {
  .download-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .download-card {
    grid-template-rows: 1fr auto;
  }

  .download-icon {
    width: 84px;
    height: 84px;
    border-radius: 19px;
  }
}

@media (max-width: 420px) {
  .site-nav-links a {
    padding: 0.45rem 0.5rem;
    font-size: 0.85rem;
  }

  .site-brand span {
    display: none;
  }
}

/* ---------- Rechtsseiten ---------- */

.legal-page {
  width: min(100% - 2rem, 720px);
  margin: 2rem auto 3rem;
  padding: clamp(1.2rem, 4vw, 2.2rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  line-height: 1.65;
}

.legal-page h1 {
  margin-top: 0;
  font-size: clamp(1.7rem, 5vw, 2.2rem);
}

.legal-page h2 {
  margin: 1.6rem 0 0.4rem;
  font-size: 1.05rem;
}

.legal-page p {
  margin: 0;
  color: var(--muted);
}

.legal-page a {
  color: var(--amber);
}

.legal-note {
  font-size: 0.88rem;
}

.legal-page .legal-note + h2,
.legal-page p + .legal-note {
  margin-top: 1.4rem;
}
