:root {
  --bg: #fcfcf9;
  --side: #f3f3ee;
  --card: #ffffff;
  --raise: #f0efe9;
  --fg: #13343b;
  --fg-2: #3b5157;
  --mute: #7c8b8e;
  --line: #e3e3dc;
  --line-2: #d4d4cc;
  --accent: #1f8a96;
  --accent-fg: #ffffff;
  --send: #13343b;
  --send-fg: #fcfcf9;
  --cite: #1f8a961f;
  --cite-fg: #1a6f78;
  --danger: #b42318;
  --feat-a: linear-gradient(135deg, #2f8b97 0%, #3e9aa5 55%, #5aa9b0 100%);
  --feat-b: linear-gradient(135deg, #e6efee 0%, #dbe7e6 100%);
  --feat-b-fg: #13343b;
  --feat-b-mute: #3b5157;
  --side-w: 256px;
  --rail-w: 64px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #191a1a;
    --side: #1f2020;
    --card: #202222;
    --raise: #2a2c2c;
    --fg: #e8e8e6;
    --fg-2: #bfc2c2;
    --mute: #8d9191;
    --line: #2e3030;
    --line-2: #3d4040;
    --accent: #3fb6c2;
    --accent-fg: #0d1f21;
    --send: #e8e8e6;
    --send-fg: #191a1a;
    --cite: #3fb6c21f;
    --cite-fg: #8ad8e0;
    --danger: #f97066;
    --feat-a: linear-gradient(135deg, #2b6f78 0%, #367f88 55%, #4b8e96 100%);
    --feat-b: linear-gradient(135deg, #1c3438 0%, #152326 60%, #13191b 100%);
    --feat-b-fg: #e8e8e6;
    --feat-b-mute: #b3bdbe;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.6 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { flex: none; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
code { font-family: var(--mono); font-size: .88em; }

/* ---------- layout ---------- */
.app { display: flex; min-height: 100%; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }

/* ---------- sidebar ---------- */
.side {
  width: var(--side-w); flex: none; position: sticky; top: 0; height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 12px calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--side); border-right: 1px solid var(--line);
  transition: width .2s ease;
}
.side-top { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 0 6px; height: 36px; margin-bottom: 18px; }
.brand { display: inline-flex; text-decoration: none; }
.logo {
  width: 26px; height: 26px; border-radius: 8px;
  background: conic-gradient(from 210deg, var(--accent), #8b9cf6, #e0a44a, var(--accent));
  -webkit-mask: radial-gradient(circle at 50% 50%, #0000 5px, #000 5.5px);
          mask: radial-gradient(circle at 50% 50%, #0000 5px, #000 5.5px);
}
.icon-btn { display: inline-grid; place-items: center; background: none; border: 0; padding: 6px; border-radius: 8px; color: var(--mute); }
.icon-btn:hover { color: var(--fg); background: var(--raise); }
.box-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: transparent; color: var(--fg-2); text-decoration: none; }
.box-btn:hover { background: var(--raise); color: var(--fg); }
.box-btn[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }

.side-nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 8px; border-radius: 10px;
  border: 0; background: none; text-decoration: none; font-size: 15.5px; color: var(--fg); text-align: left;
}
.nav-item:hover { background: var(--raise); }
.nav-ico { width: 28px; height: 28px; display: grid; place-items: center; color: var(--fg-2); }
.nav-ico-round { border-radius: 50%; background: var(--raise); color: var(--fg); }
.nav-label { white-space: nowrap; overflow: hidden; }

.side-section { margin-top: 26px; display: flex; flex-direction: column; min-height: 0; flex: 1; }
.section-head {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  border: 0; background: none; padding: 4px 8px; color: var(--mute); font-size: 14.5px;
}
.section-head:hover { color: var(--fg-2); }
.section-head .chev { transition: transform .15s; }
.section-head[aria-expanded="false"] .chev { transform: rotate(-90deg); }
.history { overflow-y: auto; margin-top: 6px; flex: 1; }
.history-row { display: flex; align-items: center; border-radius: 8px; }
.history-row:hover, .history-row.on { background: var(--raise); }
.history a {
  display: block; flex: 1; min-width: 0; padding: 6px 4px 6px 8px; border-radius: 8px; text-decoration: none;
  font-size: 14px; color: var(--fg-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.history-row:hover a, .history-row.on a { color: var(--fg); }
.history-del {
  flex: none; display: grid; place-items: center; width: 26px; height: 26px; margin-right: 2px;
  border: 0; border-radius: 7px; background: none; color: var(--mute); transform: rotate(45deg); opacity: 0;
}
.history-row:hover .history-del, .history-del:focus-visible { opacity: 1; }
.history-del:hover { color: var(--danger); }
@media (hover: none) { .history-del { opacity: 1; } }
.history-empty { padding: 4px 8px; font-size: 14px; color: var(--mute); }
.history-note { padding: 6px 8px; margin-bottom: 4px; border-radius: 8px; background: var(--raise); font-size: 12.5px; line-height: 1.35; color: var(--fg-2); }

.side-foot { border-top: 1px solid var(--line); margin: 12px -12px 0; padding: 14px 20px 0; }
.credits { font-size: 13px; color: var(--fg-2); }
.credits b { font-variant-numeric: tabular-nums; color: var(--fg); }
.credits i { display: block; height: 3px; margin-top: 7px; border-radius: 2px; background: var(--line); overflow: hidden; }
.credits i::after { content: ""; display: block; height: 100%; width: var(--pct, 100%); background: var(--accent); transition: width .4s; }

/* collapsed rail (desktop) */
.app.rail .side { width: var(--rail-w); padding-left: 10px; padding-right: 10px; }
.app.rail .nav-label, .app.rail .section-head, .app.rail .history, .app.rail .side-foot, .app.rail #collapseSide { display: none; }
.app.rail .side-top { justify-content: center; padding: 0; }
.app.rail .nav-item { justify-content: center; padding: 8px 0; }
.expand-side { display: none !important; }
.app.rail .expand-side { display: inline-grid !important; }

.scrim { position: fixed; inset: 0; background: #0008; z-index: 30; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 20;
  padding: calc(16px + env(safe-area-inset-top, 0px)) 24px 8px 16px; background: var(--bg);
}
.topbar-title { flex: 1; min-width: 0; font-size: 14px; font-weight: 500; color: var(--fg-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; gap: 10px; margin-left: auto; }
.mobile-only { display: none !important; }

/* ---------- home ---------- */
.home { flex: 1; display: flex; align-items: center; justify-content: center; padding: 16px 16px 12vh; }
.home-inner { width: 100%; max-width: 720px; }
.eyebrow { font-size: 14px; color: var(--fg-2); margin: 0 0 4px 18px; }
.hero { font-weight: 450; font-size: clamp(26px, 3.4vw, 34px); letter-spacing: -.015em; line-height: 1.25; margin: 0 0 30px 18px; }

.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 36px; }
.feature {
  display: flex; flex-direction: column; gap: 6px; text-align: left; border: 0; border-radius: 12px;
  padding: 18px 18px 20px; min-height: 96px; background: var(--feat-b); color: var(--feat-b-fg);
  transition: filter .15s, transform .15s;
}
.feature:hover { filter: brightness(1.08); }
.feature-a { background: var(--feat-a); color: #f4fbfb; }
.feature-title { display: flex; align-items: center; gap: 9px; font-size: 16.5px; font-weight: 500; }
.feature-body { font-size: 14px; line-height: 1.45; color: var(--feat-b-mute); }
.feature-a .feature-body { color: #e2f1f2; }
.badge { font-style: normal; font-size: 11px; letter-spacing: .06em; padding: 2px 7px; border-radius: 6px; background: #3fb6c226; color: var(--accent); font-weight: 600; }
.demo-note { margin-top: 26px; font-size: 13px; color: var(--mute); text-align: center; }

/* ---------- composer ---------- */
.composer {
  width: 100%; background: var(--card); border: 1px solid var(--line-2); border-radius: 16px;
  padding: 14px 14px 12px 20px; transition: border-color .15s, box-shadow .15s;
}
.composer:focus-within { border-color: var(--mute); }
.composer textarea {
  width: 100%; border: 0; outline: 0; resize: none; background: transparent;
  font-size: 17px; line-height: 1.5; max-height: 240px; padding: 2px 0; min-height: 52px;
}
#followInput { min-height: 28px; }
.composer textarea::placeholder { color: var(--mute); }
.composer-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; }
.composer-right { display: flex; align-items: center; gap: 6px; min-width: 0; }

.modes { display: inline-flex; padding: 0; border-radius: 999px; background: var(--raise); }
.mode {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid transparent; background: none;
  padding: 7px 14px; border-radius: 999px; font-size: 15px; color: var(--mute);
}
.mode:hover { color: var(--fg); }
.mode.on { background: var(--card); border-color: var(--line-2); color: var(--fg); }

.model-pick {
  position: relative; display: inline-flex; align-items: center; gap: 4px; min-width: 0;
  padding: 7px 8px 7px 10px; border-radius: 8px; font-size: 15px; color: var(--fg-2); cursor: pointer;
}
.model-pick:hover, .model-pick:focus-within { background: var(--raise); color: var(--fg); }
.model-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 190px; }
/* The real select sits invisibly on top: native menus and keyboard, custom look. */
.model-pick select { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; font-size: 16px; }
.model-pick select option, .model-pick select optgroup { background: var(--card); color: var(--fg); }
.model-pick:has(select:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.mic.listening { color: var(--danger); }

.send {
  flex: none; width: 42px; height: 42px; border-radius: 50%; border: 0;
  display: grid; place-items: center; background: var(--send); color: var(--send-fg);
}
.send:disabled { opacity: .35; cursor: default; }

.dock { position: sticky; bottom: 0; padding: 10px 16px calc(16px + env(safe-area-inset-bottom, 0px)); background: linear-gradient(to top, var(--bg) 75%, #0000); }
.dock .composer { max-width: 760px; margin: 0 auto; padding-top: 10px; }

/* ---------- thread ---------- */
.thread { width: 100%; max-width: 760px; margin: 0 auto; padding: 12px 16px 16px; flex: 1; }
.turn { padding-bottom: 30px; margin-bottom: 30px; border-bottom: 1px solid var(--line); }
.turn:last-child { border-bottom: 0; }
.q { font-weight: 450; font-size: clamp(22px, 3vw, 28px); line-height: 1.3; letter-spacing: -.012em; margin: 8px 0 16px; overflow-wrap: anywhere; }

.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tab { position: relative; display: inline-flex; align-items: center; gap: 7px; border: 0; background: none; padding: 8px 0 10px; font-size: 14.5px; color: var(--mute); }
.tab:hover { color: var(--fg); }
.tab.on { color: var(--fg); }
.tab.on::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px; background: var(--fg); }
.tab .count { font-size: 12px; color: var(--mute); font-variant-numeric: tabular-nums; }
.mode-tag { margin-left: auto; align-self: center; font-size: 12.5px; color: var(--mute); display: inline-flex; align-items: center; gap: 5px; }

.sources { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 18px; scrollbar-width: thin; }
.src {
  flex: 0 0 180px; display: flex; flex-direction: column; justify-content: space-between; gap: 8px;
  min-height: 76px; padding: 9px 11px; border-radius: 10px; background: var(--card); border: 1px solid var(--line);
  text-decoration: none; font-size: 12.5px; line-height: 1.35;
}
.src:hover { border-color: var(--line-2); background: var(--raise); }
.src-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--fg); }
.src-meta { display: flex; align-items: center; gap: 6px; color: var(--mute); font-size: 11.5px; min-width: 0; }
.src-meta span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fav { flex: none; width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; font-size: 9.5px; font-weight: 700; color: #fff; text-transform: uppercase; }
.src-skel { flex: 0 0 180px; height: 76px; border-radius: 10px; background: linear-gradient(90deg, var(--card), var(--raise), var(--card)); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.src-list { display: flex; flex-direction: column; gap: 4px; }
.src-row { display: block; padding: 12px 12px; border-radius: 10px; text-decoration: none; }
.src-row:hover { background: var(--raise); }
.src-row .src-meta { margin-bottom: 4px; }
.src-row b { display: block; font-weight: 500; font-size: 15px; color: var(--fg); margin-bottom: 3px; }
.src-row p { margin: 0; font-size: 13.5px; color: var(--fg-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.status { display: flex; align-items: center; gap: 9px; color: var(--mute); font-size: 14.5px; margin: 2px 0 16px; }
.status i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .3; transform: scale(.7); } }

.ads-slot { margin: 0 0 18px; min-height: 1px; }
.ads-slot[hidden] { display: none; }

.demo-ad-label { font-size: 12px; color: var(--mute); margin: 0 0 6px; letter-spacing: .02em; }
.demo-ad-card { display: flex; gap: 16px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px; }
.demo-ad-media { flex: 0 0 min(320px, 46%); aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: #000; }
.demo-ad-media video { display: block; width: 100%; height: 100%; object-fit: cover; }
.demo-ad-text { flex: 1; min-width: 0; padding-right: 6px; }
.demo-ad-text b { display: block; font-size: 15px; font-weight: 600; color: var(--fg); }
.demo-ad-text p { margin: 4px 0 12px; font-size: 14px; line-height: 1.45; color: var(--fg-2); }
.demo-ad-cta { display: inline-block; padding: 7px 14px; border-radius: 999px; background: var(--accent); color: var(--accent-fg); font-size: 14px; font-weight: 600; text-decoration: none; }
@media (max-width: 600px) {
  .demo-ad-card { flex-direction: column; align-items: stretch; }
  .demo-ad-media { flex-basis: auto; width: 100%; }
  .demo-ad-text { padding: 2px 4px 4px; }
}

.answer { font-size: 16.5px; line-height: 1.72; color: var(--fg); overflow-wrap: anywhere; }
.answer > :first-child { margin-top: 0; }
.answer p { margin: 0 0 14px; }
.answer h2, .answer h3, .answer h4 { font-size: 18px; font-weight: 600; margin: 24px 0 8px; line-height: 1.35; }
.answer ul, .answer ol { margin: 0 0 14px; padding-left: 22px; }
.answer li { margin: 5px 0; }
.answer blockquote { margin: 0 0 14px; padding-left: 14px; border-left: 3px solid var(--line-2); color: var(--fg-2); }
.answer pre { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; overflow-x: auto; font-size: 13.5px; line-height: 1.5; }
.answer pre code { font-size: inherit; }
.answer :not(pre) > code { background: var(--raise); padding: 1px 5px; border-radius: 5px; }
.answer a { color: var(--accent); }
.table-wrap { overflow-x: auto; margin: 0 0 14px; border: 1px solid var(--line); border-radius: 10px; }
.answer table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
.answer th, .answer td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.answer th { background: var(--card); font-weight: 600; }
.answer tr:last-child td { border-bottom: 0; }
.answer a.cite {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin: 0 1px;
  border-radius: 999px; background: var(--raise); color: var(--fg-2); font-size: 10.5px; font-weight: 600;
  text-decoration: none; vertical-align: 2px; line-height: 1; font-variant-numeric: tabular-nums;
}
.answer a.cite:hover { background: var(--accent); color: var(--accent-fg); }
.caret::after { content: ""; display: inline-block; width: 8px; height: 8px; margin-left: 4px; border-radius: 50%; background: var(--accent); vertical-align: 1px; animation: pulse 1s infinite; }

.notice { border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 11px 14px; font-size: 14px; color: var(--fg-2); margin: 8px 0 14px; }
.notice.err { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); color: var(--danger); }

.actions { display: flex; align-items: center; gap: 4px; margin-top: 12px; color: var(--mute); font-size: 13px; flex-wrap: wrap; }
.act { background: none; border: 0; padding: 6px 9px; border-radius: 8px; color: var(--mute); font-size: 13px; display: inline-flex; align-items: center; gap: 5px; }
.act:hover { background: var(--raise); color: var(--fg); }
.actions .model-tag { margin-left: auto; }

.related { margin-top: 26px; }
.related-head { font-size: 17px; font-weight: 500; margin: 0 0 6px; }
.related button {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%;
  text-align: left; background: none; border: 0; border-top: 1px solid var(--line); padding: 12px 2px; font-size: 15px; color: var(--fg-2);
}
.related button:hover { color: var(--accent); }
.related button::after { content: "+"; font-size: 20px; line-height: 1; color: var(--mute); }

/* ---------- consent + modal ---------- */
.consent {
  /* top, under the header: at the bottom it covered the composer */
  position: fixed; left: 50%; transform: translateX(-50%); top: calc(70px + env(safe-area-inset-top, 0px)); z-index: 50;
  width: min(700px, calc(100% - 32px)); display: flex; gap: 16px; align-items: center; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line-2); border-radius: 16px; padding: 16px 18px;
  box-shadow: 0 18px 50px -12px #00000066;
}
.consent-body { flex: 1 1 320px; font-size: 13.5px; }
.consent-body p { margin: 4px 0 0; color: var(--fg-2); }
.consent-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn { border: 0; border-radius: 10px; padding: 9px 14px; background: var(--send); color: var(--send-fg); font-size: 13.5px; font-weight: 600; }
.btn.ghost { background: transparent; color: var(--fg-2); border: 1px solid var(--line-2); font-weight: 500; }
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: #0009; padding: 16px; }
.modal-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 22px; max-width: 360px; width: 100%; }
.modal-card p { color: var(--fg-2); font-size: 14px; }

/* ---------- small screens ---------- */
@media (max-width: 860px) {
  .side { position: fixed; left: 0; top: 0; bottom: 0; z-index: 40; width: min(300px, 86vw) !important; transform: translateX(-102%); transition: transform .22s ease; }
  .side.open { transform: none; }
  .app.rail .nav-label, .app.rail .section-head, .app.rail .history, .app.rail .side-foot { display: revert; }
  .desktop-only { display: none !important; }
  .mobile-only { display: inline-grid !important; }
  .topbar { padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 8px; border-bottom: 1px solid var(--line); }
  .box-btn { width: 36px; height: 36px; }
  .home { align-items: flex-start; padding-top: 12vh; }
  .eyebrow, .hero { margin-left: 4px; }
  .cards { grid-template-columns: 1fr; gap: 10px; margin-top: 22px; }
  .mode { padding: 6px 11px; font-size: 14px; }
  .model-pick { font-size: 14px; }
  .model-name { max-width: 110px; }
  .composer { padding-left: 14px; }
  .src, .src-skel { flex-basis: 150px; }
}
@media (max-width: 420px) {
  .mode span { display: none; }
  .mode { padding: 7px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- games ---------- */
.side-games { margin-top: 22px; flex: none; }
.section-head.static { cursor: default; display: flex; align-items: center; justify-content: space-between; padding: 0 4px 0 8px; color: var(--mute); font-size: 14.5px; }
.library { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.lib-empty { padding: 2px 4px; }
.lib-browse { width: 100%; padding: 8px; border: 1px dashed var(--line-2); border-radius: 10px; background: none; color: var(--mute); font-size: 13.5px; }
.lib-browse:hover { color: var(--fg); border-color: var(--mute); }
.lib-item { display: flex; align-items: center; border-radius: 10px; }
.lib-item:hover { background: var(--raise); }
.lib-open { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; padding: 7px 4px 7px 8px; border: 0; background: none; text-align: left; color: var(--fg); }
.lib-icon { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; color: #0d1f21; font-size: 13px; font-weight: 700; }
.lib-label { min-width: 0; flex: 1; }
.lib-label b { display: block; font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-label i { display: block; font-style: normal; font-size: 12px; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-remove { flex: none; display: grid; place-items: center; width: 28px; height: 28px; margin-right: 4px; border: 0; border-radius: 8px; background: none; color: var(--mute); transform: rotate(45deg); }
.lib-remove:hover { color: var(--fg); }
.app.rail .side-games { display: none; }

/* pop-out library */
.games-modal .modal-card { max-width: 560px; padding: 18px 18px 20px; }
.games-modal-head { display: flex; align-items: center; justify-content: space-between; }
.games-modal-head strong { font-size: 17px; }
.games-modal-sub { margin: 2px 0 12px; font-size: 13.5px; color: var(--mute); }
.games-filter { width: 100%; padding: 9px 12px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--bg); color: var(--fg); font-size: 14px; }
.games-filter:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.games-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; max-height: min(52vh, 420px); overflow-y: auto; }
.games-item { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.games-item.on { border-color: var(--accent); }
.games-item-icon { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: #0d1f21; font-weight: 700; }
.games-item-text { min-width: 0; flex: 1; }
.games-item-text b { display: block; font-size: 14.5px; font-weight: 600; }
.games-item-text span { display: block; font-size: 12.5px; color: var(--mute); }
.games-item .btn { padding: 7px 12px; font-size: 13px; }
.games-none { margin: 16px 2px; font-size: 14px; color: var(--mute); }
@media (max-width: 560px) { .games-grid { grid-template-columns: 1fr; } }

.game-card { border: 1px solid var(--line); border-radius: 14px; background: var(--card); padding: 12px; margin-bottom: 30px; }
.game-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.game-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.game-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; color: #0d1f21; font-weight: 700; }
.game-title b { display: block; font-size: 15px; font-weight: 600; }
.game-title i { display: block; font-style: normal; font-size: 12.5px; color: var(--mute); }
.game-result { margin-left: auto; font-size: 13px; color: var(--accent); font-variant-numeric: tabular-nums; }
.game-close { display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 8px; background: none; color: var(--mute); transform: rotate(45deg); }
.game-close:hover { background: var(--raise); color: var(--fg); }
.game-box { display: flex; justify-content: center; }

/* Five Letters */
.g5 { display: flex; flex-direction: column; align-items: center; gap: 10px; outline: none; padding: 4px 0 6px; }
.g5-grid { display: grid; gap: 5px; }
.g5-line { display: grid; grid-template-columns: repeat(5, 46px); gap: 5px; }
.g5-cell {
  display: grid; place-items: center; height: 46px; border: 2px solid var(--line-2); border-radius: 6px;
  font-size: 21px; font-weight: 700; text-transform: uppercase;
}
.g5-cell.filled { border-color: var(--mute); }
.g5-cell.is-correct { background: #2f9e6b; border-color: #2f9e6b; color: #fff; }
.g5-cell.is-present { background: #c8a217; border-color: #c8a217; color: #fff; }
.g5-cell.is-absent { background: var(--raise); border-color: var(--raise); color: var(--fg-2); }
.g5-msg { min-height: 18px; font-size: 13.5px; color: var(--mute); opacity: 0; transition: opacity .15s; }
.g5-msg.show { opacity: 1; color: var(--fg-2); }
.g5-pad { display: flex; flex-direction: column; gap: 5px; width: 100%; max-width: 340px; }
.g5-row { display: flex; justify-content: center; gap: 4px; }
.g5-key {
  flex: 1 1 auto; min-width: 0; height: 40px; border: 0; border-radius: 6px; background: var(--raise); color: var(--fg);
  font-size: 13px; font-weight: 600; text-transform: uppercase;
}
.g5-key.wide { flex: 1.6 1 auto; font-size: 11px; }
.g5-key:hover { filter: brightness(1.08); }
.g5-key.is-correct { background: #2f9e6b; color: #fff; }
.g5-key.is-present { background: #c8a217; color: #fff; }
.g5-key.is-absent { background: var(--line); color: var(--mute); }

/* Sky Hop */
.gj { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.gj-hud { display: flex; justify-content: space-between; width: 320px; font-size: 13px; color: var(--fg-2); font-variant-numeric: tabular-nums; }
.gj-best { color: var(--mute); }
.gj-canvas { width: 320px; height: 440px; border-radius: 12px; touch-action: none; display: block; outline: none; }
.gj-canvas:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 420px) {
  .g5-line { grid-template-columns: repeat(5, 40px); }
  .g5-cell { height: 40px; font-size: 18px; }
  .gj-canvas, .gj-hud { width: 280px; }
  .gj-canvas { height: 385px; }
}

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(18px + env(safe-area-inset-bottom, 0px)); z-index: 70;
  display: flex; align-items: center; gap: 14px; padding: 10px 12px 10px 16px; border-radius: 12px;
  background: var(--fg); color: var(--bg); font-size: 13.5px; box-shadow: 0 16px 40px -12px #00000066;
}
.toast-undo { border: 0; border-radius: 8px; padding: 5px 10px; background: var(--bg); color: var(--fg); font-size: 13px; font-weight: 600; }

/* ---------- agents ---------- */
.agent-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 4px 4px 10px; border-radius: 999px;
  background: var(--raise); color: var(--fg-2); font-size: 12.5px; white-space: nowrap;
}
.chip-off { display: grid; place-items: center; width: 20px; height: 20px; border: 0; border-radius: 50%; background: none; color: var(--mute); transform: rotate(45deg); }
.chip-off:hover { color: var(--fg); }
.agent-modal .modal-card { max-width: 520px; padding: 18px; }
.field { display: block; margin-top: 12px; }
.field > span { display: block; font-size: 12.5px; color: var(--mute); margin-bottom: 4px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line-2); border-radius: 10px;
  background: var(--bg); color: var(--fg); font-size: 14px; resize: vertical;
}
.field input:focus, .field textarea:focus, .field select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; min-width: 0; }
.agent-error { min-height: 16px; margin: 8px 0 0; font-size: 13px; color: var(--danger); }
.agent-actions { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.agent-actions .spacer { flex: 1; }

/* ---------- affiliate offer ---------- */
.offer-box { margin: 4px 0 18px; }
.offer {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--card); text-decoration: none; color: inherit;
}
.offer:hover { border-color: var(--line-2); }
.offer-text { flex: 1; min-width: 0; }
.offer-label { display: block; font-size: 11.5px; color: var(--mute); margin-bottom: 2px; }
.offer-text b { display: block; font-size: 15px; font-weight: 600; }
.offer-text p { margin: 2px 0 0; font-size: 13px; color: var(--fg-2); }
.offer-cta { flex: none; padding: 7px 13px; border-radius: 999px; background: var(--raise); color: var(--fg); font-size: 13.5px; font-weight: 600; }
