/* Baumodus (K05, docs/ux/BAUMODUS_2026-11-04.md): the Vorlage as large as the screen allows, never cropped; square
   picture tiles below it (portrait) or in the two bottom corners (landscape). No header, no navigation. */
.app-shell:has(.view.is-active[data-view="detail"] .baumodus) .app-header,
.app-shell:has(.view.is-active[data-view="detail"] .baumodus) .bottom-nav { display: none; }
.view.detail-view.is-active:has(.baumodus) { position: fixed; inset: 0; z-index: 20; margin: 0; padding: 0; max-width: none;
  background: var(--kds-color-surface-page); overscroll-behavior: none; }
.detail-view:has(.baumodus) > #detailContent { height: 100%; padding: 0; }
.detail-view:has(.baumodus) #closeDetail { display: none; }
.baumodus { position: relative; display: flex; flex-direction: column; height: 100%; height: 100dvh;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); box-sizing: border-box; -webkit-user-select: none; user-select: none; }
.bau-stage { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; }
/* Laid over the stage: a percentage height inside the flexible stage would take the photo's own height instead. */
.bau-stage > img { position: absolute; inset: 8px; width: calc(100% - 16px); height: calc(100% - 16px); object-fit: contain; display: block; }
/* The 3D model of the plan (spec 2026-11-14-plan-3d-kachel-design.md) in the place of the picture; one finger turns it. */
.bau-stage > .bau-3d { position: absolute; inset: 8px; width: calc(100% - 16px); height: calc(100% - 16px); display: block; touch-action: none; }
.bau-stage > [hidden] { display: none; }
.bau-tools { display: flex; justify-content: space-between; gap: 8px; padding: 8px 12px 12px; }
.bau-group { display: flex; gap: 8px; }
.bau-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  /* Five tiles (Zurück, Steine, Plan, Scan, Foto) fit a 390 px phone: 72 px or a fifth of the bar. */
  width: min(72px, calc((100vw - 56px) / 5)); height: min(72px, calc((100vw - 56px) / 5)); padding: 6px; border: 0; border-radius: var(--kds-radius-md);
  background: var(--kds-color-surface-card); color: var(--kds-color-text-default); font: inherit; }
.bau-tile svg { width: 36px; height: 36px; fill: none; stroke: currentColor; stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; }
.bau-tile small { font-size: 11px; line-height: 1.1; color: inherit; opacity: .75; }
/* Foto is the way to finish; Übernehmen and Weiterbauen lead on the same way. */
.bau-tile:is([data-bau="photo"], [data-bau="take"], [data-bau="again"]) { background: var(--kds-color-action-primary-bg); color: #fff; }
.bau-tile:is([data-bau="photo"], [data-bau="take"], [data-bau="again"]) small { opacity: 1; }
.bau-stones { position: absolute; left: 12px; right: 12px; bottom: calc(env(safe-area-inset-bottom) + 96px);
  display: flex; flex-wrap: wrap; gap: 8px; padding: 10px; border-radius: var(--kds-radius-md);
  background: var(--kds-color-surface-page); box-shadow: 0 4px 16px rgba(28, 25, 19, .22); }
.bau-stones[hidden] { display: none; }
.bau-stone { display: flex; align-items: center; gap: 4px; padding: 4px 8px 4px 4px; border-radius: var(--kds-radius-md);
  background: var(--kds-color-surface-highlight); }
.bau-stone > svg { width: 44px; height: 44px; }
.bau-stone em { font-style: normal; font-size: 12px; padding: 0 4px; }
.bau-stone b { font-size: 22px; font-weight: 700; min-width: 1.2em; text-align: center; }
.bau-saved { display: flex; flex-direction: column; align-items: center; gap: 8px; max-width: 70%; max-height: 100%;
  color: var(--kds-color-text-default); text-decoration: none; }
.bau-saved img { max-width: 100%; max-height: 50vh; object-fit: contain; border-radius: var(--kds-radius-md);
  box-shadow: 0 4px 16px rgba(28, 25, 19, .22); }
.bau-saved small { font-size: 13px; font-weight: 600; }
.bau-message { position: absolute; left: 12px; right: 12px; bottom: calc(env(safe-area-inset-bottom) + 96px); margin: 0;
  padding: 10px; border-radius: var(--kds-radius-md); background: var(--kds-color-surface-page); font-size: 14px; }
/* Landscape on a phone: the picture takes the whole screen, the tiles sit in the two bottom corners above it. */
@media (orientation: landscape) and (max-height: 520px) {
  .bau-stage > :is(img, .bau-3d) { inset: 4px; width: calc(100% - 8px); height: calc(100% - 8px); }
  .bau-tools { position: absolute; left: 0; right: 0; bottom: env(safe-area-inset-bottom); padding: 8px; pointer-events: none; }
  .bau-group { pointer-events: auto; }
  .bau-tile { width: 60px; height: 60px; box-shadow: 0 2px 8px rgba(28, 25, 19, .18); }
  .bau-stones, .bau-message { bottom: calc(env(safe-area-inset-bottom) + 76px); }
  /* Saved: the tiles lie over the stage, so the miniature keeps clear of the large Weiterbauen tile. */
  .baumodus[data-state="done"] .bau-stage { padding-bottom: calc(env(safe-area-inset-bottom) + 100px); }
  .baumodus[data-state="done"] .bau-saved img { max-height: calc(100dvh - 160px); }
}
/* Saved: Weiterbauen leads, Prüfen and Start stay small (BM §6, no equal row of buttons). */
.baumodus[data-state="done"] .bau-tools { justify-content: center; }
.baumodus[data-state="done"] .bau-group { align-items: flex-end; }
.baumodus[data-state="done"] [data-bau="again"] { width: 144px; height: 88px; }
.baumodus[data-state="done"] [data-bau="again"] small { font-size: 13px; }
.baumodus[data-state="done"] :is([data-bau="scan"], [data-bau="home"]) { width: 56px; height: 56px; }
.baumodus[data-state="done"] :is([data-bau="scan"], [data-bau="home"]) svg { width: 28px; height: 28px; }
.bau-corner { position: absolute; top: 8px; left: 12px; }
/* With a next Vorlage, Nächste Aufgabe is the large tile and Weiterbauen a normal one (BM §6). */
.baumodus[data-state="done"] .has-next [data-bau="again"] { width: 72px; height: 72px; background: var(--kds-color-surface-card); color: var(--kds-color-text-default); }
.baumodus[data-state="done"] .has-next [data-bau="again"] small { font-size: 11px; opacity: .75; }
.baumodus[data-state="done"] [data-bau="next"] { width: 144px; height: 88px; background: var(--kds-color-action-primary-bg); color: #fff; }
.baumodus[data-state="done"] [data-bau="next"] small { font-size: 13px; opacity: 1; }
/* Tipp: top right over the Vorlage; the hint opens below it and closes with the next touch, also on itself. */
.bau-corner-right { left: auto; right: 12px; }
.baumodus [data-bau="tip"] { width: 56px; height: 56px; box-shadow: 0 2px 8px rgba(28, 25, 19, .18); }
.baumodus [data-bau="tip"] svg { width: 28px; height: 28px; }
/* The 2D/3D switch lies over the model, whose ground has the tile's colour: the tip's shadow sets it off. */
.baumodus [data-bau="dim"] { width: 56px; height: 56px; box-shadow: 0 2px 8px rgba(28, 25, 19, .18); }
.baumodus [data-bau="dim"] svg { width: 28px; height: 28px; }
.bau-tip { position: absolute; left: 12px; right: 12px; top: 72px; margin: 0;
  padding: 12px 14px; border-radius: var(--kds-radius-md); background: var(--kds-color-surface-page);
  box-shadow: 0 4px 16px rgba(28, 25, 19, .22); font-size: 16px; line-height: 1.4; }
.bau-tip[hidden] { display: none; }
