/* Tokens follow the ChatGPT-style session surface on imake.lol (web/src/styles.css, .chat-app). */
:root {
  --bg: #ffffff;
  --sub: #f9f9f9;
  --ink: #0d0d0d;
  --ink-2: #5d5d5d;
  --ink-3: #8f8f8f;
  --line: #e5e5e5;
  --bubble: #f4f4f4;
  --hover: rgba(127, 127, 127, 0.14);
  --green: #19c37d;
  --red: #e5484d;
  --accent: #3fd3f7;
  --measure: 48rem;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #212121;
    --sub: #171717;
    --ink: #ececec;
    --ink-2: #b4b4b4;
    --ink-3: #8f8f8f;
    --line: #333333;
    --bubble: #303030;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Söhne", InterVariable, Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "cv11", "ss01";
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

/* ── Shell ───────────────────────────────────────────────────────── */
.app { position: fixed; inset: 0; display: flex; overflow: hidden; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }

/* Landing hides app chrome; the app hides marketing chrome. */
.app[data-view="landing"] .side,
.app[data-view="landing"] .scrim,
.app[data-view="landing"] .only-app,
.app:not([data-view="landing"]) .only-landing,
.app:not([data-view="game"]) .only-game { display: none !important; }

/* ── Sidebar ─────────────────────────────────────────────────────── */
.side {
  width: 260px;
  flex: 0 0 260px;
  background: var(--sub);
  display: flex;
  flex-direction: column;
  padding: 0.5rem;
  transition: margin-left 0.35s var(--ease);
}
.app[data-collapsed="true"] .side { margin-left: -260px; }
.app[data-collapsed="false"] .topbar [data-action="toggle-side"] { visibility: hidden; }
.side-top { display: flex; align-items: center; justify-content: space-between; padding: 0.35rem 0.25rem 0.75rem; }
.brand { display: flex; align-items: center; gap: 0.55rem; font-weight: 600; font-size: 0.95rem; padding: 0.25rem 0.5rem; letter-spacing: -0.01em; }
.brand img { border-radius: 7px; }
.icon-btn {
  display: grid; place-items: center;
  width: 2rem; height: 2rem; border-radius: 0.5rem;
  color: var(--ink-2);
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.side-new {
  display: flex; align-items: center; gap: 0.6rem;
  width: 100%; padding: 0.6rem; border-radius: 0.6rem;
  font-size: 0.9rem; font-weight: 500; text-align: left;
  transition: background 0.15s var(--ease);
}
.side-new:hover { background: var(--hover); }
.side-label { font-size: 0.75rem; color: var(--ink-3); padding: 1.25rem 0.75rem 0.35rem; font-weight: 500; }
.side-list { flex: 1; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; gap: 1px; padding-bottom: 1rem; }
.side-item {
  display: flex; align-items: center; gap: 0.55rem;
  padding: 0.5rem 0.6rem; border-radius: 0.6rem;
  font-size: 0.875rem; color: var(--ink-2); text-align: left; width: 100%;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.side-item span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-item:hover { background: rgba(127, 127, 127, 0.12); color: var(--ink); }
.side-item[aria-current="true"] { background: rgba(127, 127, 127, 0.16); color: var(--ink); font-weight: 500; }
.side-empty { font-size: 0.85rem; color: var(--ink-3); padding: 0.4rem 0.75rem; }
.side-foot { border-top: 1px solid var(--line); padding-top: 0.5rem; }
.quota { font-size: 0.75rem; color: var(--ink-3); padding: 0.25rem 0.6rem 0.4rem; }
.side-user { display: flex; align-items: center; gap: 0.65rem; padding: 0.4rem 0.4rem 0.4rem 0.6rem; border-radius: 0.6rem; font-size: 0.875rem; }
.side-user-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar {
  width: 1.75rem; height: 1.75rem; border-radius: 999px;
  display: grid; place-items: center; flex: 0 0 auto;
  font-size: 0.75rem; font-weight: 600; background: var(--green); color: #fff;
}
.scrim { display: none; }

/* ── Status dots and pills ───────────────────────────────────────── */
.dot { width: 7px; height: 7px; border-radius: 999px; background: var(--ink-3); flex: 0 0 auto; }
.dot.live, .dot[data-status="running"] { background: var(--green); animation: pulse 2s var(--ease) infinite; }
.dot[data-status="ready"] { background: var(--green); }
.dot[data-status="failed"] { background: var(--red); }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.45; transform: scale(0.8); } }
.pill {
  display: inline-flex; align-items: center; gap: 0.45rem;
  font-size: 0.75rem; color: var(--ink-2);
  border: 1px solid var(--line); padding: 0.28rem 0.65rem; border-radius: 999px; white-space: nowrap;
}

/* ── Top bar ─────────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.6rem 0.85rem; min-height: 3.5rem;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  z-index: 5;
}
.top-title { font-size: 0.95rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 0.4rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  height: 2.3rem; padding: 0 1rem; border-radius: 999px;
  font-size: 0.875rem; font-weight: 500; white-space: nowrap;
  transition: background 0.15s var(--ease), transform 0.15s var(--ease), opacity 0.2s var(--ease);
}
.btn-solid { background: var(--ink); color: var(--bg); }
.btn-solid:hover { opacity: 0.86; }
.btn-ghost { border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--hover); }
.btn-lg { height: 2.9rem; padding: 0 1.4rem; font-size: 0.95rem; }

/* ── Compose / landing ───────────────────────────────────────────── */
.scroll { flex: 1; overflow-y: auto; scroll-behavior: smooth; scrollbar-gutter: stable; }
.hero {
  max-width: var(--measure); margin: 0 auto;
  min-height: calc(100% - 1rem);
  display: flex; flex-direction: column; justify-content: center;
  padding: 2rem 1.25rem 3rem; text-align: center;
}
.app[data-view="landing"] .hero { min-height: calc(100vh - 9rem); min-height: calc(100dvh - 9rem); }
.eyebrow {
  align-self: center; display: inline-flex; align-items: center; gap: 0.5rem;
  font-size: 0.8rem; color: var(--ink-2);
  border: 1px solid var(--line); border-radius: 999px; padding: 0.3rem 0.8rem; margin-bottom: 1.4rem;
  animation: rise 0.6s var(--ease) both;
}
h1 {
  font-size: clamp(1.9rem, 4.6vw, 2.75rem); line-height: 1.12; letter-spacing: -0.03em; font-weight: 600;
  margin-bottom: 0.9rem; animation: rise 0.6s 0.04s var(--ease) both;
}
.app:not([data-view="landing"]) h1 { margin-bottom: 1.75rem; }
.lead {
  font-size: 1.05rem; color: var(--ink-2); max-width: 36rem; margin: 0 auto 2rem;
  animation: rise 0.6s 0.08s var(--ease) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.composer {
  border: 1px solid var(--line); border-radius: 1.6rem; background: var(--bg);
  padding: 0.45rem 0.45rem 0.45rem 1.1rem;
  display: flex; align-items: flex-end; gap: 0.5rem; text-align: left;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.055);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.composer:focus-within { border-color: color-mix(in srgb, var(--ink) 28%, var(--line)); box-shadow: 0 4px 24px rgba(0, 0, 0, 0.09); }
.composer textarea {
  flex: 1; border: 0; outline: 0; resize: none; background: none;
  font-size: 1rem; line-height: 1.55; max-height: 220px; padding: 0.5rem 0;
}
.composer textarea::placeholder, .composer input::placeholder { color: var(--ink-3); }
.composer-big { flex-direction: column; align-items: stretch; gap: 0.1rem; padding: 0.9rem 0.6rem 0.6rem 1.25rem; animation: rise 0.6s 0.12s var(--ease) both; }
.composer-big textarea { padding: 0.2rem 0.6rem 0.5rem 0; min-height: 4.6rem; }
.composer-title {
  border: 0; outline: 0; background: none;
  font-size: 1.05rem; font-weight: 600; letter-spacing: -0.01em; padding: 0.1rem 0;
}
.composer-row { display: flex; align-items: center; gap: 0.4rem; margin-left: -0.6rem; }
.round {
  flex: 0 0 auto; width: 2.1rem; height: 2.1rem; border-radius: 999px;
  display: grid; place-items: center; color: var(--ink-2); border: 1px solid var(--line);
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.round:hover { background: var(--hover); color: var(--ink); }
.select-pill {
  position: relative; display: inline-flex; align-items: center; gap: 0.4rem;
  height: 2.1rem; padding: 0 0.85rem; border-radius: 999px; border: 1px solid var(--line);
  font-size: 0.85rem; color: var(--ink-2); cursor: pointer;
  transition: background 0.15s var(--ease);
}
.select-pill:hover { background: var(--hover); color: var(--ink); }
.select-pill select { appearance: none; -webkit-appearance: none; border: 0; outline: 0; background: none; cursor: pointer; padding-right: 0.1rem; }
.select-pill select option { color: #0d0d0d; background: #fff; }
.send {
  flex: 0 0 auto; width: 2.1rem; height: 2.1rem; margin-left: auto;
  border-radius: 999px; display: grid; place-items: center;
  background: var(--ink); color: var(--bg);
  transition: opacity 0.2s var(--ease), transform 0.15s var(--ease);
}
.send:disabled { opacity: 0.18; cursor: default; }
.send:not(:disabled):hover { transform: scale(1.06); }
.send:not(:disabled):active { transform: scale(0.94); }
.send.busy { opacity: 1; }
.send.busy svg { display: none; }
.send.busy::after { content: ""; width: 0.8rem; height: 0.8rem; border-radius: 3px; background: var(--bg); animation: pulse 1.2s var(--ease) infinite; }

.files { display: flex; flex-wrap: wrap; gap: 0.5rem; list-style: none; padding: 0.4rem 0 0.5rem; }
.file { position: relative; width: 3.4rem; height: 3.4rem; border-radius: 0.8rem; overflow: hidden; border: 1px solid var(--line); }
.file img { width: 100%; height: 100%; object-fit: cover; display: block; }
.file button {
  position: absolute; top: 0.15rem; right: 0.15rem; width: 1.2rem; height: 1.2rem; border-radius: 999px;
  background: rgba(0, 0, 0, 0.65); color: #fff; font-size: 0.75rem; line-height: 1; display: grid; place-items: center;
}

.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; margin-top: 1.1rem; animation: rise 0.6s 0.16s var(--ease) both; }
.chip {
  font-size: 0.85rem; color: var(--ink-2); border: 1px solid var(--line); border-radius: 999px;
  padding: 0.4rem 0.85rem; transition: background 0.15s var(--ease), color 0.15s var(--ease), transform 0.15s var(--ease);
}
.chip:hover { background: var(--hover); color: var(--ink); transform: translateY(-1px); }
.error { color: var(--red); font-size: 0.85rem; padding: 0.6rem 0.25rem 0; text-align: left; }

.below { max-width: 64rem; margin: 0 auto; padding: 0 1.25rem 2rem; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1rem; }
.step { background: var(--sub); border-radius: 1.25rem; padding: 1.5rem; }
.step-n {
  width: 1.9rem; height: 1.9rem; border-radius: 999px; display: grid; place-items: center;
  border: 1px solid var(--line); background: var(--bg); font-size: 0.85rem; font-weight: 600; margin-bottom: 1rem;
}
.step h3 { font-size: 1rem; font-weight: 600; margin-bottom: 0.35rem; letter-spacing: -0.01em; }
.step p { font-size: 0.92rem; color: var(--ink-2); }
.band {
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem;
  border: 1px solid var(--line); border-radius: 1.25rem; padding: 1.75rem; margin-bottom: 2.5rem;
}
.band h2 { font-size: 1.35rem; letter-spacing: -0.02em; font-weight: 600; margin-bottom: 0.25rem; }
.band p { color: var(--ink-2); font-size: 0.95rem; max-width: 34rem; }
.foot { display: flex; flex-wrap: wrap; gap: 1.25rem; font-size: 0.8rem; color: var(--ink-3); padding: 1rem 0.25rem; border-top: 1px solid var(--line); }
.foot a:hover { color: var(--ink); }

/* ── Game thread ─────────────────────────────────────────────────── */
.thread { max-width: var(--measure); margin: 0 auto; padding: 1rem 1.25rem 2rem; }
.turn { margin-bottom: 2rem; animation: rise 0.45s var(--ease) both; }
.turn[data-role="user"] { display: flex; justify-content: flex-end; }
.turn[data-role="user"] .body { background: var(--bubble); padding: 0.7rem 1.1rem; border-radius: 1.5rem; max-width: 85%; white-space: pre-wrap; }
.turn[data-role="assistant"] { display: flex; gap: 1rem; }
.bot { flex: 0 0 auto; width: 1.85rem; height: 1.85rem; border-radius: 999px; overflow: hidden; border: 1px solid var(--line); margin-top: 0.1rem; }
.bot img { width: 100%; height: 100%; display: block; }
.body { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.body p { margin: 0 0 0.9rem; }
.body p:last-child { margin-bottom: 0; }
.body a { text-decoration: underline; text-underline-offset: 0.18em; text-decoration-color: var(--ink-3); }
.body code { font-size: 0.875em; background: rgba(127, 127, 127, 0.16); padding: 0.15em 0.38em; border-radius: 0.3rem; }
.body ul { padding-left: 1.4rem; margin: 0 0 0.9rem; }
.muted { color: var(--ink-2); }

.thinking { display: inline-flex; gap: 0.3rem; align-items: center; padding: 0.35rem 0; }
.thinking i { width: 0.45rem; height: 0.45rem; border-radius: 999px; background: var(--ink-3); animation: bounce 1.3s var(--ease) infinite; }
.thinking i:nth-child(2) { animation-delay: 0.16s; }
.thinking i:nth-child(3) { animation-delay: 0.32s; }
@keyframes bounce { 0%, 60%, 100% { opacity: 0.25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-0.2rem); } }

.progress { margin-top: 0.6rem; height: 4px; border-radius: 999px; background: var(--bubble); overflow: hidden; max-width: 22rem; }
.progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--green), var(--accent)); border-radius: inherit; transition: width 1s var(--ease); }

.play {
  margin-top: 0.4rem; border: 1px solid var(--line); border-radius: 1rem; overflow: hidden; background: #000;
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.08);
}
.play iframe { display: block; width: 100%; aspect-ratio: 16 / 10; border: 0; background: #000; }
.play-bar { display: flex; align-items: center; gap: 0.5rem; padding: 0.55rem 0.6rem 0.55rem 0.9rem; background: var(--bg); border-top: 1px solid var(--line); }
.play-url { font-size: 0.82rem; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.play-bar .btn { height: 2rem; padding: 0 0.8rem; font-size: 0.8rem; }

/* ── Dock ────────────────────────────────────────────────────────── */
.dock { padding: 0.75rem 1.25rem calc(1.1rem + env(safe-area-inset-bottom)); background: var(--bg); position: relative; }
.dock::before { content: ""; position: absolute; left: 0; right: 0; bottom: 100%; height: 3rem; background: linear-gradient(to top, var(--bg), transparent); pointer-events: none; }
.dock-inner { max-width: var(--measure); margin: 0 auto; position: relative; }
.dock-note { text-align: center; font-size: 0.72rem; color: var(--ink-3); padding-top: 0.6rem; }
.jump {
  position: absolute; left: 50%; bottom: 100%; transform: translateX(-50%) scale(0.9); margin-bottom: 0.6rem;
  width: 2.1rem; height: 2.1rem; border-radius: 999px; background: var(--bg); border: 1px solid var(--line);
  display: grid; place-items: center; color: var(--ink-2); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  opacity: 0; pointer-events: none; transition: opacity 0.25s var(--ease), transform 0.25s var(--ease); z-index: 6;
}
.jump[data-show="true"] { opacity: 1; pointer-events: auto; transform: translateX(-50%) scale(1); }

/* ── Sign-in modal ───────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 1.25rem; background: rgba(0, 0, 0, 0.35); backdrop-filter: blur(4px); animation: fade 0.2s var(--ease) both; }
.modal-card {
  width: min(24rem, 100%); background: var(--bg); border-radius: 1.4rem; padding: 2rem 1.75rem 1.25rem; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 0.75rem; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  animation: rise 0.35s var(--ease) both;
}
.modal-card img { border-radius: 11px; }
.modal-card h2 { font-size: 1.2rem; letter-spacing: -0.02em; }
.modal-card p { color: var(--ink-2); font-size: 0.92rem; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 860px) {
  .side { position: absolute; z-index: 20; height: 100%; }
  .app[data-collapsed="false"] .side { box-shadow: 0 0 40px rgba(0, 0, 0, 0.2); }
  .app[data-collapsed="false"]:not([data-view="landing"]) .scrim { display: block; position: absolute; inset: 0; z-index: 15; background: rgba(0, 0, 0, 0.3); }
  .app[data-collapsed="false"] .topbar [data-action="toggle-side"] { visibility: visible; }
  .steps { grid-template-columns: 1fr; }
  .band { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 520px) {
  .top-actions .btn { height: 2.1rem; padding: 0 0.8rem; font-size: 0.82rem; }
  .brand span { font-size: 0.9rem; }
  .composer-big { padding-left: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .scroll { scroll-behavior: auto; }
}
