/* ============ Spielehelfer — Frutiger Aero ============ */

@font-face {
  font-family: 'Clash Grotesk';
  src: url('../assets/ClashGrotesk-Variable.ttf') format('truetype');
  font-weight: 200 700;
  font-display: swap;
}

:root {
  /* Warme, flache Brettspiel-Palette (Variablennamen historisch) */
  --aqua: #c23327;
  --aqua-deep: #9c2820;
  --aqua-dark: #7a1f19;
  --aqua-light: #f3d9d0;
  --aero-green: #3f9142;
  --ink: #26211b;
  --ink-soft: #6f665a;
  --glass: #fffdf8;
  --glass-border: #e6ddcd;
  --radius: 18px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Clash Grotesk', 'Segoe UI', sans-serif;
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
  background: #f1ede4;
}

/* ---------- Header ---------- */
.site-header {
  text-align: center;
  padding: 44px 20px 6px;
  user-select: none;
}
.logo {
  display: inline-block;
  font-weight: 650;
  font-size: clamp(2.6rem, 7vw, 4.4rem);
  letter-spacing: -0.02em;
  color: var(--ink);
  cursor: default;
}
.tagline {
  margin-top: 4px;
  font-weight: 450;
  font-size: clamp(0.95rem, 2.4vw, 1.15rem);
  color: var(--ink-soft);
}

/* ---------- Home grid ---------- */
main { padding: 26px clamp(14px, 4vw, 48px) 90px; max-width: 1180px; margin: 0 auto; }

@keyframes floatIn {
  from { opacity: 0; transform: translateY(18px) scale(0.92); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- Landing ---------- */
.landing {
  min-height: 84vh;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.landing-title {
  font-weight: 700;
  font-size: clamp(2.6rem, 11vw, 7.5rem);
  letter-spacing: 0.04em;
  text-align: center;
  color: var(--ink);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation: floatIn 0.5s ease backwards;
}
.landing:hover .landing-title { transform: scale(1.045); }

/* ---------- Spielesammlung (Regal) ---------- */
body.view-sammlung main { padding: 0 0 90px; max-width: none; }
body.view-sammlung .tagline { display: none; }
body.view-sammlung .site-header { padding: 30px 20px 18px; }
body.view-sammlung .logo { text-transform: uppercase; letter-spacing: 0.05em; }

.shelf {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 10px;
  width: 100%;
}

.game-box {
  position: relative;
  display: flex;
  align-items: stretch;
  width: 100%;
  aspect-ratio: 13 / 2;   /* feste Proportion: Schachtel + Hintergrundbild skalieren gemeinsam */
  border: 2px solid var(--ink);
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  overflow: hidden;
  background-size: 100% 100%;   /* Bild füllt exakt — nichts wird abgeschnitten */
  background-position: center;
  transition: transform 0.18s ease;
}

@media (max-width: 700px) {
  .shelf { grid-template-columns: 1fr; }
  /* einspaltig ist die Schachtel doppelt so breit — Titel proportional mitskalieren */
  .game-box .box-title { font-size: 6.4vw; }
}
.game-box:hover, .game-box:focus-visible { transform: scale(1.02); z-index: 5; }

.box-title {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4%;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-size: clamp(1.2rem, 3.4vw, 2.4rem);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  z-index: 1;
}

/* Würfel-Bereich: keine Fläche, kein Hintergrund — nur das Bild */
.die-pad {
  flex: none;
  align-self: center;
  height: 76%;
  aspect-ratio: 1;
  margin-right: 2.5%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}
.die-face {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.die-face img.print {
  width: 100%; height: 100%;
  object-fit: contain;
}
.die-face img.custom {
  width: 100%; height: 100%;
  object-fit: contain;
}
.die-emoji { font-size: clamp(1.4rem, 4vh, 2.4rem); }

/* ---------- Hover-Hand ---------- */
.hover-hand {
  position: absolute;
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
  z-index: 3;
}
.hover-hand img { height: 100%; width: auto; display: block; }
.game-box:hover .hover-hand { opacity: 1; }

/* Globaler Button-Hover: die Hand zeigt auf jeden Button */
.btn { position: relative; }
body.hand-on .btn:hover::after,
.btn.hand-demo.on::after {
  content: '';
  position: absolute;
  top: -1.1em;
  right: -0.6em;
  width: 3em;
  height: 3em;
  background-image: var(--hand-url);
  background-size: contain;
  background-position: top right;
  background-repeat: no-repeat;
  transform: rotate(var(--hand-rot, -135deg));
  pointer-events: none;
  z-index: 5;
}

/* ---------- Seiten-Styles (pro Spielseite anpassbar) ---------- */
.tool-view .btn { border-radius: var(--pbtn-radius, 12px); }
.tool-view .btn:not(.green):not(.red):not(.ghost) {
  background: var(--pbtn-bg, var(--ink));
  color: var(--pbtn-fg, #fffdf8);
}
.tool-view .glass-panel { background: var(--ppanel-bg, var(--glass)); }
.tool-view .tool-title { color: var(--ptitle, var(--ink)); }

input.color {
  padding: 2px;
  width: 54px;
  height: 40px;
  border: 1.5px solid var(--glass-border);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}

/* Editor-Vorschau */
.box-preview-wrap .game-box.preview {
  height: auto;
  aspect-ratio: 13 / 2;
  cursor: default;
  border-radius: 10px;
}
.box-preview-wrap .game-box.preview .box-title { font-size: 1.3rem; }
.box-preview-wrap .game-box.preview:hover { transform: none; }

/* ---------- Tool view ---------- */
.tool-view { animation: floatIn 0.4s ease backwards; }

.tool-topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.tool-title {
  font-weight: 600;
  font-size: clamp(1.5rem, 4vw, 2.1rem);
  letter-spacing: -0.01em;
  color: var(--ink);
}
.tool-title-icon {
  width: 52px; height: 52px;
  object-fit: contain;
}

.glass-panel {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: clamp(18px, 3.4vw, 34px);
  position: relative;
  overflow: hidden;
}

.panel-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.panel-stack { display: flex; flex-direction: column; gap: 14px; }
.spacer { flex: 1; }
.center { text-align: center; }

/* ---------- Aqua buttons ---------- */
.btn {
  font-family: inherit;
  font-weight: 570;
  font-size: 1rem;
  color: #fffdf8;
  padding: 11px 24px;
  border-radius: 12px;
  border: none;
  background: var(--ink);
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
}
.btn:hover { filter: brightness(1.15); transform: translateY(-1px); }
.btn:active { transform: translateY(1px) scale(0.98); filter: brightness(0.95); }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; filter: grayscale(0.4); }

.btn.green { background: var(--aero-green); }
.btn.red { background: var(--aqua); }
.btn.ghost {
  color: var(--ink);
  border: 1.5px solid var(--glass-border);
  background: #fffdf8;
}
.btn.small { padding: 7px 16px; font-size: 0.9rem; }
.btn.big { padding: 15px 38px; font-size: 1.2rem; }

.back-btn { flex-shrink: 0; }

/* ---------- Inputs ---------- */
.input, select.input, textarea.input {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 480;
  color: var(--ink);
  padding: 10px 16px;
  border-radius: 12px;
  border: 1.5px solid var(--glass-border);
  background: #fff;
  outline: none;
  min-width: 0;
}
.input:focus { border-color: var(--aqua); }
.input.num { width: 92px; text-align: center; }
textarea.input { resize: vertical; }
label.field { display: flex; flex-direction: column; gap: 5px; font-weight: 500; font-size: 0.92rem; color: var(--ink-soft); }

.check {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 500; color: var(--ink-soft); cursor: pointer;
}
.check input { width: 18px; height: 18px; accent-color: var(--aqua); }

/* ---------- Displays ---------- */
.big-display {
  font-weight: 700;
  font-size: clamp(4rem, 16vw, 8.5rem);
  line-height: 1.05;
  text-align: center;
  color: var(--ink);
  min-height: 1.1em;
  word-break: break-word;
}
.sub-display {
  text-align: center;
  color: var(--ink-soft);
  font-weight: 500;
  min-height: 1.4em;
}

.chip-list { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 6px 14px;
  border-radius: 999px;
  background: #fffdf8;
  border: 1px solid var(--glass-border);
  font-weight: 520;
  font-size: 0.92rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.chip .x { cursor: pointer; color: #c22b22; font-weight: 700; }

/* ---------- Tables ---------- */
.aero-table { border-collapse: separate; border-spacing: 0; width: 100%; }
.aero-table th, .aero-table td {
  padding: 9px 12px;
  text-align: center;
  font-weight: 480;
}
.aero-table th {
  font-weight: 600;
  color: #fffdf8;
  background: var(--ink);
  border-right: 1px solid rgba(255,255,255,0.16);
}
.aero-table th:first-child { border-radius: 12px 0 0 0; }
.aero-table th:last-child { border-radius: 0 12px 0 0; border-right: none; }
.aero-table tbody tr:nth-child(odd) td { background: #fffdf8; }
.aero-table tbody tr:nth-child(even) td { background: #f7f3ea; }
.aero-table tr.total td {
  font-weight: 650;
  background: var(--aqua-light);
  border-top: 2px solid rgba(194,51,39,0.45);
}
.aero-table td input {
  width: 64px;
  font-family: inherit;
  font-size: 0.98rem;
  text-align: center;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 5px 4px;
  background: #fff;
  color: var(--ink);
  outline: none;
}
.aero-table td input:focus { border-color: var(--aqua); }
.table-scroll { overflow-x: auto; border-radius: 12px; }

/* ---------- Coin ---------- */
.coin-stage { perspective: 900px; display: flex; justify-content: center; padding: 18px 0; }
.coin {
  width: clamp(150px, 40vw, 220px);
  height: clamp(150px, 40vw, 220px);
  position: relative;
  transform-style: preserve-3d;
  transition: transform 2.6s cubic-bezier(0.18, 0.75, 0.22, 1);
}
.coin-face {
  position: absolute; inset: 0;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 650;
  font-size: 1.6rem;
  color: #5c451a;
  backface-visibility: hidden;
  border: 6px solid #b8963c;
  background: #d9b64a;
}
.coin-face.back {
  transform: rotateY(180deg);
  color: #3c454d;
  border-color: #8d9aa5;
  background: #c2ccd4;
}

/* ---------- Dice ---------- */
.dice-row { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; padding: 10px 0; }
.die {
  width: 86px; height: 86px;
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 2.2rem; color: var(--ink);
  background: #fff;
  border: 2px solid var(--ink);
}
.die.rolling { animation: dieShake 0.5s ease infinite; }
@keyframes dieShake {
  0%, 100% { transform: rotate(0deg) translateY(0); }
  25% { transform: rotate(-8deg) translateY(-6px); }
  75% { transform: rotate(8deg) translateY(-3px); }
}

/* ---------- LCD (Yu-Gi-Oh / Timer) ---------- */
.lcd {
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  letter-spacing: 0.04em;
  background: #dff0e2;
  color: #14532d;
  border-radius: 12px;
  border: 2px solid #14532d;
  padding: 8px 18px;
  display: inline-block;
}

.lp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(10px, 3vw, 26px); }
@media (max-width: 560px) { .lp-grid { grid-template-columns: 1fr; } }
.lp-player {
  border-radius: 18px;
  padding: 16px;
  background: #fffdf8;
  border: 1px solid var(--glass-border);
  display: flex; flex-direction: column; gap: 10px; align-items: center;
}
.lp-player.dead { opacity: 0.55; filter: grayscale(0.7); }
.lp-name { font-weight: 600; font-size: 1.1rem; }
.lp-value { font-size: clamp(2.2rem, 7vw, 3.2rem); }
.lp-bar {
  width: 100%; height: 14px; border-radius: 999px;
  background: #e8e2d5;
  overflow: hidden;
}
.lp-bar > div {
  height: 100%;
  border-radius: 999px;
  background: var(--aero-green);
  transition: width 0.4s ease, background 0.4s ease;
}
.lp-bar.low > div { background: var(--aqua); }
.lp-btns { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; }

/* ---------- Wheel ---------- */
.wheel-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.wheel-stage { position: relative; width: min(78vw, 380px); }
.wheel-stage canvas { width: 100%; height: auto; display: block; }
.wheel-pointer {
  position: absolute;
  top: -6px; left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 16px solid transparent;
  border-right: 16px solid transparent;
  border-top: 30px solid var(--aqua);
  z-index: 2;
}

/* ---------- Hourglass ---------- */
.hourglass-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.hourglass-svg { width: min(56vw, 240px); }
.hourglass-svg.flipping { animation: hgFlip 0.8s ease; }
@keyframes hgFlip { from { transform: rotate(0); } to { transform: rotate(180deg); } }

/* ---------- Soundboard ---------- */
.sound-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 14px;
}
.sound-btn {
  aspect-ratio: 1.15;
  border-radius: 20px;
  font-family: inherit;
  font-weight: 600;
  font-size: 1.05rem;
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: var(--c2, #2eb6e8);
  transition: transform 0.1s ease;
}
.sound-btn:active { transform: scale(0.94); }
.sound-btn .emoji { font-size: 2rem; }

/* ---------- Misc ---------- */
.result-pop {
  animation: pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes pop {
  from { transform: scale(0.4); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.hint { font-size: 0.88rem; color: var(--ink-soft); font-weight: 450; }

.vote-bar-wrap { display: flex; flex-direction: column; gap: 10px; }
.vote-bar {
  position: relative;
  border-radius: 14px;
  background: #fffdf8;
  border: 1px solid var(--glass-border);
  overflow: hidden;
  height: 44px;
}
.vote-bar .fill {
  position: absolute; inset: 0 auto 0 0;
  background: var(--aqua);
  opacity: 0.8;
  transition: width 0.5s ease;
  border-radius: 14px;
}
.vote-bar .label {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px;
  font-weight: 570;
  z-index: 1;
}

.divider { border: none; border-top: 1.5px solid rgba(194,51,39,0.3); margin: 6px 0; }

footer-space { display: block; height: 40px; }

/* ---------- Bearbeiten-Modus ---------- */
.edit-fab {
  position: fixed;
  top: 16px; right: 18px;
  z-index: 120;
  width: 62px; height: 62px;
  border-radius: 50%;
  border: 1.5px solid var(--glass-border);
  background: #fffdf8;
  cursor: pointer;
  padding: 7px;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.2s;
}
.edit-fab:hover { transform: scale(1.08) rotate(-6deg); }
.edit-fab img {
  width: 100%; height: 100%;
  object-fit: contain;
  pointer-events: none;
}
.edit-fab .edit-fab-fallback { font-size: 1.7rem; }
body.edit-mode .edit-fab { border-color: var(--aqua); border-width: 3px; }

/* Hand-Button: nur im Bearbeiten-Modus, unter dem Stift */
.hand-fab { top: 88px; display: none; }
body.edit-mode .hand-fab {
  display: block;
  border-color: var(--glass-border);
  border-width: 1.5px;
}

/* Regal im Bearbeiten-Modus */
body.edit-mode .game-box { user-select: none; -webkit-user-select: none; }
body.edit-mode .game-box:not(.preview) { cursor: grab; }

.game-box.dragging {
  cursor: grabbing;
  transition: none;
  opacity: 0.95;
}
.box-placeholder {
  background: rgba(255,255,255,0.35) !important;
  box-shadow: none;
  border: 2.5px dashed rgba(194,51,39,0.65);
}
.box-placeholder::after { display: none; }

.edit-hint {
  position: fixed;
  bottom: 18px; left: 50%;
  transform: translateX(-50%);
  z-index: 110;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  border-radius: 999px;
  background: #fffdf8;
  border: 1.5px solid var(--glass-border);
  font-weight: 540;
  font-size: 0.92rem;
  color: var(--ink);
  white-space: nowrap;
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(38, 33, 27, 0.4);
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: min(94vw, 420px);
  animation: pop 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modal h3 {
  font-weight: 600;
  font-size: 1.3rem;
  color: var(--ink);
}
.modal.shake { animation: shake 0.4s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-10px); }
  40% { transform: translateX(9px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(4px); }
}
/* ---------- Statistikbuch ---------- */
.section-title {
  font-weight: 600;
  font-size: 1.12rem;
  color: var(--aqua-dark);
  margin-top: 4px;
}

.evening-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  font-family: inherit;
  color: inherit;
  padding: 11px 16px;
  border-radius: 16px;
  background: #fffdf8;
  border: 1.5px solid var(--glass-border);
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.14s ease;
}
.evening-row:hover {
  transform: translateX(3px);
  border-color: var(--aqua);
}
.evening-date {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: var(--aqua-deep);
  white-space: nowrap;
}
.evening-body { flex: 1; min-width: 0; }
.evening-arrow { font-size: 1.5rem; color: var(--ink-soft); }

.game-card {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255,255,255,0.45);
  border: 1.5px solid rgba(255,255,255,0.85);
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.chip.suggestion {
  cursor: pointer;
  color: var(--ink-soft);
  border-style: dashed;
}
.chip.suggestion:hover { color: var(--aqua-deep); background: rgba(255,255,255,0.9); }

.chip.toggle { cursor: pointer; user-select: none; }
.chip.toggle.on {
  color: #fff;
  border-color: var(--aero-green);
  background: var(--aero-green);
}

