/* ========================================================================
   LobbyWARS - BASE STYLES
   ======================================================================== */

:root {
  --app-height: 100vh;
  --primary: #ff4081;
  --primary-dark: #c60055;
  --secondary: #00bcd4;
  --secondary-dark: #0097a7;
  --success: #4caf50;
  --danger: #ff5252;
  --warning: #ffc107;
  --dark: #222;
  --light: #f5f5f5;
  --white: #ffffff;

  --gradient-bg: linear-gradient(135deg, #ffe6f0 0%, #c2f0ff 100%);
  --gradient-primary: linear-gradient(135deg, var(--primary), var(--secondary));
  --gradient-card: linear-gradient(135deg, #fff9e6, #fff0f5);

  --header-height: 60px;
  --tab-height: 50px;
  --bottom-action-height: 80px;
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.2);
  --shadow-xl: 0 12px 24px rgba(0, 0, 0, 0.25);

  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --transition-slow: 0.5s ease;

  --touch-target: 44px;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: var(--app-height);
  height: -webkit-fill-available;
}

body {
  font-family: 'Comic Sans MS', 'Chalkboard SE', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--gradient-bg);
  background-attachment: fixed;
  color: var(--dark);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: var(--app-height);
  min-height: 100vh;
  min-height: -webkit-fill-available;
}

body.mobile-chrome-hack {
  min-height: calc(var(--app-height) + 2px);
}

body.mobile-chrome-hack::after {
  content: '';
  display: block;
  height: 1px;
  width: 1px;
}

*:focus {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

button:focus {
  box-shadow: 0 0 0 4px rgba(255, 64, 129, 0.3);
}

.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--primary);
  color: white;
  padding: 8px;
  z-index: 100;
}

.skip-link:focus {
  top: 0;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

.screen {
  display: none;
  min-height: var(--app-height);
  min-height: 100vh;
  min-height: -webkit-fill-available;
  animation: fadeIn 0.3s ease;
}

@supports (height: 100dvh) {
  :root {
    --app-height: 100dvh;
  }
}

.screen.active {
  display: flex;
  flex-direction: column;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

h1, h2, h3, h4, h5, h6 {
  line-height: 1.2;
  font-weight: bold;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  padding: 12px 24px;
  min-height: var(--touch-target);
  min-width: var(--touch-target);
  font-family: inherit;
  font-size: 1rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--primary);
  color: var(--white);
  cursor: pointer;
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-md);
  user-select: none;
  -webkit-user-select: none;
}

.btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  filter: brightness(1.1);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary { background: var(--primary); }
.btn-secondary { background: #999; }
.btn-success { background: var(--success); }
.btn-danger { background: var(--danger); }

.btn-danger:hover:not(:disabled) {
  background: #d32f2f;
  box-shadow: var(--shadow-xl);
}

.btn-leave {
  min-width: 100px;
  background: var(--danger);
  font-weight: 700;
}

.btn-success.pulsing-glow {
  box-shadow: 0 0 20px rgba(76, 175, 80, 0.6);
  animation: glowPulse 2s infinite;
}

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(76, 175, 80, 0.6); }
  50% { box-shadow: 0 0 30px rgba(76, 175, 80, 0.8); }
}

.btn-icon {
  padding: 10px;
  font-size: 1.2rem;
  min-width: var(--touch-target);
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon svg {
  fill: currentColor;
}

input[type="text"],
input[type="email"],
input[type="password"],
input:not([type]),
select {
  width: 100%;
  padding: 12px 16px;
  font-family: inherit;
  font-size: 1rem;
  border: 2px solid #ddd;
  border-radius: var(--radius-md);
  background: var(--white);
  transition: var(--transition-normal);
  min-height: var(--touch-target);
}

input:hover {
  border-color: var(--secondary);
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255, 64, 129, 0.15);
}

input::placeholder {
  color: #999;
  font-style: italic;
}

input:disabled {
  background: #e0e0e0;
  cursor: not-allowed;
  opacity: 0.6;
}

kbd {
  background: #333;
  color: white;
  padding: 3px 8px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.9em;
  font-weight: bold;
}

.icon-inline {
  vertical-align: middle;
  margin-right: 4px;
  display: inline-block;
}

.icon-btn {
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
}

.btn svg {
  flex-shrink: 0;
}

@keyframes bounceIn {
  0% { transform: scale(0.3); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-30px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@keyframes countdownPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

@keyframes shakeScreen {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  75% { transform: translateX(10px); }
}

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

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(400px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slideOutRight {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(400px); }
}

@keyframes confettiFall {
  to { transform: translateY(100vh) rotate(360deg); opacity: 0; }
}

#loadingOverlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

#loadingOverlay.active {
  display: flex;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 5px solid #f0f0f0;
  border-top: 5px solid var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.spinner-text {
  color: white;
  margin-top: 20px;
  font-weight: bold;
  font-size: 1.2em;
}

.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--secondary);
  color: white;
  padding: 15px 20px;
  border-radius: 8px;
  z-index: 9999;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  animation: slideInRight 0.3s ease;
  max-width: 300px;
  word-wrap: break-word;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); }
.toast-info { background: var(--secondary); }

.toast button {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 1.2em;
  margin-left: 10px;
  padding: 0;
}

.confetti {
  position: fixed;
  width: 10px;
  height: 10px;
  background: var(--primary);
  z-index: 9999;
  border-radius: 50%;
  pointer-events: none;
  animation: confettiFall 3s linear;
}

.audio-control-deck {
  --audio-surface: linear-gradient(145deg, rgb(208 12 93), rgb(214 18 97));
  margin-top: var(--spacing-md);
  margin-bottom: calc(var(--bottom-action-height) + var(--spacing-xl) + env(safe-area-inset-bottom));
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--audio-surface);
  color: var(--white);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.24);
  padding: 12px;
  display: grid;
  gap: 12px;
  overflow: hidden;
}

.audio-control-deck.is-collapsed {
  gap: 8px;
}

.audio-control-deck-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.audio-control-deck-titlewrap h4 {
  margin: 0;
  font-size: 0.95rem;
  letter-spacing: 0.2px;
  text-transform: uppercase;
}

.audio-unlock-status {
  margin: 4px 0 0;
  font-size: 0.76rem;
  line-height: 1.3;
  color: rgba(255, 255, 255, 0.78);
}

.audio-unlock-status.is-warning {
  color: #ffd479;
}

.audio-unlock-status.is-ready {
  color: #83f3c0;
}

.audio-control-deck-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.audio-deck-toggle {
  min-width: 34px;
  width: 34px;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
}

.audio-control-deck-body {
  display: grid;
  gap: 10px;
}

.audio-control-deck-body[hidden] {
  display: none !important;
}

.audio-compact-btn {
  min-height: 34px;
  padding: 8px 10px;
  font-size: 0.74rem;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.audio-compact-btn.ghost {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--white);
}

.audio-compact-btn.ghost:hover {
  background: rgba(255, 255, 255, 0.12);
}

.audio-control-deck-grid {
  display: grid;
  gap: 8px;
}

.audio-control-row {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) auto minmax(110px, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.audio-control-row.master {
  grid-template-columns: minmax(0, 1.3fr) minmax(120px, 1fr) auto;
  background: linear-gradient(120deg, rgba(0, 188, 212, 0.08), rgba(255, 64, 129, 0.06));
}

.audio-control-row.voice {
  grid-template-columns: minmax(0, 1.25fr) auto auto auto auto;
}

.audio-control-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.audio-control-label {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.22px;
  text-transform: uppercase;
}

.audio-control-copy small {
  font-size: 0.68rem;
  opacity: 0.75;
  line-height: 1.2;
}

.audio-chip-toggle {
  min-width: 54px;
  min-height: 30px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.05);
  color: var(--white);
  font-weight: 800;
  font-size: 0.73rem;
  cursor: pointer;
  padding: 0 10px;
}

.audio-chip-toggle[aria-pressed='true'] {
  background: linear-gradient(135deg, rgba(0, 188, 212, 0.22), rgba(76, 175, 80, 0.2));
  border-color: rgba(131, 243, 192, 0.38);
  color: #d7fff0;
}

.audio-chip-toggle[aria-pressed='false'] {
  background: rgba(255, 82, 82, 0.08);
  border-color: rgba(255, 120, 120, 0.28);
  color: #ffd0d0;
}

.audio-chip-toggle-wide {
  min-width: 94px;
}

.audio-slider {
  width: 100%;
  min-width: 0;
  accent-color: var(--primary);
}

.audio-control-value {
  min-width: 38px;
  text-align: right;
  font-size: 0.72rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.82);
}

.audio-control-deck-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: end;
}

.audio-preview-scene-status {
  margin: 0;
  padding: 7px 9px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.69rem;
  line-height: 1.25;
}

.audio-preview-scene-status.is-warning {
  border-color: rgba(255, 212, 121, 0.22);
  background: rgba(255, 212, 121, 0.07);
  color: #ffe5a8;
}

.audio-preview-scene-status.is-active {
  border-color: rgba(0, 188, 212, 0.22);
  background: rgba(0, 188, 212, 0.08);
  color: #bff6ff;
}

.audio-voice-status {
  margin-bottom: 2px;
}

.audio-voice-unlock-btn {
  min-height: 30px;
  padding: 6px 9px;
  font-size: 0.67rem;
}

.audio-voice-unlock-btn[hidden] {
  display: none !important;
}

.audio-voice-studio {
  display: grid;
  gap: 8px;
  padding: 8px 9px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.audio-kokoro-collapsed-summary {
  margin: 0;
  padding: 7px 9px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: rgba(232, 244, 255, 0.93);
  font-size: 0.71rem;
  line-height: 1.25;
}

.audio-kokoro-panel-shell[hidden] {
  display: none !important;
}

.audio-kokoro-panel-shell {
  display: grid;
  gap: 6px;
}

.audio-kokoro-panel-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  margin-left: auto;
}

.audio-kokoro-panel-toggle-label {
  font-weight: 700;
  letter-spacing: 0.02em;
}

.audio-kokoro-panel-toggle-chevron {
  font-size: 0.76rem;
  opacity: 0.84;
  transition: transform 140ms ease;
}

.audio-kokoro-panel-toggle.is-open .audio-kokoro-panel-toggle-chevron {
  transform: rotate(180deg);
}

.audio-kokoro-panel-toggle.has-ping {
  border-color: rgba(255, 208, 78, 0.38);
  box-shadow: inset 0 0 0 1px rgba(255, 208, 78, 0.08), 0 0 0 1px rgba(255, 208, 78, 0.08);
}

.audio-kokoro-panel-ping {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #ffcf4f, #ff9d2e);
  color: #231300;
  font-size: 0.64rem;
  font-weight: 800;
  line-height: 1;
}

.audio-kokoro-panel-ping[hidden] {
  display: none !important;
}

.audio-voice-picker {
  display: grid;
  gap: 4px;
}

.audio-voice-picker > label {
  font-size: 0.71rem;
  font-weight: 800;
  letter-spacing: 0.22px;
  text-transform: uppercase;
  opacity: 0.92;
}

.audio-voice-picker-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.audio-voice-picker-row select {
  appearance: none;
  -webkit-appearance: none;
  min-height: 38px;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background:
    linear-gradient(45deg, transparent 50%, rgba(223, 245, 255, 0.75) 50%),
    linear-gradient(135deg, rgba(223, 245, 255, 0.75) 50%, transparent 50%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.04));
  background-position:
    calc(100% - 16px) 52%,
    calc(100% - 11px) 52%,
    0 0;
  background-size:
    6px 6px,
    6px 6px,
    100% 100%;
  background-repeat: no-repeat;
  color: var(--white);
  color-scheme: dark;
  padding: 7px 32px 7px 11px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.audio-voice-picker-row select option,
.audio-voice-picker-row select optgroup {
  background: #101722;
  color: #ecf7ff;
}

.audio-voice-selection-hint {
  margin-top: 2px;
  font-size: 0.67rem;
}

.audio-kokoro-panel {
  display: grid;
  gap: 8px;
  padding: 8px;
  border-radius: 10px;
  background: rgba(93, 224, 255, 0.04);
  border: 1px solid rgba(93, 224, 255, 0.12);
}

.audio-kokoro-panel.is-queued-highlight {
  border-color: rgba(93, 224, 255, 0.28);
  box-shadow: 0 0 0 1px rgba(93, 224, 255, 0.08), 0 0 24px rgba(93, 224, 255, 0.08);
}

.audio-kokoro-panel.is-locked-to-host {
  border-color: rgba(255, 208, 78, 0.15);
}

.audio-kokoro-queued-banner {
  display: grid;
  gap: 2px;
  padding: 7px 8px;
  border-radius: 10px;
  border: 1px solid rgba(93, 224, 255, 0.18);
  background: rgba(93, 224, 255, 0.07);
}

.audio-kokoro-queued-banner strong {
  font-size: 0.73rem;
  color: #ecf9ff;
}

.audio-kokoro-queued-banner span {
  font-size: 0.66rem;
  color: rgba(196, 223, 245, 0.88);
}

.audio-kokoro-queued-banner.is-host {
  border-color: rgba(255, 208, 78, 0.24);
  background: rgba(255, 208, 78, 0.07);
}

.audio-kokoro-queued-banner.is-pulse {
  animation: kokoroQueuedPulse 1.2s ease-in-out 3;
}

@keyframes kokoroQueuedPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(93, 224, 255, 0); }
  50% { box-shadow: 0 0 0 2px rgba(93, 224, 255, 0.16); }
}

.audio-kokoro-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.audio-kokoro-header .audio-control-copy small {
  display: block;
  margin-top: 1px;
}

.audio-kokoro-status {
  margin: 0;
  font-size: 0.7rem;
  line-height: 1.35;
}

.audio-kokoro-voice-select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  background:
    linear-gradient(45deg, transparent 50%, rgba(223, 245, 255, 0.75) 50%),
    linear-gradient(135deg, rgba(223, 245, 255, 0.75) 50%, transparent 50%),
    linear-gradient(180deg, rgba(13, 19, 29, 0.98), rgba(22, 31, 46, 0.96)) !important;
  background-position:
    calc(100% - 16px) 52%,
    calc(100% - 11px) 52%,
    0 0;
  background-size:
    6px 6px,
    6px 6px,
    100% 100%;
  background-repeat: no-repeat;
  color: #eff9ff !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
  box-shadow: inset 0 0 0 1px rgba(93, 224, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.03);
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.audio-kokoro-voice-select:focus {
  outline: 2px solid rgba(93, 224, 255, 0.34);
  outline-offset: 1px;
}

.audio-voice-picker-row .btn {
  min-height: 38px;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .audio-voice-picker-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .audio-voice-picker-row .btn {
    width: 100%;
    justify-self: stretch;
  }
}

.audio-scene-preview {
  display: grid;
  gap: 4px;
  min-width: 0;
  font-size: 0.74rem;
  font-weight: 700;
}

.audio-scene-preview span {
  opacity: 0.88;
}

.audio-scene-preview select {
  min-height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--white);
  padding: 6px 10px;
}

.audio-quick-fab {
  position: fixed;
  right: calc(8px + env(safe-area-inset-right, 0px));
  top: calc(8px + env(safe-area-inset-top, 0px));
  z-index: 10810;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: linear-gradient(155deg, rgba(14, 18, 28, 0.97), rgba(31, 43, 58, 0.96));
  color: var(--white);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.28);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
}

.audio-quick-fab::after {
  content: '';
  position: absolute;
  right: 5px;
  top: 5px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #84f2be;
  box-shadow: 0 0 0 2px rgba(10, 14, 22, 0.82);
}

.audio-quick-fab:hover {
  transform: translateY(-1px);
}

.audio-quick-fab[aria-expanded='true'] {
  border-color: rgba(0, 188, 212, 0.48);
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.38);
}

.audio-quick-fab.is-muted {
  background: linear-gradient(155deg, rgba(40, 18, 18, 0.97), rgba(58, 26, 26, 0.96));
}

.audio-quick-fab.is-muted::after {
  background: #ff8d8d;
}

.audio-quick-fab.dot-dismissed::after {
  display: none;
}

.audio-quick-fab-icon {
  font-size: 0.95rem;
  line-height: 1;
}

.audio-quick-fab-state {
  display: none;
}

.audio-quick-panel {
  position: fixed;
  right: calc(8px + env(safe-area-inset-right, 0px));
  top: calc(54px + env(safe-area-inset-top, 0px));
  width: min(228px, calc(100vw - 16px));
  z-index: 10820;
  background: linear-gradient(155deg, rgba(12, 15, 22, 0.98), rgba(18, 25, 36, 0.97));
  color: var(--white);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 14px 24px rgba(0, 0, 0, 0.34);
  padding: 8px;
  display: grid;
  gap: 8px;
}

.audio-quick-panel[hidden] {
  display: none !important;
}

.audio-quick-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.audio-quick-panel-head strong {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.audio-quick-panel-head small {
  display: block;
  margin-top: 2px;
  font-size: 0.61rem;
  color: rgba(255, 255, 255, 0.74);
  max-width: 170px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.audio-quick-close {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--white);
  cursor: pointer;
}

.audio-quick-panel-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.audio-quick-action {
  min-height: 27px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--white);
  font-weight: 800;
  font-size: 0.63rem;
  letter-spacing: 0.2px;
  padding: 0 7px;
  cursor: pointer;
  white-space: nowrap;
}

.audio-quick-action[aria-pressed='true'] {
  background: rgba(0, 188, 212, 0.14);
  border-color: rgba(0, 188, 212, 0.35);
}

.audio-quick-action.is-off,
.audio-quick-action[aria-pressed='false'] {
  opacity: 0.72;
}

.audio-quick-volume {
  display: grid;
  gap: 4px;
}

.audio-quick-volume span {
  font-size: 0.62rem;
  font-weight: 700;
  opacity: 0.86;
}

.audio-quick-volume input {
  width: 100%;
  accent-color: var(--primary);
}

#round4EvalScreen.active ~ #audioQuickFab {
  left: calc(8px + env(safe-area-inset-left, 0px));
  right: auto;
}

#round4EvalScreen.active ~ #audioQuickPanel {
  left: calc(8px + env(safe-area-inset-left, 0px));
  right: auto;
}

.install-prompt {
  position: fixed;
  left: 50%;
  top: calc(8px + env(safe-area-inset-top, 0px));
  transform: translateX(-50%);
  width: min(96vw, 520px);
  background: rgba(34, 34, 34, 0.96);
  color: var(--white);
  border: 2px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 12px;
  z-index: 11000;
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.install-prompt[hidden] {
  display: none !important;
}

.install-prompt-copy {
  font-size: 0.95rem;
  line-height: 1.35;
  font-weight: 700;
}

.install-prompt-urgent {
  align-self: flex-start;
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  background: var(--primary);
  color: var(--white);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}

.install-prompt-close {
  position: absolute;
  right: 8px;
  top: 8px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: var(--white);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
}

.install-prompt-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.install-prompt-instruction {
  background: var(--secondary);
  color: var(--white);
  border-radius: var(--radius-sm);
  padding: 10px;
  font-size: 0.86rem;
  line-height: 1.35;
  font-weight: 700;
  border-left: 4px solid var(--warning);
}

.install-prompt-instruction[hidden] {
  display: none !important;
}

.install-prompt-reopen {
  position: fixed;
  top: calc(10px + env(safe-area-inset-top, 0px));
  right: 10px;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background: var(--warning);
  color: var(--dark);
  font-size: 1.1rem;
  font-weight: 800;
  box-shadow: var(--shadow-md);
  z-index: 10950;
  cursor: pointer;
  animation: installReopenPulse 10s ease-in-out infinite;
}

.install-prompt-reopen[hidden] {
  display: none !important;
}

@keyframes installReopenPulse {
  0%, 84%, 100% {
    transform: scale(1);
    box-shadow: var(--shadow-md);
  }
  88% {
    transform: scale(1.09);
    box-shadow: var(--shadow-xl);
  }
  92% {
    transform: scale(1);
  }
  96% {
    transform: scale(1.08);
    box-shadow: var(--shadow-lg);
  }
}

.install-prompt-actions {
  display: flex;
  gap: 8px;
}

.install-prompt .btn {
  min-height: 34px;
  padding: 8px 12px;
  font-size: 0.76rem;
}

@media (max-width: 420px) {
  .audio-control-deck-head {
    flex-direction: column;
    align-items: stretch;
  }

  .audio-control-deck-actions {
    justify-content: stretch;
  }

  .audio-control-deck-actions .audio-compact-btn {
    flex: 1;
  }

  .audio-control-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "copy toggle"
      "slider value";
    align-items: center;
  }

  .audio-control-row.master {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "copy copy"
      "slider value";
  }

  .audio-control-row.voice {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: none;
    align-items: stretch;
  }

  .audio-control-copy {
    grid-area: copy;
  }

  .audio-chip-toggle {
    grid-area: toggle;
    justify-self: end;
  }

  .audio-slider {
    grid-area: slider;
  }

.audio-control-row.voice .audio-chip-toggle,
.audio-control-row.voice .audio-voice-unlock-btn,
.audio-control-row.voice .audio-kokoro-panel-toggle {
    grid-area: auto;
    width: 100%;
    justify-self: stretch;
  }

  .audio-voice-picker-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .audio-voice-picker-row .audio-compact-btn {
    width: 100%;
  }

  .audio-kokoro-header {
    grid-template-columns: 1fr;
  }

  .audio-control-value {
    grid-area: value;
  }

  .audio-control-deck-footer {
    grid-template-columns: 1fr;
  }

  .audio-control-deck-footer .audio-compact-btn {
    width: 100%;
  }

  .install-prompt-actions {
    width: 100%;
  }

  .install-prompt .btn {
    flex: 1;
  }
}

@media (min-width: 600px) {
  .voting-grid-modern {
    grid-template-columns: repeat(2, 1fr);
  }

  .draft-area-modern {
    padding: var(--spacing-lg);
  }

  .lobby-content {
    padding: var(--spacing-lg);
  }
}

@media (min-width: 900px) {
  #join .panel {
    max-width: 450px;
  }

  .voting-grid-modern {
    grid-template-columns: repeat(3, 1fr);
  }

  .game-header-sticky {
    padding: var(--spacing-lg);
  }
}

@media (min-width: 1200px) {
  .draft-area-modern {
    max-width: 900px;
    margin: 0 auto;
  }
}

@media (max-width: 375px) {
  .btn {
    font-size: 0.9rem;
    padding: 10px 18px;
  }

  .audio-control-deck {
    padding: 10px;
    gap: 10px;
  }

  .audio-control-row {
    padding: 7px 8px;
  }

  .audio-quick-fab {
    right: calc(8px + env(safe-area-inset-right, 0px));
    top: calc(8px + env(safe-area-inset-top, 0px));
    width: 38px;
    height: 38px;
    min-width: 38px;
    padding: 0;
  }

  .audio-quick-panel {
    right: calc(8px + env(safe-area-inset-right, 0px));
    top: calc(50px + env(safe-area-inset-top, 0px));
    width: min(224px, calc(100vw - 12px));
  }

  .countdown {
    font-size: 6rem;
  }

  .round-badge, .timer-big {
    font-size: 1.2rem;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  .screen {
    min-height: 100vh;
  }

  .draft-input-sticky,
  .vote-actions-sticky,
  .lobby-actions-sticky {
    position: relative;
  }
}

@media (prefers-contrast: high) {
  .btn {
    border: 2px solid black;
  }

  .player-item, .vote-card, .leaderboard-entry {
    border: 3px solid black;
  }
}

@media print {
  body {
    background: white;
  }

  .screen {
    display: block !important;
  }

  .btn, .toast, #loadingOverlay {
    display: none !important;
  }
}

/* iOS/mobile fix for audio controls */
@media only screen and (max-width: 480px),
  (max-device-width: 480px) and (orientation: portrait) {
  .audio-control-row.voice {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 18px;
    padding: 18px 12px;
    background: rgba(255,255,255,0.04);
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
  }
  .audio-control-row.voice .audio-chip-toggle,
  .audio-control-row.voice .audio-kokoro-panel-toggle,
  .audio-control-row.voice .audio-voice-unlock-btn {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    font-size: 1.05rem;
    padding: 14px 0;
    border-radius: 14px;
    margin: 0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  }
  #audioVoiceToggle {
    margin-bottom: 0;
  }
  #audioKokoroPanelToggleBtn {
    margin-top: 0;
  }
  .audio-control-copy {
    margin-bottom: 10px;
    text-align: left;
  }
  .audio-control-label {
    font-size: 1.1rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    margin-bottom: 2px;
  }
  .audio-control-copy small {
    font-size: 0.85rem;
    opacity: 0.8;
    margin-bottom: 8px;
  }
}
