:root {
  --bg: #fff9f0;
  --bg2: #fffbeb;
  --panel: #ffffff;
  --line: #ebe5dc;
  --text: #131313;
  --muted: #757575;
  --accent: #ff961f;
  --accent-dark: #f58300;
  --accent2: #f58300;
  --gold: #ffce00;
  --brown: #432f19;
}
body.xmas { --accent: #d21d24; --accent-dark: #b41d3b; --accent2: #17821b; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: Figtree, system-ui, -apple-system, "Segoe UI", sans-serif;
  overflow: hidden;
  -webkit-user-select: none; user-select: none;
}
.app { display: flex; flex-direction: column; height: 100dvh; }

.topbar {
  display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: 28px;
  padding: 10px 24px; background: #fff; border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.logo { font-weight: 800; font-size: 32px; letter-spacing: -1.5px; color: var(--text); line-height: 1; }
.logo i, .card-logo i { font-style: normal; color: #ff961f; }
.brand-sub { font-size: 14px; font-weight: 600; color: var(--muted); }
.hud { display: flex; gap: 26px; }
.hud-item { display: flex; flex-direction: column; min-width: 54px; }
.hud-item label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted); }
.hud-item span { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.hud-item.score span { font-size: 26px; color: var(--accent-dark); min-width: 150px; display: inline-block; }
.dmd {
  justify-self: end; min-width: 260px; max-width: 480px; padding: 9px 16px; border-radius: 6px;
  background: #131313; color: #ff961f;
  font-size: 13px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase;
  background-image: radial-gradient(rgba(255,150,31,.12) 1px, transparent 1.2px); background-size: 4px 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center;
}

.stage { flex: 1; min-height: 0; display: flex; gap: 24px; padding: 16px 24px 18px; justify-content: center; }
.table-wrap { position: relative; height: 100%; aspect-ratio: 600 / 1000; max-width: 100%; }
#game {
  width: 100%; height: 100%; display: block; touch-action: none; border-radius: 18px;
  box-shadow: 0 30px 70px rgba(67,47,25,.28), 0 0 0 2px #131313;
}

.overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(255,249,240,.55); backdrop-filter: blur(3px); border-radius: 18px; }
.overlay.hidden, .pause.hidden { display: none; }
.card {
  width: min(86%, 360px); padding: 30px 26px; border-radius: 12px; text-align: center;
  background: #fff; border: 1px solid var(--line); box-shadow: 0 20px 50px rgba(67,47,25,.18);
}
.card-logo { font-weight: 800; font-size: 58px; letter-spacing: -3px; line-height: 1; }
.card h1 { font-size: 22px; font-weight: 800; margin: 4px 0 10px; }
.card h2 { font-size: 24px; font-weight: 800; margin: 0 0 6px; }
.tag { color: var(--muted); margin: 0 0 22px; line-height: 1.5; }
.final { font-size: 38px; font-weight: 800; color: var(--accent-dark); margin-bottom: 16px; font-variant-numeric: tabular-nums; }
.card label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.card input {
  width: 100%; padding: 12px 14px; font: inherit; font-size: 18px; border-radius: 6px; border: 1px solid #d4d4d4;
  background: #fff; color: var(--text); text-align: center; outline: none; -webkit-user-select: text; user-select: text;
}
.card input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,150,31,.25); }
.row { display: flex; gap: 10px; margin-top: 14px; }
.row .btn { flex: 1; }
.hint { color: var(--muted); font-size: 13px; margin: 12px 0 0; min-height: 1em; }
.btn {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 6px; padding: 11px 18px;
  border: 1px solid #d4d4d4; background: #fff; color: var(--text);
  transition: transform .08s, background .2s, border-color .2s;
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; min-width: 190px; }
.btn.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn.ghost { background: transparent; }
.btn.toggle.on { border-color: var(--accent); background: #fff3e0; }

.pause { position: absolute; top: 45%; left: 0; right: 0; text-align: center; font-size: 20px; font-weight: 800; }
.pause.hidden { display: none; }

.side { width: 330px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; }
.panel h3 { margin: 0 0 10px; font-size: 17px; font-weight: 800; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.panel-head h3 { margin: 0; }
.tabs { display: flex; gap: 4px; background: #f7f7f7; padding: 3px; border-radius: 6px; }
.tab { font: inherit; font-size: 13px; font-weight: 600; border: 0; background: transparent; color: var(--muted); padding: 5px 12px; border-radius: 4px; cursor: pointer; }
.tab.active { background: var(--accent); color: #fff; }
.board { list-style: none; margin: 0; padding: 0; }
.board li { display: grid; grid-template-columns: 28px 1fr auto; gap: 8px; align-items: center; padding: 8px 4px; border-bottom: 1px solid var(--line); font-size: 15px; }
.board li:last-child { border-bottom: 0; }
.board li .rk { font-weight: 800; color: var(--muted); }
.board li:nth-child(1) .rk { color: #ff961f; }
.board li .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board li .sc { font-weight: 800; font-variant-numeric: tabular-nums; }
.board li.me { background: #fff3e0; border-radius: 6px; }
.board li.empty { display: block; color: var(--muted); text-align: center; }
.board-note { margin: 8px 0 0; font-size: 12px; color: var(--muted); }
.missions, .keys { margin: 0; padding: 0; list-style: none; font-size: 14px; line-height: 1.5; }
.missions li, .keys li { padding: 4px 0; }
.missions b { color: var(--accent-dark); font-weight: 800; margin-right: 4px; }
kbd { font-family: inherit; font-size: 12px; padding: 2px 7px; border-radius: 4px; border: 1px solid #d4d4d4; background: #f7f7f7; }
.toggles { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.touch-only { display: none; }

@media (max-width: 900px) {
  body { overflow: auto; }
  .app { height: auto; min-height: 100dvh; }
  .topbar { grid-template-columns: auto 1fr; gap: 10px; padding: 8px 14px; }
  .dmd { grid-column: 1 / -1; justify-self: stretch; max-width: none; min-width: 0; font-size: 12px; padding: 6px 10px; }
  .hud { justify-content: flex-end; gap: 14px; }
  .hud-item.score span { min-width: 0; font-size: 20px; }
  .hud-item span { font-size: 17px; }
  .logo { font-size: 26px; }
  .stage { flex-direction: column; align-items: center; padding: 10px 14px 18px; }
  .table-wrap { height: auto; width: min(100%, calc((100dvh - 120px) * .6)); }
  .side { width: 100%; max-width: 560px; overflow: visible; }
  .touch-only { display: list-item; }
}

/* Weihnachtsmodus – cyon-Farben, festlich */
body.xmas {
  background:
    radial-gradient(900px 500px at 20% -10%, rgba(210,29,36,.10), transparent 70%),
    radial-gradient(700px 500px at 100% 100%, rgba(23,130,27,.10), transparent 70%),
    #fff9f0;
}
body.xmas .topbar {
  border-bottom: 0;
  box-shadow: 0 4px 0 #d21d24, 0 8px 0 #fff, 0 12px 0 #17821b;
  margin-bottom: 12px;
}
body.xmas .brand-sub::after { content: " · Frohe Festtage"; color: #d21d24; font-weight: 700; }
body.xmas .dmd { color: #ffce00; background-color: #0d3d13; }
body.xmas #game { box-shadow: 0 30px 70px rgba(94,11,22,.35), 0 0 0 3px #d21d24, 0 0 0 7px #fff, 0 0 0 10px #17821b; }
body.xmas .panel { border-top: 4px solid #d21d24; }
body.xmas .panel:nth-child(2) { border-top-color: #17821b; }
body.xmas .panel:nth-child(3) { border-top-color: #ffce00; }
body.xmas .card { border-top: 6px solid #d21d24; }
body.xmas .btn.primary { background: #d21d24; border-color: #d21d24; }
body.xmas .btn.primary:hover { background: #b41d3b; }

/* Gehäuse: Chrom-Seitenleisten, Lockdown-Bar */
.table-wrap {
  padding: 12px 14px 30px;
  border-radius: 20px;
  background:
    linear-gradient(90deg, #6b717c 0, #e9edf3 5px, #8b929e 9px, #1b1b1f 12px, #131313 calc(100% - 12px), #8b929e calc(100% - 9px), #e9edf3 calc(100% - 5px), #6b717c 100%);
  box-shadow: 0 30px 70px rgba(67,47,25,.35), 0 0 0 1px #000, inset 0 2px 0 rgba(255,255,255,.15);
}
.table-wrap::before {
  content: ""; position: absolute; left: 14px; right: 14px; top: 4px; height: 4px; border-radius: 2px;
  background: linear-gradient(90deg, transparent, #ff961f 20%, #ffce00 50%, #ff961f 80%, transparent);
  opacity: .9;
}
.table-wrap::after {
  content: "cyon"; position: absolute; left: 10px; right: 10px; bottom: 5px; height: 18px; border-radius: 9px;
  background: linear-gradient(180deg, #f4f6f9, #9aa3b0 45%, #5d6470 55%, #c9ced6);
  box-shadow: 0 2px 6px rgba(0,0,0,.5);
  font: 800 11px/18px Figtree, sans-serif; letter-spacing: 6px; text-align: center; color: #3a3f48; text-shadow: 0 1px 0 rgba(255,255,255,.6);
}
#game { border-radius: 10px; box-shadow: 0 0 0 2px #000, 0 0 0 4px rgba(255,150,31,.35); }
body.xmas .table-wrap::before { background: repeating-linear-gradient(90deg, #d21d24 0 14px, #fff 14px 28px, #17821b 28px 42px, #fff 42px 56px); }
body.xmas #game { box-shadow: 0 0 0 2px #000, 0 0 0 4px rgba(210,29,36,.5); }
.overlay { border-radius: 20px; }
