@font-face { font-family: DaemonDisplay; src: url(/fonts/heading.ttf) format("truetype"); font-display: swap; }
:root {
  --bg: #07070b; --panel: rgba(12, 12, 18, 0.94); --line: #23232f; --ink: #ecebf2; --dim: #a3a1b3;
  --lime: #c3ff5c; --lav: #b9a3ff; --coral: #ff7a6b;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
  --tab-h: calc(58px + var(--safe-b));
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --display: DaemonDisplay, Impact, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); font: 14px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; overscroll-behavior: none; }
canvas#world { position: fixed; inset: 0; width: 100vw; height: 100dvh; display: block; touch-action: none; cursor: grab; image-rendering: pixelated; }
canvas#world.dragging { cursor: grabbing; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
a { color: var(--lime); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---- top: brand and clock, floating over the world ---- */
.top { position: fixed; top: 0; left: 0; right: 0; padding: calc(8px + var(--safe-t)) calc(12px + var(--safe-r)) 18px calc(12px + var(--safe-l));
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; pointer-events: none;
  background: linear-gradient(rgba(7,7,11,.85), rgba(7,7,11,0)); }
.brand { display: flex; flex-direction: column; line-height: 1; }
.brand .word { font: 700 12px var(--mono); letter-spacing: .22em; color: var(--lime); }
.brand .sub { font: 22px/1 var(--display); letter-spacing: .03em; text-transform: uppercase; margin-top: 3px; }
.clock { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; font: 12px var(--mono); color: var(--dim); text-align: right; text-shadow: 0 1px 2px #000; }
.clock .phase { color: var(--ink); font-weight: 600; }
.clock .tide { color: var(--lav); }

/* ---- loading ---- */
.loading { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 6px; background: var(--bg); text-align: center; padding: 24px; transition: opacity .25s var(--ease); z-index: 5; }
.loading.done { opacity: 0; pointer-events: none; }
.portal { position: relative; width: 92px; height: 92px; margin-bottom: 18px; }
.portal i { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--lime); opacity: .9; animation: ring 2.4s var(--ease) infinite; }
.portal i:nth-child(2) { inset: 16px; border-color: var(--lav); animation-delay: -.8s; }
.portal i:nth-child(3) { inset: 34px; background: radial-gradient(var(--lime), transparent 70%); border: 0; animation: glow 1.6s ease-in-out infinite; }
@keyframes ring { 0% { transform: scale(.7); opacity: 0; } 40% { opacity: .9; } 100% { transform: scale(1.15); opacity: 0; } }
@keyframes glow { 50% { opacity: .35; transform: scale(.8); } }
.lt { margin: 0; font: 26px/1.1 var(--display); text-transform: uppercase; letter-spacing: .03em; }
.ls { margin: 0; color: var(--dim); font-size: 13px; max-width: 280px; }

/* ---- first-visit hint and ticker ---- */
.hint { position: fixed; left: 50%; top: 42%; transform: translate(-50%, -50%); padding: 10px 16px; border-radius: 999px; background: rgba(7,7,11,.88); border: 1px solid #3b3452; color: var(--ink); font-size: 14px; pointer-events: none; animation: hint 3s var(--ease) forwards; white-space: nowrap; }
@keyframes hint { 0% { opacity: 0; transform: translate(-50%, -40%); } 12%, 80% { opacity: 1; transform: translate(-50%, -50%); } 100% { opacity: 0; } }
.ticker { position: fixed; left: calc(12px + var(--safe-l)); right: calc(12px + var(--safe-r)); bottom: calc(var(--tab-h) + var(--sheet-h, 120px) + 8px); font: 12px var(--mono); color: var(--dim);
  pointer-events: none; text-shadow: 0 1px 2px #000, 0 0 6px #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticker.in { animation: tick .25s var(--ease); }
@keyframes tick { from { opacity: 0; transform: translateY(4px); } }

/* ---- bottom tab bar ---- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; height: var(--tab-h); padding: 0 calc(4px + var(--safe-r)) var(--safe-b) calc(4px + var(--safe-l)); display: grid; grid-template-columns: repeat(5, 1fr);
  background: #0a0a10; border-top: 1px solid var(--line); z-index: 3; }
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 52px; border: 0; background: transparent; color: var(--dim); cursor: pointer; font: 600 12px var(--mono); transition: color .15s var(--ease), transform .15s var(--ease); }
.tab svg { width: 22px; height: 22px; }
.tab:active { transform: scale(.92); }
.tab:hover { color: var(--ink); }
.tab[aria-pressed="true"] { color: var(--lime); }
.tab[aria-pressed="true"] svg { filter: drop-shadow(0 0 6px rgba(195,255,92,.6)); }

/* ---- the sheet: who to watch, or the followed daemon ---- */
.sheet { position: fixed; left: 0; right: 0; bottom: var(--tab-h); padding: 10px calc(12px + var(--safe-r)) 10px calc(12px + var(--safe-l));
  background: var(--panel); border-top: 1px solid var(--line); border-radius: 16px 16px 0 0; max-height: 46dvh; display: flex; flex-direction: column; backdrop-filter: blur(8px); z-index: 2;
  transition: max-height .22s var(--ease); }
.sheet.expanded { max-height: min(62dvh, calc(100dvh - var(--tab-h) - 64px - var(--safe-t))); }
/* who to watch: phones get one closed chip; wider layouts get three compact rows and See all */
.watchchip { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 6px 4px; border: 0; background: transparent; color: var(--ink); cursor: pointer; text-align: left; }
.watchchip > svg { width: 20px; height: 20px; flex: none; color: var(--dim); }
.wfaces { display: flex; flex: none; }
.wfaces canvas { width: 32px; height: 32px; image-rendering: pixelated; border-radius: 8px; background: #000; border: 2px solid var(--panel-solid, #0c0c12); margin-left: -10px; }
.wfaces canvas:first-child { margin-left: 0; }
.wtext { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.wtext b { font: 700 12px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--lav); }
.wtext span { font-size: 13px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pickhead { display: none; align-items: center; justify-content: space-between; margin: 0 0 6px; }
.picktitle { margin: 0; font: 700 12px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--lav); }
.seeall { min-height: 44px; padding: 0 10px; border: 0; background: transparent; color: var(--lime); font: 700 12px var(--mono); cursor: pointer; border-radius: 10px; }
.seeall:hover { background: rgba(195,255,92,.08); }
.pickrow { display: none; flex-direction: column; gap: 4px; }
.pick { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 6px 8px; border: 1px solid transparent; border-radius: 12px; background: transparent; cursor: pointer; text-align: left; color: var(--ink);
  transition: background .15s var(--ease), transform .15s var(--ease); animation: rise .25s var(--ease) both; }
.pick:hover { background: #15151e; }
.pick:active { transform: scale(.98); }
.pick.skel { height: 52px; background: linear-gradient(90deg, #101017 30%, #181822 50%, #101017 70%) 0 0 / 300% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -150% 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.pick canvas { width: 36px; height: 36px; flex: none; image-rendering: pixelated; border-radius: 8px; background: #000; }
.pt { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.pick .ph { display: flex; align-items: baseline; gap: 8px; font: 700 13px var(--mono); white-space: nowrap; overflow: hidden; }
.pick .pk { font: 600 12px var(--mono); color: var(--lav); overflow: hidden; text-overflow: ellipsis; }
.pick .pi { font-size: 12px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.watchlist { padding: 8px; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
.pick, .pt { min-width: 0; }
.watchlist .pick { min-height: 56px; }
.card:not([hidden]) { display: flex; flex-direction: column; min-height: 0; animation: rise .2s var(--ease); }
.cardhead { display: flex; align-items: center; gap: 10px; }
.face { width: 52px; height: 52px; image-rendering: pixelated; background: #000; border-radius: 10px; flex: none; border: 1px solid var(--line); }
.who { flex: 1; min-width: 0; }
.name { font: 20px/1.1 var(--display); letter-spacing: .03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
@media (max-width: 520px) { .name .house { display: none; } }
.house { font: 600 12px var(--mono); padding: 1px 6px; border-radius: 6px; background: #1b1b26; letter-spacing: 0; }
.meta { font: 12px var(--mono); color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.share { display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 14px; border: 0; border-radius: 12px; background: var(--lime); color: #0a0d05; font: 700 13px var(--mono); cursor: pointer; transition: transform .15s var(--ease); flex: none; }
.share svg { width: 18px; height: 18px; }
.share:active { transform: scale(.95); }
.icon { width: 44px; height: 44px; display: inline-grid; place-items: center; border: 0; border-radius: 12px; background: transparent; color: var(--ink); cursor: pointer; flex: none; transition: transform .15s var(--ease); }
.icon svg { width: 20px; height: 20px; }
.icon:hover { background: rgba(255,255,255,.06); }
.icon:active { transform: scale(.92); }
#btnExpand svg { transition: transform .2s var(--ease); }
#btnExpand[aria-expanded="true"] svg { transform: rotate(180deg); }
.intent { margin: 8px 0 6px; font-size: 15px; line-height: 1.35; }
.intent .label { display: inline-block; font: 600 12px var(--mono); color: var(--bg); background: var(--lime); padding: 1px 6px; border-radius: 6px; margin-right: 4px; vertical-align: 1px; }
.bars { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: center; }
.bar { height: 6px; border-radius: 3px; background: #22222e; overflow: hidden; }
.bar i { display: block; height: 100%; width: 100%; transform-origin: left; transition: transform .4s var(--ease); }
.bar.hp i { background: var(--coral); }
.bar.vg i { background: var(--lav); }
.purse { font: 600 12px var(--mono); color: var(--lime); white-space: nowrap; }
.more { overflow-y: auto; margin-top: 8px; padding-right: 2px; overscroll-behavior: contain; min-height: 0; }
.more h3 { font: 700 12px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--lav); margin: 14px 0 6px; }
.plan { margin: 0; color: var(--ink); font-size: 13px; }
.tally { margin: 6px 0 0; font: 12px var(--mono); color: var(--dim); }
.decisions { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.decisions li { border: 1px solid var(--line); border-radius: 10px; padding: 8px; font-size: 13px; }
.decisions .chose { font-weight: 700; }
.decisions .p { font: 600 12px var(--mono); color: var(--lime); }
.decisions .why { color: var(--dim); margin-top: 2px; }
.decisions .alt { font: 12px var(--mono); color: var(--dim); margin-top: 4px; }
.decisions .when { font: 12px var(--mono); color: #8a889c; float: right; }
.persona { margin: 0; font-size: 13px; color: var(--dim); }
.lessons, .story { margin: 0; padding-left: 18px; font-size: 13px; color: var(--dim); }
.story li { margin: 2px 0; }
.story .when { font: 12px var(--mono); color: #8a889c; }
.rec { font-size: 13px; }

/* ---- dialogs ---- */
.panel { width: min(520px, calc(100vw - 24px)); max-height: min(82dvh, 760px); padding: 0; border: 1px solid var(--line); border-radius: 16px; background: #0d0d13; color: var(--ink); overflow: hidden; }
.panel[open] { display: flex; flex-direction: column; animation: pop .2s var(--ease); }
.panel::backdrop { background: rgba(0,0,0,.6); backdrop-filter: blur(4px); }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.phead { display: flex; align-items: center; justify-content: space-between; padding: 6px 6px 6px 16px; border-bottom: 1px solid var(--line); }
.phead h2 { margin: 0; font: 22px/1 var(--display); letter-spacing: .03em; text-transform: uppercase; color: var(--lime); }
.note { margin: 10px 16px 0; font-size: 12px; color: var(--dim); }
.standings, .chron { list-style: none; margin: 0; padding: 8px 8px 16px; overflow-y: auto; overscroll-behavior: contain; }
.standings li button { width: 100%; display: grid; grid-template-columns: 30px 32px 1fr auto; gap: 8px; align-items: center; min-height: 48px; padding: 4px 8px; border: 0; border-radius: 10px; background: transparent; cursor: pointer; text-align: left; }
.standings li button:hover { background: #16161f; }
.standings .rk { font: 600 12px var(--mono); color: var(--dim); }
.standings canvas { width: 32px; height: 32px; image-rendering: pixelated; border-radius: 6px; }
.standings .nm { font: 600 13px var(--mono); }
.standings .nm small { display: block; font-weight: 400; color: var(--dim); font-size: 12px; }
.standings .em { font: 700 13px var(--mono); color: var(--lime); }
.standings li.cut { border-top: 1px dashed #3b3452; margin-top: 4px; padding-top: 4px; }
.chron li { padding: 8px; border-bottom: 1px solid #16161f; font-size: 13px; }
.chron time { display: block; font: 12px var(--mono); color: #8a889c; }
.about { padding: 4px 16px 16px; overflow-y: auto; font-size: 14px; }
.about h3 { font: 700 12px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--lav); margin: 16px 0 6px; }
.about ul { padding-left: 18px; }
.about li { margin: 4px 0; }
.about .dev, .about .sig { font: 12px var(--mono); color: var(--dim); }
.sharebody { padding: 12px 16px 16px; overflow-y: auto; display: grid; gap: 12px; justify-items: center; }
.sharebody img { width: 100%; max-width: 340px; aspect-ratio: 4 / 5; border-radius: 12px; border: 1px solid var(--line); background: #000; }
.shareacts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; width: 100%; }
.primary, .quiet { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 12px; font: 700 13px var(--mono); cursor: pointer; text-decoration: none; transition: transform .15s var(--ease); }
.primary { border: 0; background: var(--lime); color: #0a0d05; }
.primary svg { width: 18px; height: 18px; }
.quiet { border: 1px solid var(--line); background: transparent; color: var(--ink); }
.primary:active, .quiet:active { transform: scale(.96); }
.noscript { position: fixed; inset: 40% 0 auto; text-align: center; }

/* ---- phone landscape and short screens: the sheet moves to the side ---- */
@media (orientation: landscape) and (max-height: 520px) {
  :root { --side: min(340px, 44vw); --tab-h: calc(50px + var(--safe-b)); }
  .tabbar { right: var(--side); }
  .tab { flex-direction: row; gap: 6px; min-height: 48px; }
  .sheet { left: auto; top: 0; bottom: 0; width: var(--side); max-height: none; border-radius: 0; border-top: 0; border-left: 1px solid var(--line); padding-top: calc(10px + var(--safe-t)); padding-bottom: calc(10px + var(--safe-b)); }
  .sheet.expanded { max-height: none; }
  .top { right: var(--side); }
  .ticker { right: calc(var(--side) + 12px); bottom: calc(var(--tab-h) + 8px); }
  .brand .sub { font-size: 18px; }
}
/* ---- tablet, portrait and landscape: the world plus a side panel with the tools under it ---- */
@media (min-width: 700px) and (max-width: 1180px) and (min-height: 560px) {
  :root { --side: clamp(340px, 38vw, 420px); --tab-h: calc(62px + var(--safe-b)); }
  .top { right: var(--side); padding: calc(14px + var(--safe-t)) 18px 24px calc(18px + var(--safe-l)); }
  .brand .sub { font-size: 28px; }
  .clock { font-size: 13px; }
  .sheet { left: auto; top: 0; bottom: var(--tab-h); width: var(--side); max-height: none; border-radius: 0; border-top: 0; border-left: 1px solid var(--line); padding: calc(18px + var(--safe-t)) calc(16px + var(--safe-r)) 12px 16px; }
  .sheet.expanded { max-height: none; }
  .tabbar { left: auto; width: var(--side); border-left: 1px solid var(--line); }
  .ticker { right: calc(var(--side) + 16px); left: calc(18px + var(--safe-l)); bottom: calc(16px + var(--safe-b)); font-size: 13px; }
  .face { width: 64px; height: 64px; }
  .name { font-size: 24px; }
}
/* ---- desktop: floating card and a tab pill ---- */
@media (min-width: 1181px) and (min-height: 560px) {
  :root { --tab-h: 0px; }
  .top { padding: 16px 20px 24px; }
  .brand .sub { font-size: 28px; }
  .clock { font-size: 13px; }
  .tabbar { left: 50%; right: auto; bottom: 16px; transform: translateX(-50%); height: 60px; width: 460px; border: 1px solid var(--line); border-radius: 16px; padding: 0 6px; background: var(--panel); backdrop-filter: blur(8px); }
  .sheet { left: 16px; right: auto; bottom: 16px; width: 400px; border: 1px solid var(--line); border-radius: 16px; max-height: 46vh; }
  .sheet.expanded { max-height: calc(100dvh - 110px); }
  .ticker { left: 50%; transform: translateX(-50%); bottom: 88px; width: 460px; right: auto; text-align: center; }
}
@media (max-width: 340px) { .share span { display: none; } .share { padding: 0 12px; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
body:has(.sheet.expanded) .ticker { display: none; }
/* wider layouts: rows instead of the chip */
@media (orientation: landscape) and (max-height: 520px), (min-width: 700px) and (min-height: 560px) {
  .watchchip { display: none; }
  .pickhead { display: flex; }
  .pickrow { display: flex; }
}
@media (min-width: 1181px) and (min-height: 560px) {
  .sheet { width: min(380px, calc(50vw - 250px)); max-height: calc(100dvh - 140px); }
}
