:root {
  --bg: #0d0f14;
  --bg2: #151821;
  --bg3: #1d212d;
  --line: #2a2f3d;
  --text: #eef0f5;
  --muted: #8b92a5;
  --accent: #ff5a5f;
  --accent2: #5ac8fa;
  --ok: #34c759;
  --radius: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #05060a; color: var(--text); overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input, textarea, select { font: inherit; color: var(--text); background: var(--bg3); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%; outline: none; }
input:focus, textarea:focus { border-color: var(--accent2); }
input[type=range] { padding: 0; border: 0; background: transparent; accent-color: var(--accent); }
input[type=checkbox] { width: auto; }

/* ---------- iPhone-Rahmen (Desktop) / Vollbild (echtes Handy) ---------- */
body { display: flex; align-items: center; justify-content: center; }
#device {
  position: relative; width: 390px; height: 844px; background: var(--bg);
  border-radius: 54px; overflow: hidden; display: flex; flex-direction: column;
  box-shadow: 0 0 0 11px #1c1c1e, 0 0 0 13px #3a3a3c, 0 30px 80px rgba(0,0,0,.6);
}
#statusbar { height: 47px; flex: none; display: flex; align-items: center; justify-content: space-between; padding: 6px 30px 0 34px; font-weight: 600; font-size: 15px; position: relative; }
#statusbar .notch { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); width: 122px; height: 35px; background: #000; border-radius: 20px; }
#statusbar .sb-icons { font-size: 11px; letter-spacing: 1px; }
#homebar { height: 30px; flex: none; position: relative; }
#homebar::after { content: ""; position: absolute; left: 50%; bottom: 9px; width: 134px; height: 5px; border-radius: 3px; background: #fff; transform: translateX(-50%); opacity: .85; }
#app { flex: 1; min-height: 0; position: relative; display: flex; flex-direction: column; }
@media (max-width: 500px), (max-height: 760px) {
  body { display: block; }
  #device { width: 100%; height: 100%; border-radius: 0; box-shadow: none; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
  #statusbar, #homebar { display: none; }
}

/* ---------- Allgemein ---------- */
.screen { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.navbar { flex: none; display: flex; align-items: center; gap: 8px; padding: 6px 14px; min-height: 44px; }
.navbar h1 { font-size: 17px; margin: 0; flex: 1; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.largetitle { font-size: 32px; font-weight: 700; margin: 4px 18px 10px; }
.iconbtn { width: 34px; height: 34px; border-radius: 17px; display: inline-flex; align-items: center; justify-content: center; font-size: 17px; color: var(--accent2); }
.iconbtn:active { background: var(--bg3); }
.linkbtn { color: var(--accent2); font-size: 16px; padding: 6px 4px; }
.btn { background: var(--bg3); border-radius: 10px; padding: 8px 12px; font-size: 14px; font-weight: 500; white-space: nowrap; }
.btn:active { opacity: .7; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.blue { background: var(--accent2); color: #001; }
.btn.danger { color: var(--accent); }
.btn:disabled { opacity: .35; }
.scroll { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; align-items: center; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.avatar { width: 26px; height: 26px; border-radius: 13px; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #fff; flex: none; border: 2px solid var(--bg); }
.avatars { display: flex; }
.avatars .avatar { margin-left: -8px; }
.avatar.online { box-shadow: 0 0 0 2px var(--ok); }
.chip { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 10px; background: var(--bg3); color: var(--muted); }

/* ---------- Projektliste ---------- */
.projcard { margin: 0 16px 12px; background: var(--bg2); border-radius: var(--radius); padding: 14px; display: flex; gap: 12px; align-items: center; cursor: pointer; }
.projcard:active { background: var(--bg3); }
.projcard .thumb { width: 64px; height: 44px; border-radius: 8px; background: var(--bg3); flex: none; }
.projcard h3 { margin: 0 0 4px; font-size: 16px; }
.empty { text-align: center; color: var(--muted); padding: 40px 30px; }
.fab { position: absolute; right: 20px; bottom: 20px; width: 56px; height: 56px; border-radius: 28px; background: var(--accent); color: #fff; font-size: 30px; box-shadow: 0 6px 20px rgba(255,90,95,.4); }

/* ---------- Editor ---------- */
.toolbar { flex: none; display: flex; align-items: center; gap: 6px; padding: 4px 10px 6px; overflow-x: auto; }
.toolbar .btn { padding: 6px 10px; font-size: 13px; }
.toolbar .btn.on { background: var(--accent2); color: #001; }
.selinfo { font-size: 12px; color: var(--muted); white-space: nowrap; margin-left: auto; font-variant-numeric: tabular-nums; }
.tool { width: 40px; height: 34px; border-radius: 10px; background: var(--bg3); display: inline-flex; align-items: center; justify-content: center; color: var(--text); flex: none; gap: 4px; }
.tool.on { background: var(--accent2); color: #001; }
.tool.dim { opacity: .35; }
.tool.wide { width: auto; padding: 0 10px; font-size: 13px; }
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s; }
.timeline { flex: 1; min-height: 120px; position: relative; background: var(--bg2); border-top: 1px solid var(--line); }
.timeline canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.lanesbar { flex: none; display: flex; align-items: center; gap: 6px; padding: 0 8px 0 4px; border-top: 1px solid var(--line); background: var(--bg); }
.lanesbar > button:first-child { flex: 1; display: flex; align-items: center; gap: 6px; padding: 7px 4px; font-size: 13px; color: var(--muted); text-align: left; }
.lanesbar.open .ic { transform: rotate(180deg); }
.lanes { flex: none; max-height: 170px; overflow-y: auto; background: var(--bg); display: none; }
.lanes.open { display: block; }
.lanes canvas { display: block; width: 100%; touch-action: pan-y; }
.livestrip { flex: none; padding: 0 10px; display: flex; flex-direction: column; gap: 6px; }
.livestrip:not(:empty) { padding-top: 8px; padding-bottom: 2px; }
/* Live-Kommentare bekommen so viel Platz wie die aufgeklappten Spuren; sind beide offen, teilen sie sich ihn */
.livestrip.on { height: 170px; overflow-y: auto; }
.screen.both .lanes { max-height: 120px; }
.screen.both .livestrip.on { height: 120px; }
.livehint { font-size: 12px; color: var(--muted); text-align: center; padding: 26px 10px; }
.lcard { background: var(--bg2); border-left: 3px solid; border-radius: 10px; padding: 7px 10px; font-size: 13px; flex: none; }
.lcard .ctext { margin: 3px 0 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; cursor: text; }
.lcard .ctext.full { display: block; }
.lcard .more { color: var(--accent); font-size: 12px; padding: 2px 0 0; }
.ctext[data-act] { cursor: text; }
.selbar { flex: none; display: none; gap: 6px; padding: 8px 10px; overflow-x: auto; border-top: 1px solid var(--line); background: var(--bg2); }
.selbar.open { display: flex; }
.selbar, .toolbar { scrollbar-width: none; }
.selbar::-webkit-scrollbar, .toolbar::-webkit-scrollbar { display: none; }
.sbtn { flex: none; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 66px; padding: 6px 4px; border-radius: 10px; background: var(--bg3); font-size: 11px; }
.sbtn span { font-size: 17px; line-height: 20px; }
.sbtn.on { background: var(--accent2); color: #001; }
.actbar { flex: none; border-top: 1px solid var(--line); background: var(--bg2); padding: 7px 10px 8px; }
.actinfo { font-size: 11.5px; color: var(--muted); padding: 0 2px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.actrow { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.actrow::-webkit-scrollbar { display: none; }
.actrow .sbtn { flex: 1 0 auto; }
.cbtn { width: 26px; height: 26px; border-radius: 13px; font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.cbtn:active { background: var(--bg3); }
.item.live { box-shadow: 0 0 0 1.5px var(--ok); }
.item.tap { cursor: pointer; }
.emojis { display: flex; flex-wrap: wrap; gap: 5px; }
.emo { width: 36px; height: 36px; border-radius: 9px; background: var(--bg3); font-size: 18px; }
.emo.on { box-shadow: 0 0 0 2px var(--accent2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chips .chip { font-size: 12px; padding: 4px 10px; cursor: pointer; }
.chips .chip.on { background: var(--text); color: var(--bg); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.blockchip { display: inline-flex; gap: 4px; align-items: center; font-size: 12px; padding: 4px 8px; border-radius: 8px; margin: 6px 6px 0 0; background: var(--bg3); border-left: 3px solid; }
.transport { flex: none; display: flex; align-items: center; justify-content: space-between; padding: 8px 18px; }
.transport .time { font-variant-numeric: tabular-nums; font-size: 15px; min-width: 96px; }
.transport .time small { color: var(--muted); }
.tbtns { display: flex; align-items: center; gap: 14px; }
.tbtn { width: 40px; height: 40px; border-radius: 20px; font-size: 18px; display: flex; align-items: center; justify-content: center; background: var(--bg3); }
.tbtn.play { width: 52px; height: 52px; border-radius: 26px; background: var(--text); color: var(--bg); font-size: 22px; }
.tbtn.rec { color: var(--accent); }
.tbtn.rec.on { background: var(--accent); color: #fff; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .6; } }
.tabs { flex: none; display: flex; padding: 0 6px; border-bottom: 1px solid var(--line); }
.tabs button { flex: auto; padding: 9px 3px; font-size: 12px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--text); border-color: var(--accent); }
.tabs .badge { display: inline-block; margin-left: 3px; font-size: 10px; line-height: 15px; vertical-align: 1px; background: var(--accent); color: #fff; border-radius: 8px; padding: 0 5px; }
.panel { flex: 1; min-height: 0; overflow-y: auto; padding: 10px 14px 20px; }
.panel h4 { margin: 14px 0 8px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }
.panel h4:first-child { margin-top: 2px; }

.item { background: var(--bg2); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; }
.item.resolved { opacity: .5; }
.item.resolved .ctext { text-decoration: line-through; }
.item .meta { font-size: 12px; color: var(--muted); }
.ctext { margin: 6px 0 2px; font-size: 14px; line-height: 1.35; white-space: pre-wrap; word-wrap: break-word; }
.timebadge { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--accent2); background: rgba(90,200,250,.12); padding: 2px 7px; border-radius: 6px; }
.check { width: 24px; height: 24px; border-radius: 12px; border: 2px solid var(--muted); flex: none; display: flex; align-items: center; justify-content: center; font-size: 13px; }
.check.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.composer { display: flex; gap: 8px; align-items: flex-end; margin-bottom: 10px; }
.composer textarea { resize: none; height: 42px; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch { width: 22px; height: 22px; border-radius: 11px; border: 2px solid transparent; }
.swatch.on { border-color: #fff; }
.slider-row { display: grid; grid-template-columns: 92px 1fr 56px; gap: 8px; align-items: center; font-size: 14px; margin: 8px 0; }
.slider-row .val { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; }
.btngrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.filter { display: flex; gap: 6px; margin-bottom: 10px; }
.filter button { font-size: 12px; padding: 4px 10px; border-radius: 12px; background: var(--bg3); color: var(--muted); }
.filter button.on { background: var(--text); color: var(--bg); }
.hint { font-size: 12px; color: var(--muted); line-height: 1.4; }
.laneicon { width: 26px; height: 26px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 14px; flex: none; }

/* ---------- Sheets / Toast ---------- */
.backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.5); z-index: 50; display: flex; align-items: flex-end; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.sheet { width: 100%; max-height: 88%; overflow-y: auto; background: var(--bg2); border-radius: 18px 18px 0 0; padding: 8px 18px 24px; animation: up .25s ease-out; }
@keyframes up { from { transform: translateY(100%); } }
.sheet .grabber { width: 36px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 10px; }
.sheet h2 { font-size: 18px; margin: 4px 0 14px; }
.sheet label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; }
.sheet .actions { display: flex; gap: 8px; margin-top: 18px; }
.sheet .actions .btn { flex: 1; padding: 12px; }
.toast { position: absolute; left: 50%; bottom: 90px; transform: translateX(-50%); background: rgba(40,44,56,.96); padding: 10px 16px; border-radius: 20px; font-size: 13px; z-index: 60; white-space: nowrap; animation: fade .2s; pointer-events: none; }
.seg { display: flex; background: var(--bg3); border-radius: 9px; padding: 2px; }
.seg button { flex: 1; padding: 6px; border-radius: 7px; font-size: 13px; }
.seg button.on { background: var(--line); }
