:root {
  color-scheme: dark;
  --background: #111416;
  --surface: #191e21;
  --editor: #131719;
  --foreground: #e6eeeb;
  --muted: #97aaa3;
  --primary: #a8e7bc;
  --primary-foreground: #102619;
  --accent: #ecc08d;
  --border: #303d38;
  --danger: #f3a0a0;
  --shadow: 0 12px 36px #00000024;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  letter-spacing: 0;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--background); color: var(--foreground); }
button, input, select, textarea { font: inherit; }
button, .button, select { min-height: 44px; }
button, .button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--border); border-radius: 6px; padding: 10px 14px; color: var(--foreground); background: var(--surface); cursor: pointer; text-decoration: none; font-weight: 600; }
button:hover, .button:hover { border-color: var(--muted); }
button:disabled { opacity: .5; cursor: not-allowed; }
button svg { width: 18px; height: 18px; flex-shrink: 0; }
button.primary { background: var(--primary); color: var(--primary-foreground); border-color: var(--primary); }
button.icon { width: 44px; padding: 10px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
a { color: var(--primary); }

header { border-bottom: 1px solid var(--border); }
.header-inner { max-width: 1540px; margin: auto; padding: 22px 28px; display: flex; gap: 18px; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; color: var(--primary); }
.brand-mark svg { width: 36px; height: 36px; }
h1 { font-size: 26px; margin: 0; font-weight: 700; }
.brand small { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.header-links { display: flex; align-items: center; gap: 18px; font-size: 13px; }
.header-links a { text-decoration: none; min-height: 44px; display: flex; align-items: center; }

main { max-width: 1540px; padding: 28px; margin: auto; }
.workspace-bar { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.selector { min-width: 0; width: min(100%, 360px); }
label, .eyebrow { display: block; font-size: 11px; font-weight: 700; color: var(--muted); margin-bottom: 9px; text-transform: uppercase; letter-spacing: 0; }
select, input { width: 100%; background: var(--surface); color: var(--foreground); padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px; }
.task-actions, .editor-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.workspace { display: grid; grid-template-columns: minmax(260px, .7fr) minmax(0, 1.7fr); gap: 24px; align-items: start; }
.assignment { padding: 6px 4px 12px 0; min-width: 0; }
h2 { font-size: 22px; margin: 0 0 18px; line-height: 1.4; overflow-wrap: anywhere; }
.assignment pre { color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; font: 13px/1.75 ui-monospace, SFMono-Regular, Consolas, monospace; padding: 0; margin: 0; }

.editor-panel { border: 1px solid var(--border); border-radius: 6px; background: var(--editor); box-shadow: var(--shadow); min-width: 0; overflow: hidden; }
.panel-bar { display: flex; align-items: center; justify-content: space-between; min-height: 54px; gap: 12px; padding: 8px 16px; border-bottom: 1px solid var(--border); background: var(--surface); }
.filename { font: 12px ui-monospace, SFMono-Regular, Consolas, monospace; color: var(--muted); }
.file-dot { color: var(--primary); margin-right: 8px; }

/* Monaco Editor Container Layout */
.editor-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  position: relative;
  height: 400px; /* Feste Höhe für den Editor */
}

#editor-container {
  width: 100%;
  height: 100%;
}

.run-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-top: 1px solid var(--border); }
.runtime-status { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }

.results { margin-top: 24px; border-top: 1px solid var(--border); padding-top: 22px; }
.results-heading { display: flex; gap: 16px; justify-content: space-between; align-items: center; }
.results h2 { font-size: 16px; margin: 0; }
#result-summary { font-size: 13px; color: var(--muted); }
#result-summary[data-state="success"] { color: var(--primary); }
#result-summary[data-state="error"] { color: var(--danger); }
.result-output { margin: 16px 0 0; font: 13px/1.65 ui-monospace, SFMono-Regular, Consolas, monospace; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 340px; overflow: auto; }
.result-output:empty { display: none; }

#notice { min-height: 24px; margin: 18px 0 0; color: var(--accent); font-size: 13px; }
footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; border-top: 1px solid var(--border); margin-top: 22px; padding-top: 18px; color: var(--muted); font-size: 12px; }
details { margin-top: 12px; font-size: 12px; color: var(--muted); }
summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: var(--muted); }
details p { line-height: 1.7; margin-top: 0; max-width: 760px; }

dialog { width: min(760px, calc(100% - 32px)); background: var(--surface); color: var(--foreground); border: 1px solid var(--border); border-radius: 8px; padding: 24px; box-shadow: var(--shadow); }
dialog::backdrop { background: var(--background); opacity: .82; }
dialog textarea { width: 100%; min-height: 300px; padding: 14px; color: var(--foreground); background: var(--editor); border: 1px solid var(--border); border-radius: 6px; font: 13px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; resize: vertical; margin-bottom: 18px; }
dialog input { margin-bottom: 18px; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 12px; }
.dialog-heading h2 { margin: 0; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; }
.dialog-error { color: var(--danger); font-size: 13px; min-height: 18px; }
[hidden] { display: none !important; }

@media (max-width: 760px) {
  .header-inner { padding: 16px; }
  .header-links { gap: 12px; }
  .brand small { display: none; }
  h1 { font-size: 22px; }
  main { padding: 20px 16px; }
  .workspace-bar { align-items: stretch; flex-direction: column; gap: 14px; }
  .selector { width: 100%; }
  .workspace { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .assignment pre { max-height: 300px; overflow: auto; }
  .editor-wrap { height: 380px; }
  .panel-bar { padding: 8px 12px; }
  .run-bar { flex-wrap: wrap; }
  .results-heading { align-items: flex-start; flex-direction: column; gap: 8px; }
  dialog { padding: 18px; }
}

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto; } }

/* Falls Monaco intern oder ein Wrapper diesen Kasten erzeugt, erzwingen wir saubere Ansicht */
.editor-wrap textarea, 
.monaco-editor .inputarea {
  background: transparent !important;
}

#editor-container {
  background: var(--editor);
}