/* Kugelbahn · v001 ------------------------------------------------------------
   Schichten: Wand (body) → Texte (#content) → 3D-Bahn (#stage, transparent)
   → Bedienelemente (#ui). --u = Pixel pro Welt-Einheit (setzt main.js).     */

/* Schriften lokal (DSGVO: keine Anfrage an Google), Lizenz: SIL OFL 1.1 → vendor/fonts */
@font-face {
  font-family: 'Fraunces';
  src: url('../vendor/fonts/fraunces-latin-full-normal.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Inter';
  src: url('../vendor/fonts/inter-latin-wght-normal.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --wall: #f4f1ec;
  --ink: #29231f;
  --ink-soft: #5d5148;
  --wood: #a86f3e;
  --wood-deep: #6b4125;
  --walnut-1: #8c5d3d;
  --walnut-2: #573520;
  --cream: #f7ecdc;
  --u: 90px;
  --ox: 0px;
  --display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--wall);
  scroll-behavior: auto;
  overflow-y: scroll; /* Scrollleiste reserviert immer Platz → stabile Breite */
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  background: var(--wall);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* sanftes Raumlicht auf der Wand */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 85% at 28% 12%, rgba(255, 253, 249, 0.9) 0%, rgba(255, 253, 249, 0) 60%),
    radial-gradient(140% 100% at 70% 110%, rgba(214, 200, 182, 0.35) 0%, rgba(214, 200, 182, 0) 60%);
}

::selection {
  background: #ebd3b3;
  color: var(--ink);
}

h1,
h2 {
  font-family: var(--display);
  font-weight: 620;
  font-variation-settings: 'SOFT' 50, 'opsz' 144;
  letter-spacing: -0.02em;
  text-wrap: balance;
  margin: 0;
}

p {
  margin: 0;
}

a {
  color: inherit;
}

.skip-link {
  position: fixed;
  left: 12px;
  top: -60px;
  z-index: 10;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
}

.skip-link:focus {
  top: 12px;
}

/* --- Schichten -------------------------------------------------------------- */

#content {
  position: relative;
  z-index: 1;
  /* feiner Putz, scrollt mit der Wand */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .38 0 0 0 0 .3 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)'/%3E%3C/svg%3E");
}

.js #content {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  will-change: transform;
  transition: opacity 0.6s ease;
}

.js:not(.is-ready) #content {
  opacity: 0;
}

#scroll-spacer {
  width: 1px;
}

#stage {
  position: fixed;
  inset: 0;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.9s ease 0.1s;
}

.is-ready #stage {
  opacity: 1;
}

#ui {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

#ui button,
#ui a {
  pointer-events: auto;
}

.track {
  position: relative;
  width: 100%;
}

/* --- Header (scrollt mit der Wand weg) ---------------------------------------- */

.site-header {
  position: absolute;
  top: 0;
  left: calc(var(--ox) + var(--u) * 0.55);
  right: calc(var(--ox) + 16px + 42px + 22px);
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  transition: opacity 0.55s ease;
}

.wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5em;
  color: var(--ink);
  text-decoration: none;
}

.wordmark__ball {
  align-self: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #fff 0 10%, #d3d6da 28%, #8a8f95 72%, #5f646a 100%);
  box-shadow: 2px 3px 4px rgba(60, 40, 25, 0.28);
}

.wordmark__name {
  font-family: var(--display);
  font-weight: 650;
  font-size: 22px;
  font-variation-settings: 'SOFT' 80, 'opsz' 48;
  letter-spacing: -0.01em;
}

.wordmark__tag {
  font: 500 13px/1 var(--sans);
  color: var(--ink-soft);
}

.site-nav {
  display: flex;
  gap: 26px;
}

.site-nav a {
  position: relative;
  padding: 6px 0;
  color: var(--ink-soft);
  font: 500 15px/1 var(--sans);
  text-decoration: none;
  transition: color 0.2s ease;
}

.site-nav a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1.5px;
  background: var(--wood);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}

.site-nav a:hover {
  color: var(--ink);
}

.site-nav a:hover::after {
  transform: scaleX(1);
}

.wordmark:focus-visible,
.site-nav a:focus-visible {
  outline: 3px solid #d59a52;
  outline-offset: 4px;
  border-radius: 4px;
}

/* Sprungziele (Anker) bekommen Fokus, aber keinen Rahmen */
[tabindex='-1']:focus {
  outline: none;
}

/* --- Textzonen (Scrollmodus) ----------------------------------------------- */

.zone {
  position: absolute;
  transition:
    opacity 0.55s ease,
    transform 0.55s ease;
}

.mode-auto .zone {
  opacity: 0;
  transform: translateY(0.5em);
  pointer-events: none;
}

.eyebrow {
  font: 600 max(11px, calc(var(--u) * 0.15)) / 1.3 var(--sans);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--wood);
}

.zone--hero h1 {
  margin-top: 0.28em;
  font-size: calc(var(--u) * 0.6);
  line-height: 1.02;
}

.lead {
  font-size: clamp(15px, calc(var(--u) * 0.2), 21px);
  line-height: 1.55;
  color: var(--ink-soft);
}

.hint {
  margin-top: 0.9em;
  font-size: clamp(13px, calc(var(--u) * 0.15), 16px);
  color: var(--wood-deep);
}

.hint__arrow {
  display: inline-block;
  margin-right: 0.45em;
  animation: nudge 2.2s ease-in-out infinite;
}

@keyframes nudge {
  0%,
  100% {
    transform: translateY(-2px);
  }
  50% {
    transform: translateY(4px);
  }
}

.zone--mid h2 {
  font-size: calc(var(--u) * 0.4);
  line-height: 1.08;
  margin-bottom: 0.55em;
}

.zone--mid p {
  font-size: clamp(15px, calc(var(--u) * 0.195), 20px);
  line-height: 1.6;
  color: var(--ink-soft);
}

.zone--rules h2 {
  font-size: calc(var(--u) * 0.34);
  line-height: 1.1;
  margin-bottom: 0.6em;
}

.rules {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: calc(var(--u) * 0.14) calc(var(--u) * 0.34);
}

.rules li {
  position: relative;
  padding-left: 1.1em;
  font-size: clamp(13px, calc(var(--u) * 0.155), 16px);
  line-height: 1.4;
  color: var(--ink-soft);
}

.rules li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.42em;
  width: 0.55em;
  height: 0.55em;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff 0 12%, #c9ccd1 30%, #7d8288 100%);
  box-shadow: 1px 1px 2px rgba(60, 40, 25, 0.3);
}

.rules strong {
  display: block;
  color: var(--ink);
  font-weight: 600;
  font-size: clamp(14px, calc(var(--u) * 0.17), 18px);
}

.rules-short {
  display: none;
}

/* --- Hammer-Sätze (Automodus) ---------------------------------------------- */

.punch-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.punch {
  position: absolute;
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  font-variation-settings: 'SOFT' 100, 'opsz' 144;
  line-height: 1;
  letter-spacing: -0.02em;
  white-space: nowrap;
  color: var(--ink);
  opacity: 0;
  transition: opacity 0.45s ease;
}

.mode-auto .punch.is-on,
.mode-test .punch.is-on {
  opacity: 1;
  transition: none;
}

.punch--big {
  color: var(--wood-deep);
}

.punch .w {
  display: inline-block;
  opacity: 0;
  transform-origin: 50% 88%;
}

.punch .w.is-hit {
  opacity: 1;
  text-shadow: 0.03em 0.05em 0.04em rgba(70, 48, 30, 0.3);
}

.dust {
  position: absolute;
  border-radius: 50%;
  background: #c8baa6;
  pointer-events: none;
}

.puff {
  position: absolute;
  aspect-ratio: 3.2 / 1;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(190, 172, 150, 0.55), rgba(190, 172, 150, 0));
  pointer-events: none;
  opacity: 0;
}

/* --- Start-Knopf (sitzt auf der Plakette des Start-Häuschens) ----------------- */

.start-btn {
  --size: 96px;
  position: absolute;
  left: 0;
  top: 0;
  width: var(--size);
  height: var(--size);
  padding: 0;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: calc(var(--size) * 0.03);
  color: var(--cream);
  background: transparent;
  box-shadow:
    inset 0 0 0 1.5px rgba(247, 236, 220, 0.28),
    inset 0 2px 6px rgba(0, 0, 0, 0.25);
  font: 700 max(10px, calc(var(--size) * 0.15)) / 1 var(--sans);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    background-color 0.3s ease,
    box-shadow 0.3s ease,
    opacity 0.4s ease;
}

.js:not(.is-ready) .start-btn {
  opacity: 0;
}

.start-btn::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(168, 111, 62, 0.55);
  opacity: 0;
  pointer-events: none;
}

.start-btn[data-state='idle']::after {
  animation: invite 2.6s ease-out 1.2s infinite;
}

@keyframes invite {
  0% {
    opacity: 0.8;
    transform: scale(0.92);
  }
  70%,
  100% {
    opacity: 0;
    transform: scale(1.35);
  }
}

.start-btn:hover {
  box-shadow:
    inset 0 0 0 2px rgba(247, 236, 220, 0.6),
    inset 0 2px 6px rgba(0, 0, 0, 0.25),
    0 0 0 5px rgba(168, 111, 62, 0.18);
}

.start-btn:focus-visible {
  outline: 3px solid #d59a52;
  outline-offset: 4px;
}

.start-btn.is-stuck {
  background: radial-gradient(circle at 35% 28%, var(--walnut-1), var(--walnut-2));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    0 10px 22px -6px rgba(60, 38, 22, 0.45);
}

.start-btn__icon {
  display: none;
  width: calc(var(--size) * 0.24);
  height: calc(var(--size) * 0.24);
  fill: currentColor;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.4));
}

.start-btn[data-state='idle'] .i-play,
.start-btn[data-state='running'] .i-stop,
.start-btn[data-state='done'] .i-again {
  display: block;
}

.start-btn__label {
  font-size: max(9px, calc(var(--size) * 0.13));
}

.start-btn.is-stuck .start-btn__label {
  letter-spacing: 0.08em;
}

/* --- Leiste oben rechts (bleibt stehen, sitzt oben in der Header-Zeile) -------- */

.topbar {
  position: absolute;
  top: 17px;
  right: max(16px, calc(var(--ox) + 16px));
  display: flex;
  gap: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid rgba(90, 60, 35, 0.14);
  background: rgba(255, 253, 249, 0.74);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 14px -6px rgba(60, 40, 25, 0.25);
  color: var(--ink);
  font: 600 14px/1 var(--sans);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.pill:hover {
  background: #fff;
}

.pill:focus-visible {
  outline: 3px solid #d59a52;
  outline-offset: 2px;
}

.pill--icon {
  width: 42px;
  padding: 0;
}

.pill svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.pill .wave,
.pill .mute {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
}

.pill .mute,
.pill[data-on='0'] .wave {
  display: none;
}

.pill[data-on='0'] .mute {
  display: inline;
}

/* --- Bauplatz (v003) ------------------------------------------------------------------ */

.zone--bau h2 {
  margin: 0.15em 0 0.35em;
  font-size: max(24px, calc(var(--u) * 0.42));
}

.zone--bau p {
  margin: 0 0 0.8em;
  max-width: 34em;
  color: var(--ink-soft);
  font-size: max(15px, calc(var(--u) * 0.19));
}

.zone--bau .bau-status {
  color: var(--ink);
  font-weight: 600;
}

.again--small {
  padding: 13px 26px;
  font-size: 16px;
}

/*
 * Lochwand: weiß lackiertes Holz, die Maserung schimmert durch (SVG-Rauschen, Höhenlinien als Jahresringe).
 * Sie liegt hinter Texten und Bahn wie die Wand selbst: Die Teile verdecken die Sätze und werfen Schatten
 * darauf. Kein Ein- und Ausblenden – beim Fahren klappen nur die Seitenwände (3D) weg.
 */
.lochwand {
  position: absolute;
  left: 0;
  top: 0;
  border-radius: calc(var(--u) * 0.03);
  background-color: #f8f5ef;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='600'%3E%3Cfilter id='w' x='0' y='0' width='100%' height='100%' color-interpolation-filters='sRGB'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.0022 .03' numOctaves='3' seed='4' stitchTiles='stitch'/%3E%3CfeColorMatrix values='1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1'/%3E%3CfeComponentTransfer%3E%3CfeFuncR type='table' tableValues='0 0 0 .55 .64 0 0 0 0 0 .46 .73 0 0 0 0 0 .38 .82 .02 0 0 0 0 .29 .91 .11 0 0 0 0 .2 1 .2 0 0 0 0 .11 .91 .29 0 0 0 0 .02 .82 .38 0 0 0 0 0 .73 .46 0 0 0 0 0 .64 .55 0 0 0'/%3E%3C/feComponentTransfer%3E%3CfeColorMatrix values='0 0 0 0 .55 0 0 0 0 .45 0 0 0 0 .33 .14 0 0 0 0' result='r'/%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.004 .09' numOctaves='2' seed='15' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .55 0 0 0 0 .45 0 0 0 0 .33 .1 0 0 0 -.045'/%3E%3CfeMerge%3E%3CfeMergeNode/%3E%3CfeMergeNode in='r'/%3E%3C/feMerge%3E%3C/filter%3E%3Crect width='600' height='600' filter='url(%23w)'/%3E%3C/svg%3E");
  background-size: calc(var(--u) * 6) calc(var(--u) * 6);
  /* hängt knapp vor der Wand: weicher Schatten nach rechts unten wie bei den Bauteilen */
  box-shadow:
    calc(var(--u) * 0.04) calc(var(--u) * 0.06) calc(var(--u) * 0.12) rgba(64, 49, 42, 0.18),
    0 0 0 1px rgba(120, 100, 80, 0.07);
  pointer-events: none;
}

.lochwand__loecher {
  position: absolute;
  background-image: radial-gradient(
    circle,
    #5e544d 0,
    #6e645c calc(var(--u) * 0.05),
    #b3aaa0 calc(var(--u) * 0.07),
    rgba(179, 170, 160, 0) calc(var(--u) * 0.07 + 0.8px)
  );
  background-size: calc(var(--u) * 0.5) calc(var(--u) * 0.5);
}

html:not(.kann-bauen) [data-build],
.mode-build .zone--bau {
  visibility: hidden;
}

/* Im Bau-Modus fängt die Bühne Maus und Finger; ist etwas ausgewählt, scrollt Ziehen nicht */
.mode-build #stage {
  pointer-events: auto;
  touch-action: pan-y;
}

.mode-build.bau-greift #stage {
  touch-action: none;
}

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

.bau[hidden],
.bau [hidden] {
  display: none !important;
}

.bau__unten {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr); /* nicht breiter als der Bildschirm → Leiste bricht um */
  justify-items: center;
  gap: 10px;
  padding: 28px 12px calc(12px + env(safe-area-inset-bottom));
  /* Wandfarbe hinter der Leiste, damit Texte darunter nicht durchscheinen */
  background: linear-gradient(to top, rgba(244, 241, 236, 0.94) 55%, rgba(244, 241, 236, 0));
}

.bau__hint {
  max-width: min(560px, 100%);
  margin: 0;
  padding: 9px 16px;
  border-radius: 16px;
  background: rgba(41, 35, 31, 0.88);
  color: #fbf1e3;
  font: 500 14px/1.35 var(--sans);
  text-align: center;
}

.bau__bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  pointer-events: auto;
}

.pill--strong {
  border-color: transparent;
  background: linear-gradient(180deg, #7c4b2b, #57331c);
  color: #fbf1e3;
}

.pill--strong:hover {
  background: linear-gradient(180deg, #8a5532, #633a20);
}

.pill:disabled {
  opacity: 0.45;
  cursor: default;
}

.bau__kiste {
  width: min(760px, 100%);
  padding: 8px;
  border: 1px solid rgba(90, 60, 35, 0.14);
  border-radius: 18px;
  background: rgba(255, 253, 249, 0.88);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 30px -14px rgba(60, 40, 25, 0.35);
  pointer-events: auto;
}

.bau__tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  padding: 0 4px 6px;
}

.bau__tab {
  padding: 6px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font: 600 13px/1 var(--sans);
  white-space: nowrap;
  cursor: pointer;
}

.bau__tab[aria-selected='true'] {
  background: rgba(168, 111, 62, 0.14);
  color: var(--ink);
}

.bau__teile {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
}

.bau__teil {
  flex: 0 0 auto;
  width: 92px;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 4px;
  padding: 6px 4px 8px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  font: 600 12px/1.2 var(--sans);
  text-align: center;
  cursor: pointer;
  scroll-snap-align: start;
}

.bau__teil:hover {
  background: rgba(168, 111, 62, 0.1);
}

.bau__teil:focus-visible,
.bau__knopf:focus-visible,
.bau__tab:focus-visible {
  outline: 3px solid #d59a52;
  outline-offset: 1px;
}

.bau__teil img {
  width: 64px;
  height: 64px;
  object-fit: contain;
}

.bau__sel {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  max-width: calc(100vw - 16px);
  gap: 2px;
  padding: 4px;
  border: 1px solid rgba(90, 60, 35, 0.16);
  border-radius: 999px;
  background: rgba(255, 253, 249, 0.94);
  box-shadow: 0 8px 22px -10px rgba(60, 40, 25, 0.45);
  pointer-events: auto;
  will-change: transform;
}

.bau__knopf {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.bau__knopf:hover {
  background: rgba(168, 111, 62, 0.12);
}

.bau__knopf svg {
  width: 22px;
  height: 22px;
}

.bau__wert {
  align-self: center;
  min-width: 6.5em;
  padding: 0 4px;
  color: var(--ink);
  font: 600 13px/1 var(--sans);
  text-align: center;
  white-space: nowrap;
}

/* Teile aus der Kiste herausziehen: seitlich scrollt die Kiste, nach oben kommt das Teil mit */
.bau__teil {
  touch-action: pan-x;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.bau__teil img {
  -webkit-user-drag: none;
  pointer-events: none;
}

.bau-zieht,
.bau-zieht * {
  cursor: grabbing !important;
}

/* Eigene Sätze im Bau-Modus: Schilder über der Lochwand (während der Probefahrt ausgeblendet) */
.bau__saetze {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.mode-test .bau__saetze {
  display: none;
}

.bau__satz {
  position: absolute;
  left: 0;
  top: 0;
  margin: 0;
  padding: 0.04em 0.18em;
  border: 1px dashed rgba(90, 60, 35, 0.55);
  border-radius: 6px;
  background: rgba(255, 250, 240, 0.62);
  color: var(--ink);
  font-family: var(--display);
  font-weight: 800;
  font-variation-settings: 'SOFT' 100, 'opsz' 144;
  line-height: 1;
  letter-spacing: -0.02em;
  white-space: nowrap;
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  will-change: transform;
}

.bau__satz.is-sel {
  border: 2px solid #d59a52;
  background: rgba(255, 241, 214, 0.85);
}

.bau__satz.is-draft {
  opacity: 0.7;
}

.bau__satz:empty::before {
  content: 'Ihr Satz';
  color: rgba(41, 35, 31, 0.38);
}

/* 16px: kleiner zoomt Safari auf dem iPhone beim Antippen ins Feld */
.bau__textfeld {
  flex: 0 1 auto;
  width: 15em;
  min-width: 0;
  height: 38px;
  margin: 2px 4px 2px 2px;
  padding: 0 12px;
  border: 1px solid rgba(90, 60, 35, 0.3);
  border-radius: 999px;
  background: #fffdf9;
  color: var(--ink);
  font: 500 16px/1 var(--sans);
}

.bau__textfeld:focus-visible {
  outline: 3px solid #d59a52;
  outline-offset: 1px;
}

.bau__teil svg.bau__satzicon {
  width: 64px;
  height: 64px;
}

/* Holzknöpfe an der unteren rechten Ecke der Lochwand: länger / kürzer */
.bau__groesse {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: auto;
  will-change: transform;
}

.holzknopf {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid #8a5a33;
  border-radius: 10px;
  /* Maserung: zwei Verläufe übereinander */
  background:
    repeating-linear-gradient(98deg, rgba(120, 72, 38, 0.13) 0 2px, transparent 2px 7px),
    linear-gradient(180deg, #e3b583, #c78f5c);
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 215, 0.6),
    inset 0 -2px 0 rgba(90, 50, 22, 0.35),
    0 6px 14px -6px rgba(60, 35, 18, 0.55);
  color: #4a2a14;
  cursor: pointer;
}

.holzknopf:hover {
  background:
    repeating-linear-gradient(98deg, rgba(120, 72, 38, 0.13) 0 2px, transparent 2px 7px),
    linear-gradient(180deg, #ebc290, #cf9763);
}

.holzknopf:active {
  transform: translateY(1px);
  box-shadow:
    inset 0 2px 3px rgba(90, 50, 22, 0.35),
    0 3px 8px -5px rgba(60, 35, 18, 0.5);
}

.holzknopf:disabled {
  opacity: 0.45;
  cursor: default;
}

.holzknopf:focus-visible {
  outline: 3px solid #d59a52;
  outline-offset: 2px;
}

.holzknopf svg {
  width: 24px;
  height: 24px;
}

@media (max-width: 520px) {
  .bau__teil {
    width: 78px;
  }

  .bau__teil img {
    width: 52px;
    height: 52px;
  }

  .bau__bar .pill {
    height: 38px;
    padding: 0 13px;
  }

  .bau__bar .pill--icon {
    width: 38px;
    padding: 0;
  }

  /* Satz: Platz fürs Eingabefeld, die Größe zeigt das Schild selbst */
  .bau__sel.is-text .bau__wert {
    display: none;
  }
}

/* --- Ausklang / Fuß ---------------------------------------------------------------- */

.outro {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: max(40px, calc(var(--u) * 0.7)) 24px 32px;
}

.outro__inner {
  max-width: 780px;
  margin: 0 auto;
  text-align: center;
}

.outro h2 {
  max-width: 15em;
  margin: 0.2em auto 0.45em;
  font-size: clamp(30px, calc(var(--u) * 0.56), 60px);
  line-height: 1.06;
}

.outro__text {
  max-width: 36em;
  margin: 0 auto 2em;
  font-size: clamp(16px, calc(var(--u) * 0.2), 20px);
  color: var(--ink-soft);
}

.again {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  padding: 17px 30px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #7c4b2b, #57331c);
  color: #fbf1e3;
  font: 600 17px/1 var(--sans);
  cursor: pointer;
  box-shadow:
    0 12px 26px -10px rgba(70, 40, 20, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.again__icon {
  width: 19px;
  height: 19px;
  fill: currentColor;
  transition: transform 0.5s ease;
}

.again:hover {
  transform: translateY(-2px);
  box-shadow:
    0 16px 30px -10px rgba(70, 40, 20, 0.65),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.again:hover .again__icon {
  transform: rotate(-300deg);
}

.again:focus-visible {
  outline: 3px solid #d59a52;
  outline-offset: 4px;
}

.outro.is-arrived .again {
  animation: arrive 1.1s ease 0.4s 2;
}

@keyframes arrive {
  0%,
  100% {
    box-shadow:
      0 12px 26px -10px rgba(70, 40, 20, 0.6),
      0 0 0 0 rgba(168, 111, 62, 0.45);
  }
  60% {
    box-shadow:
      0 12px 26px -10px rgba(70, 40, 20, 0.6),
      0 0 0 16px rgba(168, 111, 62, 0);
  }
}

.facts {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 34px;
  margin: 3.2em 0 0;
  padding: 0;
  font-size: 15px;
  color: var(--ink-soft);
}

.facts strong {
  color: var(--wood-deep);
  font-weight: 600;
}

.legal {
  margin-top: 3.5em;
  text-align: center;
  font-size: 13px;
  color: var(--ink-soft);
}

/* --- Hochformat / Smartphone --------------------------------------------------------- */

.preset-narrow .eyebrow {
  font-size: max(11px, calc(var(--u) * 0.3));
}

.preset-narrow .zone--hero h1 {
  font-size: calc(var(--u) * 0.9);
  line-height: 1.04;
}

.preset-narrow .lead {
  font-size: clamp(15px, calc(var(--u) * 0.4), 19px);
}

.preset-narrow .hint {
  font-size: clamp(13px, calc(var(--u) * 0.34), 16px);
}

.preset-narrow .zone--mid h2 {
  font-size: calc(var(--u) * 0.66);
}

.preset-narrow .zone--mid p {
  font-size: clamp(15px, calc(var(--u) * 0.4), 18px);
}

.preset-narrow .zone--rules h2 {
  font-size: calc(var(--u) * 0.56);
  margin-bottom: 0.3em;
}

.preset-narrow .rules {
  display: none;
}

.preset-narrow .rules-short {
  display: block;
  font-size: clamp(14px, calc(var(--u) * 0.38), 17px);
  line-height: 1.45;
  color: var(--ink-soft);
}

@media (max-width: 720px) {
  .site-nav {
    display: none;
  }
}

@media (max-width: 520px) {
  .site-header {
    right: 64px;
  }

  .wordmark__name {
    font-size: 20px;
  }

  .topbar {
    top: 19px;
    right: 12px;
  }

  .pill {
    height: 38px;
    padding: 0 14px;
  }

  .pill--icon {
    width: 38px;
  }
}

/* --- Ohne JavaScript / ohne WebGL: ruhige, lesbare Seite ---------------------------- */

html:not(.js) .track,
.no-webgl .track {
  height: auto !important;
  padding: 72px 0 24px;
}

html:not(.js) .zone,
.no-webgl .zone {
  position: static;
  width: auto !important;
  max-width: 720px;
  margin: 0 auto 56px;
  padding: 0 24px;
}

.no-webgl #content {
  position: static;
  transform: none !important;
}

.no-webgl #stage,
.no-webgl .lochwand,
html:not(.js) .lochwand,
.no-webgl .start-btn,
.no-webgl .punch-layer,
html:not(.js) .punch-layer {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .hint__arrow,
  .start-btn[data-state='idle']::after,
  .outro.is-arrived .again {
    animation: none;
  }
}
