:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;

  /* Official CheeseWebRR / RiCheese Brand Tokens */
  --cheese-orange: #ff7f5b;
  --cheese-amber: #ff9626;
  --cheese-apricot: #ffb077;
  --cheese-cream: #ffdebb;
  --cheese-peach: #ffcda2;
  --cheese-blue: #6d8ffd;
  --cheese-blue-soft: #e7edff;
  --cheese-indigo: #7770ff;
  --cheese-green: #00b985;
  --cheese-surface: #fffaf5;
  --cheese-ink: #191b27;
  --cheese-ink-secondary: #474c5c;
  --cheese-ink-muted: #6b748b;

  --ease-expo: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-std: cubic-bezier(0.5, 0, 0.5, 1);
}

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

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--cheese-surface);
  color: var(--cheese-ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ============================================================================
 * Top Header (Logo + Smart OS-Detected Split-Pill Download Action)
 * ============================================================================ */
.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 20;
  height: 68px;
  padding: 14px max(24px, 50% - 600px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--cheese-ink);
  pointer-events: none;
}

.nav-brand,
.nav-actions {
  display: flex;
  align-items: center;
  pointer-events: auto;
}

.nav-brand {
  gap: 13px;
  font-size: 20px;
  letter-spacing: -0.01em;
  user-select: none;
}

.nav-brand strong {
  font-weight: 600;
  line-height: 20px;
  color: var(--cheese-ink);
}

.mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  object-fit: cover;
  display: block;
  box-shadow: 0 6px 18px rgba(255, 127, 91, 0.2), 0 0 0 1px rgba(25, 27, 39, 0.06);
}

.download-pill-group {
  display: inline-flex;
  align-items: center;
  height: 38px;
  border-radius: 999px;
  background: var(--cheese-ink);
  color: #ffffff;
  box-shadow: 0 8px 24px rgba(25, 27, 39, 0.16), 0 2px 6px rgba(255, 127, 91, 0.12);
  overflow: hidden;
  transition: transform 0.22s var(--ease-expo), box-shadow 0.22s ease;
}

.download-pill-group:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(25, 27, 39, 0.2), 0 3px 10px rgba(255, 127, 91, 0.18);
}

.download-pill-main,
.download-pill-switcher {
  appearance: none;
  border: 0;
  height: 100%;
  background: transparent;
  color: inherit;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.download-pill-main {
  padding: 0 13px 0 16px;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  white-space: nowrap;
}

.download-pill-switcher {
  padding: 0 13px 0 10px;
}

.download-pill-main:hover,
.download-pill-switcher:hover {
  background: rgba(255, 150, 38, 0.2);
}

.download-pill-main:active,
.download-pill-switcher:active {
  background: rgba(255, 127, 91, 0.28);
}

.download-pill-divider {
  width: 1px;
  height: 16px;
  background: rgba(255, 255, 255, 0.18);
  flex: none;
}

.download-pill-main:focus-visible,
.download-pill-switcher:focus-visible,
.composer-skill:focus-visible,
.composer-dispatch-btn:focus-visible,
.dialog-close-btn:focus-visible,
.platform-item:focus-visible {
  outline: 2px solid var(--cheese-orange);
  outline-offset: 2px;
}

/* ============================================================================
 * Full-Viewport Stage & WebGL Satin-Silk Backdrop
 * ============================================================================ */
.stage {
  position: relative;
  width: 100%;
  height: 100svh;
  min-height: 500px;
  overflow: hidden;
  isolation: isolate;
  background: var(--cheese-surface);
}

.backdrop-canvas,
.grain-layer,
.shade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.backdrop-canvas {
  display: block;
  z-index: 0;
}

.grain-layer {
  z-index: 1;
  opacity: 0.015;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  background-repeat: repeat;
}

.shade {
  z-index: 2;
  background:
    radial-gradient(ellipse 60% 44% at 50% 48%, rgba(255, 252, 248, 0.34) 0%, rgba(255, 250, 245, 0.08) 62%, transparent 100%),
    linear-gradient(
      180deg,
      rgba(255, 250, 245, 0.2) 0%,
      rgba(255, 250, 245, 0) 24%,
      rgba(255, 250, 245, 0) 78%,
      rgba(255, 247, 238, 0.24) 100%
    );
}

/* ============================================================================
 * Minimalist Hero Headline + Agent Task Dispatch Composer
 * ============================================================================ */
.hero-copy {
  position: relative;
  z-index: 3;
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(28px, 4.2vh, 42px);
  padding: 68px 24px 80px;
  pointer-events: none;
}

.hero-headline {
  margin: 0;
  font-size: clamp(34px, 4.6vw, 58px);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--cheese-ink);
  text-align: center;
  user-select: none;
  animation: hero-enter 0.68s var(--ease-expo) 40ms both;
}

.agent-composer {
  width: min(620px, 100%);
  border-radius: 24px;
  padding: 20px 20px 14px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow:
    0 22px 54px rgba(25, 27, 39, 0.08),
    0 4px 14px rgba(255, 127, 91, 0.07);
  pointer-events: auto;
  transition: border-color 0.28s ease, box-shadow 0.28s ease, transform 0.28s var(--ease-expo);
  animation: hero-enter 0.72s var(--ease-expo) 120ms both;
}

.agent-composer[data-state="dispatching"] {
  border-color: rgba(255, 127, 91, 0.48);
  box-shadow:
    0 24px 60px rgba(25, 27, 39, 0.09),
    0 0 0 3px rgba(255, 127, 91, 0.14);
}

.composer-prompt-wrap {
  min-height: 56px;
  display: flex;
  align-items: flex-start;
  text-align: left;
}

.composer-prompt {
  margin: 0;
  font-size: clamp(16px, 1.55vw, 19px);
  font-weight: 500;
  line-height: 1.52;
  color: var(--cheese-ink);
  word-break: break-word;
}

.composer-caret {
  display: inline-block;
  width: 2px;
  height: 1.08em;
  margin-left: 2px;
  vertical-align: -0.16em;
  border-radius: 2px;
  background: var(--cheese-orange);
  animation: caret-blink 0.9s steps(1) infinite;
  transition: opacity 0.18s ease;
}

.agent-composer[data-state="dispatching"] .composer-caret,
.agent-composer[data-state="dispatched"] .composer-caret {
  opacity: 0;
  animation: none;
}

@keyframes caret-blink {
  0%,
  49% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0;
  }
}

.composer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid rgba(25, 27, 39, 0.06);
}

.composer-skills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  min-width: 0;
}

.composer-skill {
  appearance: none;
  border: 1px solid transparent;
  background: rgba(25, 27, 39, 0.045);
  color: var(--cheese-ink-muted);
  padding: 5px 11px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 18px;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.composer-skill:hover {
  background: rgba(25, 27, 39, 0.08);
  color: var(--cheese-ink);
}

.composer-skill[data-accent="amber"][aria-selected="true"] {
  background: rgba(255, 127, 91, 0.14);
  border-color: rgba(255, 127, 91, 0.26);
  color: #df5834;
}

.composer-skill[data-accent="blue"][aria-selected="true"] {
  background: rgba(109, 143, 253, 0.15);
  border-color: rgba(109, 143, 253, 0.28);
  color: #3f66e0;
}

.composer-skill[data-accent="indigo"][aria-selected="true"] {
  background: rgba(119, 112, 255, 0.14);
  border-color: rgba(119, 112, 255, 0.26);
  color: #5b53e6;
}

.composer-skill[data-accent="emerald"][aria-selected="true"] {
  background: rgba(0, 185, 133, 0.14);
  border-color: rgba(0, 185, 133, 0.26);
  color: #068d67;
}

.composer-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

.composer-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  color: var(--cheese-ink-muted);
  white-space: nowrap;
  opacity: 0;
  transform: translateX(4px);
  transition: opacity 0.24s ease, transform 0.24s var(--ease-expo);
}

.agent-composer[data-state="dispatched"] .composer-status {
  opacity: 1;
  transform: translateX(0);
}

.composer-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--cheese-orange);
  animation: status-pulse 1.6s ease-in-out infinite;
}

.composer-status[data-accent="blue"] .composer-status-dot {
  background: var(--cheese-blue);
}

.composer-status[data-accent="indigo"] .composer-status-dot {
  background: var(--cheese-indigo);
}

.composer-status[data-accent="emerald"] .composer-status-dot {
  background: var(--cheese-green);
}

@keyframes status-pulse {
  0%,
  100% {
    opacity: 0.45;
    transform: scale(0.92);
  }
  50% {
    opacity: 1;
    transform: scale(1.12);
  }
}

.composer-dispatch-btn {
  appearance: none;
  border: 0;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--cheese-ink);
  color: #ffffff;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: none;
  transition: transform 0.22s var(--ease-expo), background-color 0.2s ease, box-shadow 0.22s ease;
}

.composer-dispatch-btn:hover {
  background: var(--cheese-orange);
  transform: translateY(-1px);
}

.agent-composer[data-state="dispatching"] .composer-dispatch-btn {
  background: var(--cheese-orange);
  transform: scale(0.92);
  box-shadow: 0 0 0 6px rgba(255, 127, 91, 0.22);
}

@keyframes hero-enter {
  0% {
    opacity: 0;
    transform: translateY(14px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================================================
 * Frosted Light-Glass Native <dialog> Download Sheet
 * ============================================================================ */
.download-dialog {
  margin: auto;
  padding: 0;
  border: 0;
  background: transparent;
  width: min(448px, calc(100vw - 32px));
  max-width: none;
  color: var(--cheese-ink);
  overflow: visible;
}

.download-dialog::backdrop {
  background: rgba(25, 27, 39, 0.32);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.download-dialog[open] .download-dialog-surface {
  animation: dialog-pop-in 0.28s var(--ease-expo) both;
}

@keyframes dialog-pop-in {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.97);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.download-dialog-surface {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid rgba(25, 27, 39, 0.08);
  border-radius: 24px;
  padding: 22px;
  box-shadow: 0 24px 64px rgba(25, 27, 39, 0.16), 0 4px 16px rgba(255, 127, 91, 0.08);
}

.download-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.download-dialog-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dialog-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 4px 12px rgba(255, 127, 91, 0.2);
}

.download-dialog-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.download-dialog-title-row h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  line-height: 24px;
  color: var(--cheese-ink);
}

.version-badge {
  font-size: 11px;
  line-height: 18px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(255, 127, 91, 0.14);
  color: #d9522e;
  border: 1px solid rgba(255, 127, 91, 0.24);
}

.download-dialog-subtitle {
  margin: 2px 0 0;
  font-size: 13px;
  line-height: 18px;
  color: var(--cheese-ink-muted);
}

.dialog-close-btn {
  appearance: none;
  border: 0;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: rgba(25, 27, 39, 0.06);
  color: var(--cheese-ink-secondary);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.dialog-close-btn:hover {
  background: rgba(25, 27, 39, 0.12);
  color: var(--cheese-ink);
}

.download-platform-list {
  display: grid;
  gap: 10px;
}

.platform-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  border-radius: 16px;
  border: 1px solid rgba(25, 27, 39, 0.08);
  background: rgba(245, 248, 255, 0.65);
  color: inherit;
  text-decoration: none;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s var(--ease-expo);
}

.platform-item.is-detected {
  background: rgba(255, 127, 91, 0.07);
  border-color: rgba(255, 127, 91, 0.3);
}

.platform-item.is-ready:hover {
  background: rgba(255, 127, 91, 0.12);
  border-color: rgba(255, 127, 91, 0.5);
  transform: translateY(-1px);
}

.platform-item.is-pending {
  cursor: default;
}

.platform-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.platform-os-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(25, 27, 39, 0.06);
  color: var(--cheese-ink);
  display: grid;
  place-items: center;
  flex: none;
}

.platform-item.is-detected .platform-os-icon {
  background: rgba(255, 127, 91, 0.16);
  color: #d9522e;
}

.platform-text {
  min-width: 0;
}

.platform-label-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.platform-label {
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  color: var(--cheese-ink);
}

.platform-rec-badge {
  font-size: 11px;
  font-weight: 500;
  line-height: 16px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(255, 127, 91, 0.14);
  color: #d9522e;
}

.platform-sublabel {
  margin-top: 2px;
  font-size: 12px;
  line-height: 16px;
  color: var(--cheese-ink-muted);
}

.platform-action-pill {
  flex: none;
  font-size: 12px;
  font-weight: 500;
  line-height: 20px;
  padding: 4px 11px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.platform-item.is-ready .platform-action-pill {
  background: var(--cheese-ink);
  color: #ffffff;
  transition: background-color 0.2s ease;
}

.platform-item.is-ready:hover .platform-action-pill {
  background: var(--cheese-orange);
}

.platform-item.is-pending .platform-action-pill {
  background: rgba(25, 27, 39, 0.06);
  color: var(--cheese-ink-muted);
}

.download-dialog-note {
  margin: 14px 0 2px;
  font-size: 12px;
  line-height: 18px;
  color: var(--cheese-ink-muted);
  text-align: center;
}

/* ============================================================================
 * Responsive & Reduced Motion
 * ============================================================================ */
@media (max-width: 680px) {
  .site-header {
    padding-inline: 16px;
  }

  .nav-brand {
    gap: 10px;
    font-size: 18px;
  }

  .mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }

  .download-pill-group {
    height: 34px;
  }

  .download-pill-main {
    padding: 0 10px 0 13px;
    font-size: 13px;
  }

  .download-pill-switcher {
    padding: 0 10px 0 8px;
  }

  .hero-copy {
    gap: 24px;
    padding: 68px 16px 76px;
  }

  .agent-composer {
    padding: 16px 14px 12px;
    border-radius: 20px;
  }

  .composer-prompt-wrap {
    min-height: 50px;
  }

  .composer-prompt {
    font-size: 15px;
  }

  .composer-skills {
    gap: 4px;
  }

  .composer-skill {
    padding: 4px 7px;
    font-size: 11.5px;
  }

  .composer-status {
    display: none;
  }

  .composer-dispatch-btn {
    width: 32px;
    height: 32px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-headline,
  .agent-composer,
  .composer-status,
  .composer-dispatch-btn,
  .composer-status-dot,
  .composer-caret,
  .download-dialog[open] .download-dialog-surface {
    animation: none !important;
    transition: none !important;
  }

  .composer-caret {
    opacity: 0;
  }
}
