/* Robbenvolley - robbenvolley.herrsack.de */

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

:root {
  --himmel: #9fd8f5;
  --meer: #2f7fae;
  --sand: #efd9a7;
  --text: #2a2620;
  --text-leise: #5d5548;
  --karte: rgba(255, 250, 238, 0.95);
  --links: #7a6656;
  --rechts: #566778;
  --akzent: #ff5a4f;
  --fokus: #ff5a4f;
  --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(--text);
  background: linear-gradient(#bfe6fb, #f3e6c6);
  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;
  background: var(--himmel);
}

@media (min-width: 900px) and (min-height: 620px) {
  .rahmen {
    width: min(1180px, calc(100vw - 48px));
    height: min(760px, calc(100dvh - 48px));
    border-radius: 26px;
    box-shadow: 0 18px 50px rgba(40, 60, 80, 0.35), 0 0 0 1px rgba(40, 60, 80, 0.08);
  }
}

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

.ansicht {
  position: absolute;
  inset: 0;
}

/* --- title ------------------------------------------------------------ */
.titel {
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: clamp(18px, 4vh, 40px) 24px 18px;
  text-align: center;
  background: linear-gradient(rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 70%);
}

.spielname {
  margin: 0;
  font-size: clamp(44px, 9vw, 84px);
  font-weight: 800;
  line-height: 1;
  color: var(--meer);
  letter-spacing: -0.01em;
}
.spielname span { color: var(--akzent); }

.untertitel {
  margin: 10px auto 0;
  max-width: 34ch;
  font-size: clamp(17px, 2.4vw, 21px);
  color: var(--text-leise);
}

.titel-mitte {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.knopfzeile, .knopfreihe {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.tastenhilfe {
  margin-top: 6px;
  padding: 10px 16px;
  border-radius: 14px;
  background: rgba(255, 250, 238, 0.82);
  font-size: 16px;
  color: var(--text-leise);
}
.tastenhilfe p { margin: 2px 0; }

.seite-links { color: var(--links); font-weight: 700; }
.seite-rechts { color: var(--rechts); font-weight: 700; }

.titel-fuss .links {
  display: flex;
  gap: 18px;
  justify-content: center;
  font-size: 15px;
}
.titel-fuss a { color: var(--text-leise); }

/* only the last played mode carries the Enter key */
.modi .knopf:not(.haupt) .taste { display: none; }

.gegnerwahl {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(255, 250, 238, 0.82);
}
.gegnerwahl .pfeil {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: #fff8ea;
  font: inherit;
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
  cursor: pointer;
}
.gegnerwahl .pfeil:hover { background: #fff; }
.gegnerwahl .pfeil:disabled { opacity: 0.35; cursor: default; }
.gegner { margin: 0 6px; min-width: 15em; font-size: 17px; }
.gegner span#gegner-name { font-weight: 800; }
.gegner-stufe {
  display: inline-block;
  min-width: 1.5em;
  border-radius: 999px;
  background: var(--meer);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
}
.gegner-art { color: var(--text-leise); }

/* --- sound and motion switches, as in the other games --- */
.schalter { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin: 6px 0; }
.knopf.mini { font-size: 0.9rem; padding: 0.35em 0.9em 0.25em; min-height: 40px; }
.knopf.mini[aria-pressed="false"][data-aktion="ton"] { opacity: 0.7; }
.schicht .schalter { margin-top: 14px; }
[data-ruhig] * { transition: none !important; animation: none !important; }

/* --- end of a run and leaderboard --- */
.ende-info { margin: 0 0 10px; font-weight: 600; color: var(--text-leise); }
.eintrag { margin: 6px 0 12px; text-align: left; }
.eintrag label { display: block; margin-bottom: 6px; font-weight: 600; }
.eintrag-zeile { display: flex; gap: 8px; }
.eintrag-zeile input { flex: 1; min-width: 0; padding: 8px 12px; border: 2px solid rgba(47, 42, 36, 0.25); border-radius: 12px; font: inherit; }
.eintrag-info { min-height: 1.2em; margin: 6px 0 0; font-size: 15px; }
.eintrag-info.fehler { color: #c0392b; }
.eintrag-info.gut { color: #2e7d32; }
.liste { margin: 8px 0 14px; padding: 0; list-style: none; min-width: min(80vw, 320px); }
.liste li { display: flex; gap: 10px; padding: 5px 10px; border-radius: 10px; }
.liste li:nth-child(odd) { background: rgba(240, 219, 166, 0.45); }
.liste li.du { background: #ffe08a; font-weight: 800; }
.liste .platz { width: 2em; text-align: right; }
.liste .name { flex: 1; text-align: left; }
.liste .wert { font-weight: 700; }
.schicht.oben { z-index: 30; }

/* --- beach tour ---------------------------------------------------------------- */
.tourknopf { display: inline-flex; flex-direction: column; align-items: center; gap: 0; line-height: 1.15; }
.tourknopf .tour-stand { font-size: 14px; font-weight: 600; color: var(--text-leise); }
.strandwahl { min-width: 10em; }

/* before a set: beach and rule in one sentence, gone after three seconds or any key */
.ansage {
  position: absolute;
  left: 50%;
  top: 24%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: min(90%, 560px);
  padding: 16px 26px;
  border: 0;
  border-radius: 18px;
  background: rgba(255, 250, 238, 0.94);
  box-shadow: 0 8px 30px rgba(40, 30, 10, 0.25);
  font: inherit;
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  cursor: pointer;
}
.ansage-nr { font-size: 15px; font-weight: 600; color: var(--text-leise); }
.ansage-nr:empty { display: none; }

/* --- buttons ---------------------------------------------------------- */
.knopf {
  font: inherit;
  font-weight: 700;
  font-size: 19px;
  padding: 10px 22px;
  border: 0;
  border-radius: 999px;
  background: #fff8ea;
  color: var(--text);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.12);
  cursor: pointer;
}
.knopf:hover { background: #fff; }
.knopf.haupt {
  font-size: 24px;
  padding: 12px 34px;
  background: var(--akzent);
  color: #fff;
}
.knopf.haupt:hover { background: #ff6e64; }
.knopf.klein { font-size: 17px; padding: 8px 18px; }

.knopf:focus-visible, a:focus-visible, .pausenknopf:focus-visible, .pfeil:focus-visible, .ware:focus-visible, .ansage:focus-visible, .eintrag-zeile input:focus-visible {
  outline: 3px solid var(--fokus);
  outline-offset: 3px;
}

.taste {
  display: inline-block;
  min-width: 1.6em;
  padding: 0 6px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.72em;
  font-weight: 700;
  line-height: 1.5;
  text-align: center;
  background: rgba(0, 0, 0, 0.08);
  color: inherit;
}
.knopf.haupt .taste { background: rgba(255, 255, 255, 0.25); }

/* --- game ------------------------------------------------------------- */
.spiel { pointer-events: none; }
.spiel:focus { outline: none; }

.hud {
  position: absolute;
  top: 10px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
}

.stand {
  margin: 0;
  padding: 2px 22px;
  border-radius: 999px;
  background: rgba(255, 250, 238, 0.85);
  font-size: clamp(30px, 5vw, 44px);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.doppelpunkt { margin: 0 10px; color: var(--text-leise); }

.hud { flex-direction: column; align-items: center; }
.namen {
  display: flex;
  gap: 12px;
  margin: 0 0 4px;
  font-size: 15px;
}
.namen span {
  min-width: 8em;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(255, 250, 238, 0.75);
}
.namen span:first-child { text-align: right; }
.namen span:last-child { text-align: left; }

.pausenknopf {
  position: absolute;
  top: 0;
  right: 14px;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 250, 238, 0.85);
  cursor: pointer;
  pointer-events: auto;
}
.pausenknopf svg { width: 24px; height: 24px; fill: var(--text); }

.banner {
  position: absolute;
  top: 32%;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  padding: 6px 22px;
  border-radius: 999px;
  background: rgba(255, 250, 238, 0.92);
  font-size: clamp(22px, 4vw, 32px);
  font-weight: 800;
  color: var(--akzent);
}

/* --- dialogs ---------------------------------------------------------- */
.schicht {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(30, 50, 70, 0.35);
}

.karte {
  min-width: min(360px, 90vw);
  padding: 22px 28px 26px;
  border-radius: var(--rund);
  background: var(--karte);
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}
.karte h2 { margin: 0 0 6px; font-size: 32px; }
.endstand { margin: 0 0 16px; font-size: 44px; font-weight: 800; font-variant-numeric: tabular-nums; }

/* --- step 10: touch ---------------------------------------------------- */
/* html[data-touch] is set by the app after the first touch (or on a touch-first device) */
.touch, .nur-touch { display: none; }
html[data-touch] .touch { display: block; }
html[data-touch] p.nur-touch { display: block; }
html[data-touch] .nur-tasten, html[data-touch] kbd.taste { display: none; }

.touch { position: absolute; inset: 0; pointer-events: none; }
.pad-lauf, .pad-sprung {
  position: absolute;
  bottom: max(14px, env(safe-area-inset-bottom));
  display: flex;
  align-items: flex-end;
  gap: 12px;
  pointer-events: auto;
}
.tt {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  padding: 0;
  border: 3px solid rgba(42, 38, 32, 0.55);
  border-radius: 50%;
  background: rgba(255, 250, 238, 0.55);
  touch-action: none;
  -webkit-touch-callout: none;
  cursor: pointer;
}
.tt svg { width: 46%; height: 46%; fill: none; stroke: var(--text); stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.tt.gross { width: 92px; height: 92px; }
.tt.klein { width: 58px; height: 58px; }
.tt.gedrueckt { background: rgba(255, 250, 238, 0.95); transform: scale(0.94); }

/* solo: move bottom left, jump bottom right */
.touch.solo .pad-rechts { display: none; }
.touch.solo .pad-lauf { left: max(16px, env(safe-area-inset-left)); }
.touch.solo .pad-sprung { right: max(16px, env(safe-area-inset-right)); }
/* duel on a tablet: one field per side, the jump buttons above the move buttons */
.touch.duell .pad-links .pad-lauf { left: max(16px, env(safe-area-inset-left)); }
.touch.duell .pad-links .pad-sprung { left: max(16px, env(safe-area-inset-left)); bottom: 106px; }
.touch.duell .pad-rechts .pad-lauf { right: max(16px, env(safe-area-inset-right)); }
.touch.duell .pad-rechts .pad-sprung { right: max(16px, env(safe-area-inset-right)); bottom: 106px; flex-direction: row-reverse; }
.touch.duell .tt.gross { width: 80px; height: 80px; }
.touch.duell .pad-links .tt { border-color: rgba(122, 102, 86, 0.8); }
.touch.duell .pad-rechts .tt { border-color: rgba(86, 103, 120, 0.8); }

@media (max-height: 520px) {
  .tt { width: 62px; height: 62px; }
  .tt.gross { width: 80px; height: 80px; }
  .tt.klein { width: 52px; height: 52px; }
}

/* low screens (phones held sideways): everything smaller, the title may scroll */
@media (max-height: 520px) {
  .titel { padding: 8px max(12px, env(safe-area-inset-left)) 6px; overflow-y: auto; }
  .spielname { font-size: 38px; }
  .untertitel { display: none; }
  .titel-mitte { gap: 7px; }
  .knopfzeile, .knopfreihe { gap: 6px; }
  .knopf { font-size: 15px; padding: 6px 14px; }
  .knopf.haupt { font-size: 18px; padding: 8px 22px; }
  .knopf.klein { font-size: 14px; padding: 5px 12px; }
  .tourknopf .tour-stand { font-size: 12px; }
  .gegnerwahl .pfeil { width: 32px; height: 32px; font-size: 20px; }
  .gegner { font-size: 14px; min-width: 11em; }
  .strandwahl { min-width: 7em; }
  .tastenhilfe { margin-top: 0; padding: 4px 12px; font-size: 13px; }
  .titel-fuss { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 14px; }
  .titel-fuss .links { font-size: 12px; gap: 12px; }
  .knopf.mini { min-height: 32px; font-size: 13px; padding: 0.2em 0.8em 0.1em; }
  .schalter { margin: 2px 0; }
  .karte { padding: 12px 18px 14px; max-height: 96dvh; overflow-y: auto; }
  .karte h2 { font-size: 24px; }
  .endstand { font-size: 32px; margin-bottom: 8px; }
  .huette-bild { height: 100px; }
  .laden { grid-template-columns: repeat(auto-fill, minmax(8em, 1fr)); gap: 4px; }
  .ware { font-size: 13px; padding: 3px 6px; }
  .laden-titel { margin: 4px 0; font-size: 17px; }
  .stand { font-size: 28px; padding: 0 16px; }
  .namen { font-size: 13px; }
  .namen span { min-width: 6em; }
  .pausenknopf { width: 40px; height: 40px; }
  .ansage { font-size: 18px; }
}

/* phones: games against the computer only */
html[data-handy] .modi [data-modus="duell"], html[data-handy] [data-aktion="wild-spieler"], html[data-handy] .duellwahl { display: none; }

/* held upright: a hint to turn the device (touch devices only) */
.drehen { display: none; }
@media (orientation: portrait) {
  html[data-touch] .drehen {
    position: absolute;
    inset: 0;
    z-index: 50;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 10px;
    padding: 24px;
    background: var(--himmel);
    text-align: center;
    font-size: 22px;
    font-weight: 700;
  }
  .drehen svg { width: 90px; height: 90px; fill: none; stroke: var(--text); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
  .drehen p { margin: 0; max-width: 16em; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* step 9: your seal, accessories, shop */
.huette { max-width: min(94vw, 560px); max-height: 94vh; overflow-y: auto; background: #fbf4e4; }
.muscheln { margin: 0 0 4px; font-weight: 800; }
.muscheln::before, .ende-muscheln::before { content: ''; display: inline-block; width: 0.9em; height: 0.75em; margin-right: 0.35em; border-radius: 0.9em 0.9em 0.25em 0.25em; background: repeating-linear-gradient(90deg, #f4b38a 0 3px, #ffd9c0 3px 6px); border: 2px solid var(--text); vertical-align: -0.05em; }
.huette-bild { display: block; width: 100%; height: 170px; margin: 4px 0 6px; border-radius: 14px; background: linear-gradient(#bfe6f8 0 55%, #f0dba6 55%); }
.robbe-name { font-weight: 800; }
.gegner.klein { font-size: 15px; min-width: 13em; }
.gesperrt .robbe-name { opacity: 0.55; }
.duellwahl { display: flex; flex-wrap: wrap; gap: 6px 10px; justify-content: center; align-items: center; margin: 6px 0 2px; }
.laden-titel { margin: 10px 0 6px; font-size: 20px; }
.laden { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5em, 1fr)); gap: 6px; }
.ware { display: flex; flex-direction: column; align-items: center; padding: 6px 8px 5px; border: 2px solid rgba(47, 42, 36, 0.25); border-radius: 12px; background: rgba(255, 255, 255, 0.7); font: inherit; font-size: 15px; font-weight: 700; color: var(--text); cursor: pointer; line-height: 1.2; }
.ware:hover { background: #fff; }
.ware .preis { font-size: 13px; font-weight: 600; color: var(--text-leise); }
.ware.besitz .preis { color: #2e7d32; }
.ware[aria-pressed="true"] { border-color: var(--akzent); background: #fff3d6; }
.laden-info { min-height: 1.2em; margin: 8px 0 4px; font-size: 15px; }
.ende-muscheln { margin: 0 0 10px; font-size: 19px; font-weight: 800; color: #9a5a2c; }
.ende-neu { margin: -2px 0 12px; padding: 6px 12px; border-radius: 12px; background: #fff3d6; font-weight: 700; }

/* low screens: "Deine Robbe" in two columns, the seal left, the shop right */
@media (max-height: 520px) {
  .huette {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    column-gap: 16px;
    align-items: start;
    max-width: 96vw;
    width: 96vw;
    max-height: 94dvh;
  }
  .huette > h2 { grid-column: 1; grid-row: 1; font-size: 22px; }
  .huette > .muscheln { grid-column: 1; grid-row: 2; }
  .huette > .huette-bild { grid-column: 1; grid-row: 3; height: 96px; margin: 2px 0 4px; }
  .huette > .gegnerwahl { grid-column: 1; grid-row: 4; }
  .huette > .duellwahl { grid-column: 1; grid-row: 5; }
  .huette > .laden-titel { grid-column: 2; grid-row: 1; margin: 4px 0; }
  .huette > .laden { grid-column: 2; grid-row: 2 / 5; }
  .huette > .laden-info { grid-column: 2; grid-row: 5; font-size: 13px; margin: 4px 0; }
  .huette > .knopfreihe { grid-column: 1 / 3; grid-row: 6; margin-top: 4px; }
  .huette .gegner { min-width: 0; flex: 1; }
  .huette > .laden { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .huette > .muscheln { margin: 0; }
  .ware { font-size: 12px; padding: 2px 4px; }
  .ware .preis { font-size: 11px; }
}
