.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 13px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0.4px;
  cursor: pointer;
  transition: filter 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.btn:active {
  filter: brightness(0.97);
}

.btn-primary {
  background: var(--srf-red);
  color: #fff;
  width: 100%;
}

.btn-primary:hover {
  filter: brightness(1.05);
}

.btn-secondary {
  background: var(--bg-muted);
  color: var(--neutral);
  width: 100%;
  box-shadow: none;
}

.btn-secondary:hover {
  background: var(--border);
}

.btn-ghost {
  background: transparent;
  color: var(--srf-red);
  padding: 8px 16px;
  box-shadow: none;
}

.btn-ghost:hover {
  background: var(--srf-red-soft);
}

.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--bg-muted);
  color: var(--text-muted);
}

.badge-pill--live {
  background: var(--srf-red-soft);
  color: var(--srf-red);
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--srf-red);
}

.live-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--srf-red);
  animation: pulse 1.5s infinite;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-md);
  box-shadow: var(--shadow-sm);
}

.input-text {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

.input-text::placeholder {
  color: var(--text-subtle);
}

.input-text:focus {
  outline: 2px solid var(--srf-red);
  outline-offset: 1px;
  border-color: var(--srf-red);
}

.color-picker {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.color-swatch {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
  box-shadow: var(--shadow-sm);
}

.color-swatch.selected {
  border-color: var(--text);
  transform: scale(1.08);
}

.timer-bar {
  height: 4px;
  background: var(--bg-muted);
  border-radius: 2px;
  overflow: hidden;
  margin: var(--space-md) 0;
}

.timer-bar-fill {
  height: 100%;
  background: var(--srf-red);
  transition: width 0.1s linear;
}

.quiz-option {
  display: block;
  width: 100%;
  padding: 16px;
  margin-bottom: var(--space-sm);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  box-shadow: var(--shadow-sm);
}

.quiz-option:hover:not(:disabled) {
  border-color: var(--srf-red);
  background: var(--bg-elevated);
}

.quiz-option:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.quiz-option.correct {
  border-color: var(--success);
  background: rgba(26, 122, 197, 0.08);
}

.quiz-option.wrong {
  border-color: var(--srf-red);
  background: var(--srf-red-soft);
}

.app-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  max-width: none;
  height: calc(var(--footer-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: none;
  z-index: 100;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.06);
}

.app-footer.visible {
  display: flex;
}

.footer-nav {
  display: flex;
  width: 100%;
}

.footer-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: var(--space-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.75rem;
  cursor: pointer;
}

.footer-btn.active {
  color: var(--srf-red);
}

.footer-btn .footer-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.srf-banner {
  background: var(--srf-red-soft);
  border: 1px solid rgba(201, 16, 36, 0.25);
  border-radius: var(--radius-sm);
  padding: var(--space-sm) var(--space-md);
  font-size: 0.875rem;
  color: var(--text);
  text-align: center;
  margin-bottom: var(--space-md);
}

.demo-dock[hidden],
.demo-panel[hidden] {
  display: none !important;
}

.demo-dock {
  position: fixed;
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  bottom: max(20px, calc(var(--footer-height) + var(--safe-bottom) + 8px));
  right: max(12px, calc(50% - var(--device-width) / 2 + 12px));
  pointer-events: none;
}

.demo-dock > * {
  pointer-events: auto;
}

.demo-toggle {
  flex-shrink: 0;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg-card);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  box-shadow: var(--shadow-md);
}

.demo-toggle:hover {
  color: var(--text);
  border-color: var(--srf-red);
}

.demo-toggle.is-open {
  color: #fff;
  background: var(--srf-red);
  border-color: var(--srf-red);
}

.demo-panel {
  width: 220px;
  max-width: min(220px, calc(100vw - 24px));
  max-height: min(50vh, 380px);
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.7rem;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.demo-panel-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-sm) 0;
}

.demo-panel h3 {
  font-size: 0.75rem;
  margin: 0;
  color: var(--srf-red);
}

.demo-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-family: inherit;
  cursor: pointer;
  flex-shrink: 0;
}

.demo-close span {
  font-size: 1.25rem;
  line-height: 1;
  margin-top: -1px;
}

.demo-close:hover {
  color: var(--text);
  border-color: var(--srf-red);
  background: var(--bg-card);
}

.demo-panel-body {
  padding: var(--space-xs) var(--space-sm) var(--space-sm);
  overflow-y: auto;
  min-height: 0;
}

.demo-panel-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 8px 0 4px;
}

.demo-panel-label:first-child {
  margin-top: 0;
}

.demo-action {
  display: block;
  width: 100%;
  margin-bottom: 4px;
  padding: 7px 10px;
  font-size: 0.65rem;
  line-height: 1.3;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
}

.demo-action:hover {
  background: var(--srf-red);
  border-color: var(--srf-red);
  color: #fff;
}

@media (min-width: 481px) {
  .demo-dock {
    bottom: 24px;
    left: calc(50% + var(--device-width) / 2 + 16px);
    right: auto;
  }

  .demo-panel {
    max-height: min(65vh, 480px);
  }
}

@media (max-width: 480px) {
  .demo-dock {
    right: 12px;
    bottom: max(16px, calc(var(--footer-height) + var(--safe-bottom) + 8px));
  }

  .demo-panel {
    width: min(220px, calc(100vw - 24px));
  }
}
