/* ============================================================
   Codestudio – Oberfläche
   ============================================================ */

:root {
    --bg:          #0a0a0a;
    --bg-elev:     #111111;
    --bg-elev-2:   #171717;
    --line:        #262626;
    --line-soft:   #1c1c1c;
    --text:        #fafafa;
    --text-dim:    #a3a3a3;
    --text-faint:  #6b6b6b;
    --accent:      #60a5fa;
    --accent-2:    #3b82f6;
    --amber:       #fbbf24;
    --green:       #4ade80;
    --red:         #f87171;
    --purple:      #c084fc;
    --topbar-h:    40px;
    --status-h:    22px;
    --dock-h:      54px;
    --tab-h:       32px;
    --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;
    --ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html[data-theme="light"] {
    --bg:         #ffffff;
    --bg-elev:    #f7f7f8;
    --bg-elev-2:  #eeeef0;
    --line:       #e0e0e3;
    --line-soft:  #ebebee;
    --text:       #18181b;
    --text-dim:   #52525b;
    --text-faint: #8a8a93;
    --accent:     #2563eb;
    --accent-2:   #1d4ed8;
    --amber:      #b45309;
    --green:      #15803d;
    --red:        #b91c1c;
    --purple:     #7e22ce;
}

* { box-sizing: border-box; }

html, body {
    height: 100%;
    margin: 0;
    overscroll-behavior: none;
}

body {
    background: var(--bg);
    color: var(--text);
    font: 13px/1.5 var(--ui);
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

button, input, textarea, select {
    font: inherit;
    color: inherit;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #444; }

/* ============ Kopfleiste ============ */

.topbar {
    height: var(--topbar-h);
    flex: 0 0 var(--topbar-h);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 8px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    position: relative;
    z-index: 30;
}

.logo {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    background: none;
    border: 1.6px solid var(--text);
    border-radius: 7px;
    color: var(--text);
    cursor: pointer;
    flex: 0 0 auto;
}
.logo:hover { border-color: var(--accent); color: var(--accent); }
.logo .accent, .welcome-logo .accent { stroke: var(--accent); }

.brand {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
    font-size: 13.5px;
    font-weight: 700;
    letter-spacing: .2px;
    pointer-events: none;
    white-space: nowrap;
}

.top-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 2px;
}

.project-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 26px;
    padding: 0 8px;
    margin-right: 4px;
    max-width: 44vw;
    background: transparent;
    border: 1px solid var(--accent-2);
    border-radius: 7px;
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
}
.project-pill span { overflow: hidden; text-overflow: ellipsis; }
.project-pill:hover { background: color-mix(in srgb, var(--accent-2) 16%, transparent); }
.project-pill .chev { flex: 0 0 auto; opacity: .8; }
.project-pill[aria-expanded="true"] .chev { transform: rotate(180deg); }

.icon-btn {
    width: 30px;
    height: 28px;
    display: grid;
    place-items: center;
    background: none;
    border: 0;
    border-radius: 6px;
    color: var(--text);
    cursor: pointer;
}
.icon-btn:hover { background: var(--bg-elev-2); color: var(--accent); }
.icon-btn.on { color: var(--accent); }

/* ============ Tableiste ============ */

.tabbar {
    flex: 0 0 var(--tab-h);
    height: var(--tab-h);
    display: flex;
    align-items: stretch;
    overflow-x: auto;
    overflow-y: hidden;
    background: var(--bg-elev);
    border-bottom: 1px solid var(--line);
    scrollbar-width: none;
}
.tabbar::-webkit-scrollbar { height: 0; }

.tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0 8px 0 12px;
    max-width: 190px;
    background: none;
    border: 0;
    border-right: 1px solid var(--line);
    color: var(--text-dim);
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    flex: 0 0 auto;
}
.tab .name { overflow: hidden; text-overflow: ellipsis; }
.tab.active {
    background: var(--bg);
    color: var(--text);
    box-shadow: inset 0 2px 0 var(--accent);
}
.tab .dot { color: var(--accent); font-size: 15px; line-height: 1; }
.tab .close {
    width: 17px; height: 17px;
    display: grid; place-items: center;
    border: 0; border-radius: 4px;
    background: none; color: inherit;
    font-size: 15px; line-height: 1;
    opacity: .55; cursor: pointer;
}
.tab .close:hover { background: var(--bg-elev-2); opacity: 1; }

/* ============ Arbeitsfläche ============ */

.stage {
    flex: 1 1 auto;
    min-height: 0;
    padding-bottom: var(--kb, 0px);
    position: relative;
    display: flex;
    background: var(--bg);
}

.welcome {
    margin: auto;
    padding: 24px;
    text-align: center;
    animation: fade .3s ease;
}
.welcome-logo {
    width: 48px; height: 48px;
    margin: 0 auto 18px;
    display: grid; place-items: center;
    border: 2px solid var(--text);
    border-radius: 12px;
    color: var(--text);
}
.welcome h2 { margin: 0 0 10px; font-size: 16px; font-weight: 700; }
.welcome p { margin: 0; color: var(--text-dim); font-size: 13px; line-height: 1.55; }
.welcome-actions { margin-top: 22px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

@keyframes fade { from { opacity: 0; transform: translateY(6px); } }

/* ---- Editor ---- */

.editor {
    position: absolute;
    inset: 0;
    display: flex;
    background: var(--bg);
    overflow: hidden;
}

.gutter {
    flex: 0 0 auto;
    min-width: 42px;
    padding: 10px 8px 10px 0;
    text-align: right;
    background: var(--bg);
    color: var(--text-faint);
    font: var(--code-font, 13px/1.55 var(--mono));
    user-select: none;
    overflow: hidden;
    border-right: 1px solid var(--line-soft);
}
.gutter .ln.cur { color: var(--text); }

.code-wrap {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    overflow: auto;
}

.highlight, #code {
    margin: 0;
    padding: 10px 16px 40vh 10px;
    border: 0;
    font: var(--code-font, 13px/1.55 var(--mono));
    tab-size: 4;
    white-space: pre;
    word-wrap: normal;
    overflow-wrap: normal;
}
body.wrap .highlight, body.wrap #code { white-space: pre-wrap; word-break: break-word; }

.highlight {
    /* Absolut im Scroll-Container: scrollt mit dem Inhalt mit.
       Kein `bottom`, sonst würde die Höhe auf das Sichtfeld gekappt. */
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    color: var(--text);
    min-width: 100%;
    width: max-content;
}
body.wrap .highlight { width: 100%; }
.highlight code { font: inherit; }

#code {
    position: relative;
    display: block;
    width: 100%;
    min-height: 100%;
    background: transparent;
    color: transparent;
    caret-color: var(--accent);
    resize: none;
    outline: none;
    overflow: hidden;
}
#code::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }

/* Syntaxfarben */
.t-key { color: #c084fc; font-weight: 600; }
.t-str { color: #86efac; }
.t-num { color: #fbbf24; }
.t-com { color: #6b7280; font-style: italic; }
.t-fun { color: #60a5fa; }
.t-var { color: #f0abfc; }
.t-tag { color: #f87171; }
.t-att { color: #fbbf24; }
.t-op  { color: #94a3b8; }
.t-bool{ color: #fb923c; }

html[data-theme="light"] .t-key { color: #7e22ce; }
html[data-theme="light"] .t-str { color: #15803d; }
html[data-theme="light"] .t-num { color: #b45309; }
html[data-theme="light"] .t-com { color: #71717a; }
html[data-theme="light"] .t-fun { color: #1d4ed8; }
html[data-theme="light"] .t-var { color: #a21caf; }
html[data-theme="light"] .t-tag { color: #b91c1c; }
html[data-theme="light"] .t-att { color: #a16207; }
html[data-theme="light"] .t-op  { color: #475569; }
html[data-theme="light"] .t-bool{ color: #c2410c; }

.binary-note { margin: auto; text-align: center; color: var(--text-dim); }
.binary-note .btn { margin-top: 14px; }

/* ============ Statusleiste ============ */

.statusbar {
    flex: 0 0 var(--status-h);
    height: var(--status-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    background: var(--bg);
    border-top: 1px solid var(--line-soft);
    font-size: 11px;
    color: var(--text-dim);
}
.status-left, .status-right { display: flex; align-items: center; gap: 10px; }
.status-left { background: none; border: 0; color: inherit; font: inherit; gap: 6px; cursor: pointer; padding: 0; }
.status-left:hover, .status-right button:hover { color: var(--accent); }
.status-right button { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; padding: 0; }
.status-dirty { color: var(--accent); font-size: 13px; }

/* ============ Untere Navigation ============ */

.dock {
    flex: 0 0 auto;
    height: calc(var(--dock-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    background: var(--bg);
    border-top: 1px solid var(--line);
    z-index: 30;
}

.dock-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: none;
    border: 0;
    color: var(--text);
    font-size: 10.5px;
    cursor: pointer;
    padding: 4px 2px;
}
.dock-item span { opacity: .92; }
.dock-item:hover { color: var(--accent); }
.dock-item.accent { color: var(--amber); }
.dock-item.active { color: var(--accent); }
.dock-item.accent.active { color: var(--amber); }

/* ============ Blätter ============ */

.scrim {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .55);
    backdrop-filter: blur(2px);
    z-index: 40;
    animation: fade .18s ease;
}

.sheet {
    position: fixed;
    left: 0; right: 0;
    bottom: calc(var(--dock-h) + env(safe-area-inset-bottom, 0px));
    max-height: min(72vh, 620px);
    display: flex;
    flex-direction: column;
    background: var(--bg-elev);
    border-top: 1px solid var(--line);
    border-radius: 14px 14px 0 0;
    box-shadow: 0 -14px 40px rgba(0, 0, 0, .5);
    z-index: 50;
    animation: slideup .22s cubic-bezier(.2, .8, .3, 1);
}
@keyframes slideup { from { transform: translateY(14px); opacity: 0; } }

@media (min-width: 900px) {
    .sheet {
        left: auto; right: 12px;
        width: 480px;
        bottom: calc(var(--dock-h) + 12px);
        border: 1px solid var(--line);
        border-radius: 12px;
    }
}

.sheet-head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 8px 10px 14px;
    border-bottom: 1px solid var(--line);
}
.sheet-head h3 { margin: 0; font-size: 13px; font-weight: 700; flex: 1 1 auto; }
.sheet-tools { display: flex; gap: 2px; }
.sheet-body { flex: 1 1 auto; overflow: auto; padding: 10px 12px 16px; -webkit-overflow-scrolling: touch; }

/* ============ Bausteine ============ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 12px;
    background: var(--accent-2);
    border: 1px solid var(--accent-2);
    border-radius: 7px;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { filter: brightness(1.12); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn.ghost:hover { background: var(--bg-elev-2); }
.btn.danger { background: transparent; border-color: var(--red); color: var(--red); }
.btn.danger:hover { background: color-mix(in srgb, var(--red) 15%, transparent); }
.btn.sm { height: 26px; padding: 0 9px; font-size: 11.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.field { display: block; margin-bottom: 10px; }
.field > span { display: block; margin-bottom: 4px; font-size: 11.5px; color: var(--text-dim); }
.input, select.input, textarea.input {
    width: 100%;
    height: 32px;
    padding: 0 10px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 7px;
    color: var(--text);
    font-size: 13px;
    outline: none;
}
textarea.input { height: auto; padding: 8px 10px; font-family: var(--mono); resize: vertical; }
.input:focus { border-color: var(--accent); }

.row { display: flex; gap: 8px; align-items: center; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1 1 auto; }
.muted { color: var(--text-dim); }
.small { font-size: 11.5px; }
.mono { font-family: var(--mono); }
.center { text-align: center; }
.empty { padding: 28px 12px; text-align: center; color: var(--text-faint); font-size: 12.5px; }

/* Listen (Dateien, Projekte, Versionen …) */

.list { list-style: none; margin: 0; padding: 0; }
.list li { border-radius: 7px; }

.entry {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 7px 8px;
    background: none;
    border: 0;
    border-radius: 7px;
    color: var(--text);
    font-size: 12.5px;
    text-align: left;
    cursor: pointer;
}
.entry:hover { background: var(--bg-elev-2); }
.entry.active { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--text); }
.entry .ico { flex: 0 0 auto; display: grid; place-items: center; width: 16px; color: var(--text-dim); }
.entry .label { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry .meta { flex: 0 0 auto; font-size: 11px; color: var(--text-faint); }
.entry .kebab { opacity: 0; }
.entry:hover .kebab, .entry:focus-within .kebab { opacity: .7; }

.tree-children { margin-left: 13px; border-left: 1px solid var(--line-soft); padding-left: 3px; }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 7px;
    background: var(--bg-elev-2);
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 10.5px;
    color: var(--text-dim);
}
.chip.ok  { color: var(--green); border-color: color-mix(in srgb, var(--green) 40%, transparent); }
.chip.bad { color: var(--red);   border-color: color-mix(in srgb, var(--red) 40%, transparent); }
.chip.pro { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 45%, transparent); }

/* Terminal */

.term {
    display: flex;
    flex-direction: column;
    height: min(56vh, 460px);
}
.term-out {
    flex: 1 1 auto;
    overflow: auto;
    padding: 10px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 8px;
    font: 12px/1.55 var(--mono);
    white-space: pre-wrap;
    word-break: break-word;
}
.term-out .cmd  { color: var(--accent); }
.term-out .err  { color: var(--red); }
.term-out .note { color: var(--text-faint); }
.term-in {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 0 10px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 8px;
}
.term-in span { color: var(--accent); font-family: var(--mono); font-size: 12px; }
.term-in input {
    flex: 1 1 auto;
    height: 34px;
    background: none;
    border: 0;
    outline: none;
    font: 12px var(--mono);
    color: var(--text);
}

/* Vorschau */

.preview-frame {
    width: 100%;
    height: min(56vh, 460px);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
}

/* Suchergebnisse */

.hit { padding: 6px 8px; border-radius: 6px; cursor: pointer; font: 11.5px/1.5 var(--mono); color: var(--text-dim); display: flex; gap: 8px; }
.hit:hover { background: var(--bg-elev-2); color: var(--text); }
.hit .no { color: var(--text-faint); min-width: 30px; text-align: right; }
.hit mark { background: color-mix(in srgb, var(--amber) 35%, transparent); color: inherit; border-radius: 2px; }

/* Toasts */

.toasts {
    position: fixed;
    left: 50%;
    bottom: calc(var(--dock-h) + 16px);
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 90;
    pointer-events: none;
    width: min(92vw, 420px);
}
.toast {
    padding: 9px 13px;
    background: var(--bg-elev-2);
    border: 1px solid var(--line);
    border-left: 3px solid var(--accent);
    border-radius: 8px;
    font-size: 12.5px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
    animation: slideup .2s ease;
}
.toast.err { border-left-color: var(--red); color: var(--red); }
.toast.ok  { border-left-color: var(--green); }

/* Menü am Projekt-Pill */

.menu {
    position: fixed;
    min-width: 220px;
    max-width: min(92vw, 320px);
    max-height: 60vh;
    overflow: auto;
    padding: 5px;
    background: var(--bg-elev);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, .55);
    z-index: 60;
    animation: fade .14s ease;
}
.menu button {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 7px 9px;
    background: none;
    border: 0;
    border-radius: 6px;
    color: var(--text);
    font-size: 12.5px;
    text-align: left;
    cursor: pointer;
}
.menu button:hover { background: var(--bg-elev-2); }
.menu button.on { color: var(--accent); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 2px; }
.menu .head { padding: 6px 9px 4px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-faint); }

/* Tabellen (Admin & Listen) */

.table { width: 100%; border-collapse: collapse; font-size: 12px; }
.table th, .table td { padding: 7px 8px; text-align: left; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
.table th { color: var(--text-faint); font-weight: 600; font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px; }
.table tr:hover td { background: var(--bg-elev-2); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.card {
    padding: 11px 12px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 9px;
}
.card .k { font-size: 10.5px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .5px; }
.card .v { font-size: 19px; font-weight: 700; margin-top: 3px; }

.bar { height: 5px; background: var(--bg-elev-2); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; background: var(--accent); }
.bar i.warn { background: var(--amber); }
.bar i.bad  { background: var(--red); }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.switch:last-child { border-bottom: 0; }
.switch .t { font-size: 12.5px; }
.switch .d { font-size: 11px; color: var(--text-faint); margin-top: 2px; }

.toggle { position: relative; width: 38px; height: 21px; flex: 0 0 auto; }
.toggle input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.toggle i { position: absolute; inset: 0; background: var(--bg-elev-2); border: 1px solid var(--line); border-radius: 999px; transition: .16s; }
.toggle i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 15px; height: 15px; background: var(--text-dim); border-radius: 50%; transition: .16s; }
.toggle input:checked + i { background: var(--accent-2); border-color: var(--accent-2); }
.toggle input:checked + i::after { transform: translateX(17px); background: #fff; }

.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.seg button { padding: 5px 10px; background: none; border: 0; color: var(--text-dim); font-size: 11.5px; cursor: pointer; }
.seg button.on { background: var(--accent-2); color: #fff; }

.tabs-row { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.tabs-row button { flex: 0 0 auto; padding: 5px 10px; background: none; border: 1px solid transparent; border-radius: 6px; color: var(--text-dim); font-size: 12px; cursor: pointer; }
.tabs-row button.on { background: var(--bg-elev-2); border-color: var(--line); color: var(--text); }

kbd {
    padding: 1px 5px;
    background: var(--bg-elev-2);
    border: 1px solid var(--line);
    border-bottom-width: 2px;
    border-radius: 4px;
    font: 11px var(--mono);
}

.out-block {
    margin-top: 8px;
    padding: 9px 10px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 8px;
    font: 11.5px/1.5 var(--mono);
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 260px;
    overflow: auto;
}

/* ============================================================
   Touchgeräte: iPhone, iPad, Android
   ============================================================ */

/* iOS rechnet 100vh falsch, solange die Adressleiste eingeblendet ist.
   dvh löst das auf neuen Geräten, -webkit-fill-available auf älteren. */
html, body {
    height: 100%;
    height: -webkit-fill-available;
}
@supports (height: 100dvh) {
    html, body { height: 100dvh; }
}

/* Randabstände der Notch berücksichtigen */
.topbar { padding-top: env(safe-area-inset-top, 0px); height: calc(var(--topbar-h) + env(safe-area-inset-top, 0px)); }
.topbar, .statusbar, .dock { padding-left: max(8px, env(safe-area-inset-left)); padding-right: max(8px, env(safe-area-inset-right)); }

/* Safari zoomt beim Tippen in Felder unter 16px hinein. */
@media (pointer: coarse) {
    .input, select.input, textarea.input, .term-in input, #code { font-size: 16px; }
    .highlight { font-size: 16px; }
    #code, .highlight, .gutter { font: var(--code-font-touch, 15px/1.6 var(--mono)); }
    .icon-btn { width: 38px; height: 36px; }
    .dock-item { padding: 6px 2px; }
    .entry { padding: 11px 9px; }
    .tab { padding: 0 10px 0 14px; }
    .btn { min-height: 36px; }
    .menu button { padding: 11px 10px; }
}

/* Eigene Auswahl statt der iOS-Lupe beim langen Tippen */
.dock-item, .icon-btn, .tab, .entry, .btn { -webkit-touch-callout: none; }
#code { -webkit-touch-callout: default; }

/* ---- Zeichenleiste über der Bildschirmtastatur ---- */

.keybar {
    display: flex;
    gap: 4px;
    padding: 6px 8px;
    overflow-x: auto;
    background: var(--bg-elev);
    border-top: 1px solid var(--line);
    scrollbar-width: none;
    flex: 0 0 auto;
    -webkit-overflow-scrolling: touch;
}
.keybar::-webkit-scrollbar { height: 0; }
.keybar button {
    flex: 0 0 auto;
    min-width: 36px;
    height: 34px;
    padding: 0 9px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 7px;
    color: var(--text);
    font: 15px/1 var(--mono);
    cursor: pointer;
}
.keybar button:active { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
.keybar button.wide { min-width: 46px; }

/* Bei aufgeklappter Tastatur bleibt der Editor sichtbar */
body.keyboard-open .dock { display: none; }
body.keyboard-open .statusbar { display: none; }

/* Auf sehr schmalen Geräten die Beschriftungen kürzen */
@media (max-width: 380px) {
    .dock-item { font-size: 9.5px; }
    .brand { font-size: 12.5px; }
    .project-pill { max-width: 38vw; }
}

/* Quer gehaltenes Telefon: Leiste flacher */
@media (max-height: 460px) and (orientation: landscape) {
    :root { --dock-h: 44px; --topbar-h: 36px; }
    .dock-item span { display: none; }
}

/* Als App vom Startbildschirm gestartet */
@media (display-mode: standalone) {
    body { overscroll-behavior-y: none; }
}

/* Wer Bewegung nicht mag, bekommt keine */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---- Regelliste beim Passwortwechsel ---- */

.pwrules {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
    font-size: 12px;
    color: var(--text-faint);
}
.pwrules li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
}
.pwrules li::before {
    content: "○";
    font-size: 13px;
    line-height: 1;
    width: 14px;
    text-align: center;
}
.pwrules li.ok { color: var(--green); }
.pwrules li.ok::before { content: "✓"; }
