/* HomeOS – Design-Tokens (aus design/tokens.json) */
:root {
  --font: -apple-system, system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 22px;
  --fast: 160ms; --base: 300ms; --spring: cubic-bezier(.32,.72,0,1);
  --icon: 62px;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);

  --bg: #F1F2F6; --surface: #FFFFFF; --surface-2: #E7E8ED; --border: #D3D4DA;
  --border-input: #8E8F98; --text: #111114; --text-muted: #5F606A;
  --accent: #2B5FE8; --accent-text: #2557D6; --on-accent: #FFFFFF;
  --accent-soft: rgba(43,95,232,.12);
  --danger: #C92A1E; --success: #18794A; --warning: #9A5B00;
  --glass: rgba(255,255,255,.62); --glass-strong: rgba(246,246,249,.82);
  --scrim: rgba(0,0,0,.28); --term-bg: #F7F7F9;
  --wall-dim: 0;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000; --surface: #1C1C1F; --surface-2: #2A2A2F; --border: #3A3A40;
    --border-input: #7D7E88; --text: #F4F4F6; --text-muted: #A3A4AD;
    --accent: #2F63EC; --accent-text: #7FA6FF; --on-accent: #FFFFFF; --accent-soft: rgba(127,166,255,.16);
    --danger: #FF6B5E; --success: #4CD38A; --warning: #F5B544;
    --glass: rgba(28,28,31,.62); --glass-strong: rgba(30,30,34,.84);
    --scrim: rgba(0,0,0,.5); --term-bg: #0B0B0D; --wall-dim: .35;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #000000; --surface: #1C1C1F; --surface-2: #2A2A2F; --border: #3A3A40;
  --border-input: #7D7E88; --text: #F4F4F6; --text-muted: #A3A4AD;
  --accent: #2F63EC; --accent-text: #7FA6FF; --on-accent: #FFFFFF; --accent-soft: rgba(127,166,255,.16);
  --danger: #FF6B5E; --success: #4CD38A; --warning: #F5B544;
  --glass: rgba(28,28,31,.62); --glass-strong: rgba(30,30,34,.84);
  --scrim: rgba(0,0,0,.5); --term-bg: #0B0B0D; --wall-dim: .35;
  color-scheme: dark;
}
@media (min-width: 768px) { :root { --icon: 74px; } }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #000; }
body { font: 400 16px/1.375 var(--font); color: var(--text); -webkit-font-smoothing: antialiased; overscroll-behavior: none; }
#root { position: fixed; inset: 0; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: var(--text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Hintergrundbilder (eigene Verläufe) ---------- */
.wall { position: absolute; inset: 0; background-color: #0b1030; }
.wall::after { content: ""; position: absolute; inset: 0; background: #000; opacity: var(--wall-dim); pointer-events: none; }
.wall-aurora { background:
  radial-gradient(60% 50% at 15% 20%, #6d4cff 0%, transparent 70%),
  radial-gradient(55% 45% at 85% 30%, #00b3c7 0%, transparent 70%),
  radial-gradient(70% 60% at 50% 95%, #ff4f9a 0%, transparent 70%), #0e1240; }
.wall-dusk { background:
  radial-gradient(70% 55% at 20% 10%, #ffb86b 0%, transparent 70%),
  radial-gradient(60% 50% at 90% 50%, #ff5c8a 0%, transparent 70%),
  radial-gradient(80% 60% at 30% 100%, #5b3df5 0%, transparent 70%), #3a1c5c; }
.wall-lagoon { background:
  radial-gradient(60% 50% at 80% 10%, #6ee7f9 0%, transparent 70%),
  radial-gradient(70% 60% at 10% 60%, #2563eb 0%, transparent 70%),
  radial-gradient(60% 50% at 80% 100%, #10b981 0%, transparent 70%), #082f49; }
.wall-ember { background:
  radial-gradient(60% 50% at 20% 20%, #ff7a18 0%, transparent 70%),
  radial-gradient(60% 50% at 85% 75%, #e11d48 0%, transparent 70%),
  radial-gradient(50% 40% at 70% 15%, #facc15 0%, transparent 70%), #2a0a0a; }
.wall-meadow { background:
  radial-gradient(60% 50% at 25% 15%, #a3e635 0%, transparent 70%),
  radial-gradient(60% 55% at 85% 60%, #14b8a6 0%, transparent 70%),
  radial-gradient(60% 50% at 20% 100%, #facc15 0%, transparent 70%), #0d3b2e; }
.wall-mono { background:
  radial-gradient(60% 50% at 20% 20%, #4b5563 0%, transparent 70%),
  radial-gradient(60% 50% at 80% 80%, #1f2937 0%, transparent 70%), #0a0a0b; }

/* ---------- Statusleiste ---------- */
.statusbar { position: absolute; top: 0; left: 0; right: 0; height: calc(44px + var(--safe-t)); padding: var(--safe-t) 26px 0;
  display: flex; align-items: center; justify-content: space-between; color: #fff; font-weight: 600; font-size: 16px; z-index: 5;
  text-shadow: 0 1px 2px rgba(0,0,0,.25); pointer-events: none; }
.statusbar .si { display: flex; gap: 6px; align-items: center; }
.statusbar svg { display: block; }

/* ---------- Sperrbildschirm / Login ---------- */
.lock { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; overflow-y: auto; color: #fff; }
.lock-time { margin-top: calc(70px + var(--safe-t)); text-align: center; text-shadow: 0 2px 12px rgba(0,0,0,.2); position: relative; }
.lock-date { font-size: 20px; font-weight: 600; opacity: .92; }
.lock-clock { font-size: 88px; line-height: 1; font-weight: 600; letter-spacing: -2px; font-variant-numeric: tabular-nums; }
.lock-card { position: relative; margin: 40px 16px calc(40px + var(--safe-b)); width: min(380px, calc(100% - 32px));
  background: rgba(255,255,255,.16); backdrop-filter: blur(28px) saturate(160%); -webkit-backdrop-filter: blur(28px) saturate(160%);
  border: 1px solid rgba(255,255,255,.22); border-radius: 28px; padding: 24px 20px 20px; }
.lock-card h1 { font-size: 22px; margin: 0 0 4px; text-align: center; }
.lock-card p.sub { margin: 0 0 18px; text-align: center; opacity: .85; font-size: 15px; }
.lock-card .field { width: 100%; height: 50px; border-radius: 14px; border: 1px solid rgba(255,255,255,.28);
  background: rgba(0,0,0,.22); color: #fff; padding: 0 16px; margin-bottom: 10px; font-size: 17px; outline: none; }
.lock-card .field::placeholder { color: rgba(255,255,255,.72); }
.lock-card .field:focus { border-color: #fff; }
.lock-card .btn-primary { width: 100%; height: 50px; border-radius: 14px; font-size: 17px; margin-top: 6px; }
.lock-faceid { width: 100%; height: 50px; border-radius: 14px; margin-top: 10px; display: flex; align-items: center; justify-content: center; gap: 10px;
  background: rgba(255,255,255,.92); color: #111; font-weight: 600; font-size: 17px; }
.lock-faceid:active { opacity: .7; }
.lock-switch { display: block; margin: 16px auto 0; color: #fff; font-size: 15px; text-decoration: underline; text-underline-offset: 3px; opacity: .92; }
.lock-err { background: rgba(201,42,30,.9); color: #fff; border-radius: 12px; padding: 10px 12px; font-size: 15px; margin-bottom: 12px; }
.shake { animation: shake .4s; }
@keyframes shake { 20%,60% { transform: translateX(-10px); } 40%,80% { transform: translateX(10px); } }

/* ---------- Home-Bildschirm ---------- */
.home { position: absolute; inset: 0; overflow: hidden; }
.pages { position: absolute; top: calc(44px + var(--safe-t)); bottom: calc(118px + var(--safe-b)); left: 0; right: 0;
  display: flex; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; scrollbar-width: none; }
.pages::-webkit-scrollbar { display: none; }
.page { flex: 0 0 100%; scroll-snap-align: center; padding: 18px max(16px, calc((100% - 860px) / 2)) 0; }
.grid { display: grid; grid-template-columns: repeat(var(--cols, 4), 1fr); row-gap: 22px; justify-items: center; align-content: start; }
.dots { position: absolute; left: 0; right: 0; bottom: calc(104px + var(--safe-b)); display: flex; justify-content: center; gap: 8px; }
.dots button { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.4); }
.dots button[aria-current="true"] { background: #fff; }

.widget { grid-column: 1 / -1; width: 100%; min-height: 158px; border-radius: 24px; padding: 18px 20px; color: #fff;
  background: rgba(255,255,255,.18); backdrop-filter: blur(24px) saturate(160%); -webkit-backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid rgba(255,255,255,.2); display: flex; flex-direction: column; justify-content: space-between; }
.widget .w-top { display: flex; justify-content: space-between; align-items: baseline; }
.widget .w-day { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; opacity: .85; }
.widget .w-hello { font-size: 24px; font-weight: 700; margin-top: 2px; }
.widget .w-meta { font-size: 15px; opacity: .9; }
.widget .w-btn { align-self: flex-start; margin-top: 12px; padding: 9px 16px; border-radius: 999px; background: rgba(255,255,255,.92); color: #111; font-weight: 600; font-size: 15px; }

.icon-btn { width: calc(var(--icon) + 22px); display: flex; flex-direction: column; align-items: center; gap: 6px; border-radius: 16px; touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.icon-btn:active .appicon { transform: scale(.9); filter: brightness(.85); }
.appicon { width: var(--icon); height: var(--icon); border-radius: 22.5%; display: grid; place-items: center; position: relative; overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,.18), 0 6px 14px rgba(0,0,0,.14); transition: transform var(--fast) ease, filter var(--fast); font-size: calc(var(--icon) * .56); line-height: 1; }
.appicon::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 .5px rgba(255,255,255,.25); background: linear-gradient(180deg, rgba(255,255,255,.18), transparent 45%); pointer-events: none; }
.appicon svg { width: 62%; height: 62%; }
.icon-label { color: #fff; font-size: 12px; font-weight: 500; line-height: 15px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-shadow: 0 1px 3px rgba(0,0,0,.45); }
.c-blue { background: linear-gradient(160deg, #4f8bff, #1d4ed8); }
.c-indigo { background: linear-gradient(160deg, #7c83ff, #3f37c9); }
.c-purple { background: linear-gradient(160deg, #b57bff, #6d28d9); }
.c-pink { background: linear-gradient(160deg, #ff7eb6, #db2777); }
.c-red { background: linear-gradient(160deg, #ff7a6b, #c81e1e); }
.c-orange { background: linear-gradient(160deg, #ffb057, #ea580c); }
.c-yellow { background: linear-gradient(160deg, #ffe066, #eab308); }
.c-green { background: linear-gradient(160deg, #5be38a, #15803d); }
.c-teal { background: linear-gradient(160deg, #4fe0d2, #0e7490); }
.c-graphite { background: linear-gradient(160deg, #9ca3af, #374151); }
.c-store { background: linear-gradient(145deg, #2b5fe8 0%, #7b4dff 70%, #b54cd4 100%); }
.c-settings { background: linear-gradient(160deg, #8b8d98, #3b3d46); }
.c-white { background: #fff; }

.dock { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(14px + var(--safe-b)); padding: 14px 16px; border-radius: 32px;
  display: flex; gap: 22px; background: rgba(255,255,255,.2); backdrop-filter: blur(30px) saturate(170%); -webkit-backdrop-filter: blur(30px) saturate(170%);
  border: 1px solid rgba(255,255,255,.18); }
.dock .icon-btn { width: auto; }
.dock .icon-label { display: none; }

/* Kontextmenü (Langdruck) */
.ctx-scrim { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.25); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); animation: fade var(--fast); }
.ctx-icon { position: fixed; z-index: 61; pointer-events: none; }
.ctx-menu { position: fixed; z-index: 62; width: 250px; border-radius: 14px; overflow: hidden; background: var(--glass-strong);
  backdrop-filter: blur(30px) saturate(170%); -webkit-backdrop-filter: blur(30px) saturate(170%); box-shadow: 0 12px 40px rgba(0,0,0,.3); animation: pop var(--base) var(--spring); }
.ctx-menu button { display: flex; width: 100%; justify-content: space-between; align-items: center; padding: 12px 16px; font-size: 17px; color: var(--text); border-top: .5px solid var(--border); text-align: left; }
.ctx-menu button:first-child { border-top: 0; }
.ctx-menu button:active { background: var(--surface-2); }
.ctx-menu button.danger { color: var(--danger); }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

/* ---------- App-Fenster ---------- */
.window { position: absolute; inset: 0; z-index: 20; background: var(--bg); overflow: hidden; display: flex; flex-direction: column;
  transform-origin: 0 0; will-change: transform; }
.window.anim { transition: transform var(--base) var(--spring), border-radius var(--base) var(--spring), opacity var(--base); }
.window.user { padding: var(--safe-t) 0 var(--safe-b); }
.window.user .term-in { padding-bottom: 12px; }
/* Runder Home-Knopf */
.home-fab { position: absolute; z-index: 40; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; color: #fff;
  background: rgba(28,28,32,.58); backdrop-filter: blur(18px) saturate(160%); -webkit-backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid rgba(255,255,255,.28); box-shadow: 0 4px 18px rgba(0,0,0,.28); opacity: .82; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  transition: left var(--base) var(--spring), top var(--base) var(--spring), opacity var(--fast), transform var(--fast); }
.home-fab svg { width: 22px; height: 22px; }
.home-fab:hover, .home-fab:focus-visible { opacity: 1; }
.home-fab.active { transform: scale(.9); opacity: 1; }
.home-fab.dragging { transition: none; opacity: 1; transform: scale(1.08); }
/* ZIP-Auswahl */
.zip-row { display: flex; align-items: center; gap: 12px; }
.zip-ico { font-size: 30px; }
.zip-info { flex: 1; min-width: 0; color: var(--text-muted); font-size: 15px; }
.zip-info b { display: block; color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zip-info small { font-size: 13px; }
.progress { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; margin-top: 12px; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }

/* Navigation */
.navstack { position: relative; flex: 1; overflow: hidden; }
.navpage { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--bg); transition: transform var(--base) var(--spring); }
.navpage.below { transform: translateX(-28%); }
.navpage.enter { transform: translateX(100%); }
.navbar { flex: 0 0 auto; padding-top: var(--safe-t); background: var(--glass-strong); backdrop-filter: blur(24px) saturate(170%); -webkit-backdrop-filter: blur(24px) saturate(170%);
  border-bottom: .5px solid var(--border); position: relative; z-index: 2; }
.navbar-row { height: 48px; display: grid; grid-template-columns: minmax(0,1fr) auto minmax(0,1fr); align-items: center; padding: 0 8px; }
.navbar-title { padding: 0 6px; font-size: 17px; font-weight: 600; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw; }
.nav-left { justify-self: start; display: flex; min-width: 0; max-width: 100%; }
.nav-left .nav-btn { min-width: 0; overflow: hidden; text-overflow: ellipsis; } .nav-right { justify-self: end; display: flex; gap: 4px; }
.nav-btn { display: inline-flex; align-items: center; gap: 2px; height: 40px; padding: 0 8px; color: var(--accent-text); font-size: 17px; border-radius: 10px; white-space: nowrap; }
.nav-btn:active { opacity: .5; }
.nav-btn svg { width: 22px; height: 22px; }
.nav-btn.strong { font-weight: 600; }
.content { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0 16px calc(40px + var(--safe-b)); }
.content.flush { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.wrap { max-width: 720px; margin: 0 auto; }
.large-title { font-size: 34px; line-height: 41px; font-weight: 700; margin: 14px 0 12px; letter-spacing: -.4px; }
.section-title { font-size: 13px; text-transform: uppercase; color: var(--text-muted); margin: 26px 16px 7px; letter-spacing: .2px; }
.section-foot { font-size: 13px; color: var(--text-muted); margin: 7px 16px 0; }

/* Tab-Leiste (App Store) */
.tabbar { flex: 0 0 auto; display: flex; justify-content: center; gap: 12px; padding: 6px 0 calc(22px + var(--safe-b)); background: var(--glass-strong);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); border-top: .5px solid var(--border); }
.tabbar button { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 110px; font-size: 11px; font-weight: 500; color: var(--text-muted); padding-top: 4px; }
.tabbar button svg { width: 26px; height: 26px; }
.tabbar button[aria-selected="true"] { color: var(--accent-text); }

/* Gruppierte Listen */
.list { background: var(--surface); border-radius: var(--r-lg); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 16px; width: 100%; text-align: left; position: relative; color: var(--text); }
.row + .row::before { content: ""; position: absolute; top: 0; right: 0; left: 16px; border-top: .5px solid var(--border); }
.row.has-icon + .row::before, .row.has-icon + .row.has-icon::before { left: 57px; }
button.row:active { background: var(--surface-2); }
.row .ri { width: 29px; height: 29px; border-radius: 7px; display: grid; place-items: center; color: #fff; flex: 0 0 auto; font-size: 17px; }
.row .ri svg { width: 18px; height: 18px; }
.row .rt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.row.has-icon .rt { white-space: nowrap; }
.row .rt small { display: block; color: var(--text-muted); font-size: 13px; line-height: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .rv { color: var(--text-muted); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 50%; }
.row .chev { color: var(--text-muted); opacity: .6; width: 14px; height: 14px; flex: 0 0 auto; }
.row.danger, .row.danger .rt { color: var(--danger); justify-content: center; }
.row.accent .rt { color: var(--accent-text); }

/* Formular */
.input, .select, .textarea { width: 100%; min-height: 44px; border-radius: var(--r-md); border: 1px solid transparent; background: var(--surface-2); padding: 10px 14px; font-size: 17px; outline: none; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); }
.select { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px; }
.label { display: block; font-size: 13px; color: var(--text-muted); margin: 14px 4px 6px; }
.form-card { background: var(--surface); border-radius: var(--r-lg); padding: 16px; }
.hint { font-size: 13px; color: var(--text-muted); margin: 6px 4px 0; }
.hint.warn { color: var(--warning); }
.hint.ok { color: var(--success); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 18px; border-radius: var(--r-md); font-weight: 600; font-size: 17px; transition: opacity var(--fast); }
.btn:active { opacity: .7; }
.btn:disabled { opacity: .4; pointer-events: none; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-tinted { background: var(--accent-soft); color: var(--accent-text); }
.btn-plain { color: var(--accent-text); }
.btn-danger { background: rgba(201,42,30,.12); color: var(--danger); }
.btn-sm { height: 32px; padding: 0 14px; font-size: 15px; border-radius: 999px; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 10px; margin-top: 16px; }
.btn-row .btn { flex: 1; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.segmented { display: flex; background: var(--surface-2); border-radius: 10px; padding: 2px; gap: 2px; }
.segmented button { flex: 1; height: 32px; border-radius: 8px; font-size: 14px; font-weight: 500; }
.segmented button[aria-pressed="true"] { background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.14); font-weight: 600; }

/* Icon-Editor */
.icon-editor { display: flex; gap: 16px; align-items: center; }
.icon-editor .appicon { --icon: 86px; flex: 0 0 auto; }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 4px; margin-top: 8px; max-height: 148px; overflow-y: auto; padding: 2px; }
.emoji-grid button { height: 42px; border-radius: 10px; font-size: 26px; line-height: 1; }
.emoji-grid button[aria-pressed="true"] { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.swatches button { width: 32px; height: 32px; border-radius: 50%; }
.swatches button[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }

/* Code-Editor */
.editor { display: flex; border-radius: var(--r-md); background: var(--term-bg); border: 1px solid var(--border); overflow: hidden; height: 320px; }
.editor:focus-within { border-color: var(--accent); }
.editor.tall { height: 52vh; }
.gutter { flex: 0 0 auto; padding: 12px 8px 12px 10px; text-align: right; color: var(--text-muted); font: 12px/20px var(--mono); overflow: hidden; user-select: none; opacity: .7; white-space: pre; }
.editor textarea { flex: 1; border: 0; outline: none; resize: none; background: transparent; padding: 12px 12px 12px 6px; font: 13px/20px var(--mono); white-space: pre; overflow: auto; tab-size: 2; color: var(--text); }
.editor-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* Terminal */
.term { flex: 1; display: flex; flex-direction: column; min-height: 0; background: var(--term-bg); }
.term-head { display: flex; align-items: center; gap: 8px; padding: 10px 16px; font-size: 13px; color: var(--text-muted); border-bottom: .5px solid var(--border); }
.term-out { flex: 1; overflow: auto; margin: 0; padding: 14px 16px; font: 13px/20px var(--mono); white-space: pre-wrap; word-break: break-word; color: var(--text); }
.term-out .err { color: var(--danger); }
.term-out .sys { color: var(--text-muted); }
.term-in { display: flex; gap: 8px; padding: 10px 12px calc(28px + var(--safe-b)); border-top: .5px solid var(--border); background: var(--surface); align-items: flex-end; }
.term-in textarea { flex: 1; min-height: 40px; max-height: 120px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); padding: 9px 12px; font: 13px/20px var(--mono); resize: vertical; outline: none; }
.app-frame { flex: 1; width: 100%; border: 0; background: #fff; display: block; }

/* App-Detail */
.app-hero { display: flex; gap: 16px; align-items: center; padding: 18px 0 6px; }
.app-hero .appicon { --icon: 96px; }
.app-hero h2 { margin: 0; font-size: 22px; line-height: 28px; }
.app-hero p { margin: 2px 0 10px; color: var(--text-muted); font-size: 15px; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--text-muted); }
.badge.srv { background: var(--accent-soft); color: var(--accent-text); }

.empty { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty .big { font-size: 54px; }
.empty h3 { color: var(--text); margin: 8px 0 4px; }

/* Profilkarte (Einstellungen) */
.profile { display: flex; align-items: center; gap: 14px; padding: 14px 16px; }
.avatar { width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 24px; font-weight: 600; background: linear-gradient(160deg, #9ca3af, #4b5563); flex: 0 0 auto; }
.profile b { font-size: 20px; font-weight: 600; display: block; }
.profile small { color: var(--text-muted); font-size: 14px; }
.walls { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 14px 16px; }
.walls button { aspect-ratio: 9/16; border-radius: 14px; position: relative; overflow: hidden; max-height: 180px; }
.walls button .wall { border-radius: inherit; }
.walls button[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.walls button span { position: absolute; left: 0; right: 0; bottom: 6px; color: #fff; font-size: 12px; font-weight: 600; text-shadow: 0 1px 3px rgba(0,0,0,.5); }
.pad { padding: 12px 16px; }

/* Sheet & Toast */
.sheet-scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 80; display: flex; align-items: flex-end; justify-content: center; animation: fade var(--fast); }
.sheet { width: 100%; max-width: 560px; max-height: 92%; background: var(--bg); border-radius: 22px 22px 0 0; display: flex; flex-direction: column; overflow: hidden;
  animation: up var(--base) var(--spring); box-shadow: 0 -8px 40px rgba(0,0,0,.25); }
@media (min-width: 700px) { .sheet-scrim { align-items: center; } .sheet { border-radius: 22px; } }
@keyframes up { from { transform: translateY(100%); } }
.sheet .navbar { padding-top: 0; }
.sheet .content { padding-bottom: calc(24px + var(--safe-b)); }
.toast { position: fixed; top: calc(12px + var(--safe-t)); left: 50%; transform: translateX(-50%); z-index: 100; padding: 11px 18px; border-radius: 999px;
  background: var(--glass-strong); color: var(--text); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); box-shadow: 0 8px 30px rgba(0,0,0,.2);
  font-size: 15px; font-weight: 600; display: flex; gap: 8px; align-items: center; width: max-content; animation: drop var(--base) var(--spring); max-width: calc(100% - 32px); }
.toast.err { color: var(--danger); }
@keyframes drop { from { transform: translate(-50%, -120%); } }
.boot { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* Alert-Dialog */
.alert-scrim { position: fixed; inset: 0; z-index: 90; background: var(--scrim); display: grid; place-items: center; animation: fade var(--fast); padding: 20px; }
.alert { width: min(300px, 100%); border-radius: 16px; overflow: hidden; background: var(--glass-strong); backdrop-filter: blur(30px) saturate(170%); -webkit-backdrop-filter: blur(30px) saturate(170%);
  text-align: center; animation: pop var(--base) var(--spring); box-shadow: 0 12px 40px rgba(0,0,0,.3); }
.alert .a-body { padding: 20px 18px 16px; }
.alert h3 { margin: 0 0 4px; font-size: 17px; }
.alert p { margin: 0; font-size: 14px; color: var(--text); opacity: .85; }
.alert .a-btns { display: flex; border-top: .5px solid var(--border); }
.alert .a-btns.stack { flex-direction: column; }
.alert .a-btns button { flex: 1; height: 46px; font-size: 17px; color: var(--accent-text); }
.alert .a-btns:not(.stack) button + button { border-left: .5px solid var(--border); }
.alert .a-btns.stack button + button { border-top: .5px solid var(--border); }
.alert .a-btns button.bold { font-weight: 600; }
.alert .a-btns button.danger { color: var(--danger); }
.alert .a-btns button:active { background: var(--surface-2); }
.mini-icon { --icon: 44px; }
.mini-icon .appicon { border-radius: 10px; }
[hidden] { display: none !important; }
