/* LemBot - "Aurora": deep indigo surfaces, violet and cyan light, soft glass cards and pill controls. */
:root {
  --bg: #090d1a;
  --panel: #12182b;
  --panel-2: #1a2240;
  --line: rgba(151, 165, 255, .16);
  --line-soft: rgba(151, 165, 255, .09);
  --text: #eaeefc;
  --muted: #8d99c2;
  --accent: #8b7bff;
  --accent-2: #22d3ee;
  --accent-dim: #5d51d8;
  --accent-soft: rgba(139, 123, 255, .16);
  --good: #2dd4a7;
  --bad: #ff6b81;
  --warn: #ffb84d;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 14px 34px -22px rgba(0, 0, 0, .9);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; color: var(--text); font: 15px/1.5 "Inter", "Segoe UI Variable Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body {
  min-height: 100vh;
  background:
    radial-gradient(1100px 560px at 10% -12%, rgba(139, 123, 255, .22), transparent 62%),
    radial-gradient(900px 520px at 105% -4%, rgba(34, 211, 238, .12), transparent 58%),
    var(--bg);
  background-attachment: fixed;
}
a { color: #b3a9ff; text-decoration: none; }
a:hover { color: #d2ccff; text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 1.75rem; font-weight: 750; }
h2 { font-size: 1.15rem; font-weight: 700; }
h3 { font-size: .74rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hidden { display: none !important; }

/* --- top bar --------------------------------------------------------------------------------------------------------- */
.topbar { display: flex; align-items: center; gap: 1.2rem; padding: .65rem 1.4rem; background: rgba(9, 13, 26, .72); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-bottom: 1px solid var(--line-soft); position: sticky; top: 0; z-index: 20; }
.brand { display: inline-flex; align-items: center; gap: .55rem; font-weight: 800; font-size: 1.08rem; letter-spacing: -.01em; background: linear-gradient(100deg, #b8adff, #22d3ee); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand::before { content: ""; width: 1.05rem; height: 1.05rem; border-radius: 6px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); transform: rotate(45deg) scale(.86); box-shadow: 0 0 14px rgba(139, 123, 255, .6); }
.topbar nav { display: flex; gap: .3rem; flex: 1; }
.topbar nav a { color: var(--muted); padding: .38rem .85rem; border-radius: 999px; font-weight: 550; transition: background .15s, color .15s; }
.topbar nav a:hover { color: var(--text); background: rgba(255, 255, 255, .05); text-decoration: none; }
.topbar nav a.active { color: #fff; background: var(--accent-soft); box-shadow: inset 0 0 0 1px rgba(139, 123, 255, .35); }
.topbar .who { color: var(--muted); font-size: .9rem; }

main { max-width: 1280px; margin: 0 auto; padding: 1.4rem 1.2rem 3rem; }
.card { background: linear-gradient(180deg, rgba(255, 255, 255, .04), rgba(255, 255, 255, .015)), var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.15rem 1.3rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.center-card { max-width: 420px; margin: 8vh auto; }

/* --- forms and buttons ----------------------------------------------------------------------------------------------- */
label { display: block; font-size: .85rem; color: var(--muted); margin: .7rem 0 .25rem; }
input[type=text], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; background: rgba(6, 9, 20, .55); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .52rem .7rem; font: inherit;
  transition: border-color .15s, box-shadow .15s;
}
input:hover, select:hover, textarea:hover { border-color: rgba(151, 165, 255, .32); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(139, 123, 255, .25); }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button, .button {
  display: inline-block; background: rgba(255, 255, 255, .05); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: .5rem 1rem; font: inherit; font-weight: 600; cursor: pointer; transition: background .15s, border-color .15s, transform .05s;
}
button:hover, .button:hover { border-color: rgba(139, 123, 255, .6); background: rgba(139, 123, 255, .1); text-decoration: none; color: var(--text); }
button:active { transform: translateY(1px); }
button.primary { background: linear-gradient(135deg, #9a8cff, #6a5cf0); color: #fff; border-color: transparent; box-shadow: 0 8px 20px -10px rgba(122, 106, 255, .9); }
button.primary:hover { background: linear-gradient(135deg, #aa9eff, #7a6cff); }
button.danger { color: #ff8fa1; }
button.link { background: none; border: 0; padding: 0; color: #b3a9ff; font-weight: 550; box-shadow: none; }
button.link:hover { background: none; color: #d2ccff; text-decoration: underline; text-underline-offset: 3px; }
button:disabled { opacity: .5; cursor: default; }
.row { display: flex; gap: .7rem; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.error { color: #ff8fa1; margin: .6rem 0 0; min-height: 1.2em; }
.notice { background: rgba(255, 184, 77, .09); border: 1px solid rgba(255, 184, 77, .35); color: #ffd9a0; border-radius: var(--radius-sm); padding: .65rem .95rem; margin: .8rem 0; }
.copybox { background: rgba(6, 9, 20, .6); border: 1px dashed rgba(139, 123, 255, .5); border-radius: var(--radius-sm); padding: .6rem .8rem; word-break: break-all; font-family: ui-monospace, Consolas, monospace; margin: .5rem 0; }

/* --- toolbar and results --------------------------------------------------------------------------------------------- */
.toolbar { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; padding: .75rem; background: linear-gradient(180deg, rgba(255, 255, 255, .04), rgba(255, 255, 255, .015)), var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.toolbar select { width: auto; min-width: 12rem; }
.toolbar input.coords { width: 8.5rem; text-align: center; }
.fresh { font-size: .9rem; color: var(--muted); }
.fresh.stale { color: #ff8fa1; font-weight: 600; }
.toolbar .summary { color: var(--muted); font-size: .9rem; margin-left: auto; }
.chip { display: inline-block; background: rgba(255, 255, 255, .05); border: 1px solid var(--line); border-radius: 999px; padding: .06rem .6rem; font-size: .8rem; color: var(--muted); }
.count-chip { background: #fff; color: #3a2fb0; border-radius: 999px; padding: 0 .45rem; font-size: .75rem; margin-left: .3rem; font-weight: 700; }
.pager { display: flex; align-items: center; gap: .7rem; justify-content: flex-end; margin: .6rem 0; color: var(--muted); }
.pager button { padding: .25rem .7rem; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; min-width: 900px; }
th, td { padding: .55rem .7rem; text-align: left; white-space: nowrap; }
thead th { position: sticky; top: 0; background: #161d37; color: #a9b4de; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 650; border-bottom: 1px solid var(--line); cursor: default; user-select: none; }
thead th.sortable { cursor: pointer; }
thead th.sortable:hover { color: #fff; }
thead th.sorted { color: #fff; }
thead th.sorted::after { content: " \25B2"; font-size: .62rem; color: var(--accent); }
thead th.sorted.desc::after { content: " \25BC"; }
tbody tr { border-bottom: 1px solid var(--line-soft); }
tbody tr:last-child { border-bottom: 0; }
tbody tr:hover { background: rgba(139, 123, 255, .07); }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
td .delta { display: inline-block; min-width: 2.2rem; margin-left: .3rem; font-size: .8rem; color: var(--muted); }
td .delta.up { color: var(--good); }
td .delta.down { color: #ff8fa1; background: rgba(255, 107, 129, .14); border-radius: 6px; padding: 0 .35rem; }
td.coords { color: var(--muted); }
.empty { padding: 2.2rem; text-align: center; color: var(--muted); }

.tribe { display: inline-flex; width: 1.5rem; height: 1.5rem; align-items: center; justify-content: center; border-radius: 8px; background: var(--accent-soft); color: #c4bcff; font-size: .72rem; font-weight: 750; margin-right: .45rem; }
.badge { display: inline-block; border-radius: 999px; padding: .05rem .65rem; font-size: .75rem; font-weight: 650; border: 1px solid; }
.badge.idle { color: #67e8f9; border-color: rgba(34, 211, 238, .4); background: rgba(34, 211, 238, .1); }
.badge.shrinking { color: #ffc978; border-color: rgba(255, 184, 77, .4); background: rgba(255, 184, 77, .1); }
a.attack { display: inline-block; padding: .12rem .6rem; border: 1px solid var(--line); border-radius: 8px; color: #c4bcff; background: rgba(255, 255, 255, .03); }
a.attack:hover { border-color: var(--accent); background: var(--accent-soft); text-decoration: none; }

/* --- dialogs ----------------------------------------------------------------------------------------------------------- */
.overlay { position: fixed; inset: 0; background: rgba(4, 6, 16, .72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); z-index: 50; display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 4vh 1rem; }
.dialog { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; width: 100%; max-width: 980px; box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .95); }
.dialog header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.4rem; border-bottom: 1px solid var(--line-soft); font-weight: 700; font-size: 1.1rem; }
.dialog .body { display: grid; grid-template-columns: 1fr 1fr; gap: 1.8rem 2.5rem; padding: 1.4rem; }
.dialog footer { display: flex; justify-content: space-between; padding: 1rem 1.4rem; border-top: 1px solid var(--line-soft); }
@media (max-width: 760px) { .dialog .body { grid-template-columns: 1fr; } }
.field { margin-bottom: 1.4rem; }
.field h3 { margin-bottom: .55rem; }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem 1rem; }
.checks.one { grid-template-columns: 1fr; }
.check { display: flex; align-items: center; gap: .55rem; margin: 0; color: var(--text); font-size: .95rem; cursor: pointer; }
.check input { accent-color: var(--accent); width: 1.05rem; height: 1.05rem; }
.hours-input { width: 6rem !important; }

.range { position: relative; height: 26px; margin: .2rem 0; }
.range .track, .range .fill { position: absolute; top: 11px; height: 4px; border-radius: 2px; }
.range .track { left: 0; right: 0; background: rgba(151, 165, 255, .2); }
.range .fill { background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.range input[type=range] { position: absolute; left: 0; top: 4px; width: 100%; height: 18px; margin: 0; background: none; pointer-events: none; -webkit-appearance: none; appearance: none; box-shadow: none; }
.range input[type=range]::-webkit-slider-runnable-track { background: transparent; height: 18px; }
.range input[type=range]::-moz-range-track { background: transparent; }
.range input[type=range]::-webkit-slider-thumb { pointer-events: auto; -webkit-appearance: none; width: 16px; height: 16px; margin-top: 1px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); cursor: pointer; box-shadow: 0 2px 8px rgba(0, 0, 0, .5); }
.range input[type=range]::-moz-range-thumb { pointer-events: auto; width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); cursor: pointer; }
.range-values { display: flex; justify-content: space-between; gap: .6rem; }
.range-values input { width: 6.5rem; padding: .25rem .45rem; font-size: .85rem; }
.range-values input:last-child { text-align: right; }

.tags { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .45rem; }
.tag { display: inline-flex; align-items: center; gap: .3rem; background: var(--accent-soft); border: 1px solid rgba(139, 123, 255, .3); border-radius: 999px; padding: .1rem .3rem .1rem .7rem; font-size: .85rem; }
.tag button { background: none; border: 0; padding: 0 .3rem; color: var(--muted); font-size: 1rem; line-height: 1; }
.tag button:hover { color: #ff8fa1; background: none; }

table.plain { min-width: 0; }
table.plain th { position: static; }
.note-line { margin: .2rem 0 0; }

#who { margin: 0 0 .75rem; min-height: 1.6rem; }
#who input { width: 16rem; max-width: 100%; }
.mine { margin-top: 1rem; padding-top: .75rem; border-top: 1px solid var(--line-soft); }
.mine ul { margin: .4rem 0 0; padding-left: 1.2rem; }

/* --- player and alliance pages ------------------------------------------------------------------------------------------ */
.crumbs { margin: 0 0 .8rem; font-size: .9rem; }
.hero { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; background: linear-gradient(120deg, rgba(139, 123, 255, .16), rgba(34, 211, 238, .06) 60%, transparent), var(--panel); }
.hero h1 { margin: 0 0 .45rem; font-size: 2rem; }
.hero-chips { gap: .45rem; }
.chip .tribe { width: 1.2rem; height: 1.2rem; font-size: .62rem; margin-right: .35rem; border-radius: 6px; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: .75rem; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.stat { background: linear-gradient(180deg, rgba(255, 255, 255, .04), rgba(255, 255, 255, .015)), var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: .85rem 1.05rem; box-shadow: var(--shadow); }
.stat .label { font-size: .7rem; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); font-weight: 650; }
.stat .value { font-size: 1.5rem; font-weight: 750; font-variant-numeric: tabular-nums; margin-top: .15rem; letter-spacing: -.01em; }
.stat .value .delta { font-size: 1.5rem; margin: 0; padding: 0; background: none; }
.delta.up { color: var(--good); }
.delta.down { color: #ff8fa1; }
.stat .sub { margin-top: .1rem; }

.chart-controls { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; margin-bottom: .8rem; }
.chart-controls #toggleVillages { margin-left: auto; }
.seg { display: inline-flex; background: rgba(6, 9, 20, .55); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { background: none; border: 0; border-radius: 9px; padding: .32rem .8rem; font-weight: 550; color: var(--muted); }
.seg button:hover { color: var(--text); background: rgba(255, 255, 255, .05); }
.seg button.on { background: linear-gradient(135deg, #9a8cff, #6a5cf0); color: #fff; font-weight: 700; box-shadow: 0 4px 12px -6px rgba(122, 106, 255, .9); }
.pill { display: inline-flex; align-items: center; gap: .45rem; background: rgba(255, 255, 255, .04); border: 1px solid var(--line); border-radius: 999px; padding: .3rem .85rem; font-weight: 550; color: var(--muted); }
.pill.on { color: var(--text); border-color: rgba(34, 211, 238, .5); background: rgba(34, 211, 238, .08); }
.sw { display: inline-block; width: .9rem; height: 0; border-top: 3px solid var(--accent); margin-right: .4rem; vertical-align: middle; border-radius: 2px; }
.sw.count { border-top: 3px dashed var(--accent-2); }

.chart { position: relative; min-height: 260px; touch-action: pan-y; transition: opacity .15s; }
.chart svg { display: block; max-width: 100%; overflow: visible; }
.chart .grid { stroke: rgba(151, 165, 255, .14); stroke-width: 1; stroke-dasharray: 2 5; }
.chart .axis { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .axis.count { fill: var(--accent-2); }
.chart .line-pop { fill: none; stroke: var(--accent); stroke-width: 2.6; stroke-linejoin: round; stroke-linecap: round; filter: drop-shadow(0 4px 10px rgba(139, 123, 255, .45)); }
.chart .line-count { fill: none; stroke: var(--accent-2); stroke-width: 1.8; stroke-dasharray: 6 5; stroke-linejoin: round; }
.chart .cross { stroke: rgba(234, 238, 252, .35); stroke-width: 1; }
.chart .dot-pop { fill: #fff; stroke: var(--accent); stroke-width: 3; }
.chart .dot-count { fill: var(--accent-2); stroke: var(--bg); stroke-width: 2; }
.chart .marker { stroke: var(--bg); stroke-width: 2; cursor: pointer; }
.chart .marker:hover, .chart .marker:focus { stroke: #fff; outline: none; }
.chart .hit { cursor: crosshair; }
.chart-tip { position: absolute; z-index: 5; pointer-events: none; background: rgba(8, 11, 24, .96); border: 1px solid rgba(139, 123, 255, .5); border-radius: 12px; padding: .55rem .75rem; font-size: .85rem; box-shadow: 0 12px 30px rgba(0, 0, 0, .6); max-width: 320px; }
.chart-tip .when { color: var(--muted); font-size: .75rem; margin-bottom: .2rem; }
.chart-tip b.up { color: var(--good); }
.chart-tip b.down { color: #ff8fa1; }
.chart-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); text-align: center; padding: 1rem; }

.two-col { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(0, 2fr); gap: 1rem; align-items: start; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }
.events { list-style: none; margin: 0; padding: 0; }
.events li { display: flex; gap: .7rem; padding: .6rem .5rem; border-bottom: 1px solid var(--line-soft); border-radius: 10px; }
.events li:last-child { border-bottom: 0; }
.events .dot { flex: none; width: .7rem; height: .7rem; border-radius: 50%; margin-top: .4rem; box-shadow: 0 0 10px currentColor; }
.events li.flash { animation: flash 1.6s ease-out; }
@keyframes flash { from { background: rgba(139, 123, 255, .28); } to { background: transparent; } }
.plain-wrap { border: 0; background: none; box-shadow: none; }
.plain-wrap table { min-width: 0; }
tfoot td { border-top: 2px solid var(--line); padding-top: .6rem; }
td .delta { min-width: 0; }
.delta { font-variant-numeric: tabular-nums; }
a.ext { color: var(--muted); font-size: .8rem; margin: 0 .2rem; }
a.ext:hover { color: var(--accent-2); }
.chart .tick { stroke: rgba(151, 165, 255, .4); stroke-width: 1; }
.chart .axis.time.major { fill: var(--text); font-weight: 650; }
body[data-kind=player] .two-col { grid-template-columns: 1fr; }
body[data-kind=player] .events { columns: 2 320px; column-gap: 2rem; }
body[data-kind=player] .events li { break-inside: avoid; }

/* --- activity pattern ---------------------------------------------------------------------------------------------------- */
.offline { margin-bottom: 1rem; }
.offline .big { font-size: 1.25rem; margin-bottom: .2rem; }
.offline .big strong { color: #c4bcff; }
.offline .row { margin-top: .5rem; gap: .5rem; }
.chip-on { color: var(--good); border-color: rgba(45, 212, 167, .4); background: rgba(45, 212, 167, .1); }
.chip-off { color: #67e8f9; border-color: rgba(34, 211, 238, .4); background: rgba(34, 211, 238, .1); }
.hours { display: grid; grid-template-columns: repeat(24, 1fr); gap: 3px; height: 110px; align-items: end; }
.hour { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; border-radius: 6px; padding-bottom: 1.2rem; }
.hour .bar { width: 100%; background: linear-gradient(180deg, #a99eff, var(--accent-dim)); border-radius: 4px 4px 0 0; opacity: .9; min-height: 3px; }
.hour span { position: absolute; bottom: 0; font-size: .7rem; color: var(--muted); }
.hour.quiet { background: rgba(34, 211, 238, .1); }
.hour.quiet .bar { background: linear-gradient(180deg, #67e8f9, #0e9db6); }
.hour.current { outline: 1px solid rgba(255, 255, 255, .5); outline-offset: 1px; }
.hour:hover .bar { opacity: 1; }

/* --- top 10, rankings and the hourly-update cues ---------------------------------------------------------------------------- */
.right { margin-left: auto; }
.toolbar input[type=search] { width: 15rem; max-width: 100%; }
.section-title { margin: 1.6rem 0 .8rem; font-size: 1.25rem; }
.top-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
@media (max-width: 900px) { .top-grid { grid-template-columns: 1fr; } }
.top-card { margin: 0; }
.top-card header h3 { margin-bottom: .6rem; color: #c4bcff; font-size: .8rem; }
table.top { min-width: 0; }
table.top td { padding: .34rem .4rem; }
table.top tr { border-bottom: 1px solid var(--line-soft); }
table.top tr:last-child { border-bottom: 0; }
table.top td.rank { color: var(--muted); width: 3.6rem; white-space: nowrap; }
table.top td.change { width: 5.5rem; }
.spark-cell { width: 108px; padding-right: 0 !important; }
.spark { display: block; margin-left: auto; overflow: visible; }
.spark path { fill: none; stroke: var(--muted); stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round; }
.spark circle { fill: var(--muted); }
.spark.up path { stroke: var(--good); } .spark.up circle { fill: var(--good); }
.spark.down path { stroke: var(--bad); } .spark.down circle { fill: var(--bad); }
.moved { font-size: .7rem; margin-left: .35rem; font-weight: 700; }
.moved.up { color: var(--good); } .moved.down { color: #ff8fa1; }
.delta.new { color: #67e8f9; border: 1px solid rgba(34, 211, 238, .45); border-radius: 999px; padding: 0 .45rem; font-size: .75rem; }
.movers { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; background: linear-gradient(90deg, rgba(139, 123, 255, .12), transparent), var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .65rem 1rem; margin: .8rem 0; }
.mover { display: inline-flex; gap: .4rem; align-items: center; }
.rank-table { min-width: 860px; }
.rank-table td.num, .rank-table th.num { text-align: right; }
.rank-table thead th { top: 0; }

.fresh { display: inline-flex; align-items: center; gap: .45rem; }
.pulse { display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 0 rgba(45, 212, 167, .6); animation: pulse 2.4s infinite; }
.pulse.stale { background: var(--bad); animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(45, 212, 167, .55); } 70% { box-shadow: 0 0 0 7px rgba(45, 212, 167, 0); } 100% { box-shadow: 0 0 0 0 rgba(45, 212, 167, 0); } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }
.live { display: flex; gap: .7rem; align-items: center; flex-wrap: wrap; margin-bottom: .5rem; font-size: .9rem; }
.chart .reading { fill: var(--bg); stroke: var(--accent); stroke-width: 1.5; }
.bars-title { display: flex; justify-content: space-between; align-items: baseline; margin: .6rem 0 0; }
.bars-title h3 { margin: 0; }
.chart.bars { min-height: 150px; }
.chart .bar-up { fill: var(--good); opacity: .85; }
.chart .bar-down { fill: var(--bad); opacity: .85; }
.chart .bar-flat { fill: var(--muted); }
.chart .bar-up:hover, .chart .bar-down:hover { opacity: 1; }
.chart .zero { stroke: rgba(151, 165, 255, .45); stroke-width: 1; }
.chart-tip strong.up { color: var(--good); } .chart-tip strong.down { color: #ff8fa1; }

/* --- clickable sparklines and the hourly graph dialog ------------------------------------------------------------------------ */
.spark-btn { display: block; margin-left: auto; padding: 2px 4px; background: none; border: 1px solid transparent; border-radius: 8px; cursor: zoom-in; }
.spark-btn:hover, .spark-btn:focus-visible { border-color: rgba(139, 123, 255, .55); background: var(--accent-soft); }
.graph-dialog { max-width: 1040px; }
.graph-body { padding: 1rem 1.4rem 1.4rem; }
.graph-body .chart { margin: .6rem 0 1rem; }
.hourly summary { cursor: pointer; color: var(--muted); margin-bottom: .4rem; }
.hourly-scroll { max-height: 230px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.hourly-scroll table { min-width: 0; }
.hourly-scroll th { position: sticky; top: 0; }
.hourly-scroll td.num, .hourly-scroll th.num { text-align: right; }

/* --- sign-in and registration ------------------------------------------------------------------------------------------------ */
.center-card h1 { font-size: 2rem; background: linear-gradient(100deg, #b8adff, #22d3ee); -webkit-background-clip: text; background-clip: text; color: transparent; }
.center-card { box-shadow: 0 30px 80px -40px rgba(122, 106, 255, .55), var(--shadow); }

/* --- tribe pictures ---------------------------------------------------------------------------------------------------------- */
.tribe { flex: none; overflow: hidden; vertical-align: middle; }
.tribe.has-icon { width: 1.8rem; height: 1.8rem; background: rgba(255, 255, 255, .06); box-shadow: inset 0 0 0 1px var(--line); }
.tribe-img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 12%; transform: scale(1.35); transform-origin: 50% 22%; }
.chip .tribe.has-icon { width: 1.5rem; height: 1.5rem; }

/* --- system page ------------------------------------------------------------------------------------------------------------------ */
.health { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: .7rem; margin: 1rem 0; }
.health-card { display: flex; gap: .75rem; align-items: flex-start; padding: .75rem .95rem; border-radius: 14px; border: 1px solid var(--line); background: linear-gradient(180deg, rgba(255, 255, 255, .04), rgba(255, 255, 255, .015)), var(--panel); box-shadow: var(--shadow); }
.health-card .dot { flex: none; width: .7rem; height: .7rem; margin-top: .35rem; border-radius: 50%; background: var(--muted); }
.health-card .what { font-weight: 650; }
.health-card.ok .dot { background: var(--good); box-shadow: 0 0 10px var(--good); }
.health-card.warn .dot { background: var(--warn); box-shadow: 0 0 10px var(--warn); }
.health-card.bad { border-color: rgba(255, 107, 129, .5); }
.health-card.bad .dot { background: var(--bad); box-shadow: 0 0 10px var(--bad); }
.two-col.even { grid-template-columns: 1fr 1fr; }
@media (max-width: 900px) { .two-col.even { grid-template-columns: 1fr; } }
.badge.failed { color: #ff8fa1; border-color: rgba(255, 107, 129, .45); background: rgba(255, 107, 129, .1); }
tr.run-row { cursor: pointer; }
tr.run-detail td { background: rgba(6, 9, 20, .5); padding: .8rem 1rem; white-space: normal; }
.log { margin: .6rem 0 0; padding: .7rem .9rem; max-height: 420px; overflow: auto; background: rgba(4, 6, 16, .75); border: 1px solid var(--line); border-radius: var(--radius-sm); font: .8rem/1.5 ui-monospace, Consolas, monospace; color: #cfd6f5; white-space: pre-wrap; word-break: break-word; }
.log .lerr { color: #ff8fa1; }
.log .lwarn { color: #ffc978; }
.upbars { display: grid; grid-template-columns: repeat(48, 1fr); gap: 2px; height: 110px; align-items: end; }
.upbar { height: 100%; display: flex; align-items: flex-end; border-radius: 3px; }
.upbar .fill { width: 100%; background: linear-gradient(180deg, #a99eff, var(--accent-dim)); border-radius: 3px 3px 0 0; }
.upbar.missing .fill { background: rgba(255, 107, 129, .28); height: 6% !important; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.2rem; margin: 0 0 1rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.meter-row { margin-top: .7rem; }
.meter { height: 8px; border-radius: 999px; background: rgba(151, 165, 255, .16); overflow: hidden; margin-top: .3rem; }
.meter div { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 999px; }
.meter div.warn { background: var(--warn); }
.meter div.bad { background: var(--bad); }

/* --- worlds to collect ------------------------------------------------------------------------------------------------------------ */
.switch-box { margin-top: 1.1rem; padding-top: 1rem; border-top: 1px solid var(--line-soft); }
.switch-box h3 { margin-bottom: .6rem; }
.switch-box .check { margin-top: .7rem; }
.row-actions { white-space: nowrap; }
.row-actions button + button { margin-left: .9rem; }

/* --- farm list ---------------------------------------------------------------------------------------------------------------------- */
textarea { resize: vertical; min-height: 6rem; font-family: ui-monospace, Consolas, monospace; font-size: .85rem; }
.fl-list { max-height: 260px; overflow: auto; margin: .6rem 0; padding-left: 1.2rem; }

/* --- watchlist and alerts -------------------------------------------------------------------------------------------------------------- */
.alert-options { display: grid; gap: .55rem; margin-top: .9rem; }
.alert-options .check { flex-wrap: wrap; }
.inline-number { width: 5rem !important; display: inline-block; padding: .2rem .45rem; }
