/* Grundgerüst: Kopfleiste, zwei Spalten (Mission links, Pult rechts), Buttons, Dialoge.
   Ausgelegt für iPad (9. Generation): 1080 x 810 quer, 810 x 1080 hoch. */
html, body { overflow: hidden; overscroll-behavior: none; }
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }

#app {
  height: 100%;
  display: grid;
  grid-template-rows: 52px minmax(0, 1fr);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 14px 0 16px; background: var(--bg-2); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: baseline; gap: 12px; color: var(--fg); text-decoration: none; min-width: 0; }
.brand b { font-size: 15px; font-weight: 800; letter-spacing: .08em; }
.brand-sub { color: var(--fg-3); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.xp { color: var(--fg-3); font-size: 14px; padding: 0 8px; white-space: nowrap; }
.xp b { color: var(--fg); font-variant-numeric: tabular-nums; font-family: var(--font-mono); font-size: 15px; }

.workspace { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); min-height: 0; }

/* Buttons */
.btn {
  min-height: 44px; padding: 0 16px; border-radius: var(--r-md);
  background: transparent; border: 1px solid var(--line-2); font-weight: 600; font-size: 15px; color: var(--fg); white-space: nowrap;
}
.btn:hover { background: var(--panel-2); }
.btn:active { background: var(--panel-3); }
.btn:disabled { opacity: .38; cursor: default; background: transparent; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.btn-primary:hover { background: #ff9d40; }
.btn-primary:active { background: #e67a12; }
.btn-primary:disabled { background: var(--panel-3); border-color: var(--panel-3); color: var(--fg-3); opacity: 1; }
.btn-ghost { border-color: transparent; color: var(--fg-2); }
.btn-small { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn-big { min-height: 52px; font-size: 17px; width: 100%; margin-top: 12px; }
.btn-play { min-width: 140px; background: var(--panel-2); }
.btn-play.on { background: var(--fg); border-color: var(--fg); color: #111; }

/* Dialoge */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(6, 6, 7, .8); }
.modal-card {
  width: min(780px, 100%); max-height: 100%; overflow: auto; background: var(--panel);
  border: 1px solid var(--line-2); border-radius: var(--r-lg); padding: 22px;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.modal-head h2 { margin: 0; font-size: 22px; text-wrap: balance; }
.modal-card.welcome { width: min(540px, 100%); }
.modal-card.welcome h1 { margin: 0 0 8px; font-size: 28px; line-height: 1.15; text-wrap: balance; }
.lead { color: var(--fg-2); margin: 0 0 14px; }
.checklist { margin: 0 0 14px; padding-left: 20px; color: var(--fg-2); }
.checklist li { margin-bottom: 6px; }
.checklist b { color: var(--fg); }
.cert-label { display: block; margin: 16px 0 6px; font-size: 14px; color: var(--fg-3); }
input[type="text"] {
  width: 100%; min-height: 48px; padding: 0 14px; border-radius: var(--r-md);
  background: #0f0f10; border: 1px solid var(--line-2); font-size: 17px; -webkit-user-select: text; user-select: text;
}
input[type="text"]:focus { border-color: var(--accent); outline: none; }

.modal-actions { display: flex; gap: 8px; }
.map-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.map-card {
  display: grid; grid-template-columns: 44px 1fr auto; column-gap: 12px; align-items: baseline; text-align: left; padding: 14px 14px 14px 12px;
  border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; min-height: 96px;
}
.map-card:hover { background: var(--panel-2); }
.map-num { grid-row: 1 / span 2; font: 700 22px var(--font-mono); color: var(--fg-3); }
.map-card b { font-size: 17px; line-height: 1.25; }
.map-blurb { grid-column: 2 / span 2; font-size: 14px; color: var(--fg-2); }
.map-stars { grid-column: 3; grid-row: 1; color: var(--accent); letter-spacing: 2px; font-size: 14px; }
.map-card.done .map-num { color: var(--accent); }
.map-card.locked { opacity: .4; cursor: default; }
.map-card.locked:hover { background: transparent; }

.xp-toast {
  position: fixed; right: 20px; top: 64px; z-index: 60; padding: 6px 12px; border-radius: var(--r-md);
  background: var(--fg); color: #111; font: 700 14px var(--font-mono); animation: toast 1.5s ease-out forwards; pointer-events: none;
}
@keyframes toast { 0% { transform: translateY(8px); opacity: 0; } 15% { transform: none; opacity: 1; } 80% { opacity: 1; } 100% { transform: translateY(-10px); opacity: 0; } }

/* Hochformat und schmale Fenster: Mission oben, Pult darunter */
@media (max-aspect-ratio: 1/1), (max-width: 860px) {
  .workspace { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(170px, 34%) minmax(0, 1fr); }
  .brand-sub { display: none; }
  .fader-wrap { height: 150px !important; }
}
@media (max-width: 600px) { .map-grid { grid-template-columns: 1fr; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition: none !important; }
}
