/* ═══════════════════════════════════════════════
   PsiGame – Global Stylesheet
   ═══════════════════════════════════════════════ */

/* ── Design Tokens ── */
:root {
  --primary: #6C3CE1;
  --primary-dark: #5530b8;
  --primary-light: #8b5cf6;
  --accent: #F5A623;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;

  --bg: #0d0f1a;
  --bg-card: #151827;
  --bg-card-2: #1c2035;
  --border: rgba(255,255,255,0.08);
  --border-light: rgba(255,255,255,0.12);

  --text: #f0f2ff;
  --text-muted: #8892a4;
  --text-subtle: #5a6478;

  --gradient-main: linear-gradient(135deg, #6C3CE1 0%, #a855f7 50%, #ec4899 100%);
  --gradient-card: linear-gradient(135deg, rgba(108,60,225,0.15) 0%, rgba(168,85,247,0.05) 100%);

  --radius: 12px;
  --radius-lg: 20px;
  --radius-sm: 8px;
  --radius-xs: 5px;

  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 48px rgba(0,0,0,0.4);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --transition: 0.2s ease;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary-light); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--text); }

img { max-width: 100%; }

.hidden { display: none !important; }

/* ── Containers ── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* ═══════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

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

.btn-primary {
  background: var(--gradient-main);
  color: #fff;
  box-shadow: 0 4px 15px rgba(108,60,225,0.4);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(108,60,225,0.6);
  color: #fff;
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--border-light);
}
.btn-outline:hover {
  background: rgba(255,255,255,0.07);
  border-color: var(--primary-light);
  color: var(--text);
}

.btn-ghost {
  background: rgba(255,255,255,0.06);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text);
}

.btn-success { background: var(--success); color: #fff; }
.btn-warning { background: var(--warning); color: #000; }
.btn-danger { background: var(--danger); color: #fff; }

.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.82rem; }
.btn-xs { padding: 0.25rem 0.6rem; font-size: 0.75rem; }
.btn-lg { padding: 0.85rem 1.75rem; font-size: 1rem; }
.btn-full { width: 100%; justify-content: center; }

/* ═══════════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════════ */
.form-group { margin-bottom: 1.25rem; }

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.45rem;
}

.form-label.required::after {
  content: ' *';
  color: var(--danger);
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 1rem;
  font-size: 1rem;
  line-height: 1;
  pointer-events: none;
  z-index: 1;
}

.input-toggle-pass {
  position: absolute;
  right: 1rem;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 0;
  color: var(--text-muted);
}

.form-input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.75rem;
  background: var(--bg-card-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.95rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-input:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(108,60,225,0.2);
}

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

.code-input {
  letter-spacing: 0.2em;
  font-weight: 700;
  font-size: 1.1rem;
  text-align: center;
  text-transform: uppercase;
}

.form-hint {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

/* ═══════════════════════════════════════════════
   BADGES
   ═══════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.65rem;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  gap: 0.25rem;
}

.badge-success { background: rgba(34,197,94,0.15); color: #4ade80; border: 1px solid rgba(34,197,94,0.3); }
.badge-danger  { background: rgba(239,68,68,0.15);  color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
.badge-warning { background: rgba(245,158,11,0.15); color: #fbbf24; border: 1px solid rgba(245,158,11,0.3); }
.badge-info    { background: rgba(59,130,246,0.15); color: #60a5fa; border: 1px solid rgba(59,130,246,0.3); }
.badge-gray    { background: rgba(255,255,255,0.07); color: var(--text-muted); border: 1px solid var(--border); }
.badge-new     { background: var(--gradient-main); color: #fff; }

/* ═══════════════════════════════════════════════
   TOASTS
   ═══════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-width: 380px;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.9rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-size: 0.88rem;
  animation: slideInRight 0.3s ease;
  color: var(--text);
}

.toast-success { border-left: 3px solid var(--success); }
.toast-danger  { border-left: 3px solid var(--danger); }
.toast-warning { border-left: 3px solid var(--warning); }
.toast-info    { border-left: 3px solid var(--info); }

.toast-icon { font-size: 1.1rem; flex-shrink: 0; }
.toast-close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
}
.toast-close:hover { color: var(--text); }

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

/* ═══════════════════════════════════════════════
   AUTH PAGES (login, enter)
   ═══════════════════════════════════════════════ */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  position: relative;
  overflow: hidden;
}

.auth-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.25;
}

.bg-orb-1 {
  width: 400px; height: 400px;
  background: var(--primary);
  top: -100px; left: -100px;
}

.bg-orb-2 {
  width: 350px; height: 350px;
  background: #ec4899;
  bottom: -100px; right: -50px;
}

.bg-orb-3 {
  width: 250px; height: 250px;
  background: var(--accent);
  top: 50%; right: 15%;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 450px;
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 1;
  backdrop-filter: blur(10px);
}

.auth-header { text-align: center; margin-bottom: 2rem; }

.auth-logo {
  font-size: 3.5rem;
  display: block;
  margin-bottom: 1rem;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-8px); }
}

.auth-title {
  font-size: 1.75rem;
  font-weight: 800;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}

.auth-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.auth-form { display: flex; flex-direction: column; gap: 0; }

.auth-footer {
  margin-top: 1.5rem;
  text-align: center;
}

.link-muted {
  color: var(--text-muted);
  font-size: 0.85rem;
}
.link-muted:hover { color: var(--text); }

.back-link {
  position: fixed;
  top: 1.5rem;
  left: 1.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  z-index: 10;
  transition: color var(--transition);
}
.back-link:hover { color: var(--text); }

/* Info Box */
.info-box {
  display: flex;
  gap: 0.75rem;
  padding: 1rem;
  background: rgba(108,60,225,0.1);
  border: 1px solid rgba(108,60,225,0.25);
  border-radius: var(--radius-sm);
  margin-top: 1rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.info-box-blue {
  background: rgba(59,130,246,0.08);
  border-color: rgba(59,130,246,0.2);
}

/* ═══════════════════════════════════════════════
   LANDING PAGE
   ═══════════════════════════════════════════════ */
.landing-wrapper { min-height: 100vh; }

/* Nav */
.landing-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: rgba(13,15,26,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.3rem;
  font-weight: 800;
}

.brand-icon { font-size: 1.5rem; }
.brand-text { background: var(--gradient-main); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }

/* Hero */
.landing-main {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  padding: 7rem 4rem 4rem;
  max-width: 1200px;
  margin: 0 auto;
  gap: 4rem;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  background: rgba(108,60,225,0.15);
  border: 1px solid rgba(108,60,225,0.3);
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary-light);
  margin-bottom: 1.5rem;
}

.badge-dot {
  width: 6px; height: 6px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.8); }
}

.hero-title {
  font-size: clamp(2.5rem, 5vw, 3.8rem);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 1.25rem;
}

.gradient-text {
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.7;
  margin-bottom: 2rem;
  max-width: 480px;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 2.5rem;
}

.hero-stats {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.25rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: fit-content;
}

.stat-item { text-align: center; }
.stat-number { display: block; font-size: 1.4rem; font-weight: 800; background: var(--gradient-main); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.stat-label  { display: block; font-size: 0.72rem; color: var(--text-muted); margin-top: 0.1rem; }
.stat-divider { width: 1px; height: 40px; background: var(--border); }

/* Hero Visual */
.hero-visual {
  position: relative;
  height: 450px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.central-orb {
  width: 160px; height: 160px;
  background: var(--gradient-main);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  box-shadow: 0 0 60px rgba(108,60,225,0.5);
  animation: float 4s ease-in-out infinite;
  z-index: 2;
}

.float-card {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 0.85rem 1.1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.card-emoji { font-size: 1.5rem; }

.card-1 { top: 5%;     left: 5%;   animation: float 3.5s ease-in-out infinite; }
.card-2 { top: 5%;     right: 10%; animation: float 4.5s ease-in-out infinite 0.5s; }
.card-3 { bottom: 15%; left: 0%;   animation: float 3s   ease-in-out infinite 1s; }
.card-4 { bottom: 10%; right: 5%;  animation: float 4s   ease-in-out infinite 0.8s; }

/* Features Section */
.section-features {
  padding: 5rem 0;
  background: rgba(255,255,255,0.02);
  border-top: 1px solid var(--border);
}

.section-header {
  text-align: center;
  margin-bottom: 3rem;
}

.section-header h2 {
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.section-header p {
  color: var(--text-muted);
  font-size: 1rem;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  position: relative;
  transition: transform var(--transition), border-color var(--transition);
}

.feature-card:hover {
  transform: translateY(-5px);
  border-color: var(--primary);
}

.feature-number {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--primary-light);
  letter-spacing: 0.1em;
  margin-bottom: 1rem;
}

.feature-icon { font-size: 2.5rem; margin-bottom: 1rem; }

.feature-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.65rem;
}

.feature-card p { color: var(--text-muted); font-size: 0.9rem; line-height: 1.6; }

/* CTA Section */
.section-cta {
  padding: 5rem 0;
  border-top: 1px solid var(--border);
}

.cta-card {
  background: var(--gradient-card);
  border: 1px solid rgba(108,60,225,0.3);
  border-radius: var(--radius-lg);
  padding: 3.5rem;
  text-align: center;
}

.cta-card h2 { font-size: 2rem; font-weight: 800; margin-bottom: 0.75rem; }
.cta-card p  { color: var(--text-muted); margin-bottom: 2rem; font-size: 1rem; }

/* Footer */
.landing-footer {
  border-top: 1px solid var(--border);
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ═══════════════════════════════════════════════
   GAME LOBBY
   ═══════════════════════════════════════════════ */
.lobby-wrapper { min-height: 100vh; display: flex; flex-direction: column; }

.lobby-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.lobby-brand {
  font-size: 1.2rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.lobby-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-avatar { font-size: 1.8rem; }

.user-info {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.user-name  { font-weight: 700; font-size: 0.95rem; }
.user-role  { font-size: 0.75rem; color: var(--text-muted); }

.lobby-main { flex: 1; padding: 3rem 0; }

.lobby-welcome { text-align: center; margin-bottom: 3rem; }
.lobby-welcome h1 { font-size: 2rem; font-weight: 800; margin-bottom: 0.5rem; }
.lobby-welcome p  { color: var(--text-muted); }

.games-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.game-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  position: relative;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.game-card:hover { transform: translateY(-4px); border-color: var(--primary); }
.game-icon  { font-size: 2.5rem; }
.game-title { font-size: 1.05rem; font-weight: 700; }
.game-desc  { font-size: 0.85rem; color: var(--text-muted); line-height: 1.6; flex: 1; }

.game-badge {
  position: absolute;
  top: 1rem; right: 1rem;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
  background: var(--gradient-main);
  color: #fff;
}

.game-meta { display: flex; gap: 1rem; font-size: 0.78rem; color: var(--text-muted); }

.game-info-card { background: var(--gradient-card); border-color: rgba(108,60,225,0.25); }

.progress-info { display: flex; align-items: center; gap: 0.75rem; font-size: 0.8rem; color: var(--text-muted); }

.progress-bar { flex: 1; height: 6px; background: var(--border); border-radius: 100px; }
.progress-fill { height: 100%; background: var(--gradient-main); border-radius: 100px; transition: width 0.4s ease; }

.lobby-notice {
  margin-top: 3rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  background: rgba(245,166,35,0.08);
  border: 1px solid rgba(245,166,35,0.2);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.85rem;
}

.notice-icon { font-size: 1.5rem; flex-shrink: 0; }

/* ═══════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════ */
@media (max-width: 900px) {
  .landing-main  { grid-template-columns: 1fr; padding-top: 6rem; }
  .hero-visual   { display: none; }
  .features-grid { grid-template-columns: 1fr; }
  .games-grid    { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
  .games-grid     { grid-template-columns: 1fr; }
  .hero-actions   { flex-direction: column; }
  .landing-main   { padding: 6rem 1.5rem 2rem; }
  .auth-card      { padding: 2rem 1.5rem; }
  .hero-stats     { flex-wrap: wrap; }
}
