* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --bg: #0a0a0a;
  --surface: rgba(20, 20, 20, 0.92);
  --accent: #2196F3;
  --accent-dim: rgba(33, 150, 243, 0.3);
  --text: #e0e0e0;
  --text-dim: #888;
  --danger: #f44336;
  --success: #4CAF50;
  --warn: #FF9800;
}

html, body {
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

/* ===== Login Screen ===== */
#login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #0a0a0a 0%, #111827 50%, #0a0a0a 100%);
  z-index: 1000;
}

#login-screen.hidden { display: none; }

.login-card {
  text-align: center;
  width: 280px;
}

.login-logo {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 3px;
  margin-bottom: 2.5rem;
  opacity: 0.7;
}

.login-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.mode-title {
  display: block;
  font-size: 0.8rem;
  color: var(--text-dim);
  letter-spacing: 3px;
  margin-bottom: 12px;
  text-transform: uppercase;
}

.password-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  margin-bottom: 8px;
}

.password-section input {
  flex: 1;
  padding: 14px 16px;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font-size: 1.1rem;
  text-align: center;
  letter-spacing: 6px;
  outline: none;
  transition: border-color 0.2s;
}

.password-section input:focus {
  border-color: var(--accent);
  background: rgba(255,255,255,0.06);
}

.login-submit {
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.2s;
}

.login-submit:active {
  opacity: 0.8;
}

.login-divider {
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, #333, transparent);
  margin: 1.8rem 0;
}

.login-or {
  color: var(--text-dim);
  font-size: 0.85rem;
  letter-spacing: 2px;
  margin: 1.2rem 0;
  position: relative;
  width: 100%;
  text-align: center;
}

.login-or::before,
.login-or::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 35%;
  height: 1px;
  background: linear-gradient(90deg, transparent, #333);
}

.login-or::before {
  left: 0;
  background: linear-gradient(90deg, transparent, #333);
}

.login-or::after {
  right: 0;
  background: linear-gradient(270deg, transparent, #333);
}

.viewer-btn {
  width: 100%;
  padding: 14px;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
  background: transparent;
  color: var(--text-dim);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 2px;
  cursor: pointer;
  transition: all 0.2s;
}

.viewer-btn:active {
  background: rgba(255,255,255,0.06);
  border-color: var(--text-dim);
  color: var(--text);
}

.login-error {
  color: var(--danger);
  font-size: 0.8rem;
  text-align: center;
  min-height: 1.2em;
  margin-top: 1rem;
}

#password-section.hidden {
  display: none;
}

/* ===== Main Player ===== */
#app {
  position: fixed;
  inset: 0;
  background: #000;
}

#app.hidden { display: none; }

#video-container {
  position: absolute;
  inset: 0;
}

#video-player {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

/* ===== Stream Placeholder ===== */
#stream-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #000;
  z-index: 1;
  gap: 12px;
}

#stream-placeholder.hidden { display: none; }

.placeholder-icon {
  font-size: 3rem;
  opacity: 0.6;
  animation: pulse-slow 2s ease-in-out infinite;
}

.placeholder-text {
  font-size: 0.9rem;
  color: var(--text-dim);
  letter-spacing: 2px;
}

@keyframes pulse-slow {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 0.3; }
}

/* ===== Overlay Controls ===== */
#overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  transition: opacity 0.4s ease;
  pointer-events: none;
  z-index: 10;
}

#overlay.visible {
  opacity: 1;
}

#overlay.hidden-ui {
  opacity: 0;
}

#overlay > * {
  pointer-events: auto;
}

/* Touch area for showing UI */
#touch-area {
  flex: 1;
  pointer-events: auto;
}

/* ===== Lock button ===== */
#lock-btn {
  position: absolute;
  top: 12px;
  right: 8px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: var(--text);
  font-size: 1.1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  pointer-events: auto;
  cursor: pointer;
  transition: opacity 0.4s ease;
}

#lock-btn.ui-hidden {
  opacity: 0;
  pointer-events: none;
}

/* ===== Mute Mini Button ===== */
#mute-mini {
  position: absolute;
  top: 12px;
  right: 88px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: var(--text);
  font-size: 1.1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  pointer-events: auto;
  cursor: pointer;
  transition: opacity 0.4s ease;
}

#mute-mini.ui-hidden {
  opacity: 0;
  pointer-events: none;
}

#mute-mini.muted {
  color: var(--danger);
}

/* ===== Fullscreen button ===== */
#fullscreen-btn {
  position: absolute;
  top: 12px;
  right: 48px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: var(--text);
  font-size: 1.1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  pointer-events: auto;
  cursor: pointer;
  transition: opacity 0.4s ease;
}

#fullscreen-btn.ui-hidden {
  opacity: 0;
  pointer-events: none;
}

/* ===== Track Navigation (ch301) ===== */
.track-btn {
  display: none;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 64px;
  border: none;
  border-radius: 8px;
  background: rgba(0,0,0,0.5);
  color: #fff;
  font-size: 1.6rem;
  font-weight: 700;
  z-index: 15;
  pointer-events: auto;
  cursor: pointer;
  transition: opacity 0.3s, background 0.2s;
}

.track-btn:active {
  background: rgba(0,0,0,0.8);
}

.track-btn.track-prev {
  left: 8px;
}

.track-btn.track-next {
  right: 8px;
}

.track-btn.visible {
  display: flex;
  align-items: center;
  justify-content: center;
}

.track-btn.ui-hidden {
  opacity: 0;
  pointer-events: none;
}

/* ===== Stream status bar ===== */
#status-bar {
  position: absolute;
  top: 16px;
  left: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(0,0,0,0.6);
  border-radius: 20px;
  font-size: 0.75rem;
  z-index: 15;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
}

#logout-btn {
  margin-left: 8px;
  padding: 3px 10px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 12px;
  background: transparent;
  color: var(--text-dim);
  font-size: 0.65rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

#logout-btn:active {
  background: rgba(255,255,255,0.1);
  color: var(--text);
}

.status-dot.live { background: var(--success); }
.status-dot.starting { background: var(--warn); animation: pulse 1s infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ===== Stream ON/OFF button ===== */
#stream-toggle {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 20px;
  border: 1px solid var(--accent);
  border-radius: 20px;
  background: rgba(0,0,0,0.6);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  z-index: 15;
}

#stream-toggle.on {
  border-color: var(--danger);
  color: var(--danger);
}

/* ===== Channel Info Bar ===== */
#channel-info {
  background: linear-gradient(transparent, rgba(0,0,0,0.85));
  padding: 12px 16px 8px;
}

.channel-name {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.program-title {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.progress-bar-container {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.7rem;
  color: var(--text-dim);
}

.progress-bar {
  flex: 1;
  height: 3px;
  background: #333;
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 1s linear;
}

/* ===== Control Buttons ===== */
#controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 8px 16px;
  background: var(--surface);
}

.ctrl-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 4px;
  border: none;
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  color: var(--text);
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.15s;
  gap: 4px;
}

.ctrl-btn:active {
  background: var(--accent-dim);
}

.ctrl-btn .icon {
  font-size: 1.4rem;
}

.ctrl-btn.power-btn { color: var(--danger); }
.ctrl-btn.power-btn.awake { color: var(--success); }

/* ===== Notice Marquee ===== */
.notice-bar {
  position: absolute;
  top: 50px;
  left: 0;
  right: 0;
  background: rgba(0,0,0,0.75);
  padding: 6px 16px;
  z-index: 25;
  overflow: hidden;
  white-space: nowrap;
}

.notice-bar.hidden { display: none; }

.notice-text {
  display: inline-block;
  color: #FFD700;
  font-size: 0.85rem;
  font-weight: 600;
  animation: marquee 15s linear infinite;
}

@keyframes marquee {
  0% { transform: translateX(100%); }
  100% { transform: translateX(-100%); }
}

/* ===== System Settings Panel ===== */
#settings-panel {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.95);
  display: none;
  flex-direction: column;
  z-index: 80;
}

#settings-panel.open { display: flex; }

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #333;
  font-size: 0.9rem;
  font-weight: 600;
  background: var(--surface);
  flex-shrink: 0;
}

.settings-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px 8px;
}

.settings-menu {
  display: flex;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: rgba(20,20,20,0.95);
  border-bottom: 1px solid #222;
  flex-shrink: 0;
  scrollbar-width: none;
  gap: 2px;
  padding: 4px;
}

.settings-menu::-webkit-scrollbar { display: none; }

.settings-menu-item {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-dim);
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  position: relative;
}

.settings-menu-item.active {
  background: rgba(33,150,243,0.15);
  color: var(--accent);
}

.settings-menu-item:active {
  background: rgba(255,255,255,0.05);
}

.smi-icon {
  font-size: 1.2rem;
}

.power-state-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 0.55rem;
  padding: 1px 4px;
  border-radius: 4px;
  font-weight: 700;
}

.power-state-badge.awake {
  background: rgba(76,175,80,0.3);
  color: var(--success);
}

.power-state-badge.sleep {
  background: rgba(244,67,54,0.3);
  color: var(--danger);
}

.settings-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 16px;
}

/* Settings content sections */
.sys-section {
  margin-bottom: 16px;
}

.sys-section-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid #222;
}

.sys-info-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
}

.sys-info-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #1a1a1a;
}

.sys-info-table td:first-child {
  color: var(--text-dim);
  width: 35%;
  white-space: nowrap;
}

.sys-info-table td:last-child {
  color: var(--text);
  word-break: break-all;
}

/* Health indicators */
.health-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #1a1a1a;
}

.health-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.health-dot.green { background: var(--success); }
.health-dot.yellow { background: var(--warn); }
.health-dot.red { background: var(--danger); }

.health-label {
  font-size: 0.8rem;
  color: var(--text);
  flex: 1;
}

.health-value {
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* Stats bars */
.stats-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 0.72rem;
}

.stats-bar-label {
  width: 70px;
  color: var(--text-dim);
  flex-shrink: 0;
}

.stats-bar-track {
  flex: 1;
  height: 8px;
  background: #222;
  border-radius: 4px;
  overflow: hidden;
}

.stats-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.3s;
}

.stats-bar-value {
  width: 60px;
  text-align: right;
  color: var(--text);
  flex-shrink: 0;
}

/* Notice form */
.notice-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.notice-input {
  width: 100%;
  padding: 12px;
  border: 1px solid #333;
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font-size: 0.85rem;
  outline: none;
}

.notice-input:focus {
  border-color: var(--accent);
}

.notice-btn-row {
  display: flex;
  gap: 8px;
}

.notice-btn {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.notice-btn.send {
  background: var(--accent);
  color: #fff;
}

.notice-btn.clear {
  background: rgba(244,67,54,0.2);
  color: var(--danger);
}

.notice-btn:active { opacity: 0.8; }

/* Power section */
.power-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 20px 0;
}

.power-big-btn {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid var(--danger);
  background: rgba(244,67,54,0.1);
  color: var(--danger);
  font-size: 2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.power-big-btn.awake {
  border-color: var(--success);
  background: rgba(76,175,80,0.1);
  color: var(--success);
}

.power-big-btn:active {
  transform: scale(0.95);
}

.power-status-text {
  font-size: 0.85rem;
  color: var(--text-dim);
}

.stb-sleep-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 30;
  flex-direction: column;
  gap: 12px;
}

.stb-sleep-overlay.show { display: flex; }

.stb-sleep-msg {
  color: var(--warn);
  font-size: 0.9rem;
  font-weight: 600;
}

.stb-sleep-btn {
  padding: 10px 24px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: transparent;
  color: var(--accent);
  font-size: 0.85rem;
  cursor: pointer;
}

/* ===== Number Pad Modal ===== */
#numpad-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

#numpad-modal.show { display: flex; }

.numpad {
  background: var(--surface);
  border-radius: 16px;
  padding: 20px;
  width: 280px;
}

.numpad-display {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  font-size: 2rem;
  letter-spacing: 8px;
  color: var(--accent);
  margin-bottom: 16px;
  min-height: 3rem;
}

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

.numpad-btn {
  padding: 16px;
  border: none;
  border-radius: 10px;
  background: rgba(255,255,255,0.08);
  color: var(--text);
  font-size: 1.3rem;
  font-weight: 600;
  cursor: pointer;
}

.numpad-btn:active {
  background: var(--accent-dim);
}

.numpad-btn.go {
  background: var(--accent);
  color: #fff;
}

.numpad-btn.cancel {
  background: rgba(244, 67, 54, 0.2);
  color: var(--danger);
  font-size: 0.9rem;
}

.numpad-btn.backspace {
  font-size: 0.9rem;
}

/* ===== Schedule Panel ===== */
#schedule-panel {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  display: none;
  flex-direction: column;
  z-index: 80;
}

#schedule-panel.open {
  display: flex;
}

.schedule-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #333;
  font-size: 0.9rem;
  font-weight: 600;
  background: var(--surface);
  flex-shrink: 0;
}

.schedule-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px 8px;
}

.schedule-table-wrap {
  flex: 1;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.schedule-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 0.7rem;
}

.schedule-table th,
.schedule-table td {
  padding: 6px 8px;
  border: 1px solid #2a2a2a;
  white-space: nowrap;
  text-align: center;
}

.schedule-table th {
  background: rgba(33,150,243,0.15);
  color: var(--accent);
  position: sticky;
  top: 0;
  z-index: 2;
  font-weight: 600;
}

.schedule-table th:first-child {
  position: sticky;
  left: 0;
  z-index: 3;
  background: rgba(20,20,20,0.98);
}

.schedule-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: rgba(20,20,20,0.95);
  color: var(--text);
  font-weight: 600;
  text-align: left;
  min-width: 80px;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.schedule-table td.current-ch td:first-child,
.schedule-table tr.current-ch td:first-child {
  color: var(--accent);
}

.schedule-table tr.current-ch {
  background: rgba(33,150,243,0.08);
}

.schedule-table td.prog-cell {
  text-align: left;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-dim);
  font-size: 0.65rem;
}

.schedule-table td.prog-current {
  background: rgba(33,150,243,0.15);
  color: var(--text);
}

.schedule-table th.now-col,
.schedule-table td.now-col {
  border-left: 2px solid var(--danger);
}

/* ===== Channel List Panel ===== */
#chlist-panel {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.95);
  display: none;
  flex-direction: column;
  z-index: 80;
}

#chlist-panel.open {
  display: flex;
}

.chlist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #333;
  font-size: 0.9rem;
  font-weight: 600;
  background: var(--surface);
  flex-shrink: 0;
}

.chlist-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px 8px;
}

.chlist-tabs {
  display: flex;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: rgba(20,20,20,0.95);
  border-bottom: 1px solid #222;
  flex-shrink: 0;
  scrollbar-width: none;
}

.chlist-tabs::-webkit-scrollbar {
  display: none;
}

.chlist-tab {
  flex-shrink: 0;
  padding: 10px 14px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.chlist-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.chlist-tab:active {
  background: rgba(255,255,255,0.05);
}

.chlist-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.chlist-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #1a1a1a;
  gap: 12px;
}

.chlist-item:active {
  background: rgba(255,255,255,0.04);
}

.chlist-chno {
  width: 42px;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}

.chlist-name {
  flex: 1;
  font-size: 0.85rem;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chlist-go {
  flex-shrink: 0;
  padding: 8px 14px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: transparent;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.chlist-go:active {
  background: var(--accent);
  color: #fff;
}

/* ===== Loading Spinner ===== */
.loading-overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.5);
  z-index: 50;
}

.loading-overlay.show { display: flex; }

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #333;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== Safe area for notch devices ===== */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  #controls {
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
  }
}
