:root {
  color-scheme: light dark;
  --page: var(--tg-theme-bg-color, #f5f6f3);
  --card: var(--tg-theme-section-bg-color, #fff);
  --ink: var(--tg-theme-text-color, #181e1b);
  --muted: var(--tg-theme-subtitle-text-color, #4b5750);
  --line: color-mix(in srgb, var(--ink) 20%, transparent);
  --accent: #ffd34a;
  --accent-ink: #221a00;
  font-family: "Geist", system-ui, sans-serif;
  color: var(--ink);
  background: var(--page);
}
@media (prefers-color-scheme: dark) {
  :root { --page: var(--tg-theme-bg-color, #121816); --card: var(--tg-theme-section-bg-color, #1b2521); --ink: var(--tg-theme-text-color, #f3f7f4); --muted: var(--tg-theme-subtitle-text-color, #cad5cf); }
}
:root[data-theme="dark"] { color-scheme: dark; }
:root[data-theme="light"] { color-scheme: light; }
* { box-sizing: border-box; }
body { margin: 0; }
button, select { font: inherit; min-height: 44px; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid var(--tg-theme-link-color, #10876b); outline-offset: 2px; }
.shell { max-width: 565px; margin: 0 auto; padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)); }
.masthead, .filters, .chooser, .dialog-actions { display: flex; align-items: center; gap: 8px; }
.masthead { justify-content: space-between; }
.brand { padding: 6px 13px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-weight: 900; letter-spacing: -.03em; }
.chooser label, .filters label { font-size: .875rem; font-weight: 650; }
select, .secondary { border: 1px solid var(--line); border-radius: 10px; background: var(--card); padding: 7px 9px; }
h1 { font-size: clamp(1.55rem, 6vw, 2rem); margin: 12px 0 8px; line-height: 1.12; letter-spacing: -.035em; }
.filters select { flex: 1; }
.preview { padding: 8px 10px; font-size: .85rem; border: 1px solid var(--line); border-radius: 10px; margin: 8px 0; }
.tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: 13px; margin: 9px 0; background: var(--card); }
.tabs button { border: 0; background: transparent; border-radius: 9px; padding: 4px; }
.tabs button[aria-pressed="true"] { background: var(--ink); color: var(--page); font-weight: 720; }
.calendar { border: 1px solid var(--line); border-radius: 14px; padding: 8px; background: var(--card); }
.weekhead { padding: 2px 4px; }
h2 { margin: 0; font-size: 1.15rem; }
.weekhead p, .night-note, #status { font-size: .87rem; color: var(--muted); margin: 4px 0; }
table { width: 100%; table-layout: fixed; border-spacing: 3px; }
th, td { padding: 0; text-align: left; }
thead th { font-size: .82rem; padding: 4px; color: var(--muted); }
th:first-child { width: 30%; }
tbody th { padding-left: 3px; font-size: .87rem; white-space: nowrap; }
.cell { width: 100%; border: 1px solid var(--line); border-radius: 9px; background: var(--page); font-weight: 650; padding: 3px; }
.cell[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.cell[aria-pressed="true"]::before { content: "✓ "; }
.cell.unavailable { background: color-mix(in srgb, var(--ink) 9%, var(--card)); color: var(--muted); }
.night-note { padding: 2px 4px; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; padding-top: 9px; }
.actions output, #status { grid-column: 1 / -1; }
.actions output { font-weight: 720; }
.primary { background: var(--accent); color: var(--accent-ink); border: 1px solid transparent; padding: 6px 9px; border-radius: 10px; font-weight: 750; }
.primary:disabled { opacity: .5; }
.secondary[aria-pressed="true"] { outline: 2px solid var(--accent); outline-offset: -2px; }
dialog { width: min(420px, calc(100% - 24px)); padding: 17px; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 14px; }
dialog::backdrop { background: #0008; }
.dialog-actions > button { flex: 1; }
#first-language .dialog-actions { margin-top: 12px; }
[hidden] { display: none !important; }
