/* Revision — one accent hue, one easing curve, the Z Ink surface ladder. */
:root {
  color-scheme: dark;

  --radius: 0.875rem;
  --radius-sm: calc(var(--radius) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);
  --radius-2xl: calc(var(--radius) + 8px);
  --radius-3xl: calc(var(--radius) + 12px);
  --radius-pill: 999px;

  --accent-hue: 24;
  --accent-chroma: 0.17;
  --primary: oklch(0.66 var(--accent-chroma) var(--accent-hue));
  --ring: oklch(0.66 var(--accent-chroma) var(--accent-hue) / 60%);
  --accent-soft: oklch(0.66 var(--accent-chroma) var(--accent-hue) / 0.14);
  --theme-shadow-glow:
    0 0 0 1px oklch(0.66 var(--accent-chroma) var(--accent-hue) / 35%),
    0 12px 40px -16px oklch(0.66 var(--accent-chroma) var(--accent-hue) / 45%);

  --font-sans: "Inter", ui-sans-serif, system-ui, sans-serif;
  --font-display: "Sora", ui-sans-serif, system-ui, sans-serif;
  --ease-z: cubic-bezier(0.22, 1, 0.36, 1);
  --ease: var(--ease-z);
}

:root,
:root[data-theme="dark"] {
  --primary-foreground: oklch(0.145 0.008 275);
  --background: oklch(0.145 0.008 275);
  --foreground: oklch(0.928 0.004 275);
  --surface: oklch(0.184 0.008 275);
  --surface-2: oklch(0.222 0.009 275);
  --muted: oklch(0.244 0.009 275);
  --muted-foreground: oklch(0.66 0.012 275);
  --destructive: oklch(0.63 0.2 22);
  --online: oklch(0.78 0.17 152);
  --warning: oklch(0.8 0.15 80);
  --border: oklch(1 0 0 / 9%);
  --input: oklch(1 0 0 / 12%);
  --sidebar: oklch(0.164 0.008 275);
  --sidebar-border: oklch(1 0 0 / 9%);
  --theme-shadow-lift:
    0 1px 0 0 oklch(1 0 0 / 4%) inset, 0 18px 40px -24px oklch(0 0 0 / 80%);
  --shadow: var(--theme-shadow-lift);
}

:root[data-theme="light"] {
  color-scheme: light;
  --primary-foreground: oklch(0.99 0.003 260);
  --background: oklch(0.982 0.003 260);
  --foreground: oklch(0.205 0.012 270);
  --surface: oklch(1 0 0);
  --surface-2: oklch(0.947 0.006 260);
  --muted: oklch(0.93 0.005 260);
  --muted-foreground: oklch(0.5 0.014 270);
  --border: oklch(0.28 0.015 270 / 13%);
  --sidebar: oklch(0.965 0.004 260);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
}

body {
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button,
a,
input,
textarea,
select,
[role="button"] {
  font: inherit;
  color: inherit;
  touch-action: manipulation;
}

/* The touch platform layer is global, not behind a media query. */
@media (pointer: coarse) {
  input,
  textarea,
  select {
    font-size: 16px !important;
  }
}

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

p {
  margin: 0;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--muted-foreground);
}

.small {
  font-size: 13px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  margin-bottom: 10px;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 12px var(--primary);
}

/* ---------------------------------------------------------------- backdrop */
.aurora {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.orb {
  position: absolute;
  width: 48vw;
  aspect-ratio: 1;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.36;
  animation: drift 26s var(--ease) infinite alternate;
}

.o1 {
  background: var(--primary);
  top: -12vw;
  left: -8vw;
}

.o2 {
  background: oklch(0.62 0.2 calc(var(--accent-hue) + 70));
  bottom: -18vw;
  right: -6vw;
  animation-delay: -9s;
}

.o3 {
  background: oklch(0.7 0.14 calc(var(--accent-hue) - 60));
  top: 30vh;
  left: 42vw;
  width: 30vw;
  opacity: 0.22;
  animation-delay: -16s;
}

.grid {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 64px 64px;
  opacity: 0.07;
  mask-image: radial-gradient(60% 60% at 50% 30%, black, transparent 75%);
}

@keyframes drift {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(6vw, 4vh, 0) scale(1.12);
  }
}

#fx {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
}

/* -------------------------------------------------------------------- auth */
.auth {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: clamp(24px, 5vw, 72px);
  align-items: center;
  padding: clamp(28px, 6vw, 96px);
}

.auth-copy .display {
  font-size: clamp(34px, 4.6vw, 62px);
  font-weight: 680;
}

.shimmer {
  background: linear-gradient(100deg, var(--primary), oklch(0.86 0.1 calc(var(--accent-hue) + 60)), var(--primary));
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 6s linear infinite;
}

@keyframes shimmer {
  to {
    background-position: -220% 0;
  }
}

.lede {
  margin-top: 18px;
  max-width: 46ch;
  color: var(--muted-foreground);
  font-size: 16px;
}

.bullets {
  list-style: none;
  padding: 0;
  margin: 28px 0 0;
  display: grid;
  gap: 10px;
}

.bullets li {
  display: flex;
  gap: 12px;
  align-items: baseline;
  color: var(--muted-foreground);
  font-size: 14px;
}

.bullets span {
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--primary);
}

.auth-card {
  position: relative;
  padding: 30px;
  border-radius: calc(var(--radius) + 6px);
  background: linear-gradient(180deg, var(--surface), var(--sidebar));
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transform-style: preserve-3d;
  transition: transform 0.5s var(--ease);
}

.tape {
  position: absolute;
  top: -12px;
  left: 50%;
  width: 96px;
  height: 24px;
  transform: translateX(-50%) rotate(-3deg);
  background: var(--accent-soft);
  border: 1px solid oklch(0.66 var(--accent-chroma) var(--accent-hue) / 0.4);
  border-radius: 4px;
}

.auth-card h2 {
  font-size: 24px;
}

.auth-card .muted {
  margin: 6px 0 22px;
  font-size: 13px;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--muted-foreground);
}

input,
textarea,
select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--background);
  color: var(--foreground);
  outline: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

textarea {
  resize: vertical;
  min-height: 90px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  padding: 11px 16px;
  font-weight: 560;
  transition: transform 0.18s var(--ease), background 0.2s var(--ease), border-color 0.2s var(--ease);
}

.btn:hover {
  border-color: var(--primary);
}

.btn:active {
  transform: scale(0.97);
}

.btn.primary {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: transparent;
}

.btn.primary svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn.ghost {
  background: transparent;
}

.btn.small {
  padding: 7px 12px;
  font-size: 13px;
}

.btn.wide {
  width: 100%;
}

.link {
  background: none;
  border: 0;
  color: var(--primary);
  padding: 0;
  font-weight: 560;
}

.switch {
  margin-top: 16px;
  font-size: 13px;
  color: var(--muted-foreground);
  display: flex;
  gap: 6px;
}

.or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 14px;
  color: var(--muted-foreground);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.or::before,
.or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.oauth {
  gap: 10px;
  text-decoration: none;
}

.oauth svg {
  width: 18px;
  height: 18px;
}

.error {
  min-height: 18px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--destructive);
}

/* --------------------------------------------------------------------- app */
.app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: 100dvh;
}

.rail {
  position: sticky;
  top: 0;
  height: 100dvh;
  padding: 22px 16px;
  background: color-mix(in oklch, var(--sidebar) 82%, transparent);
  backdrop-filter: blur(18px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: 0;
  padding: 0;
  font-weight: 650;
  font-size: 16px;
}

.mark {
  display: block;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  flex: none;
}

.auth-logo {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  margin-bottom: 14px;
}

.rail nav {
  display: grid;
  gap: 4px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 0;
  background: none;
  color: var(--muted-foreground);
  font-size: 14px;
  text-align: left;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

.nav svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linejoin: round;
}

.nav:hover,
.nav.on {
  background: var(--accent-soft);
  color: var(--foreground);
}

.rail-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.streak {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 13px;
  color: var(--muted-foreground);
}

.streak b {
  color: var(--foreground);
  font-size: 18px;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  text-transform: uppercase;
  font-weight: 700;
}

.main {
  padding: clamp(20px, 3.4vw, 44px);
  max-width: 1180px;
}

.top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}

.page-title {
  font-size: clamp(24px, 2.8vw, 34px);
}

.pills {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pill {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--muted-foreground);
}

.pill b {
  color: var(--foreground);
}

/* -------------------------------------------------------------------- home */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  padding: 26px;
  border-radius: calc(var(--radius) + 4px);
  border: 1px solid var(--border);
  background: linear-gradient(135deg, var(--surface), var(--sidebar) 70%);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.hero-title {
  font-size: clamp(22px, 2.6vw, 32px);
  margin-bottom: 8px;
}

.hero-stats {
  display: flex;
  gap: 26px;
  margin-top: 22px;
}

.hero-stats b {
  display: block;
  font-size: 22px;
}

.hero-stats small {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}

.ring {
  position: relative;
  width: 132px;
  height: 132px;
}

.ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring circle {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
}

.ring .track {
  stroke: var(--border);
}

.ring .fill {
  stroke: var(--primary);
  stroke-dasharray: 302;
  stroke-dashoffset: 302;
  transition: stroke-dashoffset 0.8s var(--ease);
}

.ring-text {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
}

.ring-text b {
  font-size: 26px;
}

.ring-text small {
  color: var(--muted-foreground);
  font-size: 11px;
}

.drop {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  background: color-mix(in oklch, var(--surface) 70%, transparent);
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease), transform 0.2s var(--ease);
  margin-bottom: 26px;
}

.drop.over {
  border-color: var(--primary);
  background: var(--accent-soft);
  transform: scale(1.01);
}

.drop-inner {
  display: flex;
  align-items: center;
  gap: 14px;
}

.drop-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--primary);
  flex: none;
}

.drop-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.drop-inner .btn {
  margin-left: auto;
}

.paste {
  margin-top: 16px;
  display: grid;
  gap: 10px;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.papers-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}

.papers {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.paper {
  text-align: left;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: transform 0.25s var(--ease), border-color 0.2s var(--ease), background 0.2s var(--ease);
}

.paper:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  background: var(--surface-2);
}

.paper h5 {
  margin: 0 0 4px;
  font-size: 15px;
}

.paper .meta {
  display: flex;
  gap: 10px;
  font-size: 12px;
  color: var(--muted-foreground);
}

.paper .flag {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--primary);
}

.empty {
  padding: 26px;
  text-align: center;
  color: var(--muted-foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ------------------------------------------------------------------- paper */
.back {
  margin-bottom: 14px;
}

.paper-head h3 {
  font-size: clamp(22px, 2.6vw, 30px);
}

.panel {
  margin: 18px 0 26px;
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.tag {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted-foreground);
}

.tag.ready {
  border-color: oklch(0.72 0.15 155 / 0.5);
  color: var(--online);
}

.topics {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.topic {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--background);
  border: 1px solid var(--border);
}

.topic b {
  font-size: 13px;
}

.topic ul {
  margin: 6px 0 0;
  padding-left: 18px;
  color: var(--muted-foreground);
  font-size: 13px;
}

.section-label {
  margin: 8px 0 12px;
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}

.modes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.mode {
  text-align: left;
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  display: grid;
  gap: 4px;
  transform-style: preserve-3d;
  transition: transform 0.3s var(--ease), border-color 0.2s var(--ease), background 0.2s var(--ease);
}

.mode:hover {
  border-color: var(--primary);
  background: var(--surface-2);
}

.mode b {
  font-size: 15px;
}

.mode small {
  color: var(--muted-foreground);
  font-size: 12px;
}

.mode-ico {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-bottom: 8px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--primary);
}

.mode-ico svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tilt {
  will-change: transform;
}

/* ------------------------------------------------------------------- study */
.study-top {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.bar {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--primary);
  transition: width 0.4s var(--ease);
}

.card {
  padding: 26px;
  border-radius: calc(var(--radius) + 4px);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface), var(--sidebar));
  box-shadow: var(--shadow);
}

.question h3 {
  font-size: clamp(20px, 2.4vw, 28px);
  margin-bottom: 18px;
}

#answerBox {
  margin-bottom: 12px;
}

.verdict {
  margin-top: 16px;
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  animation: rise 0.35s var(--ease);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.verdict-head {
  font-weight: 700;
  font-size: 18px;
  margin-bottom: 8px;
}

.verdict-head.good {
  color: var(--online);
}

.verdict-head.bad {
  color: var(--destructive);
}

.roast {
  font-size: 16px;
  padding: 14px 16px;
  border-radius: 12px;
  background: oklch(0.68 0.19 25 / 0.1);
  border-left: 3px solid var(--destructive);
  margin-bottom: 12px;
  min-height: 24px;
}

.verdict-answer {
  color: var(--muted-foreground);
  font-size: 14px;
  margin-bottom: 8px;
}

.verdict-fix {
  font-size: 14px;
  color: var(--warning);
  margin-bottom: 14px;
}

/* -------------------------------------------------------------------- chat */
.chat {
  display: grid;
  gap: 10px;
  padding: 18px;
  min-height: 52vh;
  max-height: 62vh;
  overflow-y: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  margin-bottom: 12px;
}

.bubble {
  max-width: 78%;
  padding: 11px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  animation: rise 0.3s var(--ease);
  white-space: pre-wrap;
}

.bubble.them {
  background: var(--surface-2);
  border-bottom-left-radius: 6px;
  justify-self: start;
}

.bubble.me {
  background: var(--primary);
  color: var(--primary-foreground);
  border-bottom-right-radius: 6px;
  justify-self: end;
}

.bubble.typing::after {
  content: "…";
  animation: dots 1.2s steps(3) infinite;
}

@keyframes dots {
  50% {
    opacity: 0.3;
  }
}

.chat-form {
  display: flex;
  gap: 10px;
}

/* ----------------------------------------------------------------- library */
.search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  margin-bottom: 18px;
}

.search svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--muted-foreground);
  stroke-width: 1.8;
  stroke-linecap: round;
}

.search input {
  border: 0;
  background: none;
  padding: 4px 0;
  box-shadow: none;
}

.search input:focus {
  box-shadow: none;
}

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

.note {
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}

.note h4 {
  font-size: 16px;
  margin-bottom: 6px;
}

.note p {
  color: var(--muted-foreground);
  font-size: 14px;
  margin-bottom: 10px;
}

.chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.chip {
  font-size: 11px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--primary);
}

.note details {
  margin-top: 12px;
}

.note summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--muted-foreground);
  list-style: none;
}

.note summary::-webkit-details-marker {
  display: none;
}

.note ul {
  margin: 10px 0 0;
  padding-left: 18px;
  font-size: 13px;
  color: var(--muted-foreground);
}

/* ---------------------------------------------------------------- settings */
/* ---------------------------------------------------------------- settings */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
  align-items: start;
}

.settings-grid .panel {
  margin: 0;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--muted-foreground);
  flex-wrap: wrap;
}

.seg {
  display: flex;
  gap: 3px;
  padding: 3px;
  border-radius: 10px;
  background: var(--background);
  border: 1px solid var(--border);
}

.seg button {
  border: 0;
  background: transparent;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  color: var(--muted-foreground);
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

.seg button.on {
  background: var(--primary);
  color: var(--primary-foreground);
}

.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--muted-foreground);
  cursor: pointer;
}

.toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  flex: none;
}

.swatches {
  display: flex;
  gap: 8px;
  margin: 2px 0 16px;
}

.swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid transparent;
  padding: 0;
}

.swatch.on {
  border-color: var(--foreground);
}

[data-theme="light"] .orb {
  opacity: 0.18;
}

[data-theme="light"] .grid {
  opacity: 0.04;
}

[data-motion="off"] .orb,
[data-motion="off"] .shimmer {
  animation: none !important;
}

[data-density="compact"] .main {
  padding: 18px 20px;
}

[data-density="compact"] .panel,
[data-density="compact"] .card,
[data-density="compact"] .hero {
  padding: 16px;
}

[data-density="compact"] .paper {
  padding: 12px;
}

[data-density="compact"] .topic {
  padding: 9px 12px;
}

.slider {
  display: grid;
  grid-template-columns: 120px 1fr 40px;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--muted-foreground);
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--border));
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--foreground);
  border: 3px solid var(--primary);
  cursor: pointer;
}

.slider b {
  text-align: right;
  color: var(--foreground);
}

/* ------------------------------------------------------------------- toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 20px);
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
  z-index: 60;
}

.toast.on {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.bad {
  border-color: var(--destructive);
}

/* ------------------------------------------------------------------ mobile */
@media (max-width: 900px) {
  .auth {
    grid-template-columns: 1fr;
    padding: 28px 20px 40px;
  }

  .auth-copy .display {
    font-size: 34px;
  }

  .app {
    grid-template-columns: 1fr;
  }

  .rail {
    position: fixed;
    bottom: 0;
    top: auto;
    left: 0;
    right: 0;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    border-right: 0;
    border-top: 1px solid var(--border);
    z-index: 30;
  }

  .brand-text,
  .nav span,
  .rail-foot .streak small {
    display: none;
  }

  .rail nav {
    display: flex;
    gap: 4px;
  }

  .rail-foot {
    margin: 0 0 0 auto;
  }

  .main {
    padding: 18px 16px 90px;
  }

  .hero {
    grid-template-columns: 1fr;
  }

  .hero-art {
    display: none;
  }

  .top {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
