/* ---------- Tokens
   This block holds the tokens of the WasserWelt prebuild. The interface colours, fonts and shadows are those of the Design Guide R0.6.
   The game tokens make touch targets of at least 56 px and text of at least 20 px for children.
   The pastel tones of the game surfaces are a proposal. The Design Guide R0.6 has no chapter for game scenes (finding WAW-F04). */
:root {
  color-scheme: light;
  --c-page: #ffffff;
  --c-card: #f5f5f5;
  --c-hover: #e5e5e5;
  --c-border: #d0d0d0;
  --c-divider: #e5e5e5;
  --c-text: #1a1a1a;
  --c-text-2: #4a4a4a;
  --c-text-3: #666666;
  --c-outline: #666666;
  --c-disabled: #cccccc;
  --c-brand: #0073e6;
  --c-accent: #0066cc;
  --c-on-brand: #ffffff;
  --c-accent-2: #ff8000;
  --c-danger: #b3261e;
  --d-success: #00aa33;
  --d-success-ink: #007724;
  --d-success-tint: #e7f6ec;
  --d-danger: #d32f2f;
  --d-danger-ink: #b3261e;
  --d-danger-tint: #fdeded;
  --d-warning-ink: #a15100;
  --d-warning-tint: #fff4e6;
  --font-title: Verdana, "DejaVu Sans", Roboto, sans-serif;
  --font-data: Consolas, Menlo, "DejaVu Sans Mono", "Liberation Mono", "Lucida Console", "Courier New", monospace;
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --radius-badge: 4px;
  --radius-control: 6px;
  --radius-card: 8px;
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.12);
  --shadow-dialog: 0 12px 32px rgba(0, 0, 0, 0.25);
  --g-tap-size: 56px;
  --fs-child: 20px;
  --fs-child-large: 22px;
  --fs-child-title: 26px;
  --fs-hub-title: 34px;
  --g-radius-toy: 18px;
  --g-sky: #dff0fa;
  --g-bubble: #fffdf6;
  --g-mint: #e3f4e6;
  --g-peach: #fde9dc;
  --g-lilac: #ece6f6;
  --g-water: #dcf0fa;
  --g-sand: #fbf1d9;
  --c-grid: #9a9a9a;
  --g-leaf: #a8d99c;
  --g-pond: #8fcdea;
  --g-rose: #f6c1c8;
  --g-butter: #f8e3a3;
  --g-sun: #ffd98a;
  --g-plush: #9b7fc7;
  --g-rain: #5aa9d6;
  --g-path: #f1d9a8;
  --g-portal: #7fd3ff;
  --g-backdrop: rgba(26, 26, 26, 0.35);
}

/* ---------- Page base
   This block sets the font, the background and the focus ring of all pages.
   The game pages fill the whole window. The hub page scrolls. */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-title);
  font-size: var(--fs-child);
  line-height: 1.4;
  color: var(--c-text);
  background: var(--g-sky);
}
body.is-game { height: 100vh; overflow: hidden; }
a { color: var(--c-accent); }
:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }
.skip-link {
  position: absolute; left: var(--sp-2); top: -80px; z-index: 50;
  background: var(--c-page); color: var(--c-accent); padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-control); box-shadow: var(--shadow-card);
}
.skip-link:focus { top: var(--sp-2); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
[hidden] { display: none !important; }

/* ---------- Buttons
   This block styles the large buttons of the game. Each button is at least 56 px high and has a text of 20 px.
   The primary button is blue. The danger button is red. A pressed toggle has a thick outline. */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: var(--g-tap-size); min-width: var(--g-tap-size); padding: 0 var(--sp-4);
  font-family: var(--font-title); font-size: var(--fs-child); font-weight: bold; line-height: 1.2;
  color: var(--c-text); background: var(--c-page);
  border: 2px solid var(--c-outline); border-radius: var(--g-radius-toy);
  cursor: pointer; text-decoration: none; user-select: none; touch-action: manipulation;
}
.button:hover { background: var(--c-hover); }
.button-primary { background: var(--c-brand); border-color: var(--c-brand); color: var(--c-on-brand); }
.button-primary:hover { background: var(--c-accent); }
.button-danger { color: var(--c-danger); border-color: var(--c-danger); }
.button[aria-pressed="true"] { border-width: 4px; border-color: var(--c-accent); background: var(--g-water); }
.button:disabled, .button[aria-disabled="true"] { background: var(--c-disabled); border-color: var(--c-disabled); color: var(--c-text-2); cursor: not-allowed; }
.button-icon { width: 28px; height: 28px; flex: none; }
.button-square { padding: 0; width: var(--g-tap-size); }

/* ---------- Stage
   This block lets the 3D stage fill the space below the top bar and puts the overlays on top of it.
   The canvas takes all pointer gestures, so the browser does not scroll or zoom the page. */
.game-shell { display: flex; flex-direction: column; height: 100vh; }
.stage-host { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.stage-canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.stage-overlay { position: absolute; inset: 0; pointer-events: none; }
.stage-overlay > * { pointer-events: auto; }
.fps-badge {
  position: absolute; right: var(--sp-3); top: var(--sp-3);
  padding: var(--sp-1) var(--sp-3); font-family: var(--font-data); font-size: var(--fs-child);
  background: var(--c-page); color: var(--c-text); border: 1px solid var(--c-border); border-radius: var(--radius-badge);
  pointer-events: none;
}
.stage-hint {
  position: absolute; left: 50%; top: var(--sp-3); transform: translateX(-50%);
  max-width: 70%; padding: var(--sp-2) var(--sp-5);
  background: var(--g-bubble); border: 2px solid var(--c-border); border-radius: var(--g-radius-toy);
  font-size: var(--fs-child); text-align: center; box-shadow: var(--shadow-card);
}

/* ---------- Speech card and questions
   This block styles the speech bubble card of the characters with its large answer buttons.
   The tail of the bubble is drawn with borders. A right answer has a green outline and the word Richtig. */
.speech-card {
  position: absolute; left: 50%; bottom: var(--sp-5); transform: translateX(-50%);
  width: min(720px, calc(100% - 40px)); padding: var(--sp-5) var(--sp-6);
  background: var(--g-bubble); border: 3px solid var(--c-outline); border-radius: 26px;
  box-shadow: var(--shadow-dialog);
}
.speech-card::after {
  content: ""; position: absolute; left: 64px; top: -22px;
  border-left: 18px solid transparent; border-right: 18px solid transparent; border-bottom: 22px solid var(--c-outline);
}
.speech-head { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-2); }
.speaker-name { font-weight: bold; font-size: var(--fs-child-title); }
.tier-badge {
  display: inline-flex; align-items: center; min-height: 32px; padding: 0 var(--sp-3);
  font-size: var(--fs-child); font-weight: bold; background: var(--g-lilac);
  border: 2px solid var(--c-outline); border-radius: 16px;
}
.speech-text { margin: 0 0 var(--sp-4) 0; font-size: var(--fs-child-large); line-height: 1.45; }
.speech-image { display: block; max-width: 100%; max-height: 180px; margin: 0 auto var(--sp-4) auto; border-radius: var(--radius-card); }
.answer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.answer-grid.is-pairs { grid-template-columns: 1fr 1fr; }
.answer-column { display: flex; flex-direction: column; gap: var(--sp-3); }
.answer-button { width: 100%; min-height: 64px; justify-content: flex-start; text-align: left; padding: var(--sp-2) var(--sp-4); background: var(--c-page); }
.answer-button .answer-mark {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 36px; height: 36px; border-radius: 18px; background: var(--g-lilac); border: 2px solid var(--c-outline);
  font-size: var(--fs-child);
}
.answer-button.is-chosen { border-color: var(--c-accent); border-width: 4px; }
.answer-button.is-right { border-color: var(--d-success); border-width: 4px; background: var(--d-success-tint); color: var(--c-text); }
.answer-button.is-wrong { border-color: var(--d-danger); border-width: 4px; background: var(--d-danger-tint); color: var(--c-text); }
.answer-button:disabled { cursor: default; }
.answer-button.is-right:disabled { background: var(--d-success-tint); border-color: var(--d-success); color: var(--c-text); }
.answer-button.is-wrong:disabled { background: var(--d-danger-tint); border-color: var(--d-danger); color: var(--c-text); }
.answer-button.is-plain:disabled { background: var(--c-page); border-color: var(--c-border); color: var(--c-text-2); }
.feedback { margin: var(--sp-4) 0 0 0; padding: var(--sp-3) var(--sp-4); border-radius: var(--radius-card); font-size: var(--fs-child); }
.feedback.is-right { background: var(--d-success-tint); border: 2px solid var(--d-success); }
.feedback.is-wrong { background: var(--d-danger-tint); border: 2px solid var(--d-danger); }
.feedback-word { font-weight: bold; }
.card-actions { display: flex; justify-content: flex-end; gap: var(--sp-3); margin-top: var(--sp-4); }

/* ---------- Dialog and chips
   This block styles the dialog of the topic tutor with its question chips.
   The backdrop dims the stage without blur. */
.dialog-backdrop {
  position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center;
  background: var(--g-backdrop);
}
.dialog-card {
  width: min(760px, calc(100% - 40px)); max-height: calc(100% - 40px); overflow: auto;
  padding: var(--sp-5) var(--sp-6); background: var(--g-bubble);
  border: 3px solid var(--c-outline); border-radius: 26px; box-shadow: var(--shadow-dialog);
}
.dialog-title { margin: 0 0 var(--sp-3) 0; font-size: var(--fs-child-title); }
.tutor-asked { margin: 0 0 var(--sp-2) 0; color: var(--c-text-2); font-weight: bold; }
.tutor-answer p { margin: 0 0 var(--sp-2) 0; font-size: var(--fs-child-large); }
.chip-list { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin-top: var(--sp-4); }
.chip { background: var(--g-lilac); border-radius: 28px; }
.chip:hover { background: var(--c-hover); }
.dialog-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-top: var(--sp-5); }
.source-note { color: var(--c-text-3); font-size: var(--fs-child); }

/* ---------- Camera controller widget
   This block styles the on-screen camera controller. It opens from one button in the lower right corner.
   The pan pad has 4 arrows. The groups for rotation, tilt and zoom have two buttons each. */
.camera-widget { position: absolute; right: var(--sp-3); bottom: var(--sp-3); display: flex; flex-direction: column; align-items: flex-end; gap: var(--sp-2); }
.camera-panel {
  display: grid; grid-template-columns: auto auto; gap: var(--sp-3) var(--sp-4);
  padding: var(--sp-4); background: var(--c-page); border: 2px solid var(--c-border);
  border-radius: var(--g-radius-toy); box-shadow: var(--shadow-dialog);
}
.camera-group { display: flex; flex-direction: column; gap: var(--sp-1); }
.camera-group-label { font-size: var(--fs-child); color: var(--c-text-2); }
.camera-pair { display: flex; gap: var(--sp-2); }
.camera-pad { display: grid; grid-template-columns: repeat(3, var(--g-tap-size)); grid-template-rows: repeat(3, var(--g-tap-size)); gap: var(--sp-1); }
.camera-pad .pad-up { grid-column: 2; grid-row: 1; }
.camera-pad .pad-left { grid-column: 1; grid-row: 2; }
.camera-pad .pad-right { grid-column: 3; grid-row: 2; }
.camera-pad .pad-down { grid-column: 2; grid-row: 3; }
.camera-presets { grid-column: 1 / span 2; display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.camera-presets .button { padding: 0 var(--sp-3); }
.camera-lock-note { grid-column: 1 / span 2; margin: 0; color: var(--c-text-2); font-size: var(--fs-child); }

/* ---------- Building mode
   This block styles the catalogue of elements on the left and the tool bar at the bottom of the building mode.
   The status words of the footprint are Platz frei and Kein Platz. The colour of the footprint only supports them. */
.catalogue-panel {
  position: absolute; left: var(--sp-3); top: var(--sp-3); bottom: 168px; width: 360px; overflow-y: auto;
  padding: var(--sp-4); background: var(--c-page); border: 2px solid var(--c-border);
  border-radius: var(--g-radius-toy); box-shadow: var(--shadow-dialog);
}
.catalogue-title { margin: 0 0 var(--sp-2) 0; font-size: var(--fs-child-title); }
.catalogue-group { border-top: 1px solid var(--c-divider); }
.catalogue-summary {
  display: flex; align-items: center; gap: var(--sp-3); min-height: var(--g-tap-size); padding: 0 var(--sp-2);
  font-size: var(--fs-child); font-weight: bold; cursor: pointer; list-style: none; border-radius: var(--radius-control);
}
.catalogue-summary::-webkit-details-marker { display: none; }
.catalogue-summary:hover { background: var(--c-hover); }
.catalogue-summary .group-chevron { margin-left: auto; transition: transform 0.2s; }
.catalogue-group[open] .group-chevron { transform: rotate(180deg); }
.catalogue-items { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); padding: 0 0 var(--sp-3) 0; }
.catalogue-item { width: 100%; padding: 0 var(--sp-2); font-size: var(--fs-child); }
.catalogue-item.is-wide { grid-column: 1 / span 2; }
.swatch { width: 24px; height: 24px; flex: none; border-radius: 12px; border: 2px solid var(--c-outline); }
.swatch-natur { background: var(--g-leaf); }
.swatch-wasser { background: var(--g-pond); }
.swatch-haeuser { background: var(--g-rose); }
.swatch-inhalte { background: var(--g-butter); }
.tool-bar {
  position: absolute; left: var(--sp-3); right: var(--sp-3); bottom: var(--sp-3);
  display: flex; flex-direction: column; gap: var(--sp-2);
  padding: var(--sp-3); background: var(--c-page); border: 2px solid var(--c-border);
  border-radius: var(--g-radius-toy); box-shadow: var(--shadow-dialog);
}
.tool-bar-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.tool-bar-separator { width: 2px; align-self: stretch; background: var(--c-divider); }
.tool-bar-status { display: flex; align-items: center; gap: var(--sp-2); flex: 1; min-height: 36px; }
.stage-overlay.is-building .camera-widget { bottom: 168px; }
.status-word {
  display: inline-flex; align-items: center; min-height: 32px; padding: 0 var(--sp-3);
  font-size: var(--fs-child); font-weight: bold; background: var(--c-card); border: 2px solid var(--c-border); border-radius: var(--radius-badge);
}
.status-word.is-free { border-color: var(--d-success); color: var(--d-success-ink); background: var(--d-success-tint); }
.status-word.is-taken { border-color: var(--d-danger); color: var(--d-danger-ink); background: var(--d-danger-tint); }
.status-word.is-saving { border-color: var(--c-accent-2); border-style: dashed; color: var(--c-text-2); }
.status-word.is-saved { border-color: var(--c-text); color: var(--c-text); }
.status-word.is-error { border-color: var(--c-danger); color: var(--c-danger); }
.tool-hint { color: var(--c-text-2); }

/* ---------- Hub page
   This block lays out the hub page with its large tiles. Each tile is a link with a drawn icon, a title and one line of text. */
.hub-page { max-width: 1240px; margin: 0 auto; padding: var(--sp-5); }
.hub-title { margin: var(--sp-4) 0 var(--sp-2) 0; font-size: var(--fs-hub-title); }
.hub-lead { margin: 0 0 var(--sp-6) 0; font-size: var(--fs-child-large); color: var(--c-text-2); }
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--sp-6); }
.tile {
  display: flex; flex-direction: column; gap: var(--sp-3); min-height: 220px; padding: var(--sp-5);
  color: var(--c-text); text-decoration: none; background: var(--c-page);
  border: 3px solid var(--c-border); border-radius: 26px; box-shadow: var(--shadow-card);
}
.tile:hover { border-color: var(--c-accent); }
.tile-icon { width: 96px; height: 96px; border-radius: 22px; }
.tile-icon-mint { background: var(--g-mint); }
.tile-icon-water { background: var(--g-water); }
.tile-icon-peach { background: var(--g-peach); }
.tile-icon-lilac { background: var(--g-lilac); }
.tile-icon-sand { background: var(--g-sand); }
.tile-title { font-size: var(--fs-child-title); font-weight: bold; }
.tile-text { font-size: var(--fs-child); color: var(--c-text-2); }
.hub-section-title { margin: var(--sp-8) 0 var(--sp-4) 0; padding-top: var(--sp-5); font-size: var(--fs-child-title); border-top: 2px solid var(--c-divider); }
.hub-tools .tile { min-height: 180px; }
.hub-foot { margin-top: var(--sp-8); color: var(--c-text-2); font-size: var(--fs-child); }

/* ---------- Camera path editor
   This block lays out the camera path editor with the live 3D view and the three 2D views in a grid.
   The handles of the camera are blue circles. The handles of the target are squares with an orange outline. */
.editor-shell { display: flex; flex-direction: column; height: 100vh; }
.editor-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: var(--sp-2); padding: var(--sp-2); }
.editor-cell { position: relative; min-height: 0; display: flex; flex-direction: column; background: var(--c-page); border: 2px solid var(--c-border); border-radius: var(--radius-card); overflow: hidden; }
.editor-cell-title { margin: 0; padding: var(--sp-1) var(--sp-3); font-size: var(--fs-child); background: var(--c-card); border-bottom: 1px solid var(--c-divider); }
.editor-view { flex: 1 1 0; min-height: 0; height: 0; width: 100%; display: block; touch-action: none; background: var(--c-page); }
.editor-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); padding: var(--sp-2) var(--sp-3); background: var(--c-page); border-top: 1px solid var(--c-border); }
.keyframe-list { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.keyframe-chip { min-width: 96px; font-family: var(--font-data); }
.editor-view * { vector-effect: non-scaling-stroke; }
.svg-grid-line { stroke: var(--c-grid); stroke-width: 1; opacity: 0.45; }
.svg-world-area { fill: var(--g-mint); stroke: var(--c-outline); stroke-width: 1.5; }
.svg-shape { fill: var(--g-butter); stroke: var(--c-outline); stroke-width: 1; opacity: 0.8; }
.svg-camera-path { fill: none; stroke: var(--c-brand); stroke-width: 3; }
.svg-target-path { fill: none; stroke: var(--c-accent-2); stroke-width: 2.5; stroke-dasharray: 8 6; }
.svg-sight-line { stroke: var(--c-outline); stroke-width: 1; stroke-dasharray: 4 4; }
.svg-camera-handle { fill: var(--c-brand); stroke: var(--c-page); stroke-width: 2; cursor: grab; }
.svg-target-handle { fill: var(--c-page); stroke: var(--c-accent-2); stroke-width: 3; cursor: grab; }
.svg-handle-hit { fill: transparent; cursor: grab; }
.svg-selected { stroke: var(--c-text); stroke-width: 4; }
.svg-label { fill: var(--c-on-brand); font-family: var(--font-title); font-weight: bold; pointer-events: none; }
.svg-axis-label { fill: var(--c-text-2); font-family: var(--font-title); pointer-events: none; }
.svg-current-camera { fill: none; stroke: var(--c-text); stroke-width: 2; stroke-dasharray: 3 3; }

/* ---------- Choice of the learning world in the camera path editor
   Without a world in the address, the editor grid shows one large button per learning world instead of the views. */
.editor-grid.is-choosing { display: flex; align-items: flex-start; justify-content: center; }
.world-choice {
  width: min(720px, 100%); margin-top: var(--sp-6); padding: var(--sp-5) var(--sp-6);
  background: var(--c-page); border: 2px solid var(--c-border); border-radius: var(--g-radius-toy); box-shadow: var(--shadow-card);
}
.world-choice-title { margin: 0 0 var(--sp-2) 0; font-size: var(--fs-child-title); }
.world-choice-text { margin: 0 0 var(--sp-4) 0; color: var(--c-text-2); }
.world-choice-list { display: flex; flex-direction: column; gap: var(--sp-3); }
.world-choice-button { justify-content: flex-start; min-height: 72px; font-size: var(--fs-child-large); }

/* ---------- Tile icons
   This block colours the drawn icons of the hub tiles with the pastel tokens. */
.icon-fill-path { fill: var(--g-path); }
.icon-fill-portal { fill: var(--g-portal); stroke: var(--c-outline); stroke-width: 2; }
.icon-fill-plush { fill: var(--g-plush); }
.icon-fill-sun { fill: var(--g-sun); }
.icon-fill-cloud { fill: var(--c-page); stroke: var(--c-outline); stroke-width: 2; }
.icon-fill-water { fill: var(--g-pond); }
.icon-fill-leaf { fill: var(--g-leaf); }
.icon-fill-eye { fill: var(--c-page); stroke: var(--c-text); stroke-width: 2; }
.icon-fill-handle { fill: var(--c-brand); stroke: var(--c-page); stroke-width: 2; }
.icon-stroke-rain { fill: none; stroke: var(--g-rain); stroke-width: 4; stroke-linecap: round; }
.icon-stroke-path { fill: none; stroke: var(--c-brand); stroke-width: 4; stroke-linecap: round; }
