@font-face {
  font-family: "Tab Mono";
  src: url("fonts/mono.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --base: #24273a;
  --mantle: #1e2030;
  --surface0: #363a4f;
  --overlay0: #6e738d;
  --text: #cad3f5;
  --subtext0: #a5adcb;
  --blue: #8aadf4;
  --teal: #8bd5ca;
  --green: #a6da95;
  --yellow: #eed49f;
  --peach: #f5a97f;
  --mauve: #c6a0f6;
  --pink: #f5bde6;
  --red: #ed8796;
  --accent: var(--blue);
  --mono: "Tab Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

:root[data-day="1"] { --accent: var(--blue); }
:root[data-day="2"] { --accent: var(--teal); }
:root[data-day="3"] { --accent: var(--green); }
:root[data-day="4"] { --accent: var(--yellow); }
:root[data-day="5"] { --accent: var(--peach); }
:root[data-day="6"] { --accent: var(--mauve); }
:root[data-day="7"] { --accent: var(--pink); }

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --base: #eff1f5;
    --mantle: #e6e9ef;
    --surface0: #ccd0da;
    --overlay0: #9ca0b0;
    --text: #4c4f69;
    --subtext0: #6c6f85;
    --blue: #1e66f5;
    --teal: #179299;
    --green: #40a02b;
    --yellow: #df8e1d;
    --peach: #fe640b;
    --mauve: #8839ef;
    --pink: #ea76cb;
    --red: #d20f39;
  }
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body {
  min-height: 100vh;
  overflow: hidden;
  background: var(--base);
  color: var(--text);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

main {
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 0 clamp(24px, 4vw, 64px);
}

.gap { flex: 1 1 0; min-height: 8px; }
.gap.below { flex-grow: 2; }
.top {
  flex: none;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 32px;
  padding-top: clamp(14px, 4vh, 32px); /* vertical space gives first on a short window */
}
.clock, .counter { color: var(--subtext0); font: 13px/1.4 var(--mono); }
.clock { text-align: right; }
.clock time {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  color: var(--text);
  font-size: clamp(28px, 3vw, 44px);
  font-weight: 500;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  transform: translateZ(0);
}
.clock-tabular {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  transform: translateZ(0);
}
.digit-slot {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.62em;
  height: 1.1em;
  overflow: visible;
  vertical-align: baseline;
}
.digit {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  font-weight: 500;
}
.digit-enter {
  animation: digit-morph 280ms cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes digit-morph {
  0% {
    transform: scaleX(0.2);
    filter: blur(4px);
    font-weight: 800;
    opacity: 0;
  }
  100% {
    transform: scaleX(1);
    filter: blur(0px);
    font-weight: 500;
    opacity: 1;
  }
}
.digit-exit {
  animation: digit-exit 120ms ease-in both;
  pointer-events: none;
}
@keyframes digit-exit {
  0% {
    transform: scaleX(1);
    filter: blur(0px);
    opacity: 1;
  }
  100% {
    transform: scaleX(0);
    filter: blur(3px);
    opacity: 0;
  }
}
.clock-colon {
  display: inline-block;
  margin: 0 0.08em;
  opacity: 0.5;
  transition: transform 200ms ease;
  transform-origin: center center;
}
@keyframes colon-pulse {
  0% { transform: scale(1) rotate(0deg); opacity: 0.5; }
  50% { transform: scale(1.4, 0.6) rotate(90deg); opacity: 1; filter: drop-shadow(0 0 4px var(--accent)); }
  100% { transform: scale(1) rotate(0deg); opacity: 0.5; }
}
@keyframes date-flash {
  0% { filter: brightness(1); }
  30% { filter: brightness(1.8); color: var(--text); }
  100% { filter: brightness(1); }
}
.animate-colon-flash {
  animation: colon-pulse 280ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.animate-date-flash {
  animation: date-flash 350ms ease-out forwards;
}
.clock > span, .counter span { display: block; min-height: 1.4em; }
.counter-value { color: var(--accent); }

.banner {
  flex: none;
  height: 32px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  color: var(--subtext0);
  font: 13px/1 var(--mono);
}

h1 {
  flex: none;
  align-self: center;
  width: min(100%, 960px);
  max-width: calc(100vw - 2 * (clamp(24px, 4vw, 64px) + 80px));
  max-height: 1.2em;
  margin: 0 0 clamp(12px, 4.5vh, 36px);
  overflow: hidden;
  font: 600 clamp(22px, min(4.6vw, 8vh), 60px)/1.15 var(--mono);
  letter-spacing: -0.02em;
  text-align: center;
  text-wrap: nowrap;
  white-space: nowrap;
}

.middle {
  flex: 0 1 auto; /* as tall as its cards, up to the max; the gaps take the rest */
  min-height: 0;
  max-height: 494px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.tile[hidden] { display: none; } /* a mode with fewer than six cards */
.tiles {
  width: min(100%, 960px);
  max-width: calc(100vw - 2 * (clamp(24px, 4vw, 64px) + 80px));
  flex: 0 1 auto;
  min-height: 0;
  display: grid;
  /* Three columns while each card can be 240px wide, then two, then one; the
     rows share the height between them. No breakpoint picks the count. A row
     is at most 224px tall (two rows fill 460), so one row never stretches. */
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  grid-auto-rows: minmax(0, 224px);
  gap: 12px;
}
/* Fewer cards stay card-sized and centred instead of stretching across 960px:
   one card is one column wide (312px), two or four make two columns. */
.tiles[data-count="1"] { width: min(100%, 312px); }
.tiles[data-count="2"], .tiles[data-count="4"] { width: min(100%, 636px); }
.tile {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: clamp(6px, 1.5vh, 12px) 16px;
  overflow: hidden;
  background: var(--mantle);
  border: 1px solid var(--surface0);
  border-radius: 10px;
}
.row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.dots { display: inline-flex; gap: 5px; }
.dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--overlay0); }
.dot[data-level="ok"] { background: var(--green); }
.dot[data-level="warn"] { background: var(--yellow); }
.dot[data-level="alert"] { background: var(--red); }
.label {
  color: var(--subtext0);
  font: 12px/1.7 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.age { margin-left: auto; color: var(--subtext0); font: 12px/1.7 var(--mono); }
.value { color: var(--text); font: 600 20px/1.4 var(--mono); white-space: nowrap; }
.tile[data-level="alert"] .value { color: var(--red); }
.detail, .lines span[data-tip] {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--subtext0);
}
.lines {
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
  font-size: 12.5px;
  line-height: 1.55;
}
.lines li { display: flex; align-items: center; gap: 7px; min-width: 0; }
.lines .dot { width: 5px; height: 5px; }
.lines span[data-tip] { cursor: default; }
.lines span[data-tip]:hover, .lines span[data-tip]:focus { color: var(--text); }
/* A row in parts (tiles.js lineParts): who or which, the text, a status on the
   right that is never cut, and in a grouped list sub rows under their group.
   On a short card sub rows give way by priority (4 first) and their group
   row says what they held instead. site.css matches. */
.tile .lines .parts { display: flex; align-items: baseline; gap: 6px; flex: 1 1 auto; }
.tile .lines .parts > span { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tile .lines .parts .lead { flex: 0 0 auto; max-width: 40%; color: var(--text); }
.tile .lines .parts .body { flex: 1 1 auto; }
.tile .lines .parts .hint { display: none; flex: none; color: var(--overlay0); }
.tile .lines .parts .aside { flex: none; margin-left: auto; overflow: visible; color: var(--overlay0); font: 11px/1.55 var(--mono); }
.tile .lines li[data-level="ok"] .aside { color: var(--green); }
.tile .lines li[data-level="warn"] .aside { color: var(--yellow); }
.tile .lines li[data-level="alert"] .aside { color: var(--red); }
.tile .lines li.group .body { flex: 0 1 auto; color: var(--text); } /* its hint follows the name */
.tile .lines li.sub { padding-left: 12px; }
.tile .lines li.sub > .dot, .tile .lines li.sub > .icon { display: none; }
@container lines (height < 12.4em) { .tile .lines li.sub[data-p="4"] { display: none; } .tile .lines li.group[data-sp="4"] .hint { display: inline; } }
@container lines (height < 10.85em) { .tile .lines li.sub[data-p="3"] { display: none; } .tile .lines li.group[data-sp="3"] .hint { display: inline; } }
@container lines (height < 9.3em) { .tile .lines li.sub[data-p="2"] { display: none; } .tile .lines li.group[data-sp="2"] .hint { display: inline; } }
@container lines (height < 7.75em) { .tile .lines li.sub[data-p="1"] { display: none; } .tile .lines li.group[data-sp="1"] .hint { display: inline; } }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; min-width: 0; margin-top: 2px; }
.col { min-width: 0; }
.col > .label { display: block; margin-bottom: 1px; font-size: 11px; line-height: 1.5; }
.col .lines { margin: 0; font-size: 12px; line-height: 1.45; }

/* Cards get denser as they get shorter, never broken. newtab.html matches.
   Each list keeps as many whole lines as it has room for: auto-fill makes one
   row per line height that fits, and any line beyond them lands in a
   zero-height row, gone rather than cut in half. A card also answers to its
   own height (a size container): on a short one the column titles go first,
   then everything under the title row, the same for every card. */
.tile { container: tile / size; }
.tile .lines, .tile .cols { flex: 1 1 0; min-height: 0; }
.tile .lines {
  display: grid;
  grid-template-rows: repeat(auto-fill, 1.55em); /* the list's line height */
  grid-auto-rows: 0;
  align-content: start;
  overflow: hidden;
  container: lines / size;
}
.tile .lines li { overflow: hidden; }
.tile .cols { grid-template-rows: minmax(0, 1fr); }
.tile .col { display: flex; flex-direction: column; min-height: 0; }
.tile .col .lines { grid-template-rows: repeat(auto-fill, 1.45em); container-name: collines; }
/* auto-fill always makes one row, even with no room: then show none. */
@container lines (height < 1.55em) {
  .tile .lines li { display: none; }
}
@container collines (height < 1.45em) {
  .tile .col .lines li { display: none; }
}
@container tile (height < 120px) {
  .tile .col .label { display: none; }
}
/* Too short for a line under the head: every card shows its title row only. */
@container tile (height < 76px) {
  .tile .head > :not(:first-child), .tile .lines, .tile .cols { display: none; }
}

.rail {
  flex: none;
  height: 24px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 6px;
  overflow: hidden;
}
.rail-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  color: var(--subtext0);
  border: 1px solid transparent;
  border-radius: 6px;
  font: 12px/1.5 var(--mono);
  cursor: default;
}
.rail-item:hover, .rail-item:focus-visible { color: var(--text); border-color: var(--surface0); outline: none; }
.rail-item .dot { width: 6px; height: 6px; }

.launcher {
  flex: none;
  align-self: center;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 8px;
  padding-bottom: clamp(12px, 3.5vh, 28px);
  /* The corner labels share this row. Keep clear of them (about 160px each
     side, "mode: personal" plus a gap), so a long launcher wraps onto a
     second line instead of running under them. newtab.html matches. */
  max-width: calc(100vw - 2 * (clamp(24px, 4vw, 64px) + 160px));
}
.launcher > span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  color: var(--subtext0);
}
.launcher .subkeys { font: 12px/1.5 var(--mono); color: var(--overlay0); }
kbd {
  min-width: 22px;
  padding: 1px 6px;
  color: var(--accent);
  border: 1px solid var(--surface0);
  border-radius: 5px;
  font: 12px/1.5 var(--mono);
  text-align: center;
}

/* Quiet corner labels, mirroring the extension footer. */
#mode-label, #settings {
  position: fixed;
  bottom: calc(clamp(12px, 3.5vh, 28px) + 4px); /* level with the launcher's last row */
  padding: 4px 8px;
  color: var(--overlay0);
  font: 12px/1.5 var(--mono);
}
#mode-label { left: clamp(24px, 4vw, 64px); max-width: 160px; text-align: left; }
#mode-label span { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#settings { right: clamp(24px, 4vw, 64px); }
/* The mode label is a button in both: it opens the mode switcher. Settings
   opens Settings in the extension; the showcase has no settings page, so
   there it only answers hover and focus the same way and carries its tooltip. */
#mode-label, #settings { background: none; border: 1px solid transparent; border-radius: 6px; cursor: default; }
#mode-label { cursor: pointer; }
#mode-label .u { font-size: 11px; }
#mode-label:hover, #mode-label:focus-visible, #settings:hover, #settings:focus-visible { color: var(--text); border-color: var(--surface0); outline: none; }
/* Settings sits under the forecast. --settings-shift is set by site.js when the
   place's two lines would reach it: the width of the longer line, so a long
   country name clears it as surely as a short one. */
body.wx-on #settings { right: calc(clamp(24px, 4vw, 64px) + var(--settings-shift, 0px)); }
@media (min-height: 651px) and (max-height: 780px) {
  body.history-on #mode-label { left: calc(clamp(24px, 4vw, 64px) + 76px); }
  body.wx-on #settings { right: calc(clamp(24px, 4vw, 64px) + max(76px, var(--settings-shift, 0px))); }
}

.strip {
  position: fixed;
  left: clamp(24px, 4vw, 64px);
  top: calc(20vh + 40px); /* newtab.html: sits about four 9px rows below the counter */
  width: 64px;
  height: calc(60vh + 90px); /* newtab.html: ten more days at a 9px pitch */
}
.strip svg { display: block; overflow: visible; }
.strip rect { fill: var(--overlay0); opacity: 0.45; }
.strip rect.today { fill: var(--accent); opacity: 1; }
.strip rect.hit { fill: transparent; opacity: 1; }
.strip g:hover rect:not(.hit) { opacity: 1; }
.strip rect.bar { width: var(--target-w, 0px); }
.strip {
  --wave-base: 12px; /* the resting column, before any sample days show */
  --wave-crest: 34px;
  --wave-step: 18ms; /* WAVE_STEP in site.js and newtab.js */
  --wave-dur: 595ms; /* WAVE_DUR in site.js and newtab.js */
}
.strip.wave:not(.returning) rect.bar {
  animation: strip-wave var(--wave-dur) step-end both;
  animation-delay: calc(var(--i) * var(--wave-step));
  /* Placeholder until the wave has passed, today's row included. */
  fill: var(--overlay0);
  opacity: 0.45;
}
.strip.returning rect.bar {
  animation: strip-return var(--wave-dur) ease-in-out both;
  animation-delay: calc((var(--wave-count) - 1 - var(--i)) * var(--wave-step)); /* bottom row first */
}
@keyframes strip-return {
  0% { width: var(--wave-base); fill: var(--overlay0); opacity: 0.45; }
  50% { width: var(--wave-crest); fill: var(--overlay0); opacity: 0.45; }
  100% { width: var(--target-w, 0px); }
}
@keyframes strip-wave {
  0% { width: var(--wave-base); }
  4.1667% { width: calc(var(--wave-base) + 0.0170 * (var(--wave-crest) - var(--wave-base))); }
  8.3333% { width: calc(var(--wave-base) + 0.0670 * (var(--wave-crest) - var(--wave-base))); }
  12.5% { width: calc(var(--wave-base) + 0.1464 * (var(--wave-crest) - var(--wave-base))); }
  16.6667% { width: calc(var(--wave-base) + 0.2500 * (var(--wave-crest) - var(--wave-base))); }
  20.8333% { width: calc(var(--wave-base) + 0.3706 * (var(--wave-crest) - var(--wave-base))); }
  25% { width: calc(var(--wave-base) + 0.5000 * (var(--wave-crest) - var(--wave-base))); }
  29.1667% { width: calc(var(--wave-base) + 0.6294 * (var(--wave-crest) - var(--wave-base))); }
  33.3333% { width: calc(var(--wave-base) + 0.7500 * (var(--wave-crest) - var(--wave-base))); }
  37.5% { width: calc(var(--wave-base) + 0.8536 * (var(--wave-crest) - var(--wave-base))); }
  41.6667% { width: calc(var(--wave-base) + 0.9330 * (var(--wave-crest) - var(--wave-base))); }
  45.8333% { width: calc(var(--wave-base) + 0.9830 * (var(--wave-crest) - var(--wave-base))); }
  50% { width: var(--wave-crest); }
  54.1667% { width: calc(var(--wave-base) + 0.9830 * (var(--wave-crest) - var(--wave-base))); }
  58.3333% { width: calc(var(--wave-base) + 0.9330 * (var(--wave-crest) - var(--wave-base))); }
  62.5% { width: calc(var(--wave-base) + 0.8536 * (var(--wave-crest) - var(--wave-base))); }
  66.6667% { width: calc(var(--wave-base) + 0.7500 * (var(--wave-crest) - var(--wave-base))); }
  70.8333% { width: calc(var(--wave-base) + 0.6294 * (var(--wave-crest) - var(--wave-base))); }
  75% { width: calc(var(--wave-base) + 0.5000 * (var(--wave-crest) - var(--wave-base))); }
  79.1667% { width: calc(var(--wave-base) + 0.3706 * (var(--wave-crest) - var(--wave-base))); }
  83.3333% { width: calc(var(--wave-base) + 0.2500 * (var(--wave-crest) - var(--wave-base))); }
  87.5% { width: calc(var(--wave-base) + 0.1464 * (var(--wave-crest) - var(--wave-base))); }
  91.6667% { width: calc(var(--wave-base) + 0.0670 * (var(--wave-crest) - var(--wave-base))); }
  95.8333% { width: calc(var(--wave-base) + 0.0170 * (var(--wave-crest) - var(--wave-base))); }
  100% { width: var(--wave-base); }
}
.strip:focus-visible { outline: 1px solid var(--surface0); outline-offset: 4px; }
/* The forecast starts level with the history strip and keeps its exact row
   pitch. Both edges draw the same number of rows: sixty at most, fewer on a
   short window (stripRows), so the place under the forecast still fits. */
.strip.wx {
  left: auto;
  right: clamp(24px, 4vw, 64px);
  height: calc(60vh + 90px);
  min-height: calc(var(--drawn, 0px) + 72px); /* the bars, then the place's three lines */
}
.strip.wx svg { margin-left: auto; }
/* The current hour above the bars, and where the forecast is for (city over
   country) under them, in the clock's face at 27.5% of its size, not a
   tooltip. Both rest hidden and surface while the pointer is anywhere on the
   forecast, sharpening out of a blur as their letters draw together.
   newtab.html matches. */
.wx-now, .wx-place {
  position: absolute;
  right: 0;
  white-space: pre; /* the \n between the two lines is the line break */
  text-align: right;
  font: 500 calc(clamp(28px, 3vw, 44px) * 0.275)/1.2 var(--mono); /* the clock's size × 0.275 */
  color: var(--subtext0);
  letter-spacing: 0.12em;
  opacity: 0;
  filter: blur(6px);
  transform: translateY(4px);
  pointer-events: none;
  transition: opacity 480ms cubic-bezier(0.22, 1, 0.36, 1), filter 480ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 480ms cubic-bezier(0.22, 1, 0.36, 1), letter-spacing 640ms cubic-bezier(0.22, 1, 0.36, 1);
}
.wx-now {
  bottom: calc(100% + 14px);
}
.wx-place {
  top: calc(var(--drawn, 0px) + 14px);
  min-height: 3.6em; /* three lines from the first paint: the age line (an hour-old forecast) moves nothing */
}
.strip.wx:hover .wx-now, .strip.wx:focus-visible .wx-now,
.strip.wx:hover .wx-place, .strip.wx:focus-visible .wx-place {
  opacity: 1;
  filter: blur(0);
  transform: none;
  letter-spacing: 0.01em;
}
/* A forecast an hour old or more says so under the place, dimmer. */
.wx-place .age { color: var(--overlay0); }
@media (prefers-reduced-motion: reduce) {
  .wx-now, .wx-place { filter: none; transform: none; letter-spacing: 0.01em; transition: opacity 160ms linear; }
}
.strip.wx rect { fill: var(--overlay0); }
.strip.wx rect[data-c="clear"], .strip.wx rect[data-c="mclear"] { fill: var(--green); }
.strip.wx rect[data-c="partly"] { fill: var(--teal); }
.strip.wx rect[data-c="overcast"] { fill: var(--overlay0); }
.strip.wx rect[data-c="fog"] { fill: var(--subtext0); }
.strip.wx rect[data-c="rain"] { fill: var(--blue); }
.strip.wx rect[data-c="snow"] { fill: var(--text); }
.strip.wx rect[data-c="ice"] { fill: var(--yellow); }
.strip.wx rect[data-c="storm"] { fill: var(--red); }
.strip.wx rect.hit { fill: transparent; opacity: 1; }
/* newtab.html: each hour's own opacity, scaled to rest as quietly as history. */
.strip.wx rect.bar { opacity: calc(var(--alpha, 1) * 0.6); }
.strip.wx.wave:not(.returning) rect.bar { fill: var(--overlay0); opacity: 0.45; }
.strip.wx g:hover rect.bar { opacity: 1; }

#tooltip {
  position: fixed;
  z-index: 20;
  max-width: min(380px, calc(100vw - 16px));
  padding: 6px 9px;
  color: var(--text);
  background: var(--mantle);
  border: 1px solid var(--surface0);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgb(0 0 0 / 0.25);
  font: 12.5px/1.45 var(--mono);
  pointer-events: none;
  /* Matches tooltip.js: rows break on \n, never wrap, and end in an ellipsis. */
  white-space: nowrap;
  white-space-collapse: preserve-breaks;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transition: opacity 80ms;
}
#tooltip.on { opacity: 1; }

/* Narrow windows (a phone, a split screen): one column that scrolls. Width
   only. A short but wide window keeps the desktop layout and its margins, the
   quip and the strips (which draw fewer rows); it never turns into a phone.
   newtab.html has the same block. */
@media (max-width: 760px) {
  body { position: relative; overflow: auto; }
  main { height: auto; min-height: 100vh; min-height: 100svh; padding-bottom: 72px; }
  .top { gap: 16px; }
  .gap { min-height: 28px; flex: none; }
  .gap.below { min-height: 20px; }
  h1, .tiles { max-width: 100%; }
  h1 { margin-bottom: 24px; }
  .middle { max-height: none; }
  .tiles { grid-template-columns: 1fr; grid-auto-rows: auto; }
  .tiles[data-count] { width: 100%; } /* the phone column is one card wide at any count */
  .tile { min-height: 190px; container-type: normal; } /* every line, at full height */
  .tile .lines, .tile .cols { flex: none; }
  .tile .lines { display: block; container-type: normal; }
  .tile .cols { grid-template-rows: auto; }
  .tile .col { display: block; }
  .strip, .strip.wx { display: none; }
  .rail { height: auto; }
  .launcher { max-width: none; } /* the labels move to the end of the page */
  /* The corner labels end the page instead of floating over the cards. */
  #mode-label, #settings { position: absolute; bottom: 24px; }
  body.history-on #mode-label { left: clamp(24px, 4vw, 64px); }
  body.wx-on #settings { right: clamp(24px, 4vw, 64px); }
}
/* Below about 360px of height even the shortest strip is a stub, not a signal. */
@media (max-height: 360px) {
  .strip, .strip.wx { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* Dismissed: a hollow dot keeps the colour but says "seen". */
.tile.dismissed .dots .dot { background: transparent; box-shadow: inset 0 0 0 1.5px var(--overlay0); }
.tile.dismissed .dots .dot[data-level="warn"] { box-shadow: inset 0 0 0 1.5px var(--yellow); }
.tile.dismissed .dots .dot[data-level="alert"] { box-shadow: inset 0 0 0 1.5px var(--red); }
/* The card's menu button: beside the ✓, shown on hover and focus. */
/* Maps, as in the extension (newtab.html, mapsbox.js): the bar under the heading.
   Its dropdown floats over the page, so a card's edge never clips it. */
.maps-bar { flex: none; align-self: center; width: min(100%, 560px); margin: 0 0 clamp(10px, 2.5vh, 20px); }
.maps-bar[hidden] { display: none; }
.maps-box { position: relative; display: flex; align-items: center; gap: 6px; min-width: 0; }
.maps-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 7px 12px;
  font: 13px/1.4 var(--mono);
  color: var(--text);
  background: var(--mantle);
  border: 1px solid var(--surface0);
  border-radius: 8px;
  outline: none;
}
.maps-input::placeholder { color: var(--overlay0); }
.maps-input:focus { border-color: var(--overlay0); }
/* The bar is the card surface too (--mantle), its text starting at the left like any field. */
.maps-bar .maps-input { padding-right: 34px; }
.maps-bar .more { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); padding: 0 6px; font: 12px/1.6 var(--mono); color: var(--overlay0); background: none; border: 1px solid transparent; border-radius: 5px; cursor: pointer; opacity: 0; }
.maps-bar:hover .more, .maps-bar .more:focus-visible, .maps-bar .more[aria-expanded="true"] { opacity: 1; }
.tile.maps { justify-content: flex-start; gap: 10px; }
.tile.maps .maps-input { background: var(--base); }
.maps-pop {
  position: fixed; z-index: 30; overflow-y: auto; overscroll-behavior: contain;
  padding: 4px;
  font: 13px/1.4 var(--mono); color: var(--text);
  background: var(--mantle); border: 1px solid var(--surface0); border-radius: 10px;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.35);
}
.maps-pop[hidden] { display: none; }
.maps-list { margin: 0; padding: 0; list-style: none; }
.maps-row { display: flex; flex-direction: column; gap: 1px; padding: 6px 10px; border-radius: 6px; cursor: pointer; }
.maps-row[aria-selected="true"] { background: var(--surface0); }
.maps-row .main { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.maps-row .sub { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 12px; color: var(--subtext0); }
.maps-row.raw .main { color: var(--subtext0); }
.maps-status { margin: 4px 10px; font-size: 12px; color: var(--subtext0); }
.maps-status[hidden], .maps-status:empty { display: none; }
.maps-credit { margin: 4px 10px 2px; font-size: 12px; font-weight: 400; color: var(--subtext0); text-align: right; }
.tile .done {
  margin-left: auto;
  padding: 0 6px;
  font: 12px/1.6 var(--mono);
  color: var(--overlay0);
  background: none;
  border: 1px solid transparent;
  border-radius: 5px;
  cursor: pointer;
  opacity: 0;
}
.tile:hover .done, .tile .done:focus-visible { opacity: 1; }
.tile .done:hover { color: var(--text); border-color: var(--surface0); }
.tile .age + .done { margin-left: 6px; }
.tile .more {
  margin-left: auto;
  padding: 0 6px;
  font: 12px/1.6 var(--mono);
  color: var(--overlay0);
  background: none;
  border: 1px solid transparent;
  border-radius: 5px;
  cursor: pointer;
  opacity: 0;
}
.tile .more + .done { margin-left: 2px; }
.tile:hover .more, .tile .more:focus-visible, .tile .more[aria-expanded="true"] { opacity: 1; }
.tile .more:hover, .tile .more[aria-expanded="true"] { color: var(--text); border-color: var(--surface0); }
.tile .age + .more { margin-left: 6px; }
/* A card's ⋯ and ✓ float over the head row's right end: hidden, they take no
   room, so an age sits at the edge; on hover they show there instead of it. */
.tile .head > .row:first-child { position: relative; }
.tile .acts { position: absolute; right: 0; top: 50%; transform: translateY(-50%); display: flex; align-items: center; gap: 2px; }
.tile .acts > button { margin-left: 0; }
.tile:hover .age, .tile:focus-within .age { visibility: hidden; }
/* Per-line actions (✓ dismiss, and the open-envelope Mark as read on unread
   mail): float over the row's right end like the card header's .acts, so
   hidden they take no room and on hover they replace .aside. */
.tile .lines li { position: relative; }
.tile .lines .line-acts {
  position: absolute; right: 0; top: 50%; transform: translateY(-50%);
  display: flex; align-items: center; gap: 2px; padding-left: 10px;
  background: linear-gradient(90deg, transparent, var(--mantle) 28%);
  opacity: 0; pointer-events: none;
}
.tile .lines li:hover .line-acts, .tile .lines li:focus-within .line-acts { opacity: 1; pointer-events: auto; }
.tile .lines li:has(.line-acts):hover .parts .aside, .tile .lines li:has(.line-acts):focus-within .parts .aside { visibility: hidden; }
.tile .lines .line-acts > button {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 18px; padding: 0 4px;
  font: 12px/1 var(--mono); color: var(--overlay0);
  background: var(--mantle); border: 1px solid transparent; border-radius: 5px; cursor: pointer;
}
.tile .lines .line-acts > button:hover, .tile .lines .line-acts > button:focus-visible {
  color: var(--text); border-color: var(--surface0); outline: none;
}
.tile .lines .line-acts svg { display: block; flex: none; }
/* The menu and the Undo notice (cardmenu.js). */
.card-menu {
  position: fixed; z-index: 30; width: 320px; max-width: calc(100vw - 16px); padding: 10px;
  max-height: calc(100vh - 16px); overflow-y: auto; overscroll-behavior: contain;
  display: grid; gap: 6px; justify-items: start;
  font: 12.5px/1.4 var(--mono); color: var(--text);
  background: var(--mantle); border: 1px solid var(--surface0); border-radius: 10px;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.35);
}
.card-menu .title { margin: 0 0 2px; color: var(--subtext0); }
.card-menu button { padding: 4px 8px; font: inherit; color: var(--text); background: none; border: 1px solid var(--surface0); border-radius: 6px; cursor: pointer; text-align: left; }
.card-menu button:hover, .card-menu button:focus-visible { border-color: var(--overlay0); outline: none; }
.card-menu .snooze, .card-menu .sources { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.card-menu .where { display: grid; gap: 4px; justify-items: start; }
.card-menu .dim { color: var(--overlay0); margin-right: 2px; }
.card-menu .seg { display: inline-flex; border: 1px solid var(--surface0); border-radius: 6px; overflow: hidden; }
.card-menu .seg button { border: none; border-radius: 0; padding: 3px 7px; }
.card-menu .seg button[aria-checked="true"] { color: var(--base); background: var(--accent); }
.card-menu .mode-item.on { border-color: var(--accent); }
.card-menu hr { width: 100%; border: none; border-top: 1px solid var(--surface0); margin: 2px 0; }
/* A plain menu (Maps): a list of actions, as wide as the longest, each a line
   of text that lights up under the pointer or keyboard focus. */
.card-menu.list { width: max-content; min-width: 0; padding: 4px; gap: 0; justify-items: stretch; }
.card-menu.list .title { margin: 2px 8px 2px; }
.card-menu.list .title .name { color: var(--accent); }
.card-menu.list button { padding: 5px 8px; border: none; border-radius: 6px; white-space: nowrap; }
.card-menu.list button:hover, .card-menu.list button:focus-visible { background: var(--surface0); }
.card-menu.list hr { margin: 4px 0 4px; }
.toast {
  position: fixed; z-index: 30; left: 50%; top: 14px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; max-width: min(560px, calc(100vw - 32px)); padding: 8px 12px;
  font: 12.5px/1.4 var(--mono); color: var(--text);
  background: var(--mantle); border: 1px solid var(--surface0); border-radius: 8px;
}
.toast[hidden], .tile .lines[hidden], .tile .lines li[hidden] { display: none; }
.toast .undo { padding: 2px 8px; font: inherit; color: var(--accent); background: none; border: 1px solid var(--surface0); border-radius: 6px; cursor: pointer; }

/* Hide details, as in the extension: what cards say (a number stays, words
   like a song title go), hover details and artwork go; cards keep their
   places, so nothing moves. A meeting reminder stays, as "Meeting" and its
   countdown. The extension leaves them out of its view models; the showcase
   hides them. */
.discreet .tiles .lines, .discreet .tiles .cols, .discreet .tiles .detail, .discreet .tiles .value.phrase, .discreet .tiles .now-playing img, .discreet .counter { visibility: hidden; }
.banner-generic, .discreet .banner-title { display: none; }
.discreet .banner-generic { display: inline; }
