:root {
  color-scheme: dark;
  font-family: "Outfit", Arial, Helvetica, sans-serif;
  background: #17120d;
  --panel-bg: rgba(20, 15, 10, 0.47);
  --panel-bg-strong: rgba(20, 15, 10, 0.62);
  --panel-border: rgba(255,255,255,0.17);
  --text-main: rgba(255,255,255,0.94);
  --text-soft: rgba(255,255,255,0.70);
  --text-faint: rgba(255,255,255,0.48);
  --accent: rgba(255,255,255,0.15);
  --accent-strong: rgba(255,255,255,0.23);
  --shadow: 0 14px 42px rgba(0,0,0,0.18);
}

* { box-sizing: border-box; }
html, body, #app { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body {
  background: #17120d;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
#app { position: relative; isolation: isolate; }
#scene { display: block; width: 100%; height: 100%; outline: none; }

.topbar,
.panel,
.hint,
.view-status,
.light-angle-panel {
  position: absolute;
  z-index: 4;
}

.brand-card,
.panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(11px);
  -webkit-backdrop-filter: blur(11px);
  box-shadow: var(--shadow);
}

/* 04.2: top bar carries only identity + phase. */
.topbar {
  top: max(11px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
}
.brand-card {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 7px 9px 7px 13px;
  border-radius: 999px;
  color: var(--text-main);
  white-space: nowrap;
}
.brand-title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.15em;
}
.brand-separator,
.control-divider {
  width: 1px;
  background: rgba(255,255,255,0.13);
}
.brand-separator { height: 15px; }
.phase-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.10em;
}
.phase-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,0.72);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.08);
}
.version-pill {
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 999px;
  padding: 5px 8px 4px;
  font-size: 10px;
  letter-spacing: 0.10em;
  color: var(--text-soft);
  background: rgba(255,255,255,0.06);
}

/* Players replace the old technical status list. In the prototype, selecting a
   stone temporarily marks its side as active; no real turn logic is implied yet. */
.player-panel {
  left: max(12px, env(safe-area-inset-left));
  top: 50%;
  transform: translateY(-50%);
  width: 214px;
  padding: 9px;
  border-radius: 20px;
  pointer-events: none;
}
.player-row {
  display: grid;
  grid-template-columns: 34px minmax(0,1fr) auto;
  align-items: center;
  gap: 9px;
  min-height: 52px;
  padding: 8px 9px;
  border-radius: 15px;
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
  border: 1px solid transparent;
}
.player-row + .player-row { margin-top: 5px; }
.player-row.active {
  background: rgba(255,255,255,0.09);
  border-color: rgba(255,255,255,0.14);
  transform: translateX(2px);
}
.player-stone {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  box-shadow: inset 0 1px 2px rgba(255,255,255,.25), 0 5px 12px rgba(0,0,0,.22);
}
.player-stone-light {
  background: radial-gradient(circle at 38% 32%, #fffdf8 0 18%, #dfd8ce 55%, #b7afa6 100%);
  border: 1px solid rgba(255,255,255,.48);
}
.player-stone-dark {
  background: radial-gradient(circle at 38% 32%, #6d4b35 0 10%, #2a1a13 52%, #100b08 100%);
  border: 1px solid rgba(255,255,255,.14);
}
.player-copy { min-width: 0; }
.player-name {
  display: block;
  color: var(--text-main);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
}
.player-meta {
  display: block;
  margin-top: 3px;
  color: var(--text-faint);
  font-size: 10px;
}
.player-state {
  color: var(--text-faint);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.player-row.active .player-state { color: var(--text-main); }
.selection-strip {
  margin-top: 8px;
  padding: 9px 9px 7px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.selection-label {
  display: block;
  margin-bottom: 4px;
  color: var(--text-faint);
  font-size: 9px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}
.selection-strip strong {
  display: block;
  color: var(--text-main);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.selection-strip strong:empty {
  display: none;
}

.status-context {
  display: block;
  margin-bottom: 5px;
  color: rgba(255,255,255,.88);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
}
.hint-hidden {
  display: none !important;
}

/* Main dock: restart is primary; camera + skins are clearly tools. */
.panel-controls {
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom) + 5px);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  width: max-content;
  max-width: calc(100vw - 24px);
  padding: 8px 10px;
  border-radius: 999px;
  background: var(--panel-bg-strong);
  pointer-events: auto;
}
.primary-actions,
.view-actions,
.tool-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.control-label {
  padding: 0 3px;
  color: var(--text-faint);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.control-divider { height: 26px; }
button {
  appearance: none;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 999px;
  padding: 8px 11px 7px;
  min-width: 68px;
  background: rgba(255,255,255,0.05);
  color: var(--text-soft);
  font: inherit;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: transform .16s ease, background .16s ease, color .16s ease, border-color .16s ease, opacity .16s ease;
}
button:hover,
button.active {
  background: var(--accent-strong);
  color: #fff;
  border-color: rgba(255,255,255,0.25);
}
button:active { transform: scale(.97); }
button:disabled { opacity: .52; cursor: wait; }
.btn-primary {
  background: rgba(255,255,255,0.13);
  color: var(--text-main);
  min-width: 91px;
}
.btn-tool {
  background: rgba(255,255,255,0.025);
  color: rgba(255,255,255,0.56);
  border-color: rgba(255,255,255,0.11);
}
#free-camera { min-width: 62px; }
#skin-cycle { min-width: 112px; }
#light-cycle { min-width: 118px; }
#light-angle-toggle { min-width: 78px; }

.hint {
  left: 50%;
  bottom: calc(max(73px, env(safe-area-inset-bottom) + 68px));
  transform: translateX(-50%);
  width: min(84vw, 520px);
  text-align: center;
  color: rgba(255,255,255,0.76);
  font-size: 11px;
  line-height: 1.35;
  text-shadow: 0 1px 6px rgba(0,0,0,.55);
  pointer-events: none;
}
.view-status {
  right: max(14px, env(safe-area-inset-right));
  bottom: calc(max(68px, env(safe-area-inset-bottom) + 63px));
  color: rgba(255,255,255,0.43);
  font-size: 9px;
  line-height: 1.3;
  text-align: right;
  pointer-events: none;
}
.view-status-sep { padding: 0 4px; opacity: .55; }

#loading {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  background: #17120d;
  color: rgba(255,255,255,.75);
  font-size: 13px;
  letter-spacing: .08em;
  transition: opacity .5s ease, visibility .5s ease;
}
#loading.done { opacity: 0; visibility: hidden; }


/* 04.2.2.2: Lichtwinkel-Popover. In 04.2.2 fehlten diese Basiseigenschaften,
   daher reagierte der Button zwar in JS, das Panel blieb aber unsichtbar. */
.light-angle-panel {
  right: max(16px, env(safe-area-inset-right));
  bottom: calc(max(72px, env(safe-area-inset-bottom) + 67px));
  width: 204px;
  padding: 12px;
  border-radius: 20px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(10px) scale(.97);
  transform-origin: bottom right;
  transition: opacity .18s ease, transform .18s ease, visibility .18s ease;
}
.light-angle-panel.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}
.light-angle-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--text-soft);
  font-size: 10px;
  letter-spacing: .10em;
  text-transform: uppercase;
}
.light-angle-head strong {
  color: var(--text-main);
  font-size: 10px;
  letter-spacing: .04em;
  text-transform: none;
}
.light-dial {
  position: relative;
  width: 154px;
  height: 154px;
  margin: 0 auto;
  border-radius: 50%;
  touch-action: none;
  cursor: crosshair;
}
.dial-ring {
  position: absolute;
  inset: 15px;
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.035) 0 48%, rgba(255,255,255,.075) 49% 50%, transparent 51%);
  box-shadow: inset 0 0 24px rgba(0,0,0,.16);
}
.dial-cross {
  position: absolute;
  left: 50%;
  top: 50%;
  background: rgba(255,255,255,.09);
  pointer-events: none;
}
.dial-cross-h { width: 118px; height: 1px; transform: translate(-50%,-50%); }
.dial-cross-v { width: 1px; height: 118px; transform: translate(-50%,-50%); }
.dial-label {
  position: absolute;
  color: rgba(255,255,255,.38);
  font-size: 8px;
  font-weight: 700;
  pointer-events: none;
}
.dial-label-n { top: 2px; left: 50%; transform: translateX(-50%); }
.dial-label-s { bottom: 2px; left: 50%; transform: translateX(-50%); }
.dial-label-w { left: 3px; top: 50%; transform: translateY(-50%); }
.dial-label-e { right: 3px; top: 50%; transform: translateY(-50%); }
.light-handle {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 30px;
  height: 30px;
  min-width: 0;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255,226,170,.92);
  border: 1px solid rgba(255,255,255,.72);
  color: #5b3517;
  font-size: 15px;
  line-height: 1;
  box-shadow: 0 5px 14px rgba(0,0,0,.30), 0 0 18px rgba(255,205,125,.20);
  transform: translate(-50%,-50%);
  pointer-events: none;
}
.light-angle-actions {
  display: flex;
  justify-content: center;
  gap: 7px;
  margin-top: 9px;
}
.light-angle-actions button {
  min-width: 72px;
  padding: 7px 10px 6px;
  font-size: 9px;
}
.light-angle-panel .microcopy {
  margin-top: 8px;
  color: var(--text-faint);
  text-align: center;
  font-size: 9px;
  line-height: 1.35;
}

@media (max-width: 960px) {
  .player-panel {
    top: max(60px, calc(env(safe-area-inset-top) + 55px));
    transform: none;
  }
  .panel-controls {
    width: min(94vw, 760px);
    border-radius: 20px;
    justify-content: center;
    flex-wrap: wrap;
  }
  .view-status { display: none; }
  .hint { bottom: calc(max(91px, env(safe-area-inset-bottom) + 87px)); }
}

@media (max-width: 680px) {
  .light-angle-panel {
    right: 50%;
    top: auto;
    bottom: calc(max(164px, env(safe-area-inset-bottom) + 160px));
    transform: translateX(50%) translateY(10px) scale(.97);
    transform-origin: bottom center;
  }
  .light-angle-panel.open { transform: translateX(50%) translateY(0) scale(1); }
  .topbar { top: max(8px, env(safe-area-inset-top)); }
  .brand-card { min-height: 34px; padding: 6px 8px 6px 11px; }
  .brand-separator { display: none; }

  .player-panel {
    top: max(50px, calc(env(safe-area-inset-top) + 44px));
    left: 50%;
    transform: translateX(-50%);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    width: min(94vw, 470px);
    padding: 6px;
    border-radius: 16px;
  }
  .player-row,
  .player-row + .player-row {
    margin: 0;
    min-height: 44px;
    padding: 6px 7px;
    grid-template-columns: 27px minmax(0,1fr);
  }
  .player-row.active { transform: none; }
  .player-state { display: none; }
  .player-stone { width: 24px; height: 24px; }
  .player-name { font-size: 10px; }
  .player-meta { font-size: 9px; }
  .selection-strip {
    grid-column: 1 / -1;
    margin-top: 0;
    padding: 5px 8px 3px;
    text-align: center;
  }
  .selection-label { display: none; }
  .selection-strip strong { font-size: 10px; }

  .panel-controls {
    width: min(96vw, 520px);
    bottom: max(8px, env(safe-area-inset-bottom) + 3px);
    gap: 6px;
    padding: 8px;
  }
  .primary-actions,
  .view-actions,
  .tool-actions {
    flex: 1 1 100%;
    justify-content: center;
    gap: 5px;
  }
  .control-divider { display: none; }
  .control-label { width: 46px; text-align: right; }
  button { min-width: 0; padding: 8px 9px 7px; font-size: 9px; }
  .view-actions button { flex: 1 1 0; }
  .tool-actions button { flex: 0 1 115px; }
  #light-cycle { flex-basis: 128px; }
  #light-angle-toggle { flex-basis: 105px; }
  .primary-actions .btn-primary { flex: 0 1 130px; }
  .hint {
    bottom: calc(max(135px, env(safe-area-inset-bottom) + 131px));
    width: min(90vw, 440px);
    font-size: 10px;
  }
}

@media (max-width: 430px) {
  .phase-badge { font-size: 9px; }
  .brand-title { font-size: 11px; }
  .control-label { display: none; }
  .tool-actions button { flex: 1 1 0; }
}

/* --------------------------------------------------------------------------
   04.3.1 – AMBIENTE UI
   -------------------------------------------------------------------------- */
.panel-controls {
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom) + 5px);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px;
  border-radius: 999px;
  width: auto;
}
.panel-controls .btn-primary { min-width: 104px; }
.ambiente-toggle.active { background: rgba(255,255,255,.23); color: #fff; }

.ambiente-panel {
  right: max(16px, env(safe-area-inset-right));
  top: 50%;
  width: 272px;
  padding: 14px;
  border-radius: 24px;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-48%) translateX(14px) scale(.98);
  transition: opacity .18s ease, transform .18s ease, visibility .18s ease;
}
.ambiente-panel.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(-50%) translateX(0) scale(1);
}
.ambiente-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 2px 11px;
  border-bottom: 1px solid rgba(255,255,255,.09);
}
.ambiente-head strong {
  display: block;
  margin-top: 2px;
  color: var(--text-main);
  font-size: 13px;
  letter-spacing: .15em;
}
.ambiente-kicker {
  display: block;
  color: var(--text-faint);
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: .15em;
}
.icon-button {
  width: 28px;
  height: 28px;
  min-width: 28px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 18px;
  line-height: 1;
}
.ambiente-row {
  min-height: 47px;
  border-bottom: 1px solid rgba(255,255,255,.065);
}
.ambiente-buttons {
  display: grid;
  grid-template-columns: 62px minmax(0,1fr) auto;
  align-items: center;
  gap: 7px;
}
.ambiente-label {
  color: var(--text-faint);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .13em;
}
.ambiente-value {
  justify-self: stretch;
  min-width: 0;
  color: var(--text-main);
  background: rgba(255,255,255,.075);
}
.ambiente-mini {
  min-width: 58px;
  padding-inline: 8px;
  font-size: 8px;
}
.ambiente-muted-row { opacity: .46; }

.view-control-row {
  min-height: 118px;
  display: grid;
  grid-template-columns: 1fr 74px;
  align-items: center;
  gap: 10px;
}
.ambiente-copy strong {
  display: block;
  margin-top: 4px;
  color: var(--text-main);
  font-size: 11px;
  letter-spacing: .08em;
}
.ambiente-copy small {
  display: block;
  margin-top: 4px;
  color: var(--text-faint);
  font-size: 8px;
}
.view-slider-wrap {
  height: 105px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  justify-items: center;
  align-items: center;
  gap: 4px;
}
.view-slider-caption {
  color: rgba(255,255,255,.37);
  font-size: 7px;
  letter-spacing: .08em;
}
.view-slider {
  width: 86px;
  height: 24px;
  margin: 0;
  transform: rotate(-90deg);
  accent-color: rgba(255,255,255,.88);
  cursor: ns-resize;
  touch-action: none;
}

.preset-row {
  min-height: 70px;
  display: grid;
  grid-template-columns: 82px 1fr;
  align-items: center;
  gap: 8px;
}
.preset-controls {
  display: grid;
  grid-template-columns: repeat(3, 32px);
  gap: 5px;
  justify-content: end;
}
.preset-slot {
  min-width: 32px;
  width: 32px;
  padding-inline: 0;
}
.preset-save {
  grid-column: 1 / -1;
  width: 100%;
  min-width: 0;
  font-size: 8px;
  padding: 6px 8px;
}
.ambiente-dev {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  color: rgba(255,255,255,.28);
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: .12em;
}

.light-angle-panel {
  right: calc(max(16px, env(safe-area-inset-right)) + 288px);
  bottom: auto;
  top: 50%;
  transform: translateY(-48%) translateX(10px) scale(.97);
  transform-origin: center right;
}
.light-angle-panel.open { transform: translateY(-50%) translateX(0) scale(1); }

.hint { bottom: calc(max(69px, env(safe-area-inset-bottom) + 64px)); }
.view-status { bottom: calc(max(62px, env(safe-area-inset-bottom) + 57px)); }

@media (max-width: 960px) {
  .ambiente-panel {
    top: auto;
    bottom: calc(max(70px, env(safe-area-inset-bottom) + 65px));
    transform: translateY(12px) translateX(14px) scale(.98);
  }
  .ambiente-panel.open { transform: translateY(0) translateX(0) scale(1); }
  .light-angle-panel {
    top: auto;
    bottom: calc(max(70px, env(safe-area-inset-bottom) + 65px));
    right: calc(max(16px, env(safe-area-inset-right)) + 288px);
    transform: translateY(10px) scale(.97);
  }
  .light-angle-panel.open { transform: translateY(0) scale(1); }
  .panel-controls { width: auto; flex-wrap: nowrap; border-radius: 999px; }
  .hint { bottom: calc(max(70px, env(safe-area-inset-bottom) + 65px)); }
}

@media (max-width: 680px) {
  .ambiente-panel {
    right: 50%;
    bottom: calc(max(69px, env(safe-area-inset-bottom) + 64px));
    width: min(92vw, 360px);
    transform: translateX(50%) translateY(12px) scale(.98);
  }
  .ambiente-panel.open { transform: translateX(50%) translateY(0) scale(1); }
  .light-angle-panel {
    right: 50%;
    bottom: calc(max(344px, env(safe-area-inset-bottom) + 338px));
    transform: translateX(50%) translateY(10px) scale(.97);
  }
  .light-angle-panel.open { transform: translateX(50%) translateY(0) scale(1); }
  .panel-controls {
    width: auto;
    bottom: max(8px, env(safe-area-inset-bottom) + 3px);
    padding: 7px;
  }
  .panel-controls .btn-primary { min-width: 116px; }
  .hint { bottom: calc(max(59px, env(safe-area-inset-bottom) + 54px)); }
  .view-status { display: none; }
}


/* --------------------------------------------------------------------------
   04.3.1.1 – Responsive Ambiente Drawer / Tablet-Optimierung
   -------------------------------------------------------------------------- */

.ambiente-panel {
  overflow-y: auto;
  overscroll-behavior: contain;
}

.ambiente-buttons {
  grid-template-columns: 58px minmax(0,1fr) 84px;
}

.ambiente-value,
.ambiente-mini {
  white-space: nowrap;
}

/* Lichtpanel lebt jetzt im Ambiente-Drawer und klappt dort auf,
   statt als zweites schwebendes Fenster das Board zu verdecken. */
.ambiente-panel .light-angle-panel {
  position: relative;
  z-index: 1;
  right: auto;
  bottom: auto;
  top: auto;
  width: 100%;
  margin-top: 2px;
  padding: 0;
  border: none;
  border-top: 1px solid rgba(255,255,255,.065);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  max-height: 0;
  overflow: hidden;
  transform: none;
  transform-origin: center top;
  transition: max-height .22s ease, opacity .18s ease, visibility .18s ease, padding-top .18s ease;
}
.ambiente-panel .light-angle-panel.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  max-height: 320px;
  padding-top: 12px;
}
.ambiente-panel .light-angle-head {
  margin-bottom: 9px;
}
.ambiente-panel .light-dial {
  width: 144px;
  height: 144px;
}
.ambiente-panel .dial-ring {
  inset: 14px;
}
.ambiente-panel .dial-cross-h { width: 108px; }
.ambiente-panel .dial-cross-v { height: 108px; }

/* Desktop: großes Popover wird durch einen schlanken rechten Drawer ersetzt. */
@media (min-width: 961px) {
  .ambiente-panel {
    top: max(62px, env(safe-area-inset-top) + 56px);
    bottom: calc(max(20px, env(safe-area-inset-bottom)) + 52px);
    height: auto;
    max-height: none;
    width: 284px;
    transform: translateX(14px) scale(.985);
  }
  .ambiente-panel.open { transform: translateX(0) scale(1); }
}

/* Tablet: drawer schmal halten, damit das Board sichtbar bleibt. */
@media (min-width: 681px) and (max-width: 960px) {
  .ambiente-panel {
    right: max(10px, env(safe-area-inset-right));
    top: max(58px, env(safe-area-inset-top) + 50px);
    bottom: calc(max(10px, env(safe-area-inset-bottom)) + 64px);
    width: min(34vw, 272px);
    min-width: 236px;
    padding: 12px;
    border-radius: 22px;
    transform: translateX(14px) scale(.985);
  }
  .ambiente-panel.open { transform: translateX(0) scale(1); }
  .view-control-row {
    min-height: 108px;
    grid-template-columns: minmax(0,1fr) 64px;
    gap: 8px;
  }
  .view-slider { width: 80px; }
  .preset-row { grid-template-columns: 1fr; gap: 10px; padding-block: 8px; }
  .preset-controls { justify-content: start; }
}

/* Phone: lieber Bottom-Sheet als mittiges großes Fenster. */
@media (max-width: 680px) {
  .ambiente-panel {
    right: 10px;
    left: 10px;
    width: auto;
    max-width: none;
    bottom: calc(max(62px, env(safe-area-inset-bottom)) + 6px);
    top: auto;
    max-height: min(72vh, 640px);
    transform: translateY(12px) scale(.985);
  }
  .ambiente-panel.open { transform: translateY(0) scale(1); }
  .ambiente-buttons {
    grid-template-columns: 56px minmax(0,1fr) 92px;
  }
  .view-control-row {
    grid-template-columns: 1fr 60px;
    min-height: 102px;
  }
}


/* --------------------------------------------------------------------------
   04.3.2 – Tablet: Board sichtbar halten / Licht-Unteransicht
   -------------------------------------------------------------------------- */

/* Desktop: Lichtprofil und Richtung sauber nebeneinander, ohne Überlappung. */
.ambiente-buttons {
  grid-template-columns: 58px minmax(92px, 1fr) minmax(86px, 94px);
  column-gap: 8px;
}
#light-cycle,
#light-angle-toggle {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin: 0;
}
#light-angle-toggle {
  justify-self: stretch;
  padding-left: 8px;
  padding-right: 8px;
}

.light-angle-head {
  display: grid;
  grid-template-columns: 28px minmax(0,1fr) auto;
  align-items: center;
  gap: 7px;
}
.light-back {
  width: 28px;
  height: 28px;
  min-width: 28px;
  padding: 0;
  display: none;
  place-items: center;
  font-size: 16px;
}

/* Tablet und schmale Portrait-Viewports: immer rechter Drawer statt Bottom-Sheet. */
@media (max-width: 960px) {
  .ambiente-panel {
    left: auto !important;
    right: max(8px, env(safe-area-inset-right)) !important;
    top: max(54px, calc(env(safe-area-inset-top) + 48px)) !important;
    bottom: calc(max(10px, env(safe-area-inset-bottom)) + 58px) !important;
    width: clamp(204px, 33vw, 236px) !important;
    min-width: 0 !important;
    max-width: calc(100vw - 16px) !important;
    max-height: none !important;
    transform: translateX(12px) scale(.985) !important;
    transform-origin: center right !important;
    border-radius: 20px;
    padding: 10px;
  }
  .ambiente-panel.open { transform: translateX(0) scale(1) !important; }
  .ambiente-head { padding-bottom: 8px; }
  .ambiente-row { min-height: 42px; }
  .ambiente-buttons {
    grid-template-columns: 48px minmax(0,1fr);
    gap: 6px;
  }
  .ambiente-buttons .ambiente-mini {
    grid-column: 2;
    width: 100%;
  }
  .ambiente-label { font-size: 8px; }
  .ambiente-value,
  .ambiente-mini { font-size: 8px; padding: 7px 8px 6px; }
  .view-control-row {
    min-height: 98px;
    grid-template-columns: minmax(0,1fr) 58px;
    gap: 6px;
  }
  .view-slider-wrap { height: 90px; }
  .view-slider { width: 74px; }
  .preset-row {
    grid-template-columns: 1fr;
    min-height: 82px;
    gap: 7px;
    padding-top: 7px;
    padding-bottom: 7px;
  }
  .preset-controls { justify-content: start; }
  .ambiente-dev { padding-top: 8px; }

  /* Richtungsmodus: gleicher Drawer, aber nur Lichtwerkzeug sichtbar. */
  .ambiente-panel.light-mode > .ambiente-row,
  .ambiente-panel.light-mode > .ambiente-dev {
    display: none;
  }
  .ambiente-panel.light-mode .light-back { display: grid; }
  .ambiente-panel.light-mode .light-angle-panel {
    display: block;
    max-height: none;
    padding-top: 10px;
    overflow: visible;
  }
  .ambiente-panel.light-mode .light-dial {
    width: 146px;
    height: 146px;
  }
}

/* Sehr schmale Breiten: rund die Hälfte des Bildes bleibt frei fürs Brett. */
@media (max-width: 560px) {
  .ambiente-panel {
    width: min(208px, 48vw) !important;
    right: 6px !important;
    top: max(50px, calc(env(safe-area-inset-top) + 44px)) !important;
  }
  .ambiente-kicker { display: none; }
  .ambiente-head strong { font-size: 11px; }
  .view-control-row { min-height: 88px; }
  .view-slider-wrap { height: 82px; }
  .preset-controls { grid-template-columns: repeat(3, 29px); }
  .preset-slot { width: 29px; min-width: 29px; }
  .ambiente-panel.light-mode .light-dial { width: 132px; height: 132px; }
}


/* --------------------------------------------------------------------------
   04.3.3 – Responsive Fix
   Desktop = breiteres Ambiente-Panel bei feinem Pointer.
   Tablet = schlanker rechter Drawer, damit das Brett sichtbar bleibt.
   Phone   = Bottom-Sheet.
   Die Einordnung läuft über html[data-ui-mode] aus main.js.
   -------------------------------------------------------------------------- */

html[data-ui-mode="desktop"] .ambiente-panel,
html[data-ui-mode="tablet"] .ambiente-panel,
html[data-ui-mode="phone"] .ambiente-panel {
  overflow-y: auto;
  overscroll-behavior: contain;
}

html[data-ui-mode="desktop"] .ambiente-panel {
  left: auto !important;
  right: max(16px, env(safe-area-inset-right)) !important;
  top: max(62px, calc(env(safe-area-inset-top) + 56px)) !important;
  bottom: calc(max(18px, env(safe-area-inset-bottom)) + 50px) !important;
  width: min(312px, calc(100vw - 32px)) !important;
  max-width: min(312px, calc(100vw - 32px)) !important;
  min-width: 312px !important;
  max-height: none !important;
  padding: 14px !important;
  border-radius: 24px !important;
  transform: translateX(14px) scale(.985) !important;
  transform-origin: center right !important;
}
html[data-ui-mode="desktop"] .ambiente-panel.open {
  transform: translateX(0) scale(1) !important;
}
html[data-ui-mode="desktop"] .ambiente-row { min-height: 48px; }
html[data-ui-mode="desktop"] .ambiente-buttons {
  grid-template-columns: 60px minmax(116px, 1fr) 96px;
  column-gap: 8px;
}
html[data-ui-mode="desktop"] .ambiente-value,
html[data-ui-mode="desktop"] .ambiente-mini {
  font-size: 10px;
}
html[data-ui-mode="desktop"] .view-control-row {
  min-height: 118px;
  grid-template-columns: 1fr 76px;
  gap: 10px;
}
html[data-ui-mode="desktop"] .view-slider-wrap { height: 104px; }
html[data-ui-mode="desktop"] .view-slider { width: 86px; }
html[data-ui-mode="desktop"] .preset-row {
  min-height: 72px;
  grid-template-columns: 84px 1fr;
  gap: 8px;
}
html[data-ui-mode="desktop"] .preset-controls {
  justify-content: end;
  grid-template-columns: repeat(3, 32px);
}
html[data-ui-mode="desktop"] .light-angle-panel {
  position: relative;
  right: auto !important;
  top: auto !important;
  bottom: auto !important;
  width: 100%;
  margin-top: 2px;
}
html[data-ui-mode="desktop"] .light-angle-panel.open {
  max-height: 320px;
  padding-top: 12px;
}

html[data-ui-mode="tablet"] .ambiente-panel {
  left: auto !important;
  right: max(8px, env(safe-area-inset-right)) !important;
  top: max(54px, calc(env(safe-area-inset-top) + 48px)) !important;
  bottom: calc(max(10px, env(safe-area-inset-bottom)) + 58px) !important;
  width: clamp(208px, 24vw, 236px) !important;
  max-width: min(236px, calc(100vw - 16px)) !important;
  min-width: 0 !important;
  max-height: none !important;
  padding: 10px !important;
  border-radius: 20px !important;
  transform: translateX(12px) scale(.985) !important;
  transform-origin: center right !important;
}
html[data-ui-mode="tablet"] .ambiente-panel.open {
  transform: translateX(0) scale(1) !important;
}
html[data-ui-mode="tablet"] .ambiente-head { padding-bottom: 8px; }
html[data-ui-mode="tablet"] .ambiente-row { min-height: 42px; }
html[data-ui-mode="tablet"] .ambiente-buttons {
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 6px;
}
html[data-ui-mode="tablet"] .ambiente-buttons .ambiente-mini {
  grid-column: 2;
  width: 100%;
}
html[data-ui-mode="tablet"] .ambiente-label { font-size: 8px; }
html[data-ui-mode="tablet"] .ambiente-value,
html[data-ui-mode="tablet"] .ambiente-mini {
  font-size: 8px;
  padding: 7px 8px 6px;
}
html[data-ui-mode="tablet"] .view-control-row {
  min-height: 98px;
  grid-template-columns: minmax(0,1fr) 58px;
  gap: 6px;
}
html[data-ui-mode="tablet"] .view-slider-wrap { height: 90px; }
html[data-ui-mode="tablet"] .view-slider { width: 74px; }
html[data-ui-mode="tablet"] .preset-row {
  grid-template-columns: 1fr;
  min-height: 82px;
  gap: 7px;
  padding-top: 7px;
  padding-bottom: 7px;
}
html[data-ui-mode="tablet"] .preset-controls { justify-content: start; }
html[data-ui-mode="tablet"] .ambiente-dev { padding-top: 8px; }
html[data-ui-mode="tablet"] .ambiente-panel.light-mode > .ambiente-row,
html[data-ui-mode="tablet"] .ambiente-panel.light-mode > .ambiente-dev {
  display: none;
}
html[data-ui-mode="tablet"] .ambiente-panel.light-mode .light-back { display: grid; }
html[data-ui-mode="tablet"] .ambiente-panel.light-mode .light-angle-panel {
  display: block;
  max-height: none;
  padding-top: 10px;
  overflow: visible;
}
html[data-ui-mode="tablet"] .ambiente-panel.light-mode .light-dial {
  width: 146px;
  height: 146px;
}

html[data-ui-mode="phone"] .ambiente-panel {
  left: 10px !important;
  right: 10px !important;
  width: auto !important;
  max-width: none !important;
  min-width: 0 !important;
  top: auto !important;
  bottom: calc(max(62px, env(safe-area-inset-bottom)) + 6px) !important;
  max-height: min(72vh, 640px) !important;
  border-radius: 22px !important;
  padding: 11px !important;
  transform: translateY(12px) scale(.985) !important;
  transform-origin: center bottom !important;
}
html[data-ui-mode="phone"] .ambiente-panel.open {
  transform: translateY(0) scale(1) !important;
}
html[data-ui-mode="phone"] .ambiente-buttons {
  grid-template-columns: 56px minmax(0,1fr) 92px;
}
html[data-ui-mode="phone"] .view-control-row {
  grid-template-columns: 1fr 60px;
  min-height: 102px;
}
html[data-ui-mode="phone"] .light-angle-panel.open {
  max-height: 300px;
  padding-top: 10px;
}

/* Sehr schmale Touch-Breiten: rechter Drawer bleibt klein genug fürs Brett. */
@media (max-width: 560px) {
  html[data-ui-mode="tablet"] .ambiente-panel {
    width: min(208px, 48vw) !important;
    right: 6px !important;
    top: max(50px, calc(env(safe-area-inset-top) + 44px)) !important;
  }
  html[data-ui-mode="tablet"] .ambiente-kicker { display: none; }
  html[data-ui-mode="tablet"] .ambiente-head strong { font-size: 11px; }
  html[data-ui-mode="tablet"] .view-control-row { min-height: 88px; }
  html[data-ui-mode="tablet"] .view-slider-wrap { height: 82px; }
  html[data-ui-mode="tablet"] .preset-controls { grid-template-columns: repeat(3, 29px); }
  html[data-ui-mode="tablet"] .preset-slot { width: 29px; min-width: 29px; }
  html[data-ui-mode="tablet"] .ambiente-panel.light-mode .light-dial { width: 132px; height: 132px; }
}


/* --------------------------------------------------------------------------
   04.3.4 – Tablet-Fix: kein Phone-Fallback mehr, Board bleibt sichtbar
   -------------------------------------------------------------------------- */
html[data-ui-mode="tablet"] .ambiente-panel {
  position: absolute !important;
  left: auto !important;
  right: max(6px, env(safe-area-inset-right)) !important;
  top: max(54px, calc(env(safe-area-inset-top) + 48px)) !important;
  bottom: auto !important;
  width: 196px !important;
  min-width: 196px !important;
  max-width: 196px !important;
  max-height: calc(100vh - 122px) !important;
  padding: 9px !important;
  border-radius: 18px !important;
  overflow-y: auto !important;
  transform: translateX(12px) scale(.985) !important;
}
html[data-ui-mode="tablet"] .ambiente-panel.open {
  transform: translateX(0) scale(1) !important;
}
html[data-ui-mode="tablet"] .ambiente-head { padding: 1px 1px 7px !important; }
html[data-ui-mode="tablet"] .ambiente-kicker { display: none !important; }
html[data-ui-mode="tablet"] .ambiente-head strong { font-size: 11px !important; }
html[data-ui-mode="tablet"] .icon-button {
  width: 25px !important; height: 25px !important; min-width: 25px !important;
}
html[data-ui-mode="tablet"] .ambiente-row { min-height: 38px !important; }
html[data-ui-mode="tablet"] .ambiente-buttons {
  grid-template-columns: 42px minmax(0,1fr) !important;
  gap: 5px !important;
}
html[data-ui-mode="tablet"] .ambiente-buttons .ambiente-mini {
  grid-column: 2 !important;
  width: 100% !important;
}
html[data-ui-mode="tablet"] .ambiente-label { font-size: 7px !important; }
html[data-ui-mode="tablet"] .ambiente-value,
html[data-ui-mode="tablet"] .ambiente-mini {
  min-height: 28px !important;
  padding: 6px 6px 5px !important;
  font-size: 7px !important;
}
html[data-ui-mode="tablet"] .view-control-row {
  min-height: 84px !important;
  grid-template-columns: minmax(0,1fr) 50px !important;
  gap: 4px !important;
}
html[data-ui-mode="tablet"] .view-slider-wrap { height: 76px !important; }
html[data-ui-mode="tablet"] .view-slider { width: 64px !important; }
html[data-ui-mode="tablet"] .view-slider-caption { font-size: 6px !important; }
html[data-ui-mode="tablet"] .preset-row {
  grid-template-columns: 1fr !important;
  min-height: 68px !important;
  gap: 5px !important;
  padding: 5px 0 !important;
}
html[data-ui-mode="tablet"] .preset-controls {
  grid-template-columns: repeat(3, 27px) !important;
  justify-content: start !important;
}
html[data-ui-mode="tablet"] .preset-slot {
  width: 27px !important; min-width: 27px !important; padding-inline: 0 !important;
}
html[data-ui-mode="tablet"] .preset-save { font-size: 7px !important; padding: 5px 6px !important; }
html[data-ui-mode="tablet"] .ambiente-copy small { font-size: 7px !important; }
html[data-ui-mode="tablet"] .ambiente-dev { padding-top: 6px !important; font-size: 7px !important; }

/* Lichtrichtung auf Tablet ersetzt den Inhalt des Drawers – sie verlängert ihn nicht. */
html[data-ui-mode="tablet"] .ambiente-panel.light-mode > .ambiente-row,
html[data-ui-mode="tablet"] .ambiente-panel.light-mode > .ambiente-dev {
  display: none !important;
}
html[data-ui-mode="tablet"] .ambiente-panel.light-mode .light-back { display: grid !important; }
html[data-ui-mode="tablet"] .ambiente-panel.light-mode .light-angle-panel {
  position: relative !important;
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  width: 100% !important;
  max-height: none !important;
  padding: 8px 0 0 !important;
  margin: 0 !important;
  overflow: visible !important;
  transform: none !important;
}
html[data-ui-mode="tablet"] .ambiente-panel.light-mode .light-dial {
  width: 126px !important;
  height: 126px !important;
}
html[data-ui-mode="tablet"] .ambiente-panel.light-mode .dial-ring { inset: 12px !important; }
html[data-ui-mode="tablet"] .ambiente-panel.light-mode .dial-cross-h { width: 94px !important; }
html[data-ui-mode="tablet"] .ambiente-panel.light-mode .dial-cross-v { height: 94px !important; }
html[data-ui-mode="tablet"] .ambiente-panel.light-mode .light-angle-actions button {
  min-width: 60px !important;
  padding: 6px 7px 5px !important;
  font-size: 7px !important;
}
html[data-ui-mode="tablet"] .ambiente-panel.light-mode .microcopy { font-size: 7px !important; }

/* Phone bleibt wirklich nur für kleine Touch-Geräte. */
html[data-ui-mode="phone"] .ambiente-panel {
  left: 8px !important;
  right: 8px !important;
  top: auto !important;
  bottom: calc(max(62px, env(safe-area-inset-bottom)) + 4px) !important;
  width: auto !important;
  max-width: none !important;
  min-width: 0 !important;
  max-height: 68vh !important;
}


/* --------------------------------------------------------------------------
   04.3.5 – A9+ Portrait-Fix
   Auf Tablet-Portrait niemals Phone-Bottom-Sheet: fester schmaler rechter Drawer.
   -------------------------------------------------------------------------- */
html[data-ui-mode="tablet"] .ambiente-panel {
  left: auto !important;
  right: max(6px, env(safe-area-inset-right)) !important;
  top: max(52px, calc(env(safe-area-inset-top) + 46px)) !important;
  bottom: calc(max(8px, env(safe-area-inset-bottom)) + 54px) !important;
  width: 190px !important;
  min-width: 190px !important;
  max-width: 190px !important;
  height: auto !important;
  max-height: none !important;
  padding: 8px !important;
  border-radius: 18px !important;
  overflow-y: auto !important;
  transform: translateX(10px) scale(.99) !important;
  transform-origin: center right !important;
}
html[data-ui-mode="tablet"] .ambiente-panel.open {
  transform: translateX(0) scale(1) !important;
}

html[data-ui-mode="tablet"] .ambiente-head {
  padding: 0 0 6px !important;
}
html[data-ui-mode="tablet"] .ambiente-kicker { display: none !important; }
html[data-ui-mode="tablet"] .ambiente-head strong {
  font-size: 10px !important;
  letter-spacing: .12em !important;
}
html[data-ui-mode="tablet"] .icon-button {
  width: 24px !important;
  height: 24px !important;
  min-width: 24px !important;
  font-size: 15px !important;
}

html[data-ui-mode="tablet"] .ambiente-row { min-height: 36px !important; }
html[data-ui-mode="tablet"] .ambiente-buttons {
  grid-template-columns: 40px minmax(0,1fr) !important;
  gap: 4px !important;
}
html[data-ui-mode="tablet"] .ambiente-buttons .ambiente-mini {
  grid-column: 2 !important;
  width: 100% !important;
}
html[data-ui-mode="tablet"] .ambiente-label {
  font-size: 7px !important;
  letter-spacing: .10em !important;
}
html[data-ui-mode="tablet"] .ambiente-value,
html[data-ui-mode="tablet"] .ambiente-mini {
  min-height: 26px !important;
  padding: 5px 5px 4px !important;
  font-size: 7px !important;
}

html[data-ui-mode="tablet"] .view-control-row {
  min-height: 76px !important;
  grid-template-columns: minmax(0,1fr) 46px !important;
  gap: 3px !important;
}
html[data-ui-mode="tablet"] .view-slider-wrap { height: 70px !important; }
html[data-ui-mode="tablet"] .view-slider { width: 58px !important; }
html[data-ui-mode="tablet"] .view-slider-caption { font-size: 6px !important; }
html[data-ui-mode="tablet"] .ambiente-copy strong { font-size: 9px !important; }

html[data-ui-mode="tablet"] .preset-row {
  grid-template-columns: 1fr !important;
  min-height: 62px !important;
  gap: 4px !important;
  padding: 4px 0 !important;
}
html[data-ui-mode="tablet"] .preset-controls {
  grid-template-columns: repeat(3, 25px) !important;
  gap: 4px !important;
  justify-content: start !important;
}
html[data-ui-mode="tablet"] .preset-slot {
  width: 25px !important;
  min-width: 25px !important;
  height: 25px !important;
  padding: 0 !important;
}
html[data-ui-mode="tablet"] .preset-save {
  padding: 4px 5px !important;
  font-size: 7px !important;
}
html[data-ui-mode="tablet"] .ambiente-copy small { font-size: 6px !important; }
html[data-ui-mode="tablet"] .ambiente-dev {
  padding-top: 5px !important;
  font-size: 6px !important;
}

/* Lichtrichtung ersetzt den Inhalt des Drawers komplett. */
html[data-ui-mode="tablet"] .ambiente-panel.light-mode > .ambiente-row,
html[data-ui-mode="tablet"] .ambiente-panel.light-mode > .ambiente-dev {
  display: none !important;
}
html[data-ui-mode="tablet"] .ambiente-panel.light-mode .light-back {
  display: grid !important;
}
html[data-ui-mode="tablet"] .ambiente-panel.light-mode .light-angle-panel {
  position: relative !important;
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  width: 100% !important;
  max-height: none !important;
  padding: 7px 0 0 !important;
  margin: 0 !important;
  overflow: visible !important;
  transform: none !important;
}
html[data-ui-mode="tablet"] .ambiente-panel.light-mode .light-dial {
  width: 120px !important;
  height: 120px !important;
}
html[data-ui-mode="tablet"] .ambiente-panel.light-mode .dial-ring { inset: 11px !important; }
html[data-ui-mode="tablet"] .ambiente-panel.light-mode .dial-cross-h { width: 88px !important; }
html[data-ui-mode="tablet"] .ambiente-panel.light-mode .dial-cross-v { height: 88px !important; }
html[data-ui-mode="tablet"] .ambiente-panel.light-mode .light-angle-head {
  font-size: 8px !important;
  margin-bottom: 6px !important;
}
html[data-ui-mode="tablet"] .ambiente-panel.light-mode .light-angle-actions {
  margin-top: 6px !important;
  gap: 5px !important;
}
html[data-ui-mode="tablet"] .ambiente-panel.light-mode .light-angle-actions button {
  min-width: 56px !important;
  padding: 5px 6px 4px !important;
  font-size: 7px !important;
}
html[data-ui-mode="tablet"] .ambiente-panel.light-mode .microcopy {
  font-size: 6px !important;
  margin-top: 6px !important;
}

/* Querformat darf etwas breiter sein, bleibt aber rechts am Rand. */
@media (orientation: landscape) {
  html[data-ui-mode="tablet"] .ambiente-panel {
    width: 202px !important;
    min-width: 202px !important;
    max-width: 202px !important;
  }
}


/* --------------------------------------------------------------------------
   04.3.5-clean – verfügbare Spielfläche statt Geräteerkennung
   Der Ambiente-Drawer sitzt auf JEDEM Gerät rechts. Seine Breite folgt nur der
   realen CSS-Viewportbreite. "Desktop-Website" ändert deshalb nicht mehr das
   grundsätzliche Bedienmuster.
   -------------------------------------------------------------------------- */

html[data-ui-mode="wide"] .ambiente-panel,
html[data-ui-mode="medium"] .ambiente-panel,
html[data-ui-mode="compact"] .ambiente-panel {
  position: absolute !important;
  left: auto !important;
  right: max(6px, env(safe-area-inset-right)) !important;
  top: max(52px, calc(env(safe-area-inset-top) + 46px)) !important;
  bottom: calc(max(8px, env(safe-area-inset-bottom)) + 54px) !important;
  height: auto !important;
  max-height: none !important;
  overflow-y: auto !important;
  transform: translateX(12px) scale(.99) !important;
  transform-origin: center right !important;
}
html[data-ui-mode="wide"] .ambiente-panel.open,
html[data-ui-mode="medium"] .ambiente-panel.open,
html[data-ui-mode="compact"] .ambiente-panel.open {
  transform: translateX(0) scale(1) !important;
}

/* Große Spielfläche: komfortabel breit, aber weiterhin ein rechter Drawer. */
html[data-ui-mode="wide"] .ambiente-panel {
  width: 312px !important;
  min-width: 312px !important;
  max-width: 312px !important;
  padding: 14px !important;
  border-radius: 24px !important;
}
html[data-ui-mode="wide"] .ambiente-buttons {
  grid-template-columns: 60px minmax(116px, 1fr) 96px !important;
  gap: 8px !important;
}
html[data-ui-mode="wide"] .view-control-row {
  min-height: 118px !important;
  grid-template-columns: 1fr 76px !important;
}
html[data-ui-mode="wide"] .preset-row {
  grid-template-columns: 84px 1fr !important;
  min-height: 72px !important;
}
html[data-ui-mode="wide"] .preset-controls {
  grid-template-columns: repeat(3, 32px) !important;
  justify-content: end !important;
}

/* Mittlere Spielfläche: typischer Tablet-/kleiner-Desktop-Drawer. */
html[data-ui-mode="medium"] .ambiente-panel {
  top: max(112px, calc(env(safe-area-inset-top) + 106px)) !important;
  width: clamp(190px, 24vw, 228px) !important;
  min-width: 190px !important;
  max-width: 228px !important;
  padding: 9px !important;
  border-radius: 19px !important;
}
html[data-ui-mode="medium"] .ambiente-head { padding: 0 0 7px !important; }
html[data-ui-mode="medium"] .ambiente-kicker { display: none !important; }
html[data-ui-mode="medium"] .ambiente-head strong { font-size: 11px !important; }
html[data-ui-mode="medium"] .ambiente-row { min-height: 38px !important; }
html[data-ui-mode="medium"] .ambiente-buttons {
  grid-template-columns: 42px minmax(0,1fr) !important;
  gap: 5px !important;
}
html[data-ui-mode="medium"] .ambiente-buttons .ambiente-mini {
  grid-column: 2 !important;
  width: 100% !important;
}
html[data-ui-mode="medium"] .ambiente-label { font-size: 7px !important; }
html[data-ui-mode="medium"] .ambiente-value,
html[data-ui-mode="medium"] .ambiente-mini {
  min-height: 27px !important;
  padding: 5px 6px !important;
  font-size: 7px !important;
}
html[data-ui-mode="medium"] .view-control-row {
  min-height: 82px !important;
  grid-template-columns: minmax(0,1fr) 48px !important;
  gap: 4px !important;
}
html[data-ui-mode="medium"] .view-slider-wrap { height: 74px !important; }
html[data-ui-mode="medium"] .view-slider { width: 62px !important; }
html[data-ui-mode="medium"] .preset-row {
  grid-template-columns: 1fr !important;
  min-height: 64px !important;
  gap: 4px !important;
  padding: 4px 0 !important;
}
html[data-ui-mode="medium"] .preset-controls {
  grid-template-columns: repeat(3, 26px) !important;
  justify-content: start !important;
}
html[data-ui-mode="medium"] .preset-slot {
  width: 26px !important;
  min-width: 26px !important;
  height: 26px !important;
  padding: 0 !important;
}

/* Sehr schmale CSS-Viewportbreite: KEIN Bottom-Sheet mehr. Auch hier rechter
   Drawer, nur kompakter. So bleibt das Board in normaler wie Desktop-Website-
   Ansicht sichtbar und das Bedienprinzip identisch. */
html[data-ui-mode="compact"] .ambiente-panel {
  width: min(178px, 48vw) !important;
  min-width: 164px !important;
  max-width: 178px !important;
  padding: 7px !important;
  border-radius: 17px !important;
}
html[data-ui-mode="compact"] .ambiente-head { padding: 0 0 5px !important; }
html[data-ui-mode="compact"] .ambiente-kicker { display: none !important; }
html[data-ui-mode="compact"] .ambiente-head strong { font-size: 9px !important; }
html[data-ui-mode="compact"] .icon-button {
  width: 22px !important; height: 22px !important; min-width: 22px !important;
  font-size: 14px !important;
}
html[data-ui-mode="compact"] .ambiente-row { min-height: 34px !important; }
html[data-ui-mode="compact"] .ambiente-buttons {
  grid-template-columns: 36px minmax(0,1fr) !important;
  gap: 3px !important;
}
html[data-ui-mode="compact"] .ambiente-buttons .ambiente-mini {
  grid-column: 2 !important;
  width: 100% !important;
}
html[data-ui-mode="compact"] .ambiente-label { font-size: 6px !important; }
html[data-ui-mode="compact"] .ambiente-value,
html[data-ui-mode="compact"] .ambiente-mini {
  min-height: 24px !important;
  padding: 4px 4px !important;
  font-size: 6px !important;
}
html[data-ui-mode="compact"] .view-control-row {
  min-height: 70px !important;
  grid-template-columns: minmax(0,1fr) 42px !important;
  gap: 2px !important;
}
html[data-ui-mode="compact"] .view-slider-wrap { height: 64px !important; }
html[data-ui-mode="compact"] .view-slider { width: 54px !important; }
html[data-ui-mode="compact"] .view-slider-caption { font-size: 5px !important; }
html[data-ui-mode="compact"] .ambiente-copy strong { font-size: 8px !important; }
html[data-ui-mode="compact"] .preset-row {
  grid-template-columns: 1fr !important;
  min-height: 58px !important;
  gap: 3px !important;
  padding: 3px 0 !important;
}
html[data-ui-mode="compact"] .preset-controls {
  grid-template-columns: repeat(3, 23px) !important;
  gap: 3px !important;
  justify-content: start !important;
}
html[data-ui-mode="compact"] .preset-slot {
  width: 23px !important; min-width: 23px !important; height: 23px !important; padding: 0 !important;
}
html[data-ui-mode="compact"] .preset-save { font-size: 6px !important; padding: 4px !important; }
html[data-ui-mode="compact"] .ambiente-copy small,
html[data-ui-mode="compact"] .ambiente-dev { font-size: 6px !important; }

/* Lichtrichtung ersetzt bei Medium UND Compact den Ambiente-Inhalt komplett. */
html[data-ui-mode="medium"] .ambiente-panel.light-mode > .ambiente-row,
html[data-ui-mode="medium"] .ambiente-panel.light-mode > .ambiente-dev,
html[data-ui-mode="compact"] .ambiente-panel.light-mode > .ambiente-row,
html[data-ui-mode="compact"] .ambiente-panel.light-mode > .ambiente-dev {
  display: none !important;
}
html[data-ui-mode="medium"] .ambiente-panel.light-mode .light-back,
html[data-ui-mode="compact"] .ambiente-panel.light-mode .light-back {
  display: grid !important;
}
html[data-ui-mode="medium"] .ambiente-panel.light-mode .light-angle-panel,
html[data-ui-mode="compact"] .ambiente-panel.light-mode .light-angle-panel {
  position: relative !important;
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  width: 100% !important;
  max-height: none !important;
  padding: 7px 0 0 !important;
  margin: 0 !important;
  overflow: visible !important;
  transform: none !important;
}
html[data-ui-mode="medium"] .ambiente-panel.light-mode .light-dial { width: 122px !important; height: 122px !important; }
html[data-ui-mode="compact"] .ambiente-panel.light-mode .light-dial { width: 108px !important; height: 108px !important; }
html[data-ui-mode="compact"] .ambiente-panel.light-mode .dial-ring { inset: 10px !important; }
html[data-ui-mode="compact"] .ambiente-panel.light-mode .dial-cross-h { width: 78px !important; }
html[data-ui-mode="compact"] .ambiente-panel.light-mode .dial-cross-v { height: 78px !important; }
html[data-ui-mode="compact"] .ambiente-panel.light-mode .light-angle-head,
html[data-ui-mode="compact"] .ambiente-panel.light-mode .light-angle-actions button,
html[data-ui-mode="compact"] .ambiente-panel.light-mode .microcopy { font-size: 6px !important; }


/* --------------------------------------------------------------------------
   04.3.6 – Smartphone stable viewport
   Mobile Browser-Chrome darf die Spielfläche nach dem Laden nicht neu skalieren.
   --stable-app-height wird von main.js gesetzt und nur bei echter Layoutänderung
   bzw. Rotation aktualisiert.
   -------------------------------------------------------------------------- */
html,
body {
  width: 100%;
  height: var(--stable-app-height, 100svh) !important;
  min-height: var(--stable-app-height, 100svh) !important;
  max-height: var(--stable-app-height, 100svh) !important;
  overflow: hidden !important;
}
#app {
  width: 100%;
  height: var(--stable-app-height, 100svh) !important;
  min-height: var(--stable-app-height, 100svh) !important;
  max-height: var(--stable-app-height, 100svh) !important;
  overflow: hidden !important;
}
#scene {
  width: 100% !important;
  height: 100% !important;
}


/* 04.3.7 – Fog/Camera-Distance Fix lives in main.js; UI unchanged. */


/* --------------------------------------------------------------------------
   04.4.1 – Zugklarheit + Undo
   -------------------------------------------------------------------------- */
.player-row {
  position: relative;
  overflow: hidden;
}
.player-row.active {
  background: rgba(255,255,255,0.13);
  border-color: rgba(255,255,255,0.38);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08), 0 0 24px rgba(255,255,255,.09);
}
.player-row.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 3px;
  background: rgba(255,255,255,.88);
  box-shadow: 0 0 10px rgba(255,255,255,.45);
}
.player-row.active .player-state {
  color: #fff;
  font-weight: 800;
  letter-spacing: .10em;
}
.player-name { letter-spacing: .10em; }

.btn-undo {
  min-width: 92px;
  background: rgba(255,255,255,.07);
}
.btn-undo.available {
  color: #fff;
  background: rgba(255,255,255,.14);
  border-color: rgba(255,255,255,.26);
}
.btn-undo:disabled {
  opacity: .36;
  cursor: default;
}

@media (max-width: 680px) {
  .panel-controls .btn-primary { min-width: 92px; }
  .btn-undo { min-width: 82px !important; }
  .player-state { font-size: 8px; }
}
@media (max-width: 430px) {
  .panel-controls .btn-primary { min-width: 78px; padding-inline: 8px; }
  .btn-undo { min-width: 72px !important; }
}


/* --------------------------------------------------------------------------
   04.4.2 – Desktop-Lesbarkeit
   Tablet/Phone bleiben bewusst auf dem bereits gut getesteten Maßstab.
   -------------------------------------------------------------------------- */
@media (min-width: 1100px) and (hover: hover) and (pointer: fine) {
  .player-panel {
    width: 238px;
    padding: 11px;
  }
  .player-row {
    grid-template-columns: 38px minmax(0,1fr) auto;
    min-height: 58px;
    gap: 10px;
    padding: 9px 10px;
  }
  .player-stone { width: 33px; height: 33px; }
  .player-name { font-size: 12px; }
  .player-meta { font-size: 11px; }
  .player-state { font-size: 10px; }
  .selection-label { font-size: 10px; }
  .selection-strip strong { font-size: 12px; }

  .panel-controls { padding: 9px 11px; gap: 9px; }
  .panel-controls .btn-primary {
    min-width: 108px;
    padding: 9px 13px 8px;
    font-size: 11px;
  }
  .btn-undo { min-width: 98px !important; }

  .brand-title { font-size: 13px; }
  .phase-badge { font-size: 11px; }
  .version-pill { font-size: 11px; }
  .hint { font-size: 12px; }
}


/* --------------------------------------------------------------------------
   04.5 – Spielstart / Schwierigkeitswahl
   -------------------------------------------------------------------------- */
.start-screen {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: max(20px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  background: rgba(12, 14, 13, 0.42);
  backdrop-filter: blur(8px) saturate(0.9);
  -webkit-backdrop-filter: blur(8px) saturate(0.9);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.start-screen.open {
  opacity: 1;
  pointer-events: auto;
}

.start-card {
  width: min(560px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 28px 30px 24px;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(30,34,31,0.96), rgba(18,21,19,0.97));
  box-shadow: 0 30px 80px rgba(0,0,0,0.42), inset 0 1px 0 rgba(255,255,255,0.07);
  color: #f4f2ed;
  text-align: center;
}

.start-kicker {
  margin-bottom: 5px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.48);
}

.start-card h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1;
  letter-spacing: 0.06em;
  font-weight: 800;
}

.start-subtitle {
  margin: 12px auto 22px;
  max-width: 390px;
  color: rgba(255,255,255,0.62);
  font-size: 14px;
  line-height: 1.4;
}

.start-choice-group { text-align: left; }
.start-choice-label {
  display: block;
  margin: 0 0 9px 2px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.50);
}

.difficulty-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.difficulty-button {
  min-height: 76px;
  padding: 12px 10px;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 14px;
  background: rgba(255,255,255,0.055);
  color: rgba(255,255,255,0.76);
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease, color 120ms ease;
}
.difficulty-button:hover { transform: translateY(-1px); border-color: rgba(255,255,255,0.22); }
.difficulty-button strong,
.difficulty-button span { display: block; }
.difficulty-button strong { font-size: 14px; letter-spacing: 0.08em; }
.difficulty-button span { margin-top: 5px; font-size: 11px; color: rgba(255,255,255,0.42); }
.difficulty-button.active {
  border-color: rgba(232, 214, 176, 0.58);
  background: rgba(232, 214, 176, 0.14);
  color: #fff8e9;
  box-shadow: inset 0 0 0 1px rgba(232,214,176,0.08);
}
.difficulty-button.active span { color: rgba(255,248,233,0.64); }

.start-matchup {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  margin: 22px 0 18px;
  padding: 15px 16px;
  border-radius: 16px;
  background: rgba(0,0,0,0.18);
  border: 1px solid rgba(255,255,255,0.07);
}

.start-side {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 11px;
  text-align: left;
}
.start-side-ai { justify-content: flex-end; text-align: right; }
.start-side small,
.start-side strong { display: block; }
.start-side small { font-size: 10px; letter-spacing: .13em; color: rgba(255,255,255,.42); }
.start-side strong { margin-top: 2px; font-size: 14px; letter-spacing: .08em; }
.start-vs { font-size: 11px; color: rgba(255,255,255,.32); text-transform: uppercase; letter-spacing: .12em; }

.start-stone {
  width: 27px;
  height: 27px;
  flex: 0 0 auto;
  border-radius: 50%;
  box-shadow: inset 0 1px 2px rgba(255,255,255,.28), 0 4px 9px rgba(0,0,0,.28);
}
.start-stone-light { background: radial-gradient(circle at 35% 28%, #fffdf5, #c9c3b4 72%, #8c877c); border: 1px solid rgba(255,255,255,.48); }
.start-stone-dark { background: radial-gradient(circle at 35% 28%, #4b4c49, #1f211f 66%, #0b0c0b); border: 1px solid rgba(255,255,255,.12); }

.start-button {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 15px;
  background: #eee5d2;
  color: #1a1c19;
  font-weight: 800;
  letter-spacing: .10em;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0,0,0,.23);
  transition: transform 120ms ease, filter 120ms ease;
}
.start-button:hover { transform: translateY(-1px); filter: brightness(1.04); }
.start-button:active { transform: translateY(0); }
.start-note { margin-top: 11px; min-height: 17px; font-size: 12px; color: rgba(255,255,255,.46); }

@media (max-width: 620px) {
  .start-card { padding: 22px 18px 19px; border-radius: 20px; }
  .start-subtitle { margin-bottom: 17px; font-size: 13px; }
  .difficulty-grid { gap: 6px; }
  .difficulty-button { min-height: 68px; padding: 10px 5px; }
  .difficulty-button strong { font-size: 12px; }
  .difficulty-button span { font-size: 9px; }
  .start-matchup { gap: 8px; padding: 13px 10px; }
  .start-side { gap: 7px; }
  .start-stone { width: 23px; height: 23px; }
  .start-side strong { font-size: 12px; }
  .start-vs { font-size: 9px; }
}


/* ================================================================
   04.6 – Spielende / Partiefluss
   ================================================================ */
.result-screen {
  position: fixed;
  inset: 0;
  z-index: 125;
  display: grid;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
  background: rgba(8, 7, 5, 0);
  backdrop-filter: blur(0px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .28s ease, background .32s ease, backdrop-filter .32s ease, visibility 0s linear .32s;
}
.result-screen.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  background: rgba(8, 7, 5, .38);
  backdrop-filter: blur(3px);
  transition-delay: 0s;
}
.result-card {
  width: min(520px, calc(100vw - 34px));
  padding: 32px 34px 28px;
  border-radius: 24px;
  text-align: center;
  color: #f5f0e5;
  background: linear-gradient(180deg, rgba(32,30,25,.94), rgba(20,19,16,.96));
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 28px 75px rgba(0,0,0,.44), inset 0 1px 0 rgba(255,255,255,.07);
  transform: translateY(12px) scale(.985);
  transition: transform .3s cubic-bezier(.22,.8,.24,1);
}
.result-screen.open .result-card { transform: translateY(0) scale(1); }
.result-kicker { font-size: 10px; letter-spacing: .22em; color: rgba(255,255,255,.42); }
.result-emblem {
  width: 58px; height: 58px; margin: 16px auto 10px; border-radius: 50%;
  display: grid; place-items: center; font-size: 21px;
  background: rgba(255,255,255,.065); border: 1px solid rgba(255,255,255,.11);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
}
.result-card.win .result-emblem { background: rgba(201,168,100,.13); border-color: rgba(221,190,123,.25); color: #ddc18a; }
.result-card.loss .result-emblem { color: rgba(255,255,255,.58); }
.result-card h2 { margin: 0; font-size: clamp(40px, 6vw, 56px); line-height: 1; letter-spacing: .09em; font-weight: 760; }
.result-subtitle { margin: 12px 0 0; font-size: 14px; line-height: 1.45; color: rgba(255,255,255,.58); }
.result-summary {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  margin: 19px 0 21px; padding: 11px 12px; border-radius: 13px;
  background: rgba(255,255,255,.045); border: 1px solid rgba(255,255,255,.065);
  font-size: 11px; letter-spacing: .09em; color: rgba(255,255,255,.58);
}
.result-summary-dot { color: rgba(255,255,255,.22); }
.result-actions { display: grid; grid-template-columns: 1.55fr 1fr; gap: 9px; }
.result-actions button {
  min-height: 46px; border-radius: 13px; font: inherit; font-size: 11px; font-weight: 760;
  letter-spacing: .08em; cursor: pointer; transition: transform .14s ease, filter .14s ease, border-color .14s ease;
}
.result-actions button:hover { transform: translateY(-1px); }
.result-primary { border: 1px solid rgba(224,195,137,.31); color: #241e14; background: linear-gradient(180deg,#e3c98f,#cba96e); box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.result-secondary { border: 1px solid rgba(255,255,255,.10); color: rgba(255,255,255,.72); background: rgba(255,255,255,.055); }
.result-note { margin-top: 11px; font-size: 10px; color: rgba(255,255,255,.34); }
@media (max-width: 520px) {
  .result-card { padding: 22px 18px 19px; border-radius: 20px; }
  .result-actions { grid-template-columns: 1fr; }
  .result-actions button { min-height: 44px; }
}


/* 04.7 – Audio controls */
#music-cycle.active,
#sound-toggle.active {
  background: rgba(255,255,255,.16);
  border-color: rgba(255,255,255,.20);
  color: #fff;
}


/* ================================================================
   05.0 – Finalisierungs-Basis / Navigation
   Die Typografie bleibt bewusst unangetastet; Geräte-Feinschliff kommt separat.
   ================================================================ */
.start-secondary {
  width: 100%;
  min-height: 44px;
  margin-top: 9px;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 13px;
  background: rgba(255,255,255,.055);
  color: rgba(255,255,255,.76);
  font: inherit;
  font-size: 11px;
  font-weight: 760;
  letter-spacing: .08em;
  cursor: pointer;
  transition: transform .14s ease, background .14s ease, border-color .14s ease;
}
.start-secondary:hover { transform: translateY(-1px); background: rgba(255,255,255,.09); border-color: rgba(255,255,255,.16); }
.start-secondary[hidden] { display: none !important; }


/* ================================================================
   05.0.2 – Neustart-UX: Entscheidung und Konfiguration getrennt
   ================================================================ */
.start-step[hidden] { display: none !important; }
.restart-choice-stack { display: grid; gap: 10px; margin-top: 22px; }
.color-choice-group { margin-top: 18px; }
.color-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
.color-button {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 14px;
  background: rgba(255,255,255,.055);
  color: rgba(255,255,255,.76);
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease, color 120ms ease;
}
.color-button:hover { transform: translateY(-1px); border-color: rgba(255,255,255,.22); }
.color-button strong, .color-button small { display: block; text-align: left; }
.color-button strong { font-size: 14px; letter-spacing: .08em; }
.color-button small { margin-top: 3px; font-size: 10px; color: rgba(255,255,255,.42); }
.color-button.active {
  border-color: rgba(232,214,176,.58);
  background: rgba(232,214,176,.14);
  color: #fff8e9;
  box-shadow: inset 0 0 0 1px rgba(232,214,176,.08);
}
.color-button.active small { color: rgba(255,248,233,.64); }
.color-rule-note { margin-top: 8px; text-align: center; font-size: 11px; color: rgba(255,255,255,.48); }
@media (max-width: 620px) {
  .color-button { min-height: 60px; padding: 8px 10px; gap: 8px; }
  .color-button strong { font-size: 12px; }
  .color-button small { font-size: 9px; }
}


/* ================================================================
   05.1 – Responsive & Geräte-Pass
   Struktur/Abstände robust machen; finale Schriftgrößen bleiben bewusst
   für den späteren Gerätevergleich unangetastet.
   ================================================================ */

/* 04.3.6 liefert --stable-app-height/width. 05.1 nutzt diese Werte nun
   konsequent auch für die DOM-Oberflächen, nicht nur fürs 3D-Framing. */
html,
body,
#app {
  width: 100%;
  height: var(--stable-app-height, 100dvh);
  min-height: var(--stable-app-height, 100dvh);
  max-height: var(--stable-app-height, 100dvh);
}
body {
  position: fixed;
  inset: 0;
  overscroll-behavior: none;
}
#app,
#scene { height: 100%; }

.start-screen,
.result-screen {
  width: 100%;
  height: var(--stable-app-height, 100dvh);
  min-height: var(--stable-app-height, 100dvh);
}
.start-card,
.result-card {
  max-height: calc(var(--stable-app-height, 100dvh) - max(28px, env(safe-area-inset-top)) - max(28px, env(safe-area-inset-bottom)));
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

/* Verhindert, dass die drei Hauptbuttons bei ungewöhnlichen Zwischenbreiten
   aus dem Viewport drücken. Ihre Beschriftung/Typografie bleibt unverändert. */
.panel-controls {
  max-width: calc(100vw - max(24px, env(safe-area-inset-left) + env(safe-area-inset-right) + 12px));
}
.panel-controls > button {
  flex-shrink: 1;
}

/* WIDE: Spielerstatus darf nie mit Kopf-/Fußleiste kollidieren, selbst bei
   sehr flachen Desktopfenstern. */
html[data-ui-mode="wide"] .player-panel {
  max-height: calc(var(--stable-app-height, 100dvh) - 132px);
}

/* MEDIUM: Tablet / kleine Notebookfenster. Die linke Statuskarte bleibt aus
   der eigentlichen Brettmitte heraus und die untere Leiste bleibt einzeilig,
   solange die Breite es zulässt. */
html[data-ui-mode="medium"] .topbar {
  display: none;
}
html[data-ui-mode="medium"] .player-panel {
  left: 50%;
  top: max(10px, calc(env(safe-area-inset-top) + 8px));
  transform: translateX(-50%);
  width: min(calc(100vw - 20px), 760px);
  max-height: none;
  padding: 8px 10px;
  border-radius: 22px;
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(0,1fr);
  align-items: start;
  column-gap: 12px;
  row-gap: 0;
}
html[data-ui-mode="medium"] .player-row {
  min-height: 52px;
  padding: 7px 9px;
  margin: 0 !important;
}
html[data-ui-mode="medium"] .player-row.active {
  transform: none;
}
html[data-ui-mode="medium"] .player-name,
html[data-ui-mode="medium"] .player-meta,
html[data-ui-mode="medium"] .player-state {
  white-space: nowrap;
}
html[data-ui-mode="medium"] .player-name { font-size: 12px; }
html[data-ui-mode="medium"] .player-meta { font-size: 10px; }
html[data-ui-mode="medium"] .player-state { font-size: 10px; }
html[data-ui-mode="medium"] .player-light {
  grid-column: 1;
  grid-row: 1;
}
html[data-ui-mode="medium"] .player-dark {
  grid-column: 2;
  grid-row: 1;
  grid-template-columns: auto minmax(0,1fr) 34px;
}
html[data-ui-mode="medium"] .player-dark .player-state {
  grid-column: 1;
  grid-row: 1;
  text-align: left;
}
html[data-ui-mode="medium"] .player-dark .player-copy {
  grid-column: 2;
  grid-row: 1;
  text-align: right;
}
html[data-ui-mode="medium"] .player-dark .player-stone {
  grid-column: 3;
  grid-row: 1;
}
html[data-ui-mode="medium"] .selection-strip {
  grid-column: 1 / span 2;
  grid-row: 2;
  margin-top: 7px;
  padding: 10px 12px 4px;
  border-top: 1px solid rgba(255,255,255,.08);
  text-align: center;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
}
html[data-ui-mode="medium"] .match-phase {
  display: block;
  color: var(--text-main);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .10em;
  white-space: nowrap;
  line-height: 1.1;
}
html[data-ui-mode="medium"] .status-context {
  display: block;
  margin-bottom: 0;
  color: rgba(255,255,255,.92);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  max-width: 100%;
  white-space: normal;
  text-wrap: balance;
}
html[data-ui-mode="medium"] .selection-label {
  display: none;
}
html[data-ui-mode="medium"] .selection-strip strong {
  margin-top: 0;
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .03em;
}
html[data-ui-mode="medium"] .panel-controls {
  width: auto;
  max-width: calc(100vw - 24px);
  flex-wrap: nowrap;
  border-radius: 999px;
}
html[data-ui-mode="medium"] .hint {
  width: min(62vw, 500px);
}

/* COMPACT: Smartphone. Status bleibt oben, Steuerung unten; dazwischen wird
   die Brettzone freigehalten. Keine absolute Geräteerkennung, nur verfügbare
   Breite wie seit 04.3.5. */
html[data-ui-mode="compact"] .topbar {
  max-width: calc(100vw - 16px);
}
html[data-ui-mode="compact"] .brand-card {
  max-width: calc(100vw - 16px);
  overflow: hidden;
}
html[data-ui-mode="compact"] .phase-badge {
  min-width: 0;
  overflow: hidden;
}
html[data-ui-mode="compact"] #status-phase {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
html[data-ui-mode="compact"] .player-panel {
  width: min(calc(100vw - 16px), 470px);
  top: max(50px, calc(env(safe-area-inset-top) + 44px));
}
html[data-ui-mode="compact"] .panel-controls {
  width: min(calc(100vw - 16px), 470px);
  justify-content: stretch;
  flex-wrap: nowrap;
  gap: 5px;
  padding: 7px;
  border-radius: 18px;
}
html[data-ui-mode="compact"] .panel-controls .btn-primary {
  flex: 1 1 0;
  min-width: 0 !important;
}
html[data-ui-mode="compact"] .hint {
  width: min(calc(100vw - 24px), 430px);
  bottom: calc(max(70px, env(safe-area-inset-bottom) + 66px));
}

/* Sehr schmale Hochformate: die Versionspille ist die am wenigsten wichtige
   Information und darf zugunsten von Phase/Spielraum verschwinden. */
@media (max-width: 360px) {
  html[data-ui-mode="compact"] .version-pill { display: none; }
}

/* Flache Querformate (Phone/kleines Tablet): vertikale Luft ist der Engpass.
   Overlays bleiben scrollbar und die HUD-Karten rücken an die sicheren Ränder,
   ohne Kameraanker oder Brettframing zu verändern. */
@media (orientation: landscape) and (max-height: 620px) {
  .start-screen,
  .result-screen {
    place-items: center;
    padding-top: max(8px, env(safe-area-inset-top));
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }
  .start-card,
  .result-card {
    max-height: calc(var(--stable-app-height, 100dvh) - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  }
  .start-card { padding-top: 18px; padding-bottom: 16px; }
  .start-subtitle { margin-top: 8px; margin-bottom: 14px; }
  .restart-choice-stack { margin-top: 14px; }
  .color-choice-group { margin-top: 12px; }
  .start-matchup { margin-top: 14px; margin-bottom: 12px; padding-top: 10px; padding-bottom: 10px; }

  html[data-ui-mode="medium"] .player-panel,
  html[data-ui-mode="compact"] .player-panel {
    top: max(48px, calc(env(safe-area-inset-top) + 42px));
    max-height: calc(var(--stable-app-height, 100dvh) - 106px);
  }
  html[data-ui-mode="medium"] .panel-controls,
  html[data-ui-mode="compact"] .panel-controls {
    bottom: max(6px, env(safe-area-inset-bottom));
  }
  html[data-ui-mode="medium"] .hint,
  html[data-ui-mode="compact"] .hint {
    bottom: calc(max(56px, env(safe-area-inset-bottom) + 52px));
  }
}

/* Kurze Hochformate / Split-Screen: Dialoge dürfen scrollen, die Aktion bleibt
   sichtbar, ohne Schriftgrößen zu verkleinern. */
@media (orientation: portrait) and (max-height: 700px) {
  .start-screen,
  .result-screen { align-items: start; }
  .start-card,
  .result-card { margin-top: max(8px, env(safe-area-inset-top)); }
}

/* Touch: echte Bedienfläche, ohne Hover-Zustände festzuhalten. */
@media (hover: none), (pointer: coarse) {
  button { touch-action: manipulation; }
  button:hover { transform: none; }
}


/* --------------------------------------------------------------------------
   05.1.1 – DESKTOP-PASS
   WIDE bekommt eine ruhige, symmetrische Spielkomposition. Tablet/Phone bleiben
   für ihre eigenen späteren Pässe absichtlich unverändert.
   -------------------------------------------------------------------------- */
@media (min-width: 1180px) {
  /* Branding bleibt als kleine, eigenständige Pille. Die eigentliche Phase lebt
     im Match-Panel darunter und wird nicht doppelt erzählt. */
  html[data-ui-mode="wide"] .topbar {
    top: max(10px, env(safe-area-inset-top));
  }
  html[data-ui-mode="wide"] .topbar .phase-badge,
  html[data-ui-mode="wide"] .topbar .brand-separator {
    display: none;
  }
  html[data-ui-mode="wide"] .brand-card {
    min-height: 34px;
    padding: 6px 8px 6px 13px;
  }

  /* Das bisherige linke Hochkant-Panel wird zum horizontalen Match-Panel:
     HELL links – Phase/Auswahl Mitte – DUNKEL rechts. */
  html[data-ui-mode="wide"] .player-panel {
    left: 50%;
    top: max(72px, calc(env(safe-area-inset-top) + 66px));
    transform: translateX(-50%);
    width: min(920px, calc(100vw - 470px));
    max-height: none;
    padding: 7px 10px;
    border-radius: 22px;
    display: grid;
    grid-template-columns: minmax(250px, 1fr) minmax(230px, 0.88fr) minmax(250px, 1fr);
    align-items: center;
    gap: 10px;
  }
  html[data-ui-mode="wide"] .player-row {
    min-height: 50px;
    padding: 6px 9px;
    margin: 0 !important;
  }
  html[data-ui-mode="wide"] .player-row.active {
    transform: none;
  }
  html[data-ui-mode="wide"] .player-copy {
    min-width: 0;
  }
  html[data-ui-mode="wide"] .player-name,
  html[data-ui-mode="wide"] .player-meta,
  html[data-ui-mode="wide"] .player-state {
    white-space: nowrap;
  }
  html[data-ui-mode="wide"] .player-name { font-size: 12px; }
  html[data-ui-mode="wide"] .player-meta { font-size: 10px; }
  html[data-ui-mode="wide"] .player-light { grid-column: 1; }
  html[data-ui-mode="wide"] .selection-strip {
    grid-column: 2;
    margin: 0;
    padding: 6px 14px;
    border-top: 0;
    border-left: 1px solid rgba(255,255,255,.08);
    border-right: 1px solid rgba(255,255,255,.08);
    text-align: center;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
  }
  html[data-ui-mode="wide"] .player-dark { grid-column: 3; }

  /* Gegenseite bewusst spiegeln: Status innen, Name rechts, Stein außen. */
  html[data-ui-mode="wide"] .player-dark {
    grid-template-columns: auto minmax(0,1fr) 34px;
  }
  html[data-ui-mode="wide"] .player-dark .player-state {
    grid-column: 1;
    grid-row: 1;
    text-align: left;
  }
  html[data-ui-mode="wide"] .player-dark .player-copy {
    grid-column: 2;
    grid-row: 1;
    text-align: right;
  }
  html[data-ui-mode="wide"] .player-dark .player-stone {
    grid-column: 3;
    grid-row: 1;
  }

  html[data-ui-mode="wide"] .match-phase {
    display: block;
    color: var(--text-main);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .10em;
    white-space: nowrap;
    line-height: 1.1;
  }
  html[data-ui-mode="wide"] .status-context {
    display: block;
    color: rgba(255,255,255,.9);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .015em;
    line-height: 1.18;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  html[data-ui-mode="wide"] .selection-label {
    display: none;
  }
  html[data-ui-mode="wide"] .selection-strip strong {
    margin-top: 0;
    color: var(--text-faint);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .03em;
  }

  html[data-ui-mode="wide"] .hint { display: none !important; }
}

/* Außerhalb WIDE existiert match-phase nur als unsichtbarer Sync-Text; die
   bisherigen Tablet/Phone-Layouts bleiben damit pixelgenau auf 05.1-Basis. */
.match-phase { display: none; }
@media (min-width: 1180px) {
  html[data-ui-mode="wide"] .match-phase { display: block; }
}


/* --------------------------------------------------------------------------
   05.1.5 – DESKTOP HEADER ALIGNMENT
   Nur WIDE: Die drei Hauptinformationen liegen auf derselben Zeile/Höhe.
   Die Mittelspalte bekommt genug Raum für den vollständigen Handlungshinweis.
   Tablet/Phone bleiben unverändert.
   -------------------------------------------------------------------------- */
@media (min-width: 1180px) {
  html[data-ui-mode="wide"] .player-panel {
    width: min(1040px, calc(100vw - 180px));
    grid-template-columns: minmax(250px, 1fr) minmax(380px, 1.35fr) minmax(250px, 1fr);
    grid-template-rows: auto;
    column-gap: 10px;
    row-gap: 0;
    align-items: center;
  }

  html[data-ui-mode="wide"] .player-light,
  html[data-ui-mode="wide"] .selection-strip,
  html[data-ui-mode="wide"] .player-dark {
    grid-row: 1;
    align-self: center;
  }

  html[data-ui-mode="wide"] .player-light { grid-column: 1; }
  html[data-ui-mode="wide"] .selection-strip { grid-column: 2; }
  html[data-ui-mode="wide"] .player-dark { grid-column: 3; }

  html[data-ui-mode="wide"] .selection-strip {
    min-height: 50px;
    padding: 6px 14px;
    justify-content: center;
  }

  html[data-ui-mode="wide"] .match-phase {
    line-height: 1.1;
  }

  html[data-ui-mode="wide"] .status-context {
    max-width: none;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
    font-size: 11px;
    line-height: 1.2;
  }
}


/* --------------------------------------------------------------------------
   05.1.6 – Desktop Ambiente Feinschliff
   Nur WIDE/Desktop. Tablet/Phone bleiben auf 05.1.5-Basis.
   -------------------------------------------------------------------------- */
@media (min-width: 1180px) {
  html[data-ui-mode="wide"] .ambiente-panel {
    bottom: auto !important;
    height: auto !important;
    max-height: calc(var(--stable-app-height, 100dvh) - max(76px, env(safe-area-inset-top) + 68px) - 18px) !important;
    overflow-y: auto !important;
    padding-bottom: 12px !important;
  }

  /* Ansicht: Text und Slider als kompakte, zusammengehörige Einheit. */
  html[data-ui-mode="wide"] .view-control-row {
    min-height: 92px !important;
    grid-template-columns: 98px 76px !important;
    justify-content: start !important;
    column-gap: 16px !important;
  }
  html[data-ui-mode="wide"] .view-slider-wrap {
    height: 82px !important;
  }
  html[data-ui-mode="wide"] .view-slider {
    width: 66px !important;
  }

  /* Licht: Richtungssteuerung auf Desktop immer direkt sichtbar. */
  html[data-ui-mode="wide"] #light-angle-toggle {
    display: none !important;
  }
  html[data-ui-mode="wide"] .light-row {
    grid-template-columns: 60px minmax(116px, 1fr) !important;
  }
  html[data-ui-mode="wide"] .light-angle-panel {
    position: relative !important;
    inset: auto !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 8px 0 11px !important;
    border: 0 !important;
    border-bottom: 1px solid rgba(255,255,255,.065) !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transform: none !important;
  }
  html[data-ui-mode="wide"] .light-angle-head {
    margin: 0 0 5px !important;
    padding: 0 2px !important;
    justify-content: space-between !important;
  }
  html[data-ui-mode="wide"] .light-angle-head .light-back {
    display: none !important;
  }
  html[data-ui-mode="wide"] .light-dial {
    width: 118px !important;
    height: 118px !important;
    margin: 0 auto !important;
  }
  html[data-ui-mode="wide"] .dial-ring { inset: 12px !important; }
  html[data-ui-mode="wide"] .dial-cross-h { width: 88px !important; }
  html[data-ui-mode="wide"] .dial-cross-v { height: 88px !important; }
  html[data-ui-mode="wide"] .light-angle-actions {
    margin-top: 5px !important;
    gap: 6px !important;
  }
  html[data-ui-mode="wide"] .light-angle-actions button {
    min-width: 68px !important;
    padding: 6px 9px 5px !important;
    font-size: 8px !important;
  }
  html[data-ui-mode="wide"] .light-angle-panel .microcopy {
    margin-top: 5px !important;
    font-size: 8px !important;
  }

  /* Presets gehören nur zu Ansicht/Skin/Licht und stehen direkt darunter. */
  html[data-ui-mode="wide"] .preset-row {
    min-height: 62px !important;
    padding-block: 5px !important;
  }

  /* Audio ist bewusst NICHT Teil der Presets. */
  html[data-ui-mode="wide"] .audio-section-label {
    display: block !important;
    margin-top: 8px;
    padding: 10px 2px 3px;
    border-top: 1px solid rgba(255,255,255,.13);
    color: rgba(255,255,255,.40);
    font-size: 8px;
    font-weight: 700;
    letter-spacing: .15em;
  }
  html[data-ui-mode="wide"] .music-row,
  html[data-ui-mode="wide"] .sound-row {
    min-height: 44px !important;
  }
  html[data-ui-mode="wide"] .sound-row {
    border-bottom: 1px solid rgba(255,255,255,.09) !important;
  }
  html[data-ui-mode="wide"] .ambiente-dev {
    padding-top: 9px !important;
  }
}

/* Außerhalb Desktop bleibt der neue Gruppen-Titel unsichtbar. */
.ambiente-section-label { display: none; }
@media (min-width: 1180px) {
  html[data-ui-mode="wide"] .ambiente-section-label { display: block; }
}


/* --------------------------------------------------------------------------
   05.1.6.1 – Desktop-Ambiente Quickfix
   - Lichtrichtung-Panel in WIDE/Desktop wirklich öffnen
   - Readout nicht mehr über dem Titel
   - Lichtkreis sauber sichtbar
   -------------------------------------------------------------------------- */
@media (min-width: 1180px) {
  html[data-ui-mode="wide"] .light-angle-panel {
    max-height: none !important;
    overflow: visible !important;
    padding-top: 8px !important;
    padding-bottom: 11px !important;
  }

  html[data-ui-mode="wide"] .light-angle-head {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: center !important;
    column-gap: 10px !important;
    row-gap: 2px !important;
    margin: 0 0 8px !important;
    padding: 0 2px !important;
  }

  html[data-ui-mode="wide"] .light-angle-head > span {
    min-width: 0;
    color: rgba(255,255,255,.58) !important;
    font-size: 8px !important;
    letter-spacing: .14em !important;
    text-transform: uppercase !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  html[data-ui-mode="wide"] .light-angle-head > strong {
    justify-self: end !important;
    color: rgba(255,255,255,.92) !important;
    font-size: 9px !important;
    letter-spacing: .04em !important;
    white-space: nowrap !important;
  }

  html[data-ui-mode="wide"] .light-dial {
    width: 122px !important;
    height: 122px !important;
    margin: 0 auto 2px !important;
  }
  html[data-ui-mode="wide"] .dial-ring { inset: 12px !important; }
  html[data-ui-mode="wide"] .dial-cross-h { width: 92px !important; }
  html[data-ui-mode="wide"] .dial-cross-v { height: 92px !important; }
}


/* --------------------------------------------------------------------------
   05.2.1 – TABLET STATUSPANEL
   Nur MEDIUM: Spielerinfos nebeneinander, Kontext darunter. Desktop und Phone
   bleiben auf ihrem freigegebenen Stand.
   -------------------------------------------------------------------------- */
html[data-ui-mode="medium"] .player-panel {
  left: max(12px, env(safe-area-inset-left)) !important;
  top: max(58px, calc(env(safe-area-inset-top) + 52px)) !important;
  transform: none !important;
  width: clamp(258px, 31vw, 286px) !important;
  max-height: none !important;
  padding: 7px !important;
  border-radius: 18px !important;
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 6px !important;
  pointer-events: none;
}

html[data-ui-mode="medium"] .player-row,
html[data-ui-mode="medium"] .player-row + .player-row {
  margin: 0 !important;
  min-height: 62px !important;
  padding: 7px 7px !important;
  grid-template-columns: 28px minmax(0,1fr) !important;
  grid-template-rows: auto auto !important;
  align-items: center !important;
  column-gap: 7px !important;
  row-gap: 1px !important;
  border-radius: 14px !important;
}

html[data-ui-mode="medium"] .player-row.active {
  transform: none !important;
}

html[data-ui-mode="medium"] .player-stone {
  grid-column: 1 !important;
  grid-row: 1 / 3 !important;
  width: 27px !important;
  height: 27px !important;
}

html[data-ui-mode="medium"] .player-copy {
  grid-column: 2 !important;
  grid-row: 1 !important;
  min-width: 0 !important;
}

html[data-ui-mode="medium"] .player-name {
  font-size: 9px !important;
  letter-spacing: .09em !important;
  white-space: nowrap !important;
}

html[data-ui-mode="medium"] .player-meta {
  margin-top: 3px !important;
  font-size: 8px !important;
  line-height: 1.15 !important;
  white-space: nowrap !important;
}

html[data-ui-mode="medium"] .player-state {
  display: block !important;
  grid-column: 2 !important;
  grid-row: 2 !important;
  justify-self: start !important;
  align-self: end !important;
  margin-top: 2px !important;
  font-size: 7px !important;
  line-height: 1 !important;
  letter-spacing: .08em !important;
  white-space: nowrap !important;
}

html[data-ui-mode="medium"] .selection-strip {
  grid-column: 1 / -1 !important;
  margin: 0 !important;
  padding: 7px 9px 6px !important;
  border-top: 1px solid rgba(255,255,255,.08) !important;
  text-align: center !important;
  min-width: 0 !important;
}

html[data-ui-mode="medium"] .selection-label,
html[data-ui-mode="medium"] .match-phase {
  display: none !important;
}

html[data-ui-mode="medium"] .status-context {
  display: block !important;
  margin: 0 !important;
  color: rgba(255,255,255,.90) !important;
  font-size: 9px !important;
  font-weight: 700 !important;
  line-height: 1.25 !important;
  white-space: normal !important;
}

html[data-ui-mode="medium"] .selection-strip strong {
  display: none !important;
}


/* --------------------------------------------------------------------------
   05.2.2 – TABLET HORIZONTAL STATUSPANEL
   MEDIUM/Tablet: Statuspanel folgt jetzt dem Desktop-Prinzip.
   HELL links, Phase/Hinweis mittig, DUNKEL rechts.
   Die Leerstelle neben dem Statuspanel wird damit sinnvoll genutzt.
   -------------------------------------------------------------------------- */
html[data-ui-mode="medium"] .player-panel {
  left: max(12px, env(safe-area-inset-left)) !important;
  top: max(58px, calc(env(safe-area-inset-top) + 52px)) !important;
  transform: none !important;
  width: min(650px, calc(100vw - max(12px, env(safe-area-inset-left)) - clamp(202px, 25vw, 236px) - max(12px, env(safe-area-inset-right)) - 18px)) !important;
  max-width: calc(100vw - max(12px, env(safe-area-inset-left)) - clamp(202px, 25vw, 236px) - max(12px, env(safe-area-inset-right)) - 18px) !important;
  max-height: none !important;
  padding: 8px 10px !important;
  border-radius: 20px !important;
  display: grid !important;
  grid-template-columns: minmax(150px, 1fr) minmax(180px, 1.12fr) minmax(150px, 1fr) !important;
  align-items: center !important;
  gap: 8px !important;
  pointer-events: none !important;
}

html[data-ui-mode="medium"] .player-light,
html[data-ui-mode="medium"] .selection-strip,
html[data-ui-mode="medium"] .player-dark {
  align-self: center !important;
  margin: 0 !important;
}

html[data-ui-mode="medium"] .player-row,
html[data-ui-mode="medium"] .player-row + .player-row {
  min-height: 50px !important;
  padding: 6px 8px !important;
  margin: 0 !important;
  grid-template-columns: 30px minmax(0,1fr) auto !important;
  grid-template-rows: auto !important;
  align-items: center !important;
  gap: 7px !important;
  border-radius: 15px !important;
}

html[data-ui-mode="medium"] .player-row.active {
  transform: none !important;
}

html[data-ui-mode="medium"] .player-stone {
  width: 28px !important;
  height: 28px !important;
}

html[data-ui-mode="medium"] .player-copy {
  min-width: 0 !important;
}

html[data-ui-mode="medium"] .player-name,
html[data-ui-mode="medium"] .player-meta,
html[data-ui-mode="medium"] .player-state {
  white-space: nowrap !important;
}

html[data-ui-mode="medium"] .player-name {
  font-size: 10px !important;
  letter-spacing: .09em !important;
}

html[data-ui-mode="medium"] .player-meta {
  margin-top: 3px !important;
  font-size: 8px !important;
}

html[data-ui-mode="medium"] .player-state {
  font-size: 8px !important;
  line-height: 1 !important;
  letter-spacing: .08em !important;
}

html[data-ui-mode="medium"] .selection-strip {
  margin: 0 !important;
  min-height: 50px !important;
  padding: 6px 10px !important;
  border-top: 0 !important;
  border-left: 1px solid rgba(255,255,255,.08) !important;
  border-right: 1px solid rgba(255,255,255,.08) !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 3px !important;
  text-align: center !important;
  min-width: 0 !important;
}

html[data-ui-mode="medium"] .match-phase {
  display: block !important;
  color: var(--text-main) !important;
  font-size: 10px !important;
  font-weight: 800 !important;
  letter-spacing: .10em !important;
  line-height: 1.05 !important;
  white-space: nowrap !important;
}

html[data-ui-mode="medium"] .status-context {
  display: block !important;
  margin: 0 !important;
  color: rgba(255,255,255,.90) !important;
  font-size: 10px !important;
  font-weight: 700 !important;
  line-height: 1.18 !important;
  letter-spacing: .01em !important;
  max-width: 100% !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

html[data-ui-mode="medium"] .selection-label,
html[data-ui-mode="medium"] .selection-strip strong {
  display: none !important;
}

/* Gegenseite gespiegelt: Stein außen, Status innen. */
html[data-ui-mode="medium"] .player-dark {
  grid-template-columns: auto minmax(0,1fr) 30px !important;
}
html[data-ui-mode="medium"] .player-dark .player-state {
  grid-column: 1 !important;
  grid-row: 1 !important;
  justify-self: start !important;
  text-align: left !important;
}
html[data-ui-mode="medium"] .player-dark .player-copy {
  grid-column: 2 !important;
  grid-row: 1 !important;
  text-align: right !important;
}
html[data-ui-mode="medium"] .player-dark .player-stone {
  grid-column: 3 !important;
  grid-row: 1 !important;
}


/* --------------------------------------------------------------------------
   05.2.3 – Tablet Status volle Breite + Ambiente tiefer/kompakter
   MEDIUM/Tablet:
   - Statuspanel nutzt jetzt die verfügbare Breite ähnlich wie auf Desktop
   - Phase + Hinweis stehen mittig und gut lesbar
   - Ambiente-Panel sitzt etwas tiefer, damit es das Statuspanel nicht überlappt
   - Ambiente bleibt rechts, wirkt aber kompakter und weniger dominant
   -------------------------------------------------------------------------- */
html[data-ui-mode="medium"] .player-panel {
  left: max(12px, env(safe-area-inset-left)) !important;
  right: max(12px, env(safe-area-inset-right)) !important;
  top: max(58px, calc(env(safe-area-inset-top) + 52px)) !important;
  transform: none !important;
  width: auto !important;
  max-width: none !important;
  padding: 10px 12px !important;
  border-radius: 22px !important;
  display: grid !important;
  grid-template-columns: minmax(170px, 1fr) minmax(260px, 1.28fr) minmax(170px, 1fr) !important;
  align-items: center !important;
  gap: 10px !important;
}

html[data-ui-mode="medium"] .player-row,
html[data-ui-mode="medium"] .player-row + .player-row {
  min-height: 56px !important;
  padding: 7px 10px !important;
  grid-template-columns: 32px minmax(0,1fr) auto !important;
  gap: 8px !important;
  border-radius: 16px !important;
}

html[data-ui-mode="medium"] .player-stone {
  width: 30px !important;
  height: 30px !important;
}

html[data-ui-mode="medium"] .player-name {
  font-size: 11px !important;
  letter-spacing: .10em !important;
}

html[data-ui-mode="medium"] .player-meta {
  margin-top: 3px !important;
  font-size: 9px !important;
}

html[data-ui-mode="medium"] .player-state {
  font-size: 8px !important;
  letter-spacing: .08em !important;
}

html[data-ui-mode="medium"] .selection-strip {
  min-height: 56px !important;
  padding: 6px 14px !important;
  border-left: 1px solid rgba(255,255,255,.08) !important;
  border-right: 1px solid rgba(255,255,255,.08) !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 4px !important;
  text-align: center !important;
}

html[data-ui-mode="medium"] .match-phase {
  display: block !important;
  color: var(--text-main) !important;
  font-size: 12px !important;
  font-weight: 800 !important;
  letter-spacing: .10em !important;
  line-height: 1 !important;
  white-space: nowrap !important;
}

html[data-ui-mode="medium"] .status-context {
  display: block !important;
  margin: 0 !important;
  color: rgba(255,255,255,.92) !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  line-height: 1.22 !important;
  letter-spacing: .01em !important;
  white-space: normal !important;
  text-wrap: balance;
  max-width: min(40ch, 100%) !important;
}

html[data-ui-mode="medium"] .selection-label,
html[data-ui-mode="medium"] .selection-strip strong {
  display: none !important;
}

html[data-ui-mode="medium"] .player-dark {
  grid-template-columns: auto minmax(0,1fr) 32px !important;
}
html[data-ui-mode="medium"] .player-dark .player-copy {
  text-align: right !important;
}

html[data-ui-mode="medium"] .ambiente-panel {
  right: max(12px, env(safe-area-inset-right)) !important;
  top: max(156px, calc(env(safe-area-inset-top) + 150px)) !important;
  bottom: auto !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: calc(var(--stable-app-height, 100dvh) - max(156px, calc(env(safe-area-inset-top) + 150px)) - 18px) !important;
  overflow-y: auto !important;
  overscroll-behavior: contain !important;
  width: clamp(188px, 22vw, 220px) !important;
  min-width: 188px !important;
  max-width: 220px !important;
  padding: 8px 8px 10px !important;
  border-radius: 18px !important;
}

html[data-ui-mode="medium"] .ambiente-head {
  padding-bottom: 6px !important;
}

html[data-ui-mode="medium"] .ambiente-row {
  min-height: 36px !important;
}

html[data-ui-mode="medium"] .view-control-row {
  min-height: 76px !important;
  grid-template-columns: minmax(0,1fr) 46px !important;
  gap: 4px !important;
}

html[data-ui-mode="medium"] .view-slider-wrap {
  height: 68px !important;
}

html[data-ui-mode="medium"] .view-slider {
  width: 58px !important;
}

html[data-ui-mode="medium"] .preset-row {
  min-height: 60px !important;
}

html[data-ui-mode="medium"] .preset-controls {
  grid-template-columns: repeat(3, 26px) !important;
  row-gap: 4px !important;
}

html[data-ui-mode="medium"] .music-row,
html[data-ui-mode="medium"] .sound-row {
  min-height: 34px !important;
}

/* ==========================================================================
   05.2.5.9 – KONSOLIDIERUNG AMBIENTE TABLET / COMPACT
   Ein einziger Regelblock ersetzt die sich widersprechenden 05.2.5.1–05.2.5.8
   Overrides. Damit benutzt dasselbe Tablet bei „Desktop-Website AUS“ und
   „Desktop-Website EIN“ dieselbe Ambiente-Geometrie.
   ========================================================================== */

/* HTML-Struktur aus 05.2.5.1: Musik + Sound in einer Zeile. */
.audio-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.audio-control {
  display: grid;
  grid-template-columns: auto minmax(0,1fr);
  align-items: center;
  gap: 5px;
  min-width: 0;
}
.audio-control .ambiente-value { width: 100%; min-width: 0; }

/* Der externe Slider ist grundsätzlich verborgen und wird auf Tablet/Compact
   nur gemeinsam mit dem geöffneten Ambiente-Panel gezeigt. */
.view-slider-float { display: none; }

/* --------------------------------------------------------------------------
   GEMEINSAMES TABLET-LAYOUT
   tablet-normal-05244 ist die entscheidende Geräteklasse. Dadurch bleibt die
   Geometrie gleich, egal ob der Browser intern compact oder medium meldet.
   Compact ohne Tabletklasse (Smartphone) erhält dasselbe kompakte Bedienprinzip.
   -------------------------------------------------------------------------- */
html.tablet-normal-05244 .ambiente-panel,
html[data-ui-mode="compact"] .ambiente-panel {
  right: max(8px, env(safe-area-inset-right)) !important;
  top: 94px !important;
  bottom: auto !important;
  width: 286px !important;
  height: min(352px, calc(100vh - 156px)) !important;
  max-height: 352px !important;
  padding: 10px 12px 9px !important;
  border-radius: 22px !important;
  overflow: hidden !important;
  transform: translateX(12px) scale(.985) !important;
}
html.tablet-normal-05244 .ambiente-panel.open,
html[data-ui-mode="compact"] .ambiente-panel.open {
  transform: translateX(0) scale(1) !important;
}
html.tablet-normal-05244 .ambiente-head,
html[data-ui-mode="compact"] .ambiente-head {
  min-height: 42px !important;
  padding: 1px 1px 7px !important;
}
html.tablet-normal-05244 .ambiente-head strong,
html[data-ui-mode="compact"] .ambiente-head strong {
  font-size: 12px !important;
}
html.tablet-normal-05244 .ambiente-panel .view-control-row,
html[data-ui-mode="compact"] .ambiente-panel .view-control-row {
  display: none !important;
}
html.tablet-normal-05244 .ambiente-row,
html[data-ui-mode="compact"] .ambiente-row {
  min-height: 0 !important;
}

/* SKIN / LICHT: ein festes Raster. HOLZ, WEICH und RICHTUNG sind wirklich
   exakt gleich gross. Genug Luft verhindert Abschneiden im medium-Viewport. */
html.tablet-normal-05244 .skin-row,
html[data-ui-mode="compact"] .skin-row {
  display: grid !important;
  grid-template-columns: 50px 92px 92px !important;
  column-gap: 7px !important;
  align-items: center !important;
  min-height: 39px !important;
  padding-block: 3px !important;
}
html.tablet-normal-05244 .light-row,
html[data-ui-mode="compact"] .light-row {
  display: grid !important;
  grid-template-columns: 50px 92px 92px !important;
  column-gap: 7px !important;
  align-items: center !important;
  min-height: 39px !important;
  padding-block: 3px !important;
}
html.tablet-normal-05244 .skin-row .ambiente-label,
html.tablet-normal-05244 .light-row .ambiente-label,
html[data-ui-mode="compact"] .skin-row .ambiente-label,
html[data-ui-mode="compact"] .light-row .ambiente-label {
  grid-column: 1 !important;
  font-size: 8px !important;
  letter-spacing: .08em !important;
  white-space: nowrap !important;
}
html.tablet-normal-05244 .skin-row .ambiente-value,
html[data-ui-mode="compact"] .skin-row .ambiente-value {
  grid-column: 2 !important;
}
html.tablet-normal-05244 .light-row .ambiente-value,
html[data-ui-mode="compact"] .light-row .ambiente-value {
  grid-column: 2 !important;
}
html.tablet-normal-05244 .light-row #light-angle-toggle,
html[data-ui-mode="compact"] .light-row #light-angle-toggle {
  display: inline-flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: static !important;
  grid-column: 3 !important;
  pointer-events: auto !important;
}
html.tablet-normal-05244 .skin-row .ambiente-value,
html.tablet-normal-05244 .light-row .ambiente-value,
html.tablet-normal-05244 .light-row #light-angle-toggle,
html[data-ui-mode="compact"] .skin-row .ambiente-value,
html[data-ui-mode="compact"] .light-row .ambiente-value,
html[data-ui-mode="compact"] .light-row #light-angle-toggle {
  width: 92px !important;
  min-width: 92px !important;
  max-width: 92px !important;
  height: 32px !important;
  min-height: 32px !important;
  margin: 0 !important;
  padding: 0 7px !important;
  border-radius: 999px !important;
  box-sizing: border-box !important;
  align-items: center !important;
  justify-content: center !important;
  justify-self: start !important;
  font-size: 8px !important;
  font-weight: 800 !important;
  letter-spacing: .035em !important;
  line-height: 1 !important;
  white-space: nowrap !important;
}

/* Presets: breit nutzen, aber nicht aufblasen. */
html.tablet-normal-05244 .preset-row,
html[data-ui-mode="compact"] .preset-row {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 3px !important;
  padding-block: 4px !important;
}
html.tablet-normal-05244 .preset-row .ambiente-copy,
html[data-ui-mode="compact"] .preset-row .ambiente-copy {
  display: grid !important;
  grid-template-columns: auto 1fr !important;
  align-items: baseline !important;
  gap: 6px !important;
}
html.tablet-normal-05244 .preset-row .ambiente-copy .ambiente-label,
html[data-ui-mode="compact"] .preset-row .ambiente-copy .ambiente-label {
  font-size: 8px !important;
}
html.tablet-normal-05244 .preset-row .ambiente-copy small,
html[data-ui-mode="compact"] .preset-row .ambiente-copy small {
  margin: 0 !important;
  text-align: right !important;
  font-size: 8px !important;
  white-space: nowrap !important;
}
html.tablet-normal-05244 .preset-controls,
html[data-ui-mode="compact"] .preset-controls {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 6px !important;
  width: 100% !important;
}
html.tablet-normal-05244 .preset-slot,
html[data-ui-mode="compact"] .preset-slot {
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  height: 30px !important;
  min-height: 30px !important;
  padding: 0 !important;
  margin: 0 !important;
  border-radius: 999px !important;
  font-size: 9px !important;
  line-height: 1 !important;
}
html.tablet-normal-05244 .preset-save,
html[data-ui-mode="compact"] .preset-save {
  grid-column: 1 / -1 !important;
  width: 100% !important;
  height: 31px !important;
  min-height: 31px !important;
  padding: 0 10px !important;
  font-size: 8px !important;
  line-height: 1 !important;
}

/* Musik + Sound in einer einzigen, niedrigen Zeile. */
html.tablet-normal-05244 .audio-row,
html[data-ui-mode="compact"] .audio-row {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 8px !important;
  min-height: 34px !important;
  padding-block: 4px !important;
}
html.tablet-normal-05244 .audio-control,
html[data-ui-mode="compact"] .audio-control {
  display: grid !important;
  grid-template-columns: auto minmax(0,1fr) !important;
  align-items: center !important;
  gap: 5px !important;
}
html.tablet-normal-05244 .audio-control .ambiente-label,
html[data-ui-mode="compact"] .audio-control .ambiente-label {
  font-size: 8px !important;
}
html.tablet-normal-05244 .audio-control .ambiente-value,
html[data-ui-mode="compact"] .audio-control .ambiente-value {
  width: 100% !important;
  min-width: 0 !important;
  height: 30px !important;
  min-height: 30px !important;
  padding: 0 6px !important;
  font-size: 8px !important;
  line-height: 1 !important;
}
html.tablet-normal-05244 .ambiente-dev,
html[data-ui-mode="compact"] .ambiente-dev {
  min-height: 28px !important;
  padding-top: 5px !important;
  font-size: 7px !important;
}
html.tablet-normal-05244 .ambiente-dev .ambiente-mini,
html[data-ui-mode="compact"] .ambiente-dev .ambiente-mini {
  height: 28px !important;
  min-height: 28px !important;
  padding: 0 9px !important;
  font-size: 8px !important;
}

/* LICHTRICHTUNG ist eine Unteransicht und im Standardpanel vollständig weg. */
html.tablet-normal-05244 .ambiente-panel .light-angle-panel,
html[data-ui-mode="compact"] .ambiente-panel .light-angle-panel {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  position: relative !important;
  max-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  border: 0 !important;
}
html.tablet-normal-05244 .ambiente-panel.light-mode > .ambiente-row,
html.tablet-normal-05244 .ambiente-panel.light-mode > .ambiente-dev,
html[data-ui-mode="compact"] .ambiente-panel.light-mode > .ambiente-row,
html[data-ui-mode="compact"] .ambiente-panel.light-mode > .ambiente-dev {
  display: none !important;
}
html.tablet-normal-05244 .ambiente-panel.light-mode .light-angle-panel,
html[data-ui-mode="compact"] .ambiente-panel.light-mode .light-angle-panel {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  position: relative !important;
  max-height: none !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 7px 0 0 !important;
  overflow: visible !important;
  border-top: 1px solid rgba(255,255,255,.07) !important;
  transform: none !important;
}
html.tablet-normal-05244 .ambiente-panel.light-mode .light-back,
html[data-ui-mode="compact"] .ambiente-panel.light-mode .light-back {
  display: grid !important;
}
html.tablet-normal-05244 .ambiente-panel.light-mode .light-angle-head,
html[data-ui-mode="compact"] .ambiente-panel.light-mode .light-angle-head {
  margin-bottom: 7px !important;
  grid-template-columns: auto 1fr auto !important;
}
html.tablet-normal-05244 .ambiente-panel.light-mode .light-dial,
html[data-ui-mode="compact"] .ambiente-panel.light-mode .light-dial {
  width: 124px !important;
  height: 124px !important;
}
html.tablet-normal-05244 .ambiente-panel.light-mode .light-angle-actions,
html[data-ui-mode="compact"] .ambiente-panel.light-mode .light-angle-actions {
  margin-top: 7px !important;
  gap: 8px !important;
}
html.tablet-normal-05244 .ambiente-panel.light-mode .microcopy,
html[data-ui-mode="compact"] .ambiente-panel.light-mode .microcopy {
  display: none !important;
}

/* Linkes Sliderpanel: der freigegebene Stand aus 05.2.5.4 bleibt unverändert. */
html.tablet-normal-05244 #ambiente-panel.open + .view-slider-float,
html[data-ui-mode="compact"] #ambiente-panel.open + .view-slider-float {
  display: block !important;
}
html.tablet-normal-05244 .view-slider-float,
html[data-ui-mode="compact"] .view-slider-float {
  display: none !important;
  position: fixed !important;
  z-index: 23 !important;
  left: max(8px, env(safe-area-inset-left)) !important;
  top: 54% !important;
  transform: translateY(-50%) !important;
  width: 58px !important;
  height: 220px !important;
  padding: 0 !important;
  border-radius: 22px !important;
  overflow: hidden !important;
}
html.tablet-normal-05244 .view-slider-float .view-slider-caption,
html[data-ui-mode="compact"] .view-slider-float .view-slider-caption {
  position: absolute !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  z-index: 2 !important;
  font-size: 8px !important;
  font-weight: 700 !important;
  letter-spacing: .05em !important;
  line-height: 1 !important;
  color: rgba(255,255,255,.78) !important;
  white-space: nowrap !important;
}
html.tablet-normal-05244 .view-slider-float .view-slider-caption-top,
html[data-ui-mode="compact"] .view-slider-float .view-slider-caption-top { top: 13px !important; }
html.tablet-normal-05244 .view-slider-float .view-slider-caption-bottom,
html[data-ui-mode="compact"] .view-slider-float .view-slider-caption-bottom { bottom: 13px !important; }
html.tablet-normal-05244 .view-slider-float .view-slider,
html[data-ui-mode="compact"] .view-slider-float .view-slider {
  position: absolute !important;
  left: 50% !important;
  top: 50% !important;
  width: 154px !important;
  height: 30px !important;
  margin: 0 !important;
  transform: translate(-50%, -50%) rotate(-90deg) !important;
  transform-origin: center center !important;
  touch-action: none !important;
  accent-color: rgba(255,255,255,.94) !important;
}


/* ==========================================================================
   05.2.6.0 – RICHTUNG unter WEICH
   Tablet / kompakt: der Richtungsbutton sitzt unter dem Licht-Button,
   gleiche Breite/Höhe/Schriftgrösse, damit das Ambiente-Panel ruhiger wirkt.
   ========================================================================== */
html.tablet-normal-05244 .light-row,
html[data-ui-mode="compact"] .light-row {
  display: grid !important;
  grid-template-columns: 50px 92px !important;
  grid-template-rows: 32px 32px !important;
  column-gap: 7px !important;
  row-gap: 6px !important;
  align-items: center !important;
  min-height: 74px !important;
  padding-block: 3px !important;
}
html.tablet-normal-05244 .light-row .ambiente-label,
html[data-ui-mode="compact"] .light-row .ambiente-label {
  grid-column: 1 !important;
  grid-row: 1 / span 2 !important;
  align-self: center !important;
}
html.tablet-normal-05244 .light-row .ambiente-value,
html[data-ui-mode="compact"] .light-row .ambiente-value {
  grid-column: 2 !important;
  grid-row: 1 !important;
}
html.tablet-normal-05244 .light-row #light-angle-toggle,
html[data-ui-mode="compact"] .light-row #light-angle-toggle {
  grid-column: 2 !important;
  grid-row: 2 !important;
  display: inline-flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: static !important;
  pointer-events: auto !important;
}
html.tablet-normal-05244 .light-row .ambiente-value,
html.tablet-normal-05244 .light-row #light-angle-toggle,
html[data-ui-mode="compact"] .light-row .ambiente-value,
html[data-ui-mode="compact"] .light-row #light-angle-toggle {
  width: 92px !important;
  min-width: 92px !important;
  max-width: 92px !important;
  height: 32px !important;
  min-height: 32px !important;
  justify-self: start !important;
}

/* Ein wenig Reserve im Preset-Block, damit die Reihen nach unten sauber anschliessen. */
html.tablet-normal-05244 .preset-row,
html[data-ui-mode="compact"] .preset-row {
  padding-top: 5px !important;
}


/* ==========================================================================
   05.2.6.1 – Overlay-Polish für Tablet / Desktop-Website EIN+AUS
   - Slider links und Ambiente rechts mit gleichem Seitenabstand
   - beide Overlays auf derselben vertikalen Mitte
   - alle sichtbaren Panels leicht transparenter und gleichmässiger
   - gilt für tablet-normal-05244 sowie compact/medium Viewports
   ========================================================================== */

/* Gemeinsame Seitenabstände + transparentere Overlay-Flächen */
html.tablet-normal-05244 .player-panel,
html.tablet-normal-05244 .panel-controls,
html.tablet-normal-05244 .ambiente-panel,
html.tablet-normal-05244 .view-slider-float,
html[data-ui-mode="compact"] .player-panel,
html[data-ui-mode="compact"] .panel-controls,
html[data-ui-mode="compact"] .ambiente-panel,
html[data-ui-mode="compact"] .view-slider-float,
html[data-ui-mode="medium"] .player-panel,
html[data-ui-mode="medium"] .panel-controls,
html[data-ui-mode="medium"] .ambiente-panel,
html[data-ui-mode="medium"] .view-slider-float {
  background: rgba(20, 15, 10, 0.35) !important;
  border-color: rgba(255,255,255,0.17) !important;
  backdrop-filter: blur(10px) saturate(0.96) !important;
  -webkit-backdrop-filter: blur(10px) saturate(0.96) !important;
}

/* Seitliche Bündigkeit der beiden Overlay-Panels links/rechts. */
html.tablet-normal-05244 .view-slider-float,
html[data-ui-mode="compact"] .view-slider-float,
html[data-ui-mode="medium"] .view-slider-float {
  left: calc(env(safe-area-inset-left) + 12px) !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
}
html.tablet-normal-05244 #ambiente-panel.open + .view-slider-float,
html[data-ui-mode="compact"] #ambiente-panel.open + .view-slider-float,
html[data-ui-mode="medium"] #ambiente-panel.open + .view-slider-float {
  display: block !important;
}

html.tablet-normal-05244 .ambiente-panel,
html[data-ui-mode="compact"] .ambiente-panel,
html[data-ui-mode="medium"] .ambiente-panel {
  right: calc(env(safe-area-inset-right) + 12px) !important;
  top: 50% !important;
  bottom: auto !important;
  height: min(352px, calc(100vh - 232px)) !important;
  max-height: 352px !important;
  transform: translate(12px, -50%) scale(.985) !important;
}
html.tablet-normal-05244 .ambiente-panel.open,
html[data-ui-mode="compact"] .ambiente-panel.open,
html[data-ui-mode="medium"] .ambiente-panel.open {
  transform: translate(0, -50%) scale(1) !important;
}

/* Die Haupt-Panels oben/unten optisch an dieselbe Transparenz angleichen. */
html.tablet-normal-05244 .player-row.active,
html[data-ui-mode="compact"] .player-row.active,
html[data-ui-mode="medium"] .player-row.active {
  background: rgba(255,255,255,0.075) !important;
}

/* Medium soll denselben Ambiente-Randabstand und dieselbe Buttonsprache nutzen. */
html[data-ui-mode="medium"] .skin-row {
  display: grid !important;
  grid-template-columns: 50px 92px !important;
  column-gap: 7px !important;
  align-items: center !important;
  min-height: 39px !important;
  padding-block: 3px !important;
}
html[data-ui-mode="medium"] .light-row {
  display: grid !important;
  grid-template-columns: 50px 92px !important;
  grid-template-rows: 32px 32px !important;
  column-gap: 7px !important;
  row-gap: 6px !important;
  align-items: center !important;
  min-height: 74px !important;
  padding-block: 3px !important;
}
html[data-ui-mode="medium"] .skin-row .ambiente-label,
html[data-ui-mode="medium"] .light-row .ambiente-label {
  grid-column: 1 !important;
  font-size: 8px !important;
  letter-spacing: .08em !important;
  white-space: nowrap !important;
}
html[data-ui-mode="medium"] .light-row .ambiente-label {
  grid-row: 1 / span 2 !important;
  align-self: center !important;
}
html[data-ui-mode="medium"] .skin-row .ambiente-value {
  grid-column: 2 !important;
}
html[data-ui-mode="medium"] .light-row .ambiente-value {
  grid-column: 2 !important;
  grid-row: 1 !important;
}
html[data-ui-mode="medium"] .light-row #light-angle-toggle {
  grid-column: 2 !important;
  grid-row: 2 !important;
  display: inline-flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: static !important;
  pointer-events: auto !important;
}
html[data-ui-mode="medium"] .skin-row .ambiente-value,
html[data-ui-mode="medium"] .light-row .ambiente-value,
html[data-ui-mode="medium"] .light-row #light-angle-toggle {
  width: 92px !important;
  min-width: 92px !important;
  max-width: 92px !important;
  height: 32px !important;
  min-height: 32px !important;
  margin: 0 !important;
  padding: 0 7px !important;
  border-radius: 999px !important;
  box-sizing: border-box !important;
  align-items: center !important;
  justify-content: center !important;
  justify-self: start !important;
  font-size: 8px !important;
  font-weight: 800 !important;
  letter-spacing: .035em !important;
  line-height: 1 !important;
  white-space: nowrap !important;
}
html[data-ui-mode="medium"] .preset-row {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 3px !important;
  padding-block: 4px !important;
}
html[data-ui-mode="medium"] .preset-row .ambiente-copy {
  display: grid !important;
  grid-template-columns: auto 1fr !important;
  align-items: baseline !important;
  gap: 6px !important;
}
html[data-ui-mode="medium"] .preset-row .ambiente-copy .ambiente-label,
html[data-ui-mode="medium"] .preset-row .ambiente-copy small,
html[data-ui-mode="medium"] .audio-control .ambiente-label {
  font-size: 8px !important;
}
html[data-ui-mode="medium"] .preset-row .ambiente-copy small {
  margin: 0 !important;
  text-align: right !important;
  white-space: nowrap !important;
}
html[data-ui-mode="medium"] .preset-controls {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 6px !important;
  width: 100% !important;
}
html[data-ui-mode="medium"] .preset-slot {
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  height: 30px !important;
  min-height: 30px !important;
  padding: 0 !important;
  margin: 0 !important;
  border-radius: 999px !important;
  font-size: 9px !important;
  line-height: 1 !important;
}
html[data-ui-mode="medium"] .preset-save {
  grid-column: 1 / -1 !important;
  width: 100% !important;
  height: 31px !important;
  min-height: 31px !important;
  padding: 0 10px !important;
  font-size: 8px !important;
  line-height: 1 !important;
}
html[data-ui-mode="medium"] .audio-row {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 8px !important;
  min-height: 34px !important;
  padding-block: 4px !important;
}
html[data-ui-mode="medium"] .audio-control {
  display: grid !important;
  grid-template-columns: auto minmax(0,1fr) !important;
  align-items: center !important;
  gap: 5px !important;
}
html[data-ui-mode="medium"] .audio-control .ambiente-value {
  width: 100% !important;
  min-width: 0 !important;
  height: 30px !important;
  min-height: 30px !important;
  padding: 0 6px !important;
  font-size: 8px !important;
  line-height: 1 !important;
}
html[data-ui-mode="medium"] .ambiente-dev {
  min-height: 28px !important;
  padding-top: 5px !important;
  font-size: 7px !important;
}
html[data-ui-mode="medium"] .ambiente-dev .ambiente-mini {
  height: 28px !important;
  min-height: 28px !important;
  padding: 0 9px !important;
  font-size: 8px !important;
}
html[data-ui-mode="medium"] .ambiente-panel .light-angle-panel {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  position: relative !important;
  max-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  border: 0 !important;
}
html[data-ui-mode="medium"] .ambiente-panel.light-mode > .ambiente-row,
html[data-ui-mode="medium"] .ambiente-panel.light-mode > .ambiente-dev {
  display: none !important;
}
html[data-ui-mode="medium"] .ambiente-panel.light-mode .light-angle-panel {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  position: relative !important;
  max-height: none !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 7px 0 0 !important;
  overflow: visible !important;
  border-top: 1px solid rgba(255,255,255,.07) !important;
  transform: none !important;
}
html[data-ui-mode="medium"] .ambiente-panel.light-mode .light-back {
  display: grid !important;
}
html[data-ui-mode="medium"] .ambiente-panel.light-mode .light-angle-head {
  margin-bottom: 7px !important;
  grid-template-columns: auto 1fr auto !important;
}
html[data-ui-mode="medium"] .ambiente-panel.light-mode .light-dial {
  width: 124px !important;
  height: 124px !important;
}
html[data-ui-mode="medium"] .ambiente-panel.light-mode .light-angle-actions {
  margin-top: 7px !important;
  gap: 8px !important;
}
html[data-ui-mode="medium"] .ambiente-panel.light-mode .microcopy {
  display: none !important;
}


/* ==========================================================================
   05.2.6.2 – Geometrie-Fix Ambiente-Panel
   05.2.6.1 hat das Panel mathematisch um die Bildschirmmitte zentriert und
   dadurch in einigen Tablet/Compact-Konstellationen oben abgeschnitten.
   Jetzt liegt das Panel wieder im freien Spielraum zwischen Status oben und
   Buttonleiste unten, mit identischem rechtem Randabstand wie zuvor.
   Slider links bleibt bewusst unverändert.
   ========================================================================== */
html.tablet-normal-05244 .ambiente-panel,
html[data-ui-mode="compact"] .ambiente-panel,
html[data-ui-mode="medium"] .ambiente-panel {
  right: calc(env(safe-area-inset-right) + 12px) !important;
  top: clamp(104px, calc(50% - 150px), 170px) !important;
  bottom: auto !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: calc(100vh - 178px) !important;
  overflow-y: auto !important;
  overscroll-behavior: contain !important;
  transform: translateX(12px) scale(.985) !important;
  transform-origin: center right !important;
}
html.tablet-normal-05244 .ambiente-panel.open,
html[data-ui-mode="compact"] .ambiente-panel.open,
html[data-ui-mode="medium"] .ambiente-panel.open {
  transform: translateX(0) scale(1) !important;
}

/* Kleine inhaltliche Reserve nach oben/unten, damit Kopf und Fuss sicher im
   sichtbaren Bereich bleiben, selbst wenn Desktop-Website EIN/AUS umschaltet. */
html.tablet-normal-05244 .ambiente-panel .ambiente-head,
html[data-ui-mode="compact"] .ambiente-panel .ambiente-head,
html[data-ui-mode="medium"] .ambiente-panel .ambiente-head {
  padding-top: 2px !important;
}
html.tablet-normal-05244 .ambiente-panel .ambiente-dev,
html[data-ui-mode="compact"] .ambiente-panel .ambiente-dev,
html[data-ui-mode="medium"] .ambiente-panel .ambiente-dev {
  padding-bottom: 2px !important;
}


/* ==========================================================================
   05.2.6.3 – Ambiente-Panel sauber einpassen
   - Entwicklung/FREI auf Tablet-/Touch-Layouts ausgeblendet
   - Slider links und Ambiente rechts werden per JS im freien Raum zwischen
     Statuspanel oben und Buttonpanel unten zentriert
   - dadurch gleiche obere/untere Luft statt grober top-Schätzwerte
   ========================================================================== */
html.tablet-normal-05244 .ambiente-dev,
html[data-ui-mode="compact"] .ambiente-dev,
html[data-ui-mode="medium"] .ambiente-dev {
  display: none !important;
}
html.tablet-normal-05244 .view-slider-float,
html[data-ui-mode="compact"] .view-slider-float,
html[data-ui-mode="medium"] .view-slider-float {
  transform: none !important;
}
html.tablet-normal-05244 .ambiente-panel,
html[data-ui-mode="compact"] .ambiente-panel,
html[data-ui-mode="medium"] .ambiente-panel {
  overflow-y: auto !important;
  overscroll-behavior: contain !important;
}


/* ==========================================================================
   05.2.6.4 – alte Positionszwänge endgültig neutralisiert
   Die vertikale Position wird auf Tablet/compact/medium durch JS aus den
   realen Kanten von Status- und Spielebutton-Panel berechnet.
   ========================================================================== */
html.tablet-normal-05244 .ambiente-dev,
html[data-ui-mode="compact"] .ambiente-dev,
html[data-ui-mode="medium"] .ambiente-dev {
  display: none !important;
}


/* ==========================================================================
   05.2.6.5 – Startmenü Compact-Fix
   Nur DESKTOP WEBSITE AUS / compact: die Konfiguration wird so verdichtet,
   dass PARTIE STARTEN, ZURÜCK und Hinweis vollständig im sichtbaren Bereich
   bleiben. Desktop-Website EIN / medium bleibt unverändert.
   ========================================================================== */
html[data-ui-mode="compact"] .start-screen {
  place-items: center !important;
  padding-top: max(8px, env(safe-area-inset-top)) !important;
  padding-bottom: max(8px, env(safe-area-inset-bottom)) !important;
}
html[data-ui-mode="compact"] .start-card {
  width: min(calc(100vw - 16px), 470px) !important;
  max-height: calc(var(--stable-app-height, 100dvh) - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) !important;
  padding: 15px 16px 13px !important;
  border-radius: 18px !important;
  overflow-y: auto !important;
}
html[data-ui-mode="compact"] .start-kicker {
  margin-bottom: 3px !important;
  font-size: 9px !important;
}
html[data-ui-mode="compact"] .start-card h1 {
  font-size: 25px !important;
}
html[data-ui-mode="compact"] .start-subtitle {
  margin: 7px auto 11px !important;
  font-size: 11px !important;
  line-height: 1.25 !important;
}
html[data-ui-mode="compact"] .start-choice-label {
  margin-bottom: 5px !important;
  font-size: 9px !important;
}
html[data-ui-mode="compact"] .difficulty-grid {
  gap: 5px !important;
}
html[data-ui-mode="compact"] .difficulty-button {
  min-height: 52px !important;
  padding: 6px 4px !important;
  border-radius: 12px !important;
}
html[data-ui-mode="compact"] .difficulty-button strong {
  font-size: 10px !important;
}
html[data-ui-mode="compact"] .difficulty-button span {
  margin-top: 3px !important;
  font-size: 8px !important;
}
html[data-ui-mode="compact"] .color-choice-group {
  margin-top: 10px !important;
}
html[data-ui-mode="compact"] .color-grid {
  gap: 6px !important;
}
html[data-ui-mode="compact"] .color-button {
  min-height: 51px !important;
  padding: 6px 8px !important;
  gap: 7px !important;
  border-radius: 12px !important;
}
html[data-ui-mode="compact"] .color-button strong {
  font-size: 10px !important;
}
html[data-ui-mode="compact"] .color-button small {
  margin-top: 2px !important;
  font-size: 8px !important;
}
html[data-ui-mode="compact"] .color-rule-note {
  margin-top: 5px !important;
  font-size: 9px !important;
}
html[data-ui-mode="compact"] .start-stone {
  width: 20px !important;
  height: 20px !important;
}
html[data-ui-mode="compact"] .start-matchup {
  gap: 6px !important;
  margin: 9px 0 8px !important;
  padding: 8px 9px !important;
  border-radius: 13px !important;
}
html[data-ui-mode="compact"] .start-side {
  gap: 6px !important;
}
html[data-ui-mode="compact"] .start-side small {
  font-size: 8px !important;
}
html[data-ui-mode="compact"] .start-side strong {
  font-size: 10px !important;
}
html[data-ui-mode="compact"] .start-vs {
  font-size: 8px !important;
}
html[data-ui-mode="compact"] .start-button,
html[data-ui-mode="compact"] .start-secondary {
  min-height: 40px !important;
  border-radius: 12px !important;
  font-size: 10px !important;
}
html[data-ui-mode="compact"] #start-back:not([hidden]) {
  margin-top: 6px !important;
}
html[data-ui-mode="compact"] .start-note {
  margin-top: 5px !important;
  min-height: 12px !important;
  font-size: 9px !important;
}


/* ========================================================================== 
   05.2.6.6 – Startmenü: kein Flash + echte horizontale Zentrierung
   Die 05.2.6.5-Karte war mit 100vw berechnet, während der Start-Screen links
   und rechts zusätzlich Padding hatte. Dadurch war die Karte breiter als die
   tatsächlich verfügbare Grid-Fläche und wirkte seitlich versetzt.
   ========================================================================== */
html[data-ui-mode="compact"] .start-screen {
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  padding-left: max(8px, env(safe-area-inset-left)) !important;
  padding-right: max(8px, env(safe-area-inset-right)) !important;
  justify-items: center !important;
  align-items: center !important;
}
html[data-ui-mode="compact"] .start-card {
  width: min(100%, 470px) !important;
  margin-left: auto !important;
  margin-right: auto !important;
}


/* ==========================================================================
   05.2.6.7 – Kameraruckler-Fix
   Keine Geometrieänderung. Ambiente öffnen/schließen ist ab jetzt reine UI
   und verändert Kamera/Target nicht mehr.
   ========================================================================== */


/* ========================================================================== 
   05.2.7.0 – Tablet Landscape Vollbild
   Portrait/Smartphone bleiben unverändert. Im Querformat erscheint auf dem
   erkannten Tablet ein VOLLBILD-Button. Im echten Browser-Vollbild wird das
   Statuspanel auf eine flache Einzeilen-Anordnung umgebaut, damit das Brett
   nicht mehr vom HUD verdeckt wird.
   ========================================================================== */
.fullscreen-toggle { display: none; }

@media (orientation: landscape) {
  html.tablet-normal-05244 .panel-controls .fullscreen-toggle {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
}

/* Vollbild auf Tablet-Landscape: Browser-Chrome ist weg, die komplette
   Bildschirmhöhe gehört dem Spiel. */
@media (orientation: landscape) {
  html.tablet-normal-05244.landscape-fullscreen-05270,
  html.tablet-normal-05244.landscape-fullscreen-05270 body,
  html.tablet-normal-05244.landscape-fullscreen-05270 #app {
    width: 100% !important;
    height: 100dvh !important;
    min-height: 100dvh !important;
    max-height: 100dvh !important;
  }

  /* Status wird im Querformat zu einer einzigen flachen Zeile:
     HELL | Phase/Anweisung | DUNKEL. */
  html.tablet-normal-05244.landscape-fullscreen-05270 .player-panel {
    left: 50% !important;
    right: auto !important;
    top: max(6px, env(safe-area-inset-top)) !important;
    transform: translateX(-50%) !important;
    width: min(calc(100vw - 20px), 980px) !important;
    padding: 5px 7px !important;
    grid-template-columns: minmax(0,1fr) minmax(180px,1.15fr) minmax(0,1fr) !important;
    grid-template-rows: 42px !important;
    column-gap: 8px !important;
    align-items: center !important;
    border-radius: 18px !important;
  }

  html.tablet-normal-05244.landscape-fullscreen-05270 .player-light {
    grid-column: 1 !important;
    grid-row: 1 !important;
  }
  html.tablet-normal-05244.landscape-fullscreen-05270 .selection-strip {
    grid-column: 2 !important;
    grid-row: 1 !important;
    margin: 0 !important;
    padding: 2px 8px !important;
    border-top: 0 !important;
    border-left: 1px solid rgba(255,255,255,.08) !important;
    border-right: 1px solid rgba(255,255,255,.08) !important;
    min-height: 34px !important;
    align-self: center !important;
  }
  html.tablet-normal-05244.landscape-fullscreen-05270 .player-dark {
    grid-column: 3 !important;
    grid-row: 1 !important;
  }

  html.tablet-normal-05244.landscape-fullscreen-05270 .player-row,
  html.tablet-normal-05244.landscape-fullscreen-05270 .player-row + .player-row {
    min-height: 38px !important;
    height: 38px !important;
    padding: 3px 6px !important;
    gap: 7px !important;
  }
  html.tablet-normal-05244.landscape-fullscreen-05270 .player-stone {
    width: 25px !important;
    height: 25px !important;
  }
  html.tablet-normal-05244.landscape-fullscreen-05270 .player-dark .player-stone {
    width: 26px !important;
    height: 26px !important;
  }
  html.tablet-normal-05244.landscape-fullscreen-05270 .player-name {
    font-size: 9px !important;
  }
  html.tablet-normal-05244.landscape-fullscreen-05270 .player-meta,
  html.tablet-normal-05244.landscape-fullscreen-05270 .player-state {
    font-size: 7px !important;
  }
  html.tablet-normal-05244.landscape-fullscreen-05270 .match-phase {
    font-size: 9px !important;
  }
  html.tablet-normal-05244.landscape-fullscreen-05270 .status-context {
    font-size: 9px !important;
    line-height: 1.05 !important;
    white-space: nowrap !important;
  }

  /* Untere Bedienleiste bleibt kompakt und vollständig sichtbar. */
  html.tablet-normal-05244.landscape-fullscreen-05270 .panel-controls {
    bottom: max(6px, env(safe-area-inset-bottom)) !important;
    padding: 6px 8px !important;
    gap: 6px !important;
    border-radius: 18px !important;
    width: auto !important;
    max-width: calc(100vw - 20px) !important;
  }
  html.tablet-normal-05244.landscape-fullscreen-05270 .panel-controls .btn-primary {
    min-width: 88px !important;
    height: 32px !important;
    min-height: 32px !important;
    padding: 0 10px !important;
    font-size: 8px !important;
  }

  /* Die Zubehör-Panels werden weiterhin durch die gemessene freie Zone aus
     05.2.6.4 positioniert. Im Vollbild darf der Slider etwas kürzer werden,
     falls die verfügbare Höhe knapp ist. */
  html.tablet-normal-05244.landscape-fullscreen-05270 .view-slider-float {
    max-height: calc(100dvh - 116px) !important;
  }
  html.tablet-normal-05244.landscape-fullscreen-05270 .ambiente-panel {
    max-height: calc(100dvh - 116px) !important;
  }
}


/* ========================================================================== 
   05.2.7.1 – Desktop Ambiente/HUD Feinschliff
   Nur WIDE/Desktop. Tablet/Smartphone und Landscape-Vollbild bleiben unberührt.
   ========================================================================== */
@media (min-width: 1180px) {
  /* Statuspanel: gleicher Außenabstand oben wie die Spielebuttons unten. */
  html[data-ui-mode="wide"] .player-panel {
    top: max(14px, env(safe-area-inset-top)) !important;
  }

  /* Ambiente bleibt rechts im grünen Spielfeld. Die exakte vertikale Position
     wird in main.js zwischen Statuspanel und Buttonpanel gemessen/zentriert. */
  html[data-ui-mode="wide"] .ambiente-panel {
    right: max(14px, env(safe-area-inset-right)) !important;
    width: 312px !important;
    min-width: 312px !important;
    max-width: 312px !important;
    border-radius: 24px !important;
    overflow-y: auto !important;
  }

  /* Ansicht: konstante Bezeichnung links, längerer vertikaler Regler rechts. */
  html[data-ui-mode="wide"] .view-control-row {
    min-height: 136px !important;
    grid-template-columns: 92px 88px !important;
    justify-content: start !important;
    column-gap: 18px !important;
    align-items: center !important;
  }
  html[data-ui-mode="wide"] .ambiente-copy-view strong {
    margin-top: 0 !important;
  }
  html[data-ui-mode="wide"] .view-slider-wrap {
    height: 126px !important;
    grid-template-rows: auto 1fr auto !important;
    gap: 10px !important;
  }
  html[data-ui-mode="wide"] .view-slider {
    width: 94px !important;
  }
  html[data-ui-mode="wide"] .view-slider-caption {
    font-size: 7px !important;
    line-height: 1 !important;
  }

  /* Material und Licht als exakt gleichartige Hauptbuttons. */
  html[data-ui-mode="wide"] .skin-row,
  html[data-ui-mode="wide"] .light-row {
    grid-template-columns: 72px 150px !important;
    column-gap: 10px !important;
    justify-content: start !important;
    min-height: 48px !important;
  }
  html[data-ui-mode="wide"] .skin-row .ambiente-label,
  html[data-ui-mode="wide"] .light-row .ambiente-label {
    grid-column: 1 !important;
  }
  html[data-ui-mode="wide"] .skin-row .ambiente-value,
  html[data-ui-mode="wide"] .light-row .ambiente-value {
    grid-column: 2 !important;
    width: 150px !important;
    min-width: 150px !important;
    max-width: 150px !important;
    height: 34px !important;
    min-height: 34px !important;
    padding: 0 10px !important;
    border-radius: 999px !important;
    justify-self: start !important;
  }
}


/* ==========================================================================
   05.2.7.2 – Startscreen-Reparatur
   Die WIDE-Ambiente-Vermessung wird erst nach geschlossenem Startscreen aktiv.
   Desktop-Feinschliff aus 05.2.7.1 bleibt ansonsten unverändert.
   ========================================================================== */


/* ==========================================================================
   05.2.7.4 – Desktop Ambiente Typografie + Scrollbar-Fix
   Nur WIDE/Desktop. Sonstige Layouts bleiben unverändert.
   ========================================================================== */
@media (min-width: 1180px) {
  html[data-ui-mode="wide"] .ambiente-panel {
    overflow: hidden !important;
    scrollbar-width: none !important;
  }
  html[data-ui-mode="wide"] .ambiente-panel::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
  }

  /* ANSICHT ist die Referenzgröße für alle Rubrik-Labels. */
  html[data-ui-mode="wide"] .ambiente-copy-view strong,
  html[data-ui-mode="wide"] .skin-row .ambiente-label,
  html[data-ui-mode="wide"] .light-row .ambiente-label,
  html[data-ui-mode="wide"] .light-angle-head > span,
  html[data-ui-mode="wide"] .preset-row .ambiente-label,
  html[data-ui-mode="wide"] .audio-control .ambiente-label {
    font-size: 11px !important;
    line-height: 1.1 !important;
    letter-spacing: .08em !important;
    font-weight: 700 !important;
  }
}


/* ==========================================================================
   05.2.7.5 – Desktop Ambiente Label-Kontrast
   Nur WIDE/Desktop: alle Rubrik-Labels erhalten exakt die visuelle Gewichtung
   von ANSICHT. Tablet/Smartphone bleiben unverändert.
   ========================================================================== */
@media (min-width: 1180px) {
  html[data-ui-mode="wide"] .ambiente-copy-view strong,
  html[data-ui-mode="wide"] .skin-row .ambiente-label,
  html[data-ui-mode="wide"] .light-row .ambiente-label,
  html[data-ui-mode="wide"] .light-angle-head > span,
  html[data-ui-mode="wide"] .preset-row .ambiente-label,
  html[data-ui-mode="wide"] .audio-control .ambiente-label {
    color: var(--text-main) !important;
    opacity: 1 !important;
    font-weight: 700 !important;
  }
}


/* ==========================================================================
   05.2.7.6 – Desktop Ambiente Feinschliff II
   Nur WIDE/Desktop. Tablet/Smartphone bleiben unverändert.
   - LICHTRICHTUNG exakt bündig mit den übrigen Rubrik-Labels
   - Hilfstexte besser lesbar
   - Preset-Hinweis auf einer Zeile
   - RESET/RILLEN/PRESET-Buttons folgen der 34px-Höhe von HOLZ/WEICH
   ========================================================================== */
@media (min-width: 1180px) {
  /* Einheitliche linke Startkante aller Rubrik-Labels. */
  html[data-ui-mode="wide"] .ambiente-copy-view strong,
  html[data-ui-mode="wide"] .skin-row .ambiente-label,
  html[data-ui-mode="wide"] .light-row .ambiente-label,
  html[data-ui-mode="wide"] .light-angle-head,
  html[data-ui-mode="wide"] .preset-row .ambiente-copy,
  html[data-ui-mode="wide"] .audio-control .ambiente-label {
    margin-left: 0 !important;
    padding-left: 0 !important;
  }
  html[data-ui-mode="wide"] .light-angle-head {
    padding-right: 0 !important;
  }

  /* Sekundärtexte: fast Label-Größe, aber leichteres Gewicht und normaler Satz. */
  html[data-ui-mode="wide"] .light-angle-panel .microcopy,
  html[data-ui-mode="wide"] .preset-row .ambiente-copy small {
    color: rgba(255,255,255,.62) !important;
    opacity: 1 !important;
    font-size: 10px !important;
    line-height: 1.25 !important;
    font-weight: 400 !important;
    letter-spacing: .01em !important;
    text-transform: none !important;
  }

  /* PRESET: Titel + Hilfe links, Hinweis garantiert einzeilig. */
  html[data-ui-mode="wide"] .preset-row {
    grid-template-columns: minmax(130px, 1fr) 160px !important;
    column-gap: 14px !important;
    min-height: 78px !important;
    padding-block: 7px !important;
  }
  html[data-ui-mode="wide"] .preset-row .ambiente-copy {
    min-width: 0 !important;
  }
  html[data-ui-mode="wide"] .preset-row .ambiente-copy small {
    white-space: nowrap !important;
    margin-top: 6px !important;
  }
  html[data-ui-mode="wide"] .preset-controls {
    grid-template-columns: repeat(3, 34px) !important;
    gap: 8px !important;
    justify-content: end !important;
    align-items: center !important;
  }

  /* Gemeinsames Button-System: 34px Höhe wie HOLZ/WEICH. */
  html[data-ui-mode="wide"] .light-angle-actions button,
  html[data-ui-mode="wide"] .preset-slot,
  html[data-ui-mode="wide"] .preset-save {
    height: 34px !important;
    min-height: 34px !important;
    border-radius: 999px !important;
    box-sizing: border-box !important;
    font-size: 9px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
  }
  html[data-ui-mode="wide"] .light-angle-actions button {
    min-width: 82px !important;
    padding: 0 13px !important;
  }
  html[data-ui-mode="wide"] .preset-slot {
    width: 34px !important;
    min-width: 34px !important;
    max-width: 34px !important;
    padding: 0 !important;
  }
  html[data-ui-mode="wide"] .preset-save {
    grid-column: 1 / -1 !important;
    width: 100% !important;
    min-width: 0 !important;
    padding: 0 12px !important;
    margin-top: 1px !important;
  }
}


/* ==========================================================================
   05.2.7.7 – Desktop Ambiente Feinschliff III
   Nur WIDE/Desktop.
   - DRAUF/SCHRÄG visuell an die übrigen Beschriftungen angeglichen
   - PRESET-Buttons rechts bündig und ohne Abschneiden
   ========================================================================== */
@media (min-width: 1180px) {
  /* DRAUF/SCHRÄG: besser lesbar und in derselben visuellen Familie wie die
     übrigen Umfeldbeschriftungen. */
  html[data-ui-mode="wide"] .view-slider-caption {
    color: rgba(255,255,255,.62) !important;
    opacity: 1 !important;
    font-size: 8px !important;
    font-weight: 500 !important;
    letter-spacing: .06em !important;
    line-height: 1 !important;
  }
  html[data-ui-mode="wide"] .view-slider-wrap {
    gap: 12px !important;
  }

  /* PRESET: linke Textspalte flexibel, rechte Buttonspalte fix und bündig
     zum rechten Rand der übrigen Bedienelemente. */
  html[data-ui-mode="wide"] .preset-row {
    grid-template-columns: minmax(0, 1fr) 126px !important;
    column-gap: 12px !important;
  }
  html[data-ui-mode="wide"] .preset-row .ambiente-copy {
    min-width: 0 !important;
    padding-right: 0 !important;
  }
  html[data-ui-mode="wide"] .preset-controls {
    width: 126px !important;
    min-width: 126px !important;
    max-width: 126px !important;
    justify-self: end !important;
    grid-template-columns: repeat(3, 34px) !important;
    grid-auto-rows: 34px !important;
    gap: 8px !important;
    justify-content: end !important;
    align-items: center !important;
    box-sizing: border-box !important;
  }
  html[data-ui-mode="wide"] .preset-slot,
  html[data-ui-mode="wide"] .preset-save {
    justify-self: stretch !important;
  }
}


/* ==========================================================================
   05.2.8.1 – Zoomsteuerung
   Desktop/WIDE: zwei vertikale Regler nebeneinander im Bereich ANSICHT.
   Tablet/Compact: externer linker Reglerblock mit Neigung + Zoom nebeneinander.
   ========================================================================== */

/* Gemeinsame Struktur der beiden vertikalen Regler. */
.view-dual-sliders {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}
.view-slider-channel {
  min-width: 0;
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
  justify-items: center;
  align-items: center;
  gap: 10px;
}
.view-slider-channel .view-slider {
  align-self: center;
}

@media (min-width: 1180px) {
  html[data-ui-mode="wide"] .view-control-row {
    grid-template-columns: 82px minmax(0, 1fr) !important;
    column-gap: 14px !important;
    min-height: 142px !important;
  }
  html[data-ui-mode="wide"] .view-dual-sliders {
    width: 176px !important;
    height: 132px !important;
    gap: 16px !important;
  }
  html[data-ui-mode="wide"] .view-slider-channel {
    height: 132px !important;
    gap: 11px !important;
  }
  html[data-ui-mode="wide"] .view-slider-channel .view-slider {
    width: 96px !important;
  }
  html[data-ui-mode="wide"] .view-slider-channel .view-slider-caption {
    font-size: 8px !important;
    color: rgba(255,255,255,.62) !important;
    opacity: 1 !important;
    font-weight: 500 !important;
    letter-spacing: .06em !important;
  }
}

/* Tablet/Compact: zwei vertikale Regler im externen linken Panel. */
html.tablet-normal-05244 .view-slider-float,
html[data-ui-mode="compact"] .view-slider-float,
html[data-ui-mode="medium"] .view-slider-float {
  width: 116px !important;
  display: none !important;
  grid-template-columns: 1fr 1fr !important;
  padding: 0 5px !important;
}
html.tablet-normal-05244 #ambiente-panel.open + .view-slider-float,
html[data-ui-mode="compact"] #ambiente-panel.open + .view-slider-float,
html[data-ui-mode="medium"] #ambiente-panel.open + .view-slider-float {
  display: grid !important;
}
html.tablet-normal-05244 .view-slider-float-channel,
html[data-ui-mode="compact"] .view-slider-float-channel,
html[data-ui-mode="medium"] .view-slider-float-channel {
  position: relative !important;
  min-width: 0 !important;
  height: 100% !important;
}
html.tablet-normal-05244 .view-slider-float-channel .view-slider-caption,
html[data-ui-mode="compact"] .view-slider-float-channel .view-slider-caption,
html[data-ui-mode="medium"] .view-slider-float-channel .view-slider-caption {
  position: absolute !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  z-index: 2 !important;
  font-size: 8px !important;
  font-weight: 700 !important;
  letter-spacing: .05em !important;
  line-height: 1 !important;
  color: rgba(255,255,255,.78) !important;
  white-space: nowrap !important;
}
html.tablet-normal-05244 .view-slider-float-channel .view-slider-caption-top,
html[data-ui-mode="compact"] .view-slider-float-channel .view-slider-caption-top,
html[data-ui-mode="medium"] .view-slider-float-channel .view-slider-caption-top {
  top: 13px !important;
}
html.tablet-normal-05244 .view-slider-float-channel .view-slider-caption-bottom,
html[data-ui-mode="compact"] .view-slider-float-channel .view-slider-caption-bottom,
html[data-ui-mode="medium"] .view-slider-float-channel .view-slider-caption-bottom {
  bottom: 13px !important;
}
html.tablet-normal-05244 .view-slider-float-channel .view-slider,
html[data-ui-mode="compact"] .view-slider-float-channel .view-slider,
html[data-ui-mode="medium"] .view-slider-float-channel .view-slider {
  position: absolute !important;
  left: 50% !important;
  top: 50% !important;
  width: 154px !important;
  height: 30px !important;
  margin: 0 !important;
  transform: translate(-50%, -50%) rotate(-90deg) !important;
  transform-origin: center center !important;
  touch-action: none !important;
  accent-color: rgba(255,255,255,.94) !important;
}


/* ==========================================================================
   05.2.8.2 – Outfit + Desktop/4K Typografie
   Outfit wird projektweit zur Hauptschrift. Tablet/Compact behalten ihre
   bisherigen Größen; WIDE/Desktop erhält eine moderat größere Typografie,
   damit das Interface auf großen/hochauflösenden Monitoren nicht ausdünnt.
   ========================================================================== */
body, button, input, select, textarea {
  font-family: "Outfit", Arial, Helvetica, sans-serif;
}

@media (min-width: 1180px) {
  html[data-ui-mode="wide"] .player-name { font-size: 14px !important; }
  html[data-ui-mode="wide"] .player-meta { font-size: 11px !important; }
  html[data-ui-mode="wide"] .player-state { font-size: 10px !important; }
  html[data-ui-mode="wide"] .match-phase { font-size: 12px !important; }
  html[data-ui-mode="wide"] .status-context { font-size: 12px !important; }
  html[data-ui-mode="wide"] .selection-strip strong { font-size: 11px !important; }

  html[data-ui-mode="wide"] .panel-controls .btn-primary {
    font-size: 11px !important;
    letter-spacing: .075em !important;
  }

  html[data-ui-mode="wide"] .ambiente-head strong { font-size: 13px !important; }
  html[data-ui-mode="wide"] .ambiente-copy-view strong,
  html[data-ui-mode="wide"] .skin-row .ambiente-label,
  html[data-ui-mode="wide"] .light-row .ambiente-label,
  html[data-ui-mode="wide"] .light-angle-head > span,
  html[data-ui-mode="wide"] .preset-row .ambiente-label,
  html[data-ui-mode="wide"] .audio-control .ambiente-label {
    font-size: 12px !important;
    letter-spacing: .07em !important;
  }
  html[data-ui-mode="wide"] .ambiente-value,
  html[data-ui-mode="wide"] .ambiente-mini,
  html[data-ui-mode="wide"] .light-angle-actions button,
  html[data-ui-mode="wide"] .preset-slot,
  html[data-ui-mode="wide"] .preset-save {
    font-size: 10px !important;
  }
  html[data-ui-mode="wide"] .view-slider-channel .view-slider-caption {
    font-size: 9px !important;
  }
  html[data-ui-mode="wide"] .light-angle-panel .microcopy,
  html[data-ui-mode="wide"] .preset-row .ambiente-copy small {
    font-size: 11px !important;
  }
}

/* Zusätzliche, bewusst kleine Stufe für sehr breite Desktop-Viewports. */
@media (min-width: 2400px) {
  html[data-ui-mode="wide"] .player-name { font-size: 15px !important; }
  html[data-ui-mode="wide"] .player-meta { font-size: 12px !important; }
  html[data-ui-mode="wide"] .match-phase { font-size: 13px !important; }
  html[data-ui-mode="wide"] .status-context { font-size: 13px !important; }
  html[data-ui-mode="wide"] .panel-controls .btn-primary { font-size: 12px !important; }
  html[data-ui-mode="wide"] .ambiente-head strong { font-size: 14px !important; }
  html[data-ui-mode="wide"] .ambiente-copy-view strong,
  html[data-ui-mode="wide"] .skin-row .ambiente-label,
  html[data-ui-mode="wide"] .light-row .ambiente-label,
  html[data-ui-mode="wide"] .light-angle-head > span,
  html[data-ui-mode="wide"] .preset-row .ambiente-label,
  html[data-ui-mode="wide"] .audio-control .ambiente-label {
    font-size: 13px !important;
  }
  html[data-ui-mode="wide"] .ambiente-value,
  html[data-ui-mode="wide"] .ambiente-mini,
  html[data-ui-mode="wide"] .light-angle-actions button,
  html[data-ui-mode="wide"] .preset-slot,
  html[data-ui-mode="wide"] .preset-save { font-size: 11px !important; }
  html[data-ui-mode="wide"] .view-slider-channel .view-slider-caption { font-size: 10px !important; }
  html[data-ui-mode="wide"] .light-angle-panel .microcopy,
  html[data-ui-mode="wide"] .preset-row .ambiente-copy small { font-size: 12px !important; }
}


/* ==========================================================================
   05.2.9.0 – Sieginszenierung
   Elegant und kurz: warmer Lichtimpuls, ohne Konfetti.
   Niederlagen bleiben bewusst ruhig. Keine zusätzlichen Assets erforderlich.
   ========================================================================== */
.result-screen { overflow: hidden; }
.result-card { position: relative; z-index: 2; }
.result-screen.celebrating::before {
  content: "";
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 50%;
  width: min(78vw, 760px);
  aspect-ratio: 1;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(.72);
  background: radial-gradient(circle, rgba(238,205,132,.22) 0%, rgba(220,181,102,.09) 34%, rgba(220,181,102,0) 70%);
  opacity: 0;
  pointer-events: none;
  animation: resultVictoryGlow 1.8s ease-out both;
}
.result-screen.celebrating .result-card.win {
  animation: resultVictoryCard 1.25s cubic-bezier(.2,.8,.2,1) both;
}
.result-screen.celebrating .result-card.win .result-emblem {
  animation: resultVictoryEmblem 1.05s cubic-bezier(.2,.8,.2,1) .08s both;
}
@keyframes resultVictoryGlow {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.68); }
  28% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.08); }
}
@keyframes resultVictoryCard {
  0% { transform: translateY(14px) scale(.965); filter: brightness(.9); }
  38% { transform: translateY(-2px) scale(1.018); filter: brightness(1.08); }
  100% { transform: translateY(0) scale(1); filter: brightness(1); }
}
@keyframes resultVictoryEmblem {
  0% { transform: scale(.72) rotate(-12deg); box-shadow: 0 0 0 rgba(221,190,123,0); }
  42% { transform: scale(1.16) rotate(4deg); box-shadow: 0 0 30px rgba(221,190,123,.22); }
  100% { transform: scale(1) rotate(0); box-shadow: 0 0 0 rgba(221,190,123,0); }
}
@media (prefers-reduced-motion: reduce) {
  .result-screen.celebrating::before,
  .result-screen.celebrating .result-card.win,
  .result-screen.celebrating .result-card.win .result-emblem { animation: none !important; }
}


/* ==========================================================================
   05.2.9.1 – Zurückhaltendes Start-Intro
   Keine Layoutänderung: nur etwas weniger starke Hintergrundweichzeichnung,
   damit die langsame Kamerafahrt hinter der Startkarte dezent wahrnehmbar ist.
   ========================================================================== */
.start-screen {
  backdrop-filter: blur(6px) saturate(.92);
  -webkit-backdrop-filter: blur(6px) saturate(.92);
}
@media (max-width: 1179px) {
  .start-screen {
    backdrop-filter: blur(7px) saturate(.9);
    -webkit-backdrop-filter: blur(7px) saturate(.9);
  }
}


/* ==========================================================================
   05.2.9.5 – Definierter Intro-Auftakt
   Kurzer Fade von Schwarz. Das Menü bleibt während der Kamerafahrt vollkommen
   ruhig; nur die Szene dahinter wird sichtbar.
   ========================================================================== */
.start-screen.intro-black-fade::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  background: #050504;
  animation: startIntroBlackFade 920ms cubic-bezier(.22,.61,.36,1) forwards;
}
@keyframes startIntroBlackFade {
  0%, 14% { opacity: 1; }
  100% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .start-screen.intro-black-fade::after { display: none !important; }
}

/* 05.2.9.6: Intro-Kamera mobil deaktiviert; Desktop-Timing in main.js. */

/* ==========================================================================
   05.2.9.8 – Fade-Endzustand
   Nach dem schwarzen Auftakt wird die Fade-Schicht vollständig entfernt.
   Auf Desktop bleibt die Szene hinter der ruhenden Startkarte klar sichtbar.
   ========================================================================== */
html[data-ui-mode="wide"] .start-screen.intro-scene-visible {
  background: rgba(12, 14, 13, 0.16);
  backdrop-filter: blur(1.5px) saturate(.96);
  -webkit-backdrop-filter: blur(1.5px) saturate(.96);
}


/* CHESS_BASE_V001 ---------------------------------------------------------
   Safe fork of the proven Mühle UI CSS. Historical responsive rules are
   intentionally retained in V001; cleanup is deferred until visual parity
   has been verified on the real Wix desktop/tablet targets. */
#app[data-build="CHESS_BASE_V001"] .selection-strip strong:empty,
#app[data-build="CHESS_BASE_V001"] .selection-label { display:none; }
#app[data-build="CHESS_BASE_V001"] #undo { opacity:.56; cursor:default; }


/* --------------------------------------------------------------------------
   CHESS_BASE_V004 – INPUT SAFETY: CLOSED AMBIENTE MUST BE PHYSICALLY NON-INTERACTIVE
   A child may otherwise override a parent's pointer-events:none with
   pointer-events:auto (several responsive light-direction rules do exactly that).
   -------------------------------------------------------------------------- */
.ambiente-panel:not(.open),
.ambiente-panel:not(.open) * {
  pointer-events: none !important;
}


/* CHESS_BASE_V027 – difficulty, undo and optional chess clock */
.difficulty-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.clock-choice-group { margin-top: 16px; }
.start-choice-label small { font-size: 10px; font-weight: 500; letter-spacing: .04em; text-transform: none; color: rgba(255,255,255,.38); }
.clock-grid { display:grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap:7px; }
.clock-button { min-height:48px; padding:8px 5px; border:1px solid rgba(255,255,255,.10); border-radius:12px; background:rgba(255,255,255,.05); color:rgba(255,255,255,.72); cursor:pointer; }
.clock-button strong,.clock-button span { display:block; }
.clock-button strong { font-size:13px; letter-spacing:.06em; }
.clock-button span { margin-top:2px; font-size:9px; color:rgba(255,255,255,.40); }
.clock-button.active { border-color:rgba(232,214,176,.58); background:rgba(232,214,176,.14); color:#fff8e9; box-shadow:inset 0 0 0 1px rgba(232,214,176,.08); }
.player-clock { display:block; margin-top:2px; font-variant-numeric:tabular-nums; font-size:17px; line-height:1; font-weight:800; letter-spacing:.05em; color:rgba(255,255,255,.82); }
.player-row.active .player-clock { color:#fff8e9; }
.player-clock.clock-low { color:#f0c98a; }
.player-clock.clock-critical { color:#ff9d8f; }
.btn-undo:not(:disabled) { border-color:rgba(232,214,176,.42); }
@media (max-width: 700px) {
  .difficulty-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .difficulty-button { min-height:58px; }
  .clock-grid { gap:5px; }
  .clock-button { min-height:42px; padding:6px 3px; }
  .clock-button strong { font-size:12px; }
}
html[data-ui-mode="medium"] .player-clock, html.tablet-normal-05244 .player-clock { font-size:14px; }
html[data-ui-mode="compact"] .player-clock { font-size:12px; }

.player-clock[hidden]{display:none!important;}
html[data-ui-mode="compact"] .clock-choice-group{margin-top:9px!important;}
html[data-ui-mode="compact"] .clock-grid{gap:4px!important;}
html[data-ui-mode="compact"] .clock-button{min-height:36px!important;padding:4px 2px!important;border-radius:10px!important;}
html[data-ui-mode="compact"] .clock-button strong{font-size:10px!important;}
html[data-ui-mode="compact"] .clock-button span{font-size:7px!important;}


/* CHESS_BASE_V028 – calm top panel
   Remove redundant side labels and keep only side identity + timer.
   Difficulty lives in the middle, together with the move/status message. */
.player-meta,
.player-state,
.selection-label,
.selection-strip strong {
  display: none !important;
}

.player-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.player-name {
  margin: 0 !important;
}

.player-clock {
  margin-top: 4px;
}

.match-phase {
  display: block !important;
}

.selection-strip {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 3px !important;
}

html[data-ui-mode="wide"] .selection-strip,
html[data-ui-mode="medium"] .selection-strip,
html[data-ui-mode="compact"] .selection-strip,
html.tablet-normal-05244 .selection-strip {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 3px !important;
}

html[data-ui-mode="wide"] .match-phase,
html[data-ui-mode="medium"] .match-phase,
html[data-ui-mode="compact"] .match-phase,
html.tablet-normal-05244 .match-phase {
  display: block !important;
}

html[data-ui-mode="wide"] .status-context,
html[data-ui-mode="medium"] .status-context,
html[data-ui-mode="compact"] .status-context,
html.tablet-normal-05244 .status-context {
  margin: 0 !important;
}

/* Putz-Schach V110: Spielersteine in den Figurenfarben (Weiss = Orange, Schwarz = Blau) */
.player-stone-light, .start-stone-light {
  background: radial-gradient(circle at 35% 30%, #ffb27a 0%, #f26a12 55%, #b84b06 100%) !important;
  box-shadow: inset 0 0 0 2px rgba(255,194,26,.85), 0 2px 6px rgba(0,0,0,.35) !important;
}
.player-stone-dark, .start-stone-dark {
  background: radial-gradient(circle at 35% 30%, #8fb4ff 0%, #1d5fd6 55%, #0f3a8a 100%) !important;
  box-shadow: inset 0 0 0 2px rgba(92,200,242,.85), 0 2px 6px rgba(0,0,0,.35) !important;
}
