/* Code-Hero – Design im inpeek-Stil (Deep Navy, Lime, Teal, Berry; Schrift Manrope) */
@font-face {
  font-family: "Manrope";
  src: url("../fonts/Manrope-VF.woff2") format("woff2");
  font-weight: 200 800; font-style: normal; font-display: swap;
}
:root {
  --bg: #0B1220;
  --panel: #141D30;
  --panel2: #0E1626;
  --navy: #13294B;
  --navy-hi: #1B3A6B;
  --line: rgba(255, 255, 255, .12);
  --text: #E8EDF5;
  --muted: #94A2B6;
  --lime: #97D700;
  --lime-dark: #6F9D00;
  --teal: #39B2B9;
  --teal-light: #6DCED4;
  --berry: #A64D85;
  --amber: #E07C14;
  --red: #E5484D;
  --ink: #0B1220;
  --radius: 16px;
  --font: "Manrope", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  color: var(--text);
  background: radial-gradient(1100px 650px at 50% -12%, #1B3A6B 0%, var(--bg) 62%) fixed;
  -webkit-font-smoothing: antialiased;
}
#app { height: 100%; }
.screen { display: none; height: 100%; position: relative; }
.screen.active { display: flex; }
.hidden { display: none !important; }

/* ---------- Logo ---------- */
.brand-logo { position: absolute; left: 24px; top: 20px; height: 30px; width: auto; z-index: 2; }
.top-logo { height: 26px; width: auto; }

/* ---------- Buttons ---------- */
.btn {
  font: inherit; font-weight: 700; color: var(--text);
  background: var(--navy);
  border: 1px solid rgba(255, 255, 255, .18); border-radius: 12px;
  padding: 10px 16px; cursor: pointer;
  box-shadow: 0 2px 0 rgba(0, 0, 0, .35);
  transition: transform .08s, filter .15s;
}
.btn:hover { filter: brightness(1.18); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; filter: none; }
.btn.primary {
  background: var(--lime); border-color: #b4e83a; color: var(--ink); font-size: 1.05rem; font-weight: 800;
  box-shadow: 0 3px 0 var(--lime-dark), 0 8px 22px rgba(151, 215, 0, .22);
}
.btn.ghost { background: transparent; box-shadow: none; border-color: var(--line); }
.btn.small { padding: 7px 12px; font-size: .88rem; }
.btn.wide { width: 100%; }
.link-btn {
  background: none; border: 0; color: var(--muted); font: inherit; font-size: .85rem;
  cursor: pointer; text-decoration: underline; margin-top: 18px;
}
.link-btn:hover { color: var(--text); }

.text-input {
  width: 100%; font: inherit; font-weight: 600; font-size: 1.05rem; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; outline: none;
}
.text-input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(57, 178, 185, .25); }

/* ---------- Hero-Wahl ---------- */
#screen-hero { align-items: flex-start; justify-content: center; padding: 64px 20px 20px; overflow: auto; }
.hero-pick {
  width: min(420px, 100%); padding: 22px 26px 24px; margin: auto;
  background: linear-gradient(180deg, rgba(20, 29, 48, .96), rgba(14, 22, 38, .98));
  border: 1px solid var(--line); border-radius: 26px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .06);
}
.hero-pick h2 { margin: 0 0 14px; text-align: center; font-size: 1.5rem; }
.hero-stage { display: flex; justify-content: center; margin: -4px 0 4px; }
.hero-stage canvas { display: block; }
.field-label { margin: 12px 0 6px; font-size: .8rem; font-weight: 700; color: var(--muted); }
.swatches { display: flex; gap: 12px; }
.swatch {
  width: 38px; height: 38px; border-radius: 50%; cursor: pointer; padding: 0;
  border: 3px solid transparent; outline: 2px solid rgba(255, 255, 255, .12); outline-offset: 1px;
  transition: transform .1s;
}
.swatch:hover { transform: scale(1.1); }
.swatch.sel { border-color: var(--bg); outline: 3px solid #fff; }
.hero-pick .btn.wide { margin-top: 20px; }
.hero-pick .link-btn { display: block; margin: 12px auto 0; }

/* ---------- Hauptmenü ---------- */
#screen-menu { align-items: flex-start; justify-content: center; padding: 64px 20px 20px; overflow: auto; }
.menu-card {
  width: min(900px, 100%); text-align: center; padding: 30px 30px 22px; margin: auto;
  background: linear-gradient(180deg, rgba(20, 29, 48, .92), rgba(14, 22, 38, .95));
  border: 1px solid var(--line); border-radius: 26px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .06);
}
h1 {
  margin: 0; font-size: clamp(2.2rem, 6vw, 3.3rem); font-weight: 800; letter-spacing: -.01em;
  background: linear-gradient(90deg, var(--teal-light), var(--lime) 85%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tagline { margin: 2px 0 16px; color: var(--muted); }
.hero-card {
  display: inline-flex; align-items: center; gap: 14px; margin: 0 auto 16px; padding: 8px 14px 8px 8px;
  background: var(--navy); border: 1px solid rgba(255, 255, 255, .14); border-radius: 18px;
}
.portrait { width: 64px; height: 64px; border-radius: 50%; background: radial-gradient(circle, rgba(57, 178, 185, .35), rgba(14, 22, 38, .9) 72%); overflow: hidden; flex: none; }
.portrait canvas { display: block; }
.hero-info { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; min-width: 0; max-width: 220px; }
.hero-info .hello { font-size: .72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.hero-info strong { font-size: 1.25rem; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.progress { height: 10px; background: var(--bg); border-radius: 99px; overflow: hidden; border: 1px solid var(--line); max-width: 420px; margin: 0 auto; }
#progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--teal), var(--lime)); transition: width .5s; }
.progress-text { margin: 8px 0 18px; font-size: .9rem; color: var(--muted); }
.cert-btn.inactive { animation: none; box-shadow: none; opacity: .5; cursor: not-allowed; filter: grayscale(.6); }
.cert-btn { margin: 0 auto 18px; padding: 12px 26px; animation: glow 2.4s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 3px 0 var(--lime-dark), 0 8px 34px rgba(151, 215, 0, .55); } }
.level-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.level-card {
  position: relative; font: inherit; color: var(--text); cursor: pointer;
  aspect-ratio: 1 / 1.05; border-radius: 18px; padding: 8px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  background: linear-gradient(160deg, #1B3A6B, var(--navy));
  border: 2px solid var(--teal);
  box-shadow: 0 6px 0 rgba(0, 0, 0, .35), 0 0 24px rgba(57, 178, 185, .15);
  transition: transform .12s, box-shadow .12s;
}
.level-card:hover:not(:disabled) { transform: translateY(-3px); box-shadow: 0 9px 0 rgba(0, 0, 0, .35), 0 0 30px rgba(57, 178, 185, .38); }
.level-card .n { font-size: 2.2rem; font-weight: 800; line-height: 1; }
.level-card .t { font-size: .85rem; font-weight: 700; color: #cdd9ee; line-height: 1.15; }
.level-card .s { position: absolute; top: 8px; right: 10px; font-size: 1.1rem; }
.level-card.done { border-color: var(--lime); box-shadow: 0 6px 0 rgba(0, 0, 0, .35), 0 0 24px rgba(151, 215, 0, .18); }
.level-card:disabled { cursor: not-allowed; border-color: #2a3550; background: var(--panel); box-shadow: none; color: #66738c; }
.level-card:disabled .t { color: #66738c; }
.menu-footer { display: flex; justify-content: center; gap: 26px; flex-wrap: wrap; }

/* ---------- Level-Screen ---------- */
#screen-level { flex-direction: column; gap: 12px; padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.top-left { display: flex; align-items: center; gap: 16px; }
.topbar .title { display: flex; align-items: center; gap: 10px; }
.topbar h2 { margin: 0; font-size: 1.3rem; font-weight: 800; }
.badge { background: var(--lime); color: var(--ink); font-weight: 800; border-radius: 99px; padding: 3px 12px; font-size: .9rem; }
.level-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 2fr 1fr; gap: 14px; }

.stage {
  display: flex; flex-direction: column; min-height: 0; overflow: hidden;
  background: linear-gradient(180deg, #0F1A2E, var(--bg));
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .4);
}
.canvas-area { position: relative; flex: 1; min-height: 0; overflow: hidden; }
#canvas {
  position: absolute; left: 50%; top: calc(50% - 30px); transform: translate(-50%, -50%);   /* top wird in game.js passend gesetzt */
  border-radius: 14px; box-shadow: 0 10px 40px rgba(0, 0, 0, .6), 0 0 0 3px #070B14, 0 0 0 5px #2A4166;
}
.banner {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%);
  max-width: min(90%, 560px); padding: 10px 18px; border-radius: 12px; text-align: center; font-weight: 700;
  background: rgba(14, 22, 38, .96); border: 1px solid var(--line); box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
  animation: pop .25s ease-out; white-space: pre-line;
}
.banner.error { border-color: var(--red); color: #ffc9cb; }
.banner.info { border-color: var(--teal); color: #d3f4f6; }
.banner.warn { border-color: var(--amber); color: #ffd9b0; }

.side { display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 14px; min-height: 0; }
.panel { display: flex; flex-direction: column; min-height: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; box-shadow: 0 14px 40px rgba(0, 0, 0, .35); }
.panel-head { display: flex; align-items: center; justify-content: space-between; font-weight: 800; font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 8px; }
.panel-head small { text-transform: none; letter-spacing: 0; font-weight: 500; opacity: .7; }
.editor-wrap { flex: 1; min-height: 0; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.editor-wrap .CodeMirror { height: 100%; font: 15px/1.55 "Cascadia Code", Consolas, "Courier New", monospace; }
.editor-wrap textarea { width: 100%; height: 100%; border: 0; resize: none; padding: 10px; background: #282a36; color: #f8f8f2; font: 15px/1.55 Consolas, monospace; }
.actions { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; margin-top: 10px; }
.speed { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: .85rem; color: var(--muted); }
.speed input { flex: 1; accent-color: var(--lime); }
.cmd-panel { min-height: 120px; max-height: 40vh; display: flex; flex-direction: column; }
.cmd-panel .cmd-list { min-height: 0; }
.cmd-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-content: start; overflow: auto; }
.cmd {
  font: 600 .85rem "Cascadia Code", Consolas, monospace; text-align: left; cursor: pointer;
  color: #9fe3e7; background: var(--panel2); border: 1px solid var(--line); border-radius: 9px; padding: 5px 9px;
}
.cmd:hover { border-color: var(--teal); background: #122036; }
.cmd.snip { color: #e3b5d2; font-family: var(--font); font-weight: 700; }

/* ---------- Pop-up ---------- */
.modal { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(5, 8, 14, .72); backdrop-filter: blur(4px); z-index: 10; }
.modal-box {
  width: min(460px, 100%); text-align: center; padding: 28px 26px 24px;
  background: linear-gradient(180deg, #1B3A6B, var(--navy));
  border: 2px solid var(--teal); border-radius: 22px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .65), 0 0 50px rgba(57, 178, 185, .22);
  animation: pop .3s cubic-bezier(.2, 1.4, .4, 1);
}
.modal-box.bad { border-color: var(--red); box-shadow: 0 30px 80px rgba(0, 0, 0, .65), 0 0 50px rgba(229, 72, 77, .25); }
.modal-emoji { font-size: 3.2rem; line-height: 1; }
.modal-box h3 { margin: 8px 0 6px; font-size: 1.55rem; font-weight: 800; }
.modal-box p { margin: 0 0 18px; color: #b9c5da; }
.modal-box .text-input { margin: 0 0 14px; text-align: center; }
.modal-box .modal-error { margin: -6px 0 14px; color: #ffb0b3; font-weight: 700; }
.modal-actions { display: flex; flex-direction: column; gap: 10px; }
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Urkunde ---------- */
#screen-cert { align-items: flex-start; justify-content: center; padding: 64px 20px 20px; overflow: auto; }
.cert-wrap { width: min(1080px, 100%); margin: auto; display: flex; flex-direction: column; align-items: center; gap: 16px; }
#cert-canvas { width: 100%; height: auto; aspect-ratio: 2339 / 1654; border-radius: 6px; box-shadow: 0 24px 70px rgba(0, 0, 0, .55); background: #fff; }
.cert-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.cert-note { margin: 0; color: var(--muted); font-size: .9rem; text-align: center; }

/* ---------- Ergänzungen ---------- */
.mini-btn { font: inherit; font-size: .85rem; text-transform: none; letter-spacing: 0; font-weight: 700; color: #ffd2d4; background: rgba(229, 72, 77, .22); border: 1px solid var(--red); border-radius: 10px; padding: 6px 12px; cursor: pointer; }
.mini-btn:hover { color: #fff; background: rgba(229, 72, 77, .45); border-color: #ff7a7e; }
.cm-error-line { background: rgba(255, 214, 0, .38) !important; box-shadow: inset 4px 0 0 #ffd600; }
#speed-val { min-width: 2.2em; text-align: right; color: var(--text); }

/* ---------- Auszeichnungen ---------- */
.level-card .aw { display: inline-flex; flex-direction: row; flex-wrap: nowrap; align-items: center; justify-content: center; max-width: 100%; white-space: nowrap; text-align: center; gap: 4px; margin-top: 4px; padding: 2px 8px; border-radius: 99px; font-size: .64rem; font-weight: 800; color: #8794ad; background: rgba(0, 0, 0, .25); border: 1px dashed #46567a; }
.level-card .aw .awt { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.level-card .aw .medal { filter: grayscale(1); opacity: .45; font-size: .8rem; flex: none; line-height: 1; }
.level-card .aw.on { color: var(--ink); background: linear-gradient(#FFE08A, #F0B400); border: 1px solid #FFF0BF; box-shadow: 0 0 14px rgba(240, 180, 0, .5); }
.level-card .aw.on .medal { filter: none; opacity: 1; }
.modal-award { margin: -4px 0 16px; padding: 10px 14px; border-radius: 12px; font-weight: 800; color: #cbd6ea; background: rgba(255, 255, 255, .07); border: 1px dashed #5a6c92; }
.modal-award.on { color: var(--ink); background: linear-gradient(#FFE08A, #F0B400); border: 1px solid #FFF0BF; box-shadow: 0 0 22px rgba(240, 180, 0, .45); }

/* ---------- Auftrag deutlich hervorgehoben ---------- */
.mission {
  padding: 14px 18px 14px 20px; font-size: 1.08rem; font-weight: 700; line-height: 1.4; color: #eaf6f7;
  background: linear-gradient(90deg, rgba(57, 178, 185, .30), rgba(57, 178, 185, .07));
  border-bottom: 1px solid rgba(57, 178, 185, .45); border-left: 6px solid var(--teal);
}
.mission::before { content: "AUFTRAG"; display: inline-block; margin-right: 10px; padding: 2px 9px; border-radius: 6px; background: var(--lime); color: var(--ink); font-size: .72rem; font-weight: 800; letter-spacing: .08em; vertical-align: 2px; }

/* =====================================================================
   Handy und Tablet
   Layouts:  Desktop / Tablet quer  = 2 Spalten (Spielfeld links, Code rechts)
             Tablet hoch            = Spielfeld oben, Code und Befehle nebeneinander darunter (ohne Scrollen)
             Handy hoch             = alles untereinander: Spielfeld, Ausführen, Befehle, Code
             Handy quer             = 2 Spalten, kompakt
   ===================================================================== */

/* Touch-Bedienung: grössere Ziele, kein Doppeltipp-Zoom */
button, .btn, .cmd, .swatch, .level-card, .mission, input[type=range] { touch-action: manipulation; }
@media (pointer: coarse) {
  .btn { min-height: 46px; }
  .btn.small { min-height: 40px; }
  .mini-btn { min-height: 38px; padding: 8px 14px; }
  .cmd { min-height: 44px; padding: 8px 12px; font-size: .92rem; display: flex; align-items: center; }
  .swatch { width: 44px; height: 44px; }
  .swatches { gap: 14px; }
  .link-btn { padding: 10px 6px; }
  .editor-wrap .CodeMirror { font-size: 16px; }   /* unter 16 px zoomt iPhone/iPad beim Antippen */
  .speed input[type=range] { -webkit-appearance: none; appearance: none; height: 34px; background: transparent; }
  .speed input[type=range]::-webkit-slider-runnable-track { height: 8px; border-radius: 99px; background: var(--navy-hi); }
  .speed input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 30px; height: 30px; margin-top: -11px; border-radius: 50%; background: var(--lime); border: 3px solid var(--ink); box-shadow: 0 0 0 2px var(--lime); }
  .speed input[type=range]::-moz-range-track { height: 8px; border-radius: 99px; background: var(--navy-hi); }
  .speed input[type=range]::-moz-range-thumb { width: 24px; height: 24px; border-radius: 50%; background: var(--lime); border: 3px solid var(--ink); box-shadow: 0 0 0 2px var(--lime); }
}

/* Hauptmenü: Kachelspalten */
@media (max-width: 1000px) { .level-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 520px) {
  .level-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .menu-card { padding: 22px 14px 16px; border-radius: 20px; }
  .hero-card { flex-wrap: wrap; justify-content: center; padding: 10px; }
  .hero-info { align-items: center; }
  .brand-logo { height: 26px; left: 16px; top: 16px; }
  #screen-menu, #screen-hero, #screen-cert { padding: 56px 12px 12px; }
  .hero-pick { padding: 18px 18px 20px; }
  .cert-btn { width: 100%; }
}

/* Pop-ups auf kleinen Bildschirmen */
.modal-box { max-height: 94vh; overflow-y: auto; }
@media (max-height: 500px) {
  .modal-box { padding: 14px 18px; }
  .modal-emoji { font-size: 2rem; }
  .modal-box h3 { margin: 4px 0; font-size: 1.25rem; }
  .modal-box p { margin-bottom: 10px; }
  .modal-actions { flex-direction: row; flex-wrap: wrap; }
  .modal-actions .btn { flex: 1 1 40%; }
}

/* ---------- Tablet hoch: Spielfeld oben, Code + Befehle darunter, ohne Scrollen ---------- */
@media (min-width: 601px) and (max-width: 1100px) and (orientation: portrait) {
  .level-layout { grid-template-columns: 1fr; grid-template-rows: minmax(0, 56fr) minmax(0, 44fr); }
  .side { grid-template-columns: 3fr 2fr; grid-template-rows: minmax(0, 1fr); }
  .cmd-list { align-content: start; }
  .mission { font-size: 1rem; padding: 10px 16px 10px 18px; }
}

/* ---------- Handy hoch: alles untereinander, Ausführen direkt unter dem Spielfeld ---------- */
@media (max-width: 600px) and (min-height: 501px) {
  #screen-level { overflow-y: auto; height: auto; min-height: 100%; padding: 10px; gap: 10px; }
  .top-logo { display: none; }
  .topbar { gap: 8px; }
  .topbar .lbl { display: none; }
  .topbar .btn { padding: 8px 14px; font-size: 1.05rem; }
  .topbar .title { min-width: 0; flex: 1; justify-content: center; }
  .topbar h2 { font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .badge { font-size: .78rem; padding: 2px 9px; flex: none; }
  .level-layout { display: flex; flex-direction: column; gap: 10px; flex: none; min-height: auto; }
  .stage { order: 1; flex: none; height: clamp(300px, 50vh, 470px); }
  .mission { font-size: .9rem; padding: 9px 12px 9px 14px; cursor: pointer; }
  .mission:not(.open) { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  .side, .editor-panel { display: contents; }
  .actions { order: 2; margin-top: 0; }
  .speed { order: 3; margin-top: 0; }
  .cmd-panel { order: 4; flex: none; min-height: 0; padding: 8px; }
  .cmd-panel .panel-head { margin-bottom: 6px; }
  .cmd-list { display: flex; flex-wrap: wrap; gap: 6px; overflow: visible; }
  .cmd { flex: 1 1 auto; justify-content: center; }
  .editor-panel > .panel-head { order: 5; margin: 4px 2px 0; }
  .editor-wrap { order: 6; flex: none; height: 230px; }
}

/* ---------- Handy quer: zwei Spalten, kompakt ---------- */
@media (max-height: 500px) and (orientation: landscape) {
  #screen-level { padding-top: max(6px, env(safe-area-inset-top)); padding-bottom: max(6px, env(safe-area-inset-bottom)); gap: 6px; }
  .top-logo { display: none; }
  .topbar .btn { padding: 5px 12px; min-height: 36px; }
  .topbar h2 { font-size: 1rem; }
  .level-layout { grid-template-columns: 3fr 2fr; gap: 8px; }
  .mission { font-size: .8rem; padding: 5px 10px 5px 12px; cursor: pointer; }
  .mission::before { display: none; }
  .mission:not(.open) { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .side { grid-template-rows: minmax(0, 1fr) auto; gap: 8px; }
  .panel { padding: 8px; }
  .panel-head { margin-bottom: 4px; font-size: .7rem; }
  .mini-btn { min-height: 30px; padding: 4px 10px; font-size: .78rem; }
  .actions { margin-top: 6px; gap: 8px; }
  .actions .btn { min-height: 38px; padding: 6px 10px; font-size: .95rem; }
  .speed { margin-top: 2px; }
  .cmd-panel { min-height: 0; }
  .cmd-panel .panel-head { display: none; }
  .cmd-list { display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 6px; }
  .cmd { flex: none; white-space: nowrap; min-height: 36px; padding: 4px 10px; }
  /* Hero-Wahl quer: Vorschau links, Eingaben rechts */
  .hero-pick { width: min(640px, 100%); display: grid; grid-template-columns: 200px 1fr; column-gap: 24px; padding: 14px 22px 16px; }
  .hero-stage { grid-column: 1; grid-row: 1 / span 8; align-self: center; margin: 0; }
  .hero-pick > :not(.hero-stage) { grid-column: 2; }
  .hero-pick h2 { margin: 0 0 4px; text-align: left; font-size: 1.2rem; }
  #screen-hero, #screen-menu, #screen-cert { padding-top: 50px; }
}

/* ---------- Urkunden-Button zweizeilig, Auftrag, Welt-Wechsel ---------- */
.cert-btn { line-height: 1.25; }
.cert-btn small { display: block; margin-top: 2px; font-size: .8rem; font-weight: 700; }
.mission { cursor: pointer; }
.modal-kicker { display: inline-block; margin: 6px 0 2px; padding: 2px 10px; border-radius: 6px; background: var(--lime); color: var(--ink); font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.world-btn { display: block; margin: 0 auto 18px; padding: 12px 26px; }
.world-btn.back { font-size: .95rem; }

/* ---------- Super-Hero: angenehmes Grün ---------- */
body.world-super {
  --bg: #0A1B14;
  --panel: #12251C;
  --panel2: #0D1D16;
  --navy: #14402F;
  --navy-hi: #1D5E44;
  --teal: #4FCB93;
  --teal-light: #8BE0B6;
  background: radial-gradient(1100px 650px at 50% -12%, #1F6B4A 0%, var(--bg) 62%) fixed;
}
body.world-super .level-card { background: linear-gradient(160deg, #1F6B4A, var(--navy)); border-color: #5FD18F; box-shadow: 0 6px 0 rgba(0, 0, 0, .35), 0 0 24px rgba(95, 209, 143, .18); }
body.world-super .level-card:disabled { background: linear-gradient(160deg, #15291F, #10201A); border-color: #2C4A3B; }
body.world-super .modal-box { background: linear-gradient(180deg, #1F6B4A, var(--navy)); }
body.world-super .menu-card { background: linear-gradient(180deg, rgba(18, 37, 28, .92), rgba(13, 29, 22, .95)); }
body.world-super h1 { background: linear-gradient(90deg, #8BE0B6, #E4F18A 85%); -webkit-background-clip: text; background-clip: text; }

/* Inhalt darf die Spalten nie breiter machen (sonst vergrössert sich auf dem Handy die ganze Seite) */
.level-layout > *, .side > *, .panel, .cmd-panel { min-width: 0; }
@media (max-height: 500px) and (orientation: landscape) { .level-layout { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); } }

/* ---- Robustheit Editor/Befehle (Desktop): Container dürfen nie von selbst wegscrollen ---- */
@media (min-width: 901px) and (min-height: 421px) {
  #screen-level, .level-layout, .side, .editor-panel, .cmd-panel { overflow: clip; }
  .cmd-panel .cmd-list { overflow-y: auto; }
}
.CodeMirror { height: 100%; }
#modal-text { white-space: pre-line; }

/* ---- Spickzettel ---- */
.mission-wrap { display: flex; align-items: stretch; gap: 8px; }
.mission-wrap .mission { flex: 1; min-width: 0; }
.cheat-btn { flex: none; border: 1px solid var(--line); background: var(--panel, #1A2A47); color: var(--lime); border-radius: 12px; padding: 0 12px; font-size: 1.4rem; cursor: pointer; }
.cheat-btn:hover { filter: brightness(1.2); }
.cheat-btn.hidden { display: none; }
.cheat-box { max-width: 640px; text-align: left; }
.cheat-box h3 { text-align: center; }
.cheat-body { max-height: 62vh; overflow-y: auto; font-size: .95rem; line-height: 1.45; }
.cheat-body h4 { margin: 14px 0 4px; color: var(--lime); }
.cheat-body p { margin: 4px 0; }
.cheat-body pre { margin: 6px 0; padding: 8px 10px; background: rgba(0, 0, 0, .35); border-radius: 8px; overflow-x: auto; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .88rem; white-space: pre; }
.cheat-body code { font-family: ui-monospace, Menlo, Consolas, monospace; background: rgba(0, 0, 0, .3); padding: 1px 5px; border-radius: 5px; }
.cheat-body table { border-collapse: collapse; width: 100%; }
.cheat-body td { padding: 3px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.mission-wrap .mission { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
