/* anno-edu shared styles — HSG / Universität St.Gallen corporate design
   (colours + Gill Sans from official brand assets), matching the palette
   used across other HSG-branded tools in this workspace. */

:root {
  color-scheme: light;
  --bg: #f6f6f3;
  --card: #fff;
  --ink: #231f20;
  --muted: #6b6a66;
  --line: #e6e7e8;
  --accent: #00802f;
  --accent-2: #008e43;
  --accent-bg: #e8f1eb;
  --ok: #008e43;
  --ok-bg: #e8f1eb;
  --warn: #b3801f;
  --warn-bg: #fbf3e1;
  --bad: #ed1c24;
  --bad-bg: #fbe9ea;
  --logoh: 36px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Gill Sans MT", "Gill Sans", Calibri, "Segoe UI", system-ui, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  min-height: 100vh;
}

/* Sticky suite footer: header + stage + footer stacked, stage takes the slack. */
body { display: flex; flex-direction: column; }

.stage {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 22px 60px;
  display: flex;
  flex-direction: column;
  flex: 1 0 auto;
}

/* ---- HEADER / LOCKUP ----
   Kept byte-for-byte identical to the other HSG Support Tools (vocab-wordle,
   Maturaarbeit-Begleiter): a full-width bar, wordmark stacked over the suite/
   app labels, .sub indented to line up under «Universität St.Gallen» rather
   than the emblem. Only the app name in .apptitle differs per app. */
header.top { background: var(--card); border-bottom: 1px solid var(--line); padding: 12px 22px; display: flex; justify-content: space-between; align-items: center; }
.logo { height: var(--logoh); width: calc(var(--logoh) * 4.66); flex: 0 0 auto; display: block; }   /* explicit width (DE viewBox 466/100) — prevents flex 'stretch' from distorting the SVG */
html:not([lang='de']) .logo { width: calc(var(--logoh) * 4.81553); }   /* EN viewBox 496/103 */
.lockup { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: inherit; }
.lockup .sub { margin-left: calc(var(--logoh) * 1.1); }   /* left-align with the "U" of «Universität St.Gallen», not the emblem (DE logo k=1.1) */
html:not([lang='de']) .lockup .sub { margin-left: calc(var(--logoh) * 1.068); }   /* EN logo (non-German UI) viewBox h=103 → k=1.068 */
.suite { font-size: 14px; font-weight: 600; color: var(--ink); line-height: 1.2; }
.suite .sep { color: var(--muted); font-weight: 400; margin: 0 .45em; }
.apptitle { font-size: 12.5px; font-weight: 600; color: var(--accent); margin-top: 5px; line-height: 1.1; }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--accent); }
.top-right { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

/* Responsive language selector — suite-wide pattern.
   Desktop (>=561px): the pill sits inline as always (.lang-menu is layout-
   neutral via display:contents; the globe stays hidden). <=560px: the pill is
   hidden behind a compact globe button in the top header row; tapping it opens
   the SAME pill as a right-aligned dropdown card under the header. The globe +
   .lang-menu wrapper are injected by assets/i18n.js, so with JS off the bare
   pill simply stays inline (graceful degradation). */
.lang-globe { display: none; font: inherit; font-size: 17px; line-height: 1; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--ink); cursor: pointer; align-items: center; justify-content: center; flex: 0 0 auto; }
.lang-globe:hover, .lang-globe[aria-expanded='true'] { background: var(--accent-bg); }
.lang-menu { display: contents; }

@media (max-width: 560px) {
  header.top { position: relative; flex-wrap: nowrap; gap: 10px; }
  .lockup { flex: 1 1 auto; min-width: 0; }   /* lockup shrinks (suite line wraps) so the row never wraps under the logo */
  .lang-globe { display: inline-flex; }
  .lang-menu { display: none; position: absolute; top: calc(100% + 6px); right: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .14); padding: 6px; z-index: 100; }
  .lang-menu.open { display: block; }
  .lang-menu .lang-toggle { margin-right: 0; }
  .back-nav { display: none; }   /* real page navigation — the device back button covers it */
}

/* Language toggle — shared pill design with the Dashboard / Begleiter / Verteidigungs-Coach */
.lang-toggle { position: relative; display: inline-flex; align-items: center; background: #e2e8f0; border-radius: 999px; padding: 3px; margin-right: 8px; align-self: center; -webkit-user-select: none; user-select: none; }
.lang-toggle button { position: relative; z-index: 1; border: 0; background: transparent; color: #64748b; font-family: inherit; font-size: 11.5px; font-weight: 700; letter-spacing: .3px; width: 30px; padding: 4px 0; margin: 0; text-align: center; line-height: 1.3; cursor: pointer; transition: color .2s; }
.lang-toggle button.active { color: #fff; }
.lang-slider { position: absolute; top: 3px; bottom: 3px; left: 3px; width: 30px; background: var(--accent); border-radius: 999px; box-shadow: 0 1px 2px rgba(0,0,0,.15); transition: transform .22s ease; z-index: 0; }
.lang-toggle[data-lang='en'] .lang-slider { transform: translateX(30px); }
.lang-toggle[data-lang='fr'] .lang-slider { transform: translateX(60px); }
.lang-toggle[data-lang='it'] .lang-slider { transform: translateX(90px); }

.subtitle { font-size: 15px; color: var(--muted); margin: 4px 0 24px; }
.quiz-heading { font-size: 22px; font-weight: 600; color: var(--ink); text-align: center; line-height: 1.2; margin: 4px 0 2px; }

.screen { display: none; animation: fadeIn 0.35s ease; }
.screen.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ---- BUTTONS ---- */
.btn {
  font: inherit; font-weight: 600; font-size: 14px;
  background: var(--accent); color: #fff; border: 1px solid var(--accent);
  border-radius: 8px; padding: 11px 26px; cursor: pointer; transition: opacity 0.15s;
}
.btn:hover { opacity: 0.88; }
.btn:active { opacity: 0.75; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-center { display: block; margin: 0 auto; }
.btn-secondary { background: #fff; color: var(--accent); border: 1px solid var(--accent); }
.btn-small { padding: 6px 14px; font-size: 13px; border-radius: 6px; }
.btn-danger { color: var(--bad); border-color: var(--bad); background: #fff; }
.btn-danger:hover { background: var(--bad-bg); }

/* ---- FORMS (index.php, manage.php) ---- */
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 12.5px; color: var(--muted); font-weight: 600; margin-bottom: 5px; }
.field input, .field textarea, .field select {
  width: 100%; font: inherit; font-size: 14px; color: var(--ink);
  background: #fcfcfb; border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px;
}
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--accent); }
.field-row { display: flex; gap: 16px; }
.field-row .field { flex: 1; }
.hint { font-size: 13px; color: var(--muted); margin-top: 4px; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 18px 20px; margin: 0 0 20px;
}
.card-title { font-size: 11.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }

/* ---- CANDIDATE / QUESTION CARDS (manage.php) ---- */
.qcard { background: #fcfcfb; border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin-bottom: 12px; transition: background 0.4s, border-color 0.3s; }
.qcard.qcard-approved { border-color: var(--accent); background: var(--accent-bg); }
.qcard.qcard-flash { background: var(--accent-bg); }
.qcard-year { font-weight: 700; color: var(--accent); font-size: 13px; margin-bottom: 6px; }
.qcard-clue { font-size: 16px; font-weight: 500; margin-bottom: 6px; }
.qcard-info { font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.qcard-src { font-size: 11px; color: var(--muted); margin-bottom: 8px; }
.qcard-src a { color: var(--muted); }
.qcard-actions { display: flex; gap: 8px; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 18px; font-size: 13.5px; }
.flash-success { background: var(--ok-bg); color: #00461f; }
.flash-error { background: var(--bad-bg); color: var(--bad); }
.flash-info { background: #fdf6e3; color: #7a5c00; }

/* ---- GAME SCREEN ---- */
.round-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 20px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
/* Pips flex to fit the row, so a quiz with many rounds still fits on mobile:
   they share the available width and shrink (to a slim minimum) as the round
   count grows, instead of overflowing at a fixed 20px each. */
.round-pips { display: flex; gap: 4px; flex: 1 1 auto; min-width: 0; }
.pip { flex: 1 1 auto; min-width: 3px; max-width: 20px; height: 4px; border-radius: 2px; background: var(--line); transition: background 0.3s; }
.pip.done { background: var(--accent); }
.pip.current { background: var(--ink); }
.score-display { flex: 0 0 auto; white-space: nowrap; font-size: 12.5px; color: var(--muted); }
.score-display b { color: var(--ink); font-weight: 700; }

.event-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 36px 28px; margin-bottom: 32px; text-align: center; }
.event-stamp { display: inline-block; background: var(--accent-bg); color: var(--accent); border-radius: 20px; padding: 3px 12px; font-size: 11px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; margin-bottom: 16px; }
.event-text { font-size: clamp(20px, 4vw, 26px); line-height: 1.35; font-weight: 500; }

.year-display { text-align: center; margin: 4px 0 18px; }
.year-input { font-family: inherit; font-size: clamp(48px, 11vw, 76px); font-weight: 700; background: transparent; border: none; color: var(--ink); text-align: center; width: 5ch; padding: 0 4px; outline: none; border-bottom: 2px dashed var(--line); }
.year-input:focus { border-bottom-color: var(--accent); color: var(--accent); }
.year-suffix { font-size: 22px; color: var(--muted); margin-left: 0.2em; }

.slider { -webkit-appearance: none; appearance: none; width: 100%; height: 38px; background: transparent; cursor: grab; margin: 10px 0 22px; }
.slider::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: var(--line); }
.slider::-moz-range-track { height: 6px; border-radius: 3px; background: var(--line); }
.slider::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -7px; border-radius: 50%; background: var(--accent); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--accent); }
.slider::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: var(--accent); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--accent); }

.nudge-row { display: flex; justify-content: center; gap: 8px; margin-bottom: 24px; flex-wrap: wrap; }
.nudge { font: inherit; font-size: 13px; background: #fff; border: 1px solid var(--line); color: var(--muted); border-radius: 6px; padding: 6px 12px; cursor: pointer; }
.nudge:hover { border-color: var(--accent); color: var(--accent); }

/* ---- REVEAL ---- */
.reveal-eyebrow { text-align: center; font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.reveal-row { display: flex; align-items: center; justify-content: center; gap: 24px; margin: 20px 0; }
.reveal-col { text-align: center; }
.reveal-col .label { font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.reveal-col .year { font-size: 30px; font-weight: 700; }
.reveal-col.actual .year { color: var(--accent); }
.reveal-divider { color: var(--muted); font-style: italic; }
.reveal-score-block { text-align: center; margin-bottom: 18px; }
.reveal-score-block .delta { font-size: 14px; color: var(--muted); }
.reveal-score-block .points-earned { font-size: 38px; font-weight: 700; color: var(--accent); }
.reveal-score-block .verdict { font-size: 17px; font-weight: 600; }
.info-toggle { display: block; margin: 0 auto 16px; background: none; border: none; font-size: 12px; color: var(--muted); cursor: pointer; text-decoration: underline; }
.info-panel { display: none; font-size: 14px; color: var(--ink); background: #fcfcfb; border: 1px solid var(--line); border-radius: 8px; padding: 14px 18px; margin-bottom: 18px; }
.info-panel.open { display: block; }

/* ---- FINAL ---- */
.final-title { text-align: center; font-size: 20px; font-weight: 600; color: var(--accent); margin-bottom: 4px; }
.final-score { text-align: center; margin-bottom: 6px; }
.final-score .big { font-weight: 700; font-size: clamp(52px, 13vw, 78px); line-height: 1; }
.final-score .of { font-size: 12px; color: var(--muted); letter-spacing: 0.06em; }
.final-verdict { text-align: center; font-size: 18px; font-weight: 600; margin-bottom: 24px; }
.result-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.result-num { font-weight: 700; color: var(--accent); width: 24px; }
.result-body { flex: 1; }
.result-event { font-size: 14px; }
.result-meta { font-size: 11.5px; color: var(--muted); }
.result-meta .actual { color: var(--accent); font-weight: 600; }
.result-pts { font-weight: 700; }

/* ---- LEADERBOARD ---- */
.lb-title { text-align: center; font-size: 16px; font-weight: 600; margin: 24px 0 4px; }
.lb-count { text-align: center; font-size: 11.5px; color: var(--muted); margin-bottom: 12px; }
table.lb-table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.lb-table th, table.lb-table td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; }
table.lb-table th { font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
table.lb-table td.score { font-weight: 700; text-align: right; }
table.lb-table tr.me { background: var(--accent-bg); }

.qr-wrap { text-align: center; margin: 18px 0; }
.share-url { font-size: 12.5px; background: #fcfcfb; border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; word-break: break-all; text-align: center; margin-bottom: 14px; }

/* In-page tagline (bottom of .stage) — the app's own sign-off line above the suite footer */
.tagline { text-align: center; font-size: 11.5px; color: var(--muted); margin-top: 32px; }
.tagline a { color: var(--muted); }

/* ---- LIBRARY (library.php) ---- */
.lib-section { margin: 0 0 26px; }
.lib-cat { font-size: 13px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--accent); margin: 0 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.lib-card { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; text-decoration: none; color: inherit; transition: border-color .15s, box-shadow .15s, transform .15s; }
.lib-card:hover { border-color: var(--accent); box-shadow: 0 6px 18px rgba(0, 0, 0, .07); transform: translateY(-2px); }
.lib-card-title { font-size: 16px; font-weight: 600; color: var(--ink); line-height: 1.3; }
.lib-card-topic { font-size: 13px; color: var(--muted); margin-top: 4px; }
.lib-card-meta { font-size: 12.5px; color: var(--muted); margin-top: 10px; }
.lib-card-meta b { color: var(--ink); font-weight: 700; }
.lib-dot { margin: 0 6px; opacity: .6; }
.lib-play { margin-top: 12px; align-self: flex-start; font-size: 13px; font-weight: 600; color: var(--accent); }
.link-inline { color: var(--accent); font-weight: 600; text-decoration: none; }
.link-inline:hover { text-decoration: underline; }

/* Suite footer — shared with the Dashboard / Begleiter / Verteidigungs-Coach */
.site-footer { border-top: 1px solid var(--line); background: var(--card); padding: 18px 22px; text-align: center; font-size: 12.5px; color: var(--muted); }
.site-footer a { color: var(--accent); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.site-footer p { margin: 3px 0; }

/* --- draft-progress overlay (create.php runs 15-30s: staged progress per HCI) --- */
#draftOverlay{position:fixed;inset:0;background:rgba(35,31,32,.45);display:flex;align-items:center;justify-content:center;z-index:1000;padding:22px}
#draftOverlay[hidden]{display:none}
.draft-card{background:var(--card);border-radius:14px;padding:28px 30px;max-width:420px;width:100%;box-shadow:0 12px 40px rgba(0,0,0,.25);text-align:center}
.draft-card h2{margin:0 0 18px;font-size:17px}
.progress-track{height:10px;background:#e8e8e4;border-radius:999px;overflow:hidden}
.progress-bar{height:100%;width:0;background:linear-gradient(90deg,var(--accent),var(--accent-2,#008e43));border-radius:999px;transition:width .25s ease}
.draft-stage{display:flex;align-items:center;justify-content:center;gap:8px;margin:14px 0 4px;font-size:13.5px;font-weight:600;color:var(--ink)}
.stage-dot{width:9px;height:9px;border-radius:50%;background:var(--accent);animation:stagePulse 1.1s ease-in-out infinite}
@keyframes stagePulse{0%,100%{opacity:1;transform:scale(1)}50%{opacity:.35;transform:scale(.75)}}
.draft-card .hint{margin:8px 0 0;font-size:12px}
