/* Web Editor – Schwarz / Weiß / Pink wie lucahindelang.com */
:root {
  color-scheme: light;
  --ink: #0a0a0a;
  --muted: rgba(0, 0, 0, .55);
  --line: rgba(0, 0, 0, .12);
  --accent: #c12872;
  --accent-dark: #a91f63;
  --dark: #0a0a0a;
  --dark-2: #151515;
  --ok: #0f8a4a;
  --error: #ef6579;
  --mono: Consolas, "Cascadia Code", "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { background: #fff; color: var(--ink); font-family: var(--mono); }
button, select, input, textarea { font: inherit; }

.app-shell { height: 100vh; height: 100dvh; padding: 10px; }
.panel { height: 100%; border: 1px solid var(--line); border-radius: 10px; background: #fff; overflow: hidden; box-shadow: 0 10px 30px -18px rgba(0,0,0,.35); }
.ide { display: flex; flex-direction: column; min-height: 0; }

/* ---------- Kopfzeile ---------- */
.topbar { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-mark { display: grid; flex: none; width: 40px; height: 40px; place-items: center; border-radius: 9px; background: var(--ink); color: #fff; font-weight: 800; font-size: 13px; text-decoration: none; transition: background .2s, transform .2s; }
.brand-mark:hover { background: var(--accent); transform: rotate(-6deg); }
.eyebrow { margin: 0 0 2px; color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
h1 { margin: 0; font-size: 19px; white-space: nowrap; }

.toolbar { display: flex; flex-wrap: wrap; align-items: end; justify-content: flex-end; gap: 8px; }
button { min-height: 36px; padding: 0 13px; border: 0; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 600; cursor: pointer; transition: background .2s, transform .15s; }
button:hover { background: var(--accent-dark); }
button:active { transform: translateY(1px); }
button:disabled { opacity: .4; cursor: not-allowed; }
button.secondary { background: #fff; color: var(--ink); border: 1px solid var(--line); }
button.secondary:hover { border-color: var(--accent); color: var(--accent); }
.example-label { display: grid; gap: 3px; color: var(--muted); font-size: 10px; text-transform: uppercase; }
select { min-height: 36px; padding: 0 26px 0 9px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); }
.toggle { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; cursor: pointer; user-select: none; }
.toggle input { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }

/* ---------- Arbeitsbereich ---------- */
.workspace { display: grid; grid-template-columns: minmax(260px, var(--editor-width, 56%)) 6px minmax(260px, 1fr); flex: 1; min-height: 0; }
.editor-panel, .results, .preview-panel, .console-panel { display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden; }
.results { display: grid; grid-template-rows: minmax(90px, var(--preview-height, 62%)) 6px minmax(90px, 1fr); }

.section-bar { display: flex; flex: 0 0 40px; align-items: center; justify-content: space-between; gap: 8px; padding: 0 12px; border-bottom: 1px solid var(--line); background: #f7f7f7; font-size: 12px; }
.section-bar span { color: var(--muted); font-size: 11px; }
.bar-actions { display: inline-flex; align-items: center; gap: 8px; }
button.mini { min-height: 26px; width: 28px; padding: 0; border-radius: 6px; background: transparent; color: var(--muted); border: 1px solid var(--line); font-size: 13px; }
button.mini:hover { color: var(--accent); border-color: var(--accent); background: #fff; }
.run-status.ok { color: var(--ok) !important; }
.run-status.error { color: #b40f2a !important; }

/* Tabs */
.tabs-bar { justify-content: flex-start; gap: 0; padding: 0; background: var(--dark-2); border-bottom: 1px solid #222; overflow-x: auto; scrollbar-width: none; }
.tabs-bar::-webkit-scrollbar { display: none; }
.file-tab { display: flex; align-items: center; gap: 7px; height: 100%; min-height: 0; padding: 0 14px; border-radius: 0; background: transparent; color: rgba(255,255,255,.55); border-right: 1px solid #222; border-bottom: 2px solid transparent; font-weight: 500; font-size: 12.5px; white-space: nowrap; }
.file-tab:hover { background: #1c1c1c; color: #fff; }
.file-tab.active { background: var(--dark); color: #fff; border-bottom-color: var(--accent); }
.file-tab .dot { display: grid; width: 20px; height: 18px; place-items: center; border-radius: 4px; font-size: 9.5px; font-weight: 800; color: #fff; }
.dot.html { background: #e34c26; } .dot.css { background: #2f6fdb; } .dot.js { background: #d9b400; color: #111; }
.file-tab i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); opacity: 0; transition: opacity .2s; }
.file-tab.dirty i { opacity: 1; }
.tabs-bar .shortcut { margin-left: auto; padding: 0 12px; color: #777; white-space: nowrap; }

/* Editor */
.editor-host { position: relative; flex: 1; min-height: 0; background: var(--dark); }
.editor-loading { display: grid; height: 100%; place-items: center; color: #777; font-size: 13px; }
.editor-host.fallback textarea { width: 100%; height: 100%; padding: 14px; border: 0; outline: 0; resize: none; background: var(--dark); color: #f0f0f0; font: 13.5px/1.6 var(--mono); tab-size: 2; caret-color: #ff5baa; }
.statusbar { display: flex; flex: 0 0 auto; justify-content: space-between; gap: 10px; padding: 5px 12px; background: var(--accent); color: #fff; font-size: 11px; }

/* Vorschau & Konsole */
iframe { display: block; flex: 1; width: 100%; min-height: 0; border: 0; background: #fff; }
.console-output { flex: 1; min-height: 0; padding: 6px 0; overflow: auto; background: var(--dark); color: #e8e8e8; font: 12px/1.5 var(--mono); }
.console-row { display: grid; grid-template-columns: 20px 1fr; gap: 5px; padding: 4px 10px; border-bottom: 1px solid #1d1d1d; white-space: pre-wrap; overflow-wrap: anywhere; }
.console-row .icon { color: #777; }
.console-row.error { color: var(--error); background: rgba(239,101,121,.06); }
.console-row.warn { color: #f5bd64; }
.console-row.info { color: #82c7ff; }
.console-row.result { color: #a7e07f; }
.console-row.input { color: #ff8fc4; }
.console-empty { padding: 14px; color: #777; }
.console-empty kbd { padding: 1px 4px; border: 1px solid #444; border-radius: 3px; color: #bbb; }
.command-line { display: flex; flex: 0 0 38px; align-items: center; gap: 7px; padding: 0 10px; border-top: 1px solid #262626; background: #000; color: #ff5baa; }
.command-line input { width: 100%; border: 0; outline: 0; background: transparent; color: #fff; font-size: 12px; }
.command-line input::placeholder { color: #666; }

/* Resizer */
.resizer { position: relative; z-index: 4; background: #efefef; touch-action: none; outline: none; }
.resizer::after { content: ""; position: absolute; border-radius: 4px; background: rgba(0,0,0,.22); }
.resizer:hover, .resizer:focus-visible, .resizer.dragging { background: rgba(193,40,114,.14); }
.resizer:hover::after, .resizer:focus-visible::after, .resizer.dragging::after { background: var(--accent); }
.resizer-vertical { cursor: col-resize; border-inline: 1px solid var(--line); }
.resizer-vertical::after { top: calc(50% - 20px); left: 2px; width: 2px; height: 40px; }
.resizer-horizontal { cursor: row-resize; border-block: 1px solid var(--line); }
.resizer-horizontal::after { top: 2px; left: calc(50% - 20px); width: 40px; height: 2px; }
body.resizing { cursor: col-resize; user-select: none; }
body.resizing-horizontal { cursor: row-resize; user-select: none; }
body.resizing iframe, body.resizing-horizontal iframe { pointer-events: none; }

/* ---------- Tablet ---------- */
@media (max-width: 1100px) {
  .example-label { font-size: 0; gap: 0; }
  .example-label select { font-size: 13px; }
  #formatBtn, .tabs-bar .shortcut { display: none; }
}

/* ---------- Smartphone: alles untereinander, Seite scrollt ---------- */
@media (max-width: 760px) {
  html, body { overflow: auto; height: auto; }
  .app-shell { height: auto; padding: 0; }
  .panel { height: auto; border: 0; border-radius: 0; box-shadow: none; }
  .topbar { position: sticky; top: 0; z-index: 10; flex-wrap: wrap; gap: 8px; padding: 8px 10px; background: #fff; }
  .eyebrow { display: none; }
  h1 { font-size: 16px; }
  .brand-mark { width: 34px; height: 34px; }
  .toolbar { width: 100%; flex-wrap: nowrap; justify-content: stretch; gap: 6px; overflow-x: auto; scrollbar-width: none; }
  .toolbar button, .toggle { padding: 0 10px; font-size: 13px; }
  .example-label select { max-width: 120px; }
  #runBtn { width: 46px; padding: 0; font-size: 0; }        /* nur ▶ */
  #runBtn span { font-size: 15px; }
  .toolbar::-webkit-scrollbar { display: none; }
  .toolbar > * { flex: none; }
  #runBtn { margin-left: auto; }
  #downloadBtn { display: none; }
  .workspace { display: flex; flex-direction: column; }
  .resizer { display: none; }
  .editor-panel { height: 58vh; height: 58dvh; }
  .results { display: flex; flex-direction: column; }
  .preview-panel { height: 55vh; height: 55dvh; border-top: 1px solid var(--line); }
  .console-panel { height: 34vh; border-top: 1px solid var(--line); }
  .statusbar #langStatus { display: none; }
  button, select, .toggle { min-height: 40px; } /* größere Touch-Ziele */
}
