/* ===================================
   Reset & Base Styles
   =================================== */

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

html {
  font-size: 16px;
  height: 100%;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-base);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(99, 102, 241, 0.07) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(6, 182, 212, 0.05) 0%, transparent 50%);
  background-attachment: fixed;
  height: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
  width: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--border-strong);
}

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

/* ── Selection ── */
::selection {
  background: rgba(99, 102, 241, 0.3);
  color: var(--text-primary);
}

/* ── Links ── */
a {
  color: var(--primary-400);
  text-decoration: none;
}

/* ── Images ── */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ── Buttons Reset ── */
button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  line-height: inherit;
}

button:disabled {
  cursor: not-allowed;
}

/* ── Code ── */
code {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.85em;
  background: rgba(99, 102, 241, 0.12);
  padding: 0.15em 0.45em;
  border-radius: var(--radius-sm);
  color: var(--primary-200);
}

/* ── App Container ── */
#app {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  height: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  box-sizing: border-box;
}

@media (orientation: landscape) {
  #app {
    --max-width: 920px;
    padding-left: max(12px, env(safe-area-inset-left, 0px));
    padding-right: max(12px, env(safe-area-inset-right, 0px));
  }
}

@media (min-width: 768px) and (orientation: portrait) {
  #app {
    --max-width: 540px;
  }
}

@media (min-width: 1024px) {
  #app {
    --max-width: 960px;
  }
}

