/* © 2026 free-bird GmbH. Alle Rechte vorbehalten. */
:root {
  --bg: #0f141b; --card: #171e28; --card2: #1f2834; --text: #e6edf3; --muted: #9fb3c8;
  --accent: #3b9dff; --ok: #2ee66b; --warn: #ffcc33; --bad: #ff4d4d; --border: #2b3645;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden; }
canvas#view { position: fixed; inset: 0; display: block; background: #5d9be6; }
.hidden { display: none !important; }
kbd { font: 11px/1 ui-monospace, Menlo, monospace; background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.25); border-radius: 4px; padding: 2px 5px; margin-left: 4px; vertical-align: middle; }
button { font: inherit; color: var(--text); background: var(--card2); border: 1px solid var(--border); border-radius: 8px; padding: 9px 14px; cursor: pointer; }
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: #04111f; font-weight: 600; }
input[type=text], input[type=number], select, textarea { font: inherit; color: var(--text); background: #0f141b; border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; width: 100%; }

.overlay { position: fixed; inset: 0; background: rgba(6, 10, 16, 0.72); display: flex; align-items: center; justify-content: center; padding: 16px; overflow: auto; z-index: 10; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; width: min(1040px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 20px 24px; box-shadow: 0 20px 60px rgba(0,0,0,0.5); }
.card.wide { width: min(1240px, 100%); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
h1 { font-size: 24px; margin: 0; }
h1 small { display: block; font-size: 13px; color: var(--muted); font-weight: 400; margin-top: 4px; }
h2 { font-size: 20px; margin: 0 0 8px; }
h3 { font-size: 14px; color: var(--muted); margin: 14px 0 6px; text-transform: uppercase; letter-spacing: 0.04em; }
.student { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.student input { width: 220px; }

.menu-cols { display: grid; grid-template-columns: 300px 1fr; gap: 20px; }
.scenario-list { display: flex; flex-direction: column; gap: 4px; max-height: 60vh; overflow: auto; padding-right: 4px; }
.scenario-list .group { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin: 10px 0 2px; }
.scenario-list .sc { text-align: left; padding: 8px 10px; background: transparent; border-color: transparent; }
.scenario-list .sc:hover { background: var(--card2); }
.scenario-list .sc.active { background: var(--card2); border-color: var(--accent); }
.scenario-info p { color: var(--text); line-height: 1.45; }
.facts { color: var(--muted); font-size: 14px; padding-left: 18px; line-height: 1.5; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.actions.right { margin-left: auto; }
.help summary { cursor: pointer; color: var(--muted); }
.help table { font-size: 13px; border-collapse: collapse; margin-top: 8px; }
.help td { padding: 3px 10px 3px 0; vertical-align: top; }
.help td:first-child { white-space: nowrap; color: var(--muted); }

.panel { position: fixed; top: 16px; right: 16px; bottom: 16px; width: min(520px, calc(100% - 32px)); background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 18px 20px; overflow: auto; z-index: 20; box-shadow: 0 20px 60px rgba(0,0,0,0.6); }
#instrForm .row, #geraete .row { display: grid; grid-template-columns: 1fr 150px; align-items: center; gap: 10px; margin: 4px 0; font-size: 13px; }
#instrForm .row.check { grid-template-columns: 22px 1fr; }
#instrForm .row span, #geraete .row span { color: var(--muted); }
#instrForm textarea { grid-column: 1 / -1; }
.panel-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; position: sticky; bottom: 0; background: var(--card); padding-top: 10px; }
label.file { display: inline-block; background: var(--card2); border: 1px solid var(--border); border-radius: 8px; padding: 9px 14px; cursor: pointer; }
label.file input { display: none; }
#shareUrl { margin-top: 10px; font-size: 12px; }

table.results { width: 100%; border-collapse: collapse; font-size: 13px; }
table.results th, table.results td { text-align: left; padding: 6px 6px; border-bottom: 1px solid var(--border); }
table.results th { color: var(--muted); font-weight: 500; }

.db-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-bottom: 12px; }
.db-sub { color: var(--muted); }
.grade { font-size: 44px; font-weight: 800; width: 72px; height: 72px; border-radius: 16px; display: flex; align-items: center; justify-content: center; background: var(--card2); }
.grade-A { color: #2ee66b; } .grade-B { color: #8ee66b; } .grade-C { color: #ffcc33; } .grade-D { color: #ff9f1c; } .grade-E { color: #ff4d4d; }
.db-cols { display: grid; grid-template-columns: 1fr 1.2fr; gap: 20px; }
.parts { display: flex; flex-direction: column; gap: 8px; }
.part { display: grid; grid-template-columns: 170px 1fr; gap: 4px 12px; align-items: center; font-size: 14px; }
.part-name { font-weight: 600; }
.part-bar { height: 10px; background: #0f141b; border-radius: 5px; overflow: hidden; }
.part-bar div { height: 100%; border-radius: 5px; }
.part-text { grid-column: 2; color: var(--muted); font-size: 13px; }
.notes { padding-left: 18px; line-height: 1.5; font-size: 14px; }
.charts { display: flex; flex-direction: column; gap: 10px; }
.charts canvas { width: 100%; height: 200px; background: #0f141b; border-radius: 10px; }

#touchbar { position: fixed; left: 0; right: 0; bottom: 0; display: flex; gap: 6px; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); justify-content: center; flex-wrap: wrap; z-index: 5; pointer-events: none; }
#touchbar button { pointer-events: auto; padding: 11px 14px; font-size: 14px; background: rgba(23,30,40,0.8); border-color: rgba(255,255,255,0.22); min-height: 44px; white-space: nowrap; }
#touchbar button.active { border-color: #ffd166; color: #ffd166; }
#touchbar button.primary { color: #04111f; }
#touchbar.hidden { display: none; }
@media (max-width: 600px), (max-height: 500px) { #touchbar { gap: 4px; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); } #touchbar button { padding: 7px 9px; font-size: 12px; min-height: 34px; border-radius: 6px; } }

/* Einsatzort: Link zurück, Startschirm «Wer fliegt?», Name im Menü, Version und Ersteller (config.js, version.js) */
.zurueck { display: inline-block; color: var(--muted); text-decoration: none; font-size: 14px; margin-bottom: 10px; }
.zurueck:hover, .zurueck:focus-visible { color: var(--text); }
.pilot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.pilot b { color: var(--text); }
button.link { background: none; border: 0; border-radius: 0; padding: 0; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.card.narrow { width: min(560px, 100%); }
#wer h1 { margin-bottom: 12px; }
#wer .lead { line-height: 1.5; margin: 0 0 18px; }
#wer label { display: block; font-weight: 600; margin-bottom: 6px; }
#wer input { font-size: 17px; padding: 10px 12px; }
#wer .actions { margin-top: 18px; }
.hinweis { color: var(--muted); font-size: 13px; margin: 8px 0 0; }
.hinweis.quer { display: none; }
@media (orientation: portrait) and (max-width: 600px) { .hinweis.quer { display: block; } }
.about { color: var(--muted); font-size: 12px; margin: 16px 0 0; }
/* Absender Free-Bird (app.js App.absender): Signet negativ 60 px breit (Guide: mindestens 48 px), Freiraum rundherum,
   Logo nicht umfärben; nur der Firmenname im Text ist fett. Signet und Text sind zusammen ein Link auf free-bird.ch:
   ohne Unterstrich, beim Zeigen oder Fokus wird der Firmenname gold (#C8A04A, Gold auf dunklem Grund laut Guide). */
.absender { color: var(--muted); font-size: 12px; margin: 14px 0 0; }
.absender, .absender a { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.absender a { color: inherit; text-decoration: none; padding: 4px 0; border-radius: 6px; }
.absender a:hover span, .absender a:focus-visible span { text-decoration: underline; text-underline-offset: 3px; }
.absender a:hover b, .absender a:focus-visible b { color: #C8A04A; }
.absender a:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.absender svg { display: block; width: 60px; height: auto; flex: none; }
.absender b { color: var(--text); font-weight: 600; }
.db-wer { color: var(--muted); font-size: 14px; margin-top: 2px; }

/* Steuergeräte (gamepad.js) */
.g-zeile { display: grid; grid-template-columns: 1fr 90px auto; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.g-name small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; overflow-wrap: anywhere; }
.g-name small.lernt { color: var(--warn); }
.g-balken { position: relative; height: 10px; background: #0f141b; border: 1px solid var(--border); border-radius: 5px; overflow: hidden; }
.g-balken.mitte::after { content: ''; position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--muted); }
.g-balken i { position: absolute; top: 0; bottom: 0; left: 0; width: 0; background: var(--accent); }
.g-licht { width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--border); background: #0f141b; justify-self: center; }
.g-licht.an { background: var(--ok); border-color: var(--ok); }
.g-tun { display: flex; align-items: center; gap: 6px; }
.g-tun button { padding: 5px 10px; font-size: 13px; }
.g-um { font-size: 12px; color: var(--muted); white-space: nowrap; }
button.g-weg { padding: 5px 9px; }
.g-tun .aus { visibility: hidden; }
.g-geraet { margin: 8px 0 12px; font-size: 12px; }
.g-gname { color: var(--text); margin-bottom: 4px; overflow-wrap: anywhere; }
.g-rzeile { display: grid; grid-template-columns: 60px 1fr 44px; align-items: center; gap: 8px; color: var(--muted); margin: 2px 0; }
.g-wert { text-align: right; font-variant-numeric: tabular-nums; }
.g-gedrueckt { color: var(--muted); margin-top: 4px; }
@media (max-width: 520px) { .g-zeile { grid-template-columns: 1fr 70px; } .g-tun { grid-column: 1 / -1; } }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: var(--card2); border: 1px solid var(--accent); padding: 10px 16px; border-radius: 10px; opacity: 0; transition: all 0.25s; z-index: 30; pointer-events: none; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 820px) {
  .menu-cols, .db-cols { grid-template-columns: 1fr; }
  .scenario-list { max-height: 34vh; }
  .card { padding: 14px; }
  .part { grid-template-columns: 1fr; }
  .part-text { grid-column: 1; }
}
