:root {
  --bg-primary: #070708;
  --bg-secondary: #0D0D10;
  --bg-surface: #141418;
  --bg-surface-elevated: #1B1B22;
  --bg-glass: rgba(18, 18, 22, 0.75);
  
  --gold-primary: #D4AF37;
  --gold-light: #F5E296;
  --gold-dark: #996515;
  --gold-gradient: linear-gradient(135deg, #ECC86A 0%, #D4AF37 50%, #B88E28 100%);
  --gold-glow: 0 0 20px rgba(212, 175, 55, 0.25);
  --gold-border: rgba(212, 175, 55, 0.22);
  --gold-border-focus: rgba(212, 175, 55, 0.6);

  --text-primary: #FFFFFF;
  --text-secondary: #A0A0B0;
  --text-muted: #626270;
  --text-gold: #ECC86A;

  --border-subtle: #22222A;
  --border-card: #2B2B36;

  --accent-red: #E05252;
  --accent-blue: #3E8BFF;
  --accent-green: #38C172;

  --font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-heading: 'Syne', -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
  --font-body: 'Outfit', -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

/* Standalone iOS safeguard if env() has not yet fired on first tick */
html.is-ios-standalone {
  --safe-top: max(env(safe-area-inset-top, 0px), 20px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

input, textarea, [contenteditable="true"] {
  user-select: text;
}

html {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  background-color: var(--bg-primary);
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}

body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 15px;
  line-height: 1.4;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: var(--radius-full);
}

/* Buttons & Touch Feedback */
button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: transparent;
  color: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, opacity 0.15s ease, background 0.2s ease;
}

button {
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

button:active {
  transform: scale(0.96);
  opacity: 0.9;
}

.btn-gold {
  background: var(--gold-gradient);
  color: #000000;
  font-weight: 700;
  font-size: 14px;
  padding: 12px 20px;
  border-radius: var(--radius-full);
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-gold:hover {
  transform: translateY(-1.5px);
  box-shadow: 0 6px 22px rgba(212, 175, 55, 0.45);
}

.btn-secondary {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-card);
  color: var(--text-primary);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-weight: 500;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-secondary:hover {
  border-color: var(--gold-border);
  color: #FFFFFF;
  transform: translateY(-1px);
}

.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-icon:hover {
  color: var(--gold-primary);
  border-color: var(--gold-border);
  background: rgba(212, 175, 55, 0.08);
  transform: scale(1.06);
}

.btn-icon:active, .btn-icon.active {
  color: var(--gold-primary);
  border-color: var(--gold-border);
  background: rgba(212, 175, 55, 0.12);
  transform: scale(0.94);
}

/* Glass panel */
.glass-panel {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
}

/* Badges */
.badge-gold {
  background: rgba(212, 175, 55, 0.15);
  color: var(--gold-light);
  border: 1px solid var(--gold-border);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.badge-unread {
  background: var(--gold-gradient);
  color: #000000;
  font-size: 10px;
  font-weight: 800;
  min-width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

/* SVGs */
svg {
  display: block;
  flex-shrink: 0;
}
