/* =====================================================
   AeternisMU — Season 21 Browser Client
   Dark Fantasy MMORPG Theme
   ===================================================== */

/* ─── DESIGN TOKENS ─── */
:root {
  --fire: #ff7a00;
  --fire-dark: #c45500;
  --fire-light: #ffaa44;
  --fire-glow: rgba(255,122,0,.45);
  --ice: #00d4ff;
  --ice-dark: #008fbb;
  --ice-glow: rgba(0,212,255,.4);
  --gold: #ffd54f;
  --gold-dark: #c49a00;
  --gold-light: #ffe89a;
  --gold-glow: rgba(255,213,79,.35);
  --bg: #050a14;
  --panel-bg: rgba(8,12,28,.82);
  --border: rgba(255,213,79,.12);
  --border-hi: rgba(255,213,79,.35);
  --text: #c0b8a0;
  --text-hi: #f0eada;
  --text-dim: #6a6252;
  --heading: 'Cinzel', serif;
  --heading-d: 'Cinzel Decorative', serif;
  --body: 'Inter', 'Segoe UI', sans-serif;
}

/* ─── RESET ─── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; overflow: hidden; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
::selection { background: rgba(255,213,79,.15); color: #fff; }

/* ─── BACKGROUND SCENE ─── */
.bg-scene {
  position: fixed; inset: 0; z-index: 0;
  background:
    url('/assets/background.webp') center center / cover no-repeat,
    url('/assets/background.png') center center / cover no-repeat;
  filter: brightness(.62) contrast(1.1) saturate(1.15);
}
.bg-scene::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 50% 35%, transparent 0%, rgba(5,10,20,.4) 60%, rgba(5,10,20,.92) 100%),
    linear-gradient(180deg, rgba(5,10,20,.6) 0%, transparent 20%, transparent 70%, rgba(5,10,20,.95) 100%);
}

/* Floating particles */
.bg-particles {
  position: fixed; inset: 0; z-index: 1; pointer-events: none; overflow: hidden;
}
.particle {
  position: absolute;
  width: 2px; height: 2px;
  background: var(--gold);
  border-radius: 50%;
  opacity: 0;
  animation: particleFloat linear infinite;
}
@keyframes particleFloat {
  0% { opacity: 0; transform: translateY(0) scale(0.5); }
  10% { opacity: .7; }
  90% { opacity: .6; }
  100% { opacity: 0; transform: translateY(-100vh) scale(1); }
}

/* ─── SCREENS ─── */
.screen { display: none; width: 100vw; height: 100vh; position: relative; z-index: 10; }
.screen.active { display: flex; }

/* ═══════════════════════════════════════
   LOGIN SCREEN
   ═══════════════════════════════════════ */
#login-screen {
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

.login-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  max-width: 440px;
  width: 100%;
  padding: 0 20px;
  animation: fadeInUp .8s ease-out;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── LOGO ─── */
.logo-area {
  text-align: center;
  margin-bottom: 8px;
}
.logo-img {
  max-width: 360px;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 0 30px rgba(0,180,255,.3)) drop-shadow(0 0 60px rgba(255,100,0,.2));
  animation: logoPulse 4s ease-in-out infinite;
}
@keyframes logoPulse {
  0%, 100% { filter: drop-shadow(0 0 30px rgba(0,180,255,.3)) drop-shadow(0 0 60px rgba(255,100,0,.2)); }
  50% { filter: drop-shadow(0 0 40px rgba(0,180,255,.45)) drop-shadow(0 0 80px rgba(255,100,0,.35)); }
}
.logo-tagline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 2px 0 6px;
  font-family: var(--heading);
}
.orn-wing {
  color: var(--gold-dark);
  font-size: 11px;
  opacity: .5;
  letter-spacing: 1px;
}
.orn-gem {
  color: var(--gold);
  font-size: 10px;
  text-shadow: 0 0 10px var(--gold-glow);
  animation: gemPulse 2s ease-in-out infinite;
}
@keyframes gemPulse {
  0%, 100% { text-shadow: 0 0 10px var(--gold-glow); }
  50% { text-shadow: 0 0 20px var(--gold-glow), 0 0 30px rgba(255,213,79,.2); }
}
.logo-sub {
  font-family: var(--heading);
  font-size: 11px;
  letter-spacing: 6px;
  color: var(--gold-dark);
  text-shadow: 0 0 10px rgba(255,213,79,.15);
  opacity: .7;
}

/* ─── LOGIN PANEL ─── */
.login-panel {
  position: relative;
  width: 100%;
  padding: 28px 32px 24px;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  backdrop-filter: blur(30px);
  box-shadow:
    0 0 0 1px rgba(0,0,0,.5),
    inset 0 1px 0 rgba(255,213,79,.06),
    0 20px 60px rgba(0,0,0,.6),
    0 0 100px rgba(0,0,0,.3);
}
/* Gold corner decorations */
.panel-corner {
  position: absolute; width: 16px; height: 16px;
  border-color: var(--gold-dark);
  border-style: solid;
  opacity: .4;
}
.panel-corner.tl { top: -1px; left: -1px; border-width: 2px 0 0 2px; }
.panel-corner.tr { top: -1px; right: -1px; border-width: 2px 2px 0 0; }
.panel-corner.bl { bottom: -1px; left: -1px; border-width: 0 0 2px 2px; }
.panel-corner.br { bottom: -1px; right: -1px; border-width: 0 2px 2px 0; }

.panel-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 24px;
}
.panel-header span {
  font-family: var(--heading);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--gold);
  white-space: nowrap;
  text-shadow: 0 0 20px var(--gold-glow);
}
.panel-header-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-dark), transparent);
  opacity: .3;
}

/* Fields */
.field-group {
  margin-bottom: 18px;
}
.field-group label {
  display: block;
  font-family: var(--heading);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 3px;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.field-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.field-icon {
  position: absolute;
  left: 14px;
  width: 16px; height: 16px;
  color: var(--gold-dark);
  opacity: .5;
  pointer-events: none;
}
.field-wrap input {
  width: 100%;
  padding: 13px 16px 13px 42px;
  background: rgba(5,10,20,.7);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-hi);
  font-family: var(--body);
  font-size: 14px;
  outline: none;
  transition: border-color .3s, box-shadow .3s;
}
.field-wrap input:focus {
  border-color: var(--border-hi);
  box-shadow: 0 0 20px rgba(255,213,79,.08), inset 0 0 20px rgba(255,213,79,.03);
}
.field-wrap input::placeholder {
  color: rgba(192,184,160,.25);
  font-size: 13px;
}

/* Play Button */
.btn-play {
  position: relative;
  width: 100%;
  padding: 15px;
  margin-top: 6px;
  background: linear-gradient(180deg, #4a3000 0%, #2a1a00 50%, #3a2800 100%);
  border: 1px solid var(--gold-dark);
  border-radius: 3px;
  color: var(--gold);
  font-family: var(--heading);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 5px;
  cursor: pointer;
  transition: all .3s;
  text-shadow: 0 0 12px var(--gold-glow);
  overflow: hidden;
}
.btn-play::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255,213,79,.1) 0%, transparent 50%, rgba(255,213,79,.05) 100%);
  opacity: 0;
  transition: opacity .3s;
}
.btn-play:hover {
  border-color: var(--gold);
  box-shadow: 0 0 30px rgba(255,213,79,.2), inset 0 0 30px rgba(255,213,79,.05);
  text-shadow: 0 0 20px var(--gold-glow), 0 0 40px rgba(255,213,79,.2);
  transform: translateY(-1px);
}
.btn-play:hover::before { opacity: 1; }
.btn-play:active {
  transform: translateY(0);
  box-shadow: 0 0 15px rgba(255,213,79,.15);
}
.btn-play:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none !important;
}

.error-msg {
  color: #ff5555;
  font-family: var(--body);
  font-size: 12px;
  text-align: center;
  margin-top: 12px;
  min-height: 18px;
  text-shadow: 0 0 10px rgba(255,85,85,.3);
}

/* ─── SERVER STATUS BAR ─── */
.server-status-bar {
  width: 100%;
  margin-top: 16px;
  display: flex;
  justify-content: center;
}
.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  background: rgba(5,10,20,.6);
  border: 1px solid rgba(255,213,79,.06);
  border-radius: 20px;
  backdrop-filter: blur(10px);
}
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #555;
  transition: all .4s;
}
.status-dot.online {
  background: #44ff44;
  box-shadow: 0 0 8px rgba(68,255,68,.5), 0 0 20px rgba(68,255,68,.2);
  animation: statusPulse 2s ease-in-out infinite;
}
@keyframes statusPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(68,255,68,.5); }
  50% { box-shadow: 0 0 12px rgba(68,255,68,.7), 0 0 25px rgba(68,255,68,.3); }
}
.status-dot.offline {
  background: #ff4444;
  box-shadow: 0 0 8px rgba(255,68,68,.4);
}
#server-status-text {
  font-family: var(--heading);
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--text-dim);
}

/* ─── MUSIC TOGGLE ─── */
.music-btn {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 100;
  width: 36px; height: 36px;
  background: rgba(5,10,20,.7);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--gold-dark);
  font-size: 16px;
  cursor: pointer;
  transition: all .3s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.music-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
  box-shadow: 0 0 15px var(--gold-glow);
}
.music-btn.playing {
  color: var(--gold);
  border-color: var(--gold-dark);
  animation: musicPulse 1s ease-in-out infinite;
}
@keyframes musicPulse {
  0%, 100% { box-shadow: 0 0 5px var(--gold-glow); }
  50% { box-shadow: 0 0 15px var(--gold-glow); }
}

/* ═══════════════════════════════════════
   GAME SCREEN
   ═══════════════════════════════════════ */
#game-screen {
  flex-direction: column;
  background: #000;
}

#stream-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  cursor: none;
  outline: none;
}
#stream-video, #stream-canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  background: #000;
}
#stream-canvas { display: none; }

/* Stream Overlay */
#stream-overlay {
  position: absolute; inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: rgba(5,10,20,.9);
  z-index: 10;
  transition: opacity .5s;
}
#stream-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}
.loading-spinner {
  width: 48px; height: 48px;
  border: 2px solid var(--border);
  border-top: 2px solid var(--gold);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

#stream-status {
  font-family: var(--heading);
  font-size: 13px;
  letter-spacing: 2px;
  color: var(--text-dim);
}

/* Toolbar */
#game-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 12px;
  background: rgba(8,12,28,.95);
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-dim);
  height: 36px;
  z-index: 20;
}
#latency-display {
  font-family: 'Courier New', monospace;
  font-size: 11px;
}
#session-info {
  flex: 1;
  font-family: var(--heading);
  font-size: 10px;
  letter-spacing: 1px;
}

.toolbar-btn {
  padding: 4px 12px;
  background: rgba(255,213,79,.06);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--gold-dark);
  cursor: pointer;
  font-size: 14px;
  transition: all .2s;
}
.toolbar-btn:hover {
  background: rgba(255,213,79,.12);
  border-color: var(--border-hi);
  color: var(--gold);
}
.toolbar-btn.danger {
  border-color: rgba(255,80,80,.2);
  color: #cc6666;
}
.toolbar-btn.danger:hover {
  background: rgba(255,80,80,.15);
  color: #ff8888;
}

/* Fullscreen */
:fullscreen #game-toolbar { display: none; }
:fullscreen #stream-container { cursor: default; }
:fullscreen .music-btn { display: none; }
