/* EventRace Cockpit - iPad quer, Touch (Kacheln mind. 118 px) */
:root {
  color-scheme: dark;
  --bg: #0D1013; --bar: #111519; --surface: #151A1F; --surface-2: #1B2128; --line: #27303A; --line-2: #3A4450;
  --text: #EEF1F3; --muted: #8995A1; --soft: #A3AEB9; --soft-2: #CDD4DB;
  --green: #2BD46A; --yellow: #FFC400; --red: #E0312B; --purple: #B35CFF; --sel: #1F2A35; --sel-line: #3E5A74;
  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --body: "Barlow", "Helvetica Neue", Helvetica, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--text); font-family: var(--body); }
body { overscroll-behavior: none; -webkit-user-select: none; user-select: none; }
input, textarea { -webkit-user-select: text; user-select: text; }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
button:disabled { opacity: .45; cursor: default; }
.num { font-variant-numeric: tabular-nums; }
.lbl { font-size: 13px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
h1.title { margin: 0; font-family: var(--display); font-size: 34px; font-weight: 800; }

/* Login */
.login { max-width: 380px; margin: 14vh auto; padding: 0 16px; display: flex; flex-direction: column; gap: 12px; }
.login input { height: 64px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font-size: 30px; letter-spacing: .3em; text-align: center; }
.login button { height: 64px; border-radius: 12px; border: 0; background: var(--green); color: var(--bg); font-size: 20px; font-weight: 800; }
.err { color: #FF8A80; margin: 0; }

/* Rahmen */
.app { height: 100%; display: grid; grid-template-rows: 64px 1fr; grid-template-columns: 236px 1fr; padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0); }
.bar { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; padding: 0 18px; border-bottom: 1px solid var(--line); background: var(--bar); min-width: 0; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 800; font-size: 24px; white-space: nowrap; }
.brand b { color: var(--muted); font-weight: 600; }
.flag { width: 30px; height: 30px; border-radius: 4px; background: conic-gradient(var(--text) 25%, var(--bg) 0 50%, var(--text) 0 75%, var(--bg) 0) 0 0 / 15px 15px; flex: none; }
.event-line { flex-grow: 1; min-width: 0; font-size: 16px; color: #B7C0C9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px; border-radius: 22px; background: var(--surface); border: 1px solid var(--line); font-size: 15px; font-weight: 600; white-space: nowrap; }
.chip i { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.chip.ok i { background: var(--green); }
.chip.warn i { background: var(--yellow); }
.chip.bad i { background: var(--red); animation: pulse 1s steps(2, jump-none) infinite; }
.chip.fcy { background: var(--yellow); color: var(--bg); border-color: var(--yellow); }
.chip.stop { background: var(--red); color: #fff; border-color: var(--red); }
.chip.fcy i, .chip.stop i { background: currentColor; }
.chip.btn { color: var(--text); }
.icon-btn { width: 44px; height: 44px; border-radius: 22px; background: var(--surface); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; flex: none; }
@keyframes pulse { 50% { opacity: .3; } }

.steps { display: flex; flex-direction: column; gap: 8px; padding: 18px 14px; border-right: 1px solid var(--line); background: var(--bar); overflow: auto; }
.step { display: flex; align-items: center; gap: 12px; min-height: 84px; padding: 10px 12px; border-radius: 10px; text-align: left; background: transparent; border: 1px solid transparent; }
.step.on { background: var(--sel); border-color: var(--sel-line); }
.step .dot { flex: none; width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 17px; background: var(--line); color: var(--soft); }
.step.on .dot { background: var(--text); color: var(--bg); }
.step.done .dot { background: var(--green); color: var(--bg); }
.step .t { display: block; font-size: 18px; font-weight: 700; }
.step .s { display: block; font-size: 14px; color: var(--soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.view { min-width: 0; min-height: 0; overflow: auto; padding: 20px 22px 110px; -webkit-overflow-scrolling: touch; }

/* Karten */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.pad { padding: 14px 16px; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 18px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.wrap-row { display: flex; flex-wrap: wrap; gap: 12px; }

/* Buttons */
.btn-main { min-height: 96px; border-radius: 12px; border: 0; background: var(--green); color: var(--bg); font-size: 22px; font-weight: 800; padding: 0 24px; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 4px; text-align: left; }
.btn-main small { font-size: 16px; font-weight: 600; opacity: .8; }
.btn-sec { min-height: 64px; min-width: 118px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line-2); font-size: 17px; font-weight: 600; padding: 0 18px; }
.btn-sec.small { min-height: 52px; font-size: 16px; }
.btn-danger { border-color: var(--red); }
.tile { width: 118px; height: 118px; border-radius: 12px; background: var(--surface-2); border: 3px solid var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 4px; text-align: center; }
.tile b { font-family: var(--display); font-size: 30px; font-weight: 800; line-height: 1; }
.tile span { font-size: 14px; color: var(--soft); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile em { font-style: normal; font-size: 13px; color: var(--yellow); }
.tile.light { background: var(--text); color: var(--bg); border-color: var(--text); }
.tile.light span { color: #4A5560; }
.tile.dashed { background: var(--surface); border: 1px dashed var(--line-2); }
.tile.picked { background: var(--text); color: var(--bg); border-color: var(--yellow); }
.tile.picked span, .tile.picked em { color: var(--bg); }
.tile.wide { width: 148px; align-items: flex-start; justify-content: space-between; text-align: left; padding: 14px; }
.tile.wide b { font-family: var(--body); font-size: 18px; font-weight: 700; line-height: 1.15; }

/* Jetzt */
.now-head { display: flex; align-items: center; gap: 14px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.now-head .no { font-family: var(--display); font-size: 32px; font-weight: 800; line-height: 1; }
.pill { font-size: 14px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; padding: 5px 12px; border-radius: 6px; border: 1px solid var(--line); color: var(--muted); }
.pill.ready { border-color: var(--yellow); color: var(--yellow); }
.pill.active { background: var(--red); border-color: var(--red); color: #fff; }
.pill.complete { background: var(--text); border-color: var(--text); color: var(--bg); }
.pill.fcy { background: var(--yellow); border-color: var(--yellow); color: var(--bg); }
.now-head .meta { margin-left: auto; text-align: right; }
.now-head .meta b { display: block; font-family: var(--display); font-size: 30px; font-weight: 700; line-height: 1; }
.lanes { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; }
.lrow { display: grid; grid-template-columns: 52px 40px minmax(0, 1fr) 96px 84px 84px; align-items: center; gap: 10px; min-height: 76px; border-radius: 10px; background: var(--surface-2); overflow: hidden; }
.lrow.empty { opacity: .45; }
.lrow.fin { background: #1C2622; }
.lrow .ln { align-self: stretch; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.lrow .ln small { font-size: 11px; font-weight: 700; letter-spacing: .1em; opacity: .75; }
.lrow .ln b { font-family: var(--display); font-size: 34px; font-weight: 800; line-height: 1; }
.lrow .pos { font-family: var(--display); font-size: 34px; font-weight: 800; text-align: center; }
.lrow .who { min-width: 0; }
.lrow .who b { display: block; font-family: var(--display); font-size: 26px; font-weight: 800; line-height: 1; }
.lrow .who span { font-size: 15px; color: var(--soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.lrow .laps { font-size: 18px; font-weight: 700; white-space: nowrap; }
.bar-bg { height: 6px; border-radius: 3px; background: var(--line); margin-top: 6px; overflow: hidden; }
.bar-bg i { display: block; height: 100%; }
.lrow .v { text-align: right; }
.lrow .v small { display: block; font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: .06em; }
.lrow .v b { font-size: 19px; font-weight: 700; white-space: nowrap; }
.lrow .v:last-child { padding-right: 12px; }
.t-fl { color: var(--purple); }
.fixrow { display: flex; flex-wrap: wrap; gap: 10px; padding: 0 0 4px 62px; align-items: center; }
.fixrow span { color: var(--yellow); font-size: 14px; }
.now-foot { padding: 14px 16px 16px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.now-foot .btn-sec { flex: none; }
.now-foot .txt { flex-grow: 1; font-size: 15px; color: var(--soft); line-height: 1.4; }
.now-foot .txt b { display: block; font-size: 20px; color: var(--text); margin-bottom: 4px; }
.hold { position: relative; overflow: hidden; flex: none; width: 190px; min-height: 72px; border-radius: 12px; background: var(--surface-2); border: 2px solid var(--red); color: #fff; font-size: 17px; font-weight: 700; }
.hold i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--red); }
.hold span { position: relative; }
.idle { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 60px 30px; text-align: center; }
.idle h2 { margin: 0; font-family: var(--display); font-size: 34px; }
.idle p { margin: 0; font-size: 17px; color: var(--soft); max-width: 460px; line-height: 1.4; }

/* Assistent und Listen */
.hint { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 15px; line-height: 1.35; text-align: left; border: 0; width: 100%; }
.hint i { flex: none; width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; background: var(--muted); }
.hint.warn { background: #2A2410; } .hint.warn i { background: var(--yellow); animation: pulse 1s steps(2, jump-none) infinite; }
.hint.bad { background: #2A1414; } .hint.bad i { background: var(--red); }
.hint.good i { background: var(--green); }
.hint.info i { background: var(--yellow); }
.minilanes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-top: 10px; }
.minilanes div { display: flex; align-items: center; gap: 8px; height: 40px; border-radius: 8px; background: var(--surface-2); overflow: hidden; font-weight: 700; }
.minilanes b { align-self: stretch; width: 30px; display: flex; align-items: center; justify-content: center; }
.queue { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; }
.queue div { display: flex; gap: 10px; min-height: 34px; align-items: center; font-size: 15px; color: var(--soft-2); }
.queue b { width: 34px; color: var(--muted); }

/* Rennplan */
.ptable { overflow: hidden; }
.prow { width: 100%; display: grid; grid-template-columns: 90px repeat(4, minmax(0, 1fr)) 130px; align-items: center; min-height: 56px; padding: 0 16px; background: transparent; border: 0; border-bottom: 1px solid #1F262D; text-align: left; font-size: 17px; }
.prow.head { min-height: 40px; font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); border-bottom-color: var(--line); }
.prow.sel { background: var(--sel); }
.prow.old { color: var(--muted); }
.prow .c { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.prow .c i { width: 6px; height: 22px; border-radius: 2px; }
.prow .st { text-align: right; font-size: 14px; font-weight: 700; }
.slots { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.slot { height: 118px; border-radius: 12px; border: 3px solid var(--line); background: var(--surface-2); padding: 0; overflow: hidden; display: flex; flex-direction: column; text-align: left; }
.slot.target { border-color: var(--yellow); }
.slot .h { height: 30px; display: flex; align-items: center; padding: 0 12px; font-weight: 800; font-size: 15px; letter-spacing: .08em; }
.slot .b { flex-grow: 1; display: flex; flex-direction: column; justify-content: center; padding: 0 12px; }
.slot .b b { font-family: var(--display); font-size: 28px; font-weight: 800; line-height: 1; }
.slot .b span { font-size: 14px; color: var(--soft); }
.slot .b b.free { color: #5C6773; }

/* Formulare */
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; color: #B7C0C9; }
.form input, .search { height: 52px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text); font-size: 18px; padding: 0 14px; font-family: inherit; }
.form .full { grid-column: 1 / -1; }
.search { width: 320px; }

/* Rueckmeldung und Sheet */
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); display: flex; align-items: center; gap: 16px; padding: 10px 10px 10px 20px; border-radius: 14px; background: var(--text); color: var(--bg); box-shadow: 0 10px 30px rgba(0, 0, 0, .5); font-size: 17px; font-weight: 600; max-width: calc(100% - 32px); z-index: 30; }
.toast.error { background: #FFB4AB; }
.toast button { height: 52px; min-width: 118px; border-radius: 10px; background: var(--bg); border: 0; color: var(--text); font-size: 16px; font-weight: 700; }
.sheet-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); display: flex; align-items: center; justify-content: center; z-index: 20; padding: 16px; }
.sheet { background: var(--surface); border: 1px solid var(--line-2); border-radius: 16px; padding: 20px 22px; width: min(720px, 100%); max-height: 90vh; overflow: auto; display: flex; flex-direction: column; gap: 16px; }
.sheet h2 { margin: 0; font-family: var(--display); font-size: 28px; }
.sheet p { margin: 0; color: var(--soft); font-size: 16px; line-height: 1.4; }
.sheet .actions { display: flex; gap: 12px; justify-content: flex-end; flex-wrap: wrap; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media (max-width: 1000px) {
  .app { grid-template-columns: 1fr; grid-template-rows: 64px auto 1fr; }
  .steps { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px; }
  .step { min-height: 56px; flex: none; }
  .step .s { display: none; }
  .cols { grid-template-columns: 1fr; }
  .event-line { display: none; }
  .lrow { grid-template-columns: 48px 44px minmax(0, 1fr) 110px 90px; }
  .lrow .v:last-child { display: none; }
  .prow { grid-template-columns: 60px repeat(4, minmax(0, 1fr)) 80px; font-size: 15px; }
}
