/* Glass over wood: colours, type and the parts every page is built from. */

/* Roboto Flex, variable weight 100-1000 (SIL Open Font License, assets/fonts). */
@font-face { font-family: "Roboto Flex"; font-style: normal; font-display: swap; font-weight: 100 1000;
  src: url(../fonts/roboto-flex-latin-wght-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Roboto Flex"; font-style: normal; font-display: swap; font-weight: 100 1000;
  src: url(../fonts/roboto-flex-latin-ext-wght-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Roboto Flex"; font-style: normal; font-display: swap; font-weight: 100 1000;
  src: url(../fonts/roboto-flex-cyrillic-wght-normal.woff2) format("woff2");
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }

/* Colours: theme.js sets the --md-sys-color-* roles from the player's choice;
   these are the fallback (walnut, dark). */
:root {
  --md-sys-color-primary: #fbb57c;
  --md-sys-color-on-primary: #4a2600;
  --md-sys-color-primary-container: #6a3800;
  --md-sys-color-on-primary-container: #ffdbbe;
  --md-sys-color-secondary: #e0c0a7;
  --md-sys-color-on-secondary: #432a15;
  --md-sys-color-secondary-container: #5b402b;
  --md-sys-color-on-secondary-container: #fcdcc2;
  --md-sys-color-tertiary: #c0ce9b;
  --md-sys-color-on-tertiary: #2c3504;
  --md-sys-color-tertiary-container: #424c1e;
  --md-sys-color-on-tertiary-container: #dceab6;
  --md-sys-color-error: #ffafa5;
  --md-sys-color-on-error: #610005;
  --md-sys-color-error-container: #89000a;
  --md-sys-color-on-error-container: #ffd8d3;
  --md-sys-color-surface: #161310;
  --md-sys-color-on-surface: #e7e1dd;
  --md-sys-color-on-surface-variant: #d1c4ba;
  --md-sys-color-surface-container-lowest: #110d0b;
  --md-sys-color-surface-container-high: #2d2926;
  --md-sys-color-outline: #9a8e85;
  --md-sys-color-accent: #eb9445;
  --md-sys-color-accent-hi: #ffb06c;
  --md-sys-color-accent-lo: #c8741c;
  --md-sys-color-on-accent: #2d1400;
  --md-sys-color-wood: #65462c;

  --ink: var(--md-sys-color-on-surface);
  --ink-2: var(--md-sys-color-on-surface-variant);
  --accent: var(--md-sys-color-accent);
  --accent-text: var(--md-sys-color-primary);

  /* Surfaces inside a glass panel: the text colour, thinned. */
  --fill-1: color-mix(in srgb, var(--ink) 5%, transparent);
  --fill-2: color-mix(in srgb, var(--ink) 9%, transparent);
  --fill-3: color-mix(in srgb, var(--ink) 15%, transparent);
  --hair: color-mix(in srgb, var(--ink) 11%, transparent);
  --accent-soft: color-mix(in srgb, var(--accent) 24%, transparent);

  /* Glass: a tinted pane, a lit edge, a soft shadow. */
  --glass: color-mix(in srgb, var(--md-sys-color-surface) 50%, transparent);
  --glass-strong: color-mix(in srgb, var(--md-sys-color-surface) 82%, transparent);
  --glass-sheen: linear-gradient(165deg, rgb(255 255 255 / 0.075), rgb(255 255 255 / 0.012) 34%, transparent 60%);
  --glass-edge: linear-gradient(150deg, rgb(255 255 255 / 0.34), rgb(255 255 255 / 0.07) 28%, rgb(255 255 255 / 0.03) 62%, rgb(255 255 255 / 0.2));
  --glass-blur: blur(18px) saturate(1.4);
  --glass-shadow: 0 18px 40px -18px rgb(0 0 0 / 0.7), 0 2px 8px rgb(0 0 0 / 0.18);
  --btn-edge: inset 0 1px 0 rgb(255 255 255 / 0.13), inset 0 0 0 1px rgb(255 255 255 / 0.035);

  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 24px;
  --r-full: 9999px;

  --spring: cubic-bezier(0.34, 1.45, 0.5, 1);
  --ease: cubic-bezier(0.22, 0.8, 0.3, 1);
  --t-fast: 160ms;
  --t: 260ms;
  --t-slow: 460ms;

  --font: "Roboto Flex", Roboto, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Roboto Mono", ui-monospace, "Cascadia Mono", Menlo, monospace;

  color-scheme: dark;
}
:root[data-mode="light"] {
  --glass: color-mix(in srgb, var(--md-sys-color-surface-container-lowest) 66%, transparent);
  --glass-strong: color-mix(in srgb, var(--md-sys-color-surface-container-lowest) 90%, transparent);
  --glass-sheen: linear-gradient(165deg, rgb(255 255 255 / 0.5), rgb(255 255 255 / 0.1) 40%, transparent 70%);
  --glass-edge: linear-gradient(150deg, rgb(255 255 255 / 0.95), rgb(255 255 255 / 0.4) 40%, rgb(255 255 255 / 0.75));
  --glass-shadow: 0 18px 38px -20px rgb(60 30 0 / 0.5), 0 2px 8px rgb(60 30 0 / 0.1);
  --btn-edge: inset 0 1px 0 rgb(255 255 255 / 0.65), inset 0 0 0 1px rgb(0 0 0 / 0.05);
  color-scheme: light;
}
@media (prefers-reduced-transparency: reduce) {
  :root, :root[data-mode="light"] { --glass: var(--md-sys-color-surface); --glass-strong: var(--md-sys-color-surface); --glass-blur: none; }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--md-sys-color-surface); }
body {
  margin: 0;
  font: 400 1rem/1.5 var(--font);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
/* The wood: one grey texture, stained with the theme's colour. */
body::before {
  content: ""; position: fixed; inset: 0; height: 100lvh; z-index: -1; pointer-events: none;
  background:
    radial-gradient(90% 60% at 50% -8%, rgb(255 226 190 / 0.1), transparent 70%),
    radial-gradient(130% 110% at 50% 35%, transparent 45%, rgb(0 0 0 / 0.45)),
    url(../img/wood.webp) center / cover var(--md-sys-color-wood);
  background-blend-mode: normal, normal, multiply;
}
:root[data-mode="light"] body::before {
  background:
    linear-gradient(rgb(255 255 255 / 0.34), rgb(255 255 255 / 0.22)),
    url(../img/wood.webp) center / cover var(--md-sys-color-wood);
  background-blend-mode: normal, multiply;
  filter: brightness(1.18);
}
h1, h2, h3, h4 { margin: 0; font-weight: inherit; }
a { color: var(--accent-text); }
::selection { background: var(--accent-soft); }
* { scrollbar-width: thin; scrollbar-color: var(--fill-3) transparent; }

/* ---------- typography ---------- */
.headline-m { font: 650 1.75rem/2.25rem var(--font); letter-spacing: -0.01em; }
.headline-s { font: 650 1.375rem/1.875rem var(--font); letter-spacing: -0.005em; }
.title-l { font: 650 1.125rem/1.5rem var(--font); }
.title-m { font: 600 1rem/1.5rem var(--font); }
.title-s { font: 600 0.9375rem/1.375rem var(--font); }
.body-l { font: 400 1rem/1.5rem var(--font); }
.body-m { font: 400 0.9375rem/1.375rem var(--font); }
.body-s { font: 400 0.8125rem/1.125rem var(--font); }
.label-l { font: 600 0.875rem/1.25rem var(--font); }
.label-m { font: 600 0.75rem/1rem var(--font); }
.emph { font-weight: 720 !important; }
.muted { color: var(--ink-2); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- icons ---------- */
.icon { width: 24px; height: 24px; fill: currentColor; flex: none; vertical-align: middle; }
.icon.sm { width: 17px; height: 17px; }
.icon.lg { width: 32px; height: 32px; }

/* ---------- glass ---------- */
.glass, .card {
  position: relative; border-radius: var(--r-xl);
  background: var(--glass-sheen), var(--glass);
  box-shadow: var(--glass-shadow);
}
.card { padding: 18px 20px; }
/* The edge catches light: brightest at the top left, again at the bottom right. */
.glass::before, .card::before, .edge::before {
  content: ""; position: absolute; inset: 0; z-index: 1; border-radius: inherit; padding: 1px; pointer-events: none;
  background: var(--glass-edge);
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
}
/* Blur costs power and over the still wood it hardly shows on a small screen. */
@media (min-width: 840px) { .glass, .card { backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); } }
.glass .card, .card .card, .card.outlined {
  background: var(--fill-1); box-shadow: none; border-radius: var(--r-lg); padding: 14px 16px; backdrop-filter: none; -webkit-backdrop-filter: none;
}
.card.hero { background: var(--glass-sheen), linear-gradient(120deg, color-mix(in srgb, var(--accent) 20%, transparent), transparent 70%), var(--glass); }
.card > h2, .card > h3 { margin-bottom: 12px; }
.card > p:last-child { margin-bottom: 0; }
/* A light spot that follows the pointer (fx.js sets --mx, --my). */
.shine { position: relative; }
.shine::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity var(--t) var(--ease);
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 0%), rgb(255 255 255 / 0.13), transparent 65%);
}
@media (hover: hover) { .shine:hover::after { opacity: 1; } }

/* ---------- hover / press tint ---------- */
.sl { position: relative; }
.sl::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: currentColor; opacity: 0; transition: opacity var(--t-fast) var(--ease);
}
@media (hover: hover) { .sl:hover::after { opacity: 0.07; } }
.sl:active::after { opacity: 0.12; }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }

/* ---------- buttons ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 8px 20px; max-width: 100%; border: none; border-radius: var(--r-md); overflow: hidden;
  background: linear-gradient(180deg, var(--md-sys-color-accent-hi), var(--accent) 55%, color-mix(in srgb, var(--accent) 82%, var(--md-sys-color-accent-lo)));
  color: var(--md-sys-color-on-accent);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.5), inset 0 -2px 0 rgb(0 0 0 / 0.16), 0 8px 20px -10px var(--accent);
  font: 650 0.9375rem/1.25rem var(--font); text-align: center; text-decoration: none; cursor: pointer; user-select: none; -webkit-user-select: none;
  transition: transform var(--t) var(--spring), filter var(--t-fast) var(--ease), box-shadow var(--t) var(--ease), background-color var(--t-fast) var(--ease);
}
.btn .icon { width: 20px; height: 20px; margin-inline-start: -4px; }
.btn.lg { min-height: 54px; padding: 10px 28px; font-size: 1.0625rem; border-radius: var(--r-lg); }
.btn.sm { min-height: 34px; padding: 4px 14px; font-size: 0.875rem; border-radius: var(--r-sm); }
.btn.wide { width: 100%; }
@media (hover: hover) { .btn:hover:not(:disabled) { filter: brightness(1.07); } }
.btn:active:not(:disabled) { transform: scale(0.97); }
/* Reflection that runs across a main button. */
.btn.lg:not(.tonal)::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; transform: translateX(-120%) skewX(-18deg);
  background: linear-gradient(90deg, transparent 25%, rgb(255 255 255 / 0.5), transparent 75%);
}
@media (hover: hover) { .btn.lg:hover:not(:disabled)::before { transform: translateX(120%) skewX(-18deg); transition: transform 700ms var(--ease); } }
.btn.tonal, .btn.outlined, .btn.elevated { background: var(--fill-2); color: var(--ink); box-shadow: var(--btn-edge); }
.btn.outlined { background: var(--fill-1); }
@media (hover: hover) { .btn.tonal:hover:not(:disabled), .btn.outlined:hover:not(:disabled) { background: var(--fill-3); filter: none; } }
.btn.text { background: none; color: var(--accent-text); box-shadow: none; padding-inline: 12px; }
@media (hover: hover) { .btn.text:hover:not(:disabled) { background: var(--fill-2); filter: none; } }
.btn.danger { background: linear-gradient(180deg, #f0665a, #c93a30); color: #fff; box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.35), inset 0 -2px 0 rgb(0 0 0 / 0.2); }
.btn.text.danger { background: none; color: var(--md-sys-color-error); box-shadow: none; }
.btn:disabled { background: var(--fill-1); color: color-mix(in srgb, var(--ink) 40%, transparent); box-shadow: none; cursor: default; }
.btn:disabled::before { display: none; }

.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; text-decoration: none;
  border: none; border-radius: var(--r-md); background: transparent; color: var(--ink-2); cursor: pointer;
  transition: transform var(--t) var(--spring), background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.icon-btn:active:not(:disabled) { transform: scale(0.9); }
.icon-btn.tonal { background: var(--fill-2); color: var(--ink); box-shadow: var(--btn-edge); }
.icon-btn.selected { background: var(--accent-soft); color: var(--accent-text); }
.icon-btn:disabled { opacity: 0.35; cursor: default; }

.fab {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 0 20px 0 16px; border: none;
  border-radius: var(--r-lg); cursor: pointer; font: 650 1rem/1.5rem var(--font);
  background: linear-gradient(180deg, var(--md-sys-color-accent-hi), var(--accent)); color: var(--md-sys-color-on-accent);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.5), 0 10px 24px -10px var(--accent); transition: transform var(--t) var(--spring);
}
.fab:active { transform: scale(0.95); }
.fab.large { width: 72px; height: 72px; padding: 0; border-radius: 50%; }

/* Connected buttons: a sunken track, the chosen one raised like a lens. */
.seg { display: flex; gap: 2px; width: 100%; max-width: 520px; padding: 4px; border-radius: var(--r-lg); background: var(--fill-1); box-shadow: inset 0 1px 3px rgb(0 0 0 / 0.22); }
.seg > button {
  flex: 1 1 auto; min-width: 0; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 10px;
  border: none; border-radius: var(--r-md); background: transparent; color: var(--ink-2); cursor: pointer; font: 600 0.875rem/1.25rem var(--font);
  transition: background-color var(--t) var(--ease), color var(--t) var(--ease), transform var(--t) var(--spring);
}
.seg > button:active { transform: scale(0.96); }
.seg > button .lbl { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seg > button .icon { width: 18px; height: 18px; }
@media (max-width: 480px) { .seg > button .icon { display: none; } .seg > button { padding: 0 6px; font-size: 0.8125rem; } }
@media (hover: hover) { .seg > button:hover:not(:disabled) { color: var(--ink); } }
.seg > button[aria-pressed="true"] { background: var(--accent-soft); color: var(--ink); box-shadow: var(--btn-edge), 0 2px 8px rgb(0 0 0 / 0.18); }
.seg > button:disabled { opacity: 0.4; cursor: default; }

/* ---------- chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px; border: none; border-radius: var(--r-sm);
  background: var(--fill-2); color: var(--ink-2); box-shadow: var(--btn-edge); cursor: pointer; font: 600 0.875rem/1.25rem var(--font);
  transition: background-color var(--t) var(--ease), box-shadow var(--t) var(--ease), color var(--t) var(--ease), transform var(--t) var(--spring);
}
.chip:active { transform: scale(0.95); }
.chip .icon { width: 18px; height: 18px; margin-inline-start: -4px; }
@media (hover: hover) { .chip:hover { background: var(--fill-3); color: var(--ink); } }
.chip[aria-pressed="true"] { background: var(--accent-soft); color: var(--ink); box-shadow: inset 0 0 0 2px var(--accent); }

/* ---------- text fields: the label sits inside, above the text ---------- */
.field { position: relative; display: block; margin: 6px 0 2px; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 54px; padding: 22px 16px 8px; border: none; border-radius: var(--r-md); outline: none;
  background: var(--fill-2); color: var(--ink); box-shadow: inset 0 1px 3px rgb(0 0 0 / 0.2), inset 0 0 0 1px var(--hair);
  font: 400 1rem/1.5rem var(--font); transition: box-shadow var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}
.field textarea { min-height: 130px; padding-top: 28px; resize: vertical; font-family: var(--font-mono); font-size: 0.875rem; }
.field select {
  appearance: none; padding-inline-end: 40px;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 22px) 25px, calc(100% - 17px) 25px; background-size: 5px 5px; background-repeat: no-repeat;
}
.field select option { background: var(--md-sys-color-surface-container-high); color: var(--ink); }
.field input:focus, .field select:focus, .field textarea:focus { box-shadow: inset 0 0 0 2px var(--accent), 0 0 0 4px var(--accent-soft); }
.field > span {
  position: absolute; inset-inline: 16px; top: 15px; pointer-events: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--ink-2); font: 400 1rem/1.5rem var(--font); transform-origin: 0 0; transition: transform var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.field input:focus + span, .field input:not(:placeholder-shown) + span, .field select + span, .field textarea + span { transform: translateY(-10px) scale(0.75); }
.field input:focus + span, .field textarea:focus + span, .field select:focus + span { color: var(--accent-text); }
.field input:autofill { -webkit-text-fill-color: var(--ink); transition: background-color 99999s; caret-color: var(--ink); }
.field-hint { display: block; padding: 4px 16px 0; font-size: 0.75rem; line-height: 1rem; color: var(--ink-2); }
input[type="range"] { accent-color: var(--accent); }

/* ---------- switch ---------- */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 0; cursor: pointer; }
.switch-row .text { flex: 1; }
input.switch {
  appearance: none; flex: none; position: relative; width: 50px; height: 30px; margin: 0; cursor: pointer; border-radius: var(--r-full);
  background: var(--fill-3); box-shadow: inset 0 1px 4px rgb(0 0 0 / 0.35), inset 0 0 0 1px var(--hair); transition: background-color var(--t) var(--ease);
}
input.switch::before {
  content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: var(--r-full);
  background: linear-gradient(180deg, #fff, #ddd6cf); box-shadow: 0 2px 5px rgb(0 0 0 / 0.4); transition: transform var(--t) var(--spring), width var(--t-fast) var(--ease);
}
input.switch:checked { background: var(--accent); }
input.switch:checked::before { transform: translateX(20px); }
input.switch:active:not(:disabled)::before { width: 28px; }
input.switch:checked:active:not(:disabled)::before { transform: translateX(16px); }
input.switch:disabled { opacity: 0.4; cursor: default; }

/* ---------- lists ---------- */
.list { list-style: none; margin: 0 -8px; padding: 0; }
.li { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px; color: inherit; text-decoration: none; border-radius: var(--r-md); }
.li .grow { flex: 1; min-width: 0; }
.li .grow > * { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list > li + li { background: linear-gradient(var(--hair), var(--hair)) top / 100% 1px no-repeat; }
/* Rows with text buttons: where they do not fit beside the text, they get their own line. */
.li.wrap { flex-wrap: wrap; row-gap: 4px; } .li.wrap .grow { flex-basis: 150px; }
.li-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; margin-inline-start: auto; }
.empty { margin: 0; padding: 14px; text-align: center; color: var(--ink-2); font-size: 0.9375rem; }

.avatar {
  display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 50%; overflow: hidden;
  background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 75%, #fff), var(--md-sys-color-accent-lo)); color: var(--md-sys-color-on-accent);
  font: 700 1rem/1 var(--font); text-transform: uppercase; text-shadow: none;
}
.avatar.bot { background: linear-gradient(160deg, var(--md-sys-color-tertiary), color-mix(in srgb, var(--md-sys-color-tertiary) 60%, #000)); color: var(--md-sys-color-on-tertiary); }
.avatar[class*="shape-"] { border-radius: 0; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.lg { width: 104px; height: 104px; font-size: 2.5rem; }
.avatar.md { width: 52px; height: 52px; font-size: 1.25rem; }
.avatar.sm { width: 28px; height: 28px; font-size: 0.75rem; }
.badge {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-full);
  background: #e5483d; color: #fff; font: 700 0.6875rem/1 var(--font); animation: pop var(--t-slow) var(--spring);
}
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: var(--r-full); background: var(--fill-2); color: var(--ink); font: 600 0.75rem/1.25rem var(--font); white-space: nowrap; }
.pill.primary { background: var(--accent); color: var(--md-sys-color-on-accent); }
.pill.tertiary { background: var(--md-sys-color-tertiary-container); color: var(--md-sys-color-on-tertiary-container); }
.pill.error { background: var(--md-sys-color-error-container); color: var(--md-sys-color-on-error-container); }

/* ---------- dialog ---------- */
dialog.m3 {
  border: none; padding: 26px; max-width: min(560px, calc(100vw - 32px)); width: max-content; min-width: min(320px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto;
  border-radius: 28px; color: var(--ink); background: var(--glass-sheen), var(--glass-strong);
  backdrop-filter: blur(30px) saturate(1.5); -webkit-backdrop-filter: blur(30px) saturate(1.5);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.22), inset 0 0 0 1px rgb(255 255 255 / 0.07), 0 40px 80px -20px rgb(0 0 0 / 0.7);
}
dialog.m3[open] { animation: dlg-in var(--t-slow) var(--spring); }
dialog.m3::backdrop { background: rgb(0 0 0 / 0.5); animation: fade var(--t) var(--ease); }
dialog.m3 h2 { margin-bottom: 14px; }
dialog.m3 .actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 24px; }

/* ---------- snackbar ---------- */
#snackbars { position: fixed; inset-inline: 0; bottom: 20px; z-index: 100; display: grid; justify-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.snackbar {
  display: flex; align-items: center; gap: 12px; min-height: 50px; max-width: 560px; padding: 8px 10px 8px 20px; pointer-events: auto; border-radius: var(--r-lg);
  background: var(--glass-sheen), var(--glass-strong); color: var(--ink); backdrop-filter: blur(24px) saturate(1.5); -webkit-backdrop-filter: blur(24px) saturate(1.5);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.22), inset 0 0 0 1px rgb(255 255 255 / 0.07), 0 18px 40px -12px rgb(0 0 0 / 0.7); animation: snack-in var(--t-slow) var(--spring);
}
@media (max-width: 839px) { #snackbars { bottom: calc(96px + env(safe-area-inset-bottom)); } }

/* ---------- loading: a shape that changes (shapes.css) ---------- */
/* A page still waiting for its data shows the same. */
.loader, .page-host:empty { width: 48px; height: 48px; margin: 20vh auto; background: linear-gradient(160deg, var(--md-sys-color-accent-hi), var(--md-sys-color-accent-lo)); animation: shape-morph 3.2s var(--ease) infinite, fade 300ms 200ms both; }
.loader.sm { width: 20px; height: 20px; margin: 0; background: var(--accent); animation: shape-morph 3.2s var(--ease) infinite; }

/* ---------- tables ---------- */
table.m3 { width: 100%; border-collapse: collapse; font: 400 0.9375rem/1.375rem var(--font); }
table.m3 th { text-align: start; font-weight: 600; font-size: 0.8125rem; color: var(--ink-2); padding: 8px; border-bottom: 1px solid var(--hair); }
table.m3 td { padding: 10px 8px; border-bottom: 1px solid var(--hair); }
table.m3 tr:last-child td { border-bottom: none; }
table.m3 tr.me td { background: var(--accent-soft); }
table.m3 .num { text-align: end; }
table.m3 .num:first-child { width: 2.5rem; }

.divider { height: 1px; margin: 18px 0; background: var(--hair); border: 0; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.stack.sm { gap: 8px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- animations ---------- */
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }
@keyframes pop { from { opacity: 0; transform: scale(0.5); } }
@keyframes dlg-in { from { opacity: 0; transform: translateY(20px) scale(0.93); } }
@keyframes snack-in { from { opacity: 0; transform: translateY(28px) scale(0.92); } }
/* A new page: its blocks rise one after another (fx.js numbers them with --i). */
.entering [data-enter] { animation: rise 520ms var(--ease) calc(var(--i, 0) * 55ms) both; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}
.card .loader:not(.sm) { margin: 24px auto; }
