:root {
  color-scheme: dark;
  --bg: #09090b;
  --surface: #121214;
  --surface-lowest: #0c0c0e;
  --surface-low: #18181b;
  --surface-container: #202024;
  --surface-high: #2a2a30;
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --outline: #3f3f46;
  --gold: #d4af37;
  --gold-soft: #2e260f;
  --gold-text: #f6e09c;
  --primary: #d4af37;
  --primary-soft: #2e260f;
  --primary-mid: #d4af37;
  --secondary: #10b981;
  --secondary-soft: #064e3b;
  --warning: #f59e0b;
  --warning-soft: #78350f;
  --warning-text: #fef3c7;
  --danger: #ef4444;
  --danger-soft: #7f1d1d;
  --on-primary: #09090b;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  --radius: 16px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html, body {
  height: 100%;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  line-height: 1.5;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  background: transparent;
  border: none;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
  color: inherit;
  text-decoration: none;
}

/* Global Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  color: var(--text);
}

.eyebrow,
.caption {
  color: var(--muted);
  font-size: 12px;
  line-height: 16px;
}

.eyebrow {
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: .05em;
}

.page-title {
  margin: 0;
  color: var(--gold);
  font-size: 24px;
  line-height: 32px;
}

.section-title {
  margin: 0 0 12px;
  font-size: 17px;
  line-height: 24px;
  color: var(--gold-text);
}

.arabic {
  font-family: "Noto Serif", serif;
  line-height: 1.8;
}

/* Global Utility Classes */
.container {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  padding: 0 16px;
}

.hidden {
  display: none !important;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-root,
.app-shell {
  width: 100%;
  height: 100vh;
  overflow: hidden;
  display: flex;
  justify-content: center;
  background: var(--bg);
}

.screen-host {
  width: min(100%, 600px);
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  background: var(--surface-lowest);
  outline: none;
}

.screen {
  min-height: 100vh;
  padding: 16px 16px calc(88px + var(--safe-bottom));
  background: var(--surface-lowest);
  display: grid;
  align-content: start;
  gap: 16px;
}

/* Global screen padding adjustment for screens */
.screen.login,
.screen.signup,
.screen.onboarding {
  padding-bottom: 24px;
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
  padding: 10px 0;
  background: color-mix(in srgb, var(--surface-lowest) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--outline);
}

.stack {
  display: grid;
  gap: 14px;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--outline);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel {
  padding: 16px;
}

.soft-panel {
  background: var(--surface-low);
  border: 1px solid var(--outline);
  border-radius: var(--radius);
  padding: 16px;
}

.primary-button,
.ghost-button,
.quiet-button,
.icon-button {
  min-height: 44px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  transition: opacity 0.2s, transform 0.1s;
}

.primary-button:active,
.ghost-button:active,
.quiet-button:active,
.icon-button:active {
  transform: scale(0.98);
}

.primary-button {
  width: 100%;
  color: var(--on-primary);
  background: var(--gold);
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.2);
}

.ghost-button {
  color: var(--gold);
  background: transparent;
  border: 1px solid var(--outline);
}

.quiet-button,
.icon-button {
  color: var(--gold);
  background: var(--surface-low);
  border: 1px solid var(--outline);
}

.icon-button {
  width: 44px;
  padding: 0;
  border-radius: 999px;
}

.field {
  display: grid;
  gap: 8px;
}

.field label {
  font-size: 14px;
  font-weight: 700;
  color: var(--gold-text);
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--outline);
  border-radius: 12px;
  background: var(--surface-lowest);
  color: var(--text);
  padding: 12px 14px;
  transition: border-color 0.2s;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--gold);
  outline: none;
}

.textarea {
  min-height: 92px;
  resize: vertical;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-container);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.chip.success {
  background: var(--secondary-soft);
  color: var(--secondary);
}

.chip.warning {
  background: var(--warning-soft);
  color: var(--warning-text);
}

.chip.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.chip.neutral {
  background: var(--surface-container);
  color: var(--muted);
}

.meter {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-container);
}

.meter > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--secondary);
}

/* Bottom Navigation Bar Base Styles */
.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 20;
  width: min(100%, 600px);
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 8px 10px calc(8px + var(--safe-bottom));
  background: var(--surface-lowest);
  border-top: 1px solid var(--outline);
  box-shadow: 0 -8px 18px rgba(0, 0, 0, .4);
}

.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 52px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  position: relative;
  transition: color 0.2s ease;
}

.bottom-nav a[aria-current="page"] {
  color: var(--gold);
}

.bottom-nav a::before {
  content: "";
  position: absolute;
  top: 0;
  width: 0;
  height: 3px;
  background: var(--gold);
  border-radius: 0 0 4px 4px;
  transition: width 0.2s ease;
}

.bottom-nav a[aria-current="page"]::before {
  width: 32px;
}

.nav-icon,
.material-icon {
  font-size: 21px;
  line-height: 1;
}

.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none !important;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-smoothing: antialiased;
}

/* Media query for iPhone 17 Pro Max (430px) and larger screens */
@media (min-width: 430px) {
  body {
    background: var(--bg);
  }

  .screen-host {
    width: min(100%, 600px);
    box-shadow: 0 0 0 1px var(--outline), 0 24px 80px rgba(0, 0, 0, .5);
  }
}
