/* ================================================
   J.A.R.V.I.S. v2 — Core Design System
   ================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&family=JetBrains+Mono:wght@400&display=swap');

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 400;
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
  height: 100dvh;
  width: 100vw;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- Design Tokens --- */
:root {
  /* Surfaces */
  --bg: #000000;
  --bg-deep: #030712;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-hover: rgba(255, 255, 255, 0.08);
  --surface-glass: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.08);

  /* Text */
  --text: rgba(255, 255, 255, 0.92);
  --text-dim: rgba(255, 255, 255, 0.5);
  --text-muted: rgba(255, 255, 255, 0.3);

  /* Accent */
  --accent: #0ff;
  --accent-glow: rgba(0, 255, 255, 0.15);
  --accent-blue: #0a84ff;
  --accent-purple: #bf5af2;
  --accent-green: #30d158;
  --accent-red: #ff453a;
  --accent-orange: #ff9f0a;

  /* Layout */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;

  /* Typography */
  --font-mono: 'JetBrains Mono', monospace;
  --font-size-xs: clamp(0.65rem, 1.5vw, 0.75rem);
  --font-size-sm: clamp(0.75rem, 2vw, 0.8125rem);
  --font-size-md: clamp(0.875rem, 2.5vw, 0.9375rem);
  --font-size-lg: clamp(1rem, 3vw, 1.125rem);
  --font-size-xl: clamp(1.25rem, 4vw, 1.5rem);

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 150ms;
  --duration-base: 250ms;
  --duration-slow: 500ms;

  /* Safe area */
  --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);
}

/* --- Typography --- */
h1, h2, h3, h4 {
  font-weight: 600;
  line-height: 1.2;
  color: var(--text);
}

h2 { font-size: var(--font-size-xl); }
h3 { font-size: var(--font-size-lg); }
h4 { font-size: var(--font-size-md); }

p { line-height: 1.6; }

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

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

/* --- Selection --- */
::selection {
  background: rgba(0, 255, 255, 0.2);
  color: var(--text);
}

/* --- Focus --- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* --- App Container --- */
#app {
  position: relative;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  z-index: 1;
}

/* --- Utility --- */
.hidden { display: none !important; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
}

/* --- Device Frame (Desktop) --- */
@media (min-width: 769px) {
  body {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-deep);
  }

  #app {
    width: 420px;
    height: min(92dvh, 860px);
    border-radius: 40px;
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow:
      0 0 80px rgba(0, 255, 255, 0.03),
      0 0 160px rgba(0, 255, 255, 0.015),
      inset 0 0 1px rgba(255, 255, 255, 0.05);
  }

  .universe {
    border-radius: 40px;
  }
}

/* --- Tablet --- */
@media (min-width: 481px) and (max-width: 768px) {
  #app {
    max-width: 100%;
    padding-left: var(--space-md);
    padding-right: var(--space-md);
  }
}

/* --- Mobile --- */
@media (max-width: 480px) {
  #app {
    width: 100%;
    height: 100dvh;
  }
}
