/* Conseils de classe – gemeinsames Stylesheet für alle Seiten */

:root {
  --orange: #e8591f;
  --orange-dark: #b9420f;
  --orange-soft: #fff1ea;
  --ink: #1d1a17;
  --ink-2: #5b544d;
  --line: #e4ddd6;
  --bg: #f6f3f0;
  --card: #ffffff;
  --ok: #1f8a4c;
  --ok-soft: #e7f5ec;
  --warn: #b26a00;
  --warn-soft: #fff4dc;
  --bad: #c62828;
  --bad-soft: #fdeaea;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 14px rgba(0,0,0,.05);
  --g7: #2f6fd6; --g6: #0f8f8a; --g5: #5aa63a; --g4: #c9a000; --g3: #e07b1a; --g2: #d23b3b; --g1: #8a49c9; --g0: #6f6a65;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.4;
}
[hidden] { display: none !important; }
button { font: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
a { color: var(--orange-dark); }
small, .hint { color: var(--ink-2); }
.hint { font-size: .92rem; margin: .4rem 0; }
h2 { font-size: 1.1rem; margin: 0 0 .6rem; }
h3 { font-size: 1rem; margin: 0; }

/* ---------- Kopfzeile ---------- */
.top-sticky { position: sticky; top: 0; z-index: 20; }
.top-sticky .topbar { position: static; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: .6rem;
  padding: .6rem 1rem; padding-top: max(.6rem, env(safe-area-inset-top));
  background: var(--ink); color: #fff;
}
.brand { font-weight: 700; letter-spacing: .2px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand small { color: #c9c1b9; font-weight: 500; margin-left: .3rem; }

/* ---------- Verbindungsstatus ---------- */
.status {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .85rem; font-weight: 600; padding: .25rem .6rem; border-radius: 999px;
  background: #3a3430; color: #fff; white-space: nowrap;
}
.status::before { content: ""; width: .6rem; height: .6rem; border-radius: 50%; background: #999; }
.status.live::before { background: #36d07a; box-shadow: 0 0 0 3px rgba(54,208,122,.25); }
.status.connecting::before { background: #ffb020; animation: blink 1s infinite; }
.status.degraded::before { background: #ffb020; }
.status.offline { background: var(--bad); }
.status.offline::before { background: #fff; }
@keyframes blink { 50% { opacity: .25; } }

/* ---------- Banner ---------- */
.banner { padding: .6rem 1rem; font-weight: 600; text-align: center; }
.banner.test { background: repeating-linear-gradient(45deg, #ffe08a, #ffe08a 12px, #ffd25c 12px, #ffd25c 24px); color: #4a3800; }
.banner.update { background: #1f4e9c; color: #fff; }
.banner.update button { background: none; border: 0; color: inherit; font-weight: 700; text-decoration: underline; }
.banner.offline { background: var(--bad); color: #fff; }
.banner.warn { background: var(--warn-soft); color: #5a3a00; border-bottom: 1px solid #f0d9a8; }

/* ---------- Grundlayout ---------- */
main { max-width: 720px; margin: 0 auto; padding: 1rem; padding-bottom: calc(2rem + env(safe-area-inset-bottom)); }
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1rem; margin-bottom: 1rem;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  border: 0; border-radius: 10px; padding: .7rem 1rem; font-weight: 700;
  background: var(--orange); color: #fff; min-height: 44px;
}
.btn.secondary { background: #ece6e0; color: var(--ink); }
.btn.ghost { background: transparent; color: var(--orange-dark); border: 2px solid var(--orange); }
.btn.danger { background: var(--bad); }
.btn.block { width: 100%; }
.row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.msg { padding: .6rem .8rem; border-radius: 10px; margin: .5rem 0; font-weight: 600; }
.msg.ok { background: var(--ok-soft); color: var(--ok); }
.msg.warn { background: var(--warn-soft); color: var(--warn); }
.msg.bad { background: var(--bad-soft); color: var(--bad); }
.msg.info { background: #eef3fb; color: #1f4e9c; }

/* Schalter */
.toggle { display: flex; align-items: center; gap: .7rem; padding: .5rem 0; cursor: pointer; font-weight: 600; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle .knob { flex: none; width: 48px; height: 28px; border-radius: 999px; background: #cfc7bf; position: relative; transition: background .15s; }
.toggle .knob::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.toggle input:checked + .knob { background: var(--ok); }
.toggle input:checked + .knob::after { transform: translateX(20px); }
.toggle input:focus-visible + .knob { outline: 3px solid var(--orange); outline-offset: 2px; }
.toggle input:disabled + .knob { opacity: .5; }

/* ======================================================================
   Lehrer-App
   ====================================================================== */
.now { text-align: center; border: 3px solid var(--orange); }
.now-label { text-transform: uppercase; letter-spacing: .12em; font-size: .8rem; font-weight: 800; color: var(--orange-dark); }
.now-day { color: var(--ink-2); font-size: .9rem; margin-top: .15rem; }
.now-item { font-size: clamp(2.6rem, 14vw, 4.2rem); font-weight: 800; color: var(--orange); line-height: 1.05; margin: .3rem 0; word-break: break-word; }
.now-item.idle { font-size: 1.5rem; color: var(--ink-2); font-weight: 700; padding: .6rem 0; }
.now-item.pause { color: var(--ink); }
.now-meta { color: var(--ink-2); font-size: .95rem; min-height: 1.3em; }
.now-meta .late { color: var(--warn); font-weight: 700; }
.now-neighbours { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-top: .8rem; }
.nb { background: var(--bg); border-radius: 10px; padding: .45rem .6rem; font-size: .9rem; text-align: left; }
.nb b { display: block; font-size: 1.05rem; }
.nb.empty { opacity: .45; }
.now.mine-now { animation: minepulse 1.6s ease-in-out infinite; }
@keyframes minepulse { 0%,100% { box-shadow: 0 0 0 0 rgba(232,89,31,.45); } 50% { box-shadow: 0 0 0 10px rgba(232,89,31,0); } }

.sticky {
  position: sticky; top: 52px; z-index: 15;
  display: flex; align-items: center; gap: .6rem; justify-content: space-between;
  background: var(--orange); color: #fff; padding: .55rem 1rem; font-weight: 700;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.sticky .s-item { font-size: 1.25rem; }
.sticky.mine-now { background: var(--ok); animation: blink-soft 1.2s infinite; }
/* Keine Verbindung: alte Anzeige sichtbar „ausgegraut", damit niemand ihr blind vertraut */
body.is-offline .now { filter: grayscale(1); opacity: .65; animation: none; }
body.is-offline .sticky { background: #7d7670; animation: none; }
@keyframes blink-soft { 50% { filter: brightness(1.18); } }

.mine-list { list-style: none; margin: 0; padding: 0; }
.mine-list li { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.mine-list li:last-child { border-bottom: 0; }
.mine-list .m-code { font-weight: 800; font-size: 1.1rem; }
.mine-list .m-when { color: var(--ink-2); font-size: .88rem; }
.mine-list .m-state { font-weight: 700; font-size: .9rem; text-align: right; }
.m-state.now { color: #fff; background: var(--ok); padding: .2rem .55rem; border-radius: 999px; }
.m-state.soon { color: var(--orange-dark); }
.m-state.past { color: #9a928b; font-weight: 600; }
.mine-list li.past { opacity: .6; }

.push-state { display: flex; gap: .7rem; align-items: flex-start; padding: .7rem; border-radius: 10px; margin-bottom: .6rem; }
.push-state .icon { font-size: 1.5rem; line-height: 1; }
.push-state.on { background: var(--ok-soft); }
.push-state.off { background: var(--warn-soft); }
.push-state.bad { background: var(--bad-soft); }
.push-state.info { background: #eef3fb; }
.push-state p { margin: .15rem 0 0; font-size: .92rem; }
.steps { margin: .4rem 0 0; padding-left: 1.3rem; }
.steps li { margin: .3rem 0; }

.day { margin-top: 1rem; }
.day:first-child { margin-top: 0; }
.day-head { display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; padding-bottom: .35rem; border-bottom: 2px solid var(--line); margin-bottom: .55rem; }
.day-head .tag { font-size: .72rem; font-weight: 800; text-transform: uppercase; background: var(--orange); color: #fff; border-radius: 6px; padding: .1rem .4rem; }
.day-note { font-size: .85rem; color: var(--ink-2); margin: -.2rem 0 .5rem; }
.chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.chip-gap { flex-basis: 100%; height: 0; border-top: 1px dashed var(--line); margin: .15rem 0; }
.chip {
  position: relative; display: inline-flex; flex-direction: column; align-items: flex-start;
  min-width: 5.6rem; padding: .45rem 1.9rem .45rem .7rem; border-radius: 10px;
  background: #fff; border: 2px solid var(--line); cursor: pointer; user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip .c-code { font-weight: 800; font-size: 1rem; }
.chip .c-time { font-size: .8rem; color: var(--ink-2); }
.chip .c-box { position: absolute; right: .5rem; top: 50%; transform: translateY(-50%); width: 1.1rem; height: 1.1rem; border: 2px solid #b9b0a8; border-radius: 5px; background: #fff; }
.chip input:checked ~ .c-box { background: var(--ok); border-color: var(--ok); }
.chip input:checked ~ .c-box::after { content: "✓"; color: #fff; font-size: .8rem; font-weight: 900; position: absolute; inset: 0; display: grid; place-items: center; }
.chip:has(input:checked) { border-color: var(--ok); background: var(--ok-soft); }
.chip input:focus-visible ~ .c-box { outline: 3px solid var(--orange); outline-offset: 2px; }
/* Aktive Klasse: nur Rahmen + Symbol, KEIN voller Hintergrund (sonst sieht die Auswahl gesperrt aus) */
.chip.active, .chip.active:has(input:checked) { border-color: var(--orange); border-width: 3px; box-shadow: 0 0 0 3px rgba(232,89,31,.18); }
.chip.active .c-code::after { content: " ▶"; color: var(--orange); }
.chip.event .c-code { font-style: italic; font-weight: 700; }
.chip.past-item { opacity: .55; }

details.card > summary { font-weight: 700; cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after { content: "▾"; color: var(--ink-2); transition: transform .15s; }
details.card[open] > summary::after { transform: rotate(180deg); }
details.card[open] > summary { margin-bottom: .7rem; }
.tabs { display: flex; gap: .4rem; margin-bottom: .6rem; }
.tabs button { flex: 1; border: 2px solid var(--line); background: #fff; border-radius: 10px; padding: .5rem; font-weight: 700; }
.tabs button[aria-selected="true"] { border-color: var(--orange); background: var(--orange-soft); }

footer.foot { text-align: center; color: #9a928b; font-size: .8rem; padding: 0 1rem 2rem; }

/* Spiel */
.game-wrap { position: relative; }
#game { display: block; width: 100%; max-width: 480px; margin: 0 auto; aspect-ratio: 3 / 4; background: #233127; border-radius: 12px; touch-action: none; }
.game-bar { display: flex; justify-content: space-between; max-width: 480px; margin: .5rem auto 0; font-size: .9rem; color: var(--ink-2); }

/* ======================================================================
   Konferenz-Monitor
   ====================================================================== */
body.page-konferenz { background: #111; color: #fff; overflow: hidden; height: 100vh; cursor: none; }
body.page-konferenz.show-cursor { cursor: default; }
.k-wrap { display: grid; grid-template-rows: auto 1fr auto; height: 100vh; }
.k-top { display: flex; justify-content: space-between; align-items: center; padding: 1.2vh 2.5vw; font-size: 2.6vh; color: #cfc7bf; gap: 2vw; }
.k-top .k-day { font-weight: 700; color: #fff; }
.k-top .k-clock { font-variant-numeric: tabular-nums; font-weight: 700; color: #fff; font-size: 3.4vh; }
.k-main { width: 100%; max-width: none; margin: 0; padding: 0 2vw; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 2vh; }
.k-side { font-size: 4.2vh; color: #9d958e; font-weight: 600; min-height: 5vh; }
.k-side b { color: #e5ded7; }
.k-side.empty { opacity: .35; }
.k-label { font-size: 3vh; text-transform: uppercase; letter-spacing: .25em; color: var(--orange); font-weight: 800; }
.k-item { font-size: min(26vh, 22vw); font-weight: 900; color: var(--orange); line-height: 1; letter-spacing: -.01em; }
.k-item.long { font-size: min(14vh, 9vw); }
.k-item.idle { font-size: min(9vh, 7vw); color: #cfc7bf; font-weight: 700; }
.k-item.pause { color: #fff; }
.k-meta { font-size: 3.4vh; color: #cfc7bf; }
.k-meta .late { color: #ffb020; font-weight: 700; }
.k-foot { display: flex; align-items: center; justify-content: center; gap: 2vw; padding: 1.5vh 2vw 2.5vh; font-size: 2.4vh; color: #b5ada6; }
.k-foot .qr { background: #fff; padding: .8vh; border-radius: 1vh; line-height: 0; }
.k-foot .qr svg { width: 13vh; height: 13vh; }
.k-foot b { color: #fff; }
.k-offline { position: fixed; inset: auto 0 0 0; background: var(--bad); color: #fff; text-align: center; font-size: 3.4vh; font-weight: 800; padding: 1.4vh; z-index: 30; }
.k-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.88); display: grid; place-items: center; z-index: 40; cursor: default; }
.k-overlay button { font-size: 4vh; padding: 2.5vh 5vw; border-radius: 2vh; border: 0; background: var(--orange); color: #fff; font-weight: 800; }
.k-overlay small { display: block; font-size: 2.2vh; font-weight: 500; margin-top: .8vh; }
.k-flash { animation: kflash 1.2s ease-out 1; }
@keyframes kflash { 0% { background: rgba(232,89,31,.45); } 100% { background: transparent; } }
.k-wrap .status { font-size: 2vh; }

/* ======================================================================
   Direktioun
   ====================================================================== */
body.page-direktioun main { max-width: 1100px; }
.nav-tabs { display: flex; gap: .3rem; }
.nav-tabs button { background: transparent; border: 0; color: #cfc7bf; font-weight: 700; padding: .35rem .6rem; border-radius: 8px; }
.nav-tabs button[aria-selected="true"] { background: #3a3430; color: #fff; }
.d-status { display: grid; grid-template-columns: 1fr auto; gap: .4rem 1rem; align-items: center; }
.d-now { font-size: 1.15rem; }
.d-now b { font-size: 1.6rem; color: var(--orange); }
.d-counts { font-size: .9rem; color: var(--ink-2); text-align: right; }
.d-result { grid-column: 1 / -1; }
.d-actions { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: .6rem; margin-bottom: 1rem; }
.d-actions button { border: 0; border-radius: 12px; padding: .9rem .6rem; font-weight: 800; font-size: 1.05rem; min-height: 72px; background: #ece6e0; color: var(--ink); }
.d-actions button small { display: block; font-weight: 600; font-size: .8rem; color: inherit; opacity: .85; }
.d-actions .a-next { background: var(--orange); color: #fff; font-size: 1.35rem; }
.d-actions .a-pause { background: var(--ink); color: #fff; }
.d-actions .a-undo { background: #fff; border: 2px solid var(--line); }
.d-actions .a-end { background: #fff; border: 2px solid var(--line); }
.d-actions button.pending { animation: blink 0.8s infinite; }
.day-tabs { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .4rem; margin-bottom: .6rem; scrollbar-width: thin; }
.day-tabs button { flex: none; border: 2px solid var(--line); background: #fff; border-radius: 10px; padding: .45rem .7rem; font-weight: 700; font-size: .9rem; }
.day-tabs button[aria-selected="true"] { border-color: var(--ink); background: var(--ink); color: #fff; }
.day-tabs button .dot { display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; background: var(--orange); margin-left: .35rem; vertical-align: middle; }
.d-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; }
.d-break { grid-column: 1 / -1; display: flex; align-items: center; gap: .6rem; color: var(--ink-2); font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.d-break::before, .d-break::after { content: ""; flex: 1; border-top: 2px dashed var(--line); }
.d-note { grid-column: 1 / -1; color: var(--ink-2); font-size: .9rem; }
.cls {
  position: relative; border: 0; border-radius: 12px; padding: .9rem .7rem; min-height: 84px;
  color: #fff; font-weight: 800; font-size: 1.35rem; text-align: left; display: flex; flex-direction: column; justify-content: center;
  border-left: 10px solid rgba(0,0,0,.18);
}
.cls small { font-weight: 600; font-size: .85rem; opacity: .95; color: inherit; }
.cls.g7 { background: var(--g7); } .cls.g6 { background: var(--g6); } .cls.g5 { background: var(--g5); }
.cls.g4 { background: var(--g4); color: #2b2200; } .cls.g3 { background: var(--g3); } .cls.g2 { background: var(--g2); }
.cls.g1 { background: var(--g1); } .cls.g0 { background: var(--g0); }
.cls.event { font-style: italic; font-size: 1.05rem; }
.cls.done { opacity: .45; }
.cls.done::after { content: "✓"; position: absolute; right: .6rem; top: .4rem; font-size: 1rem; }
.cls.current { outline: 5px solid var(--ink); outline-offset: 3px; }
.cls.current::after { content: "▶ ELO"; position: absolute; right: .5rem; top: .4rem; font-size: .75rem; background: var(--ink); color: #fff; padding: .15rem .4rem; border-radius: 6px; }
.cls.pending { animation: blink .8s infinite; }
.d-error { position: sticky; bottom: 0; z-index: 25; background: var(--bad); color: #fff; padding: .9rem 1rem; border-radius: 12px; display: flex; gap: .8rem; align-items: center; justify-content: space-between; font-weight: 700; box-shadow: 0 6px 20px rgba(0,0,0,.25); margin-top: 1rem; }
.d-error button { background: #fff; color: var(--bad); border: 0; border-radius: 10px; padding: .6rem .9rem; font-weight: 800; }
textarea.plan { width: 100%; min-height: 420px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9rem; padding: .7rem; border: 2px solid var(--line); border-radius: 10px; resize: vertical; }
.login { max-width: 420px; margin: 3rem auto; }
.login input[type=password] { width: 100%; padding: .8rem; font-size: 1.1rem; border: 2px solid var(--line); border-radius: 10px; margin: .4rem 0 .8rem; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; font-size: .92rem; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; font-weight: 600; word-break: break-word; }
.preview-days { font-size: .88rem; color: var(--ink-2); margin-top: .5rem; }
.preview-days li { margin: .15rem 0; }
@media (max-width: 700px) {
  .d-actions { grid-template-columns: 1fr 1fr; }
  .d-actions .a-next { grid-column: 1 / -1; }
  .d-status { grid-template-columns: 1fr; }
  .d-counts { text-align: left; }
  .d-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}

/* ======================================================================
   Aushang (Drucken)
   ====================================================================== */
body.page-aushang { background: #fff; }
.aushang { max-width: 780px; margin: 0 auto; padding: 2rem; }
.aushang h1 { font-size: 2.2rem; margin: 0 0 .3rem; }
.aushang .lead { font-size: 1.2rem; color: var(--ink-2); margin: 0 0 1.5rem; }
.aushang .qr-big { display: flex; gap: 2rem; align-items: center; margin-bottom: 1.5rem; }
.aushang .qr-big svg { width: 220px; height: 220px; flex: none; }
.aushang .url { font-size: 1.4rem; font-weight: 800; word-break: break-all; }
.aushang .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.aushang .cols h2 { font-size: 1.2rem; }
.aushang .note { margin-top: 1.5rem; padding: 1rem; border: 2px solid var(--orange); border-radius: 12px; }
.no-print { margin: 1rem auto; text-align: center; }
@media print {
  .no-print { display: none !important; }
  .aushang { padding: 0; }
  @page { size: A4; margin: 15mm; }
}
