/* Layout, HUD, Panels, Karten, Buttons */
:root {
  --ink: #e8f0ff;
  --ink-dim: #a9b8d8;
  --panel: rgba(13, 21, 46, .84);
  --panel-line: rgba(255, 255, 255, .14);
  --accent: #5ee6c0;
  --accent-ink: #052a22;
  --warn: #ffb454;
  --bad: #ff6b7a;
  --good: #7dffa0;
  --bg: #121a3a;
  font-family: system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); -webkit-tap-highlight-color: transparent; }
body { font-size: 15px; line-height: 1.45; user-select: none; -webkit-user-select: none; }
body.booting #viewport { opacity: 0; }

#viewport { position: fixed; inset: 0; overflow: hidden; touch-action: none; cursor: crosshair; transition: opacity .4s; }
/* Tauchgang: das Bild wird dunkler und blauer */
#viewport::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 1.6s; z-index: 7;
  background: radial-gradient(ellipse at 50% 45%, rgba(20, 70, 160, 0) 25%, rgba(8, 30, 90, .6) 100%), rgba(30, 110, 200, .14);
}
body.diving #viewport::after { opacity: 1; }
#world { position: absolute; left: 0; top: 0; width: 3200px; height: 2000px; transform-origin: 0 0; will-change: transform; }

[hidden] { display: none !important; }
.muted { color: var(--ink-dim); }
.small { font-size: 12.5px; }

/* ---------- Buttons ---------- */
.btn {
  font: inherit; color: var(--ink); background: rgba(255, 255, 255, .09); border: 1px solid var(--panel-line);
  border-radius: 10px; padding: 8px 14px; cursor: pointer; transition: background .15s, transform .1s, border-color .15s;
}
.btn:hover:not(:disabled) { background: rgba(255, 255, 255, .17); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:focus-visible, .opt:focus-visible, .lex-item:focus-visible, .pill:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 700; }
.btn.primary:hover:not(:disabled) { background: #8bf2d6; }
.btn.ghost { background: transparent; }
.btn.big { padding: 12px 22px; font-size: 16px; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.sel { border-color: var(--accent); color: var(--accent); }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#hud > * { pointer-events: none; }
#hud .panel, #hud .btn, #hud button { pointer-events: auto; }
.panel {
  background: var(--panel); border: 1px solid var(--panel-line); border-radius: 14px;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}

#hud-top { position: absolute; left: 12px; right: 12px; top: 12px; display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
#levelbox { padding: 10px 14px; min-width: 230px; max-width: 340px; }
.lvl-title { font-weight: 700; letter-spacing: .02em; margin-bottom: 4px; }
#objectives { list-style: none; margin: 0; padding: 0; font-size: 13.5px; color: var(--ink-dim); }
#objectives li { padding-left: 20px; position: relative; margin: 2px 0; }
#objectives li::before { content: ""; position: absolute; left: 2px; top: .38em; width: 11px; height: 11px; border: 2px solid var(--ink-dim); border-radius: 3px; }
#objectives li.done { color: var(--good); }
#objectives li.done::before { background: var(--good); border-color: var(--good); }

#bars { padding: 10px 14px; min-width: 200px; }
.bar-row { display: grid; grid-template-columns: 86px 1fr; gap: 8px; align-items: center; font-size: 13px; margin: 3px 0; }
.bar { height: 10px; background: rgba(255, 255, 255, .12); border-radius: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #4fd1c5, #7dffa0); border-radius: 6px; transition: width .3s, background .3s; }
.bar.mem i { background: linear-gradient(90deg, #5ee6c0, #b8f5e6); }
.bar i.bad { background: linear-gradient(90deg, #ff6b7a, #ffb454); }
.infected { margin-top: 6px; font-size: 12.5px; color: var(--bad); font-weight: 700; }
.infected.dive { color: #8fd3ff; }

#stock { padding: 8px 10px; display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 320px; max-width: 640px; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px 3px 5px; border-radius: 999px; background: rgba(255, 255, 255, .08); font-size: 13px; font-variant-numeric: tabular-nums; }
.chip.hidden { display: none; }
.chip .ico { width: 18px; height: 18px; display: grid; place-items: center; }
.chip b { min-width: 1.4em; text-align: right; }
.chip small { color: var(--ink-dim); font-size: 11px; }
.chip.full { background: rgba(255, 180, 84, .25); }
.chip.low b { color: var(--bad); }
.chip.flash { animation: flash .5s 2; }
.chip.gain { animation: chipGain .7s ease-out; }
@keyframes chipGain { 20% { scale: 1.2; background: rgba(94, 230, 192, .45); } }
@keyframes flash { 50% { background: rgba(255, 107, 122, .5); } }

/* Meldungen hängen direkt unter den Anzeigen oben (Höhe 0, die Karten ragen nach unten heraus), egal wie hoch diese gerade sind */
#toasts { flex: 1 1 100%; height: 0; display: flex; flex-direction: column; gap: 6px; align-items: center; margin-top: -4px; }
#toasts .toast { max-width: min(640px, 92vw); }
.toast { background: var(--panel); border: 1px solid var(--panel-line); border-left: 4px solid var(--accent); padding: 7px 14px; border-radius: 10px; font-size: 14px; text-align: center; animation: toastIn .3s; }
.toast.bad { border-left-color: var(--bad); }
.toast.warn { border-left-color: var(--warn); }
.toast.good { border-left-color: var(--good); }
.toast.learn { border-left-color: #a99bff; }
.toast.out { opacity: 0; transition: opacity .6s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } }

#hintbar { width: max-content; max-width: min(680px, calc(100vw - 24px)); background: rgba(94, 230, 192, .93); color: var(--accent-ink); padding: 9px 18px; border-radius: 12px; font-weight: 600; text-align: center; box-shadow: 0 4px 18px rgba(0, 0, 0, .35); animation: toastIn .3s; }

/* Fußleiste: Hinweisbalken über den Knöpfen; ihre Höhe (auch bei zwei Knopfreihen) steht in --foot, danach richten sich die Panels */
#hud-foot { position: absolute; left: 12px; right: 12px; bottom: 12px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
#hud-bottom { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.hud-btn { background: var(--panel); display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; }
.hud-btn kbd { font: inherit; font-size: 11px; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--panel-line); color: var(--ink-dim); }
.hud-btn.release { border-color: rgba(94, 230, 192, .5); }
.hud-btn.note b { font-size: 17px; line-height: 1; position: relative; padding: 0 2px; }
.hud-btn.note.off b { color: var(--ink-dim); }
.hud-btn.note.off b::after { content: ''; position: absolute; left: -3px; right: -3px; top: 50%; height: 2px; border-radius: 2px; background: var(--bad); rotate: -40deg; }
.hud-btn.release.ready { animation: pulse 1s infinite; background: rgba(94, 230, 192, .25); }
/* Antibiotikum: Kapsel statt Y, violett abgesetzt von den Antikörpern */
.hud-btn.abx { border-color: rgba(190, 140, 255, .6); }
.hud-btn.abx.ready { background: rgba(170, 110, 255, .28); }
.pill-ico { display: inline-block; width: 20px; height: 9px; border-radius: 5px; rotate: -35deg; flex: none;
  background: linear-gradient(90deg, #c9a6ff 0 50%, #fff 50%); box-shadow: 0 0 0 1.5px #6d37b8; }
.pill-ico.big { width: 64px; height: 28px; border-radius: 14px; box-shadow: 0 0 0 3px #6d37b8; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(94, 230, 192, .3); } }

/* ---------- Seitenpanels ---------- */
.side { position: absolute; left: 12px; top: var(--head, 170px); bottom: calc(var(--foot, 54px) + 8px); width: 360px; max-width: calc(100vw - 24px); display: flex; flex-direction: column; padding: 12px; overflow: hidden; }
.side.right { left: auto; right: 12px; width: 340px; bottom: auto; max-height: calc(100vh - var(--head, 170px) - var(--foot, 54px) - 16px); overflow: auto; }
.side header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.side h3 { margin: 0; font-size: 16px; }
#build-list { overflow: auto; display: flex; flex-direction: column; gap: 8px; padding-right: 2px; }

.bcard { display: grid; grid-template-columns: 76px 1fr auto; gap: 10px; padding: 10px; border-radius: 12px; background: rgba(255, 255, 255, .06); border: 1px solid transparent; align-items: center; }
.bcard.maxed { opacity: .55; }
.bprev { height: 64px; position: relative; overflow: hidden; border-radius: 10px; background: radial-gradient(circle, rgba(184, 245, 230, .5), rgba(94, 230, 192, .18)); }
.bprev .pv { width: 100%; height: 100%; }
.binfo h4 { margin: 0 0 2px; font-size: 14.5px; }
.binfo h4 small { color: var(--ink-dim); font-weight: 400; margin-left: 4px; }
.binfo p { margin: 0 0 6px; font-size: 12.5px; color: var(--ink-dim); line-height: 1.35; }
.costs { display: flex; flex-wrap: wrap; gap: 4px; }
.cost { display: inline-flex; align-items: center; gap: 3px; background: rgba(0, 0, 0, .25); border-radius: 999px; padding: 1px 7px 1px 4px; font-size: 12px; font-variant-numeric: tabular-nums; }
.cost.short { color: var(--bad); background: rgba(255, 107, 122, .16); }
.why { font-size: 12px; color: var(--warn); min-height: 0; margin-top: 3px; }
.why:empty { display: none; }
.bbtn { display: flex; flex-direction: column; gap: 6px; }

.prow { display: grid; grid-template-columns: 14px 1fr; column-gap: 8px; padding: 5px 0; border-bottom: 1px solid rgba(255, 255, 255, .06); font-size: 13.5px; }
.prow small { grid-column: 2; color: var(--ink-dim); font-size: 12px; }
.prow .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--good); margin-top: 6px; box-shadow: 0 0 6px var(--good); }
.prow.missing .dot, .prow.full .dot, .prow.lowEnergy .dot { background: var(--warn); box-shadow: none; }
.prow.lowEnergy small { color: var(--warn); }
.prow.inhibited .dot { background: #a99bff; box-shadow: none; }
.prow.hijacked .dot { background: var(--bad); box-shadow: none; }
.prow.blocked .dot { background: #6ab7ff; box-shadow: none; }
.prow.blocked small { color: #8fd3ff; }
.prow.missing small, .prow.full small { color: var(--warn); }
.prow.hijacked small { color: var(--bad); }
.codons { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--panel-line); }
.crow { display: grid; grid-template-columns: 52px 1fr; gap: 6px; align-items: start; margin: 4px 0; }
.clabel { font-size: 11.5px; color: var(--ink-dim); padding-top: 3px; }
.codons code { display: flex; flex-wrap: wrap; gap: 3px; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.codons code span { padding: 1px 4px; border-radius: 4px; background: rgba(255, 255, 255, .06); color: rgba(255, 255, 255, .25); }
.codons code span.on { background: rgba(94, 230, 192, .2); color: var(--accent); }

/* ---------- Karten (Modals) ---------- */
#modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 14px; background: rgba(5, 8, 22, .72); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: fade .25s; }
@keyframes fade { from { opacity: 0; } }
.card { width: min(680px, 100%); max-height: calc(100vh - 28px); overflow: auto; background: #101a3c; border: 1px solid var(--panel-line); border-radius: 18px; padding: 24px 26px; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); user-select: text; -webkit-user-select: text; animation: cardIn .3s cubic-bezier(.2, 1.2, .4, 1); }
@keyframes cardIn { from { opacity: 0; transform: translateY(14px) scale(.97); } }
.card.wide { width: min(960px, 100%); padding: 18px 20px; }
.card h1, .card h2, .card h3, .card h4 { margin: 0 0 8px; }
.card h2 { font-size: 24px; }
.card h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); margin-top: 16px; }
.card p { margin: 0 0 10px; }
.card-kicker { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin-bottom: 4px; }
.card-kicker.bad { color: var(--bad); }
.story { font-size: 16px; line-height: 1.55; }
.actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.actions.col { flex-direction: column; align-items: stretch; }
/* Ist eine Karte höher als der Bildschirm, bleiben die Knöpfe beim Scrollen unten sichtbar */
.card > .actions { position: sticky; bottom: -1px; padding: 12px 0 2px; background: linear-gradient(180deg, rgba(16, 26, 60, 0), #101a3c 30%); z-index: 1; }
.goals { margin: 0; padding-left: 20px; color: var(--ink-dim); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { font: inherit; font-size: 13px; color: var(--ink); background: rgba(169, 155, 255, .18); border: 1px solid rgba(169, 155, 255, .4); border-radius: 999px; padding: 3px 12px; cursor: pointer; }
.pill:hover { background: rgba(169, 155, 255, .32); }

/* Lerneintrag */
.entry .e-head { display: flex; gap: 16px; align-items: center; margin-bottom: 8px; }
.entry h3 { font-size: 22px; margin: 0; }
.e-sub { color: var(--ink-dim); font-size: 13px; }
.entry section { margin-top: 10px; }
.entry section h4 { margin: 0 0 2px; font-size: 12px; }
.entry section p { margin: 0; }
.entry .fact { background: rgba(169, 155, 255, .12); border-left: 3px solid #a99bff; padding: 8px 12px; border-radius: 0 10px 10px 0; }
.entry .fact h4 { color: #c9c0ff; }
.entry .game { background: rgba(94, 230, 192, .1); border-left: 3px solid var(--accent); padding: 8px 12px; border-radius: 0 10px 10px 0; }
.entry .game h4 small { text-transform: none; letter-spacing: 0; color: var(--ink-dim); font-weight: 400; margin-left: 6px; }
.pv { position: relative; width: 110px; height: 90px; flex: none; display: grid; place-items: center; border-radius: 14px; background: radial-gradient(circle, rgba(184, 245, 230, .45), rgba(94, 230, 192, .12)); }
.pv .org { position: relative; left: auto; top: auto; margin: 0; translate: none; rotate: none; scale: var(--k, 1); }
.pv .res { scale: var(--k, 1); }
.pv.wide { width: 136px; overflow: hidden; }

/* Lexikon */
.lex-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.lex-head h2 { margin: 0; }
.lex-head .btn { margin-left: auto; }
.lex-body { display: grid; grid-template-columns: 230px 1fr; gap: 16px; min-height: 0; height: min(560px, calc(100vh - 130px)); }
.lex-nav { overflow: auto; padding-right: 6px; border-right: 1px solid var(--panel-line); }
.lex-nav h5 { margin: 12px 0 4px; font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.lex-nav h5:first-child { margin-top: 0; }
.lex-item { display: block; width: 100%; text-align: left; font: inherit; font-size: 13.5px; color: var(--ink); background: transparent; border: 0; padding: 4px 8px; border-radius: 7px; cursor: pointer; }
.lex-item:hover { background: rgba(255, 255, 255, .08); }
.lex-item.sel { background: rgba(94, 230, 192, .2); }
.lex-item.locked { color: var(--ink-dim); opacity: .6; }
.lex-view { overflow: auto; padding-right: 6px; }

/* Titel */
.start { text-align: center; }
@media (min-width: 861px), (min-width: 640px) and (max-height: 560px) {   /* breit oder flach: Zelle links, Texte und Knöpfe rechts, damit nichts gescrollt werden muss */
  .card.start { width: min(900px, 100%); }
  .start { display: grid; grid-template-columns: 300px 1fr; column-gap: 34px; align-items: center; }
  .start .about { margin-top: 0; }
}
@media (max-height: 560px) {           /* flaches Querformat: kompakter, die Tastenübersicht entfällt (dort wird meist getippt) */
  .card.start { padding: 10px 18px; }
  .start .logo { font-size: 32px; }
  .start .scene { --sc: .66; margin-top: 0; }
  .start .about { font-size: 13.5px; margin-bottom: 0; }
  .start .actions { margin-top: 10px; gap: 6px; }
  .start .btn.big { padding: 6px 18px; font-size: 15px; }
  .start .controls, .start .st-main > .muted { display: none; }
  .start .langs { margin-top: 8px; }
}
.logo { font-size: 46px; letter-spacing: .02em; margin: 0; line-height: 1.1; }
.logo span { color: var(--accent); }
.tag { color: var(--ink-dim); margin: 2px 0 6px; }
.about { max-width: 520px; margin: 8px auto 4px; }
.start .actions { justify-content: center; max-width: 320px; margin-left: auto; margin-right: auto; }
.controls { text-align: left; display: inline-block; margin-top: 14px; background: rgba(255, 255, 255, .05); padding: 10px 16px; border-radius: 12px; font-size: 13.5px; }
.controls h4 { margin: 0 0 4px; }
.controls ul { margin: 0; padding-left: 18px; color: var(--ink-dim); }
.langs { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px; }
.mini { position: relative; width: 210px; height: 236px; margin: 12px auto; }          /* die Zellhaut ragt etwas über den Kasten hinaus */
.mini .cell-body { position: absolute; inset: auto; left: 50%; top: 50%; width: 360px; height: 360px; margin: -180px 0 0 -180px; scale: .7; }

/* Titelbild: Platty mit Gedankenblase (entworfen auf 300 x 300 px, über --sc skaliert) */
.scene { --sc: 1; position: relative; width: calc(300px * var(--sc)); height: calc(300px * var(--sc)); margin: 4px auto 0; }
.scene-in { position: absolute; left: 0; top: 0; width: 300px; height: 300px; transform-origin: 0 0; scale: var(--sc); }
.scene .bub {
  position: absolute; left: 80px; top: 0; width: 140px; height: 140px; border-radius: 50%; overflow: hidden;
  border: 3px solid rgba(184, 245, 230, .55);
  background: radial-gradient(circle at 32% 26%, rgba(255, 255, 255, .26), rgba(94, 230, 192, .12) 62%, rgba(20, 40, 80, .5));
  box-shadow: 0 0 24px rgba(94, 230, 192, .28), inset 0 0 18px rgba(184, 245, 230, .25);
}
.scene .bub .mini { position: absolute; inset: 0; width: auto; height: auto; margin: 0; }
.scene .bub .mini .cell-body { scale: .33; }
.scene .dot { position: absolute; border-radius: 50%; border: 2px solid rgba(184, 245, 230, .55); background: rgba(184, 245, 230, .18); }
.scene .d1 { left: 206px; top: 168px; width: 8px; height: 8px; }
.scene .d2 { left: 196px; top: 150px; width: 13px; height: 13px; }
.scene .pl { position: absolute; left: 15px; top: 128px; }
@media (max-width: 400px) { .scene { --sc: .8; } }
.card-platy { display: flex; justify-content: center; margin: 2px 0 6px; }

/* Quiz */
.opts { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.opt { font: inherit; text-align: left; color: var(--ink); background: rgba(255, 255, 255, .07); border: 1px solid var(--panel-line); border-radius: 12px; padding: 11px 14px; cursor: pointer; transition: background .15s; }
.opt:hover:not(:disabled) { background: rgba(255, 255, 255, .15); }
.opt.right { background: rgba(125, 255, 160, .2); border-color: var(--good); }
.opt.wrong { background: rgba(255, 107, 122, .2); border-color: var(--bad); }
.opt:disabled { cursor: default; color: var(--ink); }
#q-why { margin-top: 12px; padding: 10px 14px; border-radius: 10px; background: rgba(169, 155, 255, .12); border-left: 3px solid #a99bff; }

/* Mitose */
.mito { text-align: center; }
.dots { display: flex; gap: 8px; justify-content: center; margin: 4px 0 10px; }
.dots i { width: 10px; height: 10px; border-radius: 50%; background: rgba(255, 255, 255, .18); transition: background .3s; }
.dots i.on { background: var(--accent); }

.pause { text-align: center; width: min(420px, 100%); }
.victory { text-align: center; }
.victory .logo { font-size: 34px; color: var(--accent); }
.victory .actions { justify-content: center; }

/* ---------- Schmale Bildschirme ---------- */
@media (max-width: 760px) {
  body { font-size: 14px; }
  #hud-top { left: 6px; right: 6px; top: 6px; gap: 6px; }
  #levelbox { min-width: 0; max-width: none; flex: 1 1 100%; padding: 6px 10px; }
  #objectives { font-size: 12.5px; }
  #bars { flex: 1 1 100%; padding: 6px 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
  .bar-row { grid-template-columns: 1fr; gap: 2px; margin: 2px 0; }
  #bars .infected { grid-column: 1 / -1; margin-top: 2px; }
  #stock { padding: 5px 6px; gap: 4px; flex: 1 1 100%; }
  .chip small { display: none; }
  #hud:has(.side:not([hidden])) #hintbar { display: none; }     /* sonst scheint der Hinweis grün durch das Panel */
  .side { left: 6px; right: 6px; top: auto; bottom: calc(var(--foot, 54px) + 8px); width: auto; max-height: 46vh; }
  .side.right { right: 6px; left: 6px; width: auto; top: auto; bottom: calc(var(--foot, 54px) + 8px); max-height: 46vh; }
  #hud-bottom { gap: 6px; }
  .hud-btn { padding: 7px 9px; }
  .hud-btn.note { padding: 7px 8px; }
  .hud-btn kbd { display: none; }
  .card { padding: 18px 16px; }
  .lex-body { grid-template-columns: 1fr; height: calc(100vh - 140px); }
  .lex-nav { border-right: 0; border-bottom: 1px solid var(--panel-line); max-height: 30vh; padding-bottom: 6px; }
  .logo { font-size: 36px; }
  .bcard { grid-template-columns: 64px 1fr auto; gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: .001s !important; }
}

/* ---------- Zell-Rundgang (js/tour.js) ---------- */
#tour { position: fixed; left: 50%; bottom: 76px; transform: translateX(-50%); width: min(580px, calc(100vw - 24px)); z-index: 6; }
.tour-card {
  background: var(--panel); border: 1px solid var(--panel-line); border-top: 3px solid var(--accent); border-radius: 14px;
  padding: 10px 16px 14px; box-shadow: 0 8px 28px rgba(0, 0, 0, .45); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  max-height: calc(100vh - 150px); overflow: auto; animation: tourIn .7s ease-out;
}
@keyframes tourIn { from { opacity: 0; transform: translateY(6px); } }
@media (max-width: 760px) and (max-height: 720px) {       /* kleines Handy hochkant: kompaktere Karte, damit die Zelle noch Platz hat */
  #tour { bottom: 64px; }
  .tour-card { padding: 9px 12px; }
  .tour-dots { margin-bottom: 3px; }
  .tour-card h3 { font-size: 15.5px; }
  .tour-card p { font-size: 13px; line-height: 1.35; }
  .tour-legend li { font-size: 12.5px; }
  .tour-goals { font-size: 13px; }
  .tour-actions { margin-top: 8px; }
  .tour-actions .btn { padding: 5px 12px; }
}
/* flacher Querformat-Bildschirm: Karte rechts, Zelle links daneben (js/tour.js setzt die Klasse) */
#tour.tour-side { left: auto; right: 12px; bottom: 56px; transform: none; width: min(52vw, 480px); }
#tour.tour-side .tour-card { max-height: calc(100vh - var(--tour-top, 130px) - 62px); padding: 8px 12px; }
#tour.tour-side .tour-dots { margin-bottom: 3px; }
#tour.tour-side .tour-card h3 { font-size: 15px; margin-bottom: 2px; }
#tour.tour-side .tour-card p { font-size: 12.5px; line-height: 1.35; }
#tour.tour-side .tour-legend { margin-top: 4px; gap: 2px; }
#tour.tour-side .tour-legend li { font-size: 12px; }
#tour.tour-side .tour-goals { font-size: 12px; margin-top: 4px; }
#tour.tour-side .tour-goals li { margin: 1px 0; }
#tour.tour-side .tour-actions { margin-top: 6px; }
#tour.tour-side .btn { padding: 4px 12px; }
.tour-dots { display: flex; gap: 5px; margin-bottom: 6px; }
.tour-dots i { width: 7px; height: 7px; border-radius: 4px; background: rgba(255, 255, 255, .2); transition: width .3s; }
.tour-dots i.on { background: rgba(94, 230, 192, .55); }
.tour-dots i.cur { width: 20px; background: var(--accent); }
.tour-card h3 { margin: 0 0 4px; font-size: 17px; }
.tour-card p { margin: 0; font-size: 14.5px; line-height: 1.45; color: var(--ink); }
.tour-legend { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.tour-legend li { display: grid; grid-template-columns: 30px 1fr; align-items: center; gap: 8px; font-size: 13.5px; }
.tour-legend .lg { width: 30px; height: 28px; display: grid; place-items: center; border-radius: 8px; background: rgba(255, 255, 255, .08); }
.tour-goals { list-style: none; margin: 8px 0 0; padding: 0; font-size: 14px; color: var(--ink-dim); }
.tour-goals li { padding-left: 22px; position: relative; margin: 3px 0; }
.tour-goals li::before { content: ""; position: absolute; left: 3px; top: .38em; width: 11px; height: 11px; border: 2px solid var(--ink-dim); border-radius: 3px; }
.tour-actions { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.tour-actions .grow { flex: 1; }

/* Beim Rundgang sind die Anzeigen zuerst versteckt und erscheinen mit ihrem Schritt; die gerade erklärte pulsiert */
#levelbox, #bars, #stock, #hud-bottom { transition: opacity 1.2s; }
body.touring #levelbox, body.touring #bars, body.touring #stock, body.touring #hud-bottom { opacity: 0; }
body.touring #hud .tour-on { opacity: 1; }
body.touring #hud * { pointer-events: none !important; }
#ents { transition: opacity 1.5s; }
body.touring #ents:not(.t-show) { opacity: 0; }
.tour-spot { outline: 3px solid var(--accent); outline-offset: 4px; border-radius: 14px; animation: spotPulse 2.6s ease-in-out infinite; }
#btn-build.tour-spot { border-radius: 10px; }
@keyframes spotPulse { 50% { outline-offset: 6px; box-shadow: 0 0 14px rgba(94, 230, 192, .4); } }
.tour-spot-w {
  position: absolute; z-index: 5; border-radius: 50%; border: 3px dashed #fff; pointer-events: none; animation: spotRing 3.2s ease-in-out infinite;
  box-shadow: 0 0 0 2px rgba(8, 60, 60, .55), inset 0 0 0 2px rgba(8, 60, 60, .45), 0 0 18px rgba(94, 230, 192, .6);
}
@keyframes spotRing { 50% { scale: 1.025; opacity: .7; } }

/* ---------- Zellwahl (nach „Neues Spiel“) und Werte der Zelltypen ---------- */
.ct-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); gap: 12px; margin: 12px 0 4px; }
.ct-card { display: grid; grid-template-columns: 132px 1fr; gap: 10px; padding: 12px; border: 1px solid var(--panel-line); border-radius: 14px; background: rgba(255, 255, 255, .05); }
.ct-card.sel { border-color: var(--accent); background: rgba(94, 230, 192, .08); }
.ct-prev { display: grid; place-items: start center; }
.mini.sm { width: 128px; height: 140px; margin: 0; }
.mini.sm .cell-body { scale: .37; }
.ct-body h3 { margin: 0 0 2px; font-size: 17px; }
.ct-tag { margin: 0 0 4px; font-size: 13px; color: var(--ink-dim); }
.fx { list-style: none; margin: 6px 0 2px; padding: 0; display: grid; gap: 3px; font-size: 13.5px; }
.fx li::before { content: "▲"; margin-right: 7px; color: var(--good); }
.fx li.bad::before { content: "▼"; color: var(--bad); }
.fx li.none::before { content: "•"; color: var(--ink-dim); }
.fx .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ct-act { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 8px; }
@media (max-width: 480px) { .ct-card { grid-template-columns: 84px 1fr; } .mini.sm { width: 84px; height: 96px; } .mini.sm .cell-body { scale: .24; } }
