:root {
  --paper: #ebe7dc;
  --paper-2: #f6f3ea;
  --ink: #111111;
  --muted: #5d5a52;
  --accent: #ff4d1c;
  --danger: #b3261e;
  --display: "Anton", "Impact", "Arial Narrow", sans-serif;
  --body: "Archivo", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Consolas", monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  line-height: 1.5;
  overflow-x: hidden;
}

.eyebrow,
.step,
.num,
.foot,
label,
.back {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* ---------- Startseite: passt exakt in das Fenster ---------- */
body.home {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.hero {
  flex: none;
  display: grid;
  grid-template-columns: 1fr minmax(260px, 400px);
  gap: 4px 48px;
  align-items: end;
  padding: clamp(12px, 3vh, 32px) clamp(20px, 4vw, 56px);
}

.hero .eyebrow {
  grid-column: 1 / -1;
  margin: 0 0 4px;
  color: var(--muted);
}

.hero h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: min(6.2vw, 13vh);
  line-height: 0.95;
  text-transform: uppercase;
}

.dot { color: var(--accent); }

.lede {
  margin: 0;
  max-width: 44ch;
  font-size: 0.98rem;
  line-height: 1.45;
}

.games {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 4px;
  padding: 4px 0;
  background: var(--ink);
}

.banner {
  position: relative;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 8px;
  background-color: var(--c, #333);
  background-size: cover;
  background-position: center;
  color: #fff;
  text-decoration: none;
  text-align: center;
  transition: transform 0.28s cubic-bezier(0.2, 0.7, 0.2, 1), filter 0.28s ease;
}

/* leichte Abdunklung, damit der Name immer lesbar ist */
.banner::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.32);
  transition: background 0.28s ease;
}

/* Farbbalken unten pro Spiel */
.banner::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 8px;
  background: var(--c, #fff);
  transition: height 0.28s ease;
}

.num {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 1;
  color: #fff;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7);
}

.name {
  position: relative;
  z-index: 1;
  font-family: var(--display);
  font-size: clamp(1.1rem, 1.85vw, 2.4rem);
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.7);
}

.games:hover .banner:not(:hover) { filter: grayscale(0.7) brightness(0.75); }

.banner:hover,
.banner:focus-visible {
  transform: scale(1.06);
  z-index: 2;
  outline: none;
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.45);
}

.banner:hover::before,
.banner:focus-visible::before { background: rgba(0, 0, 0, 0.08); }

.banner:hover::after,
.banner:focus-visible::after { height: 14px; }

.foot {
  flex: none;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px clamp(20px, 4vw, 56px);
  color: var(--muted);
}

/* ---------- Spielseite: Basis (einspaltig, darf scrollen) ---------- */
.game-layout {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100vh;
}

/* Bild in Originalproportionen als eigene Fläche: kein Hochskalieren, daher scharf */
.visual {
  position: relative;
  height: 36vh;
  min-height: 240px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px;
  background-color: var(--accent);
  background-size: cover;
  background-position: center 25%;
  color: #fff;
}

.visual::before {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 55%;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.75));
  pointer-events: none;
}

/* Akzentstreifen zum Inhalt */
.visual::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 8px;
  background: var(--accent);
}

.visual > * { position: relative; z-index: 1; }

.back {
  align-self: flex-start;
  padding: 8px 12px;
  background: var(--ink);
  color: #fff;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease;
}

.back:hover { background: #fff; color: var(--ink); }

.visual-title .eyebrow {
  display: block;
  margin-bottom: 8px;
  color: rgba(255, 255, 255, 0.85);
}

.visual h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.2rem, 9vw, 3.4rem);
  line-height: 0.95;
  text-transform: uppercase;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.6);
}

.panel { padding: 28px 20px 48px; }

.step {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
}

.step span {
  padding: 3px 7px;
  background: var(--ink);
  color: var(--paper);
}

.intro {
  margin: 0 0 22px;
  color: var(--muted);
}

form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 18px 14px;
}

label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
}

.field input,
.field select {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 2px solid var(--ink);
  border-radius: 0;
  background-color: var(--paper-2);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
}

.field select {
  appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'><path d='M1 1l6 6 6-6' fill='none' stroke='%23111' stroke-width='2.5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
}

.field input:focus,
.field select:focus {
  outline: none;
  box-shadow: 5px 5px 0 var(--accent);
}

.field input[type="number"] { appearance: textfield; -moz-appearance: textfield; }
.field input[type="number"]::-webkit-outer-spin-button,
.field input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.generate {
  grid-column: 1 / -1;
  margin-top: 8px;
  height: 58px;
  border: 2px solid var(--ink);
  border-radius: 0;
  background: var(--ink);
  color: #fff;
  font-family: var(--display);
  font-size: 1.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 6px 6px 0 var(--accent);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.generate:hover { transform: translate(-2px, -2px); box-shadow: 9px 9px 0 var(--accent); }
.generate:active { transform: translate(4px, 4px); box-shadow: 2px 2px 0 var(--accent); }

.error {
  margin: 16px 0 0;
  padding: 10px 12px;
  border: 2px solid var(--danger);
  background: var(--paper-2);
  color: var(--danger);
  font-size: 0.92rem;
  font-weight: 600;
}

/* Platzhalter nur im zweispaltigen Layout sichtbar */
.placeholder { display: none; }

/* ---------- Ergebnis ---------- */
.ticket {
  position: relative;
  margin-top: 36px;
  padding: 24px;
  border: 2px solid var(--ink);
  background: var(--paper-2);
  box-shadow: 8px 8px 0 var(--ink);
  animation: drop 0.3s ease;
}

/* nur Einblenden: eine Verschiebung würde kurz einen Scrollbalken auslösen */
@keyframes drop {
  from { opacity: 0; }
  to { opacity: 1; }
}

.result-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.result-head .step { margin: 0; }

/* Stempel */
.tier {
  padding: 6px 14px;
  border: 3px solid currentColor;
  font-family: var(--display);
  font-size: 1.4rem;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transform: rotate(-4deg);
}

.tier-leicht { color: #1f6b3d; }
.tier-mittel { color: #9a5b00; }
.tier-schwer { color: var(--danger); }

.penalties {
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
  border-top: 2px solid var(--ink);
}

.penalties li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 14px 0;
  border-bottom: 1px dashed var(--ink);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.35;
}

.amount {
  flex-shrink: 0;
  padding-bottom: 2px;
  border-bottom: 6px solid var(--accent);
  font-family: var(--display);
  font-size: 2.2rem;
  font-weight: 400;
  line-height: 1;
  white-space: nowrap;
}

.reasons {
  margin: 16px 0 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.74rem;
  line-height: 1.65;
}

.reroll {
  margin-top: 16px;
  padding: 0;
  border: 0;
  border-bottom: 2px solid var(--ink);
  background: none;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
}

.reroll:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- Spielseite: Desktop, alles in einem Fenster ---------- */
@media (min-width: 1024px) and (min-height: 561px) {
  body.game-page {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  .game-layout {
    height: 100%;
    min-height: 0;
    grid-template-columns: minmax(260px, 28%) 1fr;
  }

  .visual {
    height: 100%;
    min-height: 0;
    padding: 24px;
    background-position: center top;
  }

  .visual::after {
    top: 0;
    left: auto;
    width: 10px;
    height: auto;
  }

  .visual h1 { font-size: clamp(2rem, 3.6vw, 4rem); }

  .panel {
    height: 100%;
    min-height: 0;
    padding: clamp(24px, 7vh, 80px) clamp(24px, 3vw, 56px) clamp(16px, 3vh, 32px);
    overflow: hidden;
  }

  #content {
    height: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: clamp(24px, 3vw, 56px);
    align-items: start;
  }

  .col-result {
    min-height: 0;
    max-height: 100%;
    overflow-y: auto;
    padding: 0 10px 10px 0;
  }

  .panel { padding-top: clamp(24px, 10vh, 120px); }

  .intro { margin-bottom: clamp(16px, 3vh, 32px); }

  form { gap: clamp(12px, 2.4vh, 28px) 16px; }

  .field input,
  .field select { height: clamp(42px, 6vh, 60px); }

  .generate { height: clamp(52px, 8vh, 76px); margin-top: clamp(4px, 1vh, 14px); }

  .ticket { margin-top: 0; }

  .placeholder {
    display: block;
    padding: 24px;
    border: 2px dashed var(--muted);
    color: var(--muted);
  }

  .placeholder p:last-child { margin: 0; }
}

/* niedrige Fenster: Abstände verdichten, damit auch eine Fehlermeldung noch Platz hat */
@media (min-width: 1024px) and (min-height: 561px) and (max-height: 760px) {
  .panel { padding-top: 20px; }
  .intro { margin-bottom: 12px; }
  form { gap: 12px 12px; }
  label { margin-bottom: 4px; }
  .field input,
  .field select { height: 40px; }
  .generate { height: 50px; margin-top: 4px; }
  .ticket { padding: 18px; }
  .penalties li { padding: 10px 0; }
}

/* ---------- Responsive Startseite ---------- */
@media (max-height: 700px) {
  .hero .eyebrow { display: none; }
  .lede { font-size: 0.88rem; }
}

@media (max-width: 1000px) {
  .hero { grid-template-columns: 1fr; }
  .hero h1 { font-size: min(9vw, 11vh); }
  .games {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .hero { gap: 6px; }
  .hero h1 { font-size: min(11vw, 9vh); }
  .lede { font-size: 0.82rem; }
  .games {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(4, minmax(0, 1fr));
  }
  .foot span:last-child { display: none; }
  .ticket { padding: 20px; box-shadow: 5px 5px 0 var(--ink); }
  .penalties li { flex-direction: column; align-items: flex-start; gap: 10px; }
}
