/* ===== Würfelblock – weißes Spielblatt-Design ===== */

:root {
  --paper: #fdfcf8;
  --paper-dark: #f4f1e8;
  --line: #1b1c20;
  --ink: #1d3fbd;           /* Kugelschreiber-Blau, per Einstellungen änderbar */
  --pencil: #98a0ac;
  --red: #d92b2b;
  --marker: #fff3b0;
  --shadow: 0 10px 30px rgba(27, 28, 32, 0.12);
  --radius: 14px;
  --font-ui: 'Inter', system-ui, sans-serif;
  --font-display: 'Archivo Black', sans-serif;
  --font-hand: 'Caveat', cursive;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-ui);
  color: var(--line);
  background: #e9e6df; /* Schreibtisch */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Der komplette Inhalt liegt auf EINEM Blatt Papier. */
main {
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 1.6rem auto 2.8rem;
  padding: 1.6rem 2.4rem 3rem 4.6rem;
  background:
    repeating-linear-gradient(transparent 0 31px, rgba(29, 63, 189, 0.08) 31px 32px),
    #fffdf7;
  border: 1px solid #d9d5c9;
  border-radius: 3px;
  box-shadow: 0 1px 2px rgba(27, 28, 32, 0.1), 0 16px 45px rgba(27, 28, 32, 0.2);
  position: relative;
}
/* Rote Randlinie wie auf einem Schulblock */
main::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 3.6rem;
  width: 2px;
  background: rgba(217, 43, 43, 0.35);
  pointer-events: none;
}
/* Lochung am linken Rand */
main::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0.9rem;
  width: 18px;
  background-image: radial-gradient(circle at 9px 50%, #e9e6df 6px, rgba(27, 28, 32, 0.18) 7px, transparent 8px);
  background-size: 18px 200px;
  background-repeat: repeat-y;
  background-position: 0 90px;
  pointer-events: none;
}
@media (max-width: 760px) {
  main { margin: 0 0 1.6rem; padding: 1rem 1rem 2.4rem; border-radius: 0; border-left: none; border-right: none; }
  main::before, main::after { display: none; }
}

/* ===== Kopfzeile ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1.2rem;
  border-bottom: 2px solid var(--line);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--line); }

.brand-name { font-family: var(--font-display); font-size: 1.25rem; letter-spacing: 0.03em; }
.brand-name em { color: var(--red); font-style: normal; }

.brand-die {
  width: 30px; height: 30px;
  border: 2.5px solid var(--line);
  border-radius: 7px;
  background: #fff;
  display: grid;
  grid-template: repeat(3, 1fr) / repeat(3, 1fr);
  padding: 3px;
  transform: rotate(-8deg);
}
.brand-die span { width: 5px; height: 5px; border-radius: 50%; background: var(--red); place-self: center; }
.brand-die span:nth-child(1) { grid-area: 1 / 1; }
.brand-die span:nth-child(2) { grid-area: 1 / 3; }
.brand-die span:nth-child(3) { grid-area: 2 / 2; }
.brand-die span:nth-child(4) { grid-area: 3 / 1; }
.brand-die span:nth-child(5) { grid-area: 3 / 3; }

.topnav { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }
.topnav a {
  text-decoration: none;
  color: var(--line);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 2px solid transparent;
}
.topnav a:hover { border-color: var(--line); }
.topnav a.accent { background: var(--line); color: var(--paper); }
.topnav .userchip { font-family: var(--font-hand); font-size: 1.25rem; color: var(--ink); padding: 0 0.5rem; }

/* ===== Hero ===== */
.hero { text-align: center; padding: 3.2rem 0 1rem; position: relative; }

.hero-dice { display: flex; justify-content: center; gap: 1.1rem; margin-bottom: 1.6rem; }
.hero-dice .die { animation: float 3.2s ease-in-out infinite; }
.hero-dice .die:nth-child(2) { animation-delay: 0.3s; transform: rotate(9deg); }
.hero-dice .die:nth-child(3) { animation-delay: 0.6s; transform: rotate(-6deg); }
.hero-dice .die:nth-child(4) { animation-delay: 0.9s; transform: rotate(12deg); }
.hero-dice .die:nth-child(5) { animation-delay: 1.2s; transform: rotate(-10deg); }

@keyframes float {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -12px; }
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 7vw, 4.2rem);
  line-height: 1.02;
  margin: 0 0 0.6rem;
  text-transform: uppercase;
}
.hero h1 .stroke { color: var(--red); }

.hero .tagline { font-size: 1.1rem; color: #4a4d55; max-width: 34rem; margin: 0 auto; }
.hero .tagline strong { color: var(--line); }

.scribble {
  display: inline-block;
  font-family: var(--font-hand);
  font-size: 1.5rem;
  color: var(--ink);
  rotate: -2deg;
  margin-top: 0.8rem;
}

/* ===== Abschnitte auf dem Papier (früher Karten) ===== */
.sheet { background: transparent; }

.sheet-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.35rem 0;
  border-bottom: 3px double var(--line);
}
.sheet-head h2 { font-family: var(--font-display); font-size: 1.05rem; margin: 0; text-transform: uppercase; letter-spacing: 0.04em; }
.sheet-head .sub { font-size: 0.8rem; color: #6a6e78; font-weight: 500; text-align: right; }

.sheet-body { padding: 1.1rem 0 0.4rem; }

/* Namenszeile wie auf dem Papierblock – hier steht der Spielcode */
.name-line { display: flex; align-items: baseline; gap: 0.8rem; flex-wrap: wrap; }
.name-line label { font-weight: 800; text-transform: uppercase; font-size: 0.8rem; letter-spacing: 0.08em; }

.code-input {
  font-family: var(--font-hand);
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.35em;
  text-transform: uppercase;
  border: none;
  border-bottom: 3px dashed var(--line);
  background: transparent;
  width: 11.5ch;
  min-width: 200px;
  padding: 0 0.2rem;
  outline: none;
}
.code-input:focus { border-bottom-color: var(--ink); }
.code-input::placeholder { color: #c8ccd4; letter-spacing: 0.2em; }

.hand-input {
  font-family: var(--font-hand);
  font-size: 1.7rem;
  color: var(--ink);
  border: none;
  border-bottom: 2px dashed var(--line);
  background: transparent;
  padding: 0 0.2rem;
  outline: none;
  min-width: 180px;
}
.hand-input::placeholder { color: #c8ccd4; }

.field { margin-bottom: 1rem; }
.field > label { display: block; font-weight: 800; text-transform: uppercase; font-size: 0.75rem; letter-spacing: 0.08em; margin-bottom: 0.3rem; }
.field input[type='text'], .field input[type='password'] {
  width: 100%;
  font: 500 1rem var(--font-ui);
  padding: 0.65rem 0.8rem;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: #fff;
  outline: none;
}
.field input:focus { box-shadow: 0 0 0 3px rgba(29, 63, 189, 0.2); }

/* ===== Buttons ===== */
.btn {
  font: 800 0.95rem var(--font-ui);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.7rem 1.3rem;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: var(--line);
  color: #fff;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 0 rgba(27, 28, 32, 0.25); }
.btn:active:not(:disabled) { transform: translateY(0); box-shadow: none; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.red { background: var(--red); border-color: var(--red); }
.btn.ghost { background: transparent; color: var(--line); }
.btn.big { font-size: 1.1rem; padding: 0.9rem 1.8rem; }
.btn.small { font-size: 0.75rem; padding: 0.45rem 0.9rem; }

.btn-row { display: flex; gap: 0.7rem; flex-wrap: wrap; align-items: center; margin-top: 1.1rem; }

/* ===== Landing: Bereiche ===== */
.landing-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2.4rem; margin-top: 2.4rem; align-items: start; }
.landing-grid > section + section { border-left: 2px dashed rgba(27, 28, 32, 0.25); padding-left: 2.4rem; }
@media (max-width: 820px) {
  .landing-grid { grid-template-columns: 1fr; }
  .landing-grid > section + section { border-left: none; padding-left: 0; border-top: 2px dashed rgba(27, 28, 32, 0.25); padding-top: 1.6rem; }
}

.mode-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; margin: 0.4rem 0 1rem; }
@media (max-width: 480px) { .mode-cards { grid-template-columns: 1fr; } }

.mode-card {
  border: 2px dashed rgba(27, 28, 32, 0.4);
  border-radius: 8px;
  padding: 0.9rem;
  cursor: pointer;
  background: transparent;
  text-align: left;
  transition: background 0.1s ease;
}
.mode-card:hover { background: rgba(255, 243, 176, 0.4); }
.mode-card.selected { background: var(--marker); border-style: solid; border-color: var(--line); }
.mode-card h3 { margin: 0 0 0.3rem; font-family: var(--font-display); font-size: 1rem; text-transform: uppercase; }
.mode-card ul { margin: 0; padding-left: 1rem; font-size: 0.78rem; color: #555a63; line-height: 1.5; }

.style-cards { display: flex; flex-direction: column; gap: 0.6rem; margin: 0 0 1.1rem; }
.style-card {
  border: 2px dashed rgba(27, 28, 32, 0.4);
  border-radius: 8px;
  padding: 0.7rem 0.9rem;
  cursor: pointer;
  background: transparent;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  transition: background 0.1s ease;
}
.style-card:hover { background: rgba(255, 243, 176, 0.4); }
.style-card.selected { background: var(--marker); border-style: solid; border-color: var(--line); }
.style-card strong { font-size: 0.9rem; }
.style-card span { font-size: 0.75rem; color: #555a63; line-height: 1.4; }

.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  margin-top: 2.8rem;
  border-top: 3px double var(--line);
  padding-top: 1.4rem;
}
@media (max-width: 700px) { .features { grid-template-columns: 1fr; gap: 1.2rem; } }
.feature h3 { margin: 0 0 0.3rem; font-size: 0.95rem; }
.feature p { margin: 0; font-size: 0.85rem; color: #555a63; }

/* ===== Würfel ===== */
.die {
  width: 58px; height: 58px;
  background: #fff;
  border: 3px solid var(--line);
  border-radius: 13px;
  display: grid;
  grid-template: repeat(3, 1fr) / repeat(3, 1fr);
  padding: 7px;
  position: relative;
  user-select: none;
}
.die .pip { width: 10px; height: 10px; border-radius: 50%; background: var(--line); place-self: center; }
.die[data-face='1'] .pip, .die[data-face='4'] .pip, .die[data-face='5'] .pip { background: var(--red); }

button.die { cursor: pointer; transition: translate 0.12s ease, box-shadow 0.12s ease; }
button.die:disabled { cursor: default; }
button.die:hover:not(:disabled) { translate: 0 -3px; }

.die.held {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(29, 63, 189, 0.25), 0 8px 14px rgba(29, 63, 189, 0.18);
  translate: 0 10px;
}
.die.rolling { animation: shake 0.45s ease; }

@keyframes shake {
  0% { rotate: 0deg; translate: 0 0; }
  25% { rotate: -14deg; translate: -3px -8px; }
  50% { rotate: 10deg; translate: 3px 2px; }
  75% { rotate: -6deg; translate: -2px -4px; }
  100% { rotate: 0deg; translate: 0 0; }
}

.die.blank { background: repeating-linear-gradient(45deg, #fff 0 6px, #f1f2f5 6px 12px); }

/* ===== Spielansicht ===== */
.game-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin: 1.6rem 0 1rem; }
.game-top h1 { font-family: var(--font-display); font-size: 1.4rem; margin: 0; text-transform: uppercase; }

.codebadge {
  display: inline-flex; align-items: center; gap: 0.6rem;
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 0.35rem 0.8rem;
  background: #fff;
  font-weight: 800;
}
.codebadge .code { font-family: var(--font-hand); font-size: 1.7rem; color: var(--ink); letter-spacing: 0.25em; }

.statuspill { font-size: 0.75rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; padding: 0.3rem 0.7rem; border-radius: 999px; border: 2px solid var(--line); }
.statuspill.live { background: var(--red); border-color: var(--red); color: #fff; animation: pulse 1.6s ease infinite; }
.statuspill.lobby { background: var(--marker); }
.statuspill.done { background: var(--line); color: #fff; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }

.game-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1.4rem; align-items: start; }
@media (max-width: 940px) { .game-layout { grid-template-columns: 1fr; } }

/* Würfelbereich */
.dice-tray { display: flex; gap: 0.9rem; justify-content: center; padding: 1.2rem 0.6rem 1.6rem; flex-wrap: wrap; }
.tray-info { text-align: center; font-weight: 600; font-size: 0.9rem; color: #555a63; margin: 0 0 0.4rem; }
.tray-info .turnname { font-family: var(--font-hand); font-size: 1.5rem; color: var(--ink); margin: 0 0.35rem; }
.tray-actions { display: flex; justify-content: center; gap: 0.8rem; padding-bottom: 1.2rem; }
.hold-hint { text-align: center; font-size: 0.75rem; color: var(--pencil); margin: -0.6rem 0 0.8rem; }

/* Wertungstabelle */
.score-wrap { overflow-x: auto; }
table.scoresheet { border-collapse: collapse; width: 100%; background: #fff; }
.scoresheet th, .scoresheet td { border: 1.5px solid var(--line); padding: 0.4rem 0.6rem; font-size: 0.85rem; }
.scoresheet thead th {
  font-family: var(--font-hand);
  font-size: 1.35rem;
  color: var(--ink);
  min-width: 74px;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.scoresheet thead th.catcol { font-family: var(--font-ui); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--line); }
.scoresheet .cat { text-align: left; }
.scoresheet .cat .catname { font-weight: 700; display: block; }
.scoresheet .cat .cathint { font-size: 0.68rem; color: #868c97; display: block; }
.scoresheet td.val { text-align: center; font-family: var(--font-hand); font-size: 1.45rem; color: var(--ink); min-width: 74px; }
.scoresheet td.val.zero { color: var(--red); }
.scoresheet td.val .strike { text-decoration: line-through; }
.scoresheet tr.section th {
  background: repeating-linear-gradient(-45deg, transparent 0 6px, rgba(27, 28, 32, 0.06) 6px 12px), var(--paper-dark);
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-align: left;
}
.scoresheet tr.totals td, .scoresheet tr.totals th { background: var(--paper-dark); font-weight: 800; }
.scoresheet tr.totals td.val { font-size: 1.5rem; }
.scoresheet th.me { background: var(--marker); }
.scoresheet col.turncol { background: rgba(255, 243, 176, 0.45); }

/* anklickbare Vorschau-Zellen */
td.val.pick { cursor: pointer; color: var(--pencil); font-style: italic; position: relative; }
td.val.pick:hover { background: var(--marker); color: var(--line); font-style: normal; }
td.val.pick:hover::after { content: '✎'; position: absolute; right: 6px; font-size: 0.8rem; }

/* Analogmodus: leere eigene Felder mit Stift-Symbol */
td.val.pick.manual { font-family: var(--font-ui); font-size: 0.95rem; font-style: normal; color: var(--pencil); }
td.val.pick.manual:hover::after { content: ''; }

/* Analogmodus: eigene ausgefüllte Felder können korrigiert werden */
td.val.own-edit { cursor: pointer; position: relative; }
td.val.own-edit:hover { background: var(--marker); }
td.val.own-edit:hover::after { content: '↺'; position: absolute; right: 5px; top: 50%; translate: 0 -50%; font-size: 0.75rem; color: var(--line); }

.bonus-btn {
  font: 800 0.65rem var(--font-ui);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--marker);
  padding: 0.1rem 0.5rem;
  margin-left: 0.35rem;
  cursor: pointer;
  vertical-align: middle;
}
.bonus-btn:hover { background: var(--line); color: #fff; }

/* ===== Eingabe-Dialog (Analogmodus) ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(27, 28, 32, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 100;
}
.modal {
  width: 100%;
  max-width: 420px;
  animation: pop 0.15s ease;
  background:
    repeating-linear-gradient(transparent 0 31px, rgba(29, 63, 189, 0.07) 31px 32px),
    #fffdf7;
  border: 2px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 24px 60px rgba(27, 28, 32, 0.35);
  padding: 0.9rem 1.2rem 1.1rem;
}
@keyframes pop { from { transform: scale(0.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.chip-grid { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip {
  font: 700 1.05rem var(--font-hand);
  font-size: 1.25rem;
  color: var(--ink);
  border: 2px solid var(--line);
  border-radius: 10px;
  background: #fff;
  min-width: 52px;
  padding: 0.35rem 0.7rem;
  cursor: pointer;
}
.chip:hover { background: var(--marker); }
.chip.strike-chip { color: var(--red); font-family: var(--font-ui); font-size: 0.8rem; font-weight: 800; text-transform: uppercase; }

.entry-range { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.entry-range input {
  font: 700 1.4rem var(--font-hand);
  color: var(--ink);
  width: 110px;
  padding: 0.4rem 0.6rem;
  border: 2px solid var(--line);
  border-radius: 10px;
  outline: none;
}
.entry-range input:focus { box-shadow: 0 0 0 3px rgba(29, 63, 189, 0.2); }

/* Seitenleiste */
.side-panel { display: flex; flex-direction: column; gap: 1.2rem; }
.player-list { list-style: none; margin: 0; padding: 0; }
.player-list li { display: flex; align-items: center; gap: 0.6rem; padding: 0.45rem 0; border-bottom: 1px dashed rgba(27, 28, 32, 0.25); }
.player-list .pname { font-family: var(--font-hand); font-size: 1.4rem; color: var(--ink); flex: 1; }
.player-list .tag { font-size: 0.65rem; font-weight: 800; text-transform: uppercase; border: 1.5px solid var(--line); border-radius: 999px; padding: 0.1rem 0.5rem; }
.player-list .tag.turn { background: var(--marker); }

.gamelog { list-style: none; margin: 0; padding: 0; font-size: 0.8rem; color: #555a63; max-height: 240px; overflow-y: auto; }
.gamelog li { padding: 0.3rem 0; border-bottom: 1px dashed rgba(27, 28, 32, 0.15); }

/* Ergebnis */
.result-banner { text-align: center; padding: 1.6rem 1rem; }
.result-banner .trophy { font-size: 3rem; }
.result-banner h2 { font-family: var(--font-display); text-transform: uppercase; margin: 0.4rem 0; }
.result-list { list-style: none; padding: 0; margin: 1rem auto 0; max-width: 380px; }
.result-list li { display: flex; justify-content: space-between; align-items: baseline; padding: 0.4rem 0.6rem; border-bottom: 1.5px solid var(--line); }
.result-list .place { font-weight: 800; width: 2.4rem; }
.result-list .rname { font-family: var(--font-hand); font-size: 1.5rem; color: var(--ink); flex: 1; text-align: left; }
.result-list .rscore { font-weight: 800; font-size: 1.1rem; }
.result-list li.first { background: var(--marker); }

/* ===== Einstellungen ===== */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; margin-top: 1.6rem; align-items: start; }
@media (max-width: 820px) { .settings-grid { grid-template-columns: 1fr; } }

.ink-swatches { display: flex; gap: 0.7rem; }
.ink-swatch { width: 40px; height: 40px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; }
.ink-swatch.selected { border-color: var(--line); box-shadow: 0 0 0 3px #fff inset; }

.stats-row { display: flex; gap: 0.8rem; flex-wrap: wrap; margin-bottom: 1rem; }
.stat { border: 2px dashed rgba(27, 28, 32, 0.4); border-radius: 8px; padding: 0.6rem 1rem; background: transparent; min-width: 108px; }
.stat .num { font-family: var(--font-display); font-size: 1.4rem; }
.stat .lbl { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: #6a6e78; }

table.history { border-collapse: collapse; width: 100%; font-size: 0.85rem; }
.history th, .history td { border-bottom: 1.5px solid rgba(27, 28, 32, 0.2); padding: 0.45rem 0.5rem; text-align: left; }
.history th { text-transform: uppercase; font-size: 0.7rem; letter-spacing: 0.08em; }
.history td.score { font-family: var(--font-hand); font-size: 1.3rem; color: var(--ink); }

/* ===== Auth-Seiten ===== */
.auth-wrap { max-width: 420px; margin: 3rem auto 0; }
.auth-alt { text-align: center; margin-top: 1rem; font-size: 0.9rem; }
.auth-alt a { color: var(--ink); font-weight: 700; }

/* ===== Sonstiges ===== */
.section-title { font-family: var(--font-display); text-transform: uppercase; font-size: 1.1rem; margin: 2.4rem 0 0.8rem; }
.muted { color: #6a6e78; font-size: 0.85rem; }
.error-text { color: var(--red); font-weight: 600; font-size: 0.85rem; min-height: 1.2em; margin: 0.5rem 0 0; }

.toast {
  position: fixed;
  bottom: 1.4rem;
  left: 50%;
  translate: -50% 0;
  background: var(--line);
  color: #fff;
  font-weight: 600;
  padding: 0.7rem 1.3rem;
  border-radius: 999px;
  box-shadow: var(--shadow);
  z-index: 50;
  max-width: 90vw;
}
.toast.error { background: var(--red); }

.footer { text-align: center; padding: 0 1.4rem 1.6rem; font-size: 0.78rem; color: #6a6e78; }

.spin { display: inline-block; animation: spin 0.9s linear infinite; }
@keyframes spin { to { rotate: 360deg; } }

/* ========================================================================== 
   KLASSISCHER SPIELBLOCK
   Reduzierte Schwarzweiß-Optik; alle vertikalen Abstände folgen einem
   28-px-Grundlinienraster, passend zu den Papierlinien.
   ========================================================================== */

:root {
  --baseline: 28px;
  --paper: #fbfaf5;
  --paper-dark: #ecebe5;
  --line: #151515;
  --pencil: #8b8b86;
  --red: #151515;
  --marker: #e8e7df;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.13);
  --radius: 2px;
  --font-ui: Arial, Helvetica, sans-serif;
  --font-display: Arial, Helvetica, sans-serif;
}

body {
  background: #d9d8d3;
  color: var(--line);
}

main {
  max-width: 960px;
  margin: var(--baseline) auto calc(var(--baseline) * 2);
  padding: var(--baseline) 42px calc(var(--baseline) * 2);
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 27px,
      rgba(56, 91, 120, 0.12) 27px,
      rgba(56, 91, 120, 0.12) 28px
    ),
    var(--paper);
  border: 1px solid #b7b6b0;
  border-radius: 0;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.14);
}

main::before,
main::after {
  display: none;
}

p {
  line-height: var(--baseline);
}

/* Eine schlichte Akten-/Blockkopfzeile statt Website-Navigation. */
.topbar {
  position: static;
  min-height: 48px;
  padding: 8px 18px;
  background: #f2f1ec;
  border: 0;
  border-bottom: 1px solid #aaa9a4;
}

.brand {
  gap: 8px;
}

.brand-name {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.brand-name em {
  color: inherit;
}

.brand-die {
  width: 24px;
  height: 24px;
  border-width: 1.5px;
  border-radius: 4px;
  transform: none;
}

.brand-die span {
  width: 4px;
  height: 4px;
  background: var(--line);
}

.topnav {
  gap: 18px;
}

.topnav a,
.topnav a.accent {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--line);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 28px;
}

.topnav a:hover {
  border: 0;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.topnav .userchip {
  color: var(--ink);
  font-size: 1rem;
  line-height: 28px;
}

/* Deckblatt: nur Typografie und die würfelbare Würfelzeile. */
.hero {
  padding: var(--baseline) 0;
}

.hero-dice {
  appearance: none;
  width: max-content;
  margin: 0 auto var(--baseline);
  padding: 0;
  border: 0;
  background: transparent;
  display: grid;
  grid-template-columns: repeat(5, 46px);
  gap: 10px;
  position: relative;
  cursor: pointer;
}

.hero-dice#landing-dice .die {
  width: 46px;
  height: 46px;
  padding: 6px;
  border-width: 2px;
  border-radius: 7px;
  animation: none;
  transform: none;
  background: #fff;
}

.hero-dice .die .pip,
.hero-dice .die[data-face='1'] .pip,
.hero-dice .die[data-face='4'] .pip,
.hero-dice .die[data-face='5'] .pip {
  width: 8px;
  height: 8px;
  background: var(--line);
}

.hero-dice#landing-dice:hover .die {
  transform: translateY(-2px);
}

.hero-dice#landing-dice.is-rolling .die {
  animation: sheet-roll 0.16s linear infinite;
}

@keyframes sheet-roll {
  0% { transform: rotate(-5deg) translateY(0); }
  50% { transform: rotate(5deg) translateY(-5px); }
  100% { transform: rotate(-5deg) translateY(0); }
}

.roll-label {
  position: absolute;
  top: 52px;
  left: 0;
  right: 0;
  color: #666;
  font: 600 0.62rem var(--font-ui);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.form-number {
  margin: var(--baseline) 0 0;
  color: #555;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.hero h1 {
  margin: 0;
  font-family: var(--font-ui);
  font-size: clamp(2.1rem, 6vw, 3.4rem);
  font-weight: 900;
  line-height: calc(var(--baseline) * 2);
  letter-spacing: -0.035em;
  text-transform: uppercase;
}

.hero h1 span,
.hero h1 .stroke {
  color: #888;
  font-weight: 400;
}

.hero .tagline {
  max-width: 620px;
  margin: 0 auto;
  color: #444;
  font-size: 0.9rem;
  line-height: var(--baseline);
}

.scribble {
  margin-top: 0;
  line-height: var(--baseline);
}

/* Klassische Formularabschnitte: keine Karten, keine Schlagschatten. */
.sheet {
  background: transparent;
  border: 0;
  box-shadow: none;
  border-radius: 0;
  overflow: visible;
}

.sheet-head {
  min-height: var(--baseline);
  padding: 0;
  align-items: center;
  border-bottom: 2px solid var(--line);
  background: transparent;
}

.sheet-head h2 {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 900;
  line-height: var(--baseline);
  letter-spacing: 0.08em;
}

.sheet-head .sub {
  color: #666;
  font-size: 0.66rem;
  line-height: var(--baseline);
}

.sheet-body {
  padding: var(--baseline) 0 0;
}

.landing-grid {
  gap: 42px;
  margin-top: var(--baseline);
}

.landing-grid > section + section {
  border-left: 1px solid #999;
  padding-left: 42px;
}

.name-line {
  min-height: calc(var(--baseline) * 2);
  align-items: center;
}

.name-line label,
.field > label {
  font-size: 0.66rem;
  letter-spacing: 0.08em;
}

.code-input,
.hand-input {
  height: var(--baseline);
  padding: 0 4px;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  line-height: var(--baseline);
}

.code-input {
  font-size: 1.8rem;
  letter-spacing: 0.2em;
}

.hand-input {
  font-size: 1.35rem;
}

.mode-cards {
  gap: 6px;
  margin: 0 0 var(--baseline);
}

.mode-card,
.style-card {
  border: 1px solid #777;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.38);
  box-shadow: none;
}

.mode-card:hover,
.style-card:hover {
  background: #f1f0ea;
}

.mode-card.selected,
.style-card.selected {
  border: 2px solid var(--line);
  background:
    repeating-linear-gradient(-45deg, transparent 0 5px, rgba(0, 0, 0, 0.035) 5px 6px),
    rgba(255, 255, 255, 0.55);
  box-shadow: none;
}

.mode-card h3 {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
}

.style-card {
  padding: 7px 9px;
}

.style-card strong {
  font-size: 0.76rem;
  text-transform: uppercase;
}

.style-card span,
.mode-card ul {
  color: #555;
  font-size: 0.68rem;
}

.btn,
.btn.red,
.btn.ghost {
  min-height: var(--baseline);
  padding: 4px 12px;
  border: 1.5px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--line);
  font-size: 0.7rem;
  letter-spacing: 0.07em;
  box-shadow: none;
}

.btn:hover:not(:disabled),
.btn.red:hover:not(:disabled),
.btn.ghost:hover:not(:disabled) {
  transform: none;
  background: var(--line);
  color: var(--paper);
  box-shadow: none;
}

.btn.big {
  padding: 6px 16px;
  font-size: 0.74rem;
}

.btn.small {
  padding: 3px 9px;
  font-size: 0.64rem;
}

.btn-row {
  min-height: var(--baseline);
  gap: 8px;
  margin-top: var(--baseline);
}

.features {
  gap: 28px;
  margin-top: calc(var(--baseline) * 2);
  padding-top: var(--baseline);
  border-top: 2px solid var(--line);
}

.feature {
  display: grid;
  grid-template-columns: 24px 1fr;
  column-gap: 8px;
  background: transparent;
  border: 0;
  padding: 0;
}

.feature > b {
  grid-row: 1 / span 2;
  color: #777;
  font-size: 0.68rem;
  line-height: var(--baseline);
}

.feature h3 {
  margin: 0;
  font-size: 0.75rem;
  line-height: var(--baseline);
  text-transform: uppercase;
}

.feature p {
  margin: 0;
  color: #555;
  font-size: 0.72rem;
  line-height: 18px;
}

/* Spielkopf und Status wie Beschriftungsfelder des Blocks. */
.game-top {
  min-height: calc(var(--baseline) * 2);
  margin: 0 0 var(--baseline);
  border-bottom: 3px double var(--line);
}

.game-top h1 {
  font-family: var(--font-ui);
  font-size: 1rem;
  line-height: var(--baseline);
  letter-spacing: 0.08em;
}

.codebadge,
.statuspill {
  border: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--line);
}

.codebadge {
  padding: 0 7px;
  line-height: var(--baseline);
}

.codebadge .code {
  font-size: 1.35rem;
}

.statuspill,
.statuspill.live,
.statuspill.lobby,
.statuspill.done {
  padding: 0 7px;
  background: var(--line);
  border-color: var(--line);
  color: var(--paper);
  animation: none;
  line-height: 20px;
}

.game-layout {
  grid-template-columns: minmax(0, 1fr) 230px;
  gap: 28px;
}

.side-panel {
  gap: var(--baseline);
}

.section-title {
  min-height: var(--baseline);
  margin: var(--baseline) 0 0;
  border-bottom: 2px solid var(--line);
  font-family: var(--font-ui);
  font-size: 0.78rem;
  line-height: var(--baseline);
  letter-spacing: 0.08em;
}

/* Der eigentliche Wertungsblock: kompakt, schwarzweiß, tabellarisch. */
table.scoresheet {
  background: rgba(255, 255, 255, 0.82);
  border: 2px solid var(--line);
}

.scoresheet th,
.scoresheet td {
  border: 1px solid #343434;
  padding: 3px 6px;
  font-size: 0.74rem;
}

.scoresheet thead th {
  height: 32px;
  min-width: 66px;
  font-size: 1.05rem;
}

.scoresheet thead th.catcol {
  font-size: 0.66rem;
}

.scoresheet .cat .catname {
  font-size: 0.7rem;
}

.scoresheet .cat .cathint {
  color: #626262;
  font-size: 0.58rem;
}

.scoresheet td.val {
  min-width: 66px;
  color: var(--ink);
  font-size: 1.15rem;
}

.scoresheet td.val.zero {
  color: var(--ink);
}

.scoresheet tr.section th {
  background: #deddd7;
  color: var(--line);
  font-size: 0.62rem;
}

.scoresheet tr.totals td,
.scoresheet tr.totals th {
  background: #ecebe5;
}

.scoresheet th.me,
.scoresheet col.turncol,
td.val.pick:hover,
td.val.own-edit:hover {
  background: #e5e4dd;
}

.player-list li {
  min-height: var(--baseline);
  padding: 0;
  border-bottom: 1px dotted #777;
}

.player-list .pname {
  font-size: 1.15rem;
  line-height: var(--baseline);
}

.player-list .tag {
  border: 1px solid #555;
  border-radius: 0;
  background: transparent !important;
  color: var(--line);
}

.gamelog {
  font-size: 0.68rem;
  line-height: 18px;
}

.gamelog li {
  padding: 4px 0;
}

/* Dialog wie ein kleiner abgerissener Blockzettel. */
.modal {
  border: 2px solid var(--line);
  border-radius: 0;
  background:
    repeating-linear-gradient(to bottom, transparent 0, transparent 27px, rgba(56, 91, 120, 0.11) 27px, rgba(56, 91, 120, 0.11) 28px),
    var(--paper);
  box-shadow: 8px 10px 0 rgba(0, 0, 0, 0.17);
}

.chip {
  min-width: 46px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--paper);
}

.chip:hover {
  background: #dfded8;
}

.field input[type='text'],
.field input[type='password'],
.entry-range input {
  border: 1px solid var(--line);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.5);
}

.stat {
  border: 1px solid #777;
  border-radius: 0;
  background: transparent;
}

.ink-swatch {
  border-radius: 0;
  width: 32px;
  height: 32px;
}

.toast {
  border-radius: 0;
  background: var(--line);
}

.footer {
  color: #555;
}

@media (max-width: 820px) {
  main {
    padding: var(--baseline) 18px calc(var(--baseline) * 2);
  }

  .landing-grid > section + section {
    padding-left: 0;
    padding-top: var(--baseline);
    border-left: 0;
    border-top: 1px solid #777;
  }

  .game-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  main {
    margin: 0 0 var(--baseline);
    padding: var(--baseline) 8px;
    box-shadow: none;
  }

  .topbar {
    align-items: flex-start;
  }

  .topnav {
    gap: 10px;
    justify-content: flex-end;
  }

  .hero {
    padding-top: 0;
  }

  .hero-dice {
    grid-template-columns: repeat(5, 38px);
    gap: 6px;
  }

  .hero-dice .die {
    width: 38px;
    height: 38px;
  }

  .roll-label {
    top: 44px;
  }

  .hero h1 {
    font-size: 2rem;
    line-height: var(--baseline);
  }

  .hero .tagline {
    font-size: 0.78rem;
  }

  .features {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   ORIGINALER WERTUNGSBLOCK
   Aufbau nach dem klassischen gedruckten Kniffel-/Yatzy-Block:
   weißes Papier, kräftiges Tabellenraster, eigene Regelspalte und Spielspalten.
   ========================================================================== */

body {
  background: #ededeb;
}

main {
  max-width: 1040px;
  padding: 34px 38px 54px;
  background: #fff;
  border: 0;
  box-shadow: 0 7px 24px rgba(0, 0, 0, 0.12);
}

/* Der Titel entspricht der handschriftlichen Überschrift des Papierblocks. */
.hero h1,
.game-top h1 {
  font-family: var(--font-hand);
  font-weight: 700;
  letter-spacing: -0.02em;
  text-transform: none;
}

.hero h1 {
  font-size: clamp(3.2rem, 7vw, 5rem);
  line-height: 1;
}

.hero h1 span {
  color: #555;
}

.form-number,
.hero .tagline,
.roll-label {
  color: #333;
}

.game-top {
  min-height: 74px;
  border-bottom: 0;
  align-items: flex-end;
}

.game-top h1 {
  font-size: 3.25rem;
  line-height: 1;
}

.game-top > div {
  min-width: 280px;
  justify-content: flex-end;
}

/* Der Code sitzt dort, wo auf dem Papierblock die Namenslinie liegt. */
.codebadge {
  min-width: 220px;
  padding: 0 4px;
  border: 0;
  border-bottom: 2px solid var(--line);
  line-height: 34px;
}

.codebadge .code {
  margin-left: auto;
  font-size: 1.65rem;
}

.statuspill,
.statuspill.live,
.statuspill.lobby,
.statuspill.done {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--line);
}

/* Die Wertung erhält die volle Papierbreite; Spieler/Protokoll folgen darunter. */
.game-layout {
  grid-template-columns: minmax(0, 1fr);
}

.side-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 34px;
  margin-top: 28px;
  border-top: 2px solid var(--line);
  padding-top: 14px;
}

.section-title {
  margin-top: 24px;
  border: 0;
  font-size: 0;
  min-height: 0;
}

.section-title::after {
  content: 'Wertungsblock';
  display: block;
  font: 800 0.72rem Arial, Helvetica, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom: 2px solid var(--line);
  padding-bottom: 5px;
}

.score-wrap {
  overflow-x: auto;
  padding-bottom: 2px;
}

table.scoresheet {
  width: 100%;
  table-layout: fixed;
  border: 2px solid var(--line);
  background: #fff;
}

.scoresheet col.category-col {
  width: 27%;
}

.scoresheet col.rule-col {
  width: 18%;
}

.scoresheet th,
.scoresheet td {
  height: 42px;
  padding: 4px 7px;
  border: 1.25px solid #222;
  background: #fff;
  vertical-align: middle;
}

.scoresheet thead th {
  height: 54px;
  min-width: 72px;
  background: #fff;
  font-family: var(--font-ui);
  color: var(--line);
}

.scoresheet thead th.sheet-corner {
  text-align: left;
  font-family: var(--font-hand);
  font-size: 2rem;
  font-weight: 700;
  padding-left: 10px;
}

.scoresheet thead .game-number {
  display: block;
  font: 700 0.66rem var(--font-ui);
  color: #333;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.scoresheet thead .player-name {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font: 700 1.05rem var(--font-hand);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scoresheet th.me,
.scoresheet col.turncol {
  background: #f0f0ed;
}

.scoresheet .cat {
  text-align: left;
}

.scoresheet .cat .catname {
  display: inline-block;
  font-size: 0.82rem;
  line-height: 22px;
}

.scoresheet .rulenote {
  color: #202020;
  font-size: 0.69rem;
  font-weight: 600;
  line-height: 1.15;
  text-align: center;
}

.scoresheet .total-note {
  font-size: 0.8rem;
}

.category-dice {
  float: right;
  display: inline-flex;
  gap: 3px;
  margin-left: 6px;
}

.category-dice .die {
  width: 23px;
  height: 23px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fff;
  transform: none;
  animation: none;
}

.category-dice .die .pip,
.category-dice .die[data-face='1'] .pip,
.category-dice .die[data-face='4'] .pip,
.category-dice .die[data-face='5'] .pip {
  width: 4px;
  height: 4px;
  background: var(--line);
}

.scoresheet td.val {
  min-width: 72px;
  font-size: 1.35rem;
}

.scoresheet tr.totals th,
.scoresheet tr.totals td {
  background: #f5f5f2;
  font-weight: 800;
}

.scoresheet tr.grand th,
.scoresheet tr.grand td {
  border-top-width: 2px;
  border-bottom-width: 2px;
}

/* Oberen und unteren Block optisch wie zwei gedruckte Tabellen trennen. */
.scoresheet tbody tr.section:first-child {
  display: none;
}

.scoresheet tr.section th {
  height: 12px;
  padding: 0;
  border-right: 0;
  border-left: 0;
  background: #fff;
  color: transparent;
  font-size: 0;
}

.scoresheet td.val.pick.manual {
  color: #777;
}

.scoresheet td.val.pick:hover,
.scoresheet td.val.own-edit:hover {
  background: #e9e9e5;
}

/* Dialog und übrige Formulare ebenfalls auf sauberem, unlininiertem Papier. */
.modal {
  background: #fff;
}

.field input[type='text'],
.field input[type='password'],
.entry-range input,
.mode-card,
.style-card {
  background: #fff;
}

@media (max-width: 720px) {
  main {
    padding: 22px 8px 36px;
  }

  .game-top {
    align-items: flex-start;
  }

  .game-top h1 {
    font-size: 2.4rem;
  }

  .game-top > div {
    min-width: 0;
  }

  .codebadge {
    min-width: 150px;
  }

  .side-panel {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .scoresheet col.category-col {
    width: 34%;
  }

  .scoresheet col.rule-col {
    width: 22%;
  }

  .scoresheet th,
  .scoresheet td {
    height: 38px;
    padding: 3px 4px;
  }

  .scoresheet .cat .catname {
    font-size: 0.67rem;
  }

  .scoresheet .rulenote {
    font-size: 0.56rem;
  }

  .category-dice {
    gap: 1px;
  }

  .category-dice .die {
    width: 17px;
    height: 17px;
    padding: 1px;
  }

  .category-dice .die .pip {
    width: 3px;
    height: 3px;
  }

  .scoresheet td.val {
    min-width: 54px;
    font-size: 1.1rem;
  }

  .scoresheet thead .game-number {
    font-size: 0.52rem;
  }

  .scoresheet thead .player-name {
    font-size: 0.85rem;
  }
}

/* Das Papier IST die Seite: keine Website-Kopfzeile, kein Footer. */
.paper-page {
  position: relative;
}

#app {
  padding-top: 28px;
}

.paper-tools {
  position: absolute;
  z-index: 10;
  top: 12px;
  right: 38px;
  display: flex;
  align-items: center;
  gap: 13px;
  color: #333;
  font: 700 0.58rem Arial, Helvetica, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.paper-tools a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.paper-tools a:hover {
  border-bottom-color: currentColor;
}

.paper-tools .paper-home {
  padding-right: 13px;
  border-right: 1px solid #777;
}

.paper-tools .paper-home:hover {
  border-bottom-color: transparent;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.paper-tools .userchip {
  color: var(--ink);
  font: 700 0.9rem var(--font-hand);
  letter-spacing: 0;
  text-transform: none;
}

@media (max-width: 720px) {
  #app {
    padding-top: 34px;
  }

  .paper-tools {
    top: 9px;
    left: 8px;
    right: 8px;
    justify-content: flex-end;
    gap: 9px;
    font-size: 0.52rem;
  }

  .paper-tools .paper-home {
    margin-right: auto;
  }
}
