/* StrongCAD Viewer – Entwurf A "Bühne": das Haus füllt den Bildschirm, Bedienung schwebt auf kleinen Flächen darüber.
   Farben, Schrift, Flächen 1:1 aus dem gewählten Entwurf A. */
html, body { margin: 0; height: 100%; overflow: hidden; background: #cfd8de; overscroll-behavior: none; }
.app { --g: rgba(252, 252, 250, .90); --t: #1c1f1b; --l: #565d54; --li: rgba(20, 30, 20, .08); --a: #2f5d46; --as: #ffffff; --ag: rgba(47, 93, 70, .15);
  --sh: 0 8px 24px rgba(0, 0, 0, .22), 0 1px 3px rgba(0, 0, 0, .16);
  --oben: env(safe-area-inset-top, 0px); --unten: env(safe-area-inset-bottom, 0px);
  --links: env(safe-area-inset-left, 0px); --rechts: env(safe-area-inset-right, 0px);
  --kt: calc(var(--oben) + 10px);
  position: fixed; inset: 0; overflow: hidden; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  font: 500 15px/1.35 -apple-system, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif; color: var(--t); background: #cfd8de; -webkit-font-smoothing: antialiased; }
.app.dk { --g: rgba(30, 33, 30, .88); --t: #eef0ea; --l: #b3baaf; --li: rgba(255, 255, 255, .10); --a: #8fc0a3; --as: #10201a; --ag: rgba(143, 192, 163, .22);
  --sh: 0 8px 24px rgba(0, 0, 0, .55), 0 1px 3px rgba(0, 0, 0, .5); background: #1b1f1c; }
.app[data-geraet="rechner"] { --kt: calc(var(--oben) + 16px); }
.app *, .app *::before, .app *::after { box-sizing: border-box; }
.app [hidden] { display: none !important; }
.app :where(button) { font: inherit; color: inherit; border: 0; background: none; padding: 0; margin: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.app :where(button):focus-visible { outline: 2px solid var(--a); outline-offset: 2px; }
.app svg { display: block; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.w { position: absolute; inset: 0; overflow: hidden; }
.messprobe { position: absolute; left: 0; top: 0; width: 0; height: 0; padding: var(--oben) var(--rechts) var(--unten) var(--links); visibility: hidden; pointer-events: none; }

/* Bühne: das Haus */
.buehne { position: absolute; inset: 0; overflow: hidden; touch-action: none; cursor: grab; background-color: #cfd8de; }
.app.dk .buehne { background-color: #1b1f1c; }
.buehne:active { cursor: grabbing; }
.w[data-modus="innen"] .buehne, .w[data-modus="foto"] .buehne { cursor: crosshair; }
.w[data-modus="start"] .buehne { cursor: default; pointer-events: none; }
.buehne canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; outline: none; }
.buehne { background-position: center; background-size: cover; background-repeat: no-repeat; }
.w.leer .buehne canvas { opacity: 0; }

/* schwebende Flächen (klein, mit leichter Unschärfe) */
.pille, .seg, .leiste, .hinweis, .karte, .blatt, .start, .toast {
  background: var(--g); box-shadow: var(--sh); -webkit-backdrop-filter: blur(14px) saturate(1.3); backdrop-filter: blur(14px) saturate(1.3); }
.kopf { position: absolute; z-index: 6; left: calc(var(--links) + 12px); right: calc(var(--rechts) + 12px); top: var(--kt); display: flex; align-items: center; gap: 8px; pointer-events: none; }
.app:not([data-geraet="handy"]):not(.schmal) .kopf { left: calc(var(--links) + 20px); right: calc(var(--rechts) + 20px); }
.kopf > * { pointer-events: auto; }
.kopf > .pille.titel { pointer-events: none; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pille { height: 44px; padding: 0 16px 0 8px; display: inline-flex; align-items: center; gap: 2px; border-radius: 22px; font-size: 15px; font-weight: 600; color: var(--t); white-space: nowrap; }
.pille svg { width: 22px; height: 22px; }
:is(.app[data-geraet="handy"], .app.schmal) .pille { padding: 0 12px 0 6px; font-size: 14px; }
.pille.titel { padding: 0 16px; font-weight: 650; }
.pille.rechts { margin-left: auto; padding: 0 16px 0 12px; gap: 6px; }
.pille.rechts svg { width: 20px; height: 20px; }
.seg { display: flex; height: 44px; border-radius: 22px; margin-left: auto; flex: none; }
:is(.app[data-geraet="handy"], .app.schmal) .seg { flex: 1; margin-left: 0; }
.seg button { position: relative; height: 44px; min-width: 64px; padding: 0 16px; font-size: 14px; font-weight: 600; color: var(--t); border-radius: 22px; white-space: nowrap; }
:is(.app[data-geraet="handy"], .app.schmal) .seg button { flex: 1; padding: 0 6px; min-width: 0; }
.seg button span { position: relative; }
.seg button.on { color: var(--as); }
.seg button.on::before { content: ""; position: absolute; inset: 4px; border-radius: 18px; background: var(--a); }

.hinweis { position: absolute; z-index: 5; left: 50%; transform: translateX(-50%); top: calc(var(--kt) + 54px); width: max-content; max-width: calc(100% - 24px); min-height: 44px; display: flex; align-items: center;
  padding: 0 0 0 16px; border-radius: 22px; font-size: 13.5px; font-weight: 550; line-height: 1.3; color: var(--t); }
.hinweis .ht { padding: 6px 0; }
.x { width: 44px; height: 44px; flex: none; display: flex; align-items: center; justify-content: center; border-radius: 22px; color: var(--l); }
.x svg { width: 18px; height: 18px; }

/* untere Leiste */
.leiste { position: absolute; z-index: 6; left: 50%; bottom: calc(var(--unten) + 14px); transform: translateX(-50%); display: flex; gap: 2px; padding: 4px; border-radius: 32px; max-width: calc(100% - 24px); }
.lk { min-width: 64px; height: 52px; padding: 0 10px; border-radius: 28px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; flex: none;
  font-size: 12px; font-weight: 600; color: var(--t); white-space: nowrap; transition: background-color .15s ease, transform .12s ease; }
.lk svg { width: 24px; height: 24px; }
.lk:active { transform: scale(.96); }
.lk[aria-pressed="true"] { background: var(--ag); color: var(--a); }
.app:not([data-geraet="handy"]):not(.schmal) .lk { flex-direction: row; gap: 8px; min-width: 120px; height: 48px; font-size: 15px; padding: 0 16px; }
.fuss { overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.fuss::-webkit-scrollbar { display: none; }
.fuss .lk { height: 44px; min-width: 104px; font-size: 14px; flex-direction: row; }
.fuss .lk.on { background: var(--a); color: var(--as); }
.app:not([data-geraet="handy"]):not(.schmal) .fuss .lk { height: 44px; font-size: 15px; min-width: 130px; }

/* Blätter / Tafeln */
.blatt { position: absolute; z-index: 7; left: calc(var(--links) + 12px); right: calc(var(--rechts) + 12px); bottom: calc(var(--unten) + 86px); padding: 4px 12px 12px; border-radius: 26px;
  max-height: calc(100% - var(--oben) - var(--unten) - 160px); overflow-y: auto; overscroll-behavior: contain;
  opacity: 0; visibility: hidden; transform: translateY(14px) scale(.98); transform-origin: 50% 100%;
  transition: opacity .2s ease, transform .28s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .28s; }
.blatt.offen { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.app:not([data-geraet="handy"]):not(.schmal) .blatt { left: 50%; right: auto; width: 420px; margin-left: -210px; bottom: calc(var(--unten) + 84px); }
.bk { display: flex; align-items: center; justify-content: space-between; padding-left: 6px; min-height: 48px; }
.bt { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.chips { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.chip { min-height: 48px; padding: 0 10px 0 12px; border-radius: 14px; display: flex; align-items: center; justify-content: space-between; gap: 6px; background: var(--li); font-size: 14px; font-weight: 600; text-align: left; color: var(--t); }
.chip:active { transform: scale(.97); }
.chip[aria-disabled="true"] { opacity: .5; }
.sw { flex: none; width: 36px; height: 22px; border-radius: 11px; background: rgba(128, 128, 128, .42); position: relative; transition: background-color .18s ease; }
.sw::after { content: ""; position: absolute; left: 2px; top: 2px; width: 18px; height: 18px; border-radius: 9px; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .35); transition: transform .2s cubic-bezier(.2, .8, .2, 1); }
.chip[aria-pressed="true"] .sw { background: var(--a); }
.chip[aria-pressed="true"] .sw::after { transform: translateX(14px); }
.frow { width: 100%; display: flex; align-items: center; gap: 12px; min-height: 68px; padding: 6px; border-radius: 16px; text-align: left; }
.frow + .frow { margin-top: 4px; }
.frow:active { background: var(--li); }
.frow svg { width: 20px; height: 20px; color: var(--l); margin-right: 4px; }
.th { flex: none; width: 88px; height: 56px; border-radius: 12px; background: var(--li) center / cover no-repeat; }
.ft { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.ft b { font-size: 16px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ft i { font-style: normal; font-size: 13px; color: var(--l); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fliste .zl { margin: 10px 6px 4px; }
.fliste .zl:first-child { margin-top: 2px; }
.artext { margin: 2px 6px 14px; font-size: 15px; line-height: 1.45; color: var(--t); }
.gross { width: 100%; height: 50px; border-radius: 25px; background: var(--a); color: var(--as); font-size: 17px; font-weight: 650; transition: transform .12s ease; }
.gross:active { transform: scale(.98); }
.gross[aria-busy="true"] { opacity: .6; }

/* Start */
.start { position: absolute; z-index: 6; left: calc(var(--links) + 12px); right: calc(var(--rechts) + 12px); bottom: calc(var(--unten) + 12px); padding: 20px 16px 14px; border-radius: 30px;
  max-height: calc(100% - var(--oben) - var(--unten) - 24px); overflow-y: auto; }
.app[data-geraet="tablet"]:not(.schmal) .start { left: 50%; right: auto; width: 520px; margin-left: -260px; bottom: calc(var(--unten) + 28px); padding: 26px 24px 18px; }
.app[data-geraet="rechner"]:not(.schmal) .start { left: 32px; right: auto; width: 440px; bottom: 32px; padding: 26px 24px 18px; }
.start h1 { margin: 0; font-size: 30px; line-height: 1.1; font-weight: 750; letter-spacing: -.025em; }
.sub { margin: 6px 0 16px; font-size: 15px; color: var(--l); }
.shint { margin: 10px 4px 0; font-size: 13px; line-height: 1.4; color: var(--l); }
.ablage { width: 100%; height: 64px; margin-top: 10px; border-radius: 16px; border: 1.5px dashed var(--l); display: flex; align-items: center; justify-content: center; font-size: 14px; color: var(--l); transition: background-color .15s ease; }
.app.ziehen .ablage { background: var(--ag); border-color: var(--a); color: var(--a); }
.zl { margin: 16px 6px 6px; font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--l); }
.zliste { display: flex; flex-direction: column; gap: 6px; }
.zrow { position: relative; width: 100%; display: flex; align-items: center; min-height: 64px; border-radius: 18px; background: var(--li); touch-action: pan-y; transition: transform .2s ease, opacity .2s ease; }
.zrow.zieht { transition: none; }
.zo { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 6px 4px 6px 6px; border-radius: 18px; text-align: left; }
.zo:active { transform: scale(.985); }
.zrow .th { width: 64px; height: 48px; }
.zrow .x { margin-right: 4px; }
.laden { margin-top: 14px; }
.laden .lt { font-size: 14px; font-weight: 600; color: var(--t); }
.balken { height: 6px; margin-top: 8px; border-radius: 3px; background: var(--li); overflow: hidden; }
.balken i { display: block; height: 100%; width: 0; background: var(--a); border-radius: 3px; transition: width .2s ease; }
.fehler { margin: 12px 4px 0; padding: 10px 12px; border-radius: 14px; background: rgba(176, 58, 46, .12); color: #9b2c22; font-size: 14px; line-height: 1.4; font-weight: 600; }
.app.dk .fehler { background: rgba(240, 120, 100, .16); color: #f2a99c; }

/* Bauteil */
.marke { position: absolute; z-index: 3; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; background: var(--a); border: 3px solid #fff;
  box-shadow: 0 0 0 7px rgba(255, 255, 255, .35), 0 2px 8px rgba(0, 0, 0, .4); pointer-events: none; }
.karte { position: absolute; z-index: 5; width: 288px; max-width: calc(100% - 24px); padding: 14px 8px 14px 16px; border-radius: 22px; }
.karte .x { position: absolute; top: 2px; right: 2px; }
.kn { padding-right: 40px; font-size: 19px; font-weight: 700; letter-spacing: -.01em; overflow-wrap: anywhere; }
.kg { font-size: 13px; color: var(--l); overflow-wrap: anywhere; }
.km { margin: 10px 0 10px; font-size: 22px; font-weight: 700; letter-spacing: -.015em; font-variant-numeric: tabular-nums; }
.km small { font-size: 15px; font-weight: 600; color: var(--l); letter-spacing: 0; }
.kz { margin: 0; padding-right: 8px; display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 14px; }
.kz dt { color: var(--l); }
.kz dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }

/* Hineingehen: Zielring am Boden */
.ring { position: absolute; z-index: 3; width: 72px; height: 28px; margin: -14px 0 0 -36px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .3); pointer-events: none; animation: a-ring .9s ease-out forwards; }
@keyframes a-ring { from { transform: scale(.3); opacity: 1; } to { transform: scale(1); opacity: 0; } }
.toast { position: absolute; z-index: 9; left: 50%; transform: translateX(-50%); top: calc(var(--kt) + 54px); max-width: calc(100% - 32px); width: max-content; padding: 12px 18px; border-radius: 22px; font-size: 14px; font-weight: 600; text-align: center; pointer-events: none; }
.messung { position: absolute; z-index: 10; left: 12px; top: 12px; max-width: calc(100% - 24px); max-height: calc(100% - 24px); overflow: auto; margin: 0; padding: 12px 14px; border-radius: 14px; background: var(--g); color: var(--t); font: 12px/1.4 ui-monospace, Consolas, monospace; white-space: pre-wrap; }
@media (prefers-reduced-motion: reduce) {
  .blatt { transform: none !important; transition: opacity .15s ease; }
  .sw::after, .lk, .chip, .zrow { transition: none; }
  .ring { animation: none; opacity: 1; }
}

/* Kurz-/Langtexte der Ansichten; schmale Fenster (Rechner < 700 px) wie Handy */
.seg .kurz { display: none; }
:is(.app[data-geraet="handy"], .app.schmal) .seg .lang { display: none; }
:is(.app[data-geraet="handy"], .app.schmal) .seg .kurz { display: inline; }
:is(.app[data-geraet="handy"], .app.schmal) .pille.titel { display: none; }
@media (max-width: 380px) {
  .kopf .pille[data-a="start"] span { display: none; }
  .kopf .pille[data-a="start"] { padding: 0 10px 0 8px; }
}
