:root {
  color-scheme: dark;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Roboto Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Dark theme */
  --bg: #070707;
  --hero-surface: #121212;
  --panel-bg: #111111;
  --surface: #0e0e0e;
  --card-bg: #111111;
  --card-hover-bg: #161616;

  --pill-fill: #1a1a1a;
  --pill-fg: #ffffff;
  --pill-stroke: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 8px 24px rgba(0, 0, 0, 0.5);

  --title-color: #ffffff;
  --subtitle-color: #888888;
  --text-main: #f0f0f0;
  --text-muted: #737373;
  --section-title: #ffffff;
  --section-muted: #666666;

  --code-bg: #141414;
  --code-text: #e6e6e6;
  --copy-hover: rgba(255, 255, 255, 0.08);

  --tab-bg: #161616;
  --tab-hover-bg: #222222;
  --tab-color: #888888;
  --tab-active-bg: #262626;
  --tab-active-color: #ffffff;
  --tab-active-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);

  --chip-bg: #161616;
  --chip-hover-bg: #222222;
  --chip-color: #888888;
  --chip-active-bg: #ffffff;
  --chip-active-color: #070707;

  --strength-bg: #1a1a1a;
  --strength-fill-bg: #2e2e2e;
  --strength-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);

  --toggle-bg: #222222;
  --toggle-color: #ffffff;
  --toggle-hover: #333333;

  --border-line: rgba(255, 255, 255, 0.08);
  --border-line-strong: rgba(255, 255, 255, 0.16);

  --icon-btn-bg: rgba(255, 255, 255, 0.06);
  --icon-btn-fill: #ffffff;
  --icon-btn-hover: rgba(255, 255, 255, 0.12);

  --toast-bg: #ffffff;
  --toast-color: #070707;
}

:root[data-theme="light"],
html.light {
  color-scheme: light;

  /* Light theme */
  --bg: #f5f5f7;
  --hero-surface: #ffffff;
  --panel-bg: #ffffff;
  --surface: #ffffff;
  --card-bg: #ffffff;
  --card-hover-bg: #f9f9fb;

  --pill-fill: #ffffff;
  --pill-fg: #070707;
  --pill-stroke: 0 0 0 1px rgba(0, 0, 0, 0.07), 0 4px 16px rgba(0, 0, 0, 0.04);

  --title-color: #070707;
  --subtitle-color: #737373;
  --text-main: #111111;
  --text-muted: #888888;
  --section-title: #070707;
  --section-muted: #888888;

  --code-bg: #ececee;
  --code-text: #111111;
  --copy-hover: rgba(0, 0, 0, 0.06);

  --tab-bg: #eeeeee;
  --tab-hover-bg: #e2e2e2;
  --tab-color: #666666;
  --tab-active-bg: #ffffff;
  --tab-active-color: #070707;
  --tab-active-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.06);

  --chip-bg: #ececee;
  --chip-hover-bg: #e0e0e4;
  --chip-color: #666666;
  --chip-active-bg: #070707;
  --chip-active-color: #ffffff;

  --strength-bg: #e5e5e7;
  --strength-fill-bg: #d0d0d4;
  --strength-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04);

  --toggle-bg: #ececee;
  --toggle-color: #070707;
  --toggle-hover: #e0e0e4;

  --border-line: rgba(0, 0, 0, 0.07);
  --border-line-strong: rgba(0, 0, 0, 0.14);

  --icon-btn-bg: rgba(0, 0, 0, 0.05);
  --icon-btn-fill: #070707;
  --icon-btn-hover: rgba(0, 0, 0, 0.09);

  --toast-bg: #070707;
  --toast-color: #ffffff;
}

/* Global Reset */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text-main);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.page-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 883px;
  margin: 0 auto;
  width: 100%;
  padding: 0 24px 64px;
}

/* Header */
.header {
  position: relative;
  width: 100%;
  min-height: 200px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 60px 0 40px;
}

.header-back {
  position: absolute;
  top: 16px;
  left: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px 0 10px;
  border-radius: 9999px;
  background: var(--icon-btn-bg);
  color: var(--text-main);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  opacity: 0.7;
  transition: opacity 0.2s, background-color 0.2s;
}

.header-back:hover {
  opacity: 1;
  background: var(--icon-btn-hover);
}

.header-nav {
  position: absolute;
  top: 16px;
  right: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 9999px;
  background: var(--icon-btn-bg);
  color: var(--icon-btn-fill);
  cursor: pointer;
  transition: background-color 0.2s, opacity 0.2s;
}

.icon-btn:hover {
  background: var(--icon-btn-hover);
}

.header-orb-wrapper {
  margin-bottom: 12px;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.header-orb-wrapper:hover {
  transform: scale(1.08);
}

.header-title {
  font-size: 22px;
  font-weight: 500;
  line-height: 30px;
  color: var(--title-color);
  margin: 0;
  letter-spacing: -0.01em;
}

.header-subtitle {
  font-size: 14px;
  font-weight: 400;
  line-height: 21px;
  color: var(--subtitle-color);
  margin: 4px 0 0;
}

/* Component Demonstrations */
.demo-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 48px;
}

.demo-grid-top {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.demo-card-large {
  position: relative;
  width: 100%;
  height: 314px;
  border-radius: 30px;
  background: var(--hero-surface);
  border: 1px solid var(--border-line);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 40px;
  overflow: hidden;
}

.demo-grid-flow {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  grid-auto-rows: 151px;
}

.demo-card-item {
  position: relative;
  width: 100%;
  border-radius: 30px;
  background: var(--hero-surface);
  border: 1px solid var(--border-line);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  overflow: hidden;
}

.row-span-2 {
  grid-row: span 2;
}

/* Status Pill */
.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 9999px;
  background: var(--pill-fill);
  box-shadow: var(--pill-stroke);
  color: var(--pill-fg);
  font-family: inherit;
  cursor: default;
  user-select: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.status-pill-large {
  width: 270px;
  height: 74px;
  padding-left: 9px;
  padding-right: 32px;
  gap: 12px;
  font-size: 18px;
  line-height: 24px;
}

.status-pill-small {
  height: 36px;
  padding-left: 8px;
  padding-right: 14px;
  gap: 8px;
  font-size: 12px;
  line-height: 14px;
}

.t-shimmer {
  position: relative;
  display: inline-block;
  color: inherit;
  font-weight: 400;
  letter-spacing: -0.01em;
}

/* Section Blocks */
.section-block {
  width: 100%;
  margin-bottom: 24px;
}

.section-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.section-title {
  font-size: 16px;
  font-weight: 400;
  line-height: 34px;
  color: var(--section-title);
  margin: 0;
}

.platform-tabs {
  display: flex;
  gap: 4px;
}

.tab-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 12px;
  border: none;
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  background: var(--tab-bg);
  color: var(--tab-color);
  transition: background-color 0.15s, color 0.15s;
  white-space: nowrap;
}

.tab-btn:hover {
  background: var(--tab-hover-bg);
}

.tab-btn.active {
  background: var(--tab-active-bg);
  color: var(--tab-active-color);
  box-shadow: var(--tab-active-shadow);
}

/* Code Box */
.code-box {
  display: flex;
  align-items: center;
  height: 44px;
  background: var(--code-bg);
  border: 1px solid var(--border-line);
  border-radius: 10px;
  padding: 2px 42px 2px 14px;
  position: relative;
  overflow: hidden;
}

.code-box-multi {
  height: auto;
  padding: 14px 42px 14px 14px;
  align-items: flex-start;
}

.code-text {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 22px;
  color: var(--code-text);
  white-space: pre;
  overflow-x: auto;
  min-width: 0;
  flex: 1;
}

.copy-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0;
  transition: background-color 0.15s;
}

.copy-btn:hover {
  background: var(--copy-hover);
}

.copy-icon-copied {
  display: none;
  color: #10b981;
}

.copy-btn[data-state="copied"] .copy-icon-idle {
  display: none;
}

.copy-btn[data-state="copied"] .copy-icon-copied {
  display: inline-block;
}

/* Playground Section */
.playground-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 48px;
}

.playground-controls-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--panel-bg);
  border: 1px solid var(--border-line);
  border-radius: 12px;
  padding: 18px;
}

.control-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-label {
  font-size: 12px;
  font-weight: 400;
  line-height: 14px;
  color: var(--text-muted);
}

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

.chip {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 12px;
  border: none;
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  background: var(--chip-bg);
  color: var(--chip-color);
  transition: all 0.15s;
  white-space: nowrap;
}

.chip:hover {
  background: var(--chip-hover-bg);
}

.chip.active {
  background: var(--chip-active-bg);
  color: var(--chip-active-color);
  font-weight: 500;
}

.control-dual-row {
  display: flex;
  align-items: flex-end;
  gap: 24px;
}

.control-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.speed-col {
  min-width: 130px;
  width: 140px;
}

.speed-track {
  position: relative;
  width: 100%;
  height: 36px;
  border-radius: 8px;
  background: var(--strength-bg);
  box-shadow: var(--strength-shadow);
  overflow: hidden;
  cursor: grab;
}

.speed-track-fill {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  border-radius: 8px;
  background: var(--strength-fill-bg);
  box-shadow: var(--strength-shadow);
  transition: width 80ms ease-out;
  pointer-events: none;
}

.speed-label {
  position: absolute;
  top: 0;
  left: 12px;
  height: 100%;
  display: flex;
  align-items: center;
  font-size: 11px;
  color: var(--text-muted);
  pointer-events: none;
  z-index: 1;
  font-family: var(--font-mono);
}

.speed-input {
  appearance: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  background: transparent;
  cursor: grab;
  opacity: 0;
  z-index: 2;
}

.speed-input:active {
  cursor: grabbing;
}

.playground-stage {
  position: relative;
  width: 100%;
  min-height: 280px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border-line);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  gap: 24px;
}

.play-toggle-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 9999px;
  background: var(--toggle-bg);
  color: var(--toggle-color);
  cursor: pointer;
  transition: background-color 0.2s;
}

.play-toggle-btn:hover {
  background: var(--toggle-hover);
}

.toggle-icon-play {
  display: none;
}

.play-toggle-btn[data-state="paused"] .toggle-icon-pause {
  display: none;
}

.play-toggle-btn[data-state="paused"] .toggle-icon-play {
  display: block;
}

/* States Gallery Section */
.states-gallery-section {
  width: 100%;
  margin-top: 48px;
}

.gallery-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 16px;
}

.section-subtitle {
  font-size: 13px;
  color: var(--subtitle-color);
  margin: 2px 0 0;
}

.filter-group {
  display: flex;
  gap: 6px;
}

.filter-btn {
  background: var(--chip-bg);
  border: none;
  color: var(--chip-color);
  font-family: var(--font-sans);
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.15s;
}

.filter-btn:hover {
  background: var(--chip-hover-bg);
}

.filter-btn.active {
  background: var(--chip-active-bg);
  color: var(--chip-active-color);
}

.states-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.state-card {
  background: var(--card-bg);
  border: 1px solid var(--border-line);
  border-radius: 20px;
  min-height: 200px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  cursor: pointer;
  text-align: left;
  transition: transform 0.2s ease, border-color 0.2s, background-color 0.2s;
}

.state-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-line-strong);
  background: var(--card-hover-bg);
}

.state-card.active {
  border-color: var(--border-line-strong);
  background: var(--card-hover-bg);
}

.state-card[hidden] {
  display: none !important;
}

.card-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  font-size: 9px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.card-index {
  position: absolute;
  top: 14px;
  right: 14px;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-muted);
}

.orb-stage,
.sphere-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 24px 0 12px;
  text-align: center;
}

ai-sphere,
thinking-orb {
  display: inline-block;
  margin: 0 auto;
}

.card-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.card-info b {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.card-info small {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.35;
}

/* Footer */
.footer {
  width: 100%;
  text-align: center;
  padding: 48px 0 24px;
  font-size: 13px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-line);
  margin-top: 64px;
}

.footer p {
  margin: 0;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--toast-bg);
  color: var(--toast-color);
  font-size: 12px;
  font-weight: 500;
  padding: 8px 18px;
  border-radius: 9999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  pointer-events: none;
  opacity: 0;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s;
  z-index: 1000;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}
