@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --gold: #f5c542;
  --gold-dark: #d4a017;
  --green: #4CAF50;
  --green-dark: #388E3C;
  --bg: #2d1b00;
  --bg-card: rgba(0, 0, 0, 0.75);
  --text: #fff;
  --text-muted: rgba(255, 255, 255, 0.6);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  min-height: 100vh;
}

h1, h2, h3 {
  font-family: 'Press Start 2P', monospace;
}

/* --- Index page --- */

body {
  background: linear-gradient(135deg, var(--bg) 0%, #1a0f00 100%);
}

.page {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px;
}

header {
  text-align: center;
  padding: 24px 0 16px;
}

header h1 {
  color: var(--gold);
  font-size: clamp(16px, 4vw, 28px);
  text-shadow: 2px 2px 0 #000, 4px 4px 0 rgba(0,0,0,0.3);
  line-height: 1.4;
}

header p {
  color: var(--text-muted);
  margin-top: 8px;
  font-size: 14px;
}

/* --- Stream section --- */
.stream-section {
  position: relative;
  width: 100%;
  height: 480px;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  border: 3px solid var(--gold-dark);
}

.stream-section iframe,
#twitch-embed,
#twitch-embed > iframe {
  width: 100% !important;
  height: 100% !important;
  border: none;
}

#twitch-embed {
  position: absolute;
  inset: 0;
}

.stream-offline {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
}

@media (max-width: 639px) {
  .stream-section {
    height: auto;
    aspect-ratio: 16 / 9;
  }
}

/* --- Join section --- */
.join-section {
  margin-top: 20px;
  background: var(--bg-card);
  border-radius: 8px;
  padding: 24px;
  text-align: center;
  border: 2px solid rgba(245, 197, 66, 0.2);
}

.join-form {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

.join-form input {
  padding: 12px 16px;
  font-size: 16px;
  border: 2px solid #555;
  border-radius: 6px;
  width: 220px;
  background: #222;
  color: #fff;
  outline: none;
  transition: border-color 0.2s;
}

.join-form input:focus {
  border-color: var(--gold);
}

.join-form button {
  padding: 12px 28px;
  font-size: 16px;
  font-weight: bold;
  font-family: 'Press Start 2P', monospace;
  border: none;
  border-radius: 6px;
  background: var(--green);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  white-space: nowrap;
}

.join-form button:hover { background: var(--green-dark); }
.join-form button:active { transform: scale(0.97); }
.join-form button:disabled {
  background: #555;
  cursor: not-allowed;
}

.twitch-login {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

/* --- Auth section --- */
.auth-section {
  margin-bottom: 12px;
}

.auth-status {
  font-size: 14px;
  color: var(--green);
  margin-bottom: 8px;
}

.auth-status a {
  color: var(--text-muted);
  font-size: 12px;
  margin-left: 8px;
  cursor: pointer;
  text-decoration: underline;
}

.auth-status a:hover {
  color: var(--gold);
}

.ms-login-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: bold;
  border: none;
  border-radius: 6px;
  background: #2f2f2f;
  color: #fff;
  cursor: pointer;
  transition: background 0.2s;
  text-decoration: none;
}

.ms-login-btn:hover {
  background: #3f3f3f;
}

.ms-login-btn svg {
  width: 20px;
  height: 20px;
}

.auth-error {
  color: #ff4444;
  font-size: 13px;
  margin-bottom: 8px;
}

.auth-guest {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-style: italic;
}

/* --- In-queue state --- */
.queue-status {
  display: none;
  margin-top: 12px;
  font-size: 14px;
}

.queue-status .position {
  font-family: 'Press Start 2P', monospace;
  font-size: 18px;
  color: var(--gold);
  margin-bottom: 4px;
}

/* --- Twitch link section --- */
.twitch-link-section {
  margin-top: 12px;
  padding: 10px;
  border-radius: 6px;
  background: rgba(145, 70, 255, 0.1);
  border: 1px solid rgba(145, 70, 255, 0.3);
}

.twitch-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: bold;
  border: none;
  border-radius: 6px;
  background: #9146ff;
  color: #fff;
  cursor: pointer;
  transition: background 0.2s;
}

.twitch-link-btn:hover { background: #7c3aed; }
.twitch-link-btn:disabled { background: #555; cursor: not-allowed; }

.twitch-link-btn svg {
  width: 16px;
  height: 16px;
}

.twitch-status {
  font-size: 13px;
  margin-top: 6px;
}

.twitch-status.follower { color: #4CAF50; }
.twitch-status.subscriber { color: #9146ff; }
.twitch-status.not-following { color: var(--text-muted); }

.twitch-follow-link {
  color: #9146ff;
  text-decoration: underline;
}

.twitch-follow-link:hover { color: #b388ff; }

/* --- Queue badges --- */
.queue-badge {
  display: inline-block;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: bold;
  margin-left: 4px;
}

.queue-badge.follower-badge {
  background: rgba(76, 175, 80, 0.2);
  color: #4CAF50;
  border: 1px solid rgba(76, 175, 80, 0.4);
}

.queue-badge.subscriber-badge {
  background: rgba(145, 70, 255, 0.2);
  color: #9146ff;
  border: 1px solid rgba(145, 70, 255, 0.4);
}

/* --- Queue list --- */
.queue-section {
  margin-top: 20px;
  background: var(--bg-card);
  border-radius: 8px;
  padding: 20px 24px;
  border: 2px solid rgba(245, 197, 66, 0.2);
}

.queue-section h2 {
  font-size: 12px;
  color: var(--gold);
  margin-bottom: 12px;
  letter-spacing: 1px;
}

.queue-list {
  list-style: none;
  font-size: 14px;
}

.queue-list li {
  padding: 6px 8px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.queue-list li.active {
  background: rgba(76, 175, 80, 0.15);
  color: var(--green);
  font-weight: bold;
}

.queue-list li.you {
  background: rgba(245, 197, 66, 0.15);
  color: var(--gold);
  font-weight: bold;
}

.queue-list .pos {
  min-width: 24px;
  text-align: right;
  color: var(--text-muted);
  font-size: 12px;
}

.queue-empty {
  color: var(--text-muted);
  font-size: 13px;
  font-style: italic;
}

.now-playing {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  margin-bottom: 8px;
  background: rgba(76, 175, 80, 0.1);
  border-radius: 4px;
  font-size: 14px;
}

.now-playing .label {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  color: var(--green);
}

.now-playing .timer {
  margin-left: auto;
  font-family: 'Press Start 2P', monospace;
  font-size: 12px;
}

/* --- Modals --- */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 100;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.modal-overlay.visible {
  display: flex;
}

/* --- Auth modal --- */
.auth-modal-content {
  background: var(--bg-card);
  border: 2px solid var(--gold-dark);
  border-radius: 12px;
  padding: 32px;
  max-width: 420px;
  width: 90%;
  text-align: center;
  position: relative;
}

.auth-modal-content h2 {
  color: var(--gold);
  font-size: 18px;
  margin-bottom: 12px;
}

.auth-modal-content p {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 20px;
  line-height: 1.5;
}

.auth-modal-content .auth-error {
  margin-bottom: 12px;
}

.auth-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
}

.auth-modal-close:hover { color: var(--gold); }

/* --- Redirect modal --- */
.redirect-modal h2 {
  color: var(--gold);
  font-size: 24px;
  margin-bottom: 16px;
}

.redirect-modal .countdown {
  font-family: 'Press Start 2P', monospace;
  font-size: 64px;
  color: var(--green);
}

/* WS reconnection bar */
#ws-status {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  background: #ff4444;
  color: #fff;
  text-align: center;
  padding: 8px;
  font-size: 13px;
  z-index: 200;
}

#ws-status.visible { display: block; }

/* Footer */
footer {
  text-align: center;
  padding: 24px 0 72px;
  font-size: 12px;
  color: var(--text-muted);
}

footer a {
  color: var(--text-muted);
  text-decoration: none;
}

footer a:hover { color: var(--gold); }

/* --- Legal pages (privacy, terms, faq) --- */
.legal-page { max-width: 720px; margin: 0 auto; padding: 24px 16px; }
.legal-content { background: var(--bg-card); border-radius: 8px; padding: 24px 32px; border: 2px solid rgba(245,197,66,0.2); line-height: 1.7; font-size: 14px; }
.legal-content h2 { font-family: 'Segoe UI', system-ui, sans-serif; font-size: 18px; font-weight: bold; color: var(--gold); margin: 24px 0 12px; }
.legal-content ul { margin: 8px 0 16px 20px; }
.legal-content li { margin-bottom: 6px; }
.legal-content p { margin-bottom: 12px; }
.legal-notice { font-style: italic; color: var(--text-muted); font-size: 13px; margin-bottom: 16px; }
.gold-link { color: var(--gold); text-decoration: underline; }
.gold-link:hover { color: var(--gold-dark); }
.back-link { display: inline-block; margin-top: 20px; color: var(--text-muted); text-decoration: none; font-size: 13px; }
.back-link:hover { color: var(--gold); }

/* --- Paused banner --- */
.paused-banner {
  display: none;
  background: rgba(255, 170, 0, 0.12);
  border: 2px solid rgba(255, 170, 0, 0.4);
  border-radius: 8px;
  padding: 14px 20px;
  margin-top: 16px;
  text-align: center;
  color: #ffaa00;
  font-size: 14px;
  font-weight: bold;
}
.paused-banner.visible { display: block; }
.paused-banner .detail {
  font-weight: normal;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* --- Language selector --- */
.lang-selector { position: fixed; top: 12px; right: 12px; z-index: 50; }
.lang-toggle {
  display: flex; align-items: center; gap: 4px; padding: 6px 10px;
  background: rgba(0,0,0,0.6); border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px; color: var(--text); cursor: pointer; font-size: 13px;
  transition: border-color 0.2s;
}
.lang-toggle:hover { border-color: var(--gold); }
.lang-toggle svg { width: 16px; height: 16px; opacity: 0.7; }
.lang-dropdown {
  display: none; position: absolute; top: 100%; right: 0; margin-top: 4px;
  background: rgba(0,0,0,0.95); border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px; overflow: hidden; min-width: 140px;
}
.lang-dropdown.open { display: block; }
.lang-option {
  display: block; width: 100%; padding: 8px 14px; background: none;
  border: none; color: var(--text); font-size: 13px; text-align: left;
  cursor: pointer; transition: background 0.15s;
}
.lang-option:hover { background: rgba(245,197,66,0.15); }
.lang-option.active { color: var(--gold); font-weight: bold; }

/* --- Mute toggle --- */
.mute-toggle {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 50;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.2);
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s;
}
.mute-toggle:hover {
  background: rgba(0,0,0,0.8);
  border-color: var(--gold);
}
.mute-toggle.muted {
  color: var(--text-muted);
  border-color: rgba(255,255,255,0.1);
}

/* --- Update banner --- */
.update-banner {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 90;
  background: rgba(30,20,0,0.95);
  border-bottom: 2px solid var(--gold);
  padding: 10px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text);
  transform: translateY(-100%);
  transition: transform 0.3s ease;
}

#update-banner-text {
  cursor: pointer;
}

.update-banner-refresh {
  margin-left: 12px;
  background: var(--gold);
  color: #000;
  border: none;
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}

.update-banner-close {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
}

/* --- Cookie consent banner --- */
#cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0,0,0,0.95);
  color: #fff;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 9999;
  font-size: 13px;
  flex-wrap: wrap;
  border-top: 1px solid rgba(255,255,255,0.15);
}

#cookie-banner a {
  color: var(--gold);
  text-decoration: underline;
}

#cookie-banner .cookie-accept {
  padding: 8px 20px;
  border: none;
  border-radius: 4px;
  background: var(--green);
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: bold;
}

#cookie-banner .cookie-decline {
  padding: 8px 20px;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 4px;
  background: transparent;
  color: #fff;
  cursor: pointer;
  font-size: 13px;
}
