/* Copyright (c) 2026 Ashutosh Siddh. All rights reserved. See LICENSE. */
/* X (Twitter) dark theme: "Lights out" palette and layout. */
:root {
  --bg: #000000;
  --panel: #000000;
  --panel-2: #16181c;
  --hover: rgba(231, 233, 234, 0.1);
  --row-hover: rgba(255, 255, 255, 0.03);
  --line: #2f3336;
  --text: #e7e9ea;
  --muted: #71767b;
  --accent: #1d9bf0;
  --accent-ink: #ffffff;
  --good: #00ba7c;
  --bad: #f4212e;
  --warn: #ffd400;
  --font: "TwitterChirp", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { background: var(--bg); }
body { margin: 0; color: var(--text); font: 15px/20px var(--font); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
svg { display: block; }

/* ---------- Shell ---------- */
.shell { display: flex; justify-content: center; min-height: 100vh; }

/* ---------- Left nav ---------- */
.nav {
  position: sticky; top: 0; height: 100vh; width: 275px; flex: none;
  display: flex; flex-direction: column; padding: 0 12px 0 8px;
}
.logo { display: inline-flex; width: 52px; height: 52px; align-items: center; justify-content: center; border-radius: 50%; margin: 2px 0 2px; }
.logo:hover { background: var(--hover); }
.logo svg { width: 30px; height: 30px; }

.nav-list { display: flex; flex-direction: column; gap: 2px; }
.nav-list button {
  display: flex; align-items: center; gap: 20px; width: fit-content; max-width: 100%;
  padding: 12px; border: 0; border-radius: 9999px; background: none; cursor: pointer;
  font-size: 20px; line-height: 24px; text-align: left;
}
.nav-list button:hover { background: var(--hover); }
.nav-list button[aria-selected="true"] { font-weight: 700; }
.nav-list button[aria-selected="true"] .ico svg { stroke-width: 2.4; }
.nav-list .label { white-space: nowrap; }
.nav-list .count { display: none; } /* counts live in the "Your orbit" card, like X keeps its nav clean */
.ico { position: relative; flex: none; }
.ico svg, .ico-only { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.badge {
  position: absolute; top: -6px; right: -7px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--accent); color: #fff; font: 700 11px/18px var(--font); font-style: normal;
  text-align: center; border: 1.5px solid var(--bg);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 0 16px; border-radius: 9999px; border: 1px solid transparent;
  font-weight: 700; font-size: 15px; cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background-color .2s;
}
.btn.primary { background: var(--text); color: #0f1419; }
.btn.primary:hover:not(:disabled) { background: #d7dbdc; }
.btn.outline { background: transparent; border-color: #536471; color: var(--text); }
.btn.outline:hover:not(:disabled) { background: var(--hover); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.big { width: 90%; min-height: 52px; font-size: 17px; margin: 16px 0; background: var(--text); color: #0f1419; }
.btn.big:hover { background: #d7dbdc; }
.btn.big .ico-only { display: none; }

.account { margin: auto 0 12px; }
.account:empty { display: none; }
.account .chip { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 9999px; text-decoration: none; }
.account .chip:hover { background: var(--hover); }
.account img { width: 40px; height: 40px; border-radius: 50%; flex: none; }
.account .who { min-width: 0; line-height: 20px; }

/* ---------- Center column ---------- */
.main { width: 600px; min-height: 100vh; border-left: 1px solid var(--line); border-right: 1px solid var(--line); flex: none; }
.main-head {
  position: sticky; top: 0; z-index: 3; padding: 10px 16px 9px;
  background: rgba(0, 0, 0, .65); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.main-head h1 { margin: 0; font-size: 20px; line-height: 24px; font-weight: 800; }
.main-head .sub { color: var(--muted); font-size: 13px; line-height: 16px; min-height: 16px; }

.composer { display: flex; gap: 8px; padding: 12px 16px 8px; border-bottom: 1px solid var(--line); }
.composer-avatar { width: 40px; height: 40px; border-radius: 50%; flex: none; background: var(--panel-2) center/cover; }
.composer-body { flex: 1; min-width: 0; }
.composer-input { display: flex; align-items: center; gap: 2px; padding: 8px 0 12px; font-size: 20px; line-height: 24px; }
.composer-input .at { color: var(--muted); }
.composer-input input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 20px; }
.composer-input input::placeholder { color: var(--muted); }
.composer-foot { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding-top: 8px; border-top: 1px solid var(--line); }

.status { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.status.error { color: var(--bad); }
.status-row { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.status-row #statusCount { color: var(--muted); font-variant-numeric: tabular-nums; }
.bar { height: 3px; background: var(--panel-2); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.bar div { height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.bar.indeterminate div { width: 30%; animation: slide 1.2s infinite ease-in-out; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(340%); } }

.empty { padding: 48px 32px; }
.empty h2 { font-size: 31px; line-height: 36px; font-weight: 800; margin: 0 0 12px; letter-spacing: -.01em; }
.empty p { color: var(--muted); margin: 0 0 10px; }
.empty b { color: var(--text); }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.search {
  flex: 1; min-width: 180px; display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: 9999px; background: var(--bg);
}
.search:focus-within { border-color: var(--accent); }
.search:focus-within svg { color: var(--accent); }
.search svg { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; color: var(--muted); }
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; }
.search input::placeholder { color: var(--muted); }
select { height: 36px; padding: 0 12px; border: 1px solid #536471; border-radius: 9999px; background: var(--bg); font-weight: 700; cursor: pointer; }
.check { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 14px; margin-right: auto; cursor: pointer; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }
.hint { color: var(--muted); font-size: 13px; line-height: 16px; margin: 0; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.hint:empty { display: none; }

/* ---------- People rows (X "Who to follow" style) ---------- */
.people { list-style: none; margin: 0; padding: 0; }
.person { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-bottom: 1px solid var(--line); transition: background-color .2s; }
.person:hover { background: var(--row-hover); }
.person > img, .person .av { width: 40px; height: 40px; border-radius: 50%; flex: none; background: var(--panel-2); object-fit: cover; }
.person .who { min-width: 0; flex: 1; text-decoration: none; }
.person .name { display: flex; align-items: center; gap: 2px; font-weight: 700; min-width: 0; }
.person .name span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person a.who:hover .name span:first-child { text-decoration: underline; }
.person .handle { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person .meta { color: var(--muted); font-size: 14px; margin-top: 2px; }
.person .side-bits { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.verified { width: 18px; height: 18px; fill: var(--accent); flex: none; }
.tag { font-size: 12px; line-height: 16px; padding: 2px 8px; border-radius: 9999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.tag.bad { color: var(--bad); border-color: rgba(244, 33, 46, .4); }
.tag.good { color: var(--good); border-color: rgba(0, 186, 124, .4); }
.tag.warn { color: var(--warn); border-color: rgba(255, 212, 0, .35); }
.tag.blue { color: var(--accent); border-color: rgba(29, 155, 240, .4); }
.btn.sm { min-height: 32px; padding: 0 14px; font-size: 14px; }
.more { padding: 16px; text-align: center; border-bottom: 1px solid var(--line); }
.more button { background: none; border: 0; color: var(--accent); cursor: pointer; }
.more button:hover { text-decoration: underline; }
.nobody { padding: 32px 16px; color: var(--muted); text-align: center; }

/* ---------- Rally ---------- */
.subtabs { display: flex; border-bottom: 1px solid var(--line); }
.subtabs button {
  flex: 1; position: relative; height: 53px; border: 0; background: none; cursor: pointer;
  color: var(--muted); font-weight: 500;
}
.subtabs button:hover { background: var(--hover); }
.subtabs button[aria-selected="true"] { color: var(--text); font-weight: 700; }
.subtabs button[aria-selected="true"]::after {
  content: ""; position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
  width: 56px; height: 4px; border-radius: 4px; background: var(--accent);
}
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.inline-form { display: flex; gap: 8px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.inline-form .search { min-width: 150px; }
.inline-form .at { color: var(--muted); }
.match-form .search { flex: 1 1 140px; }
.vs { color: var(--muted); font-weight: 700; }

.intro { padding: 20px 16px 24px; border-bottom: 1px solid var(--line); }
.intro h2 { font-size: 23px; line-height: 28px; font-weight: 800; margin: 0 0 10px; }
.intro h3 { font-size: 17px; margin: 18px 0 6px; }
.intro p { color: var(--muted); margin: 0 0 10px; }
.intro b { color: var(--text); }
.plain { margin: 0; padding-left: 18px; color: var(--muted); }
.plain li { margin: 4px 0; }

.banner { margin: 0; padding: 10px 16px; border-bottom: 1px solid var(--line); background: rgba(29, 155, 240, .08); color: var(--text); font-size: 14px; }

.board-head { display: flex; gap: 12px; align-items: flex-start; padding: 16px; border-bottom: 1px solid var(--line); }
.board-head img, .board-head .av { width: 56px; height: 56px; border-radius: 50%; flex: none; background: var(--panel-2); }
.bh-name { font-weight: 800; font-size: 17px; }
.bh-text { min-width: 0; }

.scoreboard { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--line); }
.sb-tile { padding: 12px 10px; text-align: center; border-right: 1px solid var(--line); }
.sb-tile:last-child { border-right: 0; }
.sb-n { font-size: 24px; line-height: 28px; font-weight: 800; font-variant-numeric: tabular-nums; }
.sb-l { color: var(--muted); font-size: 13px; }
.serve-line { margin: 0; padding: 12px 16px; border-bottom: 1px solid var(--line); font-weight: 700; }
.serve-line:empty { display: none; }
.sort-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; margin-right: auto; }

.two-bar { list-style: none; margin: 0; padding: 0; }
.tb-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.tb-row:hover { background: var(--row-hover); }
.tb-row .rank { width: 22px; flex: none; color: var(--muted); text-align: right; padding-top: 10px; font-variant-numeric: tabular-nums; font-size: 13px; }
.tb-row > img, .tb-row > .av { width: 40px; height: 40px; border-radius: 50%; flex: none; background: var(--panel-2); object-fit: cover; }
.tb-main { flex: 1; min-width: 0; }
.tb-top { display: flex; gap: 8px; align-items: baseline; justify-content: space-between; }
.tb-top a { min-width: 0; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-top a:hover b { text-decoration: underline; }
.klass { flex: none; font-size: 12px; line-height: 16px; padding: 1px 8px; border-radius: 9999px; border: 1px solid var(--line); color: var(--muted); }
.k-talker { color: var(--accent); border-color: rgba(29, 155, 240, .45); }
.k-amplifier { color: var(--good); border-color: rgba(0, 186, 124, .4); }
.k-broadcast { color: #f7a1a8; border-color: rgba(244, 33, 46, .35); }
.bars { margin: 6px 0 4px; display: grid; gap: 4px; }
.bar-line { display: grid; grid-template-columns: 52px 1fr 42px; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); }
.track { height: 6px; background: var(--panel-2); border-radius: 3px; overflow: hidden; }
.track i { display: block; height: 100%; background: var(--text); border-radius: 3px; min-width: 2px; }
.bar-line.in .track i { background: var(--accent); }
.bv { text-align: right; font-variant-numeric: tabular-nums; }
.remove {
  flex: none; width: 32px; height: 32px; border-radius: 50%; border: 0; background: none; color: var(--muted);
  font-size: 20px; line-height: 1; cursor: pointer;
}
.remove:hover { background: rgba(244, 33, 46, .1); color: var(--bad); }
.more-btn { display: block; width: 100%; padding: 16px; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--accent); cursor: pointer; }
.more-btn:hover { background: var(--row-hover); }

.block { padding: 16px; border-bottom: 1px solid var(--line); }
.block:empty { display: none; }
.block h3 { margin: 0 0 6px; font-size: 20px; font-weight: 800; }
.block p { margin: 0 0 10px; }
.quote { display: block; padding: 12px 16px; border: 1px solid var(--line); border-radius: 16px; text-decoration: none; }
.quote:hover { background: var(--row-hover); }
.mv { margin-top: 10px; }
.mv-t { font-weight: 700; margin-bottom: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 4px 10px; border: 1px solid var(--line); border-radius: 9999px; font-size: 14px; text-decoration: none; }
.chip:hover { border-color: var(--accent); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.share-result { margin: 12px 0 0; font-size: 14px; color: var(--muted); word-break: break-all; }
.share-result a { color: var(--accent); }
.error { color: var(--bad); }

/* Match */
.m-score { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 24px 16px 8px; }
.m-side { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; }
.m-side img, .m-side .av { width: 88px; height: 88px; border-radius: 50%; border: 3px solid var(--line); background: var(--panel-2); }
.m-side.won img, .m-side.won .av { border-color: var(--accent); }
.m-side a { font-weight: 700; text-decoration: none; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-num { font-size: 56px; line-height: 1; font-weight: 800; font-variant-numeric: tabular-nums; }
.m-head { text-align: center; font-size: 20px; font-weight: 800; margin: 8px 16px 16px; }
.sets { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.sets li { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.set-n { color: var(--muted); font-size: 13px; width: 40px; flex: none; }
.set-body { flex: 1; min-width: 0; }
.set-w { font-weight: 700; color: var(--accent); flex: none; }
.set-w.tie { color: var(--muted); }
#rtMatch .actions { padding: 16px; margin: 0; }
#rtMatch .share-result { padding: 0 16px 16px; margin: 0; }

/* Guess */
.guess { padding: 16px; }
.guess h2 { font-size: 23px; line-height: 28px; font-weight: 800; margin: 6px 0 16px; }
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.opt {
  display: flex; gap: 10px; align-items: center; text-align: left; padding: 10px 12px; min-height: 64px;
  border: 1px solid var(--line); border-radius: 16px; background: none; cursor: pointer; min-width: 0;
}
.opt span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.opt:hover:not(:disabled) { border-color: var(--accent); background: var(--row-hover); }
.opt img, .opt .av { width: 40px; height: 40px; border-radius: 50%; flex: none; background: var(--panel-2); }
.opt:disabled { cursor: default; }
.opt.right { border-color: var(--accent); background: rgba(29, 155, 240, .1); }
.opt.wrong { border-color: var(--bad); opacity: .8; }
.ok b { color: var(--accent); }
.no b { color: var(--bad); }
#guessResult p { margin: 14px 0 6px; }

/* Card dialog */
.card-dialog {
  width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 1px solid var(--line);
  border-radius: 16px; background: var(--bg); color: var(--text); overflow: auto;
}
.card-dialog::backdrop { background: rgba(91, 112, 131, .4); }
.dlg-head, .dlg-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; }
.dlg-head h2 { margin: 0; font-size: 20px; }
.sizes { display: flex; gap: 16px; border: 0; margin: 0; padding: 0 16px; }
.sizes legend { float: left; margin-right: 8px; padding: 0; }
.sizes label { display: flex; gap: 6px; align-items: center; cursor: pointer; }
.sizes input { accent-color: var(--accent); }
.card-preview { padding: 12px 16px; display: flex; justify-content: center; }
.card-preview canvas { max-width: 100%; max-height: 60vh; height: auto; border-radius: 12px; border: 1px solid var(--line); }

@media (max-width: 500px) {
  .scoreboard { grid-template-columns: repeat(2, 1fr); }
  .sb-tile:nth-child(2) { border-right: 0; }
  .sb-tile:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .options { grid-template-columns: 1fr; }
  .m-side img, .m-side .av { width: 64px; height: 64px; }
  .m-num { font-size: 40px; }
  .bar-line { grid-template-columns: 44px 1fr 36px; }
}

/* ---------- Right sidebar ---------- */
.side { width: 350px; flex: none; margin-left: 30px; padding-top: 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; scrollbar-width: none; }
.card { border: 1px solid var(--line); border-radius: 16px; margin-bottom: 16px; overflow: hidden; }
.card h3 { margin: 0; padding: 12px 16px; font-size: 20px; line-height: 24px; font-weight: 800; }
.card-body { padding: 0 16px 16px; color: var(--muted); font-size: 14px; }
.card-body p { margin: 0 0 10px; }
.card-body b { color: var(--text); }
.stat-row {
  display: flex; justify-content: space-between; align-items: baseline; width: 100%;
  padding: 12px 16px; border: 0; background: none; cursor: pointer; text-align: left;
}
.stat-row:hover { background: var(--row-hover); }
.stat-row .l { font-weight: 700; }
.stat-row .s { display: block; color: var(--muted); font-size: 13px; font-weight: 400; }
.stat-row .n { font-weight: 800; font-size: 17px; font-variant-numeric: tabular-nums; }
.stat-row.bad .n { color: var(--bad); }
.stat-row.good .n { color: var(--accent); }
.weights { list-style: none; padding: 0; margin: 0 0 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; }
.weights li { display: flex; justify-content: space-between; }
.foot { font-size: 13px; padding: 0 16px 24px; }
.warn-text { color: var(--warn); }

/* ---------- Buy me a coffee ---------- */
/* Buy Me a Coffee's brand yellow on an X-style pill, in the spot X gives its Premium card. */
.bmc-btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 18px;
  border-radius: 9999px; background: #ffdd00; color: #0f1419; font-weight: 700; text-decoration: none;
  transition: filter .2s;
}
.bmc-btn:hover { filter: brightness(.94); }
.bmc-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.support-card .card-body p { color: var(--muted); }

/* ---------- Footer and legal pages ---------- */
.site-foot { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 0 16px 24px; color: var(--muted); font-size: 13px; line-height: 16px; }
.site-foot nav { display: flex; gap: 12px; }
.site-foot a { color: var(--muted); text-decoration: none; }
.site-foot a:hover, .site-foot a[aria-current="page"] { color: var(--text); text-decoration: underline; }
.main-foot { display: none; padding-top: 16px; }

.legal { max-width: 640px; margin: 0 auto; padding: 24px 16px 48px; border-left: 1px solid var(--line); border-right: 1px solid var(--line); min-height: 100vh; }
.legal h1 { font-size: 31px; line-height: 36px; font-weight: 800; margin: 16px 0 4px; }
.legal h2 { font-size: 20px; line-height: 24px; font-weight: 800; margin: 28px 0 8px; }
.legal p, .legal li { color: #c4c7ca; line-height: 22px; }
.legal ul { padding-left: 20px; }
.legal li { margin: 4px 0; }
.legal b { color: var(--text); }
.legal a { color: var(--accent); text-decoration: none; }
.legal a:hover { text-decoration: underline; }
.legal code { font-size: 14px; background: var(--panel-2); padding: 1px 6px; border-radius: 4px; }
.legal-back { display: inline-block; font-weight: 700; }
.legal .site-foot { padding: 32px 0 0; margin-top: 32px; border-top: 1px solid var(--line); }
.intro a { color: var(--accent); text-decoration: none; }
.intro a:hover { text-decoration: underline; }

/* ---------- Responsive, following X's breakpoints ---------- */
@media (max-width: 1265px) {
  .nav { width: 88px; align-items: center; padding: 0 4px; }
  .nav-list .label, .nav-list .count { display: none; }
  .btn.big { width: 52px; height: 52px; padding: 0; }
  .btn.big .label { display: none; }
  .btn.big .ico-only { display: block; stroke: #0f1419; }
  .account .who { display: none; }
}
@media (max-width: 1000px) {
  .side { display: none; }
  .main-foot { display: flex; }
}
@media (max-width: 700px) {
  .shell { display: block; }
  .main { width: 100%; border: 0; padding-bottom: 64px; }
  .nav {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0; z-index: 10; height: 56px; width: 100%;
    flex-direction: row; justify-content: center; background: rgba(0, 0, 0, .85); backdrop-filter: blur(12px);
    border-top: 1px solid var(--line); padding: 0;
  }
  .logo, .btn.big, .account { display: none; }
  .nav-list { flex-direction: row; justify-content: space-around; width: 100%; }
  .nav-list button { padding: 12px 8px; }
  .composer-foot .small { display: none; }
  .empty { padding: 32px 16px; }
  .empty h2 { font-size: 24px; line-height: 28px; }
}
