/* Gemeinsames Gerüst aller Konzepte – Look kommt aus der jeweiligen Seite. */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100dvh;
  background: var(--page);
  color: var(--page-ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { opacity: 0.38; cursor: default; }
:focus-visible { outline: 2px solid var(--focus, currentColor); outline-offset: 2px; }

.shell {
  max-width: 1080px; margin: 0 auto;
  padding-block: 20px 12px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between;
}
.shell-home { color: inherit; text-decoration: none; font-weight: 600; display: inline-flex; align-items: center; min-height: 40px; }
.concepts { display: flex; flex-wrap: wrap; gap: 6px; }
.concepts a {
  min-height: 40px; padding: 0 14px; border-radius: 999px; display: inline-flex; align-items: center;
  text-decoration: none; color: inherit; font-size: 13px; border: 1px solid var(--page-line);
}
.concepts a[aria-current] { background: var(--page-ink); color: var(--page); border-color: var(--page-ink); }

.stage {
  max-width: 1080px; margin: 0 auto;
  padding-block: 8px 48px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex; flex-wrap: wrap; gap: 40px; justify-content: center; align-items: flex-start;
}
.about { flex: 1 1 280px; max-width: 380px; min-width: 0; display: flex; flex-direction: column; gap: 14px; line-height: 1.55; font-size: 15px; }
.about h1 { margin: 0; font-size: 34px; line-height: 1.1; text-wrap: balance; }
.about p { margin: 0; }
.about ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.about .hint { font-size: 13px; opacity: 0.8; }

.phone {
  flex: none; width: 390px; height: 844px; max-width: 100%;
  border-radius: 44px; overflow: hidden; position: relative;
  display: flex; flex-direction: column;
  background: var(--bg); color: var(--ink);
}
@media (max-width: 520px) {
  .stage { padding: 0; gap: 0; flex-direction: column-reverse; }
  .phone { width: 100%; height: 100dvh; border-radius: 0; }
  .about { padding: 24px max(16px, env(safe-area-inset-left, 0px)) 40px; max-width: none; }
}

.view { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; overflow-x: hidden; scrollbar-width: none; }
.view::-webkit-scrollbar { display: none; }
[hidden] { display: none !important; }
.arena { position: relative; flex: none; height: var(--arena-h, 330px); overflow: hidden; }
.arena canvas { display: block; }
#overlay {
  position: absolute; left: 50%; top: 14px; transform: translate(-50%, -8px);
  opacity: 0; transition: opacity 0.25s, transform 0.25s; pointer-events: none; white-space: nowrap;
}
#overlay.show { opacity: 1; transform: translate(-50%, 0); }

.up { display: flex; align-items: center; gap: 12px; }
.up-txt { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 8px; row-gap: 2px; }
.up-v { flex-basis: 100%; }
.up-v em { font-style: normal; }
.up-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; min-width: 84px; font-variant-numeric: tabular-nums; }
.coin { display: inline-block; width: 8px; height: 8px; flex: none; }

.ed-wrap { width: 100%; max-width: 358px; aspect-ratio: 1; margin: 0 auto; }
.ed-wrap canvas { display: block; cursor: crosshair; }
.pal { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 56px; }
.pal-ic { width: 16px; height: 16px; }
.pal-ic svg, .shp svg, .info-ic svg, .beast-ic svg { width: 100%; height: 100%; display: block; }
#shapes { display: flex; flex-wrap: wrap; gap: 4px; }
.shp { width: 44px; height: 44px; padding: 11px; display: inline-flex; align-items: center; justify-content: center; }
#swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.sw { width: 32px; height: 32px; background: var(--c); padding: 0; }
#info { display: flex; align-items: center; gap: 12px; min-height: 64px; }
.info-ic { width: 28px; height: 28px; flex: none; }
.info-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

#bestiary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.beast { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 6px; text-align: center; font-size: 12px; }
.beast b { font-size: 13px; }
.beast-ic { width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; font-weight: 700; }
#research { display: flex; flex-direction: column; gap: 10px; }
.res { display: flex; flex-direction: column; gap: 6px; padding: 14px; }
.res-top { display: flex; justify-content: space-between; gap: 8px; }
.res-t { font-variant-numeric: tabular-nums; }
.res-bar { height: 4px; }
.res-bar i { display: block; height: 100%; }

.tabs { display: flex; flex: none; }
.tabs button { flex: 1; min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; background: none; border: 0; font-size: 11px; }
.tabs svg { width: 22px; height: 22px; }
@media (prefers-reduced-motion: reduce) { #overlay { transition: none; } }

/* ---------- Basis & Run (gemeinsame Bausteine, Farben kommen aus den Seiten-Variablen) ---------- */
.mode { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.menu-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 22px 16px 10px; }
.menu-head .menu-title { display: block; font-size: 26px; line-height: 1.1; }
.mpage { padding: 4px 16px 20px; display: flex; flex-direction: column; gap: 10px; }
.mnote { margin: 0; font-size: 13px; color: var(--muted); }
.presets { display: flex; gap: 4px; padding: 4px; border-radius: calc(var(--radius) + 4px); background: var(--surface); align-self: flex-start; }
.presets button { min-height: 36px; padding: 0 12px; border: 0; border-radius: var(--radius); background: transparent; color: var(--muted); font-size: 13px; }
.presets button.on { background: var(--accent); color: var(--accent-ink); }

#levels { display: flex; flex-direction: column; gap: 8px; }
.lvl { padding: 12px 12px 12px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.lvl.locked { background: transparent; border-style: dashed; color: var(--muted); }
.lvl-top { display: flex; align-items: center; gap: 12px; }
.lvl-no { width: 34px; height: 34px; flex: none; display: flex; align-items: center; justify-content: center; border-radius: var(--radius); background: var(--surface-2); font-weight: 700; font-variant-numeric: tabular-nums; }
.lvl-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.lvl-txt b { font-size: 15px; }
.lvl-icons { display: flex; gap: 6px; }
.lvl-ic { width: 14px; height: 14px; display: inline-block; }
.lvl-ic svg { width: 100%; height: 100%; display: block; }
.lvl-btn { min-width: 72px; min-height: 44px; border: 0; border-radius: var(--radius); background: var(--accent); color: var(--accent-ink); font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.lvl-btn:disabled { background: var(--surface-2); color: var(--muted); opacity: 1; }
.lvl-mile { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.lvl-mile i { height: 5px; border-radius: 3px; background: var(--surface-2); }
.lvl-mile i.on { background: var(--accent); }
.lvl-meta { display: flex; justify-content: space-between; gap: 10px; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.lvl-meta b { color: var(--ink); }
.lvl-meta span:last-child { text-align: right; }

#perktabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
#perktabs::-webkit-scrollbar { display: none; }
.ptab { flex: none; min-height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); font-size: 13px; }
.ptab.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
#perks { display: flex; flex-direction: column; }
.perk { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.perk-txt { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 8px; row-gap: 2px; }
.perk-n { font-size: 15px; }
.perk-lv { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.perk-v { flex-basis: 100%; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.perk-v em { font-style: normal; color: var(--ink); }
.perk-btn { min-width: 84px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--accent); border-radius: var(--radius); background: transparent; font-family: var(--mono); font-size: 13px; }

.runbar { flex: none; display: flex; align-items: center; gap: 10px; padding: 10px 16px 16px; border-top: 1px solid var(--line); background: var(--surface); }
.runinfo { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 12px; color: var(--muted); }
.runinfo b { color: var(--ink); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#endrun { min-height: 44px; padding: 0 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); font-size: 14px; }
#endrun[data-sure] { border-color: var(--accent); color: var(--accent); }
#summary { position: absolute; inset: 0; z-index: 6; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(4px); }
.sum-card { width: 100%; max-width: 320px; padding: 22px; border-radius: calc(var(--radius) + 6px); background: var(--bg); color: var(--ink); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 14px; }
.sum-card h3 { margin: 0; font-size: 32px; line-height: 1; }
.sum-rows { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 13px; }
.sum-rows span { color: var(--muted); }
.sum-rows b { text-align: right; font-variant-numeric: tabular-nums; }
.sum-miles { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: var(--radius); background: var(--surface); font-size: 12px; }
.sum-miles span::before { content: "★ "; color: var(--accent); }
.sum-btn { min-height: 48px; border: 0; border-radius: var(--radius); background: var(--accent); color: var(--accent-ink); font-weight: 700; }

#palette { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.pal.locked, .shp.locked { opacity: 0.55; }
.pal.locked .pal-c { font-size: 9px; }

/* ---------- Basis-Startseite: Turm als Schaustück ---------- */
.home { flex: 1; display: flex; flex-direction: column; gap: 12px; padding: 0 16px 16px; }
.showbox { position: relative; flex: 1 1 300px; min-height: 270px; border-radius: calc(var(--radius) + 8px); background: var(--surface); overflow: hidden; }
.showbox canvas { position: absolute; inset: 0; display: block; }
.show-stats { position: absolute; left: 10px; right: 10px; bottom: 10px; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.show-stats span { padding: 6px 10px; border-radius: 999px; background: var(--bg); font-family: var(--mono); font-size: 11px; color: var(--muted); }
.show-stats b { color: var(--ink); font-weight: 600; }
.picker { display: flex; align-items: center; gap: 8px; }
.pick-arrow { width: 44px; height: 56px; flex: none; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); display: flex; align-items: center; justify-content: center; }
.pick-arrow svg { width: 20px; height: 20px; }
.pick-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.pick-mid b { font-size: 19px; line-height: 1.2; }
.pick-icons { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; }
.lvl-boss { margin-left: 4px; font-family: var(--mono); font-size: 10px; color: var(--muted); }
.pick-meta { display: flex; flex-direction: column; align-items: center; gap: 2px; font-family: var(--mono); font-size: 11px; color: var(--muted); text-align: center; }
.pick-meta b { color: var(--ink); }
.start-btn { min-height: 56px; border: 0; border-radius: var(--radius); background: var(--accent); color: var(--accent-ink); font-size: 17px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 8px; }
.start-btn:disabled { background: var(--surface-2); color: var(--muted); opacity: 1; }
.about .presets { margin-top: 4px; }


/* ================= App: Vollbild statt Handy-Rahmen ================= */
html, body { height: 100%; overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
body { background: var(--bg); display: block; }
.phone { width: 100%; max-width: 600px; height: 100dvh; margin: 0 auto; border-radius: 0; box-shadow: none; }
