/* ============================================================
   ENGINE GUILD — Core Stylesheet
   engine.tcgguilds.co.uk
   Dark fantasy TCG aesthetic matching TCGGuilds brand
   ============================================================ */

/* ── Fonts ─────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=Raleway:wght@300;400;500;600&display=swap');

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --gold:        #c5a059;
  --gold-light:  #e2c07a;
  --gold-dim:    #8a6d3b;
  --bg-deep:     #0d0d1a;
  --bg-card:     #13132a;
  --bg-panel:    #1a1a35;
  --bg-input:    #0f0f22;
  --border:      rgba(197,160,89,0.25);
  --border-focus:rgba(197,160,89,0.7);
  --text:        #e8e0d0;
  --muted:       #8a7f6e;
  --danger:      #c0392b;
  --danger-light:#e74c3c;
  --success:     #27ae60;
  --radius:      8px;
  --radius-lg:   14px;
  --shadow:      0 8px 32px rgba(0,0,0,0.6);
  --glow:        0 0 24px rgba(197,160,89,0.15);
}

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

html { height: 100%; }

body {
  min-height: 100%;
  background-color: var(--bg-deep);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(197,160,89,0.04) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(100,80,160,0.06) 0%, transparent 50%);
  color: var(--text);
  font-family: 'Raleway', sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

/* ── Typography ────────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: 'Cinzel', serif;
  color: var(--gold);
  letter-spacing: 0.04em;
  line-height: 1.3;
}

h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); font-weight: 700; }
h2 { font-size: clamp(1.2rem, 3vw, 1.6rem); font-weight: 600; }
h3 { font-size: 1rem; font-weight: 600; }

p  { color: var(--text); }

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

/* ── Screen system (from original index.html) ──────────────── */
.screen { display: none; }
.screen.active { display: flex; }

/* ── Auth layout ───────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.auth-logo {
  margin-bottom: 2rem;
  text-align: center;
}
.auth-logo img {
  height: 56px;
  width: auto;
}
.auth-logo .engine-tag {
  display: block;
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  color: var(--muted);
  margin-top: 0.4rem;
  text-transform: uppercase;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.2rem 2.4rem;
  box-shadow: var(--shadow), var(--glow);
}

.auth-card h2 {
  margin-bottom: 0.3rem;
}
.auth-card .auth-subtitle {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 1.8rem;
}

/* ── Form elements ─────────────────────────────────────────── */
.form-group {
  margin-bottom: 1.2rem;
}
.form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.4rem;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: 'Raleway', sans-serif;
  font-size: 0.95rem;
  padding: 0.65rem 0.9rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(197,160,89,0.1);
}
.form-group input::placeholder { color: var(--muted); }
.form-group textarea { resize: vertical; min-height: 90px; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn-primary,
.btn-secondary,
.btn-ghost,
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: 'Cinzel', serif;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--gold-dim), var(--gold));
  color: #0d0d1a;
  width: 100%;
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(197,160,89,0.3);
  color: #0d0d1a;
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--border);
  width: 100%;
}
.btn-secondary:hover {
  border-color: var(--gold);
  background: rgba(197,160,89,0.08);
  color: var(--gold-light);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  font-family: 'Raleway', sans-serif;
  font-size: 0.82rem;
}
.btn-ghost:hover { color: var(--gold); border-color: var(--border); }

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: var(--danger-light); }

.btn-primary:disabled,
.btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ── Alerts ────────────────────────────────────────────────── */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.88rem;
  margin-bottom: 1.2rem;
  display: none;
}
.alert.show { display: block; }
.alert-error   { background: rgba(192,57,43,0.15); border: 1px solid rgba(192,57,43,0.4); color: #e74c3c; }
.alert-success { background: rgba(39,174,96,0.15);  border: 1px solid rgba(39,174,96,0.4);  color: #2ecc71; }
.alert-info    { background: rgba(197,160,89,0.1);  border: 1px solid rgba(197,160,89,0.3); color: var(--gold); }

/* ── Divider ───────────────────────────────────────────────── */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin: 1.4rem 0;
  color: var(--muted);
  font-size: 0.78rem;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Auth footer links ─────────────────────────────────────── */
.auth-links {
  margin-top: 1.4rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}
.auth-links a { color: var(--gold); }
.auth-links a:hover { color: var(--gold-light); }

/* ── Anti-bot check ────────────────────────────────────────── */
.captcha-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.9rem;
  margin-bottom: 1.2rem;
}
.captcha-row span {
  color: var(--gold);
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  flex: 1;
}
.captcha-row input {
  width: 70px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 0.95rem;
  padding: 0.2rem 0.4rem;
  outline: none;
  text-align: center;
}
.captcha-row input:focus { border-bottom-color: var(--gold); }

/* ── Tab switcher (Login / Register toggle) ────────────────── */
.auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.8rem;
  gap: 0;
}
.auth-tab {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  padding: 0.7rem;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: -1px;
  text-transform: uppercase;
}
.auth-tab:hover { color: var(--gold); }
.auth-tab.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

/* ── Tab content panels ────────────────────────────────────── */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Role badges ───────────────────────────────────────────── */
.role-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  margin-left: 0.5rem;
}
.role-badge.developer {
  background: rgba(197,160,89,0.15);
  color: var(--gold);
  border: 1px solid var(--border);
}
.role-badge.player {
  background: rgba(100,80,160,0.2);
  color: #a89fd4;
  border: 1px solid rgba(100,80,160,0.3);
}

/* ── Register: role selector ───────────────────────────────── */
.role-select-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
  margin-bottom: 1.4rem;
}
.role-option {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 0.8rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg-input);
}
.role-option:hover { border-color: var(--gold-dim); }
.role-option.selected {
  border-color: var(--gold);
  background: rgba(197,160,89,0.08);
  box-shadow: 0 0 12px rgba(197,160,89,0.12);
}
.role-option .role-icon { font-size: 1.6rem; margin-bottom: 0.4rem; }
.role-option .role-name {
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  color: var(--gold);
  letter-spacing: 0.06em;
}
.role-option .role-desc {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.2rem;
}
.role-option input[type="radio"] { display: none; }

/* Developer-only fields — shown/hidden by JS */
.developer-fields { display: none; }
.developer-fields.show { display: block; }

/* ── Password strength ─────────────────────────────────────── */
.pw-strength {
  height: 3px;
  border-radius: 2px;
  margin-top: 0.4rem;
  background: var(--bg-input);
  overflow: hidden;
}
.pw-strength-fill {
  height: 100%;
  width: 0;
  border-radius: 2px;
  transition: width 0.3s, background 0.3s;
}

/* ── Footer ────────────────────────────────────────────────── */
.auth-footer {
  margin-top: 2.5rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
}
.auth-footer a { color: var(--muted); }
.auth-footer a:hover { color: var(--gold); }

/* ── Loader (keep from original) ──────────────────────────── */
.loader-box {
  text-align: center;
  padding: 2rem;
}
.progress-bar {
  width: 240px;
  height: 4px;
  background: var(--bg-panel);
  border-radius: 2px;
  margin: 1rem auto 0;
  overflow: hidden;
}
#progress-fill {
  height: 100%;
  width: 0;
  background: var(--gold);
  border-radius: 2px;
  transition: width 0.3s;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 480px) {
  .auth-card { padding: 1.6rem 1.2rem; }
  .role-select-grid { grid-template-columns: 1fr; }
}

/* ── Reduced motion ────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
