:root {
  --bg: #ffffff;
  --text: #121213;
  --muted: #787c7e;
  --line: #e3e5e8;
  --empty: #d3d6da;
  --empty-active: #878a8c;
  --soft: #f3f4f6;

  --exact: #6aaa64;
  --close: #c9b458;
  --wrong: #787c7e;
  --on-tile: #ffffff;
  --up: #2f9e44;
  --down: #e03131;

  --sheet: #ffffff;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.18);

  --w: 600px; /* game column; the board inside decides the real width */
  /* One size and corner radius for every button and text field. */
  --ctl-h: 48px;
  --radius: 10px;
  --radius-sm: 6px;
  /* chart row and hint row: same height, corners, fill and padding */
  --row-h: 40px;
  --row-gap: 8px;
  /* Tile size: as large as fits 6 rows, but never below 44px on computers, so the
     board zooms with the rest of the page (zooming in shrinks 100dvh). */
  --tsmax: clamp(44px, calc((100dvh - 470px) / 6), 64px);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121213;
    --text: #f8f8f8;
    --muted: #8e9093;
    --line: #2c2c2e;
    --empty: #3a3a3c;
    --empty-active: #565758;
    --soft: #1e1e20;
    --exact: #538d4e;
    --close: #b59f3b;
    --wrong: #3a3a3c;
    --up: #51cf66;
    --down: #ff6b6b;
    --sheet: #1a1a1b;
    --shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  }
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  background: var(--bg);
  color: var(--text);
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

body.modal-open {
  overflow: hidden;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
}

.hidden {
  display: none !important;
}

/* ---------- Header ---------- */

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: calc(60px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(8px, env(safe-area-inset-right)) 0 max(8px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
}

.topbar-side.right {
  display: flex;
  justify-content: flex-end;
}

.title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.title a {
  color: inherit;
  text-decoration: none;
}

.icon-btn {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  color: var(--text);
  transition: background 120ms ease, opacity 120ms ease;
}

.icon-btn:active {
  opacity: 0.5;
}

.icon-btn:hover,
.icon-btn.active {
  background: var(--soft);
}

a.mode-btn {
  text-decoration: none;
}

/* ---------- Game layout ---------- */

.game {
  flex: 1;
  width: 100%;
  max-width: var(--w);
  margin: 0 auto;
  padding: 12px 16px 0;
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}

.modes {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 3px;
}

.mode-btn {
  font-size: 11.5px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--muted);
}

.mode-btn.active {
  color: var(--text);
  font-weight: 700;
}

.mode-btn:hover {
  color: var(--text);
}

.mode-sep {
  color: var(--muted);
  font-size: 11px;
}

/* ---------- Board ---------- */

/* Land | Sektor | Bransje | Mcap | P/E | EV/EBITDA | Fond | Stiftet
   Eight equal, square tiles (Wordle style). The board is a size container, so
   text and icons scale with the tile (cqi units). */
/* score line, board and everything in the bottom bar span exactly the width
   of the squares, so the whole game reads as one column */
.board,
.help-board,
.hud,
.dock > #ytd,
.dock > .entry,
.dock > .done-bar {
  width: min(100%, calc(var(--tsmax) * 8 + 28px));
  margin: 0 auto;
  container-type: inline-size;
}

.board-head,
.tiles {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 4px;
}

.board-head span {
  font-size: clamp(6px, 1.75cqi, 9px);
  font-weight: 700;
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: 0;
  color: var(--muted);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  align-self: end;
}

/* Very narrow board (short phones): drop the unit, let EV/EBITDA wrap. */
@container (max-width: 330px) {
  .board-head span { white-space: normal; }
  .board-head small { display: none; }
}

/* unit after a column name, e.g. MCAP (NOK) */
.board-head small {
  font-size: 0.78em;
  font-weight: 600;
  opacity: 0.6;
}

.board-head {
  padding-bottom: 2px;
  margin-bottom: 4px;
}

.row {
  margin-top: 6px;
}

.row-name {
  height: 18px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}

.logo {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  flex-shrink: 0;
  object-fit: contain;
  background: #fff;
}

.logo-fallback {
  display: inline-grid;
  place-items: center;
  font-size: 10px;
  font-weight: 800;
  background: var(--soft);
  color: var(--muted);
}

.row-name .nm {
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-name .tk {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}

.row-name em {
  font-style: normal;
  color: var(--muted);
}

.tile {
  aspect-ratio: 1;
  border-radius: 0;
  border: 1.5px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  text-align: center;
  line-height: 1.1;
  user-select: none;
  min-width: 0;
}

.row.active .tile {
  border-color: var(--empty);
}

.tile b {
  font-size: clamp(9.5px, 3.3cqi, 15px);
  font-weight: 800;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.tile.small b {
  font-size: clamp(7px, 2.2cqi, 10.5px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: 0;
  padding: 0 2px;
  white-space: normal;
  overflow-wrap: normal;
  hyphens: manual;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}

.tile.fund b {
  font-size: clamp(8.5px, 2.75cqi, 13px);
  letter-spacing: 0;
}

.tile i {
  display: block;
  line-height: 0;
  margin-top: 2px;
}

.flag {
  display: block;
  width: clamp(16px, 6.2cqi, 30px);
  height: auto;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.s-answer .flag,
.tile .flag {
  margin: 1px 0 2px;
}

.tile i.na {
  font-style: normal;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  opacity: 0.85;
}

.tile i svg {
  width: clamp(9px, 3.5cqi, 16px);
  height: auto;
}

/* 2–3 arrows = the answer is at least 2× / 3× away (or 20 / 50 years). */
.tile i.arr {
  display: flex;
  justify-content: center;
}

.tile i.arr.n2 svg,
.tile i.arr.n3 svg {
  width: clamp(7.5px, 2.7cqi, 13px);
  margin: 0 -1.5px;
}

.s-exact,
.s-close,
.s-wrong {
  color: var(--on-tile);
  border-color: transparent;
}
.s-exact { background: var(--exact); }
.s-close { background: var(--close); }
.s-wrong { background: var(--wrong); }
.s-answer {
  background: transparent;
  border-color: var(--exact);
  color: var(--exact);
}

.row-name .tag {
  margin-left: auto;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--exact);
}

.tile.flip {
  animation: flip 500ms ease-in-out both;
}

.row.win .tile.flip {
  animation: flip 500ms ease-in-out both, bounce 420ms ease-in-out;
}

@keyframes flip {
  0%,
  49% {
    background: transparent;
    border-color: var(--empty-active);
    color: transparent;
  }
  0% { transform: rotateX(0); }
  50% { transform: rotateX(-90deg); }
  100% { transform: rotateX(0); }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  40% { transform: translateY(-16px); }
  70% { transform: translateY(3px); }
}

.shake {
  animation: shake 420ms ease;
}

@keyframes shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(3px); }
  30%, 50%, 70% { transform: translateX(-5px); }
  40%, 60% { transform: translateX(5px); }
}

/* ---------- Hints ---------- */

.hints {
  display: grid;
  /* city | sector · bransje | logo, spanning the same width as the chart */
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) var(--row-h);
  gap: var(--row-gap);
  margin-bottom: var(--row-gap);
}

.hints:empty {
  display: none;
}

.chip,
.ytd {
  height: var(--row-h);
  padding: 0 12px;
  border-radius: var(--radius-sm);
  background: var(--soft);
}

.chip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  animation: pop 220ms ease;
}

.ytd {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: var(--row-gap);
}

.ytd svg {
  flex: 1;
  min-width: 0;
  height: 100%;
  overflow: visible;
}

.ytd polyline {
  fill: none;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.ytd .area {
  stroke: none;
  opacity: 0.12;
}

.ytd .zero {
  stroke: var(--muted);
  stroke-width: 1;
  stroke-dasharray: 2 3;
  opacity: 0.6;
  vector-effect: non-scaling-stroke;
}

.ytd.up polyline { stroke: var(--up); }
.ytd.down polyline { stroke: var(--down); }
.ytd.up .area { fill: var(--up); }
.ytd.down .area { fill: var(--down); }
.ytd.up b { color: var(--up); }
.ytd.down b { color: var(--down); }

.ytd-label {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.1;
  flex-shrink: 0;
}

.ytd-label b {
  font-size: 15px;
  font-weight: 800;
}

.ytd-label small {
  font-size: 10px;
  color: var(--muted);
}

.hint-logo {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  object-fit: contain;
  background: #fff;
}

.hint-logo {
  transition: filter 300ms ease;
}

.hint-logo.blur {
  filter: blur(2.5px);
}

.hint-logo.blur.grey {
  filter: blur(2.5px) grayscale(1);
}

.chip.city {
  justify-content: flex-start;
  text-overflow: ellipsis;
}

.chip.industry {
  justify-content: flex-start;
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
}

.chip.logo-slot {
  width: var(--row-h);
  padding: 0;
}

.hint-logo.none {
  background: none;
}

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

@keyframes pop {
  from { transform: scale(0.85); opacity: 0; }
}

/* ---------- Entry ---------- */

/* computers: the bar follows right under the board (and sticks to the bottom
   edge when the board is taller than the window); phones pin it to the bottom */
.dock {
  position: sticky;
  bottom: 0;
  margin-top: 6px;
  padding-top: 14px;
  background: var(--bg);
  z-index: 10;
}

.entry {
  position: relative;
}

.entry-row {
  display: flex;
  gap: 8px;
}

.guess-input,
.lb-form input {
  flex: 1;
  min-width: 0;
  height: var(--ctl-h);
  padding: 0 14px 0 38px;
  font: inherit;
  font-size: 16px; /* prevents iOS zoom */
  font-weight: 500;
  color: var(--text);
  background: var(--soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 13px center / 16px;
  border: 0;
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 1.5px transparent;
  outline: none;
  -webkit-appearance: none;
  transition: box-shadow 120ms ease;
}

.lb-form input {
  padding-left: 14px;
  background-image: none;
}

.guess-input:focus,
.lb-form input:focus {
  box-shadow: inset 0 0 0 1.5px var(--empty-active);
}

.guess-input::placeholder {
  color: var(--muted);
}

/* fixed width, so "Hint" / "Gi opp" never shifts the input */
.hint-btn {
  flex: 0 0 88px;
  padding: 0;
}

/* cost of the next hint as a small red exponent: Hint⁻⁵ */
.hint-btn sup {
  position: relative;
  top: -0.55em;
  margin-left: 1px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  color: var(--down);
}

.hint-btn.danger {
  color: var(--down);
}

.ac {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 6px);
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
  z-index: 20;
}

.ac-row {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  border-top: 1px solid var(--line);
}

.ac-row:first-child {
  border-top: 0;
}

.ac-row.active,
.ac-row:hover {
  background: var(--soft);
}

.ac-row .logo {
  width: 20px;
  height: 20px;
}

.ac-name {
  flex: 1;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ac-tick {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.ac-empty {
  padding: 14px;
  text-align: center;
  color: var(--muted);
}

.done-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 0 4px 0 6px;
}

.done-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.done-info b {
  font-size: 17px;
  font-weight: 800;
}

.done-info span {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.source {
  font-size: 10px;
  color: var(--muted);
  text-align: center;
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
}

/* ---------- Buttons ----------
   Three kinds, one size: primary (green), secondary (soft grey, also Hint)
   and plain text links. Icon buttons are the rounded squares in the header. */

.primary-btn,
.ghost-btn,
.hint-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: var(--ctl-h);
  padding: 0 18px;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  text-decoration: none;
  transition: transform 120ms ease, filter 120ms ease, background 120ms ease;
}

.primary-btn {
  background: var(--exact);
  color: #fff;
}

.ghost-btn,
.hint-btn {
  background: var(--soft);
  color: var(--text);
}

.primary-btn:hover {
  filter: brightness(1.06);
}

.ghost-btn:hover,
.hint-btn:hover {
  background: var(--line);
}

.primary-btn:active,
.ghost-btn:active,
.hint-btn:active {
  transform: scale(0.97);
}

.primary-btn:disabled,
.ghost-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.link-btn {
  display: block;
  margin: 18px auto 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.link-btn:hover {
  color: var(--text);
}

/* ---------- Modals ---------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.45);
  display: grid;
  place-items: center;
  padding: 16px;
  animation: fade 160ms ease;
}

.sheet {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  background: var(--sheet);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 28px 22px 22px;
  animation: rise 220ms ease;
}

@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(16px); opacity: 0; } }

.close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  font-size: 20px;
  line-height: 1;
  color: var(--muted);
  border-radius: 50%;
  background: var(--soft);
}

.close-btn:hover {
  color: var(--text);
}


/* help */
.help-lead {
  font-size: 16px;
  margin-bottom: 8px;
}



code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88em;
  background: var(--soft);
  padding: 1px 5px;
  border-radius: 4px;
}

.help-example {
  margin: 14px 0 18px;
}

.help-example .tile i {
  font-style: normal;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
}

.legend {
  list-style: none;
  display: grid;
  gap: 9px;
  font-size: 14px;
  margin-bottom: 16px;
}

.legend li {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sw,
.sw-txt {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 3px;
}

.sw-txt {
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
  white-space: nowrap;
}

.help-sub {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 4px 0 10px;
}

.legend .sw-txt {
  width: auto;
  min-width: 30px;
  letter-spacing: -0.08em;
}

.help-foot {
  font-size: 13px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

/* stats */
.kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  text-align: center;
  margin-bottom: 22px;
}

.score-kpis {
  grid-template-columns: repeat(2, 1fr);
  margin: 22px 0 0;
}

.kpis b {
  display: block;
  font-size: 32px;
  font-weight: 500;
  line-height: 1.1;
}

.kpis span {
  font-size: 12px;
  color: var(--text);
}


.dist {
  display: grid;
  gap: 4px;
}

.dist-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
}

.dist-row > span {
  width: 12px;
  font-weight: 600;
}

.bar {
  background: var(--wrong);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-align: right;
  padding: 2px 8px;
  min-width: 24px;
}

.bar.cur {
  background: var(--exact);
}


/* calendar */

.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  text-transform: capitalize;
}

.icon-btn.sm {
  width: 36px;
  height: 36px;
  font-size: 22px;
  line-height: 1;
}

.icon-btn:disabled {
  opacity: 0.25;
  cursor: default;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-dow {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
  padding-bottom: 2px;
}

.cal-day {
  aspect-ratio: 1;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  background: var(--soft);
  position: relative;
}

.cal-day.empty {
  background: none;
}

.cal-day:disabled {
  background: none;
  color: var(--muted);
  opacity: 0.4;
  cursor: default;
}

.cal-day.won { background: var(--exact); color: #fff; }
.cal-day.lost { background: var(--wrong); color: #fff; }
.cal-day.started { box-shadow: inset 0 0 0 2px var(--close); }
.cal-day.today::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 4px;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  border-radius: 50%;
  background: currentColor;
}
.cal-day.selected { outline: 2px solid var(--text); outline-offset: 1px; }

.cal-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 14px;
  font-size: 12px;
  color: var(--muted);
}

.cal-legend span {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-left: 8px;
}

.cal-legend .won { background: var(--exact); }
.cal-legend .lost { background: var(--wrong); }
.cal-legend .started { box-shadow: inset 0 0 0 2px var(--close); }

/* ---------- Finished rounds ---------- */

/* the chart is only useful while guessing */
body.done #ytd {
  display: none;
}

/* lost: guesses + the answer row = up to 7 rows; size the tiles for seven */
body.reveal {
  --tsmax: clamp(30px, calc((100dvh - 410px) / 7), 56px);
}

@media (min-width: 600px) {
  body.reveal {
    --tsmax: clamp(40px, calc((100dvh - 410px) / 7), 64px);
  }
}

/* ---------- Score (HUD) ---------- */

.hud {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 20px;
  margin: 0 auto 8px;
  font-variant-numeric: tabular-nums;
}

.hud-time {
  width: 30px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
}

.hud-track {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--soft);
  overflow: hidden;
}

.hud-track i {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: var(--exact);
  transition: width 400ms ease, background 300ms ease;
}

.hud.mid .hud-track i { background: var(--close); }
.hud.low .hud-track i { background: var(--down); }
.hud.lost .hud-track i { background: var(--wrong); }

.hud-score {
  min-width: 30px;
  text-align: right;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.hud.won .hud-score { color: var(--exact); }

.hud-pop {
  position: absolute;
  right: 0;
  top: -2px;
  font-size: 13px;
  font-weight: 800;
  color: var(--down);
  pointer-events: none;
  animation: pop-up 1s ease forwards;
}

.hud-pop.tick {
  font-size: 11px;
  font-weight: 700;
  opacity: 0.7;
  animation-duration: 0.9s;
}

@keyframes pop-up {
  0% { transform: translateY(6px); opacity: 0; }
  20% { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(-18px); opacity: 0; }
}

/* ---------- Start screen ---------- */

.start {
  display: none;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px 4px 40px;
}

body.pre-start .start { display: flex; }
/* the leaderboard waits until the game has started */
body.pre-start .lb-mini,
body.pre-start .lb-btn { display: none !important; }
body.pre-start .board,
body.pre-start .dock,
body.pre-start .hud { display: none; }

.start-title {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin: 6px 0 8px;
}

.start-lead {
  font-size: 15px;
  color: var(--muted);
  max-width: 290px;
  margin-bottom: 18px;
}

/* example game: same tiles as the board, scaled to the box */
.start-example {
  width: min(100%, max(340px, calc(var(--tsmax) * 6.5)));
  container-type: inline-size;
  text-align: left;
}

.start-ex-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-align: center;
  margin-bottom: 8px;
}

.start-example .row {
  margin-top: 4px;
}

.start-example .board-head {
  margin-bottom: 0;
}

.start-example .row-name .tk {
  font-weight: 500;
}

.start-key {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px;
  margin: 10px 0 22px;
  font-size: 12px;
  color: var(--muted);
}

.start-key .k {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  margin-left: 6px;
}

.start-key .k:first-child {
  margin-left: 0;
}

.start-key .k-sep {
  margin: 0 4px;
}

.start-points {
  max-width: 320px;
  margin: 0 auto 22px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--muted);
}

.primary-btn.start-btn {
  width: 100%;
  max-width: 320px;
}

/* ---------- Mini leaderboard (top left) ---------- */

.topbar-side:first-child {
  display: flex;
  align-items: center;
  gap: 6px;
}

.lb-mini {
  display: none;
  position: fixed;
  z-index: 60;
  top: calc(66px + env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  width: 180px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--sheet);
  box-shadow: var(--shadow), 0 0 0 1px var(--line);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  animation: pop 160ms ease;
}

.lb-mini.open { display: block; }

.lb-mini-head {
  display: block;
  margin-bottom: 6px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.lb-mini ol {
  list-style: none;
  display: grid;
  gap: 3px;
}

.lb-mini li {
  display: flex;
  align-items: baseline;
  gap: 7px;
}

.lb-mini em {
  min-width: 12px;
  font-style: normal;
  font-weight: 700;
  font-size: 11px;
  color: var(--muted);
}

.lb-mini span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.lb-mini li b { font-weight: 800; }
.lb-mini li:first-child b { color: var(--exact); }
.lb-mini li.me span { text-decoration: underline; text-underline-offset: 2px; }

.lb-mini-note {
  font-size: 12px;
  color: var(--muted);
}

/* Wide screens: when open, the board just sits in the corner (no popover look). */
@media (min-width: 880px) {
  .lb-mini {
    box-shadow: none;
    background: none;
    padding: 4px 6px;
    animation: none;
  }
}

/* ---------- Result sheet ---------- */

.result-sheet {
  padding: 22px 20px 18px;
}

.rs-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-right: 36px;
}

.rs-logo {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 8px;
  object-fit: contain;
  background: #fff;
  box-shadow: 0 0 0 1px var(--line);
}

.rs-logo.logo-fallback {
  display: grid;
  place-items: center;
  font-size: 20px;
}

.rs-id {
  min-width: 0;
}

.rs-name {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rs-name a {
  color: inherit;
  text-decoration: none;
}

.rs-name a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.rs-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
}

.rs-sub .flag {
  width: 15px;
  border-radius: 2px;
  flex-shrink: 0;
}

.rs-sub span + span::before {
  content: "·";
  margin-right: 6px;
}

.rs-score {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 18px 0 6px;
}

.rs-pts {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.rs-pts b {
  font-size: 52px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--exact);
  font-variant-numeric: tabular-nums;
}

/* unsolved: a friendly message instead of a grey 0 */
.rs-score.lost {
  margin-bottom: 18px;
}

.rs-nice {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 14px;
  color: var(--muted);
}

.rs-nice b {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 4px;
}

.rs-pts span {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.rs-meta {
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-bottom: 16px;
}

.mini-grid {
  display: grid;
  gap: 2px;
}

.mini-row {
  display: flex;
  gap: 2px;
}

.mini {
  width: 9px;
  height: 9px;
  border-radius: 1.5px;
}

.mini.empty {
  box-shadow: inset 0 0 0 1px var(--empty);
}

.rs-actions {
  display: flex;
  gap: 8px;
}

.rs-actions button {
  flex: 1;
}

.rs-next {
  margin-top: 12px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

.rs-next b {
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* leaderboard inside the result sheet */
.lb {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin-bottom: 16px;
}

.lb-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
}

.lb-head b {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.lb-head small {
  font-size: 11px;
  color: var(--muted);
}

.lb-form {
  display: flex;
  margin-bottom: 8px;
}

.lb-list {
  list-style: none;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.lb-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 2px;
  border-bottom: 1px solid var(--line);
}

.lb-list li:last-child {
  border-bottom: 0;
}

.lb-list li.me span,
.lb-list li.me b {
  color: var(--exact);
}

.lb-list li.gap {
  border-top: 1px dashed var(--line);
  margin-top: 2px;
}

.lb-list em {
  width: 18px;
  font-style: normal;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.lb-list span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.lb-list b {
  font-weight: 800;
}

.lb-mini li.gap {
  margin-top: 6px;
}

.lb-note {
  justify-content: center;
  color: var(--muted);
  font-size: 12.5px;
}

/* ---------- Toast ---------- */

/* Status messages appear in the header, replacing the mode line briefly. */
.brand {
  position: relative;
}

.status {
  position: absolute;
  left: 50%;
  bottom: -1px;
  transform: translate(-50%, 4px);
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.status.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.status.win {
  color: var(--exact);
  font-size: 13px;
  animation: cheer 600ms ease;
}

.status.error {
  color: var(--down);
}

.brand.has-status .modes {
  opacity: 0;
  transition: opacity 120ms ease;
}

@keyframes cheer {
  0% { transform: translate(-50%, 4px) scale(0.6); }
  50% { transform: translate(-50%, 0) scale(1.15); }
  100% { transform: translate(-50%, 0) scale(1); }
}

/* ---------- Small screens ---------- */

@media (max-width: 420px) {
  /* sides size to their icons so the bar fits on small phones */
  .topbar { grid-template-columns: auto minmax(0, 1fr) auto; column-gap: 6px; }
  .topbar-side .icon-btn { width: 36px; height: 40px; }
  .topbar-side svg { width: 20px; height: 20px; }
}

@media (max-width: 380px) {
  .title { font-size: 22px; }
}

@media (max-height: 800px) {
  .row { margin-top: 4px; }
  :root { --row-h: 36px; }
  .dock { padding-top: 10px; }
}

@media (max-height: 680px) {
  .topbar { height: calc(52px + env(safe-area-inset-top)); }
  .title { font-size: 22px; }
  .game { padding-top: 8px; }
  .row-name { height: 16px; margin-bottom: 2px; font-size: 12px; }
  .tile i { margin-top: 0; }
  .source { padding-top: 4px; }
}

.confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 300;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
    transition: none !important;
  }
}

/* ---------- Data page ---------- */


.data-main {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 14px 16px 0;
}

.data-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.data-search {
  flex: 1 1 260px;
}

.data-filters {
  display: flex;
  gap: 2px;
}

.data-filters .mode-btn {
  font-size: 12.5px;
  padding: 6px 10px;
}

.data-filters .mode-btn.active {
  background: var(--soft);
}

.data-count {
  font-size: 12px;
  color: var(--muted);
  margin: 10px 0 6px;
}

/* The table scrolls inside its own box (sticky header, and any sideways
   scrollbar stays in view instead of at the very bottom of the page). */
.table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
  max-height: calc(100dvh - 200px);
  overscroll-behavior: contain;
}

.data-page {
  height: 100dvh;
  overflow: hidden;
}

.data-page .data-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.data-page .table-wrap {
  flex: 1;
  max-height: none;
  min-height: 0;
}

.dt {
  width: 100%;
  min-width: 320px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.dt th {
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 1;
  text-align: left;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--muted);
  padding: 9px 5px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
}

.dt th:hover,
.dt th.active {
  color: var(--text);
}

.dt th i {
  font-style: normal;
  margin-left: 2px;
}

.dt td {
  padding: 5px 5px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dt tr:last-child td {
  border-bottom: 0;
}

.dt tbody tr:hover td {
  background: var(--soft);
}

.dt .num {
  text-align: right;
}

/* column widths (table-layout: fixed) */
.dt [data-key="rank"] { width: 46px; }
.dt [data-key="name"] { width: auto; }
.dt [data-key="sector"] { width: 86px; }
.dt [data-key="sub"] { width: 96px; }
.dt [data-key="mcap"] { width: 58px; }
.dt [data-key="pe"] { width: 50px; }
.dt [data-key="ev"] { width: 72px; }
.dt [data-key="own"] { width: 56px; }
.dt [data-key="fund"] { width: 58px; }
.dt [data-key="ytd"] { width: 50px; }
.dt [data-key="founded"] { width: 56px; }

.dt th:first-child,
.dt td:first-child { padding-left: 12px; }
.dt th:last-child,
.dt td:last-child { padding-right: 12px; }

.dt .c-rank {
  color: var(--muted);
}

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

.dt-co .flag {
  width: 11px;
  border-radius: 1.5px;
  opacity: 0.9;
  flex-shrink: 0;
}

.dt-co .logo {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  flex-shrink: 0;
}

.dt-nm {
  min-width: 0;
}

.dt-nm b,
.dt-nm small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dt-nm b {
  font-weight: 600;
}

.dt-nm small {
  font-size: 10px;
  color: var(--muted);
}

.dt-fund {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
}

.dt .na {
  color: var(--muted);
}

.dt .pos { color: var(--up); font-weight: 600; }
.dt .neg { color: var(--down); font-weight: 600; }

@media (max-width: 780px) {
  .dt .p3 { display: none; }
}

@media (max-width: 560px) {
  .dt .p2 { display: none; }
  .dt { font-size: 12.5px; }
}

.dt-nm a {
  color: inherit;
  text-decoration: none;
}

.dt-nm a:hover b {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---------- Simple pages (help, calendar, stats) ---------- */

.page-main {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  padding: 28px 16px 40px;
}

.page-title {
  font-size: 15px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: center;
  margin-bottom: 22px;
}

.page-main .help-head {
  border: 0;
  margin: 18px 0 4px;
  padding: 0;
}

.page-main .help-example {
  margin-top: 0;
}

.page-cta {
  display: flex;
  margin-top: 24px;
}

.page-note {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  margin-top: 16px;
}

a.cal-day {
  display: grid;
  place-items: center;
  color: inherit;
  text-decoration: none;
}

.cal-day.off {
  display: grid;
  place-items: center;
  background: none;
  color: var(--muted);
  opacity: 0.35;
}

a.cal-day:hover {
  outline: 2px solid var(--empty-active);
  outline-offset: 1px;
}

a.nm {
  color: inherit;
  text-decoration: none;
}

a.nm:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.cal-nav a.icon-btn {
  text-decoration: none;
}

/* =====================================================================
   Phones: native-feeling chrome (iOS / Android style). A translucent top
   bar with one menu button, a bottom bar fixed to the screen edge, inset
   lists and hairline separators. Everything here is scoped to narrow
   screens; the desktop layout is untouched.
   ===================================================================== */

.menu-btn,
.back-btn,
.data-sort {
  display: none;
}

/* Phone menu (action sheet) */
.menu-overlay {
  place-items: end center;
  padding: 8px max(8px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  background: rgba(0, 0, 0, 0.32);
}

.menu-sheet {
  width: 100%;
  max-width: 440px;
  display: grid;
  gap: 8px;
  animation: sheet-up 300ms cubic-bezier(0.32, 0.72, 0, 1);
}

.menu-group {
  background: var(--sheet);
  border-radius: 14px;
  overflow: hidden;
}

.menu-row {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 54px;
  padding: 0 16px;
  font-size: 17px;
  color: var(--text);
  text-decoration: none;
}

.menu-row + .menu-row {
  box-shadow: inset 52px 0.5px 0 -51.5px var(--sep), inset 0 0.5px 0 var(--sep);
}

.menu-row svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  color: var(--muted);
}

.menu-row.current {
  font-weight: 600;
}

.menu-row:active {
  background: var(--soft);
}

.menu-check,
.menu-chev {
  margin-left: auto;
  font-style: normal;
}

.menu-check {
  color: var(--exact);
  font-weight: 700;
}

.menu-chev {
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
}

.menu-cancel {
  height: 56px;
  border-radius: 14px;
  background: var(--sheet);
  font-size: 17px;
  font-weight: 600;
  color: var(--exact);
}

@media (max-width: 599px) {
  :root {
    --fill: rgba(118, 118, 128, 0.12);
    --fill-strong: rgba(118, 118, 128, 0.2);
    --sep: rgba(60, 60, 67, 0.18);
    --bar: rgba(255, 255, 255, 0.84);
    --blur: blur(20px) saturate(180%);
    --pad: max(14px, env(safe-area-inset-left));
    --ctl-h: 44px;
    --row-h: 36px;
    /* phones: always fit the screen (pinch-zoom does not change the layout) */
    --tsmax: clamp(30px, calc((100dvh - 470px) / 6), 56px);
    --soft: var(--fill);
  }

  /* ---------- Top bar ---------- */

  .topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    grid-template-columns: 1fr auto 1fr;
    column-gap: 0;
    height: calc(50px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) max(4px, env(safe-area-inset-right)) 0 max(4px, env(safe-area-inset-left));
    background: var(--bar);
    -webkit-backdrop-filter: var(--blur);
    backdrop-filter: var(--blur);
    border-bottom: 0.5px solid var(--sep);
  }

  .desk {
    display: none !important;
  }

  .menu-btn,
  .back-btn {
    display: grid;
  }

  .topbar-side,
  .topbar-side.right {
    display: flex;
    align-items: center;
    gap: 0;
  }

  .topbar-side.right {
    justify-content: flex-end;
  }

  .topbar .icon-btn {
    background: none;
  }

  .topbar .icon-btn:hover,
  .topbar .icon-btn.active {
    background: none;
  }

  .topbar .lb-btn.active {
    color: var(--exact);
  }

  .topbar-side svg {
    width: 22px;
    height: 22px;
  }

  .title {
    font-size: 18px;
    letter-spacing: -0.02em;
  }

  .modes {
    margin-top: 1px;
  }

  .mode-btn {
    padding: 0 4px;
    font-size: 11px;
  }

  .mode-btn:active,
  .menu-cancel:active {
    opacity: 0.45;
  }

  a.cal-day:active {
    transform: scale(0.97);
  }

  .status {
    background: var(--sheet);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1), 0 0 0 0.5px var(--sep);
  }

  /* ---------- Game ---------- */

  .game {
    padding: 8px var(--pad) 0;
  }

  .hud {
    height: 18px;
    margin-bottom: 6px;
  }

  .hud-track {
    height: 4px;
    background: var(--fill);
  }

  /* bottom bar: flush with the screen edge, like a native toolbar */
  .dock {
    margin: auto calc(var(--pad) * -1) 0;
    padding: 8px var(--pad) max(6px, env(safe-area-inset-bottom));
    background: var(--bar);
    -webkit-backdrop-filter: var(--blur);
    backdrop-filter: var(--blur);
    border-top: 0.5px solid var(--sep);
  }

  .ytd-label b {
    font-size: 13px;
  }

  .ytd-label small {
    font-size: 9px;
  }

  .hint-logo {
    width: 20px;
    height: 20px;
  }

  .hint-btn {
    flex-basis: 80px;
  }

  .done-bar {
    min-height: 46px;
    padding: 0 2px;
  }

  .source {
    padding: 6px 0 0;
    font-size: 9px;
  }

  /* autocomplete: an inset list above the bar */
  .ac {
    left: 0;
    right: 0;
    bottom: calc(100% + 8px);
    border: 0;
    border-radius: 12px;
    background: var(--sheet);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.16), 0 0 0 0.5px var(--sep);
  }

  .ac-row {
    min-height: 48px;
    padding: 10px 14px;
    border-top: 0;
    box-shadow: inset 0 0.5px 0 var(--sep);
  }

  .ac-row:first-child {
    box-shadow: none;
  }

  .ac-row.active,
  .ac-row:hover {
    background: var(--fill);
  }

  /* start screen */

  /* corner leaderboard: popover under the top bar */
  .lb-mini {
    top: calc(54px + env(safe-area-inset-top));
    left: max(10px, env(safe-area-inset-left));
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.16), 0 0 0 0.5px var(--sep);
  }

  /* ---------- Sheets ---------- */

  .overlay {
    place-items: end center;
    padding: 0;
    background: rgba(0, 0, 0, 0.32);
  }

  .overlay.menu-overlay {
    padding: 8px max(8px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  }

  .sheet {
    max-width: none;
    max-height: calc(100dvh - 48px - env(safe-area-inset-top));
    border-radius: 14px 14px 0 0;
    padding: 26px max(20px, env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
    animation: sheet-up 300ms cubic-bezier(0.32, 0.72, 0, 1);
    overscroll-behavior: contain;
  }

  .sheet::before {
    content: "";
    position: absolute;
    top: 7px;
    left: 50%;
    width: 36px;
    height: 5px;
    margin-left: -18px;
    border-radius: 3px;
    background: var(--fill-strong);
  }

  /* ---------- Data page: a native list ---------- */

  .data-main {
    padding: 10px 0 0;
  }

  .data-tools {
    gap: 8px;
    padding: 0 var(--pad);
  }

  .data-search {
    flex-basis: 100%;
  }

  /* country filter = segmented control */
  .data-filters {
    flex: 1;
    padding: 2px;
    border-radius: 9px;
    background: var(--fill);
  }

  .data-filters .mode-btn {
    flex: 1;
    text-align: center;
    padding: 5px 2px;
    border-radius: 7px;
    font-size: 12.5px;
  }

  .data-filters .mode-btn.active {
    background: var(--sheet);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1), 0 0 0 0.5px var(--sep);
  }

  /* sorting uses the phone's own picker */
  .data-sort {
    display: block;
    height: 34px;
    padding: 0 26px 0 10px;
    border: 0;
    border-radius: 9px;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    -webkit-appearance: none;
    appearance: none;
    background: var(--fill) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E") no-repeat right 7px center / 14px;
  }

  .data-count {
    padding: 0 var(--pad);
    margin: 10px 0 4px;
  }

  .table-wrap {
    border: 0;
    border-top: 0.5px solid var(--sep);
    border-radius: 0;
  }

  /* no header row: the name takes the space, two numbers on the right */
  .dt thead {
    display: none;
  }

  .dt {
    table-layout: auto;
  }

  .dt td.c-name {
    width: 100%;
    max-width: 0;
  }

  .dt td.c-pe,
  .dt-co .flag {
    display: none;
  }

  .dt td.c-mcap,
  .dt td.c-ytd {
    width: 1%;
    padding-left: 12px;
  }

  .dt td {
    padding: 9px 6px;
    border-bottom: 0.5px solid var(--sep);
  }

  .dt td:first-child {
    padding-left: var(--pad);
  }

  .dt td:last-child {
    padding-right: var(--pad);
  }

  .dt-co .logo {
    width: 30px;
    height: 30px;
    border-radius: 7px;
  }

  .dt-nm b {
    font-size: 14px;
  }

  .data-page .source {
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }

  /* ---------- Simple pages ---------- */

  .page-main {
    padding: 8px max(16px, env(safe-area-inset-right)) calc(32px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  }

  /* large title */
  .page-title {
    text-align: left;
    text-transform: none;
    letter-spacing: -0.02em;
    font-size: 28px;
    margin: 6px 0 18px;
  }

  .kpis {
    padding: 14px 4px;
    border-radius: 12px;
    background: var(--fill);
  }

  .bar {
    border-radius: 4px;
  }

  .cal-day {
    border-radius: 8px;
  }

}

@media (max-width: 599px) and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fill: rgba(118, 118, 128, 0.24);
    --fill-strong: rgba(118, 118, 128, 0.34);
    --sep: rgba(84, 84, 88, 0.6);
    --bar: rgba(22, 22, 23, 0.84);
  }
}

/* No backdrop-filter: solid bars */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  @media (max-width: 599px) {
    .topbar,
    .dock {
      background: var(--bg);
    }
  }
}

@keyframes sheet-up {
  from { transform: translateY(100%); }
}

/* Touch screens: no sticky hover highlights after a tap */
@media (hover: none) {
  .topbar-side.right .icon-btn:hover:not(.active),
  .dt tbody tr:hover td {
    background: none;
  }
}
