/* ===== RESET & BASE ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --brick-dark: #2a1810;
  --brick-medium: #6b3a2a;
  --brick-light: #8b4a35;
  --brick-mortar: #1a0e08;
  --neon-pink: #ff2d78;
  --neon-pink-glow: #ff2d7855;
  --neon-blue: #00d4ff;
  --neon-blue-glow: #00d4ff44;
  --neon-yellow: #ffee58;
  --neon-yellow-glow: #ffee5844;
  --stage-wood: #3e2723;
  --gold: #d4a34a;
  --cream: #f5f0e8;
  --text-light: #e8ddd0;
  --text-dim: #9e8e7e;
  --panel-bg: rgba(20, 12, 8, 0.85);
  --panel-border: rgba(139, 74, 53, 0.4);
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  background: var(--brick-dark);
  color: var(--text-light);
  font-family: 'Inter', system-ui, sans-serif;
  overflow-x: hidden;
  position: relative;
}

/* ===== BRICK WALL ===== */
.brick-wall {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-color: var(--brick-dark);
  background-image:
    /* Mortar lines - horizontal */
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 48px,
      var(--brick-mortar) 48px,
      var(--brick-mortar) 52px
    ),
    /* Mortar lines - vertical (offset rows) */
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 98px,
      var(--brick-mortar) 98px,
      var(--brick-mortar) 102px
    );
  background-size: 102px 52px;
}

/* Offset every other row */
.brick-wall::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 98px,
      var(--brick-mortar) 98px,
      var(--brick-mortar) 102px
    );
  background-size: 102px 104px;
  background-position: 51px 52px;
}

/* Brick color variation */
.brick-wall::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(ellipse 80px 30px at 50px 25px, var(--brick-light) 0%, transparent 70%),
    radial-gradient(ellipse 80px 30px at 150px 75px, var(--brick-medium) 0%, transparent 70%),
    radial-gradient(ellipse 80px 30px at 250px 25px, rgba(107, 58, 42, 0.5) 0%, transparent 70%),
    radial-gradient(ellipse 80px 30px at 50px 125px, var(--brick-medium) 0%, transparent 70%),
    radial-gradient(ellipse 80px 30px at 350px 75px, var(--brick-light) 0%, transparent 70%);
  background-size: 408px 208px;
  opacity: 0.6;
}

/* ===== SPOTLIGHTS ===== */
.spotlight {
  position: fixed;
  z-index: 1;
  pointer-events: none;
}

.spotlight-center {
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  width: 700px;
  height: 900px;
  background: radial-gradient(
    ellipse at top,
    rgba(255, 235, 180, 0.12) 0%,
    rgba(255, 235, 180, 0.05) 30%,
    transparent 70%
  );
}

.spotlight-left {
  top: -50px;
  left: 10%;
  width: 400px;
  height: 700px;
  background: radial-gradient(
    ellipse at top,
    rgba(255, 45, 120, 0.06) 0%,
    transparent 70%
  );
}

.spotlight-right {
  top: -50px;
  right: 10%;
  width: 400px;
  height: 700px;
  background: radial-gradient(
    ellipse at top,
    rgba(0, 212, 255, 0.05) 0%,
    transparent 70%
  );
}

/* ===== LAYOUT ===== */
.stage-container {
  position: relative;
  z-index: 2;
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}

/* ===== NEON SIGN HEADER ===== */
.club-header {
  text-align: center;
  padding: 2rem 0 1rem;
}

.neon-sign {
  display: inline-block;
  padding: 1rem 2.5rem;
  border: 2px solid var(--neon-pink);
  border-radius: 8px;
  box-shadow:
    0 0 10px var(--neon-pink-glow),
    0 0 40px var(--neon-pink-glow),
    inset 0 0 10px var(--neon-pink-glow);
  animation: neon-flicker 4s infinite;
}

.neon-text {
  font-family: 'Playfair Display', serif;
  font-weight: 900;
  font-size: 3rem;
  color: var(--neon-pink);
  text-shadow:
    0 0 7px var(--neon-pink),
    0 0 20px var(--neon-pink),
    0 0 42px var(--neon-pink-glow),
    0 0 82px var(--neon-pink-glow);
  letter-spacing: 2px;
  line-height: 1.1;
}

.neon-subtitle {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--neon-blue);
  text-shadow:
    0 0 7px var(--neon-blue),
    0 0 20px var(--neon-blue),
    0 0 42px var(--neon-blue-glow);
  letter-spacing: 12px;
  margin-top: 0.25rem;
}

@keyframes neon-flicker {
  0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% {
    opacity: 1;
  }
  20%, 24%, 55% {
    opacity: 0.85;
  }
}

.tagline {
  margin-top: 1.25rem;
  color: var(--text-dim);
  font-size: 0.9rem;
  font-style: italic;
}

/* ===== MIC STAND ===== */
.mic-stand {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 1.5rem auto;
}

.mic-head {
  font-size: 2.5rem;
  filter: drop-shadow(0 0 10px rgba(255, 235, 180, 0.3));
  animation: mic-sway 3s ease-in-out infinite;
}

@keyframes mic-sway {
  0%, 100% { transform: rotate(-2deg); }
  50% { transform: rotate(2deg); }
}

.mic-pole {
  width: 3px;
  height: 40px;
  background: linear-gradient(to bottom, #888, #444);
  border-radius: 2px;
}

.mic-base {
  width: 40px;
  height: 4px;
  background: #555;
  border-radius: 2px;
}

/* ===== CONTROLS PANEL ===== */
.controls-panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 1.75rem;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.panel-header {
  font-family: 'Special Elite', cursive;
  font-size: 1.3rem;
  color: var(--gold);
  margin-bottom: 1.25rem;
}

.panel-icon {
  margin-right: 0.25rem;
}

.control-group {
  margin-bottom: 1rem;
}

.control-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  margin-bottom: 0.4rem;
}

.key-input-wrapper {
  display: flex;
  gap: 0.5rem;
}

.key-input-wrapper input {
  flex: 1;
}

.toggle-key-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  color: var(--text-dim);
  padding: 0 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s;
}

.toggle-key-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-light);
}

input[type="text"],
input[type="password"],
input[type="date"] {
  width: 100%;
  padding: 0.7rem 1rem;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  color: var(--text-light);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus {
  outline: none;
  border-color: var(--neon-pink);
  box-shadow: 0 0 0 2px var(--neon-pink-glow);
}

/* Date input icon color fix for dark theme */
input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.7);
  cursor: pointer;
}

.date-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.quick-dates {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.quick-btn {
  padding: 0.4rem 0.9rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  color: var(--text-dim);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.quick-btn:hover {
  background: rgba(255, 45, 120, 0.15);
  border-color: var(--neon-pink);
  color: var(--neon-pink);
}

.generate-btn {
  width: 100%;
  padding: 1rem;
  background: linear-gradient(135deg, var(--neon-pink), #d4247a);
  border: none;
  border-radius: 10px;
  color: white;
  font-family: 'Special Elite', cursive;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 4px 15px rgba(255, 45, 120, 0.3);
  position: relative;
  overflow: hidden;
}

.generate-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(255, 45, 120, 0.5);
}

.generate-btn:active:not(:disabled) {
  transform: translateY(0);
}

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

.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 0.5rem;
}

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

/* ===== STATUS AREA ===== */
.status-area {
  margin-top: 1.25rem;
  padding: 1rem 1.25rem;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  text-align: center;
}

.status-message {
  font-family: 'Special Elite', cursive;
  color: var(--neon-yellow);
  font-size: 1rem;
}

.progress-bar-container {
  margin-top: 0.75rem;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--neon-pink), var(--neon-blue));
  border-radius: 2px;
  transition: width 0.5s ease;
  width: 0%;
}

/* ===== RESULTS ===== */
.results-area {
  margin-top: 2rem;
  animation: fadeIn 0.6s ease;
}

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

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.results-header h3 {
  font-family: 'Special Elite', cursive;
  font-size: 1.4rem;
  color: var(--gold);
}

.results-meta {
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* ===== TTS CONTROLS ===== */
.tts-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.75rem 1rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  margin-bottom: 1.25rem;
}

.tts-btn {
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  color: var(--text-light);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.tts-btn:hover {
  background: rgba(0, 212, 255, 0.15);
  border-color: var(--neon-blue);
  color: var(--neon-blue);
}

.tts-voice-select {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: 1;
  min-width: 180px;
}

.tts-voice-select label {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.tts-voice-select select {
  flex: 1;
  padding: 0.4rem;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  color: var(--text-light);
  font-size: 0.8rem;
  min-width: 0;
}

.tts-rate-control {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.tts-rate-control label {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tts-rate-control input[type="range"] {
  width: 70px;
  accent-color: var(--neon-blue);
}

#rate-display {
  font-size: 0.75rem;
  color: var(--neon-blue);
  min-width: 2.5em;
}

/* ===== COMEDY SET OUTPUT ===== */
.comedy-set {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 2rem;
  font-family: 'Special Elite', cursive;
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--cream);
  white-space: pre-wrap;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.comedy-set strong {
  color: var(--gold);
}

.comedy-set em {
  color: var(--neon-blue);
  font-style: italic;
}

.comedy-set hr {
  border: none;
  border-top: 1px solid var(--panel-border);
  margin: 1.5rem 0;
}

/* Stage directions */
.stage-direction {
  color: var(--text-dim);
  font-style: italic;
  font-size: 0.9em;
}

/* ===== POST STATS ===== */
.post-stats {
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
}

.post-stats h4 {
  font-family: 'Special Elite', cursive;
  color: var(--gold);
  margin-bottom: 0.75rem;
}

.stats-content {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.6;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  padding: 0.35rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-item:last-child {
  border-bottom: none;
}

/* ===== FOOTER ===== */
.club-footer {
  text-align: center;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(139, 74, 53, 0.3);
}

.club-footer p {
  font-family: 'Special Elite', cursive;
  color: var(--text-dim);
  font-size: 0.95rem;
}

.footer-sub {
  margin-top: 0.5rem;
  font-family: 'Inter', system-ui, sans-serif !important;
  font-size: 0.75rem !important;
  color: rgba(158, 142, 126, 0.6) !important;
}

/* ===== ERROR STATE ===== */
.error-message {
  background: rgba(255, 45, 45, 0.1);
  border: 1px solid rgba(255, 45, 45, 0.3);
  border-radius: 8px;
  padding: 1rem;
  color: #ff6b6b;
  font-size: 0.9rem;
  margin-top: 1rem;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .stage-container {
    padding: 1rem;
  }

  .neon-text {
    font-size: 2rem;
  }

  .neon-subtitle {
    font-size: 1.1rem;
    letter-spacing: 6px;
  }

  .neon-sign {
    padding: 0.75rem 1.5rem;
  }

  .date-row {
    grid-template-columns: 1fr;
  }

  .tts-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .tts-voice-select {
    min-width: auto;
  }

  .comedy-set {
    padding: 1.25rem;
    font-size: 0.95rem;
  }
}
