@import url('https://fonts.googleapis.com/css2?family=Crimson+Pro:wght@400;600;700;800&family=DM+Sans:wght@400;500;600&display=swap');

:root {
  --bg-deep: #0b0a09;
  --bg-base: #0f0e0c;
  --bg-surface: #1a1816;
  --bg-elevated: #242120;
  --bg-hover: #2e2a27;
  --border: #3a3530;
  --border-light: #4a443d;

  --text-primary: #e8e0d4;
  --text-secondary: #bfb5a5;
  --text-muted: #8a8078;
  --text-dim: #5a5450;

  --accent: #c8944a;
  --accent-bright: #daa558;
  --accent-muted: #a07838;
  --accent-glow: rgba(200, 148, 74, 0.15);

  --danger: #b54444;
  --danger-muted: #8a3535;
  --success: #5a8a5a;
  --success-muted: #3a6a3a;
  --warning: #c49832;
  --warning-muted: #a07828;

  --type-sourcebook: #8a2e4a;
  --type-adventure: #2e6b3e;
  --type-map: #4a6a8a;
  --type-monster: #9a4040;
  --type-token: #7a756e;
  --type-class: #8a7a2e;
  --type-subclass: #b08a30;
  --type-spell: #6a4a8a;
  --type-item: #3a7a7a;
  --type-encounter: #b06a2e;
  --type-npc: #9a6a7a;
  --type-setting: #5a7a5a;
  --type-rules: #6a6e7a;
  --type-reference: #4a6a8a;
  --type-asset: #7a5a3a;
  --type-other: #4a4a4a;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --font-display: 'Crimson Pro', Georgia, serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --transition: 180ms ease;
}

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

html {
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-body);
  background: var(--bg-deep);
  color: var(--text-primary);
  line-height: 1.55;
  min-height: 100vh;
}

h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

h1 { font-size: 2.4rem; font-weight: 800; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.2rem; font-weight: 600; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-bright); }

.hidden { display: none !important; }

/* Auth gate */
.auth-gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(200, 148, 74, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse at 70% 80%, rgba(138, 46, 74, 0.04) 0%, transparent 50%),
    var(--bg-deep);
}

.auth-gate .gate-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 3rem 2.5rem;
  width: 360px;
  text-align: center;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}

.auth-gate h1 {
  color: var(--accent);
  margin-bottom: 0.25rem;
  font-size: 2rem;
}

.auth-gate .subtitle {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 2rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-family: var(--font-body);
}

input[type="text"],
input[type="password"],
input[type="search"],
select,
textarea {
  font-family: var(--font-body);
  font-size: 0.95rem;
  background: var(--bg-base);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  width: 100%;
  outline: none;
  transition: border-color var(--transition);
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent-muted);
}

button, .btn {
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  background: var(--accent);
  color: var(--bg-deep);
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.6rem 1.2rem;
  cursor: pointer;
  transition: background var(--transition), transform 80ms ease;
}

button:hover, .btn:hover {
  background: var(--accent-bright);
}

button:active { transform: scale(0.97); }

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

button.secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

button.secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-light);
}

button.danger {
  background: var(--danger);
  color: var(--text-primary);
}

button.small {
  font-size: 0.8rem;
  padding: 0.35rem 0.75rem;
}

.auth-gate input[type="password"] {
  margin-bottom: 1rem;
  text-align: center;
}

.auth-gate button {
  width: 100%;
}

.auth-error {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 0.75rem;
  min-height: 1.2em;
}

/* Type badges */
.type-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.2rem 0.55rem;
  border-radius: 3px;
  color: var(--text-primary);
  white-space: nowrap;
}

.type-badge.sourcebook { background: var(--type-sourcebook); }
.type-badge.adventure { background: var(--type-adventure); }
.type-badge.map { background: var(--type-map); }
.type-badge.monster { background: var(--type-monster); }
.type-badge.token { background: var(--type-token); }
.type-badge.class { background: var(--type-class); }
.type-badge.subclass { background: var(--type-subclass); }
.type-badge.spell { background: var(--type-spell); }
.type-badge.item { background: var(--type-item); }
.type-badge.encounter { background: var(--type-encounter); }
.type-badge.npc { background: var(--type-npc); }
.type-badge.setting { background: var(--type-setting); }
.type-badge.rules { background: var(--type-rules); }
.type-badge.reference { background: var(--type-reference); }
.type-badge.asset { background: var(--type-asset); }
.type-badge.other { background: var(--type-other); }

/* Progress bar */
.progress-bar {
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 300ms ease;
  width: 0%;
}

/* Toast notifications */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.2rem;
  font-size: 0.9rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  z-index: 1000;
  animation: toast-in 250ms ease;
}

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

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }
