:root {
  --bg: #0f1012;
  --bg-2: #141518;
  --panel: #18191d;
  --panel-2: #1f2025;
  --hover: #26282d;
  --line: #2a2c31;
  --line-2: #36383e;
  --text: #ececee;
  --muted: #a1a3a9;
  --faint: #6c6f76;
  --accent: #b9a3ff;
  --accent-ink: #140e24;
  --accent-deep: rgb(83,57,153);
  --display: 'Unbounded', var(--sans);
  --danger: #ff7a7a;
  --radius: 12px;
  --rail: 216px;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2,.8,.2,1);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
img { display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ── Background ─────────────────────────────────────── */
#bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }

/* ── Shell ─────────────────────────────────────────── */
.app { position: relative; z-index: 1; display: grid; grid-template-columns: var(--rail) 1fr; height: 100dvh; transition: grid-template-columns .28s var(--ease); }
html.rail-collapsed { --rail: 68px; }

.rail {
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
  padding: 12px 10px; background: rgba(18,19,22,.8); border-right: 1px solid var(--line);
  z-index: 20;
}
.rail-top { display: flex; align-items: center; gap: 4px; margin-bottom: 14px; min-width: 0; }
.brand { flex: 1; min-width: 0; height: 44px; display: flex; align-items: center; gap: 10px; padding: 0 4px; border-radius: 12px; }
.brand .mark { width: 36px; height: 36px; flex-shrink: 0; filter: drop-shadow(0 0 12px color-mix(in srgb, var(--accent) 45%, transparent)); transition: transform .7s var(--ease); }
.brand:hover .mark { transform: rotate(-18deg) scale(1.08); }
.brand-name { font: 700 15px var(--display); letter-spacing: -.02em; white-space: nowrap; overflow: hidden; transition: opacity .2s; }
.rail-toggle { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; color: var(--faint); flex-shrink: 0; transition: background .15s, color .15s; }
.rail-toggle:hover { background: var(--panel-2); color: var(--text); }
.rail-toggle svg { width: 17px; height: 17px; }
.rail-btn {
  position: relative; height: 42px; border-radius: 11px; padding: 0 12px;
  display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; font-weight: 500;
  transition: background .15s, color .15s;
}
.rail-btn svg { width: 20px; height: 20px; flex-shrink: 0; }
.rail-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: opacity .2s; }
.rail-btn:hover { background: var(--panel-2); color: var(--text); }
.rail-btn[aria-current="page"] { color: var(--text); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.rail-btn[aria-current="page"] svg { color: var(--accent); }
.rail-btn[aria-current="page"]::before {
  content: ""; position: absolute; left: -10px; top: 11px; bottom: 11px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--accent); box-shadow: 0 0 12px var(--accent);
}
.rail-btn.bump svg { animation: bump .35s var(--ease); }
@keyframes bump { 40% { transform: scale(.78); } 100% { transform: scale(1); } }
.rail-spacer { flex: 1; }
/* Collapsed: icons only, labels become hover tooltips. */
html.rail-collapsed .rail-top { flex-direction: column; gap: 6px; }
html.rail-collapsed .brand { justify-content: center; padding: 0; }
html.rail-collapsed .brand-name { display: none; }
html.rail-collapsed .rail-btn { justify-content: center; padding: 0; }
html.rail-collapsed .rail-label {
  position: absolute; left: calc(100% + 12px); top: 50%; transform: translateY(-50%) translateX(-4px);
  background: var(--panel-2); border: 1px solid var(--line-2); color: var(--text);
  font-size: 12px; padding: 4px 8px; border-radius: 7px; opacity: 0; pointer-events: none; transition: opacity .12s, transform .12s; z-index: 50;
}
html.rail-collapsed .rail-btn:hover .rail-label { opacity: 1; transform: translateY(-50%); }
html.rail-collapsed .rail-toggle svg { transform: scaleX(-1); }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }

/* Tab strip */
.tabstrip {
  display: none; align-items: center; gap: 4px; height: 42px; padding: 0 8px;
  background: var(--bg-2); border-bottom: 1px solid var(--line);
}
body.has-tabs .tabstrip { display: flex; }
#tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; min-width: 0; }
#tabs::-webkit-scrollbar { display: none; }
.tab {
  display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 6px 0 10px;
  width: 190px; flex-shrink: 0; border-radius: 8px; color: var(--muted);
  border: 1px solid transparent; transition: background .12s, color .12s;
}
.tab:hover { background: var(--panel); color: var(--text); }
.tab.active { background: var(--panel-2); border-color: var(--line-2); color: var(--text); }
.tab img, .tab .globe { width: 16px; height: 16px; border-radius: 4px; flex-shrink: 0; }
.tab .globe { color: var(--faint); }
.tab-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; font-size: 13px; }
.tab-x {
  width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center;
  color: var(--faint); flex-shrink: 0;
}
.tab-x:hover { background: var(--hover); color: var(--text); }
.tab-x svg { width: 12px; height: 12px; }
.icon-btn {
  width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center;
  color: var(--muted); flex-shrink: 0; transition: background .12s, color .12s;
}
.icon-btn:hover { background: var(--panel-2); color: var(--text); }
.icon-btn:disabled { opacity: .35; pointer-events: none; }
.icon-btn svg { width: 16px; height: 16px; }

/* Browser toolbar */
.toolbar {
  display: none; align-items: center; gap: 4px; height: 48px; padding: 0 8px;
  background: var(--bg-2); border-bottom: 1px solid var(--line);
}
body[data-view="tab"] .toolbar { display: flex; }
.omni {
  flex: 1; display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px;
  margin: 0 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 9px;
  transition: border-color .15s;
}
.omni:focus-within { border-color: var(--line-2); background: var(--panel-2); }
.omni svg { width: 14px; height: 14px; color: var(--faint); flex-shrink: 0; }
.omni input {
  flex: 1; min-width: 0; background: none; border: 0; outline: 0;
  font-size: 13px; color: var(--text);
}
.omni input::placeholder { color: var(--faint); }

#loadbar {
  position: absolute; left: 0; right: 0; top: 0; height: 2px; z-index: 30;
  background: var(--accent); transform-origin: left; transform: scaleX(0); opacity: 0;
}
#loadbar.on { opacity: 1; animation: load 2.4s var(--ease) forwards; }
#loadbar.done { opacity: 0; transform: scaleX(1); transition: opacity .3s .1s; }
@keyframes load { 0% { transform: scaleX(0); } 100% { transform: scaleX(.85); } }

/* Views */
#frames { flex: 1; position: relative; min-height: 0; }
.fslot { position: absolute; inset: 0; display: none; flex-direction: column; background: var(--bg); }
.fslot.active { display: flex; }
#slot-home, #slot-games, #slot-assistant { background: transparent; }
#slot-home::before, #slot-games::before, #slot-assistant::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 55% 65% at 50% 38%, rgba(15,16,18,.62), transparent 80%);
}
.scroll, .composer-wrap { position: relative; z-index: 1; }
.scroll { flex: 1; overflow-y: auto; overflow-x: hidden; }
iframe.pf { flex: 1; width: 100%; border: 0; background: #000; display: block; }

.page { width: 100%; max-width: 1080px; margin: 0 auto; padding: 48px 32px 72px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-title { font-size: 34px; font-weight: 750; letter-spacing: -.035em; background: linear-gradient(180deg, #fff, color-mix(in srgb, var(--accent) 55%, #fff)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.page-sub { color: var(--muted); margin-top: 4px; }
.section { margin-top: 40px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.section-title { font-size: 13px; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.section-title svg { width: 15px; height: 15px; color: var(--accent); }
.home .section-head { margin-top: 0; }
.shortcuts-head { margin-bottom: 8px; }
.link-btn { color: var(--muted); font-size: 13px; }
.link-btn:hover { color: var(--text); }

/* ── Home ──────────────────────────────────────────── */
.home { max-width: 780px; padding-top: 11vh; }
.greet { color: var(--muted); font-size: 15px; margin-bottom: 6px; }
.wordmark {
  font: 800 clamp(38px, 7vw, 66px)/1.1 var(--display); letter-spacing: -.035em; margin-bottom: 16px;
  display: inline-flex; align-items: flex-end; user-select: none;
  animation: fade .9s var(--ease) both;
}
.wordmark .word {
  background: linear-gradient(100deg, #fff 0%, #fff 30%, var(--accent) 50%, #fff 70%, #fff 100%);
  background-size: 300% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: sweep 9s ease-in-out infinite;
}
.wordmark .dot { display: inline-block; width: .19em; height: .19em; border-radius: 50%; margin: 0 0 .14em .08em; background: var(--accent); box-shadow: 0 0 16px var(--accent); animation: pulse 2.8s ease-in-out infinite; }
@keyframes sweep { 0%, 15% { background-position: 100% 0; } 55%, 100% { background-position: 0% 0; } }
@keyframes pulse { 50% { transform: scale(.7); opacity: .65; } }
.greet { animation: fade .8s var(--ease) both; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 26px; animation: fade .8s .25s var(--ease) both; }
.pill {
  display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px 0 10px; border-radius: 999px;
  font-size: 13px; color: var(--muted); background: rgba(24,25,29,.72); border: 1px solid var(--line);
  transition: color .15s, border-color .15s, background .15s;
}
.pill svg { width: 15px; height: 15px; color: var(--accent); }
.pill:hover { color: var(--text); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); background: color-mix(in srgb, var(--accent) 8%, rgba(24,25,29,.8)); }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } }
.clock-chip {
  position: absolute; top: 18px; right: 22px; z-index: 2; display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; border-radius: 12px; background: rgba(24,25,29,.72); border: 1px solid var(--line);
  font-size: 13px; color: var(--muted); animation: fade .8s .4s var(--ease) both;
}
.clock-chip b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.clock-chip i { width: 7px; height: 7px; border-radius: 50%; background: #6ee7b7; box-shadow: 0 0 8px #6ee7b7; }
.clock-chip i.off { background: var(--faint); box-shadow: none; }

.search {
  display: flex; align-items: center; gap: 10px; height: 54px; padding: 0 8px 0 18px;
  border: 1px solid transparent; border-radius: 15px;
  background:
    linear-gradient(rgba(22,23,27,.94), rgba(22,23,27,.94)) padding-box,
    linear-gradient(120deg, color-mix(in srgb, var(--accent) 55%, transparent), var(--line-2) 35%, var(--line-2) 65%, color-mix(in srgb, var(--accent) 40%, transparent)) border-box;
  box-shadow: 0 14px 40px -16px rgba(0,0,0,.8), 0 0 0 0 transparent;
  transition: box-shadow .25s;
  animation: fade .8s .15s var(--ease) both;
}
.search:focus-within { box-shadow: 0 14px 40px -16px rgba(0,0,0,.8), 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent), 0 0 40px -8px color-mix(in srgb, var(--accent) 45%, transparent); }
.search > svg { width: 18px; height: 18px; color: var(--faint); flex-shrink: 0; }
.search input { flex: 1; min-width: 0; height: 100%; background: none; border: 0; outline: 0; font-size: 16px; }
.search input::placeholder { color: var(--faint); }
.kbd { font: 11px var(--mono); color: var(--faint); border: 1px solid var(--line-2); border-radius: 5px; padding: 2px 6px; }
.search-go {
  height: 38px; padding: 0 16px; border-radius: 10px; background: var(--accent); color: var(--accent-ink);
  font-weight: 650; font-size: 14px; transition: filter .15s, box-shadow .15s;
}
.search-go:hover { filter: brightness(1.08); box-shadow: 0 0 20px -2px color-mix(in srgb, var(--accent) 70%, transparent); }

.shortcuts { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 6px; animation: fade .8s .3s var(--ease) both; }
.sc {
  cursor: pointer; position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 14px 6px 12px; border-radius: 12px; color: var(--muted); font-size: 12.5px;
  transition: background .15s, color .15s;
}
.sc:hover { color: var(--text); }
.sc-ico {
  width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center;
  background: linear-gradient(160deg, rgba(38,40,46,.9), rgba(22,23,27,.9)); border: 1px solid var(--line);
  box-shadow: 0 8px 20px -10px rgba(0,0,0,.8), inset 0 1px 0 rgba(255,255,255,.05);
  transition: transform .2s var(--ease), border-color .2s, box-shadow .2s;
}
.sc:hover .sc-ico { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); box-shadow: 0 12px 26px -10px color-mix(in srgb, var(--accent) 45%, transparent), inset 0 1px 0 rgba(255,255,255,.06); }
.sc-ico img { width: 28px; height: 28px; border-radius: 6px; }
.sc-ico .letter { font-weight: 650; font-size: 17px; color: var(--muted); }
.sc-ico svg { width: 20px; height: 20px; color: var(--accent); }
.sc-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-rm {
  position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border-radius: 6px;
  display: grid; place-items: center; color: var(--faint); opacity: 0; transition: opacity .12s;
}
.sc:hover .sc-rm, .sc-rm:focus-visible { opacity: 1; }
.sc-rm:hover { background: var(--hover); color: var(--text); }
.sc-rm svg { width: 10px; height: 10px; }

.add-form {
  display: none; gap: 8px; margin-top: 10px; padding: 12px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--line);
}
.add-form.open { display: flex; flex-wrap: wrap; }
.field {
  flex: 1; min-width: 140px; height: 36px; padding: 0 12px; border-radius: 9px;
  background: var(--bg); border: 1px solid var(--line); outline: 0; font-size: 13px;
}
.field:focus { border-color: var(--line-2); }
.field::placeholder { color: var(--faint); }
.btn {
  height: 36px; padding: 0 14px; border-radius: 9px; font-size: 13px; font-weight: 550;
  background: var(--panel-2); border: 1px solid var(--line-2); color: var(--text);
  transition: background .15s; white-space: nowrap;
}
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn.ghost { background: none; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--panel-2); }
.btn.danger { color: var(--danger); }

.recent { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.recent-item {
  display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 12px;
  background: rgba(24,25,29,.78); border: 1px solid var(--line); text-align: left; min-width: 0;
  transition: border-color .15s, background .15s, transform .2s var(--ease);
}
.recent-item:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); transform: translateY(-2px); }
.recent-thumb { width: 56px; height: 34px; border-radius: 7px; overflow: hidden; background: var(--panel-2); flex-shrink: 0; display: grid; place-items: center; }
.recent-thumb img { width: 100%; height: 100%; object-fit: cover; }
.recent-thumb img.fav { width: 18px; height: 18px; object-fit: contain; }
.recent-text { min-width: 0; }
.recent-text b { display: block; font-weight: 550; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-text small { display: block; color: var(--faint); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(180px, 1fr); gap: 10px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x mandatory; }
.strip > * { scroll-snap-align: start; }

/* ── Games ─────────────────────────────────────────── */
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; }
.filter-search { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border-radius: 9px; background: rgba(24,25,29,.85); border: 1px solid var(--line); min-width: 220px; }
.filter-search:focus-within { border-color: var(--line-2); }
.filter-search svg { width: 14px; height: 14px; color: var(--faint); }
.filter-search input { background: none; border: 0; outline: 0; font-size: 13px; flex: 1; min-width: 0; }
.chip {
  height: 32px; padding: 0 12px; border-radius: 999px; font-size: 13px; color: var(--muted);
  border: 1px solid var(--line); transition: all .12s;
}
.chip:hover { color: var(--text); border-color: var(--line-2); }
.chip { background: rgba(24,25,29,.6); }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; box-shadow: 0 0 18px -4px color-mix(in srgb, var(--accent) 70%, transparent); }

.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.game { text-align: left; border-radius: 12px; display: flex; flex-direction: column; gap: 10px; }
.cover {
  position: relative; aspect-ratio: 460 / 215; border-radius: 10px; overflow: hidden;
  background: var(--panel-2); border: 1px solid var(--line);
  transition: border-color .2s, box-shadow .25s, transform .25s var(--ease);
}
.game:hover .cover { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); box-shadow: 0 16px 36px -14px color-mix(in srgb, var(--accent) 55%, transparent); transform: translateY(-3px); }
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .35s var(--ease); }
.cover img.bd { filter: blur(18px) saturate(1.3) brightness(.55); transform: scale(1.3); }
.cover img.fg.contain { object-fit: contain; padding: 8% 10%; filter: drop-shadow(0 6px 14px rgba(0,0,0,.5)); }
.game:hover .cover img.bd { transform: scale(1.35); }
.cover .gen {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 10px; text-align: center;
  background: radial-gradient(120% 90% at 20% 0%, hsl(var(--h) 70% 38%), transparent 60%), linear-gradient(135deg, hsl(calc(var(--h) + 40) 45% 20%), hsl(var(--h) 35% 12%));
}
.cover .gen b { font: 800 26px var(--display); letter-spacing: -.02em; color: #fff; opacity: .92; }
.cover .gen small { font-size: 12px; color: rgba(255,255,255,.75); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cover .fallback { position: absolute; inset: 0; display: grid; place-items: center; padding: 10px; text-align: center; line-height: 1.15; font-weight: 700; font-size: clamp(14px, 1.6vw, 19px); letter-spacing: -.02em; color: rgba(255,255,255,.85); }
.game:hover .cover img { transform: scale(1.04); }
.cover::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
}
.play-pill {
  position: absolute; right: 8px; bottom: 8px; height: 28px; padding: 0 10px 0 8px; border-radius: 999px;
  display: flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 650; color: var(--accent-ink); background: var(--accent); opacity: 0; transform: translateY(4px); transition: all .18s var(--ease);
}
.play-pill svg { width: 12px; height: 12px; }
.game:hover .play-pill, .game:focus-visible .play-pill { opacity: 1; transform: none; }
.game-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.game-name { font-weight: 600; font-size: 14.5px; }
.game-tag { font-size: 12px; color: var(--faint); white-space: nowrap; }
.game-desc { color: var(--muted); font-size: 13px; margin-top: -6px; }
.empty { color: var(--muted); padding: 40px 0; text-align: center; }

/* Player bar (games + movies) */
.player-bar {
  height: 44px; display: flex; align-items: center; gap: 6px; padding: 0 8px;
  background: var(--bg-2); border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.player-title { font-weight: 600; font-size: 14px; margin-left: 4px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-title small { color: var(--faint); font-weight: 400; margin-left: 8px; }
.bar-btn {
  height: 30px; padding: 0 10px; border-radius: 8px; display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--muted); transition: background .12s, color .12s;
}
.bar-btn:hover { background: var(--panel-2); color: var(--text); }
.bar-btn svg { width: 15px; height: 15px; }
.stage { flex: 1; position: relative; min-height: 0; display: flex; }
.loader {
  position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px; background: var(--bg);
  text-align: center; padding: 24px; transition: opacity .3s;
}
.loader.hidden { opacity: 0; pointer-events: none; }
.loader > img { width: 220px; aspect-ratio: 460/215; object-fit: cover; border-radius: 10px; opacity: .9; }
.loader p { color: var(--muted); font-size: 13px; max-width: 320px; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.focus-hint {
  position: absolute; left: 50%; top: 14px; transform: translateX(-50%); z-index: 3;
  background: rgba(0,0,0,.8); border: 1px solid var(--line-2); padding: 6px 12px; border-radius: 999px;
  font-size: 12.5px; color: var(--text); pointer-events: none; opacity: 0; transition: opacity .2s;
}
.focus-hint.show { opacity: 1; }

/* ── Chat ──────────────────────────────────────────── */
.chat { max-width: 760px; margin: 0 auto; width: 100%; padding: 32px 24px 24px; display: flex; flex-direction: column; gap: 18px; }
.chat-empty { padding-top: 10vh; }
.chat-empty h2 { font-size: 34px; font-weight: 750; letter-spacing: -.035em; background: linear-gradient(180deg, #fff, color-mix(in srgb, var(--accent) 55%, #fff)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.chat-empty p { color: var(--muted); margin-top: 6px; max-width: 460px; }
.suggest { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 22px; }
.suggest button {
  text-align: left; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: rgba(24,25,29,.78); color: var(--muted); font-size: 13.5px; transition: all .15s;
}
.suggest button:hover { color: var(--text); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.msg { display: flex; }
.msg.user { justify-content: flex-end; }
.bubble { max-width: 85%; white-space: pre-wrap; word-wrap: break-word; line-height: 1.55; font-size: 14.5px; }
.msg.user .bubble { background: var(--panel-2); border: 1px solid var(--line); padding: 10px 14px; border-radius: 16px 16px 4px 16px; }
.msg.bot .bubble { padding: 2px 0; }
.msg.bot.err .bubble { color: var(--danger); }
.bubble code { font: 13px var(--mono); background: var(--panel-2); padding: 1px 5px; border-radius: 5px; }
.dots { display: inline-flex; gap: 4px; padding: 8px 0; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); animation: blink 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.composer-wrap { padding: 0 24px 20px; }
.composer {
  max-width: 760px; margin: 0 auto; display: flex; align-items: flex-end; gap: 8px;
  padding: 8px 8px 8px 16px; border-radius: 16px; background: rgba(22,23,27,.94); border: 1px solid var(--line-2);
  transition: box-shadow .2s, border-color .2s;
}
.composer:focus-within { border-color: color-mix(in srgb, var(--accent) 50%, var(--line-2)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent); }
.composer textarea {
  flex: 1; resize: none; background: none; border: 0; outline: 0; font-size: 15px;
  line-height: 1.45; padding: 7px 0; max-height: 160px;
}
.composer textarea::placeholder { color: var(--faint); }
.send {
  width: 36px; height: 36px; border-radius: 10px; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; flex-shrink: 0;
}
.send:disabled { background: var(--panel-2); color: var(--faint); cursor: default; }
.send svg { width: 16px; height: 16px; }
.fine { text-align: center; color: var(--faint); font-size: 12px; margin-top: 8px; }

/* Movies unavailable */
.notice { margin: auto; text-align: center; max-width: 360px; padding: 24px; }
.notice h2 { font-size: 18px; font-weight: 600; }
.notice p { color: var(--muted); margin-top: 6px; }

/* ── Settings sheet ───────────────────────────────── */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 90; opacity: 0; pointer-events: none; transition: opacity .2s; }
.scrim.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100vw); z-index: 100;
  background: var(--bg-2); border-left: 1px solid var(--line); display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .25s var(--ease); visibility: hidden;
}
.sheet.open { transform: none; visibility: visible; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 12px 22px; }
.sheet-head h2 { font-size: 17px; font-weight: 600; }
.sheet-body { flex: 1; overflow-y: auto; padding: 0 22px 24px; }
.group { padding: 18px 0; border-top: 1px solid var(--line); }
.group:first-child { border-top: 0; padding-top: 4px; }
.group-title { font-size: 12px; color: var(--faint); font-weight: 600; margin-bottom: 12px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.row + .row { margin-top: 14px; }
.row-label b { display: block; font-weight: 550; }
.row-label small { color: var(--faint); font-size: 12.5px; }
.stack { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.inline { display: flex; gap: 8px; }
.stack > .field { flex: none; }
.switch { width: 38px; height: 22px; border-radius: 999px; background: var(--line-2); position: relative; flex-shrink: 0; transition: background .18s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .18s var(--ease); }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(16px); }
.swatches { display: flex; gap: 8px; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; box-shadow: inset 0 0 0 2px var(--bg-2); }
.swatch[aria-pressed="true"] { border-color: var(--text); }
.presets { display: flex; flex-wrap: wrap; gap: 6px; }
.presets .chip { height: 28px; font-size: 12.5px; }
select.field { appearance: none; cursor: pointer; background-image: linear-gradient(45deg, transparent 50%, var(--faint) 50%), linear-gradient(135deg, var(--faint) 50%, transparent 50%); background-position: calc(100% - 16px) 15px, calc(100% - 11px) 15px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
.link-list { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.link-list .li { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 10px; border-radius: 8px; background: var(--panel); }
.link-list img { width: 16px; height: 16px; }
.link-list span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.link-list small { color: var(--faint); font-size: 12px; }
.sheet-foot { padding: 14px 22px; border-top: 1px solid var(--line); color: var(--faint); font-size: 12px; display: flex; justify-content: space-between; align-items: center; }

/* Toast */
#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 12px); z-index: 200;
  background: var(--text); color: var(--bg); font-size: 13px; font-weight: 550;
  padding: 9px 14px; border-radius: 10px; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s var(--ease); max-width: calc(100vw - 32px);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ── Motion ────────────────────────────────────────── */
.fslot.enter { animation: viewIn .34s var(--ease); }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px) scale(.995); } }
.stagger > .game { animation: cardIn .45s calc(var(--i) * 28ms) var(--ease) both; }
@keyframes cardIn { from { opacity: 0; transform: translateY(14px) scale(.97); } }
.shortcuts .sc { animation: cardIn .45s calc(.3s + var(--i, 0) * 30ms) var(--ease) both; }
.page-title, .chat-empty h2 { font-family: var(--display); font-weight: 800; letter-spacing: -.03em; }

/* ── Tabs ──────────────────────────────────────────── */
.tab { transform-origin: left center; }
.tab.enter { animation: tabIn .26s var(--ease); }
.tab.leaving { animation: tabOut .17s ease-in forwards; pointer-events: none; }
@keyframes tabIn { from { opacity: 0; max-width: 0; transform: translateY(6px); } to { max-width: 190px; } }
@keyframes tabOut { to { opacity: 0; max-width: 0; padding: 0; margin: 0; border-width: 0; transform: scale(.9); } }
.tab.dragging { opacity: .5; }
.tab-ico { width: 16px; height: 16px; flex-shrink: 0; display: grid; place-items: center; }
.tab-ico img { width: 16px; height: 16px; border-radius: 4px; }
.tab-ico .globe { width: 15px; height: 15px; color: var(--faint); }
.tab-spin { width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: spin .7s linear infinite; }
.tab-mute svg { width: 13px; height: 13px; color: var(--faint); display: block; }
.tab.active { box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent), 0 6px 18px -10px color-mix(in srgb, var(--accent) 70%, transparent); }

/* ── Toolbar ───────────────────────────────────────── */
.icon-btn.on { color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.omni-lock { display: grid; place-items: center; color: var(--faint); }
.omni-lock svg { width: 13px; height: 13px; }
.omni-lock.secure { color: #6ee7b7; }
.omni-star { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 6px; color: var(--faint); flex-shrink: 0; }
.omni-star:hover { color: var(--text); background: var(--hover); }
.omni-star.on { color: var(--accent); }
.omni-star svg { width: 15px; height: 15px; }
.omni-star.on svg { animation: bump .35s var(--ease); }
.zoom-badge { font-size: 11.5px; padding: 2px 7px; border-radius: 6px; background: var(--hover); color: var(--muted); cursor: pointer; }

.bookmarks-bar { display: none; gap: 2px; padding: 4px 8px; background: var(--bg-2); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
body.has-bookmarks[data-view="tab"] .bookmarks-bar { display: flex; }
.bm { position: relative; display: flex; align-items: center; gap: 7px; height: 28px; padding: 0 10px; border-radius: 7px; color: var(--muted); font-size: 12.5px; max-width: 180px; flex-shrink: 0; }
.bm:hover { background: var(--panel-2); color: var(--text); }
.bm img { width: 14px; height: 14px; border-radius: 3px; }
.bm span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bm-x { display: none; width: 16px; height: 16px; place-items: center; border-radius: 4px; color: var(--faint); }
.bm:hover .bm-x { display: grid; }
.bm-x:hover { background: var(--hover); color: var(--text); }
.bm-x svg { width: 9px; height: 9px; }

/* ── Menus & popovers ──────────────────────────────── */
.menu, .suggest-box {
  position: fixed; z-index: 150; min-width: 250px; padding: 6px; border-radius: 12px;
  background: rgba(24,25,29,.97); border: 1px solid var(--line-2);
  box-shadow: 0 20px 50px -12px rgba(0,0,0,.8), 0 0 0 1px rgba(255,255,255,.02);
}
.menu.enter { animation: pop .16s var(--ease); transform-origin: top right; }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(-4px); } }
.menu button, .menu-row {
  width: 100%; display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: 8px;
  font-size: 13.5px; color: var(--text); text-align: left;
}
.menu button:hover { background: var(--hover); }
.menu svg { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; }
.menu kbd { margin-left: auto; font: 11px var(--mono); color: var(--faint); }
.menu em { margin-left: auto; font-style: normal; font-size: 12px; color: var(--accent); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 4px; }
.menu .check { margin-left: auto; width: 16px; height: 16px; border-radius: 5px; border: 1.5px solid var(--line-2); }
.menu .check.on { background: var(--accent); border-color: var(--accent); box-shadow: inset 0 0 0 3px rgba(24,25,29,.97); }
.zoom-ctl { margin-left: auto; display: flex; align-items: center; gap: 2px; background: var(--bg); border-radius: 8px; padding: 2px; }
.zoom-ctl button { width: 28px !important; height: 26px !important; justify-content: center; padding: 0 !important; font-size: 16px !important; }
.zoom-ctl b { font-size: 12px; font-weight: 600; min-width: 42px; text-align: center; }
.suggest-box { min-width: 0; padding: 6px; animation: pop .14s var(--ease); }
.sg { display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 12px; border-radius: 8px; cursor: pointer; }
.sg:hover, .sg.sel { background: var(--hover); }
.sg svg { width: 15px; height: 15px; color: var(--faint); flex-shrink: 0; }
.sg.sel svg { color: var(--accent); }
.sg-main { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sg-sub { color: var(--faint); font-size: 12px; white-space: nowrap; }

.findbar {
  position: absolute; top: 10px; right: 16px; z-index: 40; display: flex; align-items: center; gap: 2px;
  padding: 5px 5px 5px 12px; border-radius: 12px; background: rgba(24,25,29,.97); border: 1px solid var(--line-2);
  box-shadow: 0 16px 40px -12px rgba(0,0,0,.8);
}
.findbar.enter { animation: pop .18s var(--ease); }
.findbar input { width: 200px; background: none; border: 0; outline: 0; font-size: 13.5px; }
.find-count { font-size: 12px; color: var(--faint); margin: 0 6px; white-space: nowrap; }
.find-count.none { color: var(--danger); }

/* ── Auto clicker ─────────────────────────────────── */
.clicker {
  position: absolute; right: 16px; bottom: 16px; z-index: 45; width: 290px; padding: 14px; border-radius: 16px;
  background: rgba(22,23,27,.97); border: 1px solid var(--line-2);
  box-shadow: 0 24px 60px -16px rgba(0,0,0,.85), 0 0 0 1px color-mix(in srgb, var(--accent) 12%, transparent);
  display: flex; flex-direction: column; gap: 12px;
}
.clicker.enter { animation: pop .2s var(--ease); transform-origin: bottom right; }
.clicker-head { display: flex; align-items: center; justify-content: space-between; margin: -4px -6px -4px 0; }
.clicker-head b { display: flex; align-items: center; gap: 8px; font-weight: 650; }
.clicker-head b svg { width: 16px; height: 16px; color: var(--accent); }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg); border-radius: 10px; padding: 3px; }
.seg button { height: 30px; border-radius: 8px; font-size: 13px; color: var(--muted); transition: all .15s; }
.seg button[aria-pressed="true"] { background: var(--panel-2); color: var(--text); box-shadow: 0 1px 0 rgba(255,255,255,.05) inset; }
.cps { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.cps input { flex: 1; accent-color: var(--accent); }
.cps b { color: var(--text); font-weight: 600; min-width: 62px; text-align: right; font-variant-numeric: tabular-nums; }
.clicker-status { font-size: 13px; color: var(--muted); min-height: 1.4em; }
.clicker-actions { display: flex; gap: 8px; }
.clicker-actions .btn { flex: 1; }
.btn.danger-fill { background: var(--danger); color: #1a0606; }
.fine.left { text-align: left; margin: 0; }
.pick-layer {
  position: fixed; z-index: 120; cursor: crosshair; display: flex; justify-content: center; align-items: flex-start;
  background: color-mix(in srgb, var(--accent) 6%, transparent); outline: 2px dashed color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: -2px;
}
.pick-layer span { margin-top: 14px; padding: 7px 14px; border-radius: 999px; background: rgba(0,0,0,.85); font-size: 13px; pointer-events: none; }
.click-marker {
  position: absolute; z-index: 5; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%; pointer-events: none;
  border: 2px solid var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent), 0 0 18px var(--accent);
}
.click-marker::after { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: var(--accent); }

/* ── Games extras & requests ──────────────────────── */
.section-head.big { margin-bottom: 14px; }
.section-head.big .section-title { font-size: 17px; color: var(--text); font-family: var(--display); font-weight: 700; letter-spacing: -.01em; }
.section-head.big .section-title svg { width: 18px; height: 18px; }
.count { font: 600 12px var(--sans); color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); padding: 2px 8px; border-radius: 999px; letter-spacing: 0; }
.section-note { font-size: 12.5px; color: var(--faint); }
.section-note a { color: var(--muted); }
.section-sub { color: var(--muted); font-size: 13.5px; margin: -6px 0 14px; }
.btn-ico { width: 15px; height: 15px; margin-right: 6px; vertical-align: -3px; }
.more-btn { display: block; margin: 22px auto 0; }
.skel .cover, .skel-line { background: linear-gradient(100deg, var(--panel) 30%, var(--panel-2) 50%, var(--panel) 70%); background-size: 300% 100%; animation: skel 1.3s linear infinite; }
.skel-line { height: 12px; width: 60%; border-radius: 6px; }
@keyframes skel { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }

.requests { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px; }
.req {
  display: flex; gap: 12px; align-items: center; padding: 10px 14px 10px 10px; border-radius: 12px;
  background: rgba(24,25,29,.78); border: 1px solid var(--line); animation: cardIn .4s calc(var(--i) * 30ms) var(--ease) both;
}
.req.added { opacity: .6; }
.vote {
  display: flex; flex-direction: column; align-items: center; justify-content: center; width: 46px; height: 50px; border-radius: 10px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); flex-shrink: 0; transition: all .15s;
}
.vote svg { width: 16px; height: 16px; }
.vote b { font-size: 13px; font-variant-numeric: tabular-nums; }
.vote:not(:disabled):hover { border-color: var(--accent); color: var(--accent); }
.vote.on { background: color-mix(in srgb, var(--accent) 16%, transparent); border-color: color-mix(in srgb, var(--accent) 50%, transparent); color: var(--accent); cursor: default; }
.vote.bump { animation: bump .35s var(--ease); }
.req-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.req-body b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.req-body small { color: var(--faint); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.req-badge { align-self: flex-start; font-size: 11px; font-weight: 600; color: #6ee7b7; }
.req-bar { height: 3px; border-radius: 3px; background: var(--line); overflow: hidden; margin-top: 4px; }
.req-bar i { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.req { flex-wrap: wrap; }
.req.open { grid-column: 1 / -1; }
.req-replies { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; margin-top: 5px; padding: 2px 8px 2px 6px; border-radius: 7px; font-size: 12px; color: var(--muted); }
.req-replies svg { width: 13px; height: 13px; }
.req-replies:hover, .req-replies[aria-expanded="true"] { background: var(--panel-2); color: var(--text); }
.req-replies em { font-style: normal; font-size: 11px; font-weight: 600; color: var(--accent); }
.req-thread { flex-basis: 100%; display: flex; flex-direction: column; gap: 8px; margin: 4px 0 2px 30px; padding: 10px 0 2px 14px; border-left: 2px solid var(--line-2); }
.rp { display: flex; gap: 10px; align-items: flex-start; }
.rp .av { flex-shrink: 0; }
.rp-main { flex: 1; min-width: 0; }
.rp-head { display: flex; align-items: center; gap: 7px; font-size: 12.5px; }
.rp-head b { font-weight: 600; }
.rp-head time { color: var(--faint); font-size: 11.5px; }
.rp-main p { margin-top: 1px; font-size: 13.5px; line-height: 1.45; color: var(--text); overflow-wrap: anywhere; }
.rp.staff .rp-main p { color: color-mix(in srgb, var(--accent) 35%, var(--text)); }
.rp-del { width: 26px; height: 26px; opacity: 0; }
.rp:hover .rp-del, .rp-del:focus-visible { opacity: 1; }
.rp-del svg { width: 13px; height: 13px; }
.rp-empty { font-size: 12.5px; color: var(--faint); }
.rp-form { display: flex; gap: 8px; margin-top: 2px; }
.rp-form .field { flex: 1; height: 34px; font-size: 13px; }

.modal-scrim { position: fixed; inset: 0; z-index: 160; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: 16px; }
.modal-scrim.enter { animation: fadeIn .2s; }
.modal-scrim.enter .modal { animation: modalIn .28s var(--ease); }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.97); } }
.modal {
  width: min(460px, 100%); padding: 20px; border-radius: 18px; display: flex; flex-direction: column; gap: 14px;
  background: var(--bg-2); border: 1px solid var(--line-2); box-shadow: 0 30px 80px -20px rgba(0,0,0,.9), 0 0 60px -30px var(--accent);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; }
.modal-head h2 { font: 700 20px var(--display); letter-spacing: -.02em; }
.modal-sub { color: var(--muted); font-size: 13.5px; margin-top: -8px; }
.lbl { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 550; }
.lbl small { color: var(--faint); font-weight: 400; }
.lbl .field { flex: none; }
textarea.field { height: auto; padding: 9px 12px; resize: vertical; line-height: 1.45; }
.modal-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
#req-msg { color: var(--danger); }

/* ── History ───────────────────────────────────────── */
.page.narrow { max-width: 820px; }
.filter-search.wide { width: 100%; height: 40px; margin-bottom: 8px; }
.hist-day { font-size: 12px; font-weight: 600; color: var(--faint); margin: 22px 0 6px 4px; }
.hist-row {
  display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 6px 0 12px; border-radius: 10px; cursor: pointer;
  transition: background .12s;
}
.hist-row:hover { background: rgba(31,32,37,.85); }
.hist-row time { width: 64px; color: var(--faint); font-size: 12.5px; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.hist-row img { width: 16px; height: 16px; border-radius: 4px; flex-shrink: 0; }
.hist-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-host { color: var(--faint); font-size: 12.5px; white-space: nowrap; }
.hist-row .icon-btn { width: 28px; height: 28px; opacity: 0; }
.hist-row:hover .icon-btn { opacity: 1; }
.hist-row .icon-btn svg { width: 12px; height: 12px; }

/* ── Settings extras ───────────────────────────────── */
.keys { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; font-size: 13px; }
.keys dt { font: 11.5px var(--mono); color: var(--text); background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 6px; padding: 2px 7px; justify-self: start; }
.keys dd { color: var(--muted); align-self: center; }
#toast[data-kind="ok"]::before { content: "✓ "; color: #1a7f55; font-weight: 800; }
#toast[data-kind="err"] { background: #ffd6d6; color: #3a0b0b; }
#toast.show { animation: toastIn .35s cubic-bezier(.3,1.5,.5,1); }
@keyframes toastIn { from { transform: translate(-50%, 16px) scale(.9); } }
.loader-cover { width: 240px; border-radius: 12px; }
.msg { animation: msgIn .3s var(--ease); }
@keyframes msgIn { from { opacity: 0; transform: translateY(8px); } }
.sc-ico .letter { font-weight: 650; font-size: 18px; color: var(--muted); }
.recent-thumb { position: relative; }
.recent-thumb img.fg.contain, .recent-thumb img.bd { position: absolute; inset: 0; width: 100%; height: 100%; }
.recent-thumb img.bd { filter: blur(8px) brightness(.5); transform: scale(1.4); }
.recent-thumb img.contain { object-fit: contain; padding: 3px; }
#slot-history { background: transparent; }
#slot-history::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse 55% 65% at 50% 38%, rgba(15,16,18,.7), transparent 80%); }

/* ── Mobile ────────────────────────────────────────── */
@media (max-width: 720px) {
  .app { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .rail {
    grid-row: 2; flex-direction: row; justify-content: space-around; padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    border-right: 0; border-top: 1px solid var(--line);
  }
  .app, html.rail-collapsed .app { grid-template-columns: 1fr; }
  .rail { gap: 0; }
  .rail-top, .rail-spacer, .rail-btn.desk, .rail-label, html.rail-collapsed .rail-label { display: none; }
  .rail-btn { padding: 0; width: 48px; justify-content: center; }
  .findbar { right: 8px; left: 8px; }
  .clicker { right: 8px; left: 8px; width: auto; }
  .hide-sm { display: none; }
  .bookmarks-bar { display: none !important; }
  .rail-btn[aria-current="page"]::before { left: 12px; right: 12px; top: -7px; bottom: auto; width: auto; height: 3px; border-radius: 0 0 3px 3px; }
  .page { padding: 28px 16px 48px; }
  .home { padding-top: 9vh; }
  .clock-chip { top: 12px; right: 12px; padding: 6px 10px; font-size: 12px; }
  .clock-chip span { display: none; }
  .sc-ico { width: 50px; height: 50px; }
  .kbd { display: none; }
  .search-go { padding: 0 12px; }
  .tab { width: 150px; }
  .suggest { grid-template-columns: 1fr; }
  .game-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .game-desc { display: none; }
  .bar-btn .lbl { display: none; }
  .composer-wrap { padding: 0 12px 12px; }
  .chat { padding: 20px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ── Games page v3: vote card, favorites, collapsible sections ─────────── */
.vote-card {
  margin: 4px 0 26px; padding: 16px 16px 12px; border-radius: 16px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 10%, rgba(24,25,29,.9)), rgba(20,21,24,.9) 55%);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--line));
}
.vote-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.vote-head h2 { font: 700 16px var(--display); letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; }
.vote-head h2 svg { width: 17px; height: 17px; color: var(--accent); }
.vote-head p { color: var(--muted); font-size: 13px; margin-top: 3px; }
.vote-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.vote-actions .btn { height: 32px; }
.vote-card .requests { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px; }
.vote-card .req { padding: 8px 8px 8px 12px; background: rgba(15,16,18,.55); }
.req-rank { width: 18px; color: var(--faint); font-weight: 700; font-size: 13px; text-align: center; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.req:nth-child(1) .req-rank { color: var(--accent); }
.vote-card .vote { width: 42px; height: 44px; }
.empty.small { padding: 10px 0; font-size: 13px; text-align: left; }

.gsec { margin-top: 26px; }
.gsec-head {
  width: 100%; display: flex; align-items: center; gap: 9px; padding: 8px 10px 8px 4px; margin: 0 0 12px -4px;
  border-radius: 10px; text-align: left; transition: background .15s;
}
.gsec-head:hover { background: rgba(31,32,37,.6); }
.gsec-head > span:first-of-type { font: 700 17px var(--display); letter-spacing: -.01em; }
.gsec-head .ico { width: 18px; height: 18px; color: var(--accent); }
.gsec-head .chev { width: 16px; height: 16px; color: var(--faint); transition: transform .25s var(--ease); }
.gsec-note { margin-left: auto; font-style: normal; font-size: 12.5px; color: var(--faint); }
.gsec-body { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .3s var(--ease), opacity .25s; }
.gsec-body > * { min-height: 0; }
.gsec-body { overflow: hidden; }
.gsec.collapsed .gsec-body { grid-template-rows: 0fr; opacity: 0; }
.gsec.collapsed .gsec-body > * { overflow: hidden; }
.gsec.collapsed .chev { transform: rotate(-90deg); }
.gsec-body .game-grid { padding: 4px 2px 6px; }

.fav-btn {
  position: absolute; left: 8px; top: 8px; z-index: 2; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(10,10,14,.62); color: #fff;
  opacity: 0; transform: scale(.85); transition: opacity .18s, transform .18s var(--ease), color .15s, background .15s;
}
.fav-btn svg { width: 15px; height: 15px; }
.fav-btn.on { color: #ff6b8b; }
.game:hover .fav-btn, .fav-btn:focus-visible { opacity: 1; transform: none; }
.fav-btn:hover { background: rgba(10,10,14,.85); }
.fav-btn.pop { animation: favPop .35s cubic-bezier(.3,1.6,.5,1); }
@keyframes favPop { 40% { transform: scale(1.35); } }
@media (max-width: 720px) {
  .fav-btn { opacity: 1; transform: none; }
  .gsec-note { display: none; }
  .vote-head { flex-direction: column; }
}
.bar-btn.off { color: var(--danger); }

.ai-status { display: inline-flex; align-items: flex-start; gap: 10px; font-size: 13px; color: var(--muted); padding: 8px 12px; border-radius: 12px; background: rgba(24,25,29,.8); border: 1px solid var(--line); margin-bottom: 18px; max-width: 560px; }
.ai-status:empty { display: none; }
.ai-status i { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); margin-top: 5px; flex-shrink: 0; }
.ai-status.checking i { animation: blink 1s infinite; }
.ai-status.ok i { background: #6ee7b7; box-shadow: 0 0 8px #6ee7b7; }
.ai-status.bad { border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.ai-status.bad i { background: var(--danger); }
.ai-status b { display: block; color: var(--text); font-weight: 600; }
.ai-status span { display: block; margin-top: 3px; }

/* ── Badges ────────────────────────────────────────── */
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #ff5c7a; color: #fff; font: 700 11px/18px var(--sans); text-align: center; }
.rail-btn .badge { margin-left: auto; }
html.rail-collapsed .rail-btn .badge { position: absolute; top: 4px; right: 4px; margin: 0; min-width: 16px; height: 16px; line-height: 16px; font-size: 10px; }

/* ── Friends ───────────────────────────────────────── */
#slot-friends { background: transparent; }
.friends-page { position: relative; z-index: 1; flex: 1; min-height: 0; display: flex; }
.fl-center { flex: 1; display: grid; place-items: center; padding: 24px; min-height: 100%; }
.av { width: var(--s); height: var(--s); border-radius: 50%; flex-shrink: 0; display: inline-grid; place-items: center; font: 700 calc(var(--s) * .42) var(--display); color: #fff;
  background: linear-gradient(140deg, hsl(var(--h) 70% 62%), hsl(calc(var(--h) + 40) 60% 38%)); }
.av-wrap { position: relative; flex-shrink: 0; display: inline-flex; }
.av-wrap .dot { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%; background: #4a4c52; border: 2.5px solid var(--bg-2); }
.av-wrap .dot.on { background: #34d399; }

.auth { width: min(400px, 100%); padding: 26px; border-radius: 20px; background: rgba(20,21,24,.94); border: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 14px; box-shadow: 0 30px 80px -30px rgba(0,0,0,.9), 0 0 80px -40px var(--accent); animation: modalIn .35s var(--ease); }
.auth-mark .mark { width: 44px; height: 44px; }
.auth h1 { font: 800 24px var(--display); letter-spacing: -.02em; }
.auth > p { color: var(--muted); margin-top: -8px; font-size: 14px; }
.auth .lbl .field { flex: none; height: 42px; font-size: 15px; }
.auth-err { color: var(--danger); font-size: 13px; min-height: 1em; margin: -4px 0; }
.auth-go { height: 42px; font-size: 14.5px; }
.auth .fine { text-align: left; margin: 0; }

.fl { flex: 1; display: grid; grid-template-columns: 320px 1fr; min-height: 0; margin: 16px; border-radius: 18px; overflow: hidden; border: 1px solid var(--line); background: rgba(16,17,20,.9); }
.fl-side { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: rgba(20,21,24,.7); }
.fl-me { display: flex; align-items: center; gap: 12px; padding: 16px; border-bottom: 1px solid var(--line); }
.fl-me > div { flex: 1; min-width: 0; }
.fl-me b { display: block; font-weight: 650; }
.fl-me small { color: var(--faint); font-size: 12px; }
.fl-add { display: flex; gap: 6px; padding: 12px 14px; }
.fl-add .field { height: 36px; min-width: 0; }
.fl-scroll { flex: 1; overflow-y: auto; padding: 0 8px 12px; }
.fl-h { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--faint); margin: 14px 8px 6px; }
.fl-empty { color: var(--faint); font-size: 13px; padding: 8px; }
.fl-req { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; }
.fl-req b { flex: 1; min-width: 0; font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; }
.fl-req.muted b { color: var(--muted); font-weight: 500; }
.fl-req small { color: var(--faint); font-size: 12px; }
.btn.sm { height: 30px; padding: 0 12px; font-size: 12.5px; }
.fl-friend { width: 100%; display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 12px; text-align: left; transition: background .12s; }
.fl-friend:hover { background: var(--panel-2); }
.fl-friend.active { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.fl-fmain { flex: 1; min-width: 0; }
.fl-fmain b { display: block; font-weight: 600; font-size: 14px; }
.fl-fmain small { display: block; color: var(--faint); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fl-fmain em, #fl-sub em { color: var(--accent); font-style: normal; }
.fl-fmain b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fl-fmain em.tag { color: var(--accent-ink); }
.fl-friend time { color: var(--faint); font-size: 11.5px; }
.unread { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 11.5px; font-weight: 700; display: grid; place-items: center; }

.fl-chat { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.fl-hello { text-align: center; max-width: 320px; }
.fl-hello svg { width: 40px; height: 40px; color: var(--accent); }
.fl-hello h2 { font: 700 20px var(--display); margin-top: 10px; }
.fl-hello p { color: var(--muted); margin-top: 6px; }
.fl-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.fl-head > div { flex: 1; min-width: 0; }
.fl-head b { display: block; font-weight: 650; }
.fl-head small { color: var(--faint); font-size: 12.5px; }
.fl-back { display: none; }
.fl-msgs { flex: 1; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 2px; }
.fl-day { align-self: center; font-size: 11.5px; color: var(--faint); margin: 14px 0 8px; padding: 3px 10px; border-radius: 999px; background: rgba(31,32,37,.7); }
.fl-older { align-self: center; margin-bottom: 8px; }
.bub-row { display: flex; margin-top: 8px; animation: msgIn .25s var(--ease); }
.bub-row.grouped { margin-top: 2px; }
.bub-row.mine { justify-content: flex-end; }
.bub { max-width: min(520px, 78%); padding: 8px 13px; border-radius: 18px; background: var(--panel-2); border: 1px solid var(--line); white-space: pre-wrap; word-wrap: break-word; font-size: 14.5px; line-height: 1.45; }
.bub-row.mine .bub { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.bub-row.pending .bub { opacity: .6; }
.seen { font-size: 11px; color: var(--faint); margin-top: 3px; }
.seen.mine { align-self: flex-end; }
.fl-compose { display: flex; align-items: flex-end; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line); }
.fl-compose textarea { flex: 1; resize: none; min-height: 40px; max-height: 140px; padding: 10px 14px; border-radius: 20px; background: var(--panel); border: 1px solid var(--line-2); outline: 0; font-size: 14.5px; line-height: 1.4; }
.fl-compose textarea:focus { border-color: color-mix(in srgb, var(--accent) 50%, var(--line-2)); }
.fl-compose .send { width: 40px; height: 40px; border-radius: 50%; }

/* ── Background picker ─────────────────────────────── */
.bg-picker { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 10px 0 16px; }
.bg-opt { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); text-align: center; }
.bg-prev { display: block; aspect-ratio: 1; border-radius: 10px; border: 2px solid var(--line); background-color: #0f1012; transition: border-color .15s, transform .15s; }
.bg-opt:hover .bg-prev { transform: translateY(-2px); }
.bg-opt[aria-pressed="true"] { color: var(--text); }
.bg-opt[aria-pressed="true"] .bg-prev { border-color: var(--accent); box-shadow: 0 0 16px -4px var(--accent); }
.bg-prev-rings { background: radial-gradient(circle at 85% 95%, color-mix(in srgb, var(--accent) 70%, #fff) 0 14%, transparent 15%), repeating-radial-gradient(ellipse 80% 40% at 85% 95%, transparent 0 6px, color-mix(in srgb, var(--accent) 35%, transparent) 7px 8px), #0f1012; }
.bg-prev-warp { background: repeating-conic-gradient(from 0deg at 50% 50%, transparent 0 7deg, color-mix(in srgb, var(--accent) 50%, transparent) 7.5deg 8deg), radial-gradient(circle, #0f1012 0 18%, transparent 60%), #0f1012; }
.bg-prev-waves { background: repeating-linear-gradient(170deg, transparent 0 5px, color-mix(in srgb, var(--accent) 40%, transparent) 6px 7px), #0f1012; }
.bg-prev-nebula { background: radial-gradient(circle at 30% 35%, color-mix(in srgb, var(--accent) 60%, transparent), transparent 55%), radial-gradient(circle at 75% 70%, rgba(255,120,190,.35), transparent 50%), #0f1012; }
.bg-prev-none { background: radial-gradient(1px 1px at 20% 30%, #fff, transparent), radial-gradient(1px 1px at 70% 60%, #fff, transparent), radial-gradient(1px 1px at 40% 80%, #fff, transparent), #0f1012; }

/* ── Desktop mode ─────────────────────────────────── */
.taskbar, .startmenu, .win-bar, .desk { display: none; }
html.desktop .rail { display: none; }
html.desktop .app { grid-template-columns: 1fr; height: calc(100dvh - 52px); }
html.desktop .taskbar {
  display: flex; align-items: center; gap: 4px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 90; height: 52px; padding: 0 8px;
  background: rgba(18,19,23,.92); border-top: 1px solid var(--line-2);
}
.tb-start, .tb-app { position: relative; width: 44px; height: 40px; border-radius: 10px; display: grid; place-items: center; color: var(--muted); transition: background .12s, color .12s; }
.tb-start .mark { width: 28px; height: 28px; transition: transform .5s var(--ease); }
.tb-start:hover .mark, .tb-start.active .mark { transform: rotate(-20deg) scale(1.08); }
.tb-app svg { width: 21px; height: 21px; }
.tb-start:hover, .tb-app:hover, .tb-start.active { background: var(--panel-2); color: var(--text); }
.tb-app.active { color: var(--text); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.tb-app.active::after { content: ""; position: absolute; bottom: 2px; left: 14px; right: 14px; height: 3px; border-radius: 3px; background: var(--accent); }
.tb-app .badge { position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; line-height: 16px; font-size: 10px; padding: 0 4px; }
.tb-sep { width: 1px; height: 26px; background: var(--line-2); margin: 0 6px; }
.tb-running { flex: 1; min-width: 0; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tb-run { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; max-width: 190px; border-radius: 9px; color: var(--muted); font-size: 12.5px; flex-shrink: 0; border-bottom: 2px solid transparent; }
.tb-run:hover { background: var(--panel-2); color: var(--text); }
.tb-run.active { background: var(--panel-2); color: var(--text); border-bottom-color: var(--accent); }
.tb-run img, .tb-run svg { width: 16px; height: 16px; border-radius: 3px; flex-shrink: 0; }
.tb-run span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-tray { display: flex; align-items: center; gap: 10px; padding-left: 8px; }
.tb-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.tb-dot.on { background: #34d399; box-shadow: 0 0 8px #34d399; }
.tb-clock { display: flex; flex-direction: column; align-items: flex-end; padding: 4px 8px; border-radius: 8px; line-height: 1.25; }
.tb-clock:hover { background: var(--panel-2); }
.tb-clock b { font-size: 12.5px; font-weight: 600; }
.tb-clock small { font-size: 11px; color: var(--muted); }

html.desktop .startmenu:not([hidden]) {
  display: flex; flex-direction: column; position: fixed; left: 8px; bottom: 60px; z-index: 95; width: min(560px, calc(100vw - 16px)); max-height: min(640px, calc(100dvh - 76px));
  border-radius: 16px; background: rgba(22,23,27,.98); border: 1px solid var(--line-2); box-shadow: 0 30px 80px -20px rgba(0,0,0,.9); overflow: hidden;
}
.startmenu.enter { animation: startIn .22s var(--ease); transform-origin: bottom left; }
@keyframes startIn { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.sm-search { display: flex; align-items: center; gap: 10px; margin: 16px 16px 6px; height: 42px; padding: 0 14px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line-2); }
.sm-search:focus-within { border-color: var(--accent); }
.sm-search svg { width: 16px; height: 16px; color: var(--faint); }
.sm-search input { flex: 1; background: none; border: 0; outline: 0; font-size: 14px; }
.sm-body { overflow-y: auto; padding: 4px 16px 16px; }
.sm-body h3 { font-size: 12px; color: var(--faint); font-weight: 600; margin: 14px 4px 8px; }
.sm-apps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.sm-apps button { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 12px 4px; border-radius: 12px; font-size: 12.5px; color: var(--muted); }
.sm-apps button:hover { background: var(--panel-2); color: var(--text); }
.sm-apps span { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 22%, #26282e), #1a1b20); border: 1px solid var(--line-2); }
.sm-apps span svg { width: 21px; height: 21px; color: var(--text); }
.sm-games { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sm-games button { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--muted); text-align: left; }
.sm-games button:hover { color: var(--text); }
.sm-cover { display: block; border-radius: 8px; }
.sm-results { overflow-y: auto; padding: 4px 10px 12px; }
.sm-results button { width: 100%; display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 10px; border-radius: 10px; text-align: left; }
.sm-results button:hover, .sm-results button:first-child { background: var(--panel-2); }
.sm-results svg { width: 17px; height: 17px; color: var(--accent); }
.sm-results span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sm-results small { color: var(--faint); font-size: 12px; }
.sm-foot { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-top: 1px solid var(--line); background: rgba(15,16,18,.6); }
.sm-foot #sm-user { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 550; }

/* Windows */
html.desktop body:not([data-view="home"]) .main {
  margin: 14px; border-radius: 14px; overflow: hidden; border: 1px solid var(--line-2);
  background: rgba(15,16,18,.96); box-shadow: 0 30px 80px -24px rgba(0,0,0,.85), 0 0 0 1px rgba(255,255,255,.02);
}
html.desktop.win-max body:not([data-view="home"]) .main { margin: 0; border-radius: 0; border-width: 0 0 1px; }
.main.win-open { animation: winIn .28s var(--ease); }
@keyframes winIn { from { opacity: 0; transform: scale(.965) translateY(10px); } }
html.desktop body:not([data-view="home"]) .win-bar { display: flex; align-items: center; height: 38px; padding: 0 4px 0 14px; background: rgba(20,21,25,.98); border-bottom: 1px solid var(--line); flex-shrink: 0; user-select: none; }
.win-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 9px; font-size: 13px; }
.win-title svg { width: 15px; height: 15px; color: var(--accent); flex-shrink: 0; }
.win-title b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.win-btn { width: 40px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); }
.win-btn svg { width: 13px; height: 13px; }
.win-btn:hover { background: var(--hover); color: var(--text); }
.win-btn.close:hover { background: #e5484d; color: #fff; }
html.desktop body:not([data-view="home"]) #slot-games::before,
html.desktop body:not([data-view="home"]) #slot-assistant::before,
html.desktop body:not([data-view="home"]) #slot-history::before { display: none; }
html.desktop .fl { margin: 0; border: 0; border-radius: 0; }
html.desktop #slot-games, html.desktop #slot-assistant, html.desktop #slot-history, html.desktop #slot-friends { background: transparent; }

/* Desktop surface (home) */
html.desktop #slot-home > .scroll, html.desktop .clock-chip { display: none; }
html.desktop #slot-home::before { display: none; }
html.desktop .desk { display: block; position: relative; z-index: 1; flex: 1; padding: 18px; }
.desk-icons { display: grid; grid-auto-flow: column; grid-template-rows: repeat(auto-fill, 100px); grid-auto-columns: 92px; gap: 6px; height: 100%; align-content: start; }
.dicon { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 4px; border-radius: 10px; border: 1px solid transparent; }
.dicon:hover { background: rgba(255,255,255,.06); }
.dicon.sel { background: color-mix(in srgb, var(--accent) 22%, transparent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.dicon-img { width: 48px; height: 48px; border-radius: 13px; display: grid; place-items: center; background: rgba(30,31,36,.9); border: 1px solid var(--line-2); box-shadow: 0 8px 18px -8px rgba(0,0,0,.8); }
.dicon-img.is-app { background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 35%, #2a2c33), #17181c); }
.dicon-img svg { width: 24px; height: 24px; color: #fff; }
.dicon-img img { width: 26px; height: 26px; border-radius: 6px; }
.dicon-label { font-size: 12px; color: #fff; text-align: center; line-height: 1.2; text-shadow: 0 1px 3px rgba(0,0,0,.9); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.desk-widget { position: absolute; top: 28px; right: 32px; text-align: right; pointer-events: none; }
.desk-widget b { display: block; font: 800 64px/1 var(--display); letter-spacing: -.04em; text-shadow: 0 4px 30px rgba(0,0,0,.6); }
.desk-widget span { display: block; font-size: 17px; color: var(--muted); margin-top: 8px; }
.desk-widget small { display: block; font-size: 12px; color: var(--faint); margin-top: 18px; }

@media (max-width: 720px) {
  .fl { grid-template-columns: 1fr; margin: 0; border-radius: 0; border: 0; }
  .fl.conv-open .fl-side { display: none; }
  .fl:not(.conv-open) .fl-chat { display: none; }
  .fl-back { display: grid; }
  .bg-picker { grid-template-columns: repeat(3, 1fr); }
  html.desktop .app { height: calc(100dvh - 56px); }
  html.desktop .taskbar { height: 56px; }
  html.desktop body:not([data-view="home"]) .main { margin: 0; border-radius: 0; border: 0; }
  .tb-run span, .tb-clock small, .desk-widget, .tb-app[data-app="movies"], .tb-app[data-app="home"] { display: none; }
  .sm-apps { grid-template-columns: repeat(4, 1fr); }
}

/* ── Chat assistant v2: saved chats + settings ─────── */
#slot-assistant { background: transparent; }
.ai { position: relative; z-index: 1; flex: 1; min-height: 0; display: grid; grid-template-columns: 260px 1fr; }
.ai-side { display: flex; flex-direction: column; gap: 10px; min-height: 0; padding: 14px 10px; background: rgba(18,19,22,.82); border-right: 1px solid var(--line); }
.ai-new { justify-content: center; display: flex; align-items: center; height: 40px; }
.ai-find { width: 100%; min-width: 0; }
.ai-list { flex: 1; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.ai-list h4 { font-size: 11.5px; font-weight: 600; color: var(--faint); margin: 12px 8px 4px; }
.ai-item { display: flex; align-items: center; gap: 2px; height: 36px; padding: 0 4px 0 10px; border-radius: 9px; cursor: pointer; color: var(--muted); font-size: 13.5px; }
.ai-item:hover { background: var(--panel-2); color: var(--text); }
.ai-item.active { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--text); }
.ai-item-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-item-b { width: 26px; height: 26px; border-radius: 6px; display: grid; place-items: center; color: var(--faint); opacity: 0; }
.ai-item:hover .ai-item-b, .ai-item.active .ai-item-b { opacity: 1; }
.ai-item-b:hover { background: var(--hover); color: var(--text); }
.ai-item-b svg { width: 13px; height: 13px; }
.ai-none { color: var(--faint); font-size: 13px; padding: 12px 8px; }
.ai-side-foot { display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 10px; border-radius: 9px; color: var(--muted); font-size: 13.5px; }
.ai-side-foot:hover { background: var(--panel-2); color: var(--text); }
.ai-side-foot svg { width: 16px; height: 16px; }
.ai-main { display: flex; flex-direction: column; min-height: 0; min-width: 0; position: relative; }
.ai-main::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse 60% 70% at 50% 40%, rgba(15,16,18,.6), transparent 80%); }
.ai-head { position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 14px; border-bottom: 1px solid var(--line); background: rgba(16,17,20,.6); }
.ai-title { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-toggle { display: none; }
.msg-actions { display: flex; gap: 4px; margin-top: 6px; opacity: 0; transition: opacity .15s; }
.msg.bot:hover .msg-actions, .msg.bot:last-child .msg-actions { opacity: 1; }
.msg-actions button { display: flex; align-items: center; gap: 5px; height: 26px; padding: 0 8px; border-radius: 7px; font-size: 12px; color: var(--faint); }
.msg-actions button:hover { background: var(--panel-2); color: var(--text); }
.msg-actions svg { width: 13px; height: 13px; }
.msg.bot { flex-direction: column; align-items: flex-start; }
.msg.bot .bubble { white-space: normal; }
.bubble p { margin: 0 0 .6em; }
.bubble p:last-child { margin-bottom: 0; }
.bubble p.h { font-weight: 700; margin-top: .8em; }
.bubble ul, .bubble ol { margin: .2em 0 .7em 1.3em; }
.bubble li { margin: .2em 0; }
.send.stop { background: var(--text); color: var(--bg); }

.ai-settings {
  position: absolute; top: 0; right: 0; bottom: 0; z-index: 5; width: min(360px, 100%); padding: 18px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 18px; background: rgba(20,21,24,.98); border-left: 1px solid var(--line-2);
  box-shadow: -20px 0 60px -20px rgba(0,0,0,.8);
}
.ai-settings.enter { animation: slideIn .25s var(--ease); }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } }
.ai-set-head { display: flex; align-items: center; justify-content: space-between; }
.ai-set-head h2 { font: 700 18px var(--display); }
.ai-settings .lbl input[type=range] { accent-color: var(--accent); width: 100%; }
.ai-range-ends { display: flex; justify-content: space-between; }
.ai-range-ends small { color: var(--faint); font-size: 11.5px; }
.seg3 { grid-template-columns: repeat(3, 1fr); }
.ai-set-foot { margin-top: auto; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }

@media (max-width: 720px) {
  .ai { grid-template-columns: 1fr; }
  .ai-side { position: absolute; top: 0; bottom: 0; left: 0; z-index: 6; width: min(300px, 85%); transform: translateX(-102%); transition: transform .25s var(--ease); background: rgba(18,19,22,.98); }
  .ai.side-open .ai-side { transform: none; box-shadow: 20px 0 60px -10px rgba(0,0,0,.8); }
  .ai-toggle { display: grid; }
}

/* ── Admin ─────────────────────────────────────────── */
.admin-only { display: none !important; }
html.is-admin .admin-only { display: flex !important; }
html.is-admin .sm-apps .admin-only { display: flex !important; }
#slot-admin { background: transparent; }
.tag { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; font: 700 10.5px/16px var(--sans); font-style: normal; vertical-align: 1px; color: var(--accent-ink); background: var(--accent); }
.tag.bad { background: var(--danger); color: #1a0606; }
.tag.ok { background: #6ee7b7; color: #062016; }
.adm-tabs { grid-template-columns: repeat(4, 1fr); max-width: 520px; margin-bottom: 20px; }
.adm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.adm-card { padding: 16px; border-radius: 14px; background: rgba(24,25,29,.85); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.adm-card small { color: var(--faint); font-size: 12px; font-weight: 600; }
.adm-card b { font: 800 28px var(--display); letter-spacing: -.02em; }
.adm-card span { color: var(--muted); font-size: 12.5px; }
.adm-ai { display: flex; gap: 12px; align-items: flex-start; margin-top: 12px; padding: 14px 16px; border-radius: 14px; background: rgba(24,25,29,.85); border: 1px solid var(--line); }
.adm-ai i { width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; background: var(--danger); }
.adm-ai.ok i { background: #34d399; box-shadow: 0 0 8px #34d399; }
.adm-ai b { display: block; }
.adm-ai span { color: var(--muted); font-size: 13px; }
.adm-note { margin-top: 12px; color: var(--muted); font-size: 13px; }
.adm-table { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.adm-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: rgba(24,25,29,.85); border: 1px solid var(--line); }
.adm-row.done { opacity: .6; }
.adm-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.adm-main b { font-weight: 600; }
.adm-main small { color: var(--faint); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-main a { color: var(--accent); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-votes { width: 48px; display: flex; flex-direction: column; align-items: center; flex-shrink: 0; }
.adm-votes b { font: 800 18px var(--display); }
.adm-votes small { color: var(--faint); font-size: 11px; }
.adm-ann { display: flex; flex-direction: column; gap: 12px; max-width: 560px; }
.adm-ann textarea.field { flex: none; }
.adm-ann .seg { max-width: 360px; }

.announce {
  display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; font-size: 13.5px; font-weight: 550; flex-shrink: 0;
  background: color-mix(in srgb, var(--accent) 18%, #15161a); border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
}
.announce[hidden] { display: none; }
.announce.enter { animation: fade .35s var(--ease); }
.announce > svg { width: 15px; height: 15px; color: var(--accent); flex-shrink: 0; }
.announce span { flex: 1; min-width: 0; }
.announce .icon-btn { width: 28px; height: 28px; }
.announce[data-tone="warn"] { background: #3a2a10; border-color: #6b4c16; }
.announce[data-tone="warn"] > svg { color: #f6b44a; }
.announce[data-tone="party"] { background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 30%, #15161a), color-mix(in srgb, #ff8fa3 25%, #15161a)); }
@media (max-width: 720px) { .adm-row { flex-wrap: wrap; } .adm-tabs { grid-template-columns: repeat(2, 1fr); } }

/* ── In-site dialogs (ui.js) ───────────────────────── */
.dlg-scrim { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 16px; background: rgba(5,5,8,.62); animation: fadeIn .15s; }
.dlg-scrim.out { opacity: 0; transition: opacity .15s; }
.dlg {
  width: min(420px, 100%); padding: 22px; border-radius: 18px; display: flex; flex-direction: column; gap: 12px;
  background: var(--bg-2); border: 1px solid var(--line-2);
  box-shadow: 0 30px 80px -20px rgba(0,0,0,.9), 0 0 60px -30px var(--accent);
  animation: modalIn .22s var(--ease);
}
.dlg.danger { box-shadow: 0 30px 80px -20px rgba(0,0,0,.9), 0 0 60px -30px var(--danger); }
.dlg h2 { font: 700 19px var(--display); letter-spacing: -.01em; }
.dlg p { color: var(--muted); font-size: 14px; line-height: 1.5; }
.dlg .field { flex: none; height: 42px; font-size: 15px; }
.dlg-copy { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 14px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line-2); }
.dlg-copy code { flex: 1; font: 600 17px var(--mono); letter-spacing: .04em; color: var(--text); user-select: all; word-break: break-all; }
.dlg-err { color: var(--danger) !important; min-height: 1em; font-size: 13px !important; margin: -4px 0; }
.dlg-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.dlg-btns .btn { height: 38px; padding: 0 16px; }

.tag.warn { background: #f6b44a; color: #2a1a02; }
.adm-h { font-size: 13px; color: var(--muted); font-weight: 600; margin: 20px 0 4px; }

/* ── Duels ─────────────────────────────────────── */
.duel-btn { display: inline-flex; align-items: center; gap: 6px; }
.duel-btn svg { width: 15px; height: 15px; }
.menu .menu-h { height: 28px; font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
#duel-invites { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.duel-invite {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; width: min(380px, calc(100vw - 32px));
  background: rgba(24,25,29,.98); border: 1px solid var(--line-2); border-radius: 14px;
  box-shadow: 0 20px 50px -12px rgba(0,0,0,.8), 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
  animation: di-in .3s var(--ease) both;
}
.duel-invite.out { animation: di-out .25s var(--ease) both; }
.duel-invite .di-main { flex: 1; min-width: 0; }
.duel-invite b { display: block; font-weight: 650; }
.duel-invite small { color: var(--muted); font-size: 12.5px; }
@keyframes di-in { from { opacity: 0; transform: translateY(16px) scale(.97); } }
@keyframes di-out { to { opacity: 0; transform: translateX(30px); } }

/* ── Desktop apps in their own windows (apps.js) ─────────────────── */
#fwins { position: fixed; inset: 0 0 52px 0; z-index: 80; pointer-events: none; }
html:not(.desktop) #fwins { inset: 0; }
html:not(.desktop) .fw-btn[data-fw="min"] { display: none; } /* no taskbar to minimize to */
.fwin {
  position: absolute; display: flex; flex-direction: column; pointer-events: auto; overflow: hidden;
  background: #111215; border: 1px solid var(--line-2); border-radius: 12px;
  box-shadow: 0 24px 60px -18px rgba(0,0,0,.85), 0 0 0 1px rgba(255,255,255,.02);
}
.fwin:not(.active) { box-shadow: 0 14px 34px -16px rgba(0,0,0,.7); }
.fwin:not(.active) .fw-bar { background: rgba(22,23,27,.95); }
.fwin:not(.active) .fw-title { opacity: .65; }
.fwin.max { left: 0 !important; top: 0 !important; width: 100% !important; height: 100% !important; border-radius: 0; border-width: 0 0 1px; }
.fwin.dragging { user-select: none; }
.fwin.dragging iframe, .fwin.dragging canvas { pointer-events: none; }
.fwin.fw-in { animation: fwIn .2s var(--ease); }
.fwin.fw-out { animation: fwOut .14s ease-in forwards; }
.fwin.fw-nudge { animation: fwNudge .3s var(--ease); }
@keyframes fwIn { from { opacity: 0; transform: scale(.94) translateY(10px); } }
@keyframes fwOut { to { opacity: 0; transform: scale(.95); } }
@keyframes fwNudge { 40% { transform: scale(1.015); } }
.fw-bar { display: flex; align-items: center; height: 36px; padding: 0 3px 0 10px; flex-shrink: 0; background: rgba(28,29,34,.98); border-bottom: 1px solid var(--line); cursor: default; user-select: none; touch-action: none; }
.fw-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.fw-title b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fw-ico { width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; background: var(--tint); flex-shrink: 0; }
.fw-ico svg { width: 13px; height: 13px; color: #fff; }
.fw-btn { width: 36px; height: 28px; border-radius: 7px; display: grid; place-items: center; color: var(--muted); }
.fw-btn svg { width: 12px; height: 12px; }
.fw-btn:hover { background: var(--hover); color: var(--text); }
.fw-btn.close:hover { background: #e5484d; color: #fff; }
.fw-body { flex: 1; min-height: 0; position: relative; display: flex; }
.fw-grip { position: absolute; right: 0; bottom: 0; width: 16px; height: 16px; cursor: nwse-resize; touch-action: none;
  background: linear-gradient(135deg, transparent 50%, var(--line-2) 50%, var(--line-2) 58%, transparent 58%, transparent 70%, var(--line-2) 70%, var(--line-2) 78%, transparent 78%); }
.fwin.max .fw-grip { display: none; }
.tb-run.min { opacity: .6; }
.dicon-img.is-app[style*="--tint"] { background: linear-gradient(160deg, var(--tint), color-mix(in srgb, var(--tint) 45%, #111)); border-color: color-mix(in srgb, var(--tint) 55%, #000); }
.sm-apps span.tinted { background: linear-gradient(160deg, var(--tint), color-mix(in srgb, var(--tint) 45%, #111)); border-color: color-mix(in srgb, var(--tint) 55%, #000); }
.sm-apps span.tinted svg { color: #fff; }
.dicon.launch .dicon-img { animation: launch .3s var(--ease); }
@keyframes launch { 40% { transform: scale(.86); } }
.fw-body .grow { flex: 1; }

/* Calculator */
.ap-calc { flex-direction: column; padding: 12px; gap: 10px; }
.calc-screen { display: flex; flex-direction: column; align-items: flex-end; justify-content: flex-end; min-height: 92px; padding: 10px 12px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); overflow: hidden; }
.calc-expr { min-height: 18px; font-size: 13px; color: var(--faint); font-variant-numeric: tabular-nums; }
.calc-out { font: 600 42px/1.15 var(--sans); font-variant-numeric: tabular-nums; letter-spacing: -.02em; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calc-keys { flex: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.calc-keys button { border-radius: 10px; background: var(--panel-2); font-size: 19px; font-weight: 500; transition: background .1s, transform .08s; }
.calc-keys button:hover { background: var(--hover); }
.calc-keys .fn { color: var(--muted); background: rgba(255,255,255,.035); }
.calc-keys .op { color: var(--accent); font-size: 22px; }
.calc-keys .op.lit { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.calc-keys .eq { background: var(--accent); color: var(--accent-ink); }
.calc-keys .eq:hover { background: var(--accent); filter: brightness(1.08); }
.calc-keys button.tap { animation: tap .14s; }
@keyframes tap { 50% { transform: scale(.94); } }

/* Notes */
.nt-side { width: 190px; flex-shrink: 0; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: rgba(12,13,15,.5); }
.nt-tools { padding: 8px; border-bottom: 1px solid var(--line); }
.nt-tools .btn { width: 100%; display: flex; align-items: center; justify-content: center; gap: 6px; }
.nt-tools svg { width: 14px; height: 14px; }
.nt-list { flex: 1; overflow-y: auto; padding: 4px; }
.nt-item { width: 100%; text-align: left; padding: 8px 10px; border-radius: 8px; display: flex; flex-direction: column; gap: 2px; }
.nt-item:hover { background: var(--panel-2); }
.nt-item.on { background: color-mix(in srgb, #facc15 14%, transparent); }
.nt-item b { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nt-item small { font-size: 11.5px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nt-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.nt-text { flex: 1; resize: none; border: 0; outline: 0; padding: 16px 18px; background: transparent; color: var(--text); font: 14.5px/1.6 var(--sans); }
.nt-foot { display: flex; align-items: center; gap: 14px; padding: 6px 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--faint); }
.link-btn.danger { color: var(--danger); }

/* Paint */
.ap-paint { flex-direction: column; }
.pt-tools { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.pt-group { display: flex; gap: 2px; padding: 2px; border-radius: 9px; background: var(--bg); border: 1px solid var(--line); }
.pt-tool, .pt-size { width: 30px; height: 28px; border-radius: 7px; display: grid; place-items: center; font-size: 15px; color: var(--muted); }
.pt-tool:hover, .pt-size:hover { background: var(--panel-2); color: var(--text); }
.pt-tool.on, .pt-size.on { background: var(--hover); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.pt-size i { display: block; border-radius: 50%; background: currentColor; }
.pt-colors { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.pt-color { width: 20px; height: 20px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(255,255,255,.25); }
.pt-color.on { outline: 2px solid var(--text); outline-offset: 2px; }
.pt-custom { width: 22px; height: 22px; border-radius: 50%; overflow: hidden; background: conic-gradient(#f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00); cursor: pointer; position: relative; }
.pt-custom input { position: absolute; inset: -6px; opacity: 0; cursor: pointer; }
.pt-stage { flex: 1; min-height: 0; background: #e9e9ec; overflow: hidden; }
.pt-stage canvas { display: block; cursor: crosshair; touch-action: none; }

/* Clock */
.ap-clock { flex-direction: column; align-items: center; padding: 14px; gap: 14px; overflow-y: auto; }
.ck-tabs { align-self: stretch; display: flex; }
.ck-tabs button { flex: 1; }
.ck-pane { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.ck-face { width: 150px; height: 150px; }
.ck-face .rim { fill: var(--bg); stroke: var(--line-2); stroke-width: 3; }
.ck-face .tick { stroke: var(--faint); stroke-width: 2; stroke-linecap: round; }
.ck-face .tick.big { stroke: var(--text); stroke-width: 3; }
.ck-face .hh { stroke: var(--text); stroke-width: 6; stroke-linecap: round; }
.ck-face .mh { stroke: var(--text); stroke-width: 4; stroke-linecap: round; }
.ck-face .sh { stroke: #38bdf8; stroke-width: 2; stroke-linecap: round; }
.ck-face .pin { fill: #38bdf8; }
.ck-time { font: 700 30px var(--sans); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.ck-date { color: var(--muted); font-size: 13px; margin-top: -8px; }
.ck-zones { width: 100%; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.ck-zones div { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); }
.ck-zones small { font-size: 11px; color: var(--faint); }
.ck-zones b { font-size: 14px; font-variant-numeric: tabular-nums; }
.ck-big { font: 700 52px/1.1 var(--sans); font-variant-numeric: tabular-nums; letter-spacing: -.03em; margin: 16px 0 6px; }
.ck-big.ring { color: #38bdf8; animation: ring .5s ease-in-out 6; }
@keyframes ring { 50% { transform: scale(1.06); } }
.ck-btns { display: flex; gap: 8px; }
.ck-btns .btn { min-width: 84px; justify-content: center; }
.ck-laps { width: 100%; list-style: none; max-height: 150px; overflow-y: auto; font-size: 13px; }
.ck-laps li { display: grid; grid-template-columns: 1fr auto auto; gap: 14px; padding: 6px 4px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.ck-laps small { color: var(--faint); }
.ck-presets { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.ck-custom { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.ck-custom .field { width: 70px; height: 34px; text-align: center; }

/* Calendar */
.cal-main { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 12px; }
.cal-head { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.cal-title { font: 600 18px var(--sans); }
.cal-head .icon-btn { font-size: 20px; }
.cal-dow { display: grid; grid-template-columns: repeat(7, 1fr); font-size: 11.5px; color: var(--faint); text-align: center; margin-bottom: 4px; }
.cal-grid { flex: 1; display: grid; grid-template-columns: repeat(7, 1fr); grid-template-rows: repeat(6, 1fr); gap: 3px; }
.cal-cell { position: relative; border-radius: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.cal-cell:hover { background: var(--panel-2); }
.cal-cell.out { color: var(--faint); opacity: .55; }
.cal-cell.today span { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: #ef4444; color: #fff; font-weight: 700; }
.cal-cell.sel { box-shadow: inset 0 0 0 1.5px var(--line-2); background: var(--panel); }
.cal-cell i { position: absolute; bottom: 2px; font-style: normal; font-size: 13px; line-height: 1; color: #ef4444; letter-spacing: -1px; }
.cal-side { width: 220px; flex-shrink: 0; display: flex; flex-direction: column; gap: 10px; padding: 14px 12px; border-left: 1px solid var(--line); background: rgba(12,13,15,.5); }
.cal-day { font-size: 14px; font-weight: 600; }
.cal-events { flex: 1; overflow-y: auto; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.cal-events li { display: flex; align-items: center; gap: 6px; padding: 6px 4px 6px 10px; border-radius: 8px; background: var(--panel); border-left: 3px solid #ef4444; font-size: 13px; }
.cal-events li span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.cal-events li.none { background: none; border: 0; color: var(--faint); padding-left: 0; }
.cal-events .icon-btn { width: 24px; height: 24px; }
.cal-events .icon-btn svg { width: 12px; height: 12px; }
.cal-add { display: flex; flex-direction: column; gap: 6px; }
.cal-add .field { height: 34px; font-size: 13px; }

/* Mines */
.ap-mines { flex-direction: column; align-items: center; gap: 10px; padding: 12px; overflow: auto; }
.mn-head { display: flex; align-items: center; justify-content: space-between; align-self: stretch; padding: 6px 8px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); }
.mn-head output { font: 700 22px var(--mono); color: #ff5a4a; background: #120c0c; padding: 1px 8px; border-radius: 6px; letter-spacing: .05em; }
.mn-face { font-size: 24px; width: 40px; height: 36px; border-radius: 8px; background: var(--panel-2); }
.mn-face:hover { background: var(--hover); }
.mn-levels button { padding: 4px 12px; font-size: 12.5px; }
.mn-board { display: grid; gap: 0; border: 2px solid var(--line-2); border-radius: 4px; overflow: hidden; }
.mn-cell { width: 26px; height: 26px; background: #3a3d45; border: 1px solid; border-color: #4e525c #24262b #24262b #4e525c; font: 700 14px var(--sans); display: grid; place-items: center; color: #ffd166; }
.mn-cell:hover:not(.open) { background: #444852; }
.mn-cell.open { background: #22242a; border-color: #2b2d33; }
.mn-cell[data-n="1"] { color: #60a5fa; } .mn-cell[data-n="2"] { color: #4ade80; } .mn-cell[data-n="3"] { color: #f87171; }
.mn-cell[data-n="4"] { color: #a78bfa; } .mn-cell[data-n="5"] { color: #fb923c; } .mn-cell[data-n="6"] { color: #2dd4bf; }
.mn-cell[data-n="7"] { color: #f472b6; } .mn-cell[data-n="8"] { color: #e5e7eb; }
.mn-cell.boom { color: #fff; }
.mn-cell.hit { background: #b42318 !important; }
.mn-cell.wrong { background: #5b2b2b; }
.mn-hint { font-size: 12px; color: var(--faint); }

/* Terminal */
.ap-term { flex-direction: column; background: #0b0c0e; font: 13.5px/1.5 var(--mono); color: #d4d4d8; cursor: text; }
.tm-out { flex: 1; overflow-y: auto; padding: 10px 12px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.tm-row.dim { color: #8b8d94; }
.tm-row.err { color: #f87171; }
.tm-row .k, .tm-out .k { color: #4ade80; }
.tm-ps { color: #4ade80; }
.tm-line { display: flex; gap: 8px; padding: 2px 12px 12px; }
.tm-line input { flex: 1; background: none; border: 0; outline: 0; color: inherit; font: inherit; caret-color: #4ade80; }

/* Task Manager */
.ap-tasks { flex-direction: column; }
.tk-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 12px; border-bottom: 1px solid var(--line); }
.tk-stats div { padding: 8px 10px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); }
.tk-stats small { display: block; font-size: 11px; color: var(--faint); }
.tk-stats b { font-size: 18px; font-variant-numeric: tabular-nums; }
.tk-head, .tk-row { display: grid; grid-template-columns: 1fr 130px 92px; align-items: center; gap: 10px; padding: 0 12px; }
.tk-head { height: 30px; font-size: 11.5px; color: var(--faint); border-bottom: 1px solid var(--line); }
.tk-list { flex: 1; overflow-y: auto; }
.tk-row { min-height: 42px; font-size: 13px; border-bottom: 1px solid var(--line); color: var(--muted); }
.tk-row:hover { background: rgba(255,255,255,.025); }
.tk-name { display: flex; align-items: center; gap: 9px; min-width: 0; color: var(--text); }
.tk-name b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-name img, .tk-name svg { width: 16px; height: 16px; flex-shrink: 0; border-radius: 3px; }
.tk-empty { padding: 20px; text-align: center; color: var(--faint); font-size: 13px; }
@media (max-width: 700px) { .nt-side, .cal-side { width: 150px; } .ck-zones { grid-template-columns: repeat(2, 1fr); } }
.mn-levels, .ck-tabs { display: grid; grid-template-columns: repeat(3, 1fr); }

/* ── Snip & solve (snip.js) ─────────────────────────────────────── */
#snip-layer { position: fixed; z-index: 140; cursor: crosshair; background: rgba(8,8,12,.38); touch-action: none; user-select: none; }
#snip-layer.enter { animation: fadeIn .15s; }
.snip-hint { position: absolute; left: 50%; top: 18px; transform: translateX(-50%); display: flex; align-items: center; gap: 9px; padding: 8px 14px; border-radius: 999px;
  background: rgba(18,19,23,.95); border: 1px solid var(--line-2); font-size: 13px; white-space: nowrap; pointer-events: none; box-shadow: 0 10px 30px -10px rgba(0,0,0,.8); }
.snip-hint svg { width: 16px; height: 16px; color: var(--accent); }
.snip-hint kbd { font: 11px var(--mono); color: var(--muted); border: 1px solid var(--line-2); border-radius: 5px; padding: 1px 5px; margin-left: 4px; }
#snip-layer.dragging .snip-hint { opacity: 0; transition: opacity .15s; }
.snip-box { position: absolute; border: 2px solid var(--accent); border-radius: 4px; background: rgba(255,255,255,.04);
  box-shadow: 0 0 0 9999px rgba(8,8,12,.35); pointer-events: none; }
.snip-box::after { content: attr(data-size); position: absolute; right: 0; bottom: -24px; font: 11px var(--mono); color: #fff; background: rgba(0,0,0,.7); padding: 2px 6px; border-radius: 5px; }

.snip-panel { position: fixed; z-index: 130; right: 12px; top: 108px; bottom: 12px; width: min(420px, calc(100vw - 24px)); display: flex; flex-direction: column;
  background: rgba(18,19,23,.98); border: 1px solid var(--line-2); border-radius: 16px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.9); overflow: hidden; }
html.desktop .snip-panel { bottom: 64px; top: 14px; }
.snip-panel.enter { animation: spIn .22s var(--ease); }
@keyframes spIn { from { opacity: 0; transform: translateX(16px); } }
.sp-head { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 16px; border-bottom: 1px solid var(--line); }
.sp-title { flex: 1; display: flex; align-items: center; gap: 8px; font-weight: 650; }
.sp-title svg { width: 17px; height: 17px; color: var(--accent); }
.sp-head .btn { display: inline-flex; align-items: center; gap: 6px; }
.sp-head .btn svg { width: 14px; height: 14px; }
.sp-scroll { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.sp-shot { margin: 0; border-radius: 10px; overflow: hidden; border: 1px solid var(--line-2); background: #fff; cursor: zoom-in; max-height: 160px; flex-shrink: 0; }
.sp-shot.big { max-height: none; cursor: zoom-out; }
.sp-shot img { display: block; width: 100%; height: auto; }
.sp-thread { display: flex; flex-direction: column; gap: 12px; }
.sp-msg { font-size: 14px; line-height: 1.6; }
.sp-msg p { margin: 0 0 8px; }
.sp-msg p.h { font-weight: 650; margin-top: 4px; }
.sp-msg ul, .sp-msg ol { margin: 0 0 8px; padding-left: 22px; }
.sp-msg li { margin: 2px 0; }
.sp-msg code { font: 12.5px var(--mono); background: var(--panel-2); padding: 1px 5px; border-radius: 5px; }
.sp-msg .sp-ans { padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--accent) 14%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); font-size: 15px; }
.sp-msg li.sp-ans { list-style-position: inside; margin-left: -22px; margin-bottom: 6px; }
.sp-msg .katex { font-size: 1.05em; }
.sp-msg .katex-display { margin: 6px 0 10px; overflow-x: auto; overflow-y: hidden; }
.sp-msg.streaming .sp-body > :last-child::after { content: "▍"; color: var(--accent); animation: blink 1s steps(2) infinite; margin-left: 2px; }
@keyframes blink { 50% { opacity: 0; } }
.sp-tools { display: flex; gap: 14px; margin-top: 2px; }
.sp-tools .link-btn { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted); }
.sp-tools .link-btn:hover { color: var(--text); }
.sp-tools svg { width: 13px; height: 13px; }
.sp-q { align-self: flex-end; max-width: 85%; padding: 8px 12px; border-radius: 14px 14px 4px 14px; background: var(--panel-2); font-size: 13.5px; overflow-wrap: anywhere; }
.sp-status { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13.5px; }
.sp-status .spinner { width: 18px; height: 18px; border-width: 2px; }
.sp-err { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 10px; background: rgba(229,72,77,.1); border: 1px solid rgba(229,72,77,.35); font-size: 13.5px; }
.sp-err code { font: 12.5px var(--mono); color: var(--text); background: var(--bg); padding: 6px 8px; border-radius: 6px; user-select: all; }
.sp-dim { color: var(--faint); }
.sp-ask { display: flex; gap: 8px; padding: 10px 12px 4px; border-top: 1px solid var(--line); }
.sp-ask .field { flex: 1; height: 38px; font-size: 13.5px; }
.sp-ask .btn { width: 40px; justify-content: center; }
.sp-ask .btn svg { width: 16px; height: 16px; }
.sp-fine { font-size: 11.5px; color: var(--faint); padding: 2px 14px 10px; }

/* ── Tools menu (tools.js) ─────────────────────────── */
.tools-pop {
  position: fixed; z-index: 150; width: 300px; padding: 12px; border-radius: 16px;
  background: rgba(22,23,27,.96); border: 1px solid var(--line-2); backdrop-filter: blur(14px);
  box-shadow: 0 24px 60px -18px rgba(0,0,0,.85);
}
.tools-pop.enter { animation: tpIn .2s var(--ease); }
@keyframes tpIn { from { opacity: 0; transform: translateX(-6px) scale(.98); } }
.tp-head { display: flex; flex-direction: column; gap: 1px; padding: 2px 4px 10px; }
.tp-head b { font: 700 14px var(--display); letter-spacing: -.01em; }
.tp-head span { font-size: 12px; color: var(--faint); }
.tp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.tp-item { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 12px 4px 10px; border-radius: 12px; transition: background .15s; }
.tp-item:hover { background: var(--hover); }
.tp-item:active { transform: scale(.96); }
.tp-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--tint);
  background: color-mix(in srgb, var(--tint) 16%, transparent); border: 1px solid color-mix(in srgb, var(--tint) 28%, transparent); transition: transform .2s var(--ease); }
.tp-item:hover .tp-ico { transform: translateY(-2px); }
.tp-ico svg { width: 21px; height: 21px; }
.tp-name { font-size: 12px; color: var(--muted); text-align: center; line-height: 1.2; }
.tp-item:hover .tp-name { color: var(--text); }
.rail-btn[aria-expanded="true"] { background: var(--panel-2); color: var(--text); }

/* ── What's new (tools.js) ─────────────────────────── */
.whatsnew {
  display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 12px; padding: 9px 12px 9px 10px; text-align: left;
  border-radius: 12px; background: rgba(24,25,29,.6); border: 1px solid var(--line); color: var(--muted);
  transition: background .15s, border-color .15s; animation: fade .8s .3s var(--ease) both;
}
.whatsnew:hover { background: rgba(32,33,38,.8); border-color: var(--line-2); }
.wn-tag { flex: none; font: 700 10.5px var(--sans); text-transform: uppercase; letter-spacing: .08em; padding: 3px 8px; border-radius: 999px; background: var(--hover); color: var(--muted); }
.whatsnew.fresh .wn-tag { background: var(--accent); color: var(--accent-ink); box-shadow: 0 0 14px -2px color-mix(in srgb, var(--accent) 70%, transparent); }
.wn-text { flex: 1; min-width: 0; display: flex; gap: 8px; align-items: baseline; font-size: 13px; white-space: nowrap; overflow: hidden; }
.wn-text b { color: var(--text); font-weight: 600; flex: none; }
.wn-text span { overflow: hidden; text-overflow: ellipsis; color: var(--faint); }
.wn-more { flex: none; display: flex; align-items: center; gap: 2px; font-size: 12.5px; color: var(--accent); }
.wn-more svg { width: 14px; height: 14px; }
@media (max-width: 720px) { .wn-text span, .wn-more { display: none; } }
.wn-modal { width: min(560px, 100%); max-height: min(640px, calc(100dvh - 32px)); }
.wn-list { overflow-y: auto; margin: 0 -6px; padding: 0 6px; display: flex; flex-direction: column; }
.wn-rel { display: grid; grid-template-columns: 74px 1fr; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); }
.wn-rel:first-child { border-top: 0; padding-top: 4px; }
.wn-date b { display: block; font-size: 13px; color: var(--text); }
.wn-date small { font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }
.wn-rel.latest .wn-date b { color: var(--accent); }
.wn-rel h3 { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.wn-rel ul { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.wn-rel li { position: relative; padding-left: 14px; font-size: 13px; color: var(--muted); line-height: 1.45; }
.wn-rel li::before { content: ''; position: absolute; left: 2px; top: .62em; width: 5px; height: 5px; border-radius: 50%; background: var(--line-2); }
.wn-rel.latest li::before { background: var(--accent); }

/* ── Friends → People (social.js) ─────────────────── */
.fl-tabs { margin: 12px 14px 0; }
.fl-tabs button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.fl-tabs .count { padding: 0 6px; font-size: 11px; }
.fl-on { margin-left: auto; font-weight: 500; color: #34d399; }
.fl-person { cursor: pointer; }
.fl-person .btn.sm { flex-shrink: 0; }
.fl-you { font-size: 12px; color: var(--faint); padding: 0 6px; }
.fl-vis { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); cursor: pointer; }
.fl-vis span { flex: 1; min-width: 0; }
.fl-vis b { display: block; font-size: 13px; font-weight: 600; }
.fl-vis small { display: block; font-size: 11.5px; color: var(--faint); }
.fl-vis input { position: absolute; opacity: 0; pointer-events: none; }
.fl-vis .sw { width: 38px; height: 22px; border-radius: 999px; background: var(--line-2); position: relative; flex-shrink: 0; transition: background .18s; }
.fl-vis .sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .18s var(--ease); }
.fl-vis input:checked + .sw { background: var(--accent); }
.fl-vis input:checked + .sw::after { transform: translateX(16px); }
.fl-vis input:focus-visible + .sw { outline: 2px solid var(--accent); outline-offset: 2px; }
.fl-profile { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; max-width: 360px; animation: fade .3s var(--ease) both; }
.fl-profile .av-wrap .dot { width: 18px; height: 18px; right: 2px; bottom: 2px; border-width: 3px; }
.fl-profile h2 { font: 700 24px var(--display); letter-spacing: -.02em; margin-top: 10px; display: flex; align-items: center; gap: 8px; }
.fl-pmeta { color: var(--faint); font-size: 13px; }
.fl-pmeta .on { color: #34d399; }
.fl-pacts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }
