/* ==========================================================================
   A) THEME & RESET
   - Define tokens (light/dark)
   - Minimal reset & base typography
   ========================================================================== */

/* === THEME TOKENS (from your file) === */
:root {
  --bg: #ffffff;
  /* page background */
  --text: #173C56;
  /* primary text */
  --card: #fafafa;
  /* card/panel surfaces */
  --panel: #f0f0f0;
  /* side panels, lists */
  --muted: #666666;
  /* subtle text */
  --border: #e0e0e0;
  /* dividers */
  --accent: #173C56;
  /* brand accent (links/buttons) */
  --shadow: rgba(0, 0, 0, 0.1);
}

/* source: styles.css tokens. :contentReference[oaicite:0]{index=0} */

/* === DARK THEME OVERRIDES (scoped to .theme-dark on <body>) === */
body.theme-dark {
  --bg: #3a3a3a;
  --text: #f1f1f1;
  --card: #4a4a4a;
  --panel: #4f4f4f;
  --muted: #cccccc;
  --border: #666666;
  --accent: #173C56;
  --shadow: rgba(0, 0, 0, 0.25);
}

/* source: styles.css dark overrides. :contentReference[oaicite:1]{index=1} */

/* === MINIMAL RESET === */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* source: styles.css reset. :contentReference[oaicite:2]{index=2} */

/* === BASE TYPOGRAPHY (no layout rules here) === */
html,
body {
  height: 100%;
}

body {
  font-family: 'Montserrat', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* taken from your body styles, without flex/centering/overflow. :contentReference[oaicite:3]{index=3} */

/* ==========================================================================
   B) APP SHELL & LAYOUT
   - Overall container and primary regions
   ========================================================================== */

.container {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

/* Main area */
.main-content {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 100vw;
  box-sizing: border-box;
  overflow: hidden;
  text-align: center;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition: transform 0.3s ease;
  padding-top: 5vh;
  /* avoids overlap with fixed UI */
  padding-bottom: 0;
}

/* When the fixed instruction panel is open */
.main-content.instructions-active {
  transform: none;
}

/* When settings/sidebar shifts content */
.main-content.shifted {
  transform: translateX(-21vw);
}

/* Main action buttons (settings + instructions) */
.main-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  margin: 1vh auto;
  flex-wrap: wrap;
}

.author-text {
  font-size: 0.85rem;
}

.profile-status-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 1.5rem;
  margin: 0.5rem auto 0;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-weight: 600;
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: var(--shadow-sm, 0 2px 4px rgba(0, 0, 0, 0.1));
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.profile-status-btn:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
}

.profile-status-btn.is-disabled,
.profile-status-btn.is-disabled:hover {
  opacity: 0.7;
  cursor: default;
  pointer-events: none;
  transform: none;
  border-color: var(--border);
}

.profile-status-icon {
  width: 26px;
  height: 26px;
  object-fit: contain;
  pointer-events: none;
}

.profile-status-color {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: transparent;
  display: none;
}

.profile-status-btn.has-profile .profile-status-color {
  display: inline-block;
}

/* Shared layout for right pane */
.main-content,
.tabs-right {
  position: relative;
  width: 100%;
  max-width: 100vw;
  overflow-wrap: break-word;
  box-sizing: border-box;
}

/* Two-column shell for docs/infos */
.vertical-tabs-wrapper {
  display: flex;
  width: 100%;
  height: 100%;
}

.tabs-left {
  width: 200px;
  min-width: 200px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding-right: 0.5rem;
}

.tabs-right {
  position: relative;
  max-width: 100%;
  word-wrap: break-word;
  overflow-wrap: break-word;
  overflow-x: auto;
}

/* Nav stacks inside the left column */
.vertical-tabs {
  display: flex;
  height: 100%;
}

.main-topic-list,
.sub-tab-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--panel);
  border-right: 1px solid var(--border);
}

/* Content area on the right */
.info-content-area {
  flex-grow: 1;
  padding: 1rem;
  overflow-y: auto;
}

/* Small-screen padding tweak for right pane */
@media (max-width: 768px) {
  .tabs-right {
    padding: 0.5rem;
  }
}

/* ==========================================================================
   C) NAVIGATION & TABS
   - Tabs, active/hover states
   ========================================================================== */

/* Wrapper that holds the two nav lists (topics + subtabs) */
.vertical-tabs {
  display: flex;
  height: 100%;
}

/* source: styles.css. :contentReference[oaicite:0]{index=0} */

/* Left-side nav lists */
.main-topic-list,
.sub-tab-list {
  overflow-x: hidden;
  overflow-y: auto;
  max-width: 100%;
  list-style: none;
  padding: 0;
  margin: 0;
  background: var(--panel);
  border-right: 1px solid var(--border);
}

/* source: styles.css. :contentReference[oaicite:1]{index=1} */

/* Individual tab items */
.main-tab,
.sub-tab-list li {
  padding: 10px;
  cursor: pointer;
  font-family: 'Montserrat', sans-serif;
  transition: background 0.2s;
}

/* source: styles.css. :contentReference[oaicite:2]{index=2} */

/* Hover state */
.main-tab:hover,
.sub-tab-list li:hover {
  background-color: #e0e0e0;
  /* consider swapping to a token later */
}

/* source: styles.css. :contentReference[oaicite:3]{index=3} */

/* Active state */
.main-tab.active,
.sub-tab-list li.active {
  background-color: var(--text);
  color: white;
}

/* source: styles.css. :contentReference[oaicite:4]{index=4} */

/* ==========================================================================
   D) MEDIA & TYPOGRAPHY UTILITIES
   - Generic text and image helpers
   ========================================================================== */

/* --- Typography utilities --- */
.bold {
  font-weight: 700;
}

/* --- Image helpers --- */
.tabs-right img,
.page-section img {
  max-width: 100%;
  height: auto;
  border-radius: 1vw;
  box-shadow: 0 2px 8px var(--shadow);
  display: block;
  margin: 1rem auto;
}

img[src*="portrait.jpg"] {
  max-height: 300px;
  width: auto;
  display: block;
  margin: 0 auto;
  margin-bottom: 2rem;
}

/* --- Text sizing in right content pane --- */
.tabs-right p,
.tabs-right li,
.tabs-right span {
  font-size: 14px;
  line-height: 1.6;
}

/* Branding: logo sizing (added) */
/* Make logos smaller */
.login-logo {
  /* login page logo */
  width: auto;
  max-width: 250px;
  /* make it small; change to 32px if you want even smaller */
  height: auto;
  display: block;
  margin: 0 auto 0.5rem;
}

#logoMain,
/* app (main_content.html) logo */
#mainContent .logo {
  width: auto;
  max-width: 200px;
  /* same small cap in the app */
  height: auto;
  display: block;
  margin: 0 auto 0.5rem;
}

/* ==========================================================================
   E) GLOBAL BUTTONS
   - One system with variants; prefer classes over IDs for styling
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--btn-h, 40px);
  padding: 0 1rem;
  border-radius: var(--radius, 8px);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow-sm, 0 2px 4px rgba(0, 0, 0, 0.1));
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
  font-family: 'Montserrat', sans-serif;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

/* Variants */
.btn--primary {
  background: var(--accent);
  color: var(--accent-contrast, #fff);
  border-color: transparent;
}

.btn--ghost {
  background: transparent;
  border: 1px solid var(--border);
}

.btn--danger {
  background: #e5484d;
  color: #fff;
  border-color: transparent;
}

.btn--icon {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn--icon .btn-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
  pointer-events: none;
}

#logoutBtn.icon-btn {
  top: 1vh;
  left: 1vw;
}

#dataBtn.icon-btn {
  bottom: 1vh;
  left: 1vw;
}

#openProfilePanel.icon-btn {
  bottom: 1vh;
  right: 1vw;
}

#settingsBtn.icon-btn {
  top: 1vh;
  right: 1vw;
}

/* Special layout variants */
.btn--bar {
  width: 100%;
  height: 50px;
  border-radius: 0;
  justify-content: center;
}

.btn--fab {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  box-shadow: var(--shadow-md, 0 4px 8px rgba(0, 0, 0, 0.2));
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1000;
}

/* Shared “nice” close button (matches Data Interface) */
.close-button {
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  font-size: clamp(18px, 1.4vw, 22px);
  line-height: 1;
  padding: .25rem .4rem;
  border-radius: .4rem;
  transition: background .2s, color .2s, transform .08s;
}

.close-button:hover {
  color: var(--accent);
  background: color-mix(in oklab, var(--accent) 12%, transparent);
}

.close-button:active {
  transform: scale(0.98);
}

/* Pin the close button inside these cards (top-right) */
.settings-panel-centered .close-button {
  position: absolute;
  top: 10px;
  right: 10px;
}

/* === Button sizing helper for a larger Start button === */
.btn--xl {
  --btn-h: 64px;
  padding: 0 3rem;
  /* ⬅ doubled from 1.5rem */
  font-size: clamp(18px, 2.5vw, 28px);
}

/* === Exit (leave game) button: same positioning system as the 4 corner icons === */
#exitGameBtn {
  font-family: 'Montserrat', Arial, sans-serif;
  font-size: 1vw;
  /* smaller than Start */
  padding: 0.5vh 1vw;
  /* slim padding */
  margin-top: 1vh;
  background: #173C56;
  color: white;
  border: none;
  border-radius: 0.4vw;
  cursor: pointer;
  z-index: 2002;
  transition: background 0.3s ease;
}

#exitGameBtn:hover {
  background: #2a5674;
}

#skipStepBtn {
  font-family: 'Montserrat', Arial, sans-serif;
  font-size: 1vw;
  padding: 0.5vh 1vw;
  margin-top: 1vh;
  background: #4b5563;
  color: white;
  border: none;
  border-radius: 0.4vw;
  cursor: pointer;
  z-index: 2002;
  transition: background 0.3s ease;
}

#skipStepBtn:hover {
  background: #6b7280;
}

/* ==========================================================================
   F) FORMS
   - Login form, generic inputs, selects, groups, messages
   ========================================================================== */

/* Shared form wrapper */
.form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form .field {
  display: flex;
  flex-direction: column;
  margin-bottom: 1rem;
}

.form label {
  font-size: 14px;
  margin-bottom: 0.3rem;
  font-weight: 600;
  color: var(--text);
}

.form input,
.form select,
.form textarea {
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius, 6px);
  background: var(--card);
  color: var(--text);
  font-size: 14px;
}

.form .help {
  font-size: 12px;
  color: var(--muted);
  margin-top: 0.25rem;
}

/* Login form box */
.login-form {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 440px;
  gap: 1.15rem;
  background: #fff;
  padding: clamp(1.8rem, 3vw, 2.6rem);
  border-radius: 18px;
  box-shadow: 0 14px 34px rgba(15, 42, 60, 0.14);
  border: 1px solid rgba(23, 60, 86, 0.12);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

/* Center the primary login form inside the left card */
.login-left-card .login-form,
.login-left .login-form {
  margin-left: auto;
  margin-right: auto;
  width: min(100%, 520px);
}

.login-form label {
  font-size: clamp(0.95rem, 1.1vw, 1.05rem);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.35rem;
  letter-spacing: 0.01em;
}

.login-form input,
.login-form select,
.login-form textarea {
  padding: clamp(0.75rem, 1.3vw, 0.95rem);
  font-size: clamp(1rem, 1.3vw, 1.1rem);
  border: 1px solid rgba(23, 60, 86, 0.16);
  border-radius: 12px;
  background: #f7f9fc;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
}

.login-form input:focus,
.login-form select:focus,
.login-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 60, 86, 0.16);
  background: #fff;
}

.login-form:focus-within {
  box-shadow: 0 18px 44px rgba(15, 42, 60, 0.18);
}

/* Compact variant used inside register/reset/delete panels */
.login-form.small-form {
  width: min(90vw, 560px);
  background: #fff;
  padding: clamp(1.1rem, 2.2vw, 1.6rem);
  border-radius: 14px;
  box-shadow: var(--shadow-md, 0 4px 8px rgba(0, 0, 0, 0.1));
}

.login-form.small-form h2 {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  margin-bottom: 0.75rem;
  text-align: center;
}

.register-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  column-gap: 0.75rem;
  row-gap: 0.85rem;
  align-items: center;
}

.register-row {
  display: contents;
}

.register-grid label {
  margin-bottom: 0;
}

.register-input-wrap {
  position: relative;
  width: 100%;
}

.register-input-wrap input,
.register-input-wrap select {
  width: 100%;
  box-sizing: border-box;
}

.register-progress {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin: 0.35rem 0 1rem;
}

.register-progress__bar {
  height: 6px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.register-progress__fill {
  height: 100%;
  width: 20%;
  background: var(--accent);
  transition: width 0.2s ease;
}

.register-progress__label {
  font-size: 0.85rem;
  color: var(--muted);
  text-align: right;
}

.register-steps {
  display: block;
}

.register-step {
  display: none;
}

.register-step.active {
  display: block;
}

.register-help {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0.35rem 0 0.9rem;
}

.register-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

.register-actions .login-btn {
  flex: 1 1 auto;
}

.register-submit {
  display: none;
}

.pending-container {
  display: block;
}

.pending-msg {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  line-height: 1.35;
}

.hourglass-img {
  width: 42px;
  height: auto;
}

.pending-text {
  display: inline-block;
}

.pending-actions {
  margin-top: 1rem;
  display: flex;
  justify-content: center;
}

/* Row of login buttons */
.login-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
}

/* Tighter spacing for the main login form */
#loginForm {
  gap: 0.9rem;
  padding: clamp(1.4rem, 2.5vw, 2rem);
}

#loginForm #loginError {
  margin-top: 0.25rem;
}

#loginForm #loginError:empty {
  display: none;
}

#loginForm .login-actions {
  margin-top: 0.25rem;
  justify-content: center;
}

#loginForm .login-btn--primary,
#loginForm #loginBtn {
  margin: 0;
}

/* Login buttons – base + variants */
.login-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;

  font-family: 'Montserrat', Arial, sans-serif;
  font-weight: 600;
  font-size: clamp(0.95rem, 1.2vw, 1.1rem);

  padding: 0.75rem 1.25rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  cursor: pointer;

  box-shadow: var(--shadow-sm, 0 4px 12px rgba(15, 42, 60, 0.1));
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(15, 42, 60, 0.16);
}

.login-btn:active {
  transform: translateY(0);
}

/* Primary action (Login, Submit) */
.login-btn--primary,
#loginBtn {
  background: linear-gradient(140deg, #173C56 0%, #1f4f73 100%);
  color: #fff;
  border-color: transparent;
  display: block;
  margin: 0.5vh auto 0 auto;
  box-shadow: 0 12px 24px rgba(23, 60, 86, 0.3);
}

.login-btn--primary:hover,
#loginBtn:hover {
  filter: brightness(1.03);
}

/* Ghost / neutral (Zurück, etc.) */
.login-btn--ghost {
  background: #f3f6fa;
  border: 1px solid rgba(23, 60, 86, 0.15);
}

/* Danger (Delete account) — you already use class="login-btn danger" in index.php */
.login-btn.danger {
  background: #e5484d;
  color: #fff;
  border-color: transparent;
}

.login-btn.danger:hover {
  filter: brightness(0.95);
}

/* Password visibility toggle (positioned within input wrapper) */
.toggle-password {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
}

/* Feedback / error messages */
.feedback-msg,
#loginError,
#resetMessage {
  font-size: 14px;
  margin-top: 0.5rem;
}

.feedback-msg {
  color: green;
}

#loginError {
  color: red;
}

#resetMessage {
  color: orange;
}

/* Layout helpers */
.input-item {
  display: flex;
  flex-direction: column;
  margin-bottom: 1rem;
  border-radius: 8px;
}

.input-select {
  width: 100%;
  max-width: 200px;
}

.grid-inputs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem;
}

/* =========================================================
   Checkbox + Radio Coloring (use brand accent)
   ========================================================= */

/* Default border + background */
input[type="checkbox"],
input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 4px;
  background: var(--card);
  cursor: pointer;
  position: relative;
  transition: all 0.15s ease;
}

/* Hover border tint */
input[type="checkbox"]:hover,
input[type="radio"]:hover {
  border-color: var(--accent);
}

/* Focus ring */
input[type="checkbox"]:focus-visible,
input[type="radio"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 30%, transparent);
}

/* Checked state — signature blue */
input[type="checkbox"]:checked,
input[type="radio"]:checked {
  background-color: var(--accent);
  border-color: var(--accent);
}

/* Checkmark for checkboxes */
input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  inset: 0;                       /* fill the parent */
  margin: auto;                   /* centers inside */
  width: 5px;                     /* proportionate stroke size */
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  box-sizing: border-box;
}

/* Radio dot */
input[type="radio"]:checked::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
}

/* Dark mode consistency */
body.theme-dark input[type="checkbox"],
body.theme-dark input[type="radio"] {
  border-color: var(--border);
  background: var(--card);
}

body.theme-dark input[type="checkbox"]:checked,
body.theme-dark input[type="radio"]:checked {
  background-color: var(--accent);
  border-color: var(--accent);
}


/* Number input tweaks */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
  /* Firefox */
}

/* === Login panels (compat with index.php toggling) === */
.form-panel {
  position: absolute;
  inset: 0;
  /* top/right/bottom/left = 0 */
  background: rgba(248, 250, 252, 0.96);
  display: none;
  /* hidden by default */
  align-items: center;
  justify-content: center;
  z-index: 100;
  /* above the base login form */
  backdrop-filter: blur(6px);
}

.form-panel.active {
  display: flex;
}

/* The panels live inside the left column, anchor them there */
.login-left {
  position: relative;
}

/* === Welcome panel sizing tweaks === */
/* Welcome panel a bit wider */
#welcomePanel .login-form,
#welcomePanel .small-form,
#welcomePanel .welcome-card {
  width: min(600px, 95vw);
  /* was 600px – now wider */
  max-width: none;
}

/* Welcome field stack under the title */
#welcomePanel #welcomeFields {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
}

/* Keep 'Passwort' input and 'Anzeigen' inline, never overlapping */
#welcomePanel .pw-inline {
  display: flex;
  align-items: center;
  gap: 8px;
}

#welcomePanel .pw-inline input[type="password"],
#welcomePanel .pw-inline input[type="text"] {
  flex: 1;
}

#welcomePanel #toggleWelcomePw {
  position: static !important;
  right: auto !important;
  top: auto !important;
  transform: none !important;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  height: 38px;
  padding: 0 .75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  flex: 0 0 auto;
}

/* Make the welcome progress canvas behave like a thin bar */
#welcomeProgress {
  display: block;
  width: 100%;
  height: 18px;
  /* compact */
  margin-top: 6px;
}

#welcomeActiveUntilRow {
  margin-top: 10px;
  font-size: 1rem;
}

#welcomeActiveUntilRow strong {
  margin-right: 6px;
}

/* Force center alignment of buttons in welcome panel */
#welcomePanel .login-actions {
  display: flex;
  justify-content: center !important;
  /* override space-between */
  align-items: center;
  gap: 10rem !important;
  margin-top: 1.5rem;
}

#welcomePanel .login-actions .login-btn {
  margin: 0 !important;
  /* remove auto margins */
}

/* Example visibility rule (adjust to your project) */
#welcomePanel {
  display: none;
}

#welcomePanel.active {
  display: flex;
}

/* or block/grid – whatever you use */

/* ==========================================================================
   G) PANELS & OVERLAYS
   - Settings, Profile, Data (modal/slide panels)
   ========================================================================== */
:root {
  /* Panel sizing (center piece) */
  --settings-panel-width: clamp(760px, 72vw, 850px);

  /* Split it: tabs get 100% of inner height; columns get 60% of the tabs */
  --settings-tabs-max-h: var(--settings-inner-max-h);
  --settings-cols-max-h: calc(var(--settings-tabs-max-h) * 0.6);

  /* Left tabs rail width (kept smaller than content) */
  --settings-tabs-w: clamp(150px, 18vw, 180px);

  /* Inside the content area: 2-column proportions */
  --settings-col-left: 1.25fr;  /* Grundeinstellungen */
  --settings-col-right: 1.25fr; /* Modus Einstellungen */
  --settings-col-min: 280px;    /* min width for each column */
  --settings-gap: 16px;         /* gap between panel and drawer */
}

/* ---------------- Shared overlay (Settings + Profile) ---------------- */
.settings-overlay {
  position: fixed;
  inset: 0;
  display: none; /* hidden by default */
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.5); /* 🟢 dim background */
  z-index: 2000; /* above main content */
  backdrop-filter: blur(2px); /* optional soft blur */
  transition: background 0.2s ease;
}
.settings-overlay.active { display: flex; }

/* ---------------- Shared card (Settings + Profile) ---------------- */
.settings-panel-centered {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(var(--settings-panel-width), 95vw);
  max-height: 90vh;
  background: var(--card);
  border-radius: 12px;
  box-shadow: 0 0 20px rgba(0,0,0,.3);
  display: flex;
  flex-direction: column;
  overflow: auto;
}

/* ---------------- Settings inner layout ---------------- */
.settings-content{
  flex: 1;
  overflow: auto;          /* allow vertical scroll if content grows */
  padding: 1rem;
  min-height: 0;
}

/* LEFT tabs + RIGHT content area */
.settings-layout{
  display: grid;
  grid-template-columns: var(--settings-tabs-w) 1fr;
  column-gap: 16px;
  height: auto;              /* ⬅ was 100% (forced stretching) */
  min-height: 0;
  align-items: flex-start;   /* ⬅ stop vertical stretching of children */
  margin-top: 2vh;
}

/* LEFT: tabs rail uses the full inner height */
.settings-mode-tabs {
  width: var(--settings-tabs-w);
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;

  height: var(--settings-tabs-max-h);  /* ⬅ explicit height */
  max-height: none;
  overflow: auto;
  min-height: 0;
  align-self: flex-start;
}

.settings-mode-tabs button {
  width: 100%;
  text-align: left;
  display: block;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  border-radius: 8px;
  font-family: 'Montserrat', sans-serif;
  cursor: pointer;
  margin-bottom: 6px;
}
.settings-mode-tabs button:hover {
  background: color-mix(in oklab, var(--text) 10%, transparent);
  color: var(--text);
}
.settings-mode-tabs button.active {
  background: var(--text);
  color: white;
}

/* RIGHT: two wider columns limited to 60% of tabs height */
.settings-columns{
  display: grid;
  grid-template-columns:
    minmax(var(--settings-col-min), var(--settings-col-left))
    minmax(var(--settings-col-min), var(--settings-col-right));
  gap: 16px;

  height: var(--settings-cols-max-h);   /* ⬅ 60% of tabs */
  max-height: none;
  overflow: auto;                       /* scroll inside the columns */
  min-height: 0;
  align-self: flex-start;
}

.settings-presets {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  padding: 0.25rem 0 0.5rem;
  border-bottom: 1px solid var(--border);
}

.settings-presets-label {
  font-weight: 600;
  flex: 0 0 auto;
}

.settings-presets-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
  flex: 1 1 auto;
  min-height: 48px;
  padding: 4px 0;
}

.settings-presets-list {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  padding: 2px;
}

.preset-btn {
  border: 2px solid transparent;
  padding: 6px 10px;
  border-radius: 999px;
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
  color: #ffffff;
  cursor: pointer;
  opacity: 0.9;
  box-sizing: border-box;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  max-width: 42px;
  transition: max-width 0.2s ease, padding 0.2s ease, transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.preset-btn:hover,
.preset-btn:focus-visible {
  opacity: 1;
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
  max-width: 180px;
  padding: 6px 14px;
}

.preset-btn.active {
  opacity: 1;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
  max-width: 180px;
  padding: 6px 14px;
}

.preset-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.preset-btn:disabled:hover {
  opacity: 0.45;
  transform: none;
  box-shadow: none;
}

.preset-label-full { display: none; }
.preset-btn:hover .preset-label-full,
.preset-btn:focus-visible .preset-label-full,
.preset-btn.active .preset-label-full { display: inline; }
.preset-btn:hover .preset-label-short,
.preset-btn:focus-visible .preset-label-short,
.preset-btn.active .preset-label-short { display: none; }

.preset-btn--easy { background: #22c55e; }
.preset-btn--none { background: #9ca3af; }
.preset-btn--medium { background: #f59e0b; }
.preset-btn--hard { background: #ef4444; }
.preset-btn--adaptive { background: var(--accent); color: var(--accent-contrast, #fff); }
.preset-btn--adaptive.active { border-color: #77daff; box-shadow: 0 0 0 2px #77daff; }
.preset-btn--adaptive:disabled { background: #9ca3af; color: #f8fafc; }
.preset-btn--reset { background: #111827; color: #f8fafc; flex: 0 0 auto; }

.settings-help-content .settings-help-list {
  margin: 0.5rem 0 0 1.1rem;
  padding: 0;
}
.settings-help-content .settings-help-list li {
  margin: 0.25rem 0;
}
.preset-help-label {
  font-weight: 600;
}
.preset-help-easy { color: #22c55e; }
.preset-help-medium { color: #f59e0b; }
.preset-help-hard { color: #ef4444; }
.preset-help-adaptive { color: var(--accent); }
.preset-reset-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #111827;
  color: #f8fafc;
  font-weight: 700;
  font-size: 0.8em;
  line-height: 1;
  vertical-align: middle;
}

.settings-col { flex: 1; }

.setting-group {
  font-weight: 600;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}
.setting { margin-bottom: 0.75rem; }

/* Make settings checkboxes align left */
.settings-column-left .checkbox-item,
.settings-column-right .checkbox-item {
  justify-content: flex-start;
  text-align: left;
}
.settings-column-left .checkbox-item span,
.settings-column-right .checkbox-item span { flex: unset; }

/* Sticky section titles (optional) */
.settings-column-left > h3,
.settings-column-right > h3{
  position: sticky;
  top: 0;
  background: var(--card);
  z-index: 1;
  padding-top: .25rem;
  margin-top: 0;
}

/* Quadrant grid layout matches HTML rows */
.checkbox-grid { --cb: 40px; margin-top: 0.5em }
.grid-row {
  display: grid;
  grid-template-columns: repeat(5, var(--cb));
  column-gap: .2rem;
  row-gap: .2rem;
  justify-content: center;
}
.checkbox-grid .checkbox-item {
  width: var(--cb);
  height: var(--cb);
  display: flex;
  align-items: center;
  justify-content: center;
}
.checkbox-grid .checkbox-item input[type="checkbox"] {
  width: 100%;
  height: 100%;
  margin: 0;
}

.save-settings-wrapper {
  border-top: none;
  padding: 0.75rem;
  text-align: center;
  background: transparent;
}

/* Little "?" badge next to labels (inline with label) */
.setting .input-item .bold { display: inline-flex; align-items: center; gap: 0.4em;}
/* Make non-.input-item labels behave like inline containers too */
.setting > .bold,
.setting .checkbox-item .bold {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
}
.help-badge {
  display: inline-block;
  font-size: 0.9em;
  font-weight: 600;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 1.4em;
  height: 1.4em;
  line-height: 1.2em;
  text-align: center;
  cursor: pointer;
  margin-left: 0.4em;
  vertical-align: middle;
  transition: background 0.2s, color 0.2s;
}
.help-badge:hover {
  background: var(--accent);
  color: #fff;
}

/* Right help drawer (separate window to the right of centered panel) */
.settings-help-drawer {
  position: fixed;
  top: 50%;
  left: calc(50% + (var(--settings-panel-width) / 2) + var(--settings-gap));
  transform: translateY(-50%);
  width: 320px;
  max-height: 84vh;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: -8px 0 24px var(--shadow);
  border-radius: 12px;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transition: opacity .18s ease, transform .18s ease;
}
.settings-help-drawer.open {
  opacity: 1;
  transform: translateY(-50%);
  pointer-events: auto;
}

/* If screen is too narrow to fit beside the panel, fall back to right overlay */
@media (max-width: 1200px) {
  .settings-help-drawer {
    left: auto;
    right: 2vw;
    width: min(340px, 96vw);
  }
}

/* Drawer header/content */
.settings-help-header {
  display:flex; align-items:center; justify-content:space-between;
  padding: 10px 12px; border-bottom: 1px solid var(--border);
}
.settings-help-content {
  padding: 12px;
  font-size: 14px; line-height: 1.6;
  max-height: calc(84vh - 56px);
  overflow:auto;
}

/* =========================================================
   SETTINGS TABS — Harmonized with Data Panel look & feel
   ========================================================= */
#settingsModeTabs {
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

#settingsModeTabs button {
  display: block;
  width: 100%;
  padding: 10px 14px;
  text-align: left;
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
  color: var(--text);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.08s ease;
}

/* Hover and focus — subtle lift + color tint like data panel */
#settingsModeTabs button:hover,
#settingsModeTabs button:focus-visible {
  background: color-mix(in oklab, var(--text) 10%, transparent);
  color: var(--accent);
  transform: translateX(2px);
}

/* Active mode — uses brand accent on light, inverted on dark */
#settingsModeTabs button.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Dark mode fine-tuning */
body.theme-dark #settingsModeTabs {
  background: var(--panel);
  border-right: 1px solid var(--border);
}

body.theme-dark #settingsModeTabs button {
  color: var(--text);
  border-bottom-color: var(--border);
}

body.theme-dark #settingsModeTabs button:hover {
  background: color-mix(in oklab, var(--accent) 15%, transparent);
  color: #fff;
}

body.theme-dark #settingsModeTabs button.active {
  background: color-mix(in oklab, var(--accent, #173C56) 100%, var(--card, #fff));
  border-color: var(--accent, #173C56);
}

/* === Profile overlay: two columns (list + right drawer) === */
.profile-overlay {
  position: fixed;
  inset: 0;
  display: none;
  /* toggled by JS */
  grid-template-columns: 1fr 340px;
  justify-content: center;
  /* center the two-column grid horizontally */
  align-items: center;
  /* ⬅️ center items vertically */
  column-gap: 12px;
  /* adjust spacing between list and drawer */
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
}

.profile-overlay.active {
  display: grid;
}

body.profile-single .profile-overlay {
  grid-template-columns: 1fr;
}

body.profile-single .profile-left {
  display: none;
}

/* Left card (list) */
.profile-left {
  background: var(--card, #fff);
  border-radius: 12px;
  /* rounded like other panels */
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  border: 1px solid var(--border);
  margin: auto;
  /* center vertically in grid cell */
  width: min(600px, 95vw);
  max-height: 80vh;
  padding: 1rem;
  overflow-y: auto;
}

.profile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.profile-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.profile-toolbar {
  margin-bottom: 8px;
}

.profile-toolbar input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
}

/* List + rows */
.profile-list {
  display: grid;
  gap: 6px;
}

.profile-row {
  display: grid;
  grid-template-columns: 28px minmax(120px, 220px) 140px 120px;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.profile-row:hover {
  background: color-mix(in oklab, var(--panel) 40%, transparent);
}

.profile-color {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, .1);
}

.profile-name {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-date {
  color: var(--muted);
  font-size: 13px;
}

.profile-actions-row {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.profile-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  cursor: pointer;
  color: var(--text);
}

.profile-icon:hover {
  background: var(--panel);
}

/* Right drawer (small panel) */
.profile-drawer {
  background: var(--card, #fff);
  border-left: 1px solid var(--border);
  border-radius: 12px;
  /* rounded corners */
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  margin: auto;
  /* center vertically */
  padding: 1rem;
  width: 300px;
  max-height: 80vh;
  overflow-y: auto;
  display: none;
  /* show only when editing/adding */
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

/* Color grid */
.color-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 6px;
}

.color-swatch {
  width: 100%;
  padding-top: 100%;
  border-radius: 10px;
  border: 2px solid transparent;
  cursor: pointer;
  position: relative;
}

.color-swatch[aria-checked="true"] {
  outline: 3px solid var(--text);
}

.color-swatch::after {
  content: "✓";
  color: #fff;
  font-weight: 800;
  position: absolute;
  right: 6px;
  bottom: 4px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
  display: none;
}

.color-swatch[aria-checked="true"]::after {
  display: block;
}

/* Responsive narrow screens: stack (overlay becomes vertical) */
@media (max-width: 720px) {
  .profile-overlay {
    grid-template-columns: 1fr;
  }

  .profile-drawer {
    border-left: none;
  }
}

.profile-left,
.profile-drawer {
  margin: 0;
  /* remove auto centering */
  align-self: auto;
  /* stick to top of overlay */
}

/* ==========================================================================
   PROGRAM OVERLAY
   ========================================================================== */
.program-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1200;
  padding: 1rem;
}

.program-overlay.active {
  display: flex;
}

.program-panel {
  width: min(1100px, 96vw);
  max-height: 90vh;
  background: var(--card);
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.program-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.2rem;
  border-bottom: 1px solid var(--border);
}

.program-body {
  padding: 1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow: auto;
}

.program-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  align-items: end;
}

.program-field label {
  font-weight: 600;
  margin-bottom: 0.3rem;
  display: block;
}

.program-field input,
.program-field select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-weight: 600;
}

#programScope.has-profile {
  --profile-color: #3B82F6;
  padding-left: 2rem;
  background-image: linear-gradient(var(--profile-color), var(--profile-color));
  background-size: 12px 12px;
  background-position: 0.75rem center;
  background-repeat: no-repeat;
}

.program-estimate {
  font-weight: 600;
  color: var(--text);
  background: color-mix(in oklab, var(--panel) 70%, transparent);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 0.8rem;
}

.program-builder {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(0, 2fr);
  gap: 1rem;
}

.program-palette,
.program-sequence {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.program-palette h3,
.program-sequence h3 {
  margin: 0;
  font-size: 1rem;
}

.program-palette-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.program-palette-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border);
  font-weight: 600;
  width: 100%;
}

.program-arrow-btn {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--panel);
  cursor: pointer;
  font-weight: 700;
}

.program-palette-item .program-arrow-btn {
  margin-left: auto;
}

.program-sequence-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-height: 64px;
  padding: 0.2rem;
}

.program-sequence-empty {
  color: var(--muted);
  font-weight: 600;
  padding: 0.4rem;
}

.program-step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  font-weight: 600;
  width: 100%;
  position: relative;
}

.program-step.pause {
  border-style: dashed;
  color: #374151;
}

.program-step-trials {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  opacity: 0.9;
  pointer-events: none;
  white-space: nowrap;
}

body.theme-dark .program-step.pause {
  color: var(--text);
}

body.theme-dark .program-overlay .preset-badge {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.55);
}

.program-step.is-dragging {
  opacity: 0.6;
}

.program-step.is-drop-target {
  outline: 3px dashed color-mix(in oklab, var(--accent) 50%, transparent);
  outline-offset: 2px;
}

.program-step .drag-handle {
  cursor: grab;
  font-size: 1rem;
  line-height: 1;
}

.program-step-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: auto;
}

.program-step-duration {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(23, 60, 86, 0.22);
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
  line-height: 1;
  white-space: nowrap;
}

body.theme-dark .program-step-duration {
  background: rgba(255, 255, 255, 0.86);
  border-color: rgba(255, 255, 255, 0.35);
}

.program-step input[type="number"] {
  width: 64px;
  padding: 0.25rem 0.35rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--card);
}

.program-footer {
  border-top: 1px solid var(--border);
  padding: 0.9rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.program-warning {
  min-height: 1.2rem;
  color: #b45309;
  font-weight: 600;
}

.program-footer-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.program-color-grey {
  background: #e9ecef;
  color: #173C56;
  border-color: transparent;
}

.program-color-lightblue {
  background: #77daff;
  color: #173C56;
  border-color: transparent;
}

.program-color-blue {
  background: #173C56;
  color: #fff;
  border-color: transparent;
}

.preset-badge {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
}

.preset-badge.preset-none { background: #9ca3af; }
.preset-badge.preset-easy { background: #22c55e; }
.preset-badge.preset-medium { background: #f59e0b; }
.preset-badge.preset-hard { background: #ef4444; }
.preset-badge.preset-adaptive { background: var(--accent, #173C56); }

@media (max-width: 900px) {
  .program-builder {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   H) GAME STAGE & HUD
   - Canvas layers, targets, metrics, mode toolbar
   ========================================================================== */

/* Background & canvas layers */
#backgroundLayer {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  z-index: 0;
}

#gameArea {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  z-index: 1;
}

#gameArea.active {
  cursor: crosshair;
  /* example state when running */
}

#oksCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
}

.pause-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.9);
  z-index: 30;
}

body.theme-dark .pause-overlay {
  background: rgba(58, 58, 58, 0.92);
}

.pause-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  padding: 1.2rem 1.6rem;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}

.pause-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.pause-note {
  margin: 0;
  max-width: 340px;
  text-align: center;
  font-size: 0.95rem;
  line-height: 1.4;
  color: var(--text);
}

.pause-skip-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.15rem 0.55rem;
  margin: 0 0.15rem;
  border-radius: 0.4rem;
  background: #4b5563;
  color: #fff;
  font-weight: 600;
  font-size: 0.85em;
  white-space: nowrap;
}

.pause-donut {
  position: relative;
  width: 160px;
  height: 160px;
  display: grid;
  place-items: center;
}

.pause-ring {
  width: 160px;
  height: 160px;
  transform: rotate(-90deg);
}

.pause-ring-bg {
  fill: none;
  stroke: color-mix(in oklab, var(--border) 80%, transparent);
  stroke-width: 10;
}

.pause-ring-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 327;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.4s linear;
}

.pause-time {
  position: absolute;
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--text);
}

/* Fixation & target elements */
#fixationDot {
  position: absolute;
  width: 2vw;
  height: 2vw;
  background-color: red;
  border-radius: 50%;
  border: 2px solid white;
  z-index: 10;
  opacity: 1;
  transition: opacity 0.3s ease;
}

#target {
  position: absolute;
  width: 2vw;
  height: 2vw;
  background-color: blue;
  border-radius: 50%;
  border: 2px solid white;
  z-index: 10;
  display: none;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 12px;
}

/* Suchen mode */
.suchen-layer {
  position: absolute;
  inset: 0;
  z-index: 6;
}

.suchen-person {
  position: absolute;
  width: clamp(48px, 7vw, 96px);
  height: clamp(48px, 7vw, 96px);
  object-fit: contain;
  transform: translate(-50%, -50%);
  transition: transform 0.2s ease, opacity 0.2s ease;
  cursor: pointer;
  user-select: none;
  -webkit-user-drag: none;
}

.suchen-person.is-flipped {
  transform: translate(-50%, -50%) scaleX(-1);
}

.suchen-person.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.suchen-person.is-correct {
  outline: 4px solid rgba(34, 197, 94, 0.9);
  outline-offset: 3px;
}

.suchen-person.is-wrong {
  outline: 4px solid rgba(239, 68, 68, 0.9);
  outline-offset: 3px;
}

.suchen-person.is-late {
  outline: 4px solid rgba(245, 158, 11, 0.9);
  outline-offset: 3px;
}

body.theme-dark .suchen-person:not(.is-correct):not(.is-wrong):not(.is-late) {
  outline: 2px solid rgba(255, 255, 255, 0.8);
  outline-offset: 2px;
}

.suchen-target-frame {
  position: absolute;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  width: clamp(110px, 16vw, 220px);
  height: clamp(110px, 16vw, 220px);
  border: 3px solid #173C56;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.14);
  z-index: 12;
  cursor: pointer;
  padding: 0;
}

.suchen-target-frame img {
  width: 80%;
  height: 80%;
  object-fit: contain;
}

.suchen-target-frame.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.suchen-popup-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.12);
  z-index: 20;
}

.suchen-popup-card {
  width: min(90%, 420px);
  background: rgba(255, 255, 255, 0.96);
  border: 3px solid #173C56;
  border-radius: 18px;
  padding: 20px 24px;
  text-align: center;
  color: #173C56;
  font: 700 18px/1.4 'Montserrat', Arial, sans-serif;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.2);
  transform: translateY(0);
  transition: transform 0.35s ease, opacity 0.35s ease;
}

.suchen-popup-card.is-docking {
  transform: translateY(-120px) scale(0.85);
  opacity: 0;
}

.suchen-popup-title {
  font-weight: 700;
  margin-bottom: 12px;
}

.suchen-popup-image {
  width: clamp(120px, 20vw, 220px);
  height: clamp(120px, 20vw, 220px);
  object-fit: contain;
  margin: 8px auto 12px;
  display: block;
}

.suchen-popup-close {
  margin-top: 6px;
  padding: 8px 18px;
  border-radius: 999px;
  border: none;
  background: #173C56;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

/* HUD text panel */
.metrics {
  position: absolute;
  top: 1rem;
  left: 1rem;
  background: rgba(0, 0, 0, 0.5);
  color: var(--text);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius, 6px);
  font-size: 14px;
  z-index: 20;
}

.blue-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  background: blue;
  border-radius: 50%;
  margin-right: 0.25rem;
}

/* Mode toolbar (top-centered, fixed) */
.mode-button-bar {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
  width: calc(100% - 180px); /* leave breathing room near edges/corner buttons */
  max-width: 1120px;
  z-index: 1050;
  background: transparent;
  padding: .2rem 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

@media (min-width: 1400px) {
  .mode-button-bar {
    width: auto;
    max-width: none;
  }
}

.mode-group-row {
  display: inline-flex;
  flex-wrap: wrap;
  gap: .5rem .65rem;
  justify-content: center;
  width: fit-content;
  max-width: 100%;
  align-self: center;
  background: var(--card);
  backdrop-filter: blur(6px);
  padding: .6rem .7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: 0 4px 10px var(--shadow);
}

.mode-group-row.is-wrapped {
  border-radius: 12px;
}

.mode-group-row .mode-btn {
  padding: .6rem 1.2rem;
  font-size: 1.02rem;
}

.mode-group-panels {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  width: 100%;
  align-items: center;
}

.mode-group-panel {
  display: none;
  flex-wrap: wrap;
  gap: .5rem .65rem;
  justify-content: center;
  background: var(--card);
  backdrop-filter: blur(6px);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .45rem .6rem;
  max-width: 100%;
  align-self: center;
  box-shadow: 0 4px 10px var(--shadow);
}

.mode-group-panel.is-wrapped {
  border-radius: 12px;
}

.mode-group-panel.is-open {
  display: inline-flex;
}

#modeGroupPrograms {
  width: fit-content;
  margin: 0 auto;
  border-radius: 16px;
}

.program-button-list {
  display: inline-flex;
  flex-wrap: wrap;
  gap: .5rem .65rem;
  align-items: center;
  justify-content: center;
  margin: 0;
}

.program-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: .45rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.1;
  cursor: pointer;
  transition: background .2s, color .2s, transform .1s, border-color .2s;
}

.program-btn:hover {
  background: var(--accent);
  color: var(--accent-contrast, #fff);
  transform: translateY(-1px);
}

.program-btn:focus-visible {
  outline: 3px solid color-mix(in oklab, var(--accent) 60%, transparent);
  outline-offset: 2px;
}

.program-btn.is-selected {
  outline: 4px solid var(--border);
  outline-offset: 0;
}

.program-btn.is-global {
  background: #3f3f3f;
  color: #fff;
  border-color: transparent;
}

.program-btn.is-profile {
  color: #fff;
  border-color: transparent;
}

.program-btn-actions {
  display: inline-flex;
  gap: 0.2rem;
}

.program-icon {
  width: 20px;
  height: 20px;
  font-size: 0.85rem;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.2);
  color: currentColor;
  cursor: pointer;
}

.program-icon:hover {
  background: rgba(255, 255, 255, 0.35);
}

.program-add-btn {
  background: transparent;
  border-style: dashed;
}

.program-add-btn:hover {
  background: var(--panel);
  color: var(--text);
  border-color: var(--border);
}

.mode-group-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  line-height: 1;
}

.mode-group-arrow {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  opacity: 0.8;
  pointer-events: none;
}

/* defaults */
.mode-btn {
  padding: .5rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  transition: background .2s, color .2s, transform .1s, outline-color .2s;
}

.mode-btn:hover {
  background: var(--accent);
  color: var(--accent-contrast, #fff);
}

/* legacy colors */
.mode-btn.grey {
  background: #e9ecef;
  color: #173C56;
}

.mode-btn.lightblue {
  background: #77daff;
  color: #173C56;
}

.mode-btn.blue {
  background: #173C56;
  color: #fff;
  border-color: transparent;
}

.mode-btn.charcoal {
  background: #3f3f3f;
  color: #fff;
  border-color: transparent;
}

/* active: use a WHITE outline so thickness doesn't shift layout */
.mode-btn.active {
  outline: 4px solid var(--accent);
  /* default accent ring */
  outline-offset: 0;
}

/* dark buttons: force WHITE ring on active */
.mode-btn.blue.active {
  outline-color: #77daff;
  /* white ring on dark blue */
}

.mode-btn.charcoal.active {
  outline-color: var(--border);
}


.game-active .mode-button-bar,
.game-active .title,
.game-active .metrics,
.game-active .author-text,
.game-active .main-actions,
.game-active #openProfilePanel,
.game-active #settingsBtn,
.game-active #hilfeBtn,
.game-active #dataBtn,
.game-active #instructionsBtn,
.game-active #mainLogo {
  display: none;
}

/* Hide fixation marker while a game is running */
.game-active #fixationDot {
  opacity: 0;
  pointer-events: none;
}

/* Hide the theme toggle pill while a game is active */
body.game-active .theme-toggle-bar {
  display: none !important;
}


/* ==========================================================================
   I) INSTRUCTION PANEL / WALKTHROUGH
   - Slide-in instructions, pagination dots, progress bars, arrows
   ========================================================================== */

/* Panel container */
.instruction-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(2px);
  display: none;
  z-index: 1000;
}

.instruction-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(1100px, 92vw);
  height: auto;
  max-height: calc(100vh - 12vh);
  background: var(--card);
  z-index: 1200;
  display: none;
  grid-template-columns: 64px minmax(0, 1fr) 64px;
  grid-template-rows: auto auto;
  grid-template-areas:
    "prev content next"
    "dots dots dots";
  gap: 1rem 1.25rem;
  padding: 1.5rem 1.75rem;
  border-radius: 16px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
  align-items: center;
  justify-items: center;
  overflow: hidden;
}

/* Instruction overlay mockup container */
#instructionPanel .mockup-screen {
  position: relative;
  width: 78%;
  max-width: 780px;
  aspect-ratio: 16 / 9;
  min-height: 260px;
  max-height: 38vh;
  border: 5px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* source.  */

.instruction-panel.active {
  display: grid;
}

/* source. :contentReference[oaicite:1]{index=1} */

/* Inner content */
.instruction-content {
  grid-area: content;
  width: 100%;
  height: 100%;
  text-align: center;
  font-family: 'Montserrat', Arial, sans-serif;
  font-size: 1.1rem;
  color: var(--text);
  display: grid;
  grid-template-rows: auto auto auto;
  gap: 1rem;
  justify-items: center;
  align-content: start;
}
/* source.  */

.instruction-text {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.5;
  color: var(--text);
  max-height: none;
  overflow: visible;
}

.instruction-mode-label {
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted, #666);
}

.nav-arrow {
  width: 42px;
  height: 42px;
  cursor: pointer;
  position: static;
  object-fit: contain;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.25));
}

.left-arrow {
  grid-area: prev;
  justify-self: end;
}

.right-arrow {
  grid-area: next;
  justify-self: start;
}

.instruction-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: transparent;
  border: none;
  font-size: 28px;
  line-height: 1;
  color: var(--muted, #666);
  cursor: pointer;
  padding: 6px;
}

.instruction-close:hover {
  color: var(--text);
}

/* Pagination dots */
.pagination-dots {
  grid-area: dots;
  position: static;
  bottom: auto;
  left: auto;
  transform: none;
  display: flex;
  gap: 0.5rem;
  z-index: auto;
}

/* source.  */

.pagination-dots .dot {
  width: 10px;
  height: 10px;
  background: #ccc;
  border-radius: 50%;
  transition: background 0.3s ease;
}

/* source. :contentReference[oaicite:9]{index=9} */

.pagination-dots .dot.is-active,
.pagination-dots .dot.active {
  /* keep .active for backward compat */
  background: var(--accent);
}

/* source. :contentReference[oaicite:10]{index=10} */

/* Progress bars */
.progress-bar {
  position: fixed;
  /* relative to viewport */
  width: 100vw;
  height: 10px;
  background: #e0e0e0;
  z-index: 1001;
  overflow: hidden;
  display: none;
  /* shown by JS */
}

/* source.  */

.progress-bar.top-bar {
  top: 0;
  left: 0;
}

/* source. :contentReference[oaicite:12]{index=12} */
.progress-bar.bottom-bar {
  bottom: 0;
  left: 0;
}

/* source. :contentReference[oaicite:13]{index=13} */

.progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.3s ease;
}

/* source. :contentReference[oaicite:14]{index=14} */

/* optional variant used by JS for duration animation */
.progress-fill.duration-fill {
  transition: width linear;
}

/* source. :contentReference[oaicite:15]{index=15} */
.progress-fill.grey {
  background: #808080;
}

/* source. :contentReference[oaicite:16]{index=16} */

/* Tick marks for trials under the bar */
.trial-increments {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
}

/* source. :contentReference[oaicite:17]{index=17} */

.trial-increments .increment {
  flex: 1;
  border-right: 1px solid rgba(0, 0, 0, 0.2);
}

.trial-increments .increment:last-child {
  border-right: none;
}

/* source. :contentReference[oaicite:18]{index=18} */

/* ==========================================================================
   J) LOGIN SCREEN & SLIDER
   - Split layout, carousel pages, fixed nav bars and dots
   ========================================================================== */

/* Full viewport split layout */
.login-wrapper {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: clamp(14px, 2vw, 28px);
  width: min(1200px, 94vw);
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  height: auto;
  margin: 0 auto;
  padding: clamp(16px, 2.5vw, 32px);
  font-size: clamp(1rem, 1.1vw, 1.2rem);
  font-family: 'Montserrat', sans-serif;
  border-radius: 28px;
  background:
    radial-gradient(420px 420px at 8% 12%, rgba(23, 60, 86, 0.08), transparent 60%),
    radial-gradient(460px 460px at 95% 85%, rgba(23, 60, 86, 0.1), transparent 65%),
    linear-gradient(140deg, #f7f9fc 0%, #eef2f6 55%, #f7f9fc 100%);
  box-shadow: 0 28px 80px rgba(15, 42, 60, 0.18);
  overflow: hidden;
  position: relative;
  isolation: isolate;
}

/* source. :contentReference[oaicite:0]{index=0} */

.login-left {
  flex: 1 1 45%;
  background: linear-gradient(180deg, #ffffff 0%, #f7f9fc 100%);
  padding: clamp(24px, 3vw, 42px);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  position: relative;
  /* anchors .form-panel in your CSS */
  isolation: isolate;
  overflow: visible;
  border: 1px solid rgba(23, 60, 86, 0.1);
  border-radius: 22px;
  box-shadow: 0 18px 40px rgba(15, 42, 60, 0.14);
  align-self: stretch;
}

.login-left::before {
  display: none;
}

.login-left::after {
  display: none;
}

.login-left-card {
  display: contents;
}

.login-left-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.login-subtitle {
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 0.25rem;
}

.hero-note {
  margin-top: auto;
  padding: 14px 16px;
  border: 1px solid rgba(23, 60, 86, 0.12);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 14px 30px rgba(15, 42, 60, 0.12);
  display: flex;
  align-items: center;
  gap: 12px;
}

.hero-note h2 {
  color: #173C56;
  font-size: clamp(1rem, 1.1vw, 1.15rem);
  margin: 6px 0;
}

.hero-note p {
  color: #4a6173;
  margin: 0;
  line-height: 1.45;
  font-size: clamp(0.9rem, 1vw, 0.98rem);
}

.hero-note .hero-pill {
  margin: 0;
  flex: 0 0 auto;
}

/* source.  */

.login-right {
  width: 100%;
  flex: 1.35 1 55%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(220px 220px at 85% 10%, rgba(255, 255, 255, 0.12), transparent 70%),
    radial-gradient(220px 220px at 12% 22%, rgba(255, 255, 255, 0.08), transparent 70%),
    linear-gradient(150deg, #1f4f73 0%, #173C56 55%, #0f2f45 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  gap: clamp(8px, 1.5vw, 18px);
  position: relative;
  overflow: hidden;
  min-width: 0;
  padding: clamp(18px, 2.6vw, 32px);
  color: #f1f6ff;
  border-radius: 22px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  align-self: stretch;
}

.login-right::before,
.login-right::after {
  content: "";
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
  filter: blur(1px);
  opacity: 0.6;
}

.login-right::before {
  width: 260px;
  height: 260px;
  background: radial-gradient(circle at 40% 40%, rgba(255, 255, 255, 0.12), transparent 65%);
  top: -60px;
  right: -60px;
}

.login-right::after {
  width: 320px;
  height: 320px;
  background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.06), transparent 70%);
  bottom: -90px;
  left: -80px;
}

.right-hero {
  display: none;
}

.right-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(180px 180px at 80% 80%, rgba(255, 255, 255, 0.12), transparent 70%);
  pointer-events: none;
}

.hero-copy h2 {
  color: #f7fbff;
  font-size: clamp(1.4rem, 2.2vw, 1.8rem);
  line-height: 1.2;
  margin-bottom: 0.35rem;
}

.hero-copy p {
  color: rgba(241, 246, 255, 0.9);
  margin: 0.35rem 0 0.5rem;
  font-size: 0.98rem;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(23, 60, 86, 0.12);
  color: #173C56;
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: 0.02em;
}

.hero-visual {
  text-align: center;
}

.hero-visual img {
  width: min(440px, 100%);
  height: auto;
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

.nav-wrapper {
  display: none;
}

.info-card {
  width: 100%;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  border-radius: 20px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(6px);
  overflow: hidden;
  padding: clamp(22px, 3vw, 32px);
  position: relative;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  font-size: 1.25rem;
}

.info-card--stacked {
  max-width: none;
}

.info-card-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

.info-card-header h2 {
  margin: 0;
  color: var(--text);
}

/* source. :contentReference[oaicite:2]{index=2} */

/* Branding title under logo */
.branding {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  margin-bottom: 0.8rem;
}

.login-title {
  font-weight: 700;
  font-size: clamp(1.7rem, 3vw, 2.4rem);
  color: var(--text);
  margin-top: 0.5rem;
  text-align: center;
  letter-spacing: 0.02em;
}

.login-wrapper .login-logo {
  max-width: clamp(150px, 24vw, 220px);
}

.login-wrapper .hero-pill,
.login-wrapper .page-pill {
  font-size: clamp(0.85rem, 1vw, 1rem);
  padding: 6px 12px;
  letter-spacing: 0.04em;
}

/* Action links under the form */
.login-links {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.6rem;
}

#loginForm + .login-links {
  margin-top: 0;
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.link-btn:hover {
  color: #1f4f73;
  border-color: currentColor;
}

.inline-links {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
  margin-top: 0.2rem;
}

.login-text.centered-text {
  text-align: center;
  width: 100%;
  display: block;
}

/* Carousel wrapper & pages */
.page-container {
  position: relative;
  width: 100%;
  padding: clamp(14px, 2vw, 22px);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1;
  flex: 1;
  min-height: 0;
  padding-bottom: 36px;
  max-height: 100%;
  height: 100%;
}

.page-section p {
  margin-bottom: 0.95rem;
  line-height: 1.65;
}

.page-section p:last-child {
  margin-bottom: 0;
}

.page-section a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.page-section a:hover {
  text-decoration: underline;
}

/* source. :contentReference[oaicite:3]{index=3} */

.page-section {
  display: none;
}

/* inactive */
.page-section.active {
  display: block;
}

/* active page */
.login-highlight-word {
  padding: 0.1rem 0.15rem;
  border-radius: 6px;
  transition: background .2s, color .2s;
}

.login-highlight-word.is-active {
  background: var(--accent, #173C56);
  color: #fff;
}

/* source. :contentReference[oaicite:4]{index=4} */

/* Dots row (fixed at bottom of right half) */
.dots {
  position: static;
  transform: none;
  display: flex;
  gap: 10px;
  z-index: 2;
}

/* source. :contentReference[oaicite:9]{index=9} */

.dots span {
  width: 10px;
  height: 10px;
  background: #ccc;
  border-radius: 50%;
  display: inline-block;
  transition: background 0.3s;
}

/* source. :contentReference[oaicite:10]{index=10} */

/* Active dot (supports both .is-active and legacy .active) */
.dots span.is-active,
.dots span.active {
  background: var(--accent);
}

.page-pill {
  margin-bottom: 10px;
  font-size: 1.25rem;
  line-height: 1.05;
}

/* Force page-pill size on info pages (prevent inheriting larger hero-pill styles) */
.info-card .page-pill {
  font-size: 1.25rem !important;
  line-height: 1.05;
}

.slideshow {
  margin-top: 12px;
  display: grid;
  place-items: center;
  position: relative;
}

.slideshow img {
  width: 100%;
  max-width: 520px;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}

.slide-label {
  position: absolute;
  top: 16px;
  left: 26px;
  padding: 6px 10px;
  border-radius: 12px;
  background: rgba(23, 60, 86, 0.9);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
  z-index: 2;
}

.portrait-wrap {
  text-align: center;
  margin: 8px 0 12px;
}

.portrait-img {
  width: min(240px, 60%);
  height: auto;
  border-radius: 14px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
}

.pager-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 16px 8px;
  flex-wrap: wrap;
  flex: 0 0 auto;
}

.pager-btn {
  border: 1px solid rgba(23, 60, 86, 0.18);
  background: #f6f8fb;
  color: var(--text);
  border-radius: 10px;
  padding: 8px 14px;
  cursor: pointer;
  font-family: 'Montserrat', Arial, sans-serif;
  font-weight: 700;
  transition: background 0.2s ease, transform 0.1s ease;
}

.pager-btn:hover {
  background: #e8edf5;
  transform: translateY(-1px);
}

.pager-btn:active {
  transform: translateY(0);
}

/* source. :contentReference[oaicite:11]{index=11} */

/* Responsive tweaks */
@media (max-width: 1024px) {
  .login-wrapper {
    flex-direction: column;
    padding: clamp(14px, 2vw, 24px);
    gap: clamp(12px, 2vw, 20px);
    width: min(960px, 94vw);
    height: auto;
    font-size: clamp(0.98rem, 1.4vw, 1.05rem);
  }

  .login-left,
  .login-right {
    border-radius: 20px;
    min-height: auto;
    height: auto;
  }

  .login-right {
    padding: clamp(16px, 3vw, 28px);
    min-height: auto;
    max-height: none;
  }

  .info-card {
    border-radius: 20px;
    max-height: none;
    height: auto;
    font-size: clamp(0.98rem, 1.4vw, 1.05rem);
  }
}

@media (max-width: 1400px) {
  .login-wrapper {
    font-size: 1.12rem;
  }
  .hero-pill {
    font-size: 1.15rem;
  }
  .info-card {
    font-size: 1.1rem;
  }
  .login-logo {
    max-width: 200px;
  }
}

@media (max-width: 1700px) {
  .login-logo {
    max-width: 180px;
  }
  .hero-pill {
    font-size: 0.75rem;
  }
  .info-card {
    font-size: 0.95rem;
  }
  .page-pill {
    font-size: 1.1rem;
  }
}

@media (min-width: 1920px) {
  .login-wrapper {
    width: min(1500px, 90vw);
  }
}

/* Widescreen/aspect-ratio safeguard: scale down type instead of stretching at wide zooms */
@media (min-aspect-ratio: 16/9) {
  .login-wrapper {
    font-size: 1.05rem;
    max-height: 94vh;
  }
  .info-card {
    font-size: 1.05rem;
  }
  .hero-pill {
    font-size: 0.9rem;
  }
  .page-pill {
    font-size: 1rem;
  }
  .login-logo {
    max-width: 160px;
  }
}

/* Compact layout for lower viewport heights (e.g., zoomed-in 150% around 1360x813) */
@media (max-height: 900px) {
  .login-wrapper {
    font-size: 1rem;
    padding: clamp(12px, 2vw, 20px);
    max-height: none;
  }
  .login-left {
    padding: clamp(16px, 3vw, 26px);
  }
  .login-right {
    padding: clamp(14px, 2vw, 24px);
  }
  .info-card {
    font-size: 0.95rem;
    padding: clamp(16px, 2vw, 22px);
  }
  .hero-pill {
    font-size: 0.75rem;
  }
  .info-card .page-pill {
    font-size: 1rem !important;
  }
  .login-logo {
    max-width: 140px;
  }
  .login-form {
    max-width: 380px;
    padding: 1.6rem;
  }
  .hero-note h2 {
    font-size: 1rem;
  }
  .hero-note p {
    font-size: 0.9rem;
  }
}

@media (max-width: 768px) {
  .login-wrapper {
    position: relative;
  }

  .login-left {
    z-index: 2;
  }

  .login-right {
    z-index: 1;
  }

  .login-left-card {
    width: min(520px, 100%);
  }

  .form-panel {
    position: fixed;
    inset: 0;
    height: 100dvh;
    max-height: 100dvh;
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
    align-items: flex-start;
    justify-content: flex-start;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    z-index: 3000;
  }

  .form-panel .login-form {
    width: min(520px, 100%);
    margin: 0 auto;
  }

  #welcomePanel .login-actions {
    gap: 0.75rem !important;
    flex-wrap: wrap;
    justify-content: center !important;
    width: 100%;
  }

  #welcomePanel .login-actions .login-btn {
    flex: 1 1 140px;
    max-width: 220px;
  }
}

@media (max-width: 640px) {
  .login-wrapper {
    width: 100%;
    border-radius: 0;
    padding: 12px 14px;
    box-shadow: none;
  }

  .login-left,
  .login-right,
  .info-card {
    border-radius: 16px;
  }

  .login-right {
    padding: 16px;
  }

  .login-form {
    padding: 1.4rem;
  }

  .hero-note {
    padding: 12px;
  }
}

/* source. :contentReference[oaicite:12]{index=12} */

/* ==========================================================================
   K) HEADER ACTIONS (TOP/BOTTOM CONTROLS)
   - Settings, profile, data, logout
   ========================================================================== */

/* Base icon-only buttons */
/* Canonical icon pill — matches theme-toggle pill (light & dark) */
button.icon-btn,
.icon-btn {
  position: absolute;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--card);
  /* same token as .theme-toggle-pill */
  border: 1px solid var(--border);
  box-shadow: 0 6px 20px var(--shadow);
  cursor: pointer;
  z-index: 2001;
  transition: transform .12s, box-shadow .12s, background .12s;
}

button.icon-btn:hover,
.icon-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px var(--shadow);
}

button.icon-btn .icon,
.icon-btn .icon {
  width: 60%;
  height: 60%;
  object-fit: contain;
  pointer-events: none;
}

/* positions (keep as-is) */
#logoutBtn.icon-btn {
  top: 1vh;
  left: 1vw;
}

#dataBtn.icon-btn {
  bottom: 1vh;
  left: 1vw;
}

#openProfilePanel.icon-btn {
  bottom: 1vh;
  right: 1vw;
}

#settingsBtn.icon-btn {
  top: 1vh;
  right: 1vw;
}

.logout-btn {
  position: absolute;
  top: 1vh;
  left: 1vw;
  z-index: 2001;
  color: #173C56;
}

.data-btn {
  position: absolute;
  bottom: 1vh;
  left: 1vw;
  z-index: 2001;
  color: #173C56;
}

/* Optional clusters (when grouping multiple buttons in corners) */
.controls-top-left,
.controls-top-right,
.controls-bottom-left,
.controls-bottom-right {
  position: absolute;
  display: flex;
  gap: .5rem;
}

.controls-top-left {
  top: 1rem;
  left: 1rem;
}

.controls-top-right {
  top: 1rem;
  right: 1rem;
}

.controls-bottom-left {
  bottom: 1rem;
  left: 1rem;
}

.controls-bottom-right {
  bottom: 1rem;
  right: 1rem;
}

/* ======================================================================
   K1) THEME TOGGLE (dark mode slider) + Hilfe on same pill
   ====================================================================== */
.theme-toggle-bar {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  right: auto;
  width: auto;
  display: flex;
  justify-content: center;
  pointer-events: none;
  /* container stays click-through */
  z-index: 9999;
}

.theme-toggle {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 6px 14px;
  /* more padding inside pill */
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: background .2s, border-color .2s;
}

.theme-toggle-pill {
  pointer-events: auto;
  /* children are clickable */
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 6px 14px;
  min-width: 0;
  /* ensure enough width */
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: 0 6px 20px var(--shadow);
}

body.ui-overlay-open .theme-toggle-bar {
  z-index: 900;
}

body.ui-overlay-open .theme-toggle-pill {
  opacity: 0.35;
  filter: grayscale(1);
  pointer-events: none;
}

body.program-overlay-open .theme-toggle-pill {
  filter: grayscale(1) blur(2px);
}

body.ui-overlay-open .mode-button-bar {
  z-index: 900;
}

/* tiny divider between the slider and Hilfe */
.theme-toggle-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
  opacity: .7;
}

.theme-toggle__input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  display: none;
}

.theme-toggle__icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: .6;
  transition: opacity .2s;
}

.theme-toggle__icon svg {
  width: 18px;
  height: 18px;
  fill: var(--text);
}

.theme-toggle__track {
  position: relative;
  width: 48px;
  height: 26px;
  background: var(--muted);
  border-radius: 999px;
  transition: background .2s;
}

.theme-toggle__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
  transition: transform .22s, background .2s;
}

.theme-toggle__input:checked+.theme-toggle[role="switch"] .theme-toggle__thumb {
  transform: translateX(22px);
}

.theme-toggle__input:not(:checked)+.theme-toggle .theme-toggle__icon--sun {
  opacity: 1;
}

.theme-toggle__input:checked+.theme-toggle .theme-toggle__icon--moon {
  opacity: 1;
}

/* Style the Hilfe button as a pill and ensure it participates in layout */
.help-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 1rem;
  /* room for the text */
  height: 32px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  /* prevent wrap */
  cursor: pointer;
  transition: transform .1s, background .2s, color .2s, border-color .2s;
}

.help-btn:hover {
  background: var(--accent);
  color: var(--accent-contrast, #fff);
  border-color: var(--accent);
}

.pill-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  min-height: 32px;
  padding: 0 0.65rem;
  gap: 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
  cursor: pointer;
  transition: transform .1s, background .2s, border-color .2s;
}

.pill-icon-btn:hover {
  background: color-mix(in oklab, var(--accent) 12%, var(--card));
  border-color: var(--accent);
}

/* Prevent hover lift on main screen controls so they don't jump after game end */
.theme-toggle-pill .pill-icon-btn:hover,
.theme-toggle-pill .help-btn:hover,
.main-actions .btn:hover,
.profile-status-btn:hover {
  transform: none;
}

.pill-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
  pointer-events: none;
}

.pill-label {
  pointer-events: none;
}

/* compact tweak on very small screens */
@media (max-width: 480px) {
  .theme-toggle {
    gap: 8px;
    padding: 6px 8px;
  }

  .theme-toggle #hilfeBtn {
    width: 30px;
    height: 30px;
  }
}

/* ==========================================================================
   L) HELP OVERLAY
   - Onboarding arrows and labels
   ========================================================================== */

/* Fullscreen overlay behind help hints */
.hilfe-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  /* semi-transparent scrim */
  z-index: 3000;
  display: none;
  /* toggled on when active */
}

.hilfe-overlay.active {
  display: block;
}

/* Bubble labels */
.help-text {
  position: absolute;
  padding: 0.5rem 1rem;
  background: var(--panel);
  color: var(--text);
  border-radius: var(--radius, 8px);
  font-size: 1rem;
  font-family: 'Montserrat', Arial, sans-serif;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  z-index: 3100;
}

/* Arrows (base) */
.arrow {
  width: 0;
  height: 0;
  position: absolute;
  border-style: solid;
  z-index: 3101;
}

/* Arrow direction variants */
.arrow-up {
  border-width: 0 10px 10px 10px;
  border-color: transparent transparent white transparent;
}

.arrow-down {
  border-width: 10px 10px 0 10px;
  border-color: white transparent transparent transparent;
}

.arrow-left {
  border-width: 10px 10px 10px 0;
  border-color: transparent white transparent transparent;
}

.arrow-right {
  border-width: 10px 0 10px 10px;
  border-color: transparent transparent transparent white;
}

/* Target-specific placements (examples) */
.help-logout {
  bottom: 5.5rem;
  left: calc(50% - 170px);
}

.help-profile {
  top: 7.5rem;
  left: 50%;
  transform: translateX(-50%);
}

.help-data {
  bottom: 5.5rem;
  left: calc(50% + 130px);
  transform: translateX(-50%);
}

.help-settings {
  top: 12.5rem;
  left: 50%;
  transform: translateX(-50%);
}

.help-mode {
  position: absolute;
  /* or fixed, depending on use */
  top: 5rem;
  /* keep vertical offset */
  left: 50%;
  /* start at horizontal center */
  transform: translateX(-50%);
  /* pull it back by half its own width */
}

.help-toggle {
  position: absolute;
  /* or fixed, depending on use */
  bottom: 5rem;
  /* keep vertical offset */
  left: 50%;
  /* start at horizontal center */
  transform: translateX(-50%);
  /* pull it back by half its own width */
}

.help-instruction {
  position: absolute;
  /* or fixed, depending on use */
  bottom: 25%;
  /* keep vertical offset */
  left: 50%;
  /* start at horizontal center */
  transform: translateX(-50%);
  /* pull it back by half its own width */
}

/* ==========================================================================
   M) END-OF-GAME FEEDBACK
   - Compact summary card shown after max. Durchgänge
   ========================================================================== */
.end-feedback-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: transparent;
  backdrop-filter: none;
  z-index: 3200;
  padding: 1rem;
}

.end-feedback-overlay.program {
  background: rgba(255, 255, 255, 0.92);
}

.end-feedback-overlay.active {
  display: flex;
}

.end-feedback-overlay.prep {
  display: flex;
}

.end-feedback-overlay.prep .end-feedback-card {
  opacity: 0;
  visibility: hidden;
}

.end-feedback-card {
  width: min(520px, 94vw);
  background: var(--card);
  color: var(--text);
  border-radius: 14px;
  padding: 1.5rem;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.end-feedback-header {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  text-align: left;
}

.end-feedback-kicker {
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}

.end-feedback-card h3 {
  margin: 0;
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  font-weight: 700;
  color: var(--text);
}

.end-feedback-card .muted {
  color: var(--muted);
  font-size: 0.95rem;
}

.end-feedback-next {
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
}

.end-feedback-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
}

.end-feedback-item {
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: color-mix(in oklab, var(--card) 90%, transparent);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.end-feedback-item .label {
  font-size: 0.9rem;
  color: var(--muted);
}

.end-feedback-item .value {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.end-feedback-card .btn {
  align-self: center;
  min-width: 120px;
}

/* Program start panel (before each program step) */
.program-start-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.92);
  z-index: 2001;
  padding: 1rem;
}

body.theme-dark .program-start-overlay {
  background: rgba(17, 24, 39, 0.92);
}

.program-start-overlay.active {
  display: flex;
}

.program-start-card {
  width: min(520px, 94vw);
  background: var(--card);
  color: var(--text);
  border-radius: 14px;
  padding: 1.5rem;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  text-align: center;
}

.program-start-header {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.program-start-title {
  margin: 0;
  font-size: clamp(1.3rem, 2.4vw, 1.7rem);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.program-start-meta {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
}

.program-start-card .btn {
  min-width: 140px;
}

@media (max-width: 520px) {
  .end-feedback-card {
    padding: 1.1rem;
  }

  .end-feedback-content {
    grid-template-columns: 1fr;
  }

  .end-feedback-card .btn {
    width: 100%;
  }
}

/* Medal celebration overlay */
.medal-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
  z-index: 3300;
}

.medal-overlay.active {
  display: flex;
}

.medal-card {
  background: var(--card);
  color: var(--text);
  border-radius: 14px;
  padding: 1.4rem 1.6rem;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.25);
  width: min(560px, 94vw);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow: hidden;
}

.medal-kicker {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.9rem;
  color: var(--text);
  margin: 0;
}

.medal-stage {
  position: relative;
  width: 220px;
  height: 220px;
  margin: 0 auto;
}

.medal-img {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 150px;
  height: auto;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.medal-img--old {
  transition: opacity 0.9s ease, transform 0.9s ease;
}

.medal-img--old.show {
  opacity: 0.9;
  transform: scale(1);
}

.medal-img--old.fade-out {
  opacity: 0;
  transform: scale(0.9) translateY(-10px);
}

.medal-img--new.show {
  opacity: 1;
  transform: scale(1.05);
}

.medal-img--new.pulse {
  animation: medal-pop 1s ease;
}

@keyframes medal-pop {
  0% { transform: scale(0.4); opacity: 0; }
  50% { transform: scale(1.12); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* ==========================================================================
   N) MODE-SPECIFIC (NAMESPACE!)
   - Scope all mode visuals to avoid leaks across modes
   ========================================================================== */

/* Recommended root: <body data-mode="schwimmen"> or <div class="mode mode--schwimmen"> */

/* -- Schwimmen ------------------------------------------------------------ */
.mode--schwimmen .duck {
  width: 4vw;
  height: auto;
  max-width: 130px;
  pointer-events: none;
  user-select: none;
  position: absolute;
  object-fit: contain;
  transition: left 0.5s linear, top 0.5s linear;
}

.mode--schwimmen .duck-guide {
  width: 2.5vw;
  height: auto;
  max-width: 100px;
  opacity: 0.8;
  pointer-events: none;
  user-select: none;
  position: absolute;
  object-fit: contain;
  transition: left 0.5s linear, top 0.5s linear;
}

.mode--schwimmen .bread {
  width: 5vw;
  height: auto;
  max-width: 100px;
  cursor: pointer;
  position: absolute;
  z-index: 6;
  object-fit: contain;
  transition: left 0.5s linear, top 0.5s linear;
}

/* -- Vergleich ------------------------------------------------------------ */
.mode--vergleich .vergleich-grid {
  width: 80%;
  height: 80%;
  position: absolute;
  left: 10%;
  top: 10%;
  z-index: 3;
}

.mode--vergleich .grid-cell {
  float: left;
  background-size: 80%;
  background-position: center;
  background-repeat: no-repeat;
  cursor: pointer;
  border: none;
}

.mode--vergleich .grid-line {
  position: absolute;
  left: 50%;
  top: 0;
  height: 100%;
  width: 2px;
  background: black;
  z-index: 5;
}

/* -- Autofahren ----------------------------------------------------------- */
.mode--autofahren img[src*="autofahren"] {
  position: absolute;
  object-fit: contain;
}

/* -- Schiessen ------------------------------------------------------------ */
/* .mode--schiessen .target-board {
  placeholder: add background/board styling here 
}/* 

/* .mode--schiessen .bullet {
  placeholder: add bullet marker styling here
}/*

/* -- Fangen --------------------------------------------------------------- */
.mode--fangen .goal {
  position: absolute;
  background-color: rgba(50, 205, 50, 0.4);
  height: 100%;
}

.mode--fangen .footballer,
.mode--fangen .football,
.mode--fangen .goal-image {
  position: absolute;
}

/* -- Reihenfolge ---------------------------------------------------------- */
.mode--reihenfolge .cheese {
  position: absolute;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: top;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}

/* -- Punkte --------------------------------------------------------------- */
.mode--punkte .target {
  width: 2vw;
  height: 2vw;
  background-color: blue;
  border-radius: 50%;
  position: absolute;
  z-index: 10;
  cursor: pointer;
}

.punkte-controls {
  position: absolute;
  left: 50%;
  bottom: 2vh;
  transform: translateX(-50%);
  display: none;
  gap: 2vw;
  z-index: 25;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}

.punkte-btn {
  width: clamp(64px, 10vw, 96px);
  height: clamp(64px, 10vw, 96px);
  border-radius: 18px;
  border: none;
  font-family: 'Montserrat', Arial, sans-serif;
  font-size: clamp(32px, 6vw, 56px);
  font-weight: 800;
  color: white;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.punkte-btn:focus-visible {
  outline: 3px solid white;
  outline-offset: 4px;
}

.punkte-btn--yes {
  background: linear-gradient(135deg, #16a34a, #22c55e);
}

.punkte-btn--no {
  background: linear-gradient(135deg, #dc2626, #ef4444);
}

.punkte-btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.25);
  filter: brightness(1.02);
}

.punkte-btn:active {
  transform: translateY(1px) scale(0.98);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.2);
}

/* -- Folgen --------------------------------------------------------------- */
.mode--folgen .moving-dot {
  width: 2vw;
  height: 2vw;
  border-radius: 50%;
  position: absolute;
  z-index: 10;
  transition: left 0.5s ease, top 0.5s ease;
}

/* -- Normal ---------------------------------------------------------------
.mode--normal {
  placeholder: normal mode doesn’t add extra visuals
} /*

/* ==========================================================================
   UTILITIES (OPTIONAL)
   - Small one-line helpers: spacing, visibility, layout
   ========================================================================== */

.u-hidden {
  display: none !important;
}

.u-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.u-flex {
  display: flex !important;
}

.u-grid {
  display: grid !important;
}

.u-center {
  display: grid;
  place-items: center;
}

.u-gap {
  gap: var(--gap);
}

.u-gap-sm {
  gap: var(--gap-sm);
}

/* Compat: keep game area hidden until activated by JS */
#gameArea {
  display: none;
  background: transparent;
}

#gameArea.active {
  display: block;
}

/* Compat: keep the background truly behind the app */
#backgroundLayer {
  position: fixed !important;
  inset: 0 !important;
  z-index: -1 !important;
}

/* === Settings overlay input styling (scoped) === */
#settingsOverlay .input-item input,
#settingsOverlay .input-item select {
  width: min(240px, 100%);
  height: 38px;
  padding: 0 .75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  font: 600 14px/1 'Montserrat', Arial, sans-serif;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

#settingsOverlay .input-item input.adaptive-highlight,
#settingsOverlay .input-item select.adaptive-highlight {
  background: color-mix(in oklab, var(--accent) 12%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--accent) 18%, transparent);
}

/* Focus ring */
#settingsOverlay .input-item input:focus,
#settingsOverlay .input-item select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 20%, transparent);
}

/* Disabled state */
#settingsOverlay .input-item input:disabled,
#settingsOverlay .input-item select:disabled {
  opacity: .65;
  cursor: not-allowed;
}

/* Invalid state (when you validate) */
#settingsOverlay .input-item input:invalid {
  border-color: #e5484d;
  box-shadow: 0 0 0 3px color-mix(in oklab, #e5484d 20%, transparent);
}

/* Number inputs – hide native spinners (Chrome/Edge/Safari) */
#settingsOverlay .input-item input[type="number"]::-webkit-outer-spin-button,
#settingsOverlay .input-item input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
/* Number inputs – hide spinners (Firefox) */
#settingsOverlay .input-item input[type="number"] {
  -moz-appearance: textfield;
}

/* Selects – consistent arrow + spacing */
#settingsOverlay .input-item select.input-select,
#settingsOverlay .input-item select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%),
    linear-gradient(to right, transparent, transparent);
  background-position:
    calc(100% - 18px) 50%,
    calc(100% - 12px) 50%,
    100% 0;
  background-size: 6px 6px, 6px 6px, 2.5em 100%;
  background-repeat: no-repeat;
  padding-right: 2.5em; /* room for arrow */
}

/* Label row tidy-up (label + (?) stays tight; input below) */
#settingsOverlay .input-item > .bold {
  display: inline-flex;
  align-items: center;
  gap: .4em;
  margin-bottom: .35em;
}

/* Put two small inputs side-by-side when you use .grid-inputs (e.g. Vergleich rows x cols) */
#settingsOverlay .grid-inputs {
  display: grid;
  grid-template-columns: auto auto auto; /* row input, "×", column input */
  justify-content: start;                /* left align the group */
  align-items: center;
  gap: 0.25rem;                          /* very small space (~4px) */
}

/* Make checkbox rows breathe a bit */
#settingsOverlay .checkbox-item.with-spacing {
  gap: .5rem;
}

/* Optional: unify very narrow numeric fields */
#settingsOverlay input[type="number"][step="0.1"],
#settingsOverlay input[type="number"][min][max] {
  width: 100px;
}

/* === Smaller inputs for Vergleich rows/columns === */
#settingsOverlay #vergleichRows,
#settingsOverlay #vergleichColumns {
  width: 70px;          /* smaller width */
  text-align: center;
  padding: 0.35rem 0.4rem;
}

#settingsOverlay .grid-inputs span {
  font-weight: 600;
  color: var(--text);
  margin: 0;            /* no extra margin */
  line-height: 1;
}

/* Optional: keep them aligned side-by-side neatly inside .grid-inputs */
#settingsOverlay .grid-inputs #vergleichRows,
#settingsOverlay .grid-inputs #vergleichColumns {
  justify-self: center;
}

/* === Einheitliches Styling für Select-Dropdowns (z. B. "Tor") === */
/* Tor-Block als 2-Spalten-Grid: [Label] [ ? ] in Zeile 1, Select darunter */
#torGroup #torSelect {
  grid-column: 1 / span 2; grid-row: 2;
  width: 100%; max-width: 200px;
}

/* Optional: konsistenter Select-Look wie die anderen Inputs */
#torGroup #torSelect {
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius, 6px);
  background: var(--card);
  color: var(--text);
  font-family: 'Montserrat', Arial, sans-serif;
  font-size: 14px;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text) 50%),
                    linear-gradient(135deg, var(--text) 50%, transparent 50%);
  background-position: calc(100% - 15px) center, calc(100% - 10px) center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}
#torGroup #torSelect:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 60, 86, 0.15);
}

/* ========================== Radio Overlay ========================== */
.radio-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 3200;
  backdrop-filter: blur(2px);
}
.radio-overlay.active { display: flex; }

.radio-panel {
  width: min(420px, 90vw);
  background: var(--card);
  color: var(--text);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  --radio-chip-bg: color-mix(in oklab, var(--panel, #f0f0f0) 90%, transparent);
  --radio-chip-bg-hover: color-mix(in oklab, var(--panel, #f0f0f0) 82%, var(--accent, #173C56) 12%);
  --radio-chip-border: var(--border, #e0e0e0);
  --radio-chip-highlight: var(--accent, #173C56);
  --radio-chip-text: var(--text, #173C56);
  --radio-slider-track: color-mix(in oklab, var(--panel, #f0f0f0) 65%, transparent);
  --radio-shadow: 0 2px 8px var(--shadow, rgba(0,0,0,0.15));
}
body.theme-dark .radio-panel {
  --radio-chip-bg: color-mix(in oklab, var(--panel, #4f4f4f) 88%, #000 12%);
  --radio-chip-bg-hover: color-mix(in oklab, var(--panel, #4f4f4f) 78%, var(--accent, #173C56) 18%);
  --radio-chip-border: var(--border, #666666);
  --radio-chip-text: var(--text, #f1f1f1);
  --radio-slider-track: color-mix(in oklab, var(--panel, #4f4f4f) 60%, transparent);
  --radio-shadow: 0 2px 10px rgba(0,0,0,0.45);
}

.radio-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.radio-panel-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.radio-station-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.5rem;
}

.radio-station-btn {
  border: 1px solid var(--radio-chip-border);
  background: var(--radio-chip-bg);
  border-radius: 10px;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  font-family: 'Montserrat', Arial, sans-serif;
  color: var(--radio-chip-text);
  box-shadow: var(--radio-shadow);
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}
.radio-station-btn:hover {
  background: var(--radio-chip-bg-hover);
  border-color: var(--radio-chip-highlight);
  box-shadow: 0 4px 12px var(--shadow, rgba(0,0,0,0.2));
}
.radio-station-btn.active {
  background: var(--radio-chip-highlight);
  color: #fff;
  border-color: var(--radio-chip-highlight);
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--radio-chip-highlight) 45%, transparent), 0 8px 18px var(--shadow, rgba(0,0,0,0.22));
}

.radio-volume {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.radio-volume input[type="range"] {
  --radio-slider-fill: 50%;
  flex: 1;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg,
      var(--radio-chip-highlight, var(--accent)) 0%,
      var(--radio-chip-highlight, var(--accent)) var(--radio-slider-fill),
      var(--radio-slider-track, rgba(23, 60, 86, 0.2)) var(--radio-slider-fill),
      var(--radio-slider-track, rgba(23, 60, 86, 0.2)) 100%);
  outline: none;
  accent-color: var(--radio-chip-highlight, var(--accent));
  -webkit-appearance: none;
  appearance: none;
}
.radio-volume input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--radio-chip-highlight, var(--accent));
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.radio-volume input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--radio-chip-highlight, var(--accent));
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.radio-volume input[type="range"]::-webkit-slider-runnable-track {
  height: 10px;
  border-radius: 999px;
  background: transparent;
}
.radio-volume input[type="range"]::-moz-range-track {
  height: 10px;
  border-radius: 999px;
  background: var(--radio-slider-track, rgba(23, 60, 86, 0.2));
}
.radio-volume input[type="range"]::-moz-range-progress {
  height: 10px;
  border-radius: 999px;
  background: var(--radio-chip-highlight, var(--accent));
}

.radio-switch {
  display: flex;
  align-items: center;
}

.switch-toggle__input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.switch-toggle__track {
  position: relative;
  width: 48px;
  height: 26px;
  background: var(--muted);
  border-radius: 999px;
  transition: background .2s;
}

.switch-toggle__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
  transition: transform .22s, background .2s;
}

.switch-toggle__input:checked + .switch-toggle .switch-toggle__track {
  background: var(--text);
}

#radioMasterToggle:checked + .switch-toggle .switch-toggle__track {
  background: #3DDA77;
}

.switch-toggle__input:checked + .switch-toggle .switch-toggle__thumb {
  transform: translateX(22px);
}

.switch-toggle__label {
  font-family: 'Montserrat', Arial, sans-serif;
  color: var(--text);
}

/* ========================== Lesen Mode ========================== */
.lesen-window {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: none;
  justify-content: center;
  align-items: center;
  text-align: left;
  overflow: hidden;
  background: rgba(255,255,255,0.92);
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  z-index: 1050;
}
.lesen-window.lesen-mark-line-start::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 12px;
  background: #d7182a;
  border-radius: 8px;
  pointer-events: none;
}
.lesen-track {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  white-space: nowrap;
  transition: transform .25s ease;
}
.lesen-window.lesen-single {
  text-align: center;
}
.lesen-word {
  padding: 0.1rem 0.15rem;
  border-radius: 6px;
  transition: background .2s, color .2s;
}
.lesen-high-contrast .lesen-word {
  color: #ffd600;
}
.lesen-high-contrast .lesen-word.active {
  background: #000;
  color: #ffd600;
}
.lesen-high-contrast .lesen-word.muted {
  color: #ffd600;
  opacity: 0.75;
}
.lesen-word.active {
  background: var(--accent, #173C56);
  color: #fff;
}
.lesen-word.muted {
  color: rgba(0,0,0,0.4);
}

.lesen-body {
  width: 100%;
  overflow: hidden;
}
.lesen-body-abschnitt {
  max-height: 60vh;
  overflow-y: auto;
  overflow-x: hidden;
}
.lesen-line-highlight {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  border-bottom: 3px dotted #d7182a;
  pointer-events: none;
  z-index: 2;
  transition: top .15s ease;
}
.lesen-progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-top: 0.75rem;
}
.lesen-progress {
  flex: 1;
  height: 6px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  overflow: hidden;
}
.lesen-progress__fill {
  height: 100%;
  width: 0%;
  background: var(--accent, #173C56);
  transition: width .2s ease;
}
.lesen-progress-dots {
  display: flex;
  align-items: center;
  gap: 8px;
}
.lesen-progress-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.2);
  transition: background .2s ease;
}
.lesen-progress-dot.filled {
  background: var(--accent, #173C56);
}
.lesen-body.lesen-single {
  text-align: center;
}

/* Dark theme tweaks for Lesen so non-active words stay readable */
body.theme-dark .lesen-window {
  background: #edf2fa;
  color: #000;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
body.theme-dark .lesen-window.lesen-mark-line-start::before {
  background: #ff6b6b;
}
body.theme-dark .lesen-word {
  color: #000;
}
body.theme-dark .lesen-word.active {
  background: #b8d2ff;
  color: #000;
}
body.theme-dark .lesen-word.muted {
  color: rgba(0, 0, 0, 0.6);
}
body.theme-dark .lesen-progress {
  background: rgba(26, 36, 51, 0.2);
}
body.theme-dark .lesen-progress__fill {
  background: #7cb4ff;
}
body.theme-dark .lesen-progress-dot {
  background: rgba(0, 0, 0, 0.35);
}
body.theme-dark .lesen-progress-dot.filled {
  background: #7cb4ff;
}
/* High-contrast should stay consistent even in dark mode */
body.theme-dark .lesen-high-contrast .lesen-word {
  color: #ffd600;
}
body.theme-dark .lesen-high-contrast .lesen-word.active {
  background: #000;
  color: #ffd600;
}
body.theme-dark .lesen-high-contrast .lesen-word.muted {
  color: #ffd600;
  opacity: 0.75;
}
body.theme-dark .lesen-line-highlight {
  border-color: #ff6b6b;
}

/* ==========================================================================
   END
   ========================================================================== */
