/* Pinguinrutsch - pinguin.herrsack.de */

@font-face {
  font-family: "Baloo 2";
  src: url("assets/baloo2.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
}

:root {
  --lila: #5a4fb3;
  --lila-dunkel: #43399a;
  --lila-hell: #ece9ff;
  --nacht: #1f2346;
  --schnee: #fbfdff;
  --eis: #d9ecfb;
  --gold: #ffc83d;
  --fokus: #ffcf3a;
  --schatten: 0 6px 22px rgba(36, 40, 96, 0.22);
  --rund: 18px;
  color-scheme: light;
}

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

html, body { height: 100%; margin: 0; }

body {
  font-family: "Baloo 2", "Trebuchet MS", system-ui, sans-serif;
  color: var(--nacht);
  background: linear-gradient(180deg, #a596e3 0%, #c6d3f5 55%, #e8f2fc 100%);
  display: grid;
  place-items: center;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

/* --- frame ------------------------------------------------------------ */
.rahmen {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

@media (min-width: 900px) and (min-height: 620px) {
  .rahmen {
    width: min(1100px, calc(100vw - 48px));
    height: min(760px, calc(100dvh - 48px));
    border-radius: 26px;
    box-shadow: 0 18px 60px rgba(40, 36, 110, 0.35);
  }
}
/* big screens and digital boards: use more of the room */
@media (min-width: 1500px) and (min-height: 900px) {
  .rahmen { width: min(1440px, calc(100vw - 64px)); height: min(940px, calc(100dvh - 64px)); }
  html { font-size: 19px; }
}

.buehne {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.ansicht {
  position: absolute;
  inset: 0;
  padding: max(14px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

/* --- buttons -------------------------------------------------------------- */
.knopf {
  font: inherit;
  font-weight: 700;
  font-size: 1.15rem;
  line-height: 1.1;
  color: var(--lila-dunkel);
  background: var(--schnee);
  border: 3px solid var(--lila);
  border-radius: 999px;
  padding: 0.55em 1.3em 0.45em;
  min-height: 48px;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--lila-dunkel);
  transition: transform 0.08s ease, box-shadow 0.08s ease, background-color 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  touch-action: manipulation;
}
.knopf:hover { background: var(--lila-hell); }
.knopf:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--lila-dunkel); }
.knopf:focus-visible, .pausenknopf:focus-visible, .wahl-karte:focus-visible, a:focus-visible, input:focus-visible {
  outline: 4px solid var(--fokus);
  outline-offset: 3px;
}
.knopf.haupt { color: #fff; background: var(--lila); border-color: var(--lila-dunkel); font-size: 1.4rem; }
.knopf.haupt:hover { background: #6a5fc6; }
.knopf.klein { font-size: 1rem; padding: 0.45em 1em 0.35em; min-height: 44px; }
.knopf.mini { font-size: 0.9rem; padding: 0.35em 0.9em 0.25em; min-height: 40px; border-width: 2px; box-shadow: 0 3px 0 var(--lila-dunkel); }
.knopf[aria-pressed="false"][data-aktion="ton"] { color: #6b6f8f; border-color: #9a9cc0; box-shadow: 0 3px 0 #7d80a8; }

kbd, .taste {
  font: inherit;
  font-size: 0.72em;
  font-weight: 700;
  line-height: 1;
  padding: 0.25em 0.45em 0.15em;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--lila-dunkel);
  border: 1.5px solid currentColor;
  box-shadow: 0 2px 0 rgba(31, 35, 70, 0.25);
}
.knopf.haupt .taste { background: rgba(255, 255, 255, 0.18); color: #fff; }
/* key hints only where there is a keyboard and a mouse */
.taste, .tastenhinweis { display: none; }
@media (hover: hover) and (pointer: fine) {
  .taste { display: inline-block; }
  .tastenhinweis { display: flex; }
}

/* --- title ------------------------------------------------------------------ */
.titel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
}
.titel-kopf { margin-top: 2vh; }
.spielname {
  margin: 0;
  font-size: clamp(2.6rem, 9vw, 4.6rem);
  font-weight: 800;
  line-height: 0.95;
  color: #fff;
  letter-spacing: 0.01em;
  text-shadow: 0 4px 0 var(--lila-dunkel), 0 10px 24px rgba(40, 30, 120, 0.35);
}
.spielname span { color: var(--gold); }
.untertitel {
  margin: 0.4em 0 0;
  font-size: clamp(1rem, 3.5vw, 1.25rem);
  font-weight: 600;
  color: #fff;
  text-shadow: 0 2px 6px rgba(40, 30, 120, 0.45);
}
.titel-mitte { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.knopfzeile { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.rekord {
  margin: 4px 0 0;
  font-size: 1.05rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 999px;
  padding: 0.2em 1em 0.1em;
}
.titel-fuss { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; }
.schalter { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.links { display: flex; gap: 6px 18px; flex-wrap: wrap; justify-content: center; font-size: 0.95rem; }
.links a {
  color: var(--nacht);
  font-weight: 600;
  background: rgba(255, 255, 255, 0.78);
  border-radius: 8px;
  padding: 0.1em 0.5em 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.links a:hover { background: #fff; color: var(--lila-dunkel); }

/* landscape phones: title in two columns */
@media (orientation: landscape) and (max-height: 520px) {
  .titel { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr auto; align-items: center; justify-items: center; gap: 8px; }
  .titel-kopf { margin: 0; }
  .titel-fuss { grid-column: 1 / -1; flex-direction: row; justify-content: center; flex-wrap: wrap; }
  .spielname { font-size: 2.6rem; }
}

/* --- in game ---------------------------------------------------------------- */
.spiel { touch-action: none; cursor: default; }
.hud {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  left: max(14px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  gap: 4px;
  pointer-events: none;
  color: #fff;
  text-shadow: 0 2px 0 rgba(53, 44, 140, 0.75), 0 3px 10px rgba(40, 30, 120, 0.4);
}
.hud-punkte { display: flex; align-items: baseline; gap: 6px; }
.hud-punkte span { font-size: clamp(2rem, 6vw, 2.8rem); font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.hud-punkte small { font-size: 1rem; font-weight: 700; }
.hud-klein { display: flex; gap: 14px; font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.hud-fische { display: inline-flex; align-items: center; gap: 5px; }
.fisch-symbol { width: 22px; height: 13px; fill: #fff; filter: drop-shadow(0 2px 0 rgba(53, 44, 140, 0.75)); }
.kette { display: flex; gap: 4px; margin-top: 2px; }
.kette i {
  width: 16px;
  height: 10px;
  border-radius: 50% 40% 40% 50%;
  background: rgba(255, 255, 255, 0.35);
  border: 2px solid rgba(255, 255, 255, 0.85);
  transition: background-color 0.15s ease;
}
.kette i.voll { background: var(--gold); border-color: #fff; }

.pausenknopf {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 3px solid #fff;
  background: rgba(90, 79, 179, 0.85);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: var(--schatten);
}
.pausenknopf:hover { background: var(--lila); }
.pausenknopf svg { width: 26px; height: 26px; fill: currentColor; }

.tastenhinweis {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 14px;
  margin: 0;
  justify-content: center;
  gap: 18px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--nacht);
  pointer-events: none;
}
.tastenhinweis span { background: rgba(255, 255, 255, 0.82); border-radius: 999px; padding: 0.15em 0.8em 0.05em; display: inline-flex; gap: 4px; align-items: center; }

.wischhinweis, .meldung {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  text-align: center;
  pointer-events: none;
}
.wischhinweis {
  top: 38%;
  width: min(92%, 380px);
  font-size: 1.15rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.9);
  border-radius: var(--rund);
  padding: 0.6em 1em 0.5em;
  box-shadow: var(--schatten);
}
.meldung {
  top: 26%;
  font-size: clamp(1.8rem, 7vw, 3rem);
  font-weight: 800;
  color: #fff;
  white-space: nowrap;
  text-shadow: 0 3px 0 var(--lila-dunkel), 0 8px 20px rgba(40, 30, 120, 0.4);
  opacity: 0;
}
.meldung.zeigen { animation: meldung 1.2s ease-out forwards; }
@keyframes meldung {
  0% { opacity: 0; transform: translateX(-50%) scale(0.6); }
  15% { opacity: 1; transform: translateX(-50%) scale(1.08); }
  25% { transform: translateX(-50%) scale(1); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-12px); }
}
.fps {
  position: absolute;
  right: 14px;
  bottom: 10px;
  margin: 0;
  font: 600 0.9rem/1 ui-monospace, monospace;
  background: rgba(0, 0, 0, 0.6);
  color: #9f9;
  padding: 4px 6px;
  border-radius: 6px;
}

/* --- layers (pause, end, dialogs) ---------------------------------------------- */
.schicht {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(40, 36, 100, 0.35);
  overflow-y: auto;
  z-index: 10;
}
.karte {
  width: min(100%, 440px);
  background: var(--schnee);
  border-radius: 24px;
  padding: 22px 22px 20px;
  box-shadow: var(--schatten);
  text-align: center;
  animation: auf 0.22s ease-out;
}
.karte.breit { width: min(100%, 720px); }
@keyframes auf { from { opacity: 0; transform: translateY(14px) scale(0.97); } to { opacity: 1; transform: none; } }
.karte h2 { margin: 0 0 6px; font-size: 2rem; line-height: 1.05; color: var(--lila-dunkel); }
.karte p { margin: 0.3em 0; font-size: 1.1rem; }
.knopfreihe { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }

.ende-satz { color: #4a4f78; }
.ende-punkte { font-size: 1.4rem !important; font-weight: 700; }
.ende-punkte strong { font-size: 3rem; color: var(--lila); line-height: 1; font-variant-numeric: tabular-nums; }
.ende-werte { font-weight: 600; color: #4a4f78; }
.abzeichen {
  display: inline-block;
  margin: 6px 4px 0 !important;
  padding: 0.2em 0.9em 0.1em;
  border-radius: 999px;
  background: var(--gold);
  color: #4a3200;
  font-weight: 800;
}
.abzeichen.neu { background: #bfe8c9; color: #11532a; }

.eintrag { margin-top: 12px; text-align: left; }
.eintrag label { display: block; font-weight: 700; margin-bottom: 6px; }
.eintrag-zeile { display: flex; gap: 8px; }
.eintrag input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 1.15rem;
  font-weight: 600;
  padding: 0.4em 0.7em 0.3em;
  border: 3px solid var(--lila);
  border-radius: 14px;
  background: #fff;
  color: var(--nacht);
}
.eintrag-info { font-size: 1rem !important; color: #4a4f78; min-height: 1.2em; }
.eintrag-info.fehler { color: #a3222e; font-weight: 700; }
.eintrag-info.gut { color: #11632f; font-weight: 700; }

.anleitung { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 10px; text-align: left; }
.anleitung li { display: grid; grid-template-columns: 120px 1fr; gap: 14px; align-items: center; }
.anleitung canvas { width: 120px; height: 88px; border-radius: 14px; background: #eef4fb; }
.anleitung p { margin: 0; font-size: 1.08rem; }
@media (max-width: 480px) {
  .anleitung li { grid-template-columns: 92px 1fr; gap: 10px; }
  .anleitung canvas { width: 92px; height: 67px; }
  .anleitung p { font-size: 1rem; line-height: 1.3; }
  .karte { padding: 18px 14px 16px; }
}
/* keyboard hints inside sentences only where there is a keyboard */
.nur-tastatur { display: none; }
@media (hover: hover) and (pointer: fine) { .nur-tastatur { display: inline; } }

.wahl { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-top: 12px; }
.wahl-karte {
  font: inherit;
  border: 3px solid #d5d8ee;
  background: #fff;
  border-radius: 18px;
  padding: 10px 8px 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--nacht);
}
.wahl-karte:hover { border-color: var(--lila); }
.wahl-karte[aria-pressed="true"] { border-color: var(--lila); background: var(--lila-hell); box-shadow: 0 0 0 3px var(--lila) inset; }
.wahl-karte:disabled { cursor: not-allowed; opacity: 0.65; }
.wahl-karte canvas { width: 110px; height: 110px; }
.wahl-karte strong { font-size: 1.05rem; }
.wahl-karte small { font-size: 0.9rem; color: #5b6088; }

.liste { margin: 8px 0 0; padding: 0; list-style: none; text-align: left; max-height: 50vh; overflow-y: auto; }
.liste li { display: grid; grid-template-columns: 2.2em 1fr auto; gap: 8px; padding: 6px 10px 4px; border-radius: 10px; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.liste li:nth-child(odd) { background: #f0f3fb; }
.liste li.du { background: #fff1c2; font-weight: 700; }
.liste .platz { font-weight: 800; color: var(--lila); }
.liste .wert { font-weight: 700; }

/* --- storage note ------------------------------------------------------------------- */
.hinweis {
  position: absolute;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(calc(100% - 24px), 560px);
  background: #fff;
  border-radius: 18px;
  padding: 12px 14px;
  box-shadow: var(--schatten);
  display: flex;
  gap: 12px;
  align-items: center;
  z-index: 4;
}
.hinweis p { margin: 0; font-size: 0.98rem; line-height: 1.3; }

.noscript { position: absolute; inset: auto 0 40% 0; text-align: center; font-size: 1.3rem; }

/* --- reduced motion ------------------------------------------------------------------- */
html[data-ruhig] *, html[data-ruhig] *::before, html[data-ruhig] *::after {
  animation: none !important;
  transition: none !important;
}
html[data-ruhig] .meldung.zeigen { opacity: 1; }
