@layer components, utilities, accessibility;

@layer components {
:root{
  --bg:#1e2127;
  --elev:#252b33;
  --elev-rgb: 37, 43, 51;
  --participant-pill-bg:#2b3139;
  --dropdown-separator: rgba(231,235,240,0.24);
  --names-divider: rgba(231,235,240,0.46);
  --text:#e7ebf0;
  --muted:#aab1bc;
  --accent:#B5121B;
  --ready-accent: #2F6B3B;
  --accent-weak:#343b44;
  --ring:#3a424d;
  --content-w: 900px;
  --app-max-width: 560px;
  --app-width: min(100vw, var(--app-max-width));
  --desktop-scale: 1;
  --control-h: calc(52px * var(--desktop-scale));
  --rail-h: calc(40px * var(--desktop-scale));
  --card-radius: calc(20px * var(--desktop-scale));
  --space-1: calc(6px * var(--desktop-scale));
  --space-2: calc(12px * var(--desktop-scale));
  --space-3: calc(16px * var(--desktop-scale));
  --space-4: calc(24px * var(--desktop-scale));
  --error: #ff6b6b;
  --warning: #B5121B;
  --surface-1: #252b33;
  --surface-2: #2b3139;
  --surface-3: #38404b;
  --control-bg: #242a32;
  --mobile-bar-border: rgba(231, 235, 240, 0.14);
  /* Mobile UI tokens: one source for the guest flow layout. */
  --mobile-main-inline-gap: 16px;
  --mobile-progress-inline-gap: 12px;
  --mobile-progress-height: 36px;
  --mobile-ready-height: calc((var(--app-width) - (var(--mobile-progress-inline-gap) * 2)) / 1.6 + 68px);
  --mobile-ready-min-height: 308px;
  --mobile-ready-radius: 12px;
  --mobile-ready-content-gap: 12px;
  --mobile-identity-height: 64px;
  --mobile-dropdown-height: 38px;
  --mobile-dropdown-font-size: 16px;
  --mobile-dropdown-radius: 999px;
  --mobile-dropdown-open-radius: var(--card-radius) var(--card-radius) 0 0;
  --mobile-dropdown-menu-radius: 0 0 var(--card-radius) var(--card-radius);
  --mobile-status-surface: rgba(0, 0, 0, 0.10);
  --mobile-status-card-surface: var(--surface-2);
  --mobile-status-card-height: 52px;
  --mobile-status-card-gap: 0px;
  --mobile-status-area-padding: 8px;
  --mobile-status-visible-count: 6;
  --mobile-status-visible-stack-height: calc(var(--mobile-status-card-height) * 6 + var(--mobile-status-card-gap) * 5 + var(--mobile-status-area-padding) * 2);
  --mobile-status-card-radius: 8px;
  --mobile-status-card-padding-inline: 8px;
  --mobile-status-card-content-gap: 18px;
  --mobile-status-divider: var(--ring);
  --mobile-instructions-padding-top: 8px;
  --mobile-instructions-padding-bottom: 18px;
  --mobile-instructions-padding-inline: 8px;
  --mobile-instructions-heading-gap: 16px;
  --mobile-instructions-item-gap: 16px;
  --mobile-instructions-radius: 12px;
  --mobile-instructions-title-size: 24px;
  --mobile-instructions-text-size: 16px;
  --mobile-instructions-line-height: 1.2;
  --mobile-instructions-margin-top: 0;
  --mobile-instructions-margin-bottom: 8px;
  --mobile-nav-side-gap: 8px;
  --mobile-nav-gap: 8px;
  --mobile-nav-bottom: 48px;
  --mobile-nav-height: 60px;
  --mobile-nav-actions-width: 224px;
  --mobile-nav-radius: 30px;
  --mobile-nav-surface: rgba(var(--elev-rgb), 0.42);
  --mobile-nav-border: var(--mobile-bar-border);
  --on-accent: #ffffff;
  --accent-hover: #c72a33;
  --shadow-sm: 0 6px 20px rgba(8, 11, 15, 0.20);
  --shadow-md: 0 18px 42px rgba(8, 11, 15, 0.30);
  --loading-bar-width: 0;
}
/* Version: 2025-01-19-V5-FULL-MOBILE-OPTIMIZED */
body.light-mode {
  --bg: #f7f4ef;
  --elev: #fffdf9;
  --elev-rgb: 255, 253, 249;
  --participant-pill-bg: #ece7df;
  --surface-1: #fffdf9;
  --surface-2: #ece7df;
  --surface-3: #dfd9cf;
  --control-bg: #f1ede6;
  --dropdown-separator: rgba(58, 49, 40, 0.16);
  --names-divider: rgba(58, 49, 40, 0.24);
  --text: #25211c;
  --muted: #6e665d;
  --accent: #B5121B;
  --accent-hover: #9d1017;
  --accent-weak: #f1d9db;
  --ring: #d7cfc3;
  --on-accent: #fffaf4;
  --mobile-nav-surface: linear-gradient(to bottom, rgba(var(--elev-rgb), 0.75), rgba(var(--elev-rgb), 0.65));
  --mobile-nav-border: rgba(0, 0, 0, 0.08);
  --shadow-sm: 0 6px 20px rgba(72, 54, 35, 0.07);
  --shadow-md: 0 18px 42px rgba(72, 54, 35, 0.11);
}

/* Desktop scaling optional: set --desktop-scale >1 if needed */

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: rgba(0,0,0,0);
  /* MOBILE OPTIMIERUNG: Smooth scrolling für bessere UX */
  scroll-behavior: smooth;
}
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body{
  background:var(--bg);
  color:var(--text);
  font:500 calc(16px * var(--desktop-scale))/1.5 system-ui,Segoe UI,Roboto,Helvetica,Arial;
  transition: background .3s ease, color .3s ease;
  /* MOBILE OPTIMIERUNG: Verhindern von Pull-to-Refresh auf mobilen Browsern */
  overscroll-behavior-y: contain;
  /* MOBILE OPTIMIERUNG: Besseres Scrolling auf iOS */
  -webkit-overflow-scrolling: touch;
  /* Smooth page load - verhindert Flash beim Reload */
  opacity: 1;
  /* Responsive Skalierung basierend auf Auflösung */
  zoom: 1;
}
/* Layout helpers without priority overrides. */
.u-flex-col-gap12 { display: flex; flex-direction: column; gap: 12px; }
.u-grid-pair { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; }
.u-flex-column { display: flex; flex-direction: column; }
.u-gap-12 { gap: 12px; }
.u-text-right { text-align: right; }
.u-text-left { text-align: left; }
.is-hidden-pe { opacity: 0; pointer-events: none; }
.is-visible-pe { opacity: 1; pointer-events: auto; }
.ready-waiting-large { font-size: 1.5em; }
.icon-20 { width: 20px; height: 20px; }
.input-pill { width: 100%; padding: 14px 16px; font-size: 16px; border-radius: 999px; border: 1px solid var(--ring); background: var(--bg); color: var(--text); cursor: pointer; outline: none; }
.form-error { color: var(--error); font-size: 14px; text-align: center; margin: -8px 0 0 0; min-height: 1.2em; }
.dialog-muted { color: var(--muted); font-size: 14px; text-align: center; margin-bottom: 16px; }
.dialog-content-left { text-align: left; }
.history-pairings { display: flex; flex-direction: column; gap: 12px; }
.history-pairings-box {
  background: var(--participant-pill-bg);
  border-radius: 16px;
  padding: 16px 18px;
}
.history-pair { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; }
.history-arrow { width: 24px; height: 24px; color: var(--text); flex-shrink: 0; }
.history-pairings .u-warning,
#historyDataDisplay .u-warning,
#historyDataDisplayMobile .u-warning { --u-warning-color: var(--text); }
.history-box-single {
  background: var(--surface-2);
  border: none;
  border-radius: 14px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: none;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.history-notice {
  background: var(--surface-2);
  border: none;
  border-radius: 14px;
  padding: 16px 14px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: none;
}
.history-notice-text {
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  line-height: 1.4;
  max-width: 320px;
}
.history-box-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: center;
  padding: 0 4px;
  flex-shrink: 0;
}
.history-box-title {
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  text-align: left;
}
.history-box-title.receiver-title {
  text-align: right;
}
.history-box-spacer { width: 20px; height: 1px; }
.history-pairings {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-right: 2px;
}
.history-pair-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: center;
  background: var(--surface-1);
  border: none;
  border-radius: 10px;
  padding: 7px 10px;
  box-shadow: none;
  flex-shrink: 0;
}
.history-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history-name.receiver {
  text-align: right;
}
.history-arrow {
  width: 14px;
  height: 14px;
  color: var(--muted);
  stroke: var(--muted);
  opacity: 0.6;
  flex-shrink: 0;
  display: block;
}
.dashboard-section { display: flex; flex-direction: column; gap: 8px; flex: 1; min-height: 0; }
.dashboard-title { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.dashboard-year-panel { --dashboard-gap: 8px; display: flex; flex-direction: column; gap: 8px; flex: 1; min-height: 0; }
.dashboard-year-row { margin-bottom: 8px; flex-shrink: 0; }
.dashboard-year-tabs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.dashboard-year-tab {
  border: none;
  border-radius: 9999px;
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
  padding: 6px 16px;
  cursor: pointer;
  line-height: 1;
  transition: all 0.15s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  box-shadow: none;
}
.dashboard-year-tab:hover {
  color: var(--text);
  background: var(--surface-3);
}
.dashboard-year-tab.active {
  color: var(--bg);
  background: var(--text);
  box-shadow: none;
}
.dashboard-year-tab:active { transform: scale(0.97); }
.dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--dashboard-gap); flex-shrink: 0; }
.dashboard-card {
  padding: 10px 14px;
  border-radius: 14px;
  border: none;
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-height: 64px;
  box-shadow: none;
  box-sizing: border-box;
}
.dashboard-card-title {
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
}
.dashboard-card-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  word-break: break-word;
}
.dashboard-card-sub {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}
.dashboard-card-compact .dashboard-card-sub { display: none; }
.dashboard-names-card {
  display: none;
  margin-top: 0;
  background: var(--participant-pill-bg);
  border-radius: 16px;
  padding: 16px 18px;
  flex-direction: column;
  gap: 10px;
}
.dashboard-names-title { font-size: 14px; letter-spacing: 0.1em; text-transform: uppercase; color: #fff; font-weight: 700; text-align: left; }
.dashboard-names-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dashboard-name-row {
  display: block;
}
.dashboard-name-item {
  display: inline;
  text-align: left;
  color: var(--text);
  font-weight: 600;
  font-size: 15px;
  line-height: 1.35;
  padding: 0;
}
.dashboard-name-item::after {
  content: none;
}
.dashboard-names-empty { color: var(--muted); font-weight: 500; text-align: center; }
.dashboard-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.dashboard-stat { padding: 10px 12px; border-radius: 12px; border: 1px solid var(--ring); background: var(--bg); display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; }
.dashboard-stat-label { color: var(--muted); font-weight: 600; }
.dashboard-stat-value { font-weight: 700; }
.dashboard-tabs { display: flex; gap: 6px; padding: 4px; height: 52px; border-radius: 999px; border: 1px solid var(--ring); background: rgba(var(--elev-rgb), 0.18); margin-bottom: 12px; --dash-tab-inset: 4px; }
.dashboard-tabs { position: relative; overflow: hidden; }
.dashboard-tabs::before {
  content: '';
  position: absolute;
  top: var(--dash-tab-inset);
  bottom: var(--dash-tab-inset);
  left: 0;
  width: var(--dash-tab-w, 0px);
  transform: translateX(var(--dash-tab-x, 0px));
  background: var(--participant-pill-bg);
  border-radius: 999px;
  transition: none;
}
.dashboard-tabs.tab-highlight-ready::before {
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), width 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
.dashboard-tab { flex: 1; height: 100%; border: 0; border-radius: 999px; padding: 0 12px; background: transparent; color: var(--muted); font-weight: 700; font-size: 13px; cursor: pointer; display: flex; align-items: center; justify-content: center; position: relative; z-index: 1; }
.dashboard-tab.active { background: transparent; color: var(--text); }
.dashboard-tab:active { transform: scale(0.98); }
body.light-mode .dashboard-tabs { background: rgba(0, 0, 0, 0.06); }
.dashboard-year-list { display: flex; flex-direction: column; gap: 16px; }
.history-year-row { display: flex; width: 100%; margin: 0 0 12px; }
#history-section-mobile .history-year-row { margin: 0 0 12px; }
#history-section-mobile .history-year-section { margin-top: 0; }
#history-section-mobile .mobile-fullscreen-section + .mobile-fullscreen-section { margin-top: 12px; }
#history-section-desktop #historyDataDisplay { margin-top: 6px; }
#history-section-mobile #historyDataDisplayMobile { margin-top: 0; }
.history-year-row .history-year-wrapper { width: 100%; }
#history-section-mobile .history-year-wrapper { height: auto; display: flex; }
.history-year-row .history-year-button {
  width: 100%;
  padding: calc(12px * var(--desktop-scale)) calc(18px * var(--desktop-scale));
  border-radius: 999px;
  background: var(--participant-pill-bg);
  font-size: calc(16px * var(--desktop-scale));
  min-height: var(--control-h);
}
#history-section-mobile .history-year-button { height: auto; font-weight: 500; }
.sr-hidden {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}
.history-year-wrapper { display: inline-flex; align-items: center; height: 32px; padding: 0; border: 0; background: transparent; }
.history-year-button { display: inline-flex; align-items: center; justify-content: space-between; gap: 2px; height: 100%; padding: 0 10px 0 12px; border: 0; border-radius: 999px; background: var(--participant-pill-bg); color: var(--text); font-size: 16px; font-weight: 700; cursor: pointer; line-height: 1; text-align: left; }
.history-year-button .truncate { display: block; line-height: 1; }
.history-year-button:focus { outline: none; box-shadow: none; }
.history-year-button:focus-visible { outline: none; box-shadow: none; }
.history-year-button.open { border-top-left-radius: var(--card-radius); border-top-right-radius: var(--card-radius); border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.history-year-button:active { transform: scale(0.99); }
.history-year-caret { width: 16px; height: 16px; pointer-events: none; }
.suppress-menu-hover #host-view .mi::before { opacity: 0; }

/* Motion helpers; state values live in the utilities layer. */
.will-change-transform { will-change: transform, opacity; }
.icon-rotate-180 { transform: rotate(180deg); }
.fade-out { transition: opacity .25s ease; }
.fade-in { transition: opacity .25s ease; }

/* Skalierung entfernt - Standard für alle Auflösungen */
.header{position:sticky;top:0;z-index:11;background:var(--bg);position:relative;width:100%;margin-left:0}
body.light-mode .header{background:#f5f5f5}
@media (min-width: 1001px){
  .header{border-bottom:1px solid var(--ring);}
}
.loading-bar{display:none}
.bar{width:100%;min-height:calc(44px * var(--desktop-scale));padding:var(--space-1) var(--space-3);display:grid;grid-template-columns:1fr minmax(300px, var(--content-w)) 1fr;align-items:center;gap:var(--space-2)}
.bar{position:relative;}
.header-left{display:flex;align-items:center;gap:var(--space-4);justify-self:start;position:relative;height:var(--control-h);}
.burger{margin-left:var(--space-4);margin-right:0;}
.brand{font-weight:700;font-size:calc(22px * var(--desktop-scale));white-space:nowrap;display:flex;align-items:center;justify-content:center;cursor:pointer;height:var(--control-h);min-height:var(--control-h);max-height:var(--control-h);margin-left:0;flex-shrink:0;position:relative;}
.brand-name{width:calc(112px * var(--desktop-scale));height:var(--control-h);display:flex;align-items:center;justify-content:center;}
.host-superscript{
  display:none;
  position:absolute;
  top:4px;
  right:-18px;
  font-size:11px;
  font-weight:700;
  letter-spacing:0.2px;
  color:var(--muted);
}
body[data-role="host"] .host-superscript{display:inline}
.progress{justify-self:center;display:flex;align-items:center;justify-content:center;width:100%;height:var(--rail-h);min-height:var(--rail-h);max-height:var(--rail-h);}
.track{height:var(--rail-h);min-height:var(--rail-h);max-height:var(--rail-h);border-radius:999px;overflow:hidden;position:relative;width:100%;max-width:var(--content-w);display:flex;align-items:center;justify-content:center;border:1px solid var(--ring);box-sizing:border-box;}
.fill{position:absolute;left:0;top:0;height:100%;width:0;background:var(--accent);border-radius:0;transition:width .5s ease;z-index:0}
.fill{width:var(--fill-width, 0%);}
.fill.no-transition{transition:none}
#progressText{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);color:#fff;font-weight:700;font-size:calc(18px * var(--desktop-scale));z-index:1}
body.light-mode #progressText{color:#111}
.burger{border:none;background:transparent;color:var(--text);width:calc(22px * var(--desktop-scale));height:var(--control-h);min-height:var(--control-h);max-height:var(--control-h);display:inline-flex;align-items:center;justify-content:center;cursor:pointer;opacity:.9;z-index:92;flex-shrink:0;}
.burger:hover{opacity:1}
.burger:focus-visible{outline:2px solid var(--accent);outline-offset:2px;border-radius:8px;}
.burger-lines{position:relative;width:calc(22px * var(--desktop-scale));height:calc(14px * var(--desktop-scale))}
.burger-lines::before,.burger-lines::after,.burger-lines span{content:"";position:absolute;left:0;right:0;height:2px;background:var(--text);border-radius:2px;transition:transform .15s ease,opacity .15s ease}
.burger-lines::before{top:0}
.burger-lines span{top:calc(6px * var(--desktop-scale))}
.burger-lines::after{bottom:0}
/* === SIDEBAR STRUKTUR === */
.side {
  position: fixed;
  top: 0;
  left: 0;
  width: calc(100px * var(--desktop-scale));
  height: var(--app-layout-height, 100vh);
  background: var(--bg);
  z-index: 9;
  display: flex;
  flex-direction: column;
  padding-top: calc(44px * var(--desktop-scale));
  overflow: hidden;
}
body.light-mode .side { background: #f5f5f5; }
.side.expanded,
body.sidebar-expanded .side { width: calc(300px * var(--desktop-scale)); }

/* === SIDEBAR BODY === */
.side-body {
  padding: var(--space-4) 0 calc(8px * var(--desktop-scale)) 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  min-height: 0;
}

/* === SIDEBAR FOOTER === */
.side-footer {
  padding: calc(8px * var(--desktop-scale));
  flex-shrink: 0;
  flex-grow: 0;
}
.side.expanded .side-footer,
body.sidebar-expanded .side .side-footer { padding: calc(16px * var(--desktop-scale)); }

#host-footer-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* === MENU ITEMS === */
.side .mi {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: calc(10px * var(--desktop-scale)) 0;
  flex-direction: column;
  gap: calc(2px * var(--desktop-scale));
  min-height: var(--control-h);
  flex-shrink: 0;
  position: relative;
}
.side.expanded .mi,
body.sidebar-expanded .side .mi {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  padding: var(--space-2) calc(18px * var(--desktop-scale)) var(--space-2) calc(32px * var(--desktop-scale));
  flex-direction: row;
  gap: var(--space-2);
  min-height: var(--control-h);
}

/* === MENU ITEM TEXT === */
.side .mi-text {
  display: block;
  font-size: calc(10px * var(--desktop-scale));
  text-align: center;
  margin-top: 4px;
  margin-bottom: 0;
  line-height: 1.2;
}
.side.expanded .mi-text,
body.sidebar-expanded .side .mi-text {
  display: block;
  font-size: calc(16px * var(--desktop-scale));
  text-align: left;
  margin-top: 0;
  margin-bottom: 0;
  line-height: 1.5;
  padding-left: 2px;
}

/* === MENU SEPARATOR === */
.menu-separator {
  height: 0;
  min-height: 0;
  max-height: 0;
  font-size: 0;
  line-height: 0;
  overflow: hidden;
  border: none;
  border-top: 1px solid var(--ring);
  background: transparent;
  flex-shrink: 0;
  margin: 6px 8px;
  box-sizing: border-box;
}
.side .menu-separator { margin: 6px -8px; }
.side.expanded .menu-separator,
body.sidebar-expanded .side .menu-separator { margin: 6px 8px; }
body:not(.sidebar-expanded) .side #host-menu-items .menu-separator { display: none; }
body:not(.sidebar-expanded) .side #guest-menu .menu-separator { display: none; }
.menu-separator.menu-separator-full {
  margin: 6px -16px;
  width: calc(100% + 32px);
}

/* === SIDEBAR HIDDEN === */
.side-header { display: none; }
.live-clock { font-size: 14px; color: var(--muted); text-align: center; padding: 8px 0; }
body:not(.sidebar-expanded) .side .live-clock { display: none; }
.side.expanded .live-clock,
body.sidebar-expanded .side .live-clock { display: block; }
body[data-role="host"] #guest-live-clock { display: none; }
body[data-role="guest"] #host-menu-items { display: none; }
body[data-role="host"] #guest-menu { display: none; }
body[data-role="guest"] #host-footer-items { display: none; }
.side .burger { display: flex; align-items: center; }
.mi{display:flex;align-items:center;gap:var(--space-2);border-radius:999px;cursor:pointer;border:none;font-size:calc(18px * var(--desktop-scale));font-weight:600;-webkit-tap-highlight-color: transparent;user-select:none;-webkit-user-select:none;position:relative;overflow:hidden;padding:var(--space-2) var(--space-3);min-height:var(--control-h);margin:calc(4px * var(--desktop-scale)) calc(8px * var(--desktop-scale));}
.mi::before{content:'';position:absolute;top:0;left:0;right:0;bottom:0;background:rgba(128, 128, 128, 0.15);border-radius:999px;opacity:0;transition:opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);}
body:not(.sidebar-expanded) .side .mi{border-radius:16px;}
body:not(.sidebar-expanded) .side .mi::before{border-radius:16px;}
.mi.tap-flash::before{opacity:1;transition:none;}
.mi.mi-centered{justify-content:center;padding:12px}
.mi .sub{margin-left:auto;font-size:12px;color:var(--muted)}
body:not(.sidebar-expanded) .side .mi .sub{display:none}
.mi-icon{width:24px;height:24px;flex-shrink:0;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;position:relative;z-index:1;display:flex;align-items:center;justify-content:center;}
.side .mi-icon{width:24px;height:24px;align-self:center;}
.side.expanded .mi-icon,
body.sidebar-expanded .side .mi-icon{width:24px;height:24px;align-self:center;}
.mi-icon svg { width: 24px; height: 24px; display: block; }
.mi-text{white-space:nowrap;overflow:hidden;position:relative;z-index:1;}
body:not(.sidebar-expanded) .side .mi-text{white-space:normal;word-break:break-word;max-width:100%;line-height:1.2;}
.mi-text-short{display:none;}
.mi-text-long{display:inline;}
body:not(.sidebar-expanded) .side .mi-text-short{display:inline;}
body:not(.sidebar-expanded) .side .mi-text-long{display:none;}
.mi-text-line1, .mi-text-line2{display:inline;}
.mi-text-line1::after{content:' ';}
body:not(.sidebar-expanded) .side .mi-text-line1, body:not(.sidebar-expanded) .side .mi-text-line2{display:block;}
body:not(.sidebar-expanded) .side .mi-text-line1::after{content:'';}
.mi.danger{color:#ff6b6b;font-weight:700;}
.mi.danger::before{background:rgba(255,107,107,0.15);}
body.light-mode .mi.danger::before{background:rgba(255,107,107,0.12);}

/* Hover/Active Feedback */
.mi:hover::before,
.mi:active::before{opacity:1;}
.mi:active::before{transition:none;}
.ready-preview-feature-disabled { display: none; }
body.light-mode .mi::before{background:rgba(128, 128, 128, 0.12);}
#miMobileLogout { color: #ff6b6b; font-weight: 700; }
#miMobileLogout::before { background: rgba(255, 107, 107, 0.15); }
body.light-mode #miMobileLogout::before { background: rgba(255, 107, 107, 0.12); }
body[data-user-logged-in="true"] #miMobileLogin { color: #ff6b6b; font-weight: 700; }
body[data-user-logged-in="true"] #miMobileLogin::before { background: rgba(255, 107, 107, 0.15); }
body.light-mode[data-user-logged-in="true"] #miMobileLogin::before { background: rgba(255, 107, 107, 0.12); }
.header-right{justify-self:end;display:flex;align-items:center;gap:calc(8px * var(--desktop-scale));height:calc(44px * var(--desktop-scale));min-height:calc(44px * var(--desktop-scale));max-height:calc(44px * var(--desktop-scale));}
.header-pill{
  display:none;
  align-items:center;
  justify-content:center;
  height:calc(40px * var(--desktop-scale));
  padding:0 calc(16px * var(--desktop-scale));
  border-radius:999px;
  background:var(--elev);
  border:1px solid var(--ring);
  color:var(--text);
  font-weight:800;
  font-size:calc(14px * var(--desktop-scale));
  cursor:pointer;
  line-height:1;
}
.header-pill:active{transform:scale(0.98)}
.header-pill:focus-visible{outline:2px solid var(--accent);outline-offset:2px;}
.header-pill:hover{border-color:rgba(255,255,255,0.22)}
body.light-mode .header-pill:hover{border-color:rgba(0,0,0,0.18)}
.icon-btn{cursor:pointer;border-radius:50%;width:calc(40px * var(--desktop-scale));height:calc(40px * var(--desktop-scale));min-height:calc(40px * var(--desktop-scale));max-height:calc(40px * var(--desktop-scale));display:grid;place-items:center;background:var(--elev);border:1px solid var(--ring);flex-shrink:0;box-sizing:border-box;}
.icon-btn svg{width:calc(22px * var(--desktop-scale));height:calc(22px * var(--desktop-scale));fill:var(--muted);transition:fill .2s ease}
.icon-btn:hover svg{fill:var(--text)}
.icon-btn:active{transform:scale(0.95)}
.icon-btn:focus-visible{outline:2px solid var(--accent);outline-offset:2px;}
.host-icon{cursor:pointer;border-radius:50%;width:calc(40px * var(--desktop-scale));height:calc(40px * var(--desktop-scale));min-height:calc(40px * var(--desktop-scale));max-height:calc(40px * var(--desktop-scale));display:grid;place-items:center;background:var(--elev);border:1px solid var(--ring);font-size:calc(14px * var(--desktop-scale));font-weight:600;position:relative;transition:all .2s ease;flex-shrink:0;box-sizing:border-box;}
.host-icon svg{width:calc(22px * var(--desktop-scale));height:calc(22px * var(--desktop-scale));stroke:var(--muted);transition:stroke .2s ease}
.host-widget:hover .host-icon svg{stroke:var(--text)}
body:not(.light-mode) .sun{display:none}
body.light-mode .moon{display:none}
body.light-mode .sun{fill:var(--text);}
#share-feedback{position:absolute;top:calc(100% + 8px);right:0;background:var(--elev);padding:8px 12px;border-radius:8px;border:1px solid var(--ring);font-size:12px;opacity:0;transform:translateY(-10px);transition:opacity .2s ease, transform .2s ease;pointer-events:none}
#share-feedback.visible{opacity:1;transform:translateY(0)}
#mobile-copy-feedback{position:fixed;bottom:84px;left:50%;transform:translateX(-50%);background:var(--elev);padding:10px 16px;border-radius:8px;border:1px solid var(--ring);font-size:14px;opacity:0;pointer-events:none;z-index:101}
#mobile-copy-feedback.visible{opacity:1;transform:translateX(-50%) translateY(0);}

.connection-status {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  visibility: hidden;
  background-color: #c0392b;
  color: white;
  text-align: center;
  padding: 8px;
  font-size: 14px;
  font-weight: 600;
  z-index: 1000;
  transform: translateY(-100%);
  transition: transform 0.3s ease-in-out;
}
.connection-status.visible {
  visibility: visible;
  transform: translateY(0);
}

.ready-box { background: var(--elev); border-radius: var(--card-radius); width: 100%; max-width: var(--content-w); margin: calc(13px * var(--desktop-scale)) auto calc(32px * var(--desktop-scale)); box-shadow: none; position: relative; height: calc(256px * var(--desktop-scale)); padding: var(--space-3) var(--space-4) var(--space-4); display: grid; }
#ready-box-form { grid-row: 1 / -1; grid-column: 1 / 1; width: 100%; height: 100%; display: grid; grid-template-rows: auto 1fr auto; }
#ready-box-result { grid-row: 1 / -1; grid-column: 1 / 1; width: 100%; height: 100%; display: grid; grid-template-rows: auto 1fr; }
.result-mobile-identity { display: none; }

.form-header { grid-row: 1; align-self: start; width: 100%;}
.form-header h2 { margin: 0 0 calc(6px * var(--desktop-scale)) 0; font-size: calc(24px * var(--desktop-scale)); font-weight: 700; min-height: calc(36px * var(--desktop-scale)); text-align: center; }
.form-header h2 .cursor { color: var(--accent); font-weight: 400; display: inline-block; animation: blink 1s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }
.form-header hr { border: none; height: 1px; background: var(--ring); width: 40%; max-width: calc(300px * var(--desktop-scale)); margin: 0 auto; transition: opacity 0.3s ease; }

.central-animation-container { grid-row: 2; display: grid; place-items: center; position: relative; width: 100%; height: 100%; }
.central-animation-container > * { grid-area: 1 / 1; transition: opacity 0.3s ease-in-out; }
.central-animation-container.view-switched #participant-dropdown-wrapper { opacity: 0; pointer-events: none; }
.central-animation-container.view-switched #waiting-text { opacity: 1; pointer-events: auto; }

#waiting-text { opacity: 0; font-weight: 700; font-size: clamp(1.2em, 5vw, 1.8em); pointer-events: none; display:flex; align-items:center; justify-content:center; height:100%; text-align: center;}
.result-user-name { text-align: center; font-size: calc(24px * var(--desktop-scale)); font-weight: 700; }
.result-container { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; text-align: center; }
.result-headline { font-size: 1.5em; font-weight: 800; text-align: center; margin:0; }
.result-slot { position: relative; display: grid; place-items: center; margin-top: var(--space-3); min-height: calc(40px * var(--desktop-scale)); min-width: calc(200px * var(--desktop-scale)); }
#result-name{ color:var(--accent); font-size:1.5em; font-weight:700; transition: opacity 0.3s ease; }
#reveal-button { position: absolute; width: 100%; height: 100%; top: 0; left: 0; transition: opacity 0.3s ease; }
#result-container.revealed #reveal-button { opacity: 0; pointer-events: none; }
#result-container:not(.revealed) #result-name { opacity: 0; }

#participant-dropdown-wrapper { width: 100%; }
/* MOBILE FIX: Font-size 16px verhindert Auto-Zoom auf iOS */
.participant-listbox-button { width: 100%; min-height: var(--control-h); display: inline-flex; align-items: center; justify-content: space-between; border-radius: 999px; padding: calc(12px * var(--desktop-scale)) calc(18px * var(--desktop-scale)); text-align: left; color: var(--text); background: var(--participant-pill-bg); transition: none; border: 0; font-size: calc(16px * var(--desktop-scale)); cursor: pointer; }
.participant-listbox-button .truncate { min-width: 0; display: block; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.participant-listbox-button:focus,
.participant-listbox-button:focus-visible { outline: none; box-shadow: none; }
.participant-listbox-button.open { box-shadow: none; border-top-left-radius: var(--card-radius); border-top-right-radius: var(--card-radius); border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.participant-listbox-button:active { transform: scale(0.99); }
.participant-listbox-icon { flex: 0 0 auto; transition: transform 0.16s ease; }
.participant-identity-pill { justify-content: center; background: transparent; cursor: default; user-select: none; }
.participant-identity-pill .truncate { line-height: 1.25; padding-block: 2px; }
.participant-identity-pill:active { transform: none; }

.dd-container {
  position: fixed;
  z-index: 50;
  display: none;
  opacity: 1;
  transition: none;
  top: var(--dd-top, auto);
  left: var(--dd-left, auto);
  width: var(--dd-width, 852px);
  box-sizing: border-box;
}
.history-dd { z-index: 120; }
.dd-container.open { display: block; }
.dd-container.visible { opacity: 1; }
.dd-mask { 
  overflow: hidden;
  border-radius: 0 0 var(--card-radius) var(--card-radius);
  background: var(--participant-pill-bg);
  border: 0;
  border-top: 1px solid var(--dropdown-separator);
}
.dd-list {
  overflow-y: auto;
  list-style: none;
  padding: 0;
  margin: 0;
  height: var(--dd-list-height, auto);
}
.dd-list::-webkit-scrollbar { display: none; }
.dd-list { scrollbar-width: none; }
.dd-list li { padding-bottom: 0; }
/* MOBILE FIX: Font-size 16px für Touch-Targets */
.dd-item { display: flex; align-items: center; justify-content: space-between; min-height: 52px; padding: calc(12px * var(--desktop-scale)) calc(18px * var(--desktop-scale)); font-size: 16px; background: transparent; border-radius: 0; transition: background-color .2s ease-out; border: none; cursor: pointer; outline: none; }
.dd-container.snapped .dd-item { transition: background-color .2s ease-out, border-radius .16s ease-out; }
.dd-item .truncate { display: block; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dd-item:hover { background-color: rgba(255, 255, 255, 0.08); }
.dd-item:active { background-color: rgba(255, 255, 255, 0.12); transform: scale(0.99); }
.dd-item.selected { 
  background-color: rgba(255, 255, 255, 0.06);
}
.ready-box-button { min-height: var(--control-h); display: inline-flex; align-items: center; justify-content: center; }
#readyBtn { --accent: var(--ready-accent); background: var(--ready-accent); }
#readyBtn:hover:not(:disabled) { background: #397d47; }

body.light-mode .dd-item {
    background: transparent;
}
body.light-mode .dd-item:hover {
    background-color: rgba(0, 0, 0, 0.08);
}
body.light-mode .dd-item:active {
    background-color: rgba(0, 0, 0, 0.12);
}
body.light-mode .dd-item.selected {
    background-color: rgba(0, 0, 0, 0.06);
}

/* MOBILE FIX: Font-size 16px für Buttons */
.dialog-box button,.ready-box-button{padding:calc(14px * var(--desktop-scale)) calc(24px * var(--desktop-scale));border:none;border-radius:999px;background:var(--accent);color:#fff;font-weight:600;font-size:calc(16px * var(--desktop-scale));cursor:pointer;transition:background .2s, transform .1s}
.dialog-box button:hover:not(:disabled),.ready-box-button:hover:not(:disabled){background:#c72a33}

.dialog-box button:active:not(:disabled),.ready-box-button:active:not(:disabled){ 
  transform: scale(0.97);
  transition: transform 0.05s ease;
}
.dialog-box button:disabled,.ready-box-button:disabled{opacity:0.5;cursor:not-allowed}

.ready-box-button, .dialog-box button { -webkit-tap-highlight-color: rgba(0,0,0,0); }

/* Touch-Geräte: kein "sticky hover" Highlight */
@media (hover: none) and (pointer: coarse) {
  .dd-item:hover,
  body.light-mode .dd-item:hover { background-color: transparent; }
  .dialog-box button:hover:not(:disabled),.ready-box-button:hover:not(:disabled){background:var(--accent)}
  .dialog-box button:focus,.ready-box-button:focus,
  .dialog-box button:focus-visible,.ready-box-button:focus-visible{outline:none;box-shadow:none}
  .ready-box-button{touch-action:manipulation;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}
  #readyBtn{-webkit-tap-highlight-color:rgba(0,0,0,0)}
}

#readyBtn { 
    display: block;
	grid-row: 3;
    justify-self: center;
    align-self: end;
	width: 100%;
	transition: width 0.6s cubic-bezier(0.65, 0, 0.35, 1);
}
#readyBtn.transformed { 
	width: 30%;
    min-width: 150px;
}

#readyBtn span { display: inline-block; transition: opacity 0.25s ease; white-space: nowrap; }

.status-box { background: var(--elev); border-radius: var(--card-radius) var(--card-radius) 2px 2px; padding: calc(18px * var(--desktop-scale)); display: none; gap: calc(8px * var(--desktop-scale)); width: 100%; max-width: var(--content-w); margin: calc(32px * var(--desktop-scale)) auto 0; box-shadow: none; }
.status-box .title{font-weight:700;text-align:center}
.dialog-overlay {
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display:flex;
  align-items:flex-start;
  justify-content:center;
  padding-top:60px;
  opacity:0;
  pointer-events:none;
  transition:opacity .3s ease;
  z-index:80;
}
.dialog-overlay.visible{opacity:1;pointer-events:auto;}

/* Command Palette Style Dialog Box */
.dialog-box {
  background: rgba(var(--elev-rgb), 0.75);
  backdrop-filter: blur(40px) saturate(1.8);
  -webkit-backdrop-filter: blur(40px) saturate(1.8);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius:20px;
  width:min(560px, 94%);
  max-width:560px;
  box-shadow: 0 32px 64px rgba(0, 0, 0, 0.4), 0 16px 32px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.2);
  transform:translateY(-20px) scale(0.92);
  transition:transform .4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity .4s ease;
  opacity:0;
  display:flex;
  flex-direction:column;
  gap:12px;
  padding:0;
}
.dialog-overlay.visible .dialog-box {
  transform:translateY(0) scale(1);
  opacity:1;
}

body.light-mode .dialog-box {
  background: rgba(var(--elev-rgb), 0.85);
  backdrop-filter: blur(40px) saturate(1.6);
  -webkit-backdrop-filter: blur(40px) saturate(1.6);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 32px 64px rgba(0, 0, 0, 0.2), 0 16px 32px rgba(0, 0, 0, 0.15), 0 4px 16px rgba(0, 0, 0, 0.1);
}
.dialog-box.dialog-box-large{width:min(760px, 100%);}
.dialog-box h2{text-align:center;font-size:22px;font-weight:700;margin:0;padding:8px 12px 0;}
/* Guest dialogs without headline and with tight padding */











.dialog-box .dialog-content{padding:4px 4px 8px;margin:0;overflow:visible;}



.dialog-overlay.visible .dialog-box{transform:scale(1);}
/* MOBILE FIX: Font-size 16px für Inputs */
.dialog-box input, .dialog-box textarea{padding:calc(14px * var(--desktop-scale)) calc(16px * var(--desktop-scale));border-radius:999px;border:1px solid var(--ring);background:var(--control-bg);color:var(--text);font-size:calc(16px * var(--desktop-scale));width:100%;transition:border-color .2s ease, background .2s ease}
.dialog-box input:focus, .dialog-box textarea:focus{border-color:var(--accent);background:var(--surface-2);outline:none}
.dialog-box textarea{min-height: calc(160px * var(--desktop-scale)); resize: vertical; line-height: 1.6;}
body.light-mode .dialog-box input, body.light-mode .dialog-box textarea{background: #f5f5f5;}
body.light-mode .dialog-box input:focus, body.light-mode .dialog-box textarea:focus{background: #fff; border-color:var(--accent);}
.dialog-box input.error{border-color:#ff4444;animation:shake .3s}
@keyframes shake{0%,100%{transform:translateX(0)} 25%{transform:translateX(-8px)} 75%{transform:translateX(8px)}}
.dialog-link{font-size:13px;color:var(--muted);text-align:center;margin-top:4px;display:block;cursor:pointer;text-decoration:none;transition:color .2s ease}
.dialog-link:hover{color:var(--text)}
#login-selection-view, #normal-login-view, #link-login-view{display:flex;flex-direction:column;gap:16px;width:100%}
.login-option-btn{padding:0 32px;height:52px;font-size:16px;font-weight:600;border-radius:999px;border:none;background:var(--accent);color:#fff;cursor:pointer;transition:all .2s ease;text-align:center;display:flex;align-items:center;justify-content:center}
.login-option-btn:hover{background:#c72a33}
.login-option-btn:active{transform:scale(0.98)}

/* Login Panel Input & Button Styling */
#login-side-panel input[type="password"],
#login-side-panel input[type="text"] {
  width: 100%;
  padding: 0 20px;
  font-size: 16px;
  border-radius: 999px;
  border: 1px solid var(--ring);
  background: var(--bg);
  color: var(--text);
  outline: none;
  height: 52px;
  transition: border-color 0.2s ease;
}

#login-side-panel input[type="password"]:focus,
#login-side-panel input[type="text"]:focus {
  border-color: var(--accent);
}

#login-side-panel button:not(.side-panel-close):not(.login-option-btn):not(.participant-listbox-button) {
  padding: 0 24px;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 16px;
  height: 52px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

#login-side-panel button:not(.side-panel-close):not(.login-option-btn):not(.participant-listbox-button):hover {
  background: #c72a33;
}

#login-side-panel button:not(.side-panel-close):not(.login-option-btn):not(.participant-listbox-button):active {
  transform: scale(0.98);
}

#normalUsernameSelect, #registerUsernameSelect{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 12px center;background-size:20px;padding-right:40px;padding-top:0;padding-bottom:0}
body.light-mode #normalUsernameSelect, body.light-mode #registerUsernameSelect{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E")}
.dialog-title-wrapper { display: flex; justify-content: center; align-items: center; width: 100%; position: relative; gap: 16px; }
.dialog-title-wrapper h2 { text-align: center; margin: 0; }
.dialog-title-wrapper .year-selector-wrapper { position: absolute; right: 0; }


.editor-row{display:grid;grid-template-columns:1fr 1fr 1.5fr;gap:16px;align-items:center;margin-bottom:16px}
.last-year-editor .editor-row { grid-template-columns: 1fr 1fr; }
.editor-row.rules-editor-row{grid-template-columns: 1fr; gap:16px;}
.editor-row.rules-editor-row .input-with-button{width:100%}
.editor-row.rules-editor-row input{text-align:center; padding-left:16px;}
.test-draw-row{display:grid;grid-template-columns:1fr 1fr 1fr;gap:16px;align-items:stretch;margin-bottom:16px}
.test-draw-row > div{padding:14px 16px;font-size:16px;border-radius:999px;background:var(--bg);color:var(--text);border:1px solid var(--ring);height:52px;display:flex;align-items:center;justify-content:center;font-weight:500}
@media (min-width: 1001px){
  #edit-rules-content .rules-editor-row{position:relative;border-radius:999px;overflow:hidden;cursor:grab;transition:box-shadow .15s ease;}
  #edit-rules-content .rules-editor-row::before{content:'';position:absolute;inset:0;border-radius:inherit;background:rgba(255,255,255,0.04);opacity:0;transition:opacity .15s ease;pointer-events:none;}
  #edit-rules-content .rules-editor-row:hover::before,
  #edit-rules-content .rules-editor-row:focus-within::before{opacity:1;}
  #edit-rules-content .rules-editor-row:hover,
  #edit-rules-content .rules-editor-row:focus-within{box-shadow:inset 0 0 0 1px var(--ring);}
  body.light-mode #edit-rules-content .rules-editor-row::before{background:rgba(0,0,0,0.04);}
  #edit-rules-content .rules-editor-row.dragging{opacity:0.75;cursor:grabbing;}
  #edit-rules-content .rules-editor-row .input-with-button input{padding-left:48px;padding-right:48px;text-align:center;}
  #edit-rules-content .rules-editor-row .remove-rule-btn{position:absolute;left:12px;right:auto;top:50%;transform:translateY(-50%);width:22px;height:22px;border:none;background:transparent;color:var(--muted);cursor:pointer;font-size:18px;line-height:1;opacity:0;transition:opacity .15s ease;display:grid;place-items:center;padding:0;}
  #edit-rules-content .rules-editor-row:hover .remove-rule-btn,
  #edit-rules-content .rules-editor-row:focus-within .remove-rule-btn{opacity:1;}
}
.test-draw-row.is-duplicate > div { border: 1px solid #ff4444; box-shadow: 0 0 8px rgba(255,68,68,0.3); }
.editor-row input{text-align:center}
/* MOBILE FIX: Font-size 16px */
.editor-row input, .editor-row select{padding:12px 14px;font-size:16px;border-radius:999px;background:var(--bg);color:var(--text);border:1px solid var(--ring);height:52px;transition:border-color .2s ease}
.editor-row input:focus, .editor-row select:focus{border-color:var(--accent);outline:none}
.last-year-editor select { text-align: center; }
.editor-row select{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23a0a0a0' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708 .708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 1.2rem center;padding-right:36px}
.editor-row button{padding:10px 16px;height:100%;border-radius:999px;background:var(--accent-weak);color:var(--muted);border:none;cursor:pointer;transition:all .2s ease}
.editor-row button:hover{background:var(--ring);color:var(--text)}
.editor-row button:active{transform:scale(0.96)}

.participant-editor-row { display: flex; gap: 16px; margin-bottom: 16px; align-items: stretch; }
.participant-editor-row > div { flex: 1; min-width: 0; }
.participant-editor-row .participant-editor-row-input { line-height: 1.25; }
.participant-editor-header { text-align: center; margin-bottom: 8px; color: var(--muted); font-size: 14px; font-weight: 600; letter-spacing: 0.3px; }
/* MOBILE FIX: Font-size 16px */
.participant-editor-row .participant-editor-row-input { text-align:center; padding:12px 14px; font-size:16px; border-radius:999px; background:var(--bg); color:var(--text); border:1px solid var(--ring); height:52px; width: 100%; transition:border-color .2s ease; }
.participant-editor-row .participant-editor-row-input:focus{border-color:var(--accent);outline:none}
.participant-editor-row .tags-wrapper { overflow-x: auto; scrollbar-width: none; border-radius: 10px; }
.participant-editor-row .tags-wrapper::-webkit-scrollbar { display: none; }

/* Teilnehmer bearbeiten Dialog - spezifische Klasse */
.participant-editor-actions{display:grid;grid-template-columns:auto 1fr;gap:12px;margin-top:20px;align-items:stretch}
.participant-row-delete{display:none;}
@media (min-width: 1001px){
  #participants-editor-list .participant-editor-row{position:relative;border-radius:999px;transition:box-shadow .15s ease;cursor:grab;overflow:hidden;}
  #participants-editor-list .participant-editor-row::before{content:'';position:absolute;inset:0;border-radius:inherit;background:rgba(255,255,255,0.04);opacity:0;transition:opacity .15s ease;pointer-events:none;}
  #participants-editor-list .participant-editor-row:hover::before,
  #participants-editor-list .participant-editor-row:focus-within::before{opacity:1;}
  #participants-editor-list .participant-editor-row:hover,
  #participants-editor-list .participant-editor-row:focus-within{box-shadow:inset 0 0 0 1px var(--ring);}
  body.light-mode #participants-editor-list .participant-editor-row::before{background:rgba(0,0,0,0.04);}

  /* Platz f?r das Delete-Icon links, Text bleibt zentriert */
  #participants-editor-list .participant-editor-row .participant-editor-row-input[name="name"]{padding-left:42px;padding-right:42px;}
  #participants-editor-list .participant-row-delete{display:inline-flex;align-items:center;justify-content:center;position:absolute;left:12px;top:50%;transform:translateY(-50%);opacity:0;transition:opacity .15s ease;cursor:pointer;width:22px;height:22px;border:none;background:transparent;color:var(--muted);font-size:18px;line-height:1;z-index:2;}
  #participants-editor-list .participant-editor-row:hover .participant-row-delete,
  #participants-editor-list .participant-editor-row:focus-within .participant-row-delete{opacity:1;}
  #participants-editor-list .participant-editor-row.dragging{opacity:0.75;cursor:grabbing;}
}
.participant-editor-actions button:last-child{background:var(--accent);color:#fff;border:none;padding:0 24px;height:52px;border-radius:999px;font-weight:600;font-size:16px;cursor:pointer;transition:all .2s ease}
.participant-editor-actions button:last-child:hover{transform:scale(1.02)}
.participant-editor-actions button:last-child:active{transform:scale(0.98)}

/* Anleitung bearbeiten Dialog - spezifische Klasse */
.rules-editor-actions{display:grid;grid-template-columns:auto 1fr;gap:12px;margin-top:20px;align-items:stretch}
.rules-editor-actions button:last-child{background:var(--accent);color:#fff;border:none;padding:0 24px;height:52px;border-radius:999px;font-weight:600;font-size:16px;cursor:pointer;transition:all .2s ease}
.rules-editor-actions button:last-child:hover{transform:scale(1.02)}
.rules-editor-actions button:last-child:active{transform:scale(0.98)}

.login-links-section{width:100%}
.login-links-manager{display:flex;flex-direction:column;width:100%}
.login-links-loading{margin:0;color:var(--muted);font-size:14px;line-height:1.5}
.login-links-list{display:flex;flex-direction:column;gap:7px}
.login-link-row{display:grid;grid-template-columns:90px minmax(0,1fr) 120px;align-items:center;gap:6px;height:48px;padding:8px 7px 8px 14px;border-radius:14px;background:var(--participant-pill-bg)}
.login-link-name{display:flex;align-items:center;height:32px;overflow:hidden;color:var(--text);font-size:16px;line-height:1.2;text-overflow:ellipsis;white-space:nowrap}
.login-link-value{display:flex;align-items:center;justify-content:center;min-width:0}
.login-link-actions{display:flex;align-items:center;gap:2px;height:32px;min-width:0;padding:2px;border-radius:999px;background:var(--elev)}
.login-link-actions button,.login-link-copy{height:36px;padding:0 12px;border:0;border-radius:999px;font-size:12px;font-weight:700;cursor:pointer;transition:opacity .2s ease,transform .2s ease}
.login-link-copy{width:100%;height:32px;overflow:hidden;background:var(--elev);box-shadow:inset 0 0 0 1px var(--ring);color:var(--text);text-overflow:ellipsis;white-space:nowrap}
.login-link-actions button{display:grid;place-items:center;flex:1;min-width:0;height:28px;padding:0}
.login-link-actions svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}
.login-link-actions button:active,.login-link-copy:active{transform:scale(.97)}
.login-link-actions button:disabled,.login-link-copy:disabled{cursor:default;opacity:.55}
.login-link-create{background:var(--accent);color:var(--on-accent)}
.login-link-whatsapp{background:transparent;color:#25d366}
.login-link-revoke{background:rgba(255,107,107,.14);color:#ff6b6b}
.login-link-whatsapp:disabled{cursor:default;opacity:1;color:var(--muted)}
.login-link-revoke:disabled{cursor:default;opacity:1;background:transparent;color:var(--muted)}
.login-link-copy.is-empty{cursor:default;opacity:1;color:var(--muted)}
.clipboard-copy-target{position:fixed;top:0;left:-9999px;width:1px;height:1px;opacity:0}

/* Test-Ziehung Dialog - spezifische Klasse */
.test-draw-actions{display:grid;grid-template-columns:1fr;gap:12px;margin-top:20px}
.test-draw-actions button{background:var(--accent);color:#fff;border:none;padding:0 24px;height:52px;border-radius:999px;font-weight:600;font-size:16px;cursor:pointer;transition:all .2s ease}
.test-draw-actions button:hover{transform:scale(1.02)}
.test-draw-actions button:active{transform:scale(0.98)}
.add-participant-btn{width:52px;height:52px;border-radius:50%;background:var(--elev);border:1px solid var(--ring);color:var(--text);cursor:pointer;display:grid;place-items:center;transition:all .2s ease;padding:0}
.add-participant-btn svg{width:28px;height:28px;stroke:var(--text)}
.add-participant-btn:hover{transform:scale(1.05)}
.add-participant-btn:active{transform:scale(0.95)}
.dialog-content .editor-form-container{max-width:100%;margin:0 auto;padding:0 16px}
.input-with-button{position:relative;display:flex;align-items:center;width:100%}
.editor-row .input-with-button input{padding-left:40px;padding-right:40px;flex:1;width:100%;text-align:center}
.input-with-button button{position:absolute;right:0;top:50%;transform:translateY(-50%);height:100%;background:transparent;border:none;color:var(--muted);cursor:pointer;font-size:20px;font-weight:bold;padding:0 14px;transition:color .2s ease}
.input-with-button button:hover{color:var(--text)}
.input-with-button button:active{transform:translateY(-50%) scale(0.95)}
.editor-name-display{padding:14px 16px;font-size:16px;border-radius:999px;background:var(--bg);color:var(--text);border:1px solid var(--ring);height:52px;display:flex;align-items:center;justify-content:center;font-weight:500}
.participant-list-grid { display: flex; flex-direction: column; gap: 12px; }
.participant-list-grid > .editor-name-display {
  justify-content: flex-start;
  text-align: left;
  border-radius: 16px;
  padding: 16px 18px;
  min-height: 112px;
  background: var(--participant-pill-bg);
  border: none;
}
.history-pairings .editor-name-display {
  background: transparent;
  border: none;
  padding: 0;
  height: auto;
  min-height: 0;
  font-weight: 600;
}
.participant-list-grid .editor-name-display {
  background: var(--participant-pill-bg);
  border: none;
}
.rules-list li,
.dashboard-card,
.dashboard-stat {
  background: var(--participant-pill-bg);
  border: none;
}


.tags-input-container {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--ring);
  min-height: 52px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tags-input-container::-webkit-scrollbar {
  display: none;
}
.tag-item { display: inline-flex; align-items: center; background-color: var(--accent-weak); padding: 5px 10px; border-radius: 999px; font-size: 14px; flex-shrink: 0; }
.tag-item span { margin-right: 6px; }

/* Desktop scaling for high-res screens */
:is(
  .login-option-btn,
  #login-side-panel input[type="password"],
  #login-side-panel input[type="text"],
  #login-side-panel button:not(.side-panel-close):not(.login-option-btn):not(.participant-listbox-button),
  #normalUsernameSelect,
  #registerUsernameSelect,
  .test-draw-row > div,
  .editor-row input,
  .editor-row select,
  .participant-editor-row .participant-editor-row-input,
  .participant-editor-actions button:last-child,
  .rules-editor-actions button:last-child,
  .test-draw-actions button,
  .status-item
){
  height: var(--control-h);
  min-height: var(--control-h);
  font-size: calc(16px * var(--desktop-scale));
}

.add-participant-btn{width:var(--control-h);height:var(--control-h);}
.editor-name-display{min-height:var(--control-h);height:var(--control-h);}
.tags-input-container{min-height:var(--control-h);}
.tag-item button { all: unset; cursor: pointer; font-weight: bold; line-height: 1; padding: 2px; }
/* MOBILE FIX: Font-size 16px */
.tags-input-container input { flex-grow: 1; border: none; background: transparent; color: var(--text); padding: 4px; outline: none; font-size:16px; min-width: 80px;}

main{display:flex;flex-direction:column;align-items:center;justify-content:flex-start}
#host-view { display: none; height: 100%; overflow: hidden; }
body.in-host-view #host-view { display: flex; flex-direction: column; }
body.in-host-view main { display: none; }
#host-view-content { padding: 16px 16px 0; display: flex; flex-direction: column; height: 100%; }
#host-view-host, #host-view-guest { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; flex-grow: 1; padding-bottom: 16px; }
.host-view-footer { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; padding: 8px 16px; }
.host-view-footer .mi { margin: 0; width: auto; padding: 10px 16px; }
.host-view-footer .live-clock { text-align: right; }
.test-draw-stats { margin-top:20px; font-size:14px; color:var(--muted); text-align:center; font-weight:500; }

.status-overview-columns{display:grid;grid-template-columns:1fr 1fr;gap:24px;margin-top:20px;padding:0 8px}
.status-column{display:flex;flex-direction:column;gap:12px}
.status-column h3{font-size:16px;font-weight:600;margin-bottom:8px;color:var(--muted);text-align:center;letter-spacing:0.3px}
.status-item{padding:14px 16px;background:var(--bg);border:1px solid var(--ring);border-radius:999px;text-align:center;font-size:16px;font-weight:500;height:52px;display:flex;align-items:center;justify-content:center}

.last-year-repeat-marker { background-color: rgba(181, 18, 27, 0.2); border-color: #B5121B; }

.past-results-container {
  padding: 0 16px;
  margin: 0;
}

.year-selector-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}
.year-selector-select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 18px;
    font-weight: 600;
    padding: 8px 20px 8px 0;
    cursor: pointer;
}
.year-selector-select:focus {
    outline: none;
}
.year-selector-arrow {
    position: absolute;
    right: 0;
    pointer-events: none;
    width: 16px;
    height: 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23a0a0a0'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

/* Mobile Back Button im Header */
#mobile-dialog-back {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    margin-right: 6px;
}
#mobile-dialog-back svg {
    width: 28px;
    height: 28px;
    stroke: var(--text);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}
#mobile-dialog-title {
    display: none;
    font-size: 18px;
    font-weight: 600;
    align-items: center;
    gap: 2px;
    white-space: nowrap;
    min-height: 32px;
    position: relative;
    padding: 0;
}

/* Fullscreen Content Container */
#fullscreen-content {
  display: none;
}


.mobile-nav-cluster,
.mobile-actions{display:none}
#mobile-progress { display: none; }
#mobile-action-pills { display: none; }


/* === COMMAND PALETTE WITH LIQUID GLASS - NOV 2025 === */

.side-panel {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translate(-50%, -20px) scale(0.92);
  width: 90%;
  max-width: 560px;
  height: auto;
  max-height: calc(var(--app-layout-height, 100vh) - 80px);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  border-radius: 20px;
  overflow: hidden;

  /* Liquid Glass Effect */
  background: rgba(var(--elev-rgb), 0.75);
  backdrop-filter: blur(40px) saturate(1.8);
  -webkit-backdrop-filter: blur(40px) saturate(1.8);
  border: 1px solid rgba(255, 255, 255, 0.18);

  /* Premium Shadow Stack */
  box-shadow:
    0 32px 64px rgba(0, 0, 0, 0.4),
    0 16px 32px rgba(0, 0, 0, 0.3),
    0 4px 16px rgba(0, 0, 0, 0.2);

  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.side-panel.visible {
  transform: translate(-50%, 0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

/* Light Mode Liquid Glass */
body.light-mode .side-panel {
  background: rgba(var(--elev-rgb), 0.85);
  backdrop-filter: blur(40px) saturate(1.6);
  -webkit-backdrop-filter: blur(40px) saturate(1.6);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow:
    0 32px 64px rgba(0, 0, 0, 0.2),
    0 16px 32px rgba(0, 0, 0, 0.15),
    0 4px 16px rgba(0, 0, 0, 0.1);
}

/* Backdrop mit Heavy Blur */
.side-panel-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              backdrop-filter 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.side-panel-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

body.light-mode .side-panel-backdrop {
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
}

/* Command Palette Header mit Glass Effekt */
.side-panel-header {
  padding: 22px 24px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  position: relative;
  background: rgba(255, 255, 255, 0.03);
}

body.light-mode .side-panel-header {
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.5);
}

.side-panel-header h2 {
  font-size: 19px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
}
#history-panel-title { line-height: 32px; }

/* Desktop: Zurück-Pfeil ausblenden, normale Header */
@media (min-width: 1025px) {
  .history-back-button {
    display: none;
  }

  /* History Header: Title links, X rechts, Dropdown absolut zentriert */
  #history-side-panel .side-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    position: relative;
  }

  #history-side-panel .side-panel-header h2 {
    text-align: left;
  }

  #history-side-panel .history-year-selector {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
  }

  #history-side-panel .side-panel-close {
    z-index: 1;
  }

  /* Participants Header: Title | X */
  #participants-side-panel .side-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 24px 18px;
  }

  #participants-side-panel .side-panel-header h2 {
    text-align: left;
  }
}

/* Glass Close Button */
.side-panel-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

.side-panel-close:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(181, 18, 27, 0.5);
  transform: scale(1.08) rotate(90deg);
}

.side-panel-close:active {
  transform: scale(0.95) rotate(90deg);
}

body.light-mode .side-panel-close {
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

body.light-mode .side-panel-close:hover {
  background: rgba(0, 0, 0, 0.08);
  border-color: rgba(217, 97, 0, 0.4);
}

.side-panel-close svg {
  width: 16px;
  height: 16px;
  stroke: var(--text);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Glass Content Area */
.side-panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  min-height: 0;
  background: rgba(255, 255, 255, 0.01);
}

body.light-mode .side-panel-content {
  background: rgba(255, 255, 255, 0.3);
}

/* Glass Scrollbar */
.side-panel-content::-webkit-scrollbar {
  width: 6px;
}

.side-panel-content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 3px;
  margin: 4px 0;
}

.side-panel-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  transition: background 0.2s ease;
}

.side-panel-content::-webkit-scrollbar-thumb:hover {
  background: rgba(181, 18, 27, 0.6);
}

body.light-mode .side-panel-content::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.04);
}

body.light-mode .side-panel-content::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
}

body.light-mode .side-panel-content::-webkit-scrollbar-thumb:hover {
  background: rgba(217, 97, 0, 0.5);
}

/* Login als ruhiges, zentriertes Modal */
#login-side-panel {
  top: 50%;
  left: 50%;
  right: auto;
  bottom: auto;
  width: min(420px, calc(100vw - 32px));
  max-width: 420px;
  max-height: min(720px, calc(var(--app-layout-height, 100vh) - 32px));
  transform: translate(-50%, calc(-50% + 10px)) scale(0.97);
  border: none;
  border-radius: 28px;
  background: var(--elev);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.42);
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1),
              opacity 0.2s ease;
}

#login-side-panel.visible {
  transform: translate(-50%, -50%) scale(1);
}

#login-side-panel .side-panel-header {
  padding: 20px 24px 8px;
  border-bottom: none;
  background: transparent;
  align-items: center;
  justify-content: space-between;
}

#login-side-panel .side-panel-header h2 {
  margin: 0;
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.1;
}

#login-side-panel .side-panel-close {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: var(--participant-pill-bg);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

#login-side-panel .side-panel-close:hover {
  background: rgba(181, 18, 27, 0.18);
  border: none;
  transform: none;
}

#login-side-panel .side-panel-content {
  padding: 8px 24px 24px;
  background: transparent;
}

#login-side-panel #login-selection-view {
  gap: 12px;
}

#login-side-panel .login-option-btn {
  width: 100%;
  min-height: 52px;
  height: 52px;
  padding: 0 20px;
  border-radius: 16px;
  background: var(--accent);
  color: #fff;
  justify-content: center;
  text-align: center;
  font-size: 16px;
  font-weight: 750;
  transition: background 0.18s ease, transform 0.12s ease;
}

#login-side-panel .login-option-btn:hover {
  background: #c72a33;
}

#login-side-panel .login-option-btn-secondary {
  background: var(--participant-pill-bg);
  color: var(--text);
}

#login-side-panel .login-option-btn-secondary:hover {
  background: rgba(128, 128, 128, 0.28);
}

#login-side-panel #normal-login-view,
#login-side-panel #link-login-view {
  gap: 12px;
}

#login-side-panel .login-participant-picker {
  position: relative;
  width: 100%;
  z-index: 2;
}

#login-side-panel .login-participant-picker-button {
  height: 52px;
}

#login-side-panel .login-participant-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  z-index: 10;
}

#login-side-panel .login-participant-dropdown-menu[hidden] {
  display: none;
}

#login-side-panel .login-participant-dropdown-list {
  max-height: 312px;
  height: auto;
}

#login-side-panel .login-participant-empty {
  min-height: 52px;
  display: flex;
  align-items: center;
  padding: 12px 18px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.2;
}

#login-side-panel #normalUsernameSelect.login-select-source,
#login-side-panel #registerUsernameSelect.login-select-source {
  display: none;
}

#login-side-panel #normalUsernameSelect,
#login-side-panel #registerUsernameSelect,
#login-side-panel input[type="password"],
#login-side-panel input[type="text"] {
  height: 52px;
  border: none;
  background-color: var(--participant-pill-bg);
}

#login-side-panel #normalUsernameSelect:focus,
#login-side-panel #registerUsernameSelect:focus,
#login-side-panel input[type="password"]:focus,
#login-side-panel input[type="text"]:focus {
  border: none;
  background-color: var(--participant-pill-bg);
  box-shadow: 0 0 0 2px rgba(181, 18, 27, 0.42);
}

#login-side-panel button:not(.side-panel-close):not(.login-option-btn):not(.participant-listbox-button) {
  height: 52px;
  background: var(--accent);
}

#login-side-panel button:not(.side-panel-close):not(.login-option-btn):not(.participant-listbox-button):hover {
  background: #c72a33;
}

@media (hover: none) and (pointer: coarse) {
  #login-side-panel .login-participant-dropdown-list .login-dd-item:hover {
    background: transparent;
  }
}

/* Rules List - Einheitlicher Stil wie andere Panels */
.rules-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rules-list li {
  position: relative;
  background: var(--bg);
  border-radius: 999px;
  border: 1px solid var(--ring);
  padding: 14px 24px;
  font-size: 16px;
  line-height: 1.4;
  text-align: center;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rules-box {
  background: var(--participant-pill-bg);
  border-radius: 16px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}
.rules-box-title {
  font-size: 14px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #fff;
  font-weight: 700;
  text-align: left;
}
.countdown-circle {
  width: min(92vw, 520px);
  height: min(62vw, 280px);
  border-radius: 22px;
  background: var(--participant-pill-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
}
.countdown-title {
  font-size: 18px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #fff;
  font-weight: 700;
}
.countdown-time {
  font-size: 54px;
  font-weight: 800;
  color: var(--text);
}
.countdown-sub {
  font-size: 18px;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.rules-list.rules-list-plain { gap: 8px; padding-left: 0; margin-left: 0; text-align: left; }
.rules-list.rules-list-plain li {
  background: transparent;
  border: none;
  padding: 0;
  min-height: 0;
  text-align: left;
  justify-content: flex-start;
  display: block;
}
/* Mobile: Command Palette nur für Anleitung */
@media all {
  /* Login popup: mobile-friendly eye-level placement while keeping the
     desktop popup dimensions and visual treatment unchanged. */
  #login-side-panel {
    top: 30%;
  }

  #login-side-panel .login-participant-picker-button {
    height: var(--mobile-dropdown-height);
    min-height: var(--mobile-dropdown-height);
    max-height: var(--mobile-dropdown-height);
    padding: 0 var(--mobile-ready-content-gap);
    font-size: var(--mobile-dropdown-font-size);
  }

  /* Anleitung bleibt Command Palette - mittig unter Header */
  #rules-side-panel {
    width: 94%;
    max-width: 560px;
    max-height: 80vh;
    border-radius: 18px;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    transition: none;
  }

  #rules-side-panel.visible {
    display: flex;
  }

  /* Wer ist dabei - auf Mobile ausblenden (Content wird direkt in main eingefügt) */
  #participants-side-panel {
    display: none;
  }

  /* Fullscreen Panels ohne Animation auf Mobile */
  #history-side-panel,
  #edit-participants-side-panel,
  #edit-rules-side-panel,
  #test-draw-side-panel {
    top: 0;
    left: 0;
    width: 100%;
    max-width: none;
    height: var(--app-layout-height, 100vh);
    max-height: var(--app-layout-height, 100vh);
    border-radius: 0;
    transform: none;
    transition: none;
    display: none;
  }

  #history-side-panel.visible,
  #edit-participants-side-panel.visible,
  #edit-rules-side-panel.visible,
  #test-draw-side-panel.visible {
    display: flex;
  }

  /* Header für Fullscreen Panels */
  #participants-side-panel .side-panel-header,
  #history-side-panel .side-panel-header,
  #edit-participants-side-panel .side-panel-header,
  #edit-rules-side-panel .side-panel-header,
  #test-draw-side-panel .side-panel-header {
    position: relative;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 20px;
  }

  body.light-mode #participants-side-panel .side-panel-header,
  body.light-mode #history-side-panel .side-panel-header,
  body.light-mode #edit-participants-side-panel .side-panel-header,
  body.light-mode #edit-rules-side-panel .side-panel-header,
  body.light-mode #test-draw-side-panel .side-panel-header {
    background: rgba(255, 255, 255, 0.5);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  }

  /* History Mobile: Zurück-Pfeil + Title + Dropdown */
  #history-side-panel .side-panel-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    padding: 16px 20px;
  }

  #history-side-panel .side-panel-header h2 {
    font-size: 18px;
    margin: 0;
    text-align: left;
    grid-column: 2;
  }

  #history-side-panel .side-panel-close {
    display: none;
  }

  #history-side-panel .history-back-button {
    grid-column: 1;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
  }

  body.light-mode #history-side-panel .history-back-button {
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.08);
  }

  #history-side-panel .history-year-selector {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    grid-column: 3;
  }

  /* Participants Mobile: Zurück-Pfeil + Title */
  #participants-side-panel .side-panel-close {
    display: none;
  }

  #participants-side-panel .history-back-button {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
  }

  body.light-mode #participants-side-panel .history-back-button {
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.08);
  }

  #participants-side-panel .side-panel-header h2 {
    flex: 1;
    margin: 0;
    font-size: 18px;
  }

  /* History: Year Selector NICHT ausblenden auf Mobile - bleibt im Header */
  #history-side-panel .side-panel-content {
    padding-top: 20px;
  }

  .side-panel-header {
    padding: 18px 20px 15px;
  }

  .side-panel-header h2 {
    font-size: 17px;
  }

  .side-panel-content {
    padding: 20px;
  }

  .rules-list {
    gap: 10px;
  }

  .rules-list li {
    padding: 14px 20px;
    font-size: 15px;
    border-radius: 999px;
  }

  .header { margin-left: 0; border-bottom: 1px solid var(--ring); }
  .side { display: none; }
  .header-left .burger { display: none; }
  .header-right { display: flex; }
  body.in-host-view .header-right { display: none; }
  body.in-host-view .brand { display: none; }
  #theme-toggle,
  #share-link,
  #share-feedback { display: none; }
  #hostWidget { display: none; }
  .bar { grid-template-columns: auto 1fr auto; }
  .header-left { grid-column: 1; }
  .progress { grid-column: 2; }
  .header-right { grid-column: 3; justify-self: end; }
  .header { display: none; }
  
  #desktop-progress { display: none; }

  .status-box {
    display: none;
  }
  .status-box .title {
    display: none;
  }

  /* Mobile Dialog Mode */
  body.mobile-dialog-active {
    overscroll-behavior-x: contain;
    overflow: hidden;
    height: var(--app-layout-height, 100vh);
  }
  
  body.mobile-dialog-active .brand,
  body.mobile-dialog-active .progress {
    display: none;
  }
  
  body.mobile-dialog-active #mobile-dialog-back,
  body.mobile-dialog-active #mobile-dialog-title {
    display: flex;
    align-items: center;
    gap: 2px;
  }

body.mobile-dialog-active .header-left {
  gap: 8px;
}

  body.mobile-dialog-active.history-view .brand {
    display: flex;
  }
  body.mobile-dialog-active.history-view #mobile-dialog-title {
    display: none;
  }
  body.mobile-dialog-active.settings-view .brand,
  body.mobile-dialog-active.settings-view .header-right {
    display: none;
  }
  body.mobile-dialog-active.settings-view .header-left {
    width: 100%;
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
  body.mobile-dialog-active.settings-view #mobile-dialog-title {
    display: flex;
    flex: 1;
    justify-content: flex-start;
    text-align: left;
  }
  body.mobile-dialog-active.rules-view .brand {
    display: flex;
  }
  body.mobile-dialog-active.rules-view #mobile-dialog-title {
    display: none;
  }
  body.mobile-dialog-active.countdown-view .brand {
    display: flex;
  }
  body.mobile-dialog-active.countdown-view #mobile-dialog-title {
    display: none;
  }
  body.in-host-view:not(.mobile-dialog-active) #mobile-dialog-back {
    display: none;
  }
  body.in-host-view:not(.mobile-dialog-active) .header-right {
    display: none;
  }
  body.in-host-view:not(.mobile-dialog-active) .header-left {
    width: 100%;
    grid-column: 1 / -1;
    justify-content: flex-start;
    gap: 8px;
  }
  body.in-host-view:not(.mobile-dialog-active) #mobile-dialog-title {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
  }
  body.in-host-view:not(.mobile-dialog-active) .brand {
    display: none;
  }
  body.in-host-view:not(.mobile-dialog-active) #mobile-dialog-back svg {
    stroke: #fff;
  }
  body.mobile-dialog-active.no-mobile-back #mobile-dialog-back {
    display: none;
  }
  body.mobile-dialog-active.history-view #mobile-dialog-back,
  body.mobile-dialog-active.settings-view #mobile-dialog-back {
    display: none;
  }
  
  body.mobile-dialog-active main,
  body.mobile-dialog-active #host-view,
  body.mobile-dialog-active .status-box {
    display: none;
  }

body.mobile-dialog-active #fullscreen-content {
  display: block;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow-y: auto;
  padding: 16px;
  padding-bottom: max(114px, calc(114px + env(safe-area-inset-bottom)));
  background: var(--bg);
  z-index: 10;
}
  body.mobile-dialog-active.login-links-view #fullscreen-content {
    display: flex;
    flex-direction: column;
    top: 0;
    padding-top: 6px;
    overflow-y: auto;
  }
  body.mobile-dialog-active.countdown-view #fullscreen-content {
    overflow: hidden;
  }
  body.mobile-dialog-active.history-view #fullscreen-content {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding-top: max(12px, env(safe-area-inset-top));
    padding-left: 12px;
    padding-right: 12px;
    padding-bottom: calc(max(var(--mobile-nav-bottom), env(safe-area-inset-bottom)) + var(--mobile-nav-height) + 8px);
    box-sizing: border-box;
    height: var(--app-layout-height, 100vh);
    height: var(--app-layout-height, 100dvh);
  }
  #fullscreen-content .mobile-fullscreen-section {
    background: rgba(var(--elev-rgb), 0.72);
    border: none;
    border-radius: 18px;
    padding: 16px;
    box-shadow: none;
  }
  #fullscreen-content .participant-list-section {
    background: transparent;
    border: none;
    padding: 0;
  }
  #fullscreen-content .dashboard-section {
    background: transparent;
    border: none;
    padding: 0;
  }
  #fullscreen-content .rules-section {
    background: transparent;
    border: none;
    padding: 0;
  }
  #fullscreen-content .history-year-section,
  #fullscreen-content .history-mobile-section {
    background: transparent;
    border: none;
    padding: 0;
  }
  #fullscreen-content .countdown-section {
    background: transparent;
    border: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: calc(var(--app-layout-height, 100vh) - 220px);
    padding-top: 12px;
  }
  body.mobile-dialog-active.countdown-view #fullscreen-content .countdown-section {
    min-height: 0;
    padding-top: 0;
    justify-content: center;
  }
  #fullscreen-content .mobile-fullscreen-section.mobile-scrollable {
    max-height: calc(var(--app-layout-height, 100vh) - 120px);
    overflow-y: auto;
  }

  #fullscreen-content .ready-preview-section {
    min-height: calc(var(--app-layout-height, 100vh) - 120px);
    padding: 8px 0 24px;
    background: transparent;
  }

  .ready-preview-intro {
    margin: 0 4px 16px;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.35;
  }

  .ready-preview-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .ready-preview-row {
    display: flex;
    width: 100%;
    min-height: 52px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 16px;
    border: 1px solid var(--ring);
    border-radius: 16px;
    background: var(--participant-pill-bg);
    color: var(--text);
    font: inherit;
    text-align: left;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  }

  .ready-preview-row.is-ready {
    border-color: var(--ready-accent);
    background: var(--ready-accent);
    color: #fff;
  }

  .ready-preview-row:disabled {
    cursor: wait;
    opacity: 0.65;
  }

  .ready-preview-row-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 18px;
    font-weight: 700;
  }

  .ready-preview-row-state {
    flex-shrink: 0;
    font-size: 14px;
    font-weight: 700;
    opacity: 0.78;
  }

  #fullscreen-content .mobile-fullscreen-section + .mobile-fullscreen-section {
    margin-top: 12px;
  }

  /* Mobile: Einstellungen */
  #fullscreen-content .settings-page {
    background: transparent;
    padding: 8px 0 24px;
  }
  #fullscreen-content .settings-page-title {
    margin: 0 4px 18px;
    color: var(--text);
    font-size: 24px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
  }
  #fullscreen-content .settings-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  #fullscreen-content .settings-item,
  #fullscreen-content .settings-profile-button {
    display: flex;
    width: 100%;
    min-height: 60px;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    padding: 10px 14px;
    border: none;
    border-radius: 18px;
    background: var(--participant-pill-bg);
    color: var(--text);
    text-align: left;
  }
  #fullscreen-content .settings-profile-button {
    font: inherit;
    cursor: pointer;
    transition: background 0.18s ease, transform 0.12s ease;
  }
  #fullscreen-content .settings-profile-button:hover,
  #fullscreen-content .settings-profile-button:focus-visible,
  #fullscreen-content .settings-item.settings-action:hover,
  #fullscreen-content .settings-item.settings-action:focus-visible {
    background: rgba(128, 128, 128, 0.26);
  }
  #fullscreen-content .settings-profile-button:active,
  #fullscreen-content .settings-item.settings-action:active {
    transform: scale(0.985);
  }
  #fullscreen-content .settings-profile-button:focus-visible,
  #fullscreen-content .settings-item.settings-action:focus-visible,
  #fullscreen-content .settings-switch input:focus-visible + .settings-slider {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
  }
  #fullscreen-content .settings-item.settings-action {
    font: inherit;
    cursor: pointer;
    transition: background 0.18s ease, transform 0.12s ease;
  }
  #fullscreen-content .settings-leading-icon {
    display: grid;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    place-items: center;
    border-radius: 14px;
    background: rgba(128, 128, 128, 0.18);
    color: var(--muted);
  }
  #fullscreen-content .settings-leading-icon svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
  }
  #fullscreen-content .settings-share-icon svg { fill: currentColor; stroke: none; }
  #fullscreen-content .settings-item-text {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
    gap: 2px;
  }
  #fullscreen-content .settings-item-title { font-weight: 800; line-height: 1.25; }
  #fullscreen-content .settings-chevron {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    fill: none;
    stroke: var(--muted);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
  }
  #fullscreen-content .settings-switch { position: relative; width: 54px; height: 32px; flex-shrink: 0; }
  #fullscreen-content .settings-switch input { opacity: 0; width: 0; height: 0; }
  #fullscreen-content .settings-slider {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: rgba(128, 128, 128, 0.28);
    transition: background 0.2s ease;
  }
  #fullscreen-content .settings-slider::before {
    content: '';
    position: absolute;
    width: 26px;
    height: 26px;
    left: 3px;
    top: 50%;
    transform: translateY(-50%);
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s ease;
  }
  #fullscreen-content .settings-switch input:checked + .settings-slider { background: rgba(181, 18, 27, 0.55); }
  #fullscreen-content .settings-switch input:checked + .settings-slider::before { transform: translate(22px, -50%); }

  #fullscreen-content .settings-item-text { gap: 0; }

  body.mobile-dialog-active.history-view #mobile-dialog-title {
    flex: 1;
    text-align: left;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    line-height: 1.2;
    position: relative;
    justify-content: flex-start;
    padding-right: 0;
  }

  .mobile-history-title {
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    line-height: 32px;
  }

  /* Mobile Fullscreen Dialog Styles */
  .dialog-overlay.mobile-fullscreen {
    padding: 0;
    align-items: flex-start;
    background: var(--bg);
    padding-top: 56px;
    z-index: 5;
    transition: none;
  }

  .dialog-overlay.mobile-fullscreen .dialog-box {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    margin: 0;
    max-width: 100%;
    width: 100%;
    box-shadow: none;
    transform: scale(1);
    transition: none;
  }

  .dialog-overlay.mobile-fullscreen h2 {
    display: none;
  }

  .dialog-overlay.mobile-fullscreen .dialog-content {
    padding: 8px;
    margin: 0;
    overflow: visible;
  }

  .dialog-overlay.mobile-fullscreen .dialog-content .editor-form-container {
    transform: none;
    padding: 0;
    max-height: none;
    overflow: visible;
  }

  .dialog-overlay.mobile-fullscreen .editor-row {
    gap: 8px;
    margin-bottom: 8px;
  }

  .dialog-overlay.mobile-fullscreen .participant-editor-row {
    gap: 8px;
    margin-bottom: 8px;
  }

  .dialog-overlay.mobile-fullscreen .test-draw-row {
    gap: 8px;
    margin-bottom: 8px;
  }

  .dialog-overlay.mobile-fullscreen .editor-row input,
  .dialog-overlay.mobile-fullscreen .editor-row select,
  .dialog-overlay.mobile-fullscreen .participant-editor-row-input {
    height: auto;
    padding: 8px 10px;
    font-size: 14px;
  }

  .dialog-overlay.mobile-fullscreen .test-draw-row > div {
    height: auto;
    padding: 8px 10px;
    font-size: 14px;
  }

  .dialog-overlay.mobile-fullscreen .editor-actions {
    margin-top: 12px;
    gap: 8px;
  }

  .dialog-overlay.mobile-fullscreen .dialog-box button {
    padding: 10px;
    font-size: 14px;
  }

  .dialog-overlay.mobile-fullscreen .participant-editor-header {
    font-size: 12px;
    margin-bottom: 4px;
  }

  .dialog-overlay.mobile-fullscreen .tags-input-container {
    min-height: 36px;
    padding: 4px 8px;
  }

  .dialog-overlay.mobile-fullscreen .tag-item {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 999px;
  }

  .dialog-overlay.mobile-fullscreen .tag-item span {
    margin-right: 4px;
  }

  .dialog-overlay.mobile-fullscreen .tags-input-container input {
    font-size: 14px;
    min-width: 60px;
  }

  .dialog-overlay.mobile-fullscreen .status-overview-columns {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .dialog-overlay.mobile-fullscreen .status-item {
    height: auto;
    padding: 10px 12px;
    font-size: 14px;
  }


  .dialog-overlay.mobile-fullscreen .past-results-container {
    max-height: none;
    overflow: visible;
    padding: 0;
    margin: 0;
  }

  .dialog-overlay.mobile-fullscreen .dialog-title-wrapper {
    flex-direction: row;
    justify-content: center;
    position: relative;
  }

  .dialog-overlay.mobile-fullscreen .dialog-title-wrapper .year-selector-wrapper {
    position: absolute;
    right: 0;
  }

  .dialog-overlay.mobile-fullscreen .participant-list-grid {
    width: 100%;
    max-width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin: 0;
  }

  .dialog-overlay.mobile-fullscreen .editor-name-display {
    height: auto;
    padding: 8px 10px;
    font-size: 13px;
  }
  
  /* Mobile Header Year Selector - Center Position */
  body.mobile-dialog-active.history-view .track {
    display: none;
  }

  body.mobile-dialog-active.history-view .progress {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 100%;
  }

  body.mobile-dialog-active.history-view .progress .year-selector-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    position: fixed;
    left: 50vw;
    top: 28px;
    transform: translate(-50%, -50%);
    z-index: 10001;
  }

  body.mobile-dialog-active.history-view .progress .year-selector-wrapper > div {
    position: relative;
    display: inline-block;
  }

  body.mobile-dialog-active.history-view .progress .year-selector-select,
  body.mobile-dialog-active.history-view .progress #historyYearSelect {
    font-size: 18px;
    font-weight: 600;
    padding: 0 24px 0 0;
    border: none;
    border-bottom: none;
    background: transparent;
    color: var(--text);
    text-align: center;
    min-width: auto;
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
  }

  body.mobile-dialog-active.history-view .progress .year-selector-wrapper svg {
    width: 16px;
    height: 16px;
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.8;
  }

  body.mobile-dialog-active.history-view #historyDataDisplay {
    padding-top: 0;
  }

  /* Select Dropdown Options sichtbar machen */
  #historyYearSelect option {
    background: var(--bg);
    color: var(--text);
    padding: 8px;
  }

  body.light-mode #historyYearSelect option {
    background: #f5f5f5;
    color: #1a1a1a;
  }
  
  body.mobile-dialog-active.history-view .year-selector-wrapper .year-selector-arrow {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
  }
  

}

@media all {
  /* Kompakter für kleine Screens */
  :root {
    --mobile-main-inline-gap: 12px;
  }

  #rules-side-panel {
    width: 95%;
    max-height: 75vh;
    border-radius: 16px;
    left: 50%;
    transform: translateX(-50%);
  }

  .side-panel-header {
    padding: 16px 18px 14px;
  }

  .side-panel-content {
    padding: 18px;
  }

  .side-panel-header h2 {
    font-size: 16px;
  }

  .side-panel-close {
    width: 30px;
    height: 30px;
  }

  .side-panel-close svg {
    width: 14px;
    height: 14px;
  }

  .rules-list {
    gap: 8px;
  }

  .rules-list li {
    padding: 12px 18px;
    font-size: 14px;
    border-radius: 999px;
  }

  /* History Year Selector kompakter */
  #history-side-panel .history-year-wrapper { height: 30px; }
  #history-side-panel .history-year-button { font-size: 15px; padding: 0 10px 0 12px; }
  #history-side-panel .history-year-button svg { width: 14px; height: 14px; }

  #history-side-panel .side-panel-header {
    grid-template-columns: 30px 1fr 30px;
  }

  /* Kleinere Anpassungen für sehr kleine Bildschirme */
  .dialog-overlay.mobile-fullscreen .editor-row input,
  .dialog-overlay.mobile-fullscreen .editor-row select,
  .dialog-overlay.mobile-fullscreen .participant-editor-row-input {
    padding: 6px 8px;
    font-size: 13px;
  }

  .dialog-overlay.mobile-fullscreen .test-draw-row > div {
    padding: 6px 8px;
    font-size: 13px;
  }

  .dialog-overlay.mobile-fullscreen .status-overview-columns {
    gap: 10px;
  }

  .dialog-overlay.mobile-fullscreen .status-item {
    padding: 8px 10px;
    font-size: 13px;
  }


  .dialog-overlay.mobile-fullscreen .dialog-box button {
    padding: 8px;
    font-size: 13px;
  }

  .dialog-overlay.mobile-fullscreen .participant-editor-header {
    font-size: 11px;
    margin-bottom: 3px;
  }

  .dialog-overlay.mobile-fullscreen .tags-input-container {
    min-height: 32px;
    padding: 3px 6px;
  }

  .dialog-overlay.mobile-fullscreen .editor-name-display {
    padding: 8px 10px;
    font-size: 13px;
  }

}

#login-error-msg:empty { margin:0; min-height:0; padding:0; }


#login-error-msg { margin-top:4px; min-height:0; }

/* Toasts (fixed overlay, not in layout flow) */
.toast-notification {
    position: fixed;
    left: 50%;
    bottom: calc(16px + env(safe-area-inset-bottom));
    transform: translateX(-50%) translateY(10px);
    opacity: 0;
    pointer-events: none;
    z-index: 20000;
    max-width: min(560px, calc(100vw - 24px));
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(var(--elev-rgb), 0.88);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: var(--text);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    transition: opacity 180ms ease, transform 180ms ease;
}
.toast-notification.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.toast-notification.error {
    border-color: rgba(255, 107, 107, 0.35);
    background: rgba(50, 12, 12, 0.82);
}
.toast-notification.success {
    border-color: rgba(76, 175, 80, 0.35);
    background: rgba(10, 38, 16, 0.82);
}
body.light-mode .toast-notification {
    background: rgba(255, 255, 255, 0.92);
    border-color: rgba(0, 0, 0, 0.10);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.15);
}
body.light-mode .toast-notification.error {
    background: rgba(255, 235, 238, 0.96);
}
body.light-mode .toast-notification.success {
    background: rgba(232, 245, 233, 0.96);
}

/* Vereinheitlichtes Design fuer Anleitung + Dashboard */
#rules-panel-content .rules-list li,
#fullscreen-content .rules-list li {
    background: var(--participant-pill-bg);
    border: none;
}

.dashboard-card,
.dashboard-stat {
    color: var(--text);
}
.dashboard-card-title,
.dashboard-card-sub,
.dashboard-stat-label {
    color: var(--text);
}

/* Dashboard-History als zusammenhängender Nachrichtenstapel wie die Ready-Updates. */
#fullscreen-content .history-box-single {
    padding: var(--mobile-status-area-padding);
    gap: 0;
    border-radius: var(--mobile-ready-radius);
    background: linear-gradient(var(--mobile-status-surface), var(--mobile-status-surface)), var(--elev);
    overflow: hidden;
}
#fullscreen-content .history-box-header {
    display: none;
}
#fullscreen-content .history-pairings {
    gap: 0;
    padding: 0;
    border-radius: var(--mobile-status-card-radius);
    background: var(--mobile-status-card-surface);
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
#fullscreen-content .history-pairings::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}
#fullscreen-content .history-pair-row {
    height: var(--mobile-status-card-height);
    min-height: var(--mobile-status-card-height);
    padding: 0 var(--mobile-status-card-padding-inline);
    border-radius: 0;
    background: var(--mobile-status-card-surface);
}
#fullscreen-content .history-name {
    font-size: 16px;
    font-weight: 600;
}
#fullscreen-content .history-arrow {
    width: 18px;
    height: 18px;
    opacity: 0.8;
}
#fullscreen-content .history-pair-row + .history-pair-row {
    border-top: 1px solid var(--mobile-status-divider);
}
#fullscreen-content .history-pair-row:first-child {
    border-top-left-radius: var(--mobile-status-card-radius);
    border-top-right-radius: var(--mobile-status-card-radius);
}
#fullscreen-content .history-pair-row:last-child {
    border-bottom-left-radius: var(--mobile-status-card-radius);
    border-bottom-right-radius: var(--mobile-status-card-radius);
}
/* Cohesive Light Theme: warm surfaces, semantic hierarchy, restrained accent */
body.light-mode {
    background: var(--bg);
    color: var(--text);
    color-scheme: light;
}

body.light-mode .header,
body.light-mode .side {
    background: var(--bg);
}

body.light-mode .header {
    border-bottom: none;
    box-shadow: inset 0 -1px 0 rgba(58, 49, 40, 0.08);
}

body.light-mode .side {
    box-shadow: inset -1px 0 0 rgba(58, 49, 40, 0.08);
}

body.light-mode .ready-box,
body.light-mode .status-box {
    background: var(--surface-1);
    border: none;
    box-shadow: var(--shadow-md);
}

body.light-mode .form-header hr {
    background: var(--ring);
}

body.light-mode .icon-btn,
body.light-mode .host-icon,
body.light-mode .header-pill,
body.light-mode .add-participant-btn {
    background: var(--surface-1);
    border: none;
    box-shadow: var(--shadow-sm);
}

body.light-mode .icon-btn:hover,
body.light-mode .host-widget:hover .host-icon,
body.light-mode .header-pill:hover,
body.light-mode .add-participant-btn:hover {
    background: var(--surface-2);
}

body.light-mode .header-pill:hover {
    border-color: transparent;
}

body.light-mode #share-feedback,
body.light-mode #mobile-copy-feedback {
    background: var(--surface-1);
    border: none;
    box-shadow: var(--shadow-sm);
}

body.light-mode .mi::before {
    background: rgba(58, 49, 40, 0.08);
}

body.light-mode .mi.danger::before,
body.light-mode #miMobileLogout::before,
body.light-mode[data-user-logged-in="true"] #miMobileLogin::before {
    background: rgba(192, 57, 43, 0.10);
}

body.light-mode .dashboard-card {
    border: none;
    background: #ffffff;
    box-shadow: none;
}

body.light-mode .dashboard-stat {
    border: none;
    background: var(--surface-1);
    box-shadow: none;
}

body.light-mode .history-box-single,
body.light-mode .history-notice {
    background: #ffffff;
    border: none;
    box-shadow: none;
}

body.light-mode .history-pair-row {
    background: var(--surface-2);
    border: none;
    box-shadow: none;
}

body.light-mode .dashboard-names-card,
body.light-mode .rules-list li,
body.light-mode .rules-box,
body.light-mode .countdown-circle,
body.light-mode .history-pairings-box,
body.light-mode .participant-list-grid > .editor-name-display,
body.light-mode .participant-list-grid .editor-name-display {
    background: var(--surface-2);
    border: none;
    box-shadow: none;
}

body.light-mode .dashboard-names-title,
body.light-mode .rules-box-title,
body.light-mode .countdown-title,
body.light-mode .history-box-title,
body.light-mode .dashboard-card-title {
    color: var(--muted);
}

body.light-mode .dashboard-stat,
body.light-mode .status-item,
body.light-mode .test-draw-row > div,
body.light-mode .editor-row input,
body.light-mode .editor-row select,
body.light-mode .participant-editor-row .participant-editor-row-input,
body.light-mode .editor-name-display,
body.light-mode .tags-input-container,
body.light-mode #normalUsernameSelect,
body.light-mode #registerUsernameSelect,
body.light-mode .participant-listbox-button {
    background: var(--control-bg);
    border: none;
}

body.light-mode .dashboard-tabs {
    background: var(--surface-2);
    border: none;
}

body.light-mode .dashboard-tabs::before {
    background: var(--surface-1);
    box-shadow: none;
}

body.light-mode .dashboard-year-tab {
    background: var(--surface-2);
    border: none;
    box-shadow: none;
    color: var(--muted);
}

body.light-mode .dashboard-year-tab:hover {
    background: var(--surface-3);
    color: var(--text);
}

body.light-mode .dashboard-year-tab.active {
    background: #1c1c1e;
    color: #ffffff;
    border: none;
    box-shadow: none;
}

body.light-mode .history-year-button {
    background: var(--surface-2);
    border: none;
}

body.light-mode .history-year-button:hover {
    background: var(--surface-3);
}

body.light-mode .dd-mask {
    background: var(--surface-1);
    border-top: none;
    box-shadow: var(--shadow-sm);
}

body.light-mode .dd-item:hover {
    background-color: var(--surface-2);
}

body.light-mode .dd-item:active,
body.light-mode .dd-item.selected {
    background-color: var(--surface-3);
}

body.light-mode .editor-row button {
    background: var(--accent-weak);
    color: var(--accent);
}

body.light-mode .editor-row button:hover {
    background: var(--surface-3);
    color: var(--text);
}

body.light-mode .tag-item {
    background: var(--accent-weak);
    color: var(--accent);
}

body.light-mode .status-item {
    color: var(--text);
}

body.light-mode .input-pill:focus,
body.light-mode .editor-row input:focus,
body.light-mode .editor-row select:focus,
body.light-mode .participant-editor-row .participant-editor-row-input:focus,
body.light-mode .tags-input-container:focus-within,
body.light-mode .participant-listbox-button:focus-visible,
body.light-mode #normalUsernameSelect:focus,
body.light-mode #registerUsernameSelect:focus {
    box-shadow: 0 0 0 2px rgba(181, 18, 27, 0.28);
}

body.light-mode .dialog-overlay {
    background: rgba(57, 47, 37, 0.34);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

body.light-mode .dialog-box {
    background: var(--surface-1);
    border: none;
    box-shadow: var(--shadow-md);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

body.light-mode .dialog-box input,
body.light-mode .dialog-box textarea {
    background: var(--control-bg);
    border: none;
}

body.light-mode .dialog-box input:focus,
body.light-mode .dialog-box textarea:focus {
    background: var(--control-bg);
    border: none;
    box-shadow: 0 0 0 2px rgba(181, 18, 27, 0.28);
}

body.light-mode .side-panel {
    background: var(--surface-1);
    border: none;
    box-shadow: var(--shadow-md);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

body.light-mode .side-panel-header {
    background: transparent;
    border-bottom: none;
}

body.light-mode .side-panel-content {
    background: transparent;
}

body.light-mode .side-panel-close {
    background: var(--surface-2);
    border: none;
}

body.light-mode .side-panel-close:hover {
    background: var(--surface-3);
    border-color: transparent;
}

body.light-mode .side-panel-backdrop {
    background: rgba(57, 47, 37, 0.34);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

body.light-mode #fullscreen-content .mobile-fullscreen-section {
    background: var(--surface-1);
}

body.light-mode .mobile-actions,
body.light-mode .mobile-ready-action {
    background: var(--surface-1);
    border: none;
    box-shadow: var(--shadow-md);
}

body.light-mode .mobile-actions .nav-highlight {
    background: var(--surface-3);
}

body.light-mode .mobile-ready-action.is-ready,
body.light-mode .mobile-ready-action[data-state="reset"] {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 18px rgba(47, 107, 59, 0.35);
}

body.light-mode .notification-item {
    background: var(--surface-1);
    color: var(--text);
    box-shadow: var(--shadow-sm);
}

body.light-mode .toast-notification {
    background: var(--surface-1);
    border: none;
    box-shadow: var(--shadow-md);
}

body.light-mode .toast-notification.error {
    background: #fbe9e7;
}

body.light-mode .toast-notification.success {
    background: #e8f2e8;
}

body.light-mode #historyYearSelect option {
    background: var(--surface-1);
    color: var(--text);
}

body.light-mode .dialog-box button:hover:not(:disabled),
body.light-mode .ready-box-button:hover:not(:disabled),
body.light-mode #login-side-panel .login-option-btn:hover,
body.light-mode #login-side-panel button:not(.side-panel-close):not(.login-option-btn):not(.participant-listbox-button):hover {
    background: var(--accent-hover);
}

body.light-mode #login-side-panel .login-option-btn-secondary:hover {
    background: var(--surface-3);
}

body.light-mode .dashboard-card-title,
body.light-mode .dashboard-card-sub,
body.light-mode .dashboard-stat-label {
    color: var(--muted);
}

body.light-mode .last-year-repeat-marker {
    background-color: var(--accent-weak);
    border-color: var(--accent);
}

body.light-mode #fullscreen-content .settings-page {
    background: transparent;
}
}

@layer utilities {
  [data-dashboard-private][hidden] { display: none; }
  .hidden { display: none; }
  .u-text-center { text-align: center; }
  .u-p-20 { padding: 20px; }
  .u-error { color: var(--error); }
  .u-warning { color: var(--u-warning-color, var(--warning)); }
  .u-muted { color: var(--muted); }
  .d-none { display: none; }
  .d-block { display: block; }
  .d-grid { display: grid; }
  .d-flex { display: flex; }
  .d-inline-block { display: inline-block; }
  .overflow-hidden { overflow: hidden; }
  .opacity-0 { opacity: 0; }
  .opacity-1 { opacity: 1; }
  .transition-none { transition: none; }
  .fade-out { opacity: 0; }
  .fade-in { opacity: 1; }
  .position-relative { position: relative; }
}

@layer accessibility {
  @media all {
    body.preload.mobile-tab-initializing .mobile-actions .nav-highlight {
      visibility: hidden;
    }

    body.preload.mobile-tab-restore-pending main {
      visibility: hidden;
    }
  }

  body.preload *,
  body.preload *::before,
  body.preload *::after {
    transition: none;
    animation: none;
  }

  @media (prefers-reduced-motion: reduce) {
    #participantButton,
    .dd-mask,
    .dd-item,
    .notification-empty-state {
      transition: none;
    }
  }
}

/* Mobile layout: opening the participant list must not leave a row hovered. */
@media all {
  .dd-item:hover,
  body.light-mode .dd-item:hover {
    background-color: transparent;
  }
}
/*
 * Canonical mobile guest flow.
 *
 * Each mobile main-view component owns its layout here. No legacy mobile
 * guest-flow overrides remain in 03-mobile.css.
 */

.notification-area,
.notification-empty-state,
.inline-rules {
  display: none;
}

.mobile-editor-field-label {
  display: none;
}

.ready-identity-box {
  --ready-identity-track-bg: #21272E;
  --ready-identity-result-bg: var(--surface-2);
  --ready-identity-fill-bg: var(--ready-accent);
  grid-row: 1 / -1;
  grid-column: 1;
  width: 100%;
  height: 100%;
  display: grid;
}

body.light-mode .ready-identity-box {
  --ready-identity-track-bg: var(--surface-2);
  --ready-identity-result-bg: var(--surface-3);
}

/* Match the light lettering to the animated green coverage. */
body.light-mode .ready-identity-box #ready-box-form .mobile-ready-pills-container #waiting-text::after {
  content: 'Dein Wichtel' / '';
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0 8px;
  color: var(--on-accent);
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  clip-path: inset(0 calc(100% - var(--fill-width, 0%)) 0 0);
  transition: clip-path 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* After the draw, the result pill is filled completely. */
body.light-mode .ready-identity-box #ready-box-result:not(.hidden) #reveal-button::before,
body.light-mode .ready-identity-box #ready-box-result:not(.hidden) #result-name {
  color: var(--on-accent);
}

.ready-status-box {
  display: none;
}

@media all {
  /* Mobile page shell */
  main,
  #host-view {
    padding-top: 12px;
    padding-left: var(--mobile-main-inline-gap);
    padding-right: var(--mobile-main-inline-gap);
    padding-bottom: max(114px, calc(114px + env(safe-area-inset-bottom)));
    margin-left: 0;
  }

  body:not(.mobile-dialog-active):not(.in-host-view) {
    overflow-x: hidden;
    overflow-y: auto;
  }

  body.mobile-bottom-ui main,
  body.mobile-bottom-ui #host-view {
    padding-bottom: max(108px, calc(108px + env(safe-area-inset-bottom)));
  }

  body.mobile-bottom-ui .ready-box {
    height: auto;
  }

  body.mobile-bottom-ui .status-box {
    margin-top: 0;
  }

  body.in-host-view:not(.mobile-dialog-active) .header {
    display: block;
    position: sticky;
    top: 0;
    z-index: 12;
    border-bottom: none;
  }

  body.in-host-view:not(.mobile-dialog-active) .bar {
    height: 56px;
    min-height: 56px;
    padding: 6px var(--mobile-main-inline-gap);
  }

  body.in-host-view:not(.mobile-dialog-active) #mobile-dialog-back {
    display: none;
  }

  body.in-host-view:not(.mobile-dialog-active) #mobile-dialog-title {
    margin: 0;
    padding-left: var(--space-3);
    font-size: 20px;
    font-weight: 700;
  }

  body.in-host-view:not(.mobile-dialog-active) #host-view {
    height: calc(var(--app-layout-height, 100vh) - 56px);
    height: calc(var(--app-layout-height, 100dvh) - 56px);
    padding-top: 16px;
  }

  #host-view-content {
    padding: 0;
  }

  #host-view .mi-icon {
    display: none;
  }

  #host-view .mi {
    margin-left: 0;
    margin-right: 0;
  }

  #host-view .mi + .mi {
    margin-top: 0;
  }

  #host-view-host {
    gap: 16px;
  }

  #host-view-host > .mi {
    height: 36px;
    min-height: 0;
    max-height: 36px;
    margin: 0;
    padding: 0 var(--space-3);
    box-sizing: border-box;
  }

  /* Touch devices must not keep the browser's synthetic hover state active
     after a menu item was tapped. The short tap flash remains intentional. */
  @media (hover: none) and (pointer: coarse) {
    #host-view .mi:hover::before {
      opacity: 0;
    }

    #host-view .mi.tap-flash::before {
      opacity: 1;
    }
  }

  #host-view .menu-separator {
    height: 0;
    min-height: 0;
    max-height: 0;
    font-size: 0;
    line-height: 0;
    overflow: hidden;
    border: none;
    border-top: 1px solid var(--ring);
    background: transparent;
    margin: 0;
    width: 100%;
    box-sizing: border-box;
    flex-shrink: 0;
  }

  #host-view .host-view-footer {
    display: flex;
    flex-direction: column;
    gap: 8px;
    justify-content: center;
    margin-top: 0;
    padding: 0;
    width: 100%;
  }

  #host-view #miMobileLogin {
    width: 100%;
    height: var(--mobile-progress-height);
    min-height: 36px;
    max-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 4px 0;
    padding: 0 18px;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--ring);
    font-size: 16px;
    font-weight: 600;
    box-sizing: border-box;
  }

  #host-view #miMobileLogout,
  body[data-user-logged-in="true"] #host-view #miMobileLogin {
    width: 100%;
    height: var(--mobile-progress-height);
    min-height: 36px;
    max-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0 14px;
    border-radius: 999px;
    background: rgba(255, 107, 107, 0.12);
    color: #ff6b6b;
    border: none;
    font-size: 14px;
    font-weight: 700;
    box-sizing: border-box;
  }

  body[data-user-logged-in="true"] #host-view #host-view-guest {
    align-items: stretch;
    justify-content: flex-start;
  }

  .ready-box {
    margin: 4px auto 4px;
    border-radius: 20px;
  }

  /* Progress */
  #desktop-progress,
  #drawStatus,
  #readyBtn {
    display: none;
  }

  #mobile-progress {
    display: none;
    width: calc(100% - (var(--mobile-progress-inline-gap) * 2));
    height: var(--mobile-progress-height);
    min-height: var(--mobile-progress-height);
    max-height: var(--mobile-progress-height);
    position: fixed;
    top: 12px;
    left: var(--mobile-progress-inline-gap);
    right: var(--mobile-progress-inline-gap);
    z-index: 12;
  }

  #mobile-progress .track {
    height: var(--mobile-progress-height);
    min-height: var(--mobile-progress-height);
    max-height: var(--mobile-progress-height);
    max-width: none;
  }

  #mobile-progress #progressTextMobile {
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
  }

  body.light-mode #mobile-progress #progressTextMobile {
    color: #111;
  }

  body.mobile-dialog-active #mobile-progress,
  body.in-host-view #mobile-progress {
    display: none;
  }

  #participantButton.participant-identity-pill {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    font-size: 18px;
  }

  #participantButton.participant-identity-pill::before {
    --accent: var(--ready-accent);
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: var(--fill-width);
    background: var(--accent);
    transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
    z-index: 0;
    pointer-events: none;
  }

  #participantButton.participant-identity-pill .truncate {
    position: relative;
    z-index: 1;
  }

  #participantButton.participant-identity-pill::after {
    content: attr(data-label);
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px calc(18px * var(--desktop-scale));
    color: var(--on-accent);
    line-height: 1.25;
    white-space: nowrap;
    clip-path: inset(0 calc(100% - var(--fill-width)) 0 0);
    transition: clip-path 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
    z-index: 2;
    pointer-events: none;
  }

  #mobile-action-pills {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
    max-width: none;
    height: var(--mobile-progress-height);
    min-height: var(--mobile-progress-height);
    max-height: var(--mobile-progress-height);
    margin: 0 0 16px;
    box-sizing: border-box;
  }

  .inline-rules.inline-rules[hidden] + #mobile-action-pills {
    margin-top: 8px;
  }

  body.mobile-dialog-active #mobile-action-pills,
  body.in-host-view #mobile-action-pills {
    display: none;
  }

  /* Slide button for Darkmode */
  .mobile-theme-slider {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    height: var(--mobile-progress-height);
    min-height: var(--mobile-progress-height);
    max-height: var(--mobile-progress-height);
    border-radius: 9999px;
    border: 1px solid var(--ring);
    background: transparent;
    padding: 2px;
    box-sizing: border-box;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    box-shadow: none;
  }

  #mobile-action-pills #private-login-link {
    width: 100%;
    height: var(--mobile-progress-height);
    min-height: var(--mobile-progress-height);
    max-height: var(--mobile-progress-height);
    margin: 0;
    padding: 0 12px;
    border-radius: 9999px;
    background: transparent;
    border: 1px solid var(--ring);
    box-shadow: none;
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    box-sizing: border-box;
  }

  #mobile-action-pills #private-login-link.guest-link {
    font-size: clamp(11px, 3.3vw, 14px);
  }

  #mobile-action-pills #private-login-link[hidden] {
    display: none;
  }

  .mobile-theme-slider-thumb {
    position: absolute;
    top: 2px;
    bottom: 2px;
    left: 2px;
    width: calc(50% - 2px);
    border-radius: 9999px;
    background: var(--control-bg);
    border: 1px solid var(--ring);
    box-sizing: border-box;
    transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
    pointer-events: none;
    z-index: 1;
  }

  body.light-mode .mobile-theme-slider-thumb {
    transform: translateX(100%);
    background: var(--participant-pill-bg);
  }

  .mobile-theme-slider-option {
    position: relative;
    z-index: 2;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 100%;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    transition: opacity 0.2s ease;
    pointer-events: none;
  }

  .mobile-theme-slider-option svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
  }

  .mobile-theme-slider-option.option-dark {
    opacity: 1;
  }

  .mobile-theme-slider-option.option-light {
    opacity: 0.45;
    transform: translateY(-0.5px);
  }

  body.light-mode .mobile-theme-slider-option.option-dark {
    opacity: 0.45;
  }

  body.light-mode .mobile-theme-slider-option.option-light {
    opacity: 1;
  }

  /* Link teilen Pill (transparent / no fill, matching progress bar) */
  .mobile-action-pill {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: var(--mobile-progress-height);
    min-height: var(--mobile-progress-height);
    max-height: var(--mobile-progress-height);
    border-radius: 9999px;
    background: transparent;
    border: 1px solid var(--ring);
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-sizing: border-box;
    padding: 0 12px;
    transition: opacity 0.15s ease, transform 0.1s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    box-shadow: none;
  }

  .mobile-action-pill:active {
    transform: scale(0.97);
    opacity: 0.7;
  }

  .mobile-action-pill .pill-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
  }

  .mobile-action-pill .pill-icon svg {
    width: 18px;
    height: 18px;
  }

  /* Mobile host editors reuse the shared editor logic with touch-friendly layout. */
  #fullscreen-content .mobile-editor-section {
    width: 100%;
    padding: 4px 0 24px;
    border-radius: 0;
    background: transparent;
  }

  #fullscreen-content .mobile-editor-section .editor-form-container {
    width: 100%;
    max-height: none;
    padding: 0;
    overflow: visible;
  }

  #fullscreen-content .participant-editor-column-headings {
    display: none;
  }

  #fullscreen-content #participants-editor-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  #fullscreen-content .participant-editor-section #participants-editor-list .participant-editor-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 10px;
    position: relative;
    margin: 0;
    padding: 14px;
    overflow: visible;
    border-radius: 20px;
    background: var(--participant-pill-bg);
  }

  #fullscreen-content .participant-editor-section .participant-editor-field {
    min-width: 0;
  }

  #fullscreen-content .participant-editor-section .participant-exclusions-field {
    grid-column: 1 / -1;
  }

  #fullscreen-content .mobile-editor-field-label {
    display: block;
    margin: 0 0 6px 2px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1.2;
  }

  #fullscreen-content .participant-editor-section .participant-editor-row-input {
    width: 100%;
    height: 48px;
    padding: 11px 13px;
    border-radius: 14px;
    background: var(--bg);
    font-size: 16px;
    text-align: left;
  }

  #fullscreen-content .participant-editor-section .participant-name-field {
    position: relative;
  }

  #fullscreen-content .participant-editor-section .participant-name-field .participant-editor-row-input {
    padding-right: 46px;
  }

  #fullscreen-content .participant-editor-section .participant-row-delete {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    position: absolute;
    top: 29px;
    right: 7px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(255, 107, 107, 0.14);
    color: #ff6b6b;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
  }

  #fullscreen-content .participant-editor-section .tags-input-container {
    display: flex;
    width: 100%;
    min-height: 48px;
    height: auto;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 10px;
    overflow: visible;
    border-radius: 14px;
    background: var(--bg);
  }

  #fullscreen-content .participant-editor-section .tags-input-container input {
    min-width: 120px;
    height: 34px;
    padding: 0 2px;
    font-size: 16px;
  }

  #fullscreen-content .participant-editor-actions,
  #fullscreen-content .rules-editor-actions {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 10px;
    margin-top: 16px;
  }

  #fullscreen-content .participant-editor-actions .add-participant-btn,
  #fullscreen-content .rules-editor-actions .add-participant-btn,
  #fullscreen-content .participant-editor-actions button:last-child,
  #fullscreen-content .rules-editor-actions button:last-child {
    height: 52px;
  }

  #fullscreen-content .rules-editor-section .editor-form-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  #fullscreen-content .rules-editor-section .rules-editor-row {
    display: block;
    position: relative;
    margin: 0;
  }

  #fullscreen-content .rules-editor-section .input-with-button {
    width: 100%;
  }

  #fullscreen-content .rules-editor-section .rules-editor-row input {
    width: 100%;
    height: 52px;
    padding: 11px 52px 11px 14px;
    border-radius: 16px;
    background: var(--participant-pill-bg);
    font-size: 16px;
    text-align: left;
  }

  #fullscreen-content .rules-editor-section .remove-rule-btn {
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(255, 107, 107, 0.14);
    color: #ff6b6b;
    font-size: 21px;
    line-height: 1;
    opacity: 1;
    cursor: pointer;
  }

  #fullscreen-content .login-links-section {
    display: flex;
    flex: 1;
    min-height: 0;
    width: 100%;
    padding: 0;
    border-radius: 0;
    background: transparent;
  }

  #fullscreen-content .login-links-manager {
    flex: 1;
    min-height: 0;
  }

  #fullscreen-content .login-links-list {
    display: grid;
    flex: 1;
    grid-auto-rows: 48px;
    align-content: start;
    gap: 4px;
    min-height: 0;
  }

  #fullscreen-content .login-link-row {
    grid-template-columns: 80px minmax(0, 1fr) 108px;
    gap: 6px;
    height: 48px;
    padding: 8px 3px 8px 10px;
    border-radius: 12px;
  }

  #fullscreen-content .login-link-name {
    font-size: 17px;
  }

  #fullscreen-content .login-link-actions {
    gap: 2px;
    height: 32px;
    padding: 2px;
  }

  #fullscreen-content .login-link-actions button,
  #fullscreen-content .login-link-copy {
    height: 32px;
    padding: 0 5px;
    font-size: 11px;
  }

  #fullscreen-content .login-link-actions button {
    height: 28px;
    padding: 0;
  }

  #fullscreen-content .login-link-copy {
    padding-right: 12px;
    padding-left: 12px;
  }

  /* Bottom navigation */
  .mobile-nav-cluster {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--mobile-nav-gap);
    position: fixed;
    bottom: max(var(--mobile-nav-bottom), env(safe-area-inset-bottom));
    left: var(--mobile-nav-side-gap);
    right: var(--mobile-nav-side-gap);
    z-index: 10;
    isolation: isolate;
  }

  .mobile-actions.nav-highlight-transfer-active {
    overflow: visible;
    z-index: 2;
  }

  .mobile-actions.nav-highlight-transfer-active .nav-highlight {
    z-index: 2;
  }

  .mobile-nav-cluster.mobile-nav-transfer-active .mobile-ready-action::before {
    opacity: 0;
  }

  .mobile-actions {
    display: flex;
    justify-content: space-around;
    align-items: center;
    position: relative;
    flex: 0 1 var(--mobile-nav-actions-width);
    min-width: 0;
    width: var(--mobile-nav-actions-width);
    height: var(--mobile-nav-height);
    padding: 0;
    z-index: 0;
    border-radius: var(--mobile-nav-radius);
    isolation: isolate;
    overflow: hidden;
    touch-action: none;
    background: var(--mobile-nav-surface);
    border: 1px solid var(--mobile-nav-border);
    box-shadow: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    --nav-hl-x: 0px;
    --nav-hl-y: 0px;
    --nav-hl-w: 0px;
    --nav-hl-h: calc(100% - 8px);
    --nav-press-scale: 0.95;
  }

  .mobile-ready-action {
    --accent: var(--ready-accent);
    all: unset;
    box-sizing: border-box;
    display: grid;
    place-items: center;
    flex: 0 0 var(--mobile-nav-height);
    width: var(--mobile-nav-height);
    height: var(--mobile-nav-height);
    position: relative;
    z-index: 1;
    color: var(--muted);
    cursor: pointer;
    border-radius: 50%;
    isolation: isolate;
    overflow: hidden;
    touch-action: manipulation;
    background: var(--mobile-nav-surface);
    border: 1px solid var(--mobile-nav-border);
    box-shadow: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    transition: color 0.2s ease, transform 0.1s ease, background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, opacity 0.2s ease;
  }

  .mobile-ready-action::before {
    content: '';
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    background: transparent;
    z-index: 0;
    transition: background 0.2s ease;
  }

  .mobile-ready-action:hover {
    color: var(--text);
  }

  .mobile-ready-action:active:not(:disabled) {
    transform: scale(0.92);
  }

  .mobile-ready-action:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
  }

  .mobile-ready-action:disabled {
    cursor: default;
    opacity: 1;
    color: rgba(170, 177, 188, 0.62);
  }

  .mobile-ready-action svg {
    width: 24px;
    height: 24px;
    position: relative;
    z-index: 1;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .mobile-ready-action .icon-reset {
    display: none;
  }

  .mobile-ready-action.is-ready .icon-ready,
  .mobile-ready-action[data-state="reset"] .icon-ready {
    display: none;
  }

  .mobile-ready-action.is-ready .icon-reset,
  .mobile-ready-action[data-state="reset"] .icon-reset {
    display: block;
  }

  .mobile-ready-action.is-ready,
  .mobile-ready-action[data-state="reset"] {
    background: var(--accent);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.22);
    box-shadow: none;
  }

  .mobile-ready-action.is-ready:hover,
  .mobile-ready-action[data-state="reset"]:hover {
    background: #397d47;
  }

  body.light-mode .mobile-actions,
  body.light-mode .mobile-ready-action {
    background: var(--mobile-nav-surface);
    border-color: var(--mobile-nav-border);
  }

  body.light-mode .mobile-ready-action.is-ready,
  body.light-mode .mobile-ready-action[data-state="reset"] {
    background: var(--accent);
    color: #fff;
  }

  body .mobile-ready-action.is-tab-disabled,
  body .mobile-ready-action.is-tab-disabled:hover {
    background: var(--mobile-nav-surface);
    border-color: var(--mobile-nav-border);
    box-shadow: none;
    color: rgba(170, 177, 188, 0.62);
    cursor: default;
    filter: grayscale(1);
    opacity: 0.52;
  }

  body.mobile-bottom-ui {
    --mobile-nav-bottom: 32px;
  }

  .mobile-actions .nav-highlight {
    position: absolute;
    top: 0;
    left: 0;
    transform: translate3d(var(--nav-hl-x), var(--nav-hl-y), 0);
    width: var(--nav-hl-w);
    height: var(--nav-hl-h, calc(100% - 8px));
    background: rgba(128, 128, 128, 0.25);
    border-radius: calc(var(--nav-hl-h, calc(100% - 8px)) / 2);
    z-index: 0;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), width 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform, width;
  }

  .mobile-actions.nav-highlight-dragging .nav-highlight,
  .mobile-actions:not(.nav-highlight-ready) .nav-highlight {
    transition: none;
  }

  body.light-mode .mobile-actions .nav-highlight {
    background: rgba(128, 128, 128, 0.18);
  }

  .nav-icon-btn {
    all: unset;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    cursor: pointer;
    flex: 1;
    height: 100%;
    position: relative;
    z-index: 1;
    transition: color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
  }

  .nav-icon-btn.active {
    color: var(--text);
  }

  .nav-icon-btn::before {
    content: none;
  }

  .nav-icon-btn:active {
    transform: scale(0.95);
    transition: transform 0.1s ease;
  }

  .nav-icon-btn svg {
    width: 24px;
    height: 24px;
  }

  .nav-icon-btn:disabled {
    cursor: default;
    opacity: 0.65;
  }

  .nav-icon-btn.placeholder {
    pointer-events: none;
  }

  .nav-icon-btn.placeholder::before {
    display: none;
  }

  .nav-icon-btn.placeholder:active {
    transform: none;
  }

  .nav-question {
    font-size: 28px;
    font-weight: 800;
    line-height: 1;
  }

  .nav-label {
    display: none;
  }

  .nav-icon-btn svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  #mobile-home-btn.active svg path {
    fill: currentColor;
  }

  #mobile-home-btn.active svg polyline {
    stroke: var(--bg);
  }

  #mobile-dashboard-btn.active svg rect {
    fill: currentColor;
    stroke: none;
  }

  #mobile-dashboard-btn.active svg line {
    stroke: var(--bg);
  }

  #mobile-settings-btn.active svg path,
  #mobile-settings-btn.active svg circle {
    fill: currentColor;
    stroke: currentColor;
  }

  #mobile-theme-toggle .sun,
  body.light-mode #mobile-theme-toggle .moon {
    display: none;
  }

  body.light-mode #mobile-theme-toggle .sun {
    display: block;
  }

  /* Status stack defaults */
  .notification-area {
    display: none;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 0 var(--mobile-ready-content-gap);
    flex-direction: column;
    max-height: var(--mobile-status-visible-stack-height);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    scroll-snap-type: y mandatory;
    pointer-events: auto;
  }

  .notification-area.has-items {
    display: flex;
  }

  .notification-area::-webkit-scrollbar {
    display: none;
  }

  .notification-item {
    background: var(--mobile-status-card-surface);
    color: var(--text);
    padding: 0 var(--mobile-status-card-padding-inline);
    height: var(--mobile-status-card-height);
    min-height: var(--mobile-status-card-height);
    border-radius: var(--mobile-status-card-radius);
    margin-bottom: var(--mobile-status-card-gap);
    display: flex;
    align-items: center;
    gap: var(--mobile-status-card-content-gap);
    border: none;
    box-shadow: none;
    width: 100%;
    flex-shrink: 0;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    transform: translateX(-100%);
    animation: slideInLeft 0.35s cubic-bezier(0.05, 0.7, 0.1, 1) forwards;
    font-size: 15px;
    font-family: 'Roboto', system-ui, sans-serif;
    pointer-events: auto;
    box-sizing: border-box;
  }

  .notification-item.is-visible-top {
    border-top-left-radius: var(--mobile-status-card-radius);
    border-top-right-radius: var(--mobile-status-card-radius);
  }

  .notification-item.is-visible-bottom {
    border-bottom-left-radius: var(--mobile-status-card-radius);
    border-bottom-right-radius: var(--mobile-status-card-radius);
  }

  .notification-item.no-anim {
    animation: none;
    transform: none;
  }

  .ready-box-status .notification-item.slide-out,
  .notification-item.slide-out {
    animation: slideOutLeft 0.3s cubic-bezier(0.3, 0, 0.8, 0.15) forwards;
  }

  body.light-mode .notification-item {
    background: #ffffff;
    color: #1a1a1a;
  }

  .notification-icon {
    width: 32px;
    height: 32px;
    background: var(--ready-accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  .notification-icon svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: #fff;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .notification-content {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
  }

  .notification-title {
    color: var(--accent);
    -webkit-text-stroke: 1px #fff;
    paint-order: stroke fill;
    text-shadow: 0 0 1px #fff;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.1;
    text-transform: uppercase;
  }

  body.light-mode .notification-title {
    color: var(--accent);
    -webkit-text-stroke: 0;
    text-shadow: none;
  }

  .notification-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
  }
}

@media all {
  :root {
    --mobile-main-inline-gap: 12px;
  }

  #fullscreen-content .participant-editor-section #participants-editor-list .participant-editor-row {
    grid-template-columns: minmax(0, 1fr);
  }

  #fullscreen-content .participant-editor-section .participant-exclusions-field {
    grid-column: 1;
  }

  /* Readybox */
  main,
  #host-view {
    padding-left: var(--mobile-main-inline-gap);
    padding-right: var(--mobile-main-inline-gap);
    padding-bottom: max(104px, calc(104px + env(safe-area-inset-bottom)));
  }

  body.mobile-bottom-ui .ready-box,
  .ready-box {
    width: 100%;
    max-width: none;
    margin: 0 0 4px;
    padding: 0;
    height: calc(var(--mobile-status-visible-stack-height) + var(--mobile-identity-height));
    min-height: calc(var(--mobile-status-visible-stack-height) + var(--mobile-identity-height));
    aspect-ratio: auto;
    box-sizing: border-box;
    display: grid;
    grid-template-rows: var(--mobile-identity-height) var(--mobile-status-visible-stack-height);
    gap: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
    transition: height 0.3s ease, min-height 0.3s ease, grid-template-rows 0.3s ease;
  }

  #host-view #private-login-link {
    width: 100%;
    min-height: 38px;
    margin-bottom: 0;
    padding: 0 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 0;
  }

  #host-view #private-login-link[hidden] { display: none; }

  .ready-identity-box {
    grid-row: 1;
    grid-column: 1;
    width: 100%;
    height: var(--mobile-identity-height);
    min-height: var(--mobile-identity-height);
    max-height: var(--mobile-identity-height);
    box-sizing: border-box;
    padding: 8px;
    border-radius: var(--mobile-ready-radius) var(--mobile-ready-radius) 0 0;
    background: var(--elev);
    overflow: hidden;
    transition: none;
  }

  .ready-identity-box > #ready-box-form,
  .ready-identity-box > #ready-box-result {
    height: 100%;
    min-height: 0;
    max-height: none;
  }

  .ready-box-status {
    grid-row: 2;
    grid-column: 1;
    position: relative;
    height: var(--mobile-status-visible-stack-height);
    min-height: var(--mobile-status-visible-stack-height);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: var(--mobile-status-area-padding);
    border: none;
    border-radius: 0 0 var(--mobile-ready-radius) var(--mobile-ready-radius);
    background: linear-gradient(var(--mobile-status-surface), var(--mobile-status-surface)), var(--elev);
  }

  .ready-box-status .notification-empty-state {
    position: absolute;
    inset: 0;
    display: grid;
    width: 100%;
    height: 100%;
    padding: var(--mobile-status-area-padding);
    place-items: center;
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.25s cubic-bezier(0.2, 0, 0, 1), visibility 0.25s cubic-bezier(0.2, 0, 0, 1);
    pointer-events: none;
    z-index: 1;
  }

  .ready-box-status .notification-empty-state[hidden] {
    display: grid;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }

  .ready-identity-box > .ready-box-content {
    position: relative;
    z-index: 1;
    min-width: 0;
    min-height: var(--mobile-identity-height);
  }

  #participant-dropdown-wrapper {
    width: 100%;
    min-width: 0;
    margin-left: 0;
  }

  #participantButton {
    width: 100%;
    height: var(--mobile-dropdown-height);
    min-height: var(--mobile-dropdown-height);
    max-height: var(--mobile-dropdown-height);
    padding: 0 calc(18px * var(--desktop-scale));
    border: none;
    border-radius: var(--mobile-dropdown-radius);
    background: var(--surface-2);
    font-size: var(--mobile-dropdown-font-size);
    line-height: 1;
    white-space: nowrap;
  }

  #participantButton.open {
    border-radius: var(--mobile-dropdown-open-radius);
  }

  .dd-mask {
    border: none;
    border-radius: var(--mobile-dropdown-menu-radius);
    background: var(--surface-2);
  }

  #participantButton .truncate {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .form-header hr {
    display: none;
  }

  #ready-box-form,
  #ready-box-result {
    grid-row: 1;
    grid-column: 1;
    width: 100%;
    height: var(--mobile-identity-height);
    min-height: var(--mobile-identity-height);
    max-height: var(--mobile-identity-height);
    min-width: 0;
    box-sizing: border-box;
  }

  #ready-box-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    align-content: center;
    align-items: center;
    padding: 0;
  }

  .ready-identity-box #participantButton.participant-identity-pill {
    border-radius: var(--mobile-dropdown-radius);
    background: transparent;
  }

  #ready-box-form .form-header {
    display: none;
  }

  #ready-box-form .central-animation-container {
    grid-column: 1;
    grid-row: 1;
    align-self: center;
    display: block;
    width: 100%;
    height: 48px;
    min-width: 0;
  }

  #ready-box-form #waiting-text {
    display: none;
  }

  #ready-box-form .mobile-ready-pills-container {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    align-items: center;
    align-content: center;
    justify-items: stretch;
    gap: 0;
    height: 48px;
    min-height: 48px;
    max-height: 48px;
    padding: 0;
    border: 0;
    border-radius: 9999px;
    background: var(--ready-identity-track-bg);
    box-sizing: border-box;
    overflow: hidden;
  }

  .ready-identity-box #participantButton.participant-identity-pill {
    height: 100%;
    min-height: 0;
    max-height: none;
    padding: 0 12px;
    border-radius: 9999px;
    background: transparent;
    color: var(--text);
    font-size: 18px;
  }

  .ready-identity-box #participantButton.participant-identity-pill::before,
  .ready-identity-box #participantButton.participant-identity-pill::after {
    display: none;
  }

  .ready-identity-box #participantButton.participant-identity-pill .truncate {
    position: static;
    color: inherit;
    padding: 0;
  }

  #ready-box-form .mobile-ready-pills-container #participant-dropdown-wrapper {
    grid-column: 1;
    grid-row: 1;
    height: 100%;
  }

  #ready-box-form .mobile-ready-pills-container #waiting-text {
    --accent: var(--ready-accent);
    position: relative;
    isolation: isolate;
    grid-column: 2;
    grid-row: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: none;
    margin: 0;
    padding: 0 8px;
    overflow: hidden;
    border: 0;
    border-radius: 9999px;
    background: var(--ready-identity-result-bg);
    color: var(--text);
    font-size: 0;
    line-height: 1;
    opacity: 1;
    pointer-events: auto;
    cursor: default;
    text-align: center;
  }

  #ready-box-form .mobile-ready-pills-container #waiting-text::before {
    content: 'Dein Wichtel';
    position: relative;
    z-index: 2;
    color: var(--text);
    font-size: 16px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
  }

  #ready-box-form .mobile-ready-pills-container #waiting-text::after {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    z-index: 1;
    width: 100%;
    background: var(--ready-identity-fill-bg);
    clip-path: inset(0 calc(100% - var(--fill-width, 0%)) 0 0);
    transition: clip-path 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
    pointer-events: none;
  }

  #ready-box-form #readyBtn {
    display: none;
  }

  #ready-box-form.ready-state .form-header h2 {
    max-width: calc(var(--app-width) * 0.34);
  }

  /* The optimistic Ready transition must never hide the identity pill while
     the server request is still in flight. */
  #ready-box-form.ready-state .mobile-ready-pills-container #participant-dropdown-wrapper,
  #ready-box-result:not(.hidden) .result-mobile-identity #participant-dropdown-wrapper {
    opacity: 1;
    visibility: visible;
  }

  .ready-box-status .notification-area {
    position: relative;
    z-index: 2;
    width: 100%;
    height: calc(var(--mobile-status-visible-stack-height) - var(--mobile-status-area-padding) * 2);
    flex: 0 0 auto;
    max-height: calc(var(--mobile-status-visible-stack-height) - var(--mobile-status-area-padding) * 2);
    margin: 0;
    padding: 0;
    display: none;
    gap: 0;
    overflow-y: auto;
    overflow-x: hidden;
    border-radius: var(--mobile-status-card-radius);
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .ready-box-status .notification-area.has-items {
    display: flex;
    flex-direction: column;
  }

  .ready-box-status .notification-area::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
  }

  .ready-box-status .notification-item {
    width: 100%;
    height: var(--mobile-status-card-height);
    min-height: var(--mobile-status-card-height);
    margin: 0;
    padding: 0 var(--mobile-status-card-padding-inline);
    gap: var(--mobile-status-card-content-gap);
    border: none;
    border-radius: 0;
    border-top: 0;
    border-bottom: 0;
    background: var(--mobile-status-card-surface);
    box-shadow: none;
    transform: translateX(-100%);
  }

  /* Existing notifications on reload must be visible immediately. The
     mobile item rule above otherwise overrides the shared no-animation state. */
  .ready-box-status .notification-item.no-anim {
    transform: none;
  }

  .ready-box-status .notification-item:last-child {
    margin-bottom: 0;
  }

  .ready-box-status .notification-item:not(:first-child) {
    border-top: 1px solid var(--mobile-status-divider);
  }

  .ready-box-status .notification-item.is-visible-top {
    border-top-left-radius: var(--mobile-status-card-radius);
    border-top-right-radius: var(--mobile-status-card-radius);
  }

  .ready-box-status .notification-item.is-visible-bottom {
    border-bottom-left-radius: var(--mobile-status-card-radius);
    border-bottom-right-radius: var(--mobile-status-card-radius);
  }

  #participantButton.is-selection-locked,
  #participantButton:disabled {
    opacity: 1;
    color: var(--muted);
    background: var(--surface-3);
    cursor: default;
  }

  .ready-box-status .notification-icon {
    width: 30px;
    height: 30px;
  }

  .ready-box-status .notification-icon svg {
    width: 17px;
    height: 17px;
  }

  .ready-box-status .notification-content {
    min-width: 0;
    gap: 2px;
    justify-content: center;
    text-align: left;
  }

  .ready-box-status .notification-title {
    color: var(--ready-accent);
    -webkit-text-stroke: 0;
    text-shadow: none;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.3px;
  }

  .ready-box-status .notification-text {
    overflow: hidden;
    font-size: 15px;
    font-weight: 600;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #ready-box-result .form-header h2 {
    font-size: clamp(14px, 4vw, 18px);
    text-align: left;
  }

  .ready-identity-box > #ready-box-result:not(.hidden) {
    height: 100%;
    min-height: 0;
    max-height: none;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    align-items: center;
    gap: 0;
    padding: 0;
    border: 0;
    border-radius: 9999px;
    background: var(--ready-identity-track-bg);
    box-sizing: border-box;
    overflow: hidden;
  }

  #ready-box-result:not(.hidden) .result-desktop-header {
    display: none;
  }

  #ready-box-result:not(.hidden) > .result-mobile-identity {
    display: block;
    grid-row: 1;
    grid-column: 1;
    align-self: center;
    min-width: 0;
    height: 100%;
  }

  #ready-box-result:not(.hidden) .result-mobile-identity #participant-dropdown-wrapper {
    height: 100%;
  }

  #ready-box-result:not(.hidden) .result-container {
    --accent: var(--ready-accent);
    position: relative;
    isolation: isolate;
    grid-row: 1;
    grid-column: 2;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    align-content: center;
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: none;
    margin: 0;
    overflow: hidden;
    border: 0;
    border-radius: 9999px;
    background: var(--ready-identity-result-bg);
    text-align: center;
  }

  #ready-box-result:not(.hidden) .result-container::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    z-index: 0;
    width: var(--fill-width, 0%);
    background: var(--ready-identity-fill-bg);
    transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  #ready-box-result:not(.hidden) .result-headline {
    display: none;
  }

  #ready-box-result:not(.hidden) .result-slot {
    width: 100%;
    min-width: 0;
    min-height: 0;
    height: 100%;
    margin-top: 0;
    z-index: 1;
  }

  #ready-box-result:not(.hidden) #reveal-button {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 0;
    max-height: none;
    padding-top: 0;
    padding-bottom: 0;
    border: 0;
    border-radius: 9999px;
    background: transparent;
    font-family: inherit;
    font-size: 0;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
  }

  /* The reveal control remains clickable so the result can be hidden again. */
  #ready-box-result:not(.hidden) #result-container.revealed #reveal-button {
    opacity: 1;
    pointer-events: auto;
  }

  #ready-box-result:not(.hidden) #reveal-button::before {
    content: 'Dein Wichtel';
    color: var(--text);
    display: block;
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    line-height: 1;
    opacity: 1;
    transition: opacity 0.3s ease;
  }

  #ready-box-result:not(.hidden) #result-container.revealed #reveal-button::before {
    content: 'Dein Wichtel';
    opacity: 0;
  }

  #ready-box-result:not(.hidden) #result-name {
    display: block;
    max-width: 100%;
    overflow: hidden;
    color: var(--text);
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media all {
  /* Inline instructions */
  .inline-rules {
    display: block;
    width: 100%;
    max-width: none;
    grid-template-rows: 30px auto;
    row-gap: var(--mobile-instructions-heading-gap);
    margin: var(--mobile-instructions-margin-top) 0 var(--mobile-instructions-margin-bottom);
    padding: var(--mobile-instructions-padding-top) var(--mobile-instructions-padding-inline) var(--mobile-instructions-padding-bottom);
    border-radius: var(--mobile-instructions-radius);
    background: var(--surface-1);
    text-align: left;
  }

  .inline-rules > summary {
    display: flex;
    align-items: center;
    height: 24px;
    list-style: none;
    cursor: pointer;
  }

  .inline-rules > summary::-webkit-details-marker {
    display: none;
  }

  .inline-rules:not([open]) {
    height: 40px;
    padding: 8px;
  }

  .inline-rules:not([open]) > summary {
    height: 24px;
  }

  .inline-rules h2 {
    line-height: 1.15;
  }

  .inline-rules[open] > .rules-list {
    margin-top: var(--mobile-instructions-heading-gap);
  }

  .ready-box:has(+ .inline-rules:not([hidden])) {
    margin-bottom: 0;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }

  .ready-box:has(+ .inline-rules:not([hidden])) .ready-box-status {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }

  .ready-box + .inline-rules:not([hidden]) {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
  }

  .inline-rules.inline-rules[hidden] {
    display: none;
  }

  .inline-rules h2 {
    margin: 0;
    color: var(--text);
    font-size: var(--mobile-instructions-title-size);
    font-weight: 700;
    line-height: 1.15;
    text-align: left;
  }

  .inline-rules .rules-list {
    margin: 0;
    padding: 0;
    min-height: 0;
    overflow: visible;
    gap: var(--mobile-instructions-item-gap);
    justify-content: flex-start;
    align-self: start;
    height: max-content;
    max-height: none;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .inline-rules .rules-list::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
  }

  .inline-rules .rules-list li,
  .inline-rules .rules-list.rules-list-plain li {
    display: block;
    width: 100%;
    min-height: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    color: var(--text);
    font-size: var(--mobile-instructions-text-size);
    line-height: var(--mobile-instructions-line-height);
    text-align: left;
    white-space: nowrap;
  }
}

/* Mobile Dashboard: Material 3 inspired, compact and viewport-bound. */
@media all {
  body.mobile-dialog-active.history-view #fullscreen-content {
    gap: 6px;
  }

  #fullscreen-content .dashboard-mobile-card {
    display: flex;
    flex: 0 1 auto;
    min-height: 0;
    max-height: 100%;
    flex-direction: column;
    gap: 8px;
    padding: 12px 12px 0;
    overflow: hidden;
    background: var(--surface-1);
    box-sizing: border-box;
  }

  #fullscreen-content #dashboard-year-row-mobile {
    display: flex;
    flex: 0 0 40px;
    min-width: 0;
    align-items: center;
    justify-content: flex-start;
    margin: 0;
    overflow: hidden;
  }

  #fullscreen-content #dashboard-year-row-mobile .dashboard-year-wheel {
    display: flex;
    width: 100%;
    max-width: 100%;
    height: 40px;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0;
    padding: 3px;
    overflow-x: auto;
    overflow-y: hidden;
    border: 1px solid var(--ring);
    border-radius: 9999px;
    background: rgba(var(--elev-rgb), 0.18);
    box-sizing: border-box;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 3px;
    touch-action: pan-x pan-y;
    user-select: none;
    -webkit-user-select: none;
  }

  #fullscreen-content #dashboard-year-row-mobile .dashboard-year-wheel::-webkit-scrollbar {
    display: none;
  }

  #fullscreen-content #dashboard-year-row-mobile .dashboard-year-wheel-item {
    flex: 0 0 calc(100% / var(--year-visible-count, 1));
    width: calc(100% / var(--year-visible-count, 1));
    height: 32px;
    min-height: 32px;
    padding: 0;
    border: none;
    border-radius: 9999px;
    color: var(--muted);
    background: transparent;
    box-shadow: none;
    font-size: 16px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  #fullscreen-content #dashboard-year-row-mobile .dashboard-year-wheel-label {
    display: grid;
    width: 100%;
    height: 100%;
    place-items: center;
    line-height: 1;
    text-align: center;
  }

  #fullscreen-content #dashboard-year-row-mobile .dashboard-year-wheel-item.active {
    color: var(--text);
    background: var(--surface-3);
    font-size: 18px;
    font-weight: 700;
  }

  #fullscreen-content #dashboard-year-row-mobile .dashboard-year-wheel-item.active .dashboard-year-wheel-label {
    transform: translateY(1px);
  }

  #fullscreen-content #dashboard-year-row-mobile .dashboard-year-wheel-item:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
  }

  #fullscreen-content #dashboard-section-mobile {
    display: flex;
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
    width: calc(100% + 24px);
    margin-right: -12px;
    margin-left: -12px;
    gap: 0;
    overflow: hidden;
    background: var(--surface-1);
    box-sizing: border-box;
  }

  #fullscreen-content #dashboard-list-mobile,
  #fullscreen-content .dashboard-year-panel {
    display: flex;
    flex: 1 1 auto;
    width: 100%;
    height: auto;
    max-height: 100%;
    min-height: 0;
    overflow: hidden;
    box-sizing: border-box;
  }

  #fullscreen-content #dashboard-list-mobile {
    gap: 0;
  }

  #fullscreen-content .dashboard-year-panel {
    gap: 6px;
    padding: 0 12px;
    overflow: visible;
  }

  #fullscreen-content .dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    flex: 0 0 36px;
    gap: 6px;
  }

  #fullscreen-content .dashboard-card {
    display: flex;
    flex-direction: row;
    min-width: 0;
    height: 36px;
    min-height: 36px;
    max-height: 36px;
    padding: 0 10px;
    align-items: center;
    justify-content: center;
    gap: 6px;
    overflow: hidden;
    border: none;
    border-radius: 18px;
    background: var(--surface-2);
    box-shadow: none;
    text-align: center;
  }

  body.light-mode #fullscreen-content .dashboard-card {
    background: var(--surface-2);
    box-shadow: none;
  }

  #fullscreen-content .dashboard-card-title,
  #fullscreen-content .dashboard-card-value {
    display: block;
    width: auto;
    min-width: 0;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 20px;
    text-align: center;
    transform: translateY(-0.75px);
  }

  #fullscreen-content .dashboard-card-title {
    flex: 0 1 auto;
    color: var(--muted);
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
  }

  #fullscreen-content .dashboard-card-value {
    flex: 0 1 auto;
    max-width: 50%;
    color: var(--text);
    font-size: 16px;
    font-weight: 700;
  }

  #fullscreen-content .dashboard-card-sub {
    display: none;
  }

  #fullscreen-content .dashboard-history-slot {
    display: flex;
    flex: 0 1 auto;
    width: calc(100% + 24px);
    height: auto;
    max-height: calc(100% - 42px);
    min-height: 0;
    margin-right: -12px;
    margin-left: -12px;
    align-self: stretch;
    overflow: visible;
  }

  #fullscreen-content .history-box-single {
    display: flex;
    flex: 0 1 auto;
    width: 100%;
    min-width: 0;
    height: auto;
    max-height: 100%;
    min-height: 0;
    padding: 0;
    gap: 0;
    align-self: stretch;
    overflow: hidden;
    border: none;
    border-radius: 0 0 var(--mobile-ready-radius) var(--mobile-ready-radius);
    background: linear-gradient(var(--mobile-status-surface), var(--mobile-status-surface)), var(--elev);
    box-shadow: none;
    box-sizing: border-box;
  }

  body.light-mode #fullscreen-content .history-box-single {
    background: linear-gradient(var(--mobile-status-surface), var(--mobile-status-surface)), var(--elev);
    box-shadow: none;
  }

  #fullscreen-content .history-box-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 16px minmax(0, 1fr);
    flex: 0 0 48px;
    min-height: 48px;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    border-bottom: 1px solid var(--mobile-status-divider);
  }

  #fullscreen-content .history-box-title {
    color: var(--muted);
    font-size: 20px;
    font-weight: 700;
    line-height: 28px;
    letter-spacing: 0;
  }

  #fullscreen-content .history-box-spacer {
    display: block;
    width: 16px;
    height: 1px;
  }

  #fullscreen-content .history-pairings {
    display: flex;
    flex: 0 1 auto;
    height: auto;
    min-height: 0;
    gap: 0;
    padding: 0;
    overflow-x: hidden;
    overflow-y: auto;
    border-radius: 0;
    background: transparent;
    scrollbar-width: none;
  }

  #fullscreen-content .history-pairings::-webkit-scrollbar {
    display: none;
  }

  #fullscreen-content .history-pair-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 16px minmax(0, 1fr);
    flex: 0 0 42px;
    height: 42px;
    min-height: 42px;
    max-height: 42px;
    padding: 0 12px;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  #fullscreen-content .history-pair-row + .history-pair-row {
    border-top: 1px solid var(--mobile-status-divider);
  }

  #fullscreen-content .history-name {
    min-width: 0;
    color: var(--text);
    font-size: 16px;
    font-weight: 600;
    line-height: 22px;
  }

  #fullscreen-content .history-arrow {
    display: block;
    width: 16px;
    height: 16px;
    color: var(--muted);
    stroke: currentColor;
    opacity: 0.64;
  }

  #fullscreen-content .history-pair-row:first-child,
  #fullscreen-content .history-pair-row:last-child {
    border-radius: 0;
  }

  #fullscreen-content .history-notice {
    flex: 1 1 0;
    min-height: 0;
    padding: 18px 16px;
    border: none;
    border-radius: 18px;
    background: var(--surface-2);
    box-shadow: none;
  }
}


@keyframes slideInLeft {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}

@keyframes slideOutLeft {
  from { transform: translateX(0); }
  to { transform: translateX(-100%); }
}

/* iOS Safari already positions fixed content above its bottom browser controls. */
@supports (-webkit-touch-callout: none) {
  @media (max-width: 1024px) and (display-mode: browser) {
    body,
    body.mobile-bottom-ui {
      --mobile-nav-bottom: 8px;
    }

    .mobile-nav-cluster {
      bottom: 8px;
    }
  }
}
/* One shared interface; only its surrounding viewport changes on desktop. */
body {
  width: 100%;
  max-width: none;
  min-height: 100dvh;
  margin: 0;
}

#app-viewport {
  width: 100%;
  max-width: var(--app-max-width);
  min-height: 100dvh;
  margin-inline: auto;
  background: var(--bg);
}

main,
#host-view {
  width: 100%;
  max-width: none;
}

body.mobile-dialog-active #fullscreen-content,
.dialog-overlay.mobile-fullscreen {
  left: max(0px, calc((100% - var(--app-max-width)) / 2));
  right: max(0px, calc((100% - var(--app-max-width)) / 2));
}

.mobile-nav-cluster {
  left: max(var(--mobile-nav-side-gap), calc((100% - var(--app-max-width)) / 2 + var(--mobile-nav-side-gap)));
  right: max(var(--mobile-nav-side-gap), calc((100% - var(--app-max-width)) / 2 + var(--mobile-nav-side-gap)));
}

#mobile-progress {
  width: auto;
  left: max(var(--mobile-progress-inline-gap), calc((100% - var(--app-max-width)) / 2 + var(--mobile-progress-inline-gap)));
  right: max(var(--mobile-progress-inline-gap), calc((100% - var(--app-max-width)) / 2 + var(--mobile-progress-inline-gap)));
}

#rules-side-panel {
  width: min(95%, calc(var(--app-max-width) * 0.95));
}

#history-side-panel,
#edit-participants-side-panel,
#edit-rules-side-panel,
#test-draw-side-panel {
  left: max(0px, calc((100% - var(--app-max-width)) / 2));
  width: min(100%, var(--app-max-width));
}

@media (min-width: 768px) {
  :root {
    --app-max-width: 487px;
  }

  body {
    overflow: hidden;
    background: #15181d;
  }

  body.light-mode {
    background: #e4ded5;
  }

  #app-viewport {
    --app-layout-height: 909px;
    position: fixed;
    top: 50%;
    left: 50%;
    width: var(--app-max-width);
    max-width: none;
    height: var(--app-layout-height);
    min-height: 0;
    transform: translate(-50%, -50%) scale(var(--app-frame-scale, 1));
    transform-origin: center;
    contain: layout paint;
    overflow: hidden;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.18);
  }

  #app {
    height: 100%;
  }

  main {
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: none;
  }

  main::-webkit-scrollbar {
    display: none;
  }

  body.mobile-dialog-active #fullscreen-content,
  .dialog-overlay.mobile-fullscreen {
    left: 0;
    right: 0;
  }

  .mobile-nav-cluster {
    left: var(--mobile-nav-side-gap);
    right: var(--mobile-nav-side-gap);
  }

  #mobile-progress {
    left: var(--mobile-progress-inline-gap);
    right: var(--mobile-progress-inline-gap);
  }

  #history-side-panel,
  #edit-participants-side-panel,
  #edit-rules-side-panel,
  #test-draw-side-panel {
    left: 0;
    width: 100%;
  }

  #login-side-panel {
    width: min(420px, calc(100% - 32px));
  }

  .toast-notification {
    max-width: calc(100% - 24px);
  }
}
