/* Zahlenstreifen: eigene Teile. Grundlage (Kopf, Menü, Karten, Knöpfe, Rückmeldung) steht in assets/basis.css. */

:root {
  --tone: #d97706;
  --tone-deep: #b45309;
  --tone-tint: #fff7e6;
  --flag-h: clamp(70px, 15vh, 150px);
  --strip-h: clamp(46px, 9.5vh, 96px);
  --label-fs: clamp(1.15rem, 3.6vh, 2.2rem);
  /* Abstand der 0 und des Endes vom Streifenrand (runde Ecken) */
  --inset: clamp(16px, 1.8vw, 26px);
}

.sheet-one { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
@media (max-aspect-ratio: 1/1) { .sheet-one { grid-template-rows: minmax(0, 1fr); } }

.card-strip {
  --c: var(--tone);
  --tint: var(--tone-tint);
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: clamp(8px, 1.6vh, 18px) clamp(12px, 2vw, 28px) clamp(10px, 1.8vh, 18px);
}

/* ---------- Frage: Wo liegt die 37? ---------- */

.question { display: grid; justify-items: center; }
.q-text {
  display: flex;
  align-items: baseline;
  gap: .28em;
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1;
}
.q-lead { color: var(--muted); font-size: clamp(1.3rem, 4.2vh, 2.4rem); }
.q-num {
  display: inline-block;
  min-width: 2ch;
  padding: .12em .3em 0;
  border: 2px solid transparent;
  border-image: var(--frame) 34 fill / 22px / 0 stretch;
  color: var(--rose);
  font-size: clamp(2.6rem, 11vh, 6.4rem);
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.q-num.is-new { animation: pop .35s ease-out; }

/* ---------- Streifen mit Flaggen ---------- */

/* Streifen unten in der Karte: darüber bleibt Platz für angehobene Flaggen, wenn viele dicht stehen */
.track {
  position: relative;
  align-self: end;
  height: calc(var(--flag-h) + var(--strip-h) + var(--label-fs) * 3.4);
  margin: 0 clamp(18px, 3.4vw, 54px);
  touch-action: none;
  cursor: pointer;
}

.strip {
  position: absolute;
  top: var(--flag-h);
  right: 0;
  left: 0;
  height: var(--strip-h);
  border: 2px solid transparent;
  border-image: var(--frame) 34 fill / 20px / 0 stretch;
  border-radius: 18px;
  background: linear-gradient(90deg, #fff7e6, #fffbeb 50%, #fff7e6);
  box-shadow: var(--shadow);
}
.track.is-target .strip { box-shadow: 0 0 0 4px rgba(217, 119, 6, .28), var(--shadow); }

/* Striche: Enden und Einteilung dunkel, Hilfsskala nach dem Auflösen hell */
.ticks { position: absolute; inset: 0 calc(var(--inset) - 2px); }
.tick {
  position: absolute;
  bottom: 0;
  width: 3px;
  height: 46%;
  margin-left: -1.5px;
  border-radius: 2px;
  background: var(--ink);
}
.tick.is-end { top: 0; height: auto; bottom: 0; }
.tick.is-help { width: 2px; height: 26%; margin-left: -1px; background: #b8bfcd; animation: slide .3s ease-out; }

.tick-labels {
  position: absolute;
  top: calc(var(--flag-h) + var(--strip-h) + 6px);
  right: var(--inset);
  left: var(--inset);
  height: calc(var(--label-fs) * 1.3);
}
.tick-label {
  position: absolute;
  top: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: var(--label-fs);
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  transform: translateX(-50%);
}
.tick-label.is-help { color: #9aa3b5; font-size: calc(var(--label-fs) * .72); font-weight: 700; }
.tick-labels.is-dense .tick-label { font-size: calc(var(--label-fs) * .8); }
.tick-labels.is-dense .tick-label.is-help { font-size: calc(var(--label-fs) * .62); }

/* Lösung: rosa Linie durch den Streifen, Zahl darunter */
.answer {
  position: absolute;
  z-index: 3;
  top: calc(var(--flag-h) - 8px);
  width: 0;
  height: calc(var(--strip-h) + var(--label-fs) * 3.3 + 8px);
  pointer-events: none;
}
.answer-line {
  position: absolute;
  top: 0;
  left: -2.5px;
  width: 5px;
  height: calc(var(--strip-h) + 16px);
  border-radius: 3px;
  background: var(--rose);
  box-shadow: 0 0 0 2px #fff;
}
.answer-num {
  position: absolute;
  bottom: 0;
  left: 0;
  padding: .14em .42em 0;
  border: 2.4px solid var(--rose);
  border-radius: 14px;
  background: #fff;
  color: var(--rose);
  font-family: var(--font-display);
  font-size: calc(var(--label-fs) * 1.25);
  font-weight: 800;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  transform: translateX(-50%);
  box-shadow: 0 8px 18px -10px rgba(225, 29, 72, .6);
}
.answer.is-in .answer-line { animation: drop-line .45s cubic-bezier(.2, .9, .3, 1.2); transform-origin: top; }
.answer.is-in .answer-num { animation: pop-answer .4s .25s both ease-out; }

/* eigene Ebene: die z-index-Werte der Flaggen (Etagen) bleiben darin und rutschen nicht über das Menü */
.flags-layer { position: absolute; z-index: 4; top: 0; right: var(--inset); left: var(--inset); height: var(--flag-h); pointer-events: none; }

/* Flagge auf dem Streifen: Spitze des Stabs (12,5 | 46,4 von 48) sitzt auf der Oberkante.
   Angehobene Flaggen sind um --tall höher (längere Stange), gedrehte zeigen mit dem Tuch nach links. */
.flag {
  position: absolute;
  bottom: 0;
  width: var(--flag-h);
  height: calc(var(--flag-h) * var(--tall, 1));
  margin-left: calc(var(--flag-h) * -.26);
  margin-bottom: calc(var(--flag-h) * -.035);
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
  transition: left .2s ease-out;
}
.flag > svg { display: block; width: 100%; height: 100%; overflow: visible; }
.flag.is-flip { margin-left: calc(var(--flag-h) * -.74); }
.flag.is-flip > svg { transform: scaleX(-1); }
.flag.is-new { animation: plant .32s cubic-bezier(.2, .9, .3, 1.3); transform-origin: 26% 97%; }
.flag.is-flip.is-new { transform-origin: 74% 97%; }
/* Verdeckt gesetzt: wenn alle stehen, poppen die Flaggen nacheinander auf */
.flag.is-show { animation: plant .36s calc(var(--i, 0) * 110ms) cubic-bezier(.2, .9, .3, 1.3) both; transform-origin: 26% 97%; }
.flag.is-flip.is-show { transform-origin: 74% 97%; }
.flag.is-picked { filter: drop-shadow(0 0 0 #fff) drop-shadow(0 0 5px rgba(28, 34, 48, .55)); }
.flag.is-dragging { opacity: .25; transition: none; }
.flag.is-far { opacity: .78; }
.flag.is-best { animation: cheer .7s ease-out; }
/* Kopf = oberes Flaggenquadrat; Zahl mittig im Tuch (27 | 17,5 von 48), Stern oben auf der Stange */
.flag-head { position: absolute; top: 0; left: 0; width: 100%; height: var(--flag-h); pointer-events: none; }
.flag-num {
  position: absolute;
  top: 37%;
  left: 56.5%;
  padding-top: .06em;
  color: #fff;
  font-family: var(--font-display);
  font-size: calc(var(--flag-h) * var(--num-scale, .21));
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-align: center;
  white-space: nowrap;
  text-shadow: 0 1px 0 rgba(28, 34, 48, .5), 0 0 3px rgba(28, 34, 48, .35);
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.flag.is-flip .flag-num { left: 43.5%; }
.flag[data-light] .flag-num { color: var(--ink); text-shadow: none; }
.flag-star {
  position: absolute;
  top: 9%;
  left: 26%;
  width: 36%;
  height: 36%;
  margin: -18% 0 0 -18%;
  --art-color: #fbbf24;
  animation: pop .4s .2s both ease-out;
}
.flag.is-flip .flag-star { left: 74%; }
.flag-star svg { width: 100%; height: 100%; }

/* Gezogene Flagge */
.ghost {
  position: fixed;
  z-index: 70;
  top: 0;
  left: 0;
  width: var(--flag-h);
  height: var(--flag-h);
  margin: calc(var(--flag-h) * -.97) 0 0 calc(var(--flag-h) * -.26);
  pointer-events: none;
  filter: drop-shadow(0 12px 10px rgba(28, 34, 48, .28));
}
.ghost svg { width: 100%; height: 100%; }

/* ---------- Menü: Spieler:innen ---------- */

.menu-flags { display: flex; gap: 2px; margin: 8px 4px 0; }
.menu-flag { width: 34px; height: 34px; transition: opacity .15s; }
.menu-flag svg { width: 100%; height: 100%; }
.menu-flag.is-off { opacity: .18; filter: grayscale(1); }
.menu-cover { margin-top: 12px; }
.menu-cover[hidden] { display: none; }

/* ---------- Flaggen-Ablage ---------- */

.dock { display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(8px, 1.4vw, 18px); }

.flag-btn {
  position: relative;
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 2px 8px;
  min-height: 60px;
  padding: 6px 18px 13px 8px; /* unten Platz für den Rundenbalken */
  border: 2px solid var(--line);
  border-radius: 20px;
  background: #fff;
  touch-action: none;
  transition: border-color .15s, background .15s, transform .12s;
}
.flag-btn:hover { background: var(--soft); }
.flag-btn:active { transform: scale(.97); }
.flag-btn .fb-flag { grid-row: span 2; width: clamp(42px, 7.6vh, 70px); height: clamp(42px, 7.6vh, 70px); cursor: grab; }
.flag-btn .fb-flag { position: relative; }
.flag-btn .fb-flag svg { width: 100%; height: 100%; }
/* Gesetzt: Häkchen auf der blassen Flagge (verdeckt sieht man sonst nicht, wer schon dran war) */
.flag-btn .fb-check { position: absolute; right: -2px; bottom: 2px; width: 46%; height: 46%; padding: 3px; border-radius: 50%; background: var(--ink); color: #fff; --art-color: #fff; animation: pop .3s ease-out; }
.flag-btn .fb-check svg { display: block; }
/* Einloggen: die gesetzte Flagge ist hervorgehoben, die anderen warten, eingeloggte tragen ein Häkchen */
.flag-btn.is-busy { border-color: var(--ink); background: var(--tone-tint); box-shadow: 0 0 0 3px rgba(217, 119, 6, .25); }
.flag-btn.is-busy .fb-flag { opacity: 1; }
.flag-btn.is-wait { opacity: .45; }
.flag-btn.is-in { cursor: default; }
.btn-primary.is-lock { animation: lock-pulse 1.8s ease-in-out infinite; }
@keyframes lock-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(225, 29, 72, .4); } 50% { box-shadow: 0 0 0 8px rgba(225, 29, 72, 0); } }
@media (prefers-reduced-motion: reduce) { .btn-primary.is-lock { animation: none; } }
.flag-btn .fb-name { font-family: var(--font-display); font-size: clamp(1.05rem, 2.8vh, 1.5rem); font-weight: 800; line-height: 1; padding-top: .12em; text-align: left; }
.flag-btn .fb-points { color: var(--muted); font-size: clamp(.85rem, 2vh, 1.1rem); font-weight: 600; line-height: 1; text-align: left; white-space: nowrap; }
.flag-btn .fb-points b { color: var(--ink); font-family: var(--font-display); font-size: 1.15em; font-weight: 800; font-variant-numeric: tabular-nums; }
/* Rundenergebnis: Schild oben rechts, Balken unten in der Farbe der Flagge */
.flag-btn .fb-round {
  position: absolute;
  top: -12px;
  right: -10px;
  padding: .2em .5em .1em;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(1rem, 2.7vh, 1.45rem);
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  animation: pop .4s .35s both ease-out;
}
.flag-btn .fb-round.is-full { border-color: #d97706; background: #fbbf24; }
.flag-btn .fb-bar { position: absolute; right: 14px; bottom: 5px; left: 14px; height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; }
.flag-btn .fb-bar span { display: block; height: 100%; border-radius: 3px; background: var(--art-color); animation: fill-bar .7s .3s both cubic-bezier(.2, .8, .3, 1); }
.flag-btn.is-picked { border-color: var(--ink); background: var(--tone-tint); box-shadow: 0 0 0 3px rgba(217, 119, 6, .25); }
.flag-btn.is-placed .fb-flag { opacity: .3; }
.flag-btn.is-best { border-color: #fbbf24; background: #fffbeb; }
.flag-btn.is-bump .fb-points b { display: inline-block; animation: pop .4s .5s both ease-out; }

@media (max-height: 760px) {
  .flag-btn { min-height: 52px; padding: 4px 16px 11px 6px; }
}

@media (max-aspect-ratio: 1/1) {
  :root { --flag-h: clamp(70px, 11vh, 130px); --strip-h: clamp(46px, 7vh, 86px); --label-fs: clamp(1.1rem, 2.6vh, 1.9rem); }
  .track { margin: 0 clamp(18px, 4vw, 40px); }
}

@keyframes plant { from { transform: translateY(-24%) rotate(-8deg); opacity: .5; } to { transform: none; opacity: 1; } }
@keyframes cheer { 0%, 100% { transform: none; } 30% { transform: translateY(-10%) rotate(-4deg); } 60% { transform: translateY(-4%) rotate(3deg); } }
@keyframes fill-bar { from { width: 0; } }
@keyframes drop-line { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes pop-answer { from { opacity: 0; transform: translateX(-50%) scale(.6); } to { opacity: 1; transform: translateX(-50%) scale(1); } }
