:root {
  --bg: #101114;
  --panel: #1b1d24;
  --panel-2: #252830;
  --detail: #1c1f28;
  --line: #3a3e49;
  --text: #eeeae2;
  --muted: #9a958a;
  --green: #6fbf73;
  --red: #d36b6b;
  --amber: #d2a24a;
  --epic: #c9a46a;
  --select: #c4b9a6;
  --fav: #d8d0c4;
  --chip: #252830;
  --hover: #4a4f5c;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.45 ui-sans-serif, system-ui, Segoe UI, sans-serif;
  color-scheme: dark;
}

body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

h1,
h2 {
  margin: 0;
  font-weight: 600;
}

h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.live-status {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  line-height: 1.2;
}

.live-status:empty {
  display: none;
}

.logo {
  width: 32px;
  height: 32px;
  display: block;
  border-radius: 8px;
}

h2 {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  padding-top: max(12px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  flex-shrink: 0;
  z-index: 5;
}

.status {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  align-items: baseline;
  color: var(--text);
}

.epic-stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.epic-stat-kicker {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.epic-stat-value {
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.status .ready,
.live-status .ready {
  color: var(--green);
}

.status .warn,
.live-status .warn {
  color: var(--amber);
}

.status .bad,
.live-status .bad {
  color: var(--red);
}

.status .off,
.live-status .off {
  color: var(--muted);
}

.tg-join {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  background: #229ed9;
  color: #fff;
  border: 1px solid #1b8ec4;
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
}

.tg-join svg {
  width: 14px;
  height: 14px;
  display: block;
}

.tg-join:hover,
.tg-join:focus-visible {
  background: #2aa8e6;
  outline: none;
}

.view-toggle {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.banner {
  flex-shrink: 0;
  padding: 7px 16px;
  background: #2a1c1c;
  color: var(--red);
  font-size: 12px;
}

.banner[hidden] {
  display: none;
}

.workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(22rem, 32rem);
}

.scan {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: auto;
  padding: 12px 16px 16px;
}

.watch-section {
  flex: none;
}

.detail {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding: 12px 14px 16px;
  background: var(--detail);
  border-left: 2px solid #4a4538;
}

.history-view {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 12px 16px 20px;
}

.history-view[hidden],
.workspace[hidden],
#detail-machine[hidden],
#board-feed[hidden],
#activity-block[hidden] {
  display: none;
}

.pos {
  color: var(--green);
}

.neg {
  color: var(--red);
}

.epic {
  color: var(--epic);
}

.count {
  margin: 2px 0 0;
  color: var(--muted);
}

.machine-head h2,
.section-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.machine-head .count {
  font-size: 13px;
  color: var(--muted);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  margin: 0 0 10px;
  flex-wrap: wrap;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.scan-sticky {
  position: sticky;
  top: 0;
  z-index: 4;
  background: var(--bg);
  padding: 0 0 10px;
}

.filter-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.filter-chips,
.price-pills {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  overflow-x: auto;
  max-width: 100%;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.price-pills {
  flex: 1;
  min-width: 0;
}

.filter-chips:empty {
  display: none;
}

.price-pills button,
.chip-filter {
  flex: 0 0 auto;
}

.chip-filter,
.sort-control button,
#older,
#favorites-filter,
.view-toggle button,
.layout-toggle button,
.price-pills button,
.toolbar input,
.toolbar select {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 8px;
  font: inherit;
  cursor: pointer;
}

.toolbar input {
  width: 14rem;
  cursor: text;
}

.chip-filter,
.price-pills button {
  border-radius: 999px;
}

.chip-filter,
.price-pills button.on,
.view-toggle button[aria-pressed="true"],
.layout-toggle button[aria-pressed="true"] {
  background: #2a2926;
  border-color: var(--select);
  color: var(--select);
}

#favorites-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.fav-star {
  color: #f0c85c;
  font-size: 14px;
  line-height: 1;
  text-shadow: 0 0 8px rgba(240, 200, 92, 0.45);
}

#favorites-filter.on {
  background: #2a2926;
  border-color: #f0c85c;
  color: var(--text);
}

.sort-control {
  display: flex;
  gap: 4px;
}

.layout-toggle {
  display: flex;
  gap: 4px;
}

.toolbar select:hover,
.toolbar button:hover,
#older:hover,
.chip-filter:hover,
.price-pills button:hover,
.view-toggle button:hover,
.layout-toggle button:hover {
  border-color: var(--hover);
}

.chip-filter:hover,
.price-pills button.on:hover,
.view-toggle button[aria-pressed="true"]:hover,
.layout-toggle button[aria-pressed="true"]:hover {
  border-color: var(--select);
}

#favorites-filter.on:hover {
  border-color: #f0c85c;
}

.highlights {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.highlights:empty {
  display: none;
}

.highlight {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  column-gap: 12px;
  row-gap: 2px;
  align-items: baseline;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: inherit;
  font: inherit;
  text-align: left;
  padding: 12px 14px;
  cursor: pointer;
  min-width: 0;
}

.highlight:hover,
.highlight:focus-visible {
  border-color: var(--hover);
  outline: none;
}

.card.selected,
.highlight.selected {
  border-color: var(--select);
}

.card.selected.overdue,
.highlight.selected.overdue {
  border-color: var(--epic);
}

.highlight:disabled {
  cursor: default;
  color: var(--muted);
}

.highlight-kicker {
  grid-column: 1 / -1;
  color: var(--select);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.highlight-name {
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.highlight-metric {
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 1.1;
  text-align: right;
}

.highlight-metric.pos {
  color: var(--green);
}

.highlight-metric.neg {
  color: var(--red);
}

.highlight.overdue {
  border-color: var(--epic);
  background: #221c14;
}

.highlight.overdue .highlight-kicker,
.highlight.overdue .highlight-metric {
  color: var(--epic);
}

.highlight.overdue:hover,
.highlight.overdue:focus-visible,
.highlight.overdue.selected {
  border-color: var(--epic);
}

.price-btn,
.band-lead,
.row,
.card,
.activity-row,
.detail-close {
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.card.selected::before,
.row.selected::before,
.activity-row.selected::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--select);
}

.card,
.row,
.activity-row {
  position: relative;
}

.featured {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.featured:empty {
  display: none;
  margin: 0;
}

.card {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
}

.featured .card {
  padding: 8px 10px;
  border-radius: 7px;
  overflow: hidden;
}

.card.overdue {
  border-color: var(--epic);
  background: #221c14;
}

.card.hot {
  border-color: var(--line);
}

.card:hover,
.card:focus-visible,
.row:hover:not(.head),
.row:focus-visible,
.activity-row:hover,
.activity-row:focus-visible {
  outline: none;
}

.card:hover,
.card:focus-visible {
  border-color: var(--hover);
}

.card.overdue:hover,
.card.overdue:focus-visible {
  border-color: var(--epic);
}

.badge {
  display: inline-block;
  flex-shrink: 0;
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 11px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.badge.hot {
  background: #3a2e18;
  color: var(--amber);
  border: 1px solid var(--amber);
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
}

.card-title-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.card > .card-title-row {
  flex-shrink: 0;
}

.hero {
  margin-top: 8px;
}

.featured .hero {
  margin-top: 3px;
}

.hero-num {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.featured .hero-num {
  font-size: 18px;
}

.hero-label {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.featured .hero-label {
  font-size: 10px;
}

.card h3 {
  margin: 0;
  min-width: 0;
  flex: 1;
  font-size: 15px;
  line-height: 1.3;
  overflow: visible;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.featured .card h3 {
  font-size: 13px;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.detail-title {
  margin: 0;
  min-width: 0;
  flex: 1;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.star {
  flex-shrink: 0;
  background: none;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  width: 44px;
  height: 44px;
  margin: -12px -10px -12px 0;
  padding: 0;
  display: grid;
  place-items: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.star:hover,
.star:focus-visible {
  color: var(--select);
  outline: none;
}

.star.on {
  color: #f0c85c;
  text-shadow: 0 0 10px rgba(240, 200, 92, 0.55);
}

.star.on:hover,
.star.on:focus-visible {
  color: #ffd76a;
}

.card-meta,
.card-details,
.stat-sub,
.detail-meta {
  color: var(--muted);
  font-size: 12px;
}

.card-meta {
  margin-top: 2px;
}

.featured .card-meta {
  font-size: 11px;
}

.card-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px 10px;
  margin-top: 10px;
}

.featured .card-stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px 6px;
  margin-top: 6px;
}

.featured .card-stat {
  min-width: 0;
}

.card-stat-num {
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.featured .card-stat-num {
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-stat-label {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  min-height: 2.4em;
}

.featured .card-stat-label {
  min-height: 0;
  font-size: 9px;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.signals {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.chip {
  background: var(--chip);
  border-radius: 999px;
  padding: 2px 8px;
  font-variant-numeric: tabular-nums;
}

.chip.signal.overdue,
.chip.signal.hot_ev,
.chip.signal.juicy,
.chip.signal.hot {
  color: var(--epic);
}

.chip.signal.closing {
  color: var(--amber);
}

.chip.signal.empty {
  color: var(--muted);
}

.meter {
  margin-top: 10px;
  height: 5px;
  background: var(--chip);
  border-radius: 99px;
  overflow: hidden;
}

.card .meter {
  margin-top: 10px;
  flex-shrink: 0;
}

.featured .card .meter {
  margin-top: 6px;
  height: 4px;
}

.row .meter {
  margin-top: 0;
}

.meter span {
  display: block;
  height: 100%;
  background: #5b564b;
}

.meter span.over {
  background: var(--epic);
}

.meter .fill-0 { width: 0%; }
.meter .fill-5 { width: 5%; }
.meter .fill-10 { width: 10%; }
.meter .fill-15 { width: 15%; }
.meter .fill-20 { width: 20%; }
.meter .fill-25 { width: 25%; }
.meter .fill-30 { width: 30%; }
.meter .fill-35 { width: 35%; }
.meter .fill-40 { width: 40%; }
.meter .fill-45 { width: 45%; }
.meter .fill-50 { width: 50%; }
.meter .fill-55 { width: 55%; }
.meter .fill-60 { width: 60%; }
.meter .fill-65 { width: 65%; }
.meter .fill-70 { width: 70%; }
.meter .fill-75 { width: 75%; }
.meter .fill-80 { width: 80%; }
.meter .fill-85 { width: 85%; }
.meter .fill-90 { width: 90%; }
.meter .fill-95 { width: 95%; }
.meter .fill-100 { width: 100%; }

.watchlist {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: auto;
}

.watchlist:empty {
  display: none;
}

.row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1.5fr) 4.2rem 4.2rem 5.2rem 5.4rem 1.5rem;
  gap: 8px;
  align-items: center;
  width: 100%;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
}

.row:last-child {
  border-bottom: 0;
}

.row.head {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: default;
}

.row:hover:not(.head),
.row.selected {
  background: var(--panel-2);
}

.row .num {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.row-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.code {
  color: var(--muted);
}

.pip {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--line);
}

.pip.hot {
  background: var(--amber);
  outline: 1px solid #7a6233;
  outline-offset: 1px;
}

.pip.overdue,
.pip.epic {
  background: var(--epic);
}

.empty {
  color: var(--muted);
  padding: 20px 10px;
}

.detail-empty {
  color: var(--muted);
  padding: 48px 16px;
  text-align: center;
}

.board-feed {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.board-feed > .detail-section:first-child {
  margin-top: 0;
}

.board-feed .board-pulls,
.board-feed .board-recent {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.board-feed .tape,
.board-feed .detail-epics {
  flex: 1;
  max-height: none;
  min-height: 0;
  overflow: auto;
}

.board-feed .tape-row,
.board-epic {
  cursor: pointer;
}

.board-feed .tape-row:hover,
.board-feed .tape-row:focus-visible {
  background: var(--panel-2);
  outline: none;
}

#detail-machine {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.detail-head {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
}

.detail-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.detail-close {
  color: var(--muted);
  padding: 2px 6px;
  border-radius: 6px;
}

.detail-close:hover,
.detail-close:focus-visible {
  color: var(--text);
  outline: none;
}

.detail-meta {
  margin-top: 4px;
}

.detail-section {
  margin-top: 16px;
}

.detail-section .count {
  margin: 4px 0 8px;
  font-size: 12px;
}

.detail-section .count:empty {
  display: none;
}

.detail-epics {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.detail-epic {
  display: grid;
  grid-template-columns: 3.8rem minmax(0, 1fr) 4.6rem 4.8rem;
  gap: 8px;
  align-items: baseline;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}

.board-epic {
  grid-template-columns: 3.8rem minmax(0, 0.9fr) minmax(0, 1.1fr) 4.8rem;
}

.board-epic .machine {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}

.board-epic:hover,
.board-epic:focus-visible {
  background: var(--panel-2);
  outline: none;
}

.detail-epic:last-child {
  border-bottom: 0;
}

.detail-epic .ago {
  color: var(--muted);
}

.detail-epic .card-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-epic .value {
  text-align: right;
}

.hist-svg {
  width: 100%;
  height: 9.5rem;
  display: block;
}

.hist-svg .bar {
  fill: #8d7348;
}

.hist-svg .bar:hover {
  fill: var(--epic);
}

.hist-svg .count {
  fill: var(--text);
  font-size: 9px;
}

.hist-svg .axis {
  fill: var(--muted);
  font-size: 9px;
}

.hist-svg .axis-line {
  stroke: var(--line);
  stroke-width: 1;
}

.activity-block {
  flex-shrink: 0;
  margin-bottom: 12px;
}

.activity-block .section-head {
  margin-top: 0;
}

.activity-block[hidden] {
  display: none;
}

.activity {
  overflow: auto;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
  max-height: 8.5rem;
}

.activity-row {
  display: grid;
  grid-template-columns: 4.6rem minmax(0, 1fr) 4.4rem 3.4rem;
  gap: 8px;
  align-items: baseline;
  width: 100%;
  padding: 5px 8px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.activity-row:last-child {
  border-bottom: 0;
}

.activity-row:hover,
.activity-row:focus-visible {
  background: var(--panel-2);
}

.activity-kind {
  font-size: 10px;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.activity-row.restock .activity-kind {
  color: var(--green);
}

.activity-row.pool .activity-kind {
  color: var(--amber);
}

.activity-row.hot .activity-kind {
  color: var(--amber);
}

.activity-row.epic .activity-kind,
.activity-row.epic .activity-body,
.activity-row.epic .activity-value {
  color: var(--epic);
}

.activity-body {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-value {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.activity-row .ago {
  color: var(--muted);
  text-align: right;
}

.tape {
  overflow: auto;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
  max-height: 16rem;
}

.tape-row {
  display: grid;
  grid-template-columns: 8px 3.8rem minmax(0, 1fr) 4.4rem;
  gap: 8px;
  align-items: center;
  padding: 5px 8px;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}

.tape-row:last-child {
  border-bottom: 0;
}

.tape-row .machine {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tape-row .value {
  text-align: right;
}

.tape-row .ago {
  color: var(--muted);
}

.tape-row.epic .machine,
.tape-row.epic .value {
  color: var(--epic);
}

.tape-row.fresh,
tbody tr.fresh,
.activity-row.fresh {
  animation: flash 2.4s ease-out;
}

@keyframes flash {
  from { background: rgba(196, 185, 166, 0.18); }
  to { background: transparent; }
}

.epic-block {
  min-height: 12rem;
  display: flex;
  flex-direction: column;
}

.epic-block .table-wrap {
  flex: 1;
  max-height: none;
  min-height: 16rem;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 7px 8px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

tbody tr:nth-child(even) {
  background: var(--panel-2);
}

th {
  position: sticky;
  top: 0;
  background: var(--panel);
  color: var(--muted);
  font-weight: 600;
  z-index: 1;
}

.sort-row th {
  cursor: pointer;
  user-select: none;
}

.sort-row th:hover,
.sort-row th:focus {
  color: var(--text);
  outline: none;
}

.filter-row th {
  padding: 4px 6px;
  font-weight: 400;
}

.filter-row input {
  width: 100%;
  min-width: 4.5rem;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  padding: 4px 6px;
  font: inherit;
}

a {
  color: var(--text);
}

#older {
  margin-top: 8px;
}

.donate {
  flex-shrink: 0;
  padding: 8px 16px 10px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: #181a20;
  color: var(--text);
  font-size: 13px;
  text-align: center;
}

.donate-copy {
  text-align: center;
}

.donate p {
  margin: 0;
}

.donate p + p {
  margin-top: 4px;
  color: var(--select);
  font-size: 12px;
}

.donate button {
  background: none;
  border: 0;
  color: var(--epic);
  font: 12px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace;
  cursor: pointer;
  padding: 0;
  word-break: break-all;
}

.donate button:hover,
.donate button:focus-visible {
  color: var(--text);
  outline: none;
}

@media (prefers-reduced-motion: reduce) {
  .tape-row.fresh,
  tbody tr.fresh,
  .activity-row.fresh {
    animation: none;
  }
}

@media (max-width: 1100px) {
  html,
  body {
    height: auto;
    min-height: 100dvh;
    overflow: auto;
  }

  body {
    display: flex;
    flex-direction: column;
  }

  .bar {
    flex-wrap: wrap;
    gap: 8px 12px;
    padding: 10px 12px;
    padding-top: max(10px, env(safe-area-inset-top));
  }

  .brand h1 {
    font-size: 18px;
  }

  .status {
    flex: 1 1 100%;
    order: 3;
    gap: 8px 16px;
  }

  .epic-stat-value {
    font-size: 15px;
  }

  .tg-join,
  .view-toggle {
    margin-left: 0;
  }

  .view-toggle button,
  .layout-toggle button,
  .toolbar button,
  .toolbar select,
  .price-pills button,
  #favorites-filter,
  #older {
    min-height: 40px;
    padding: 8px 12px;
    touch-action: manipulation;
  }

  .toolbar input,
  .filter-row input {
    font-size: 16px;
    min-height: 40px;
  }

  .toolbar input {
    width: 100%;
    flex: 1 1 12rem;
  }

  .section-head {
    align-items: stretch;
  }

  .toolbar {
    width: 100%;
  }

  .price-pills,
  .filter-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .price-pills::-webkit-scrollbar,
  .filter-chips::-webkit-scrollbar {
    display: none;
  }

  .price-pills button,
  .chip-filter {
    flex: 0 0 auto;
  }

  .workspace {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
  }

  .scan {
    order: 2;
    overflow: visible;
    padding: 10px 12px 16px;
  }

  .detail {
    order: 1;
    border-left: 0;
    border-bottom: 2px solid #4a4538;
    max-height: min(28vh, 14rem);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .board-feed {
    overflow: visible;
  }

  .board-feed .board-pulls,
  .board-feed .board-recent {
    flex: none;
  }

  .board-feed .board-recent {
    display: none;
  }

  .board-feed .tape,
  .board-feed .detail-epics {
    max-height: 11rem;
  }

  .watch-section {
    flex: none;
    overflow: visible;
  }

  .featured {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 168px), 1fr));
    gap: 7px;
  }

  .highlights {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 10px;
  }

  .highlight {
    padding: 8px 10px;
  }

  .highlight-metric {
    font-size: 15px;
  }

  .highlight-name {
    font-size: 11px;
  }

  .filter-row {
    display: none;
  }

  .scan-sticky {
    position: static;
  }

  .activity {
    max-height: 6.5rem;
  }

  .row {
    grid-template-columns: 10px minmax(0, 1fr) 3.8rem 1.5rem;
    min-width: 0;
  }

  .row > .num:nth-child(4),
  .row > .num:nth-child(5),
  .row > .num:nth-child(6) {
    display: none;
  }

  .row.head > :nth-child(4),
  .row.head > :nth-child(5),
  .row.head > :nth-child(6) {
    display: none;
  }

  .detail-epic {
    grid-template-columns: 3.4rem minmax(0, 1fr) 4.4rem;
  }

  .detail-epic .num {
    display: none;
  }

  .board-epic {
    grid-template-columns: 3.2rem minmax(0, 0.9fr) minmax(0, 1.1fr) 4.2rem;
  }

  .activity-row {
    grid-template-columns: 4.2rem minmax(0, 1fr) 4.2rem 3.2rem;
  }

  .history-view {
    overflow: auto;
    padding: 10px 12px 16px;
  }

  .epic-block .table-wrap {
    max-height: none;
    min-height: 18rem;
  }

  body.machine-open {
    height: 100dvh;
    overflow: hidden;
  }

  body.machine-open .scan,
  body.machine-open .history-view {
    display: none;
  }

  body.machine-open .donate {
    display: none;
  }

  body.machine-open .detail {
    order: 2;
    flex: 1;
    min-height: 0;
    max-height: none;
    border-bottom: 0;
    overflow: auto;
  }

  body.machine-open #detail-machine {
    overflow: visible;
  }

  .detail-close {
    min-height: 40px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    background: var(--panel);
  }
}

@media (max-width: 560px) {
  .logo {
    width: 28px;
    height: 28px;
  }

  .brand h1 {
    font-size: 16px;
  }

  .tg-join span,
  .tg-join {
    font-size: 12px;
  }

  .detail .card-stats {
    grid-template-columns: 1fr 1fr;
  }

  .detail .card-stats > :last-child {
    grid-column: 1 / -1;
  }

  .layout-toggle {
    display: none;
  }
}
