:root {
  /* Core Colors */
  --bg-dark: #09090b;
  --bg-surface: #0f1117;
  --bg-surface-elevated: #1c1f2a;
  
  /* Text */
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  
  /* Accents */
  --accent: #8b5cf6;
  --accent-glow: rgba(139, 92, 246, 0.2);
  --accent-hover: #7c3aed;
  --gold: #fbbf24;
  --gold-glow: rgba(251, 191, 36, 0.2);
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.2);
  --danger: #ef4444;
  --warning: #f59e0b;

  /* Borders */
  --card-border: #27272a;
  --border-focus: #8b5cf6;
  
  /* Utilities */
  --border-radius-sm: 8px;
  --border-radius-md: 12px;
  --border-radius-lg: 16px;
  --border-radius-xl: 24px;

  --header-height: 64px;
}

@media (max-width: 480px) {
  :root {
    --header-height: 56px;
  }
}

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

html {
  height: 100%;
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-height);
}

body {
  min-height: 100%;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  color: var(--text-primary);
  background-color: transparent;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}

/* Never let media or embeds force horizontal scroll on mobile */
img, video, svg, canvas {
  max-width: 100%;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  line-height: 1.2;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

ul {
  list-style: none;
}

/* Base button */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--border-radius-sm);
  font-size: 14px;
  font-weight: 600;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--card-border);
  color: var(--text-primary);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.button:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 4px 12px var(--accent-glow);
}

/* Modals */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--card-border);
  border-radius: var(--border-radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 480px;
  position: relative;
  transform: translateY(20px);
  transition: transform 0.3s ease;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.modal.active .modal-content {
  transform: translateY(0);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* Toast (layout/severity live in app.css) */
.toast {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--card-border);
  border-radius: var(--border-radius-sm);
  padding: 12px 20px;
  color: var(--text-primary);
  font-weight: 500;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  gap: 12px;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 2000;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* Form Inputs */
.portal-input {
  width: 100%;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--card-border);
  border-radius: var(--border-radius-sm);
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  transition: all 0.2s;
}

.portal-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.portal-input::placeholder {
  color: var(--text-muted);
}

/* Accessibility Focus Ring for Keyboard Users */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible),
input:focus:not(:focus-visible) {
  outline: none;
}

/* Modal Scroll Lock */
html.modal-open,
body.modal-open {
  overflow: hidden !important;
  height: 100vh !important;
  height: 100dvh !important;
}
