
.page-head { max-width: calc(70ch + 40px); margin: 0 auto; font-size: 17px; padding: 20px 20px 44px; color: var(--on-stage); }
.page-head h1 { margin: 0; font-size: clamp(28px, 3.6vw, 36px); line-height: 1.2; letter-spacing: -.015em; text-wrap: balance; }

.page { background: var(--bg); padding: 48px 20px 64px; }
.content { max-width: 70ch; margin: 0 auto; font-size: 17px; line-height: 1.7; }
.content > :first-child { margin-top: 0; }
.lead { margin: 0 0 8px; font-size: 19px; line-height: 1.6; color: var(--muted); }
.content h2 { margin: 2.2em 0 .5em; font-size: clamp(22px, 2.6vw, 27px); letter-spacing: -.01em; }
.content section:first-child h2 { margin-top: 0; }
.content h3 { margin: 1.6em 0 .3em; font-size: 19px; }
.content p { margin: 0 0 1em; }
.content ul:not(.links), .content ol { margin: 0 0 1.1em; padding-left: 1.4em; }
.content li { margin: .35em 0; padding-left: .2em; }
.content li::marker { color: var(--accent); font-weight: 700; }
.links { list-style: none; margin: 1.2em 0 1.4em; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.links li { margin: 0; padding: 0; }
.links a {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 100%; min-height: 56px;
  padding: 12px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
  color: var(--fg); font-weight: 600; line-height: 1.35; text-decoration: none;
  transition: border-color .15s ease, transform .15s ease;
}
.links a::after { content: "→"; color: var(--accent); font-weight: 700; }
.links a:hover { border-color: var(--accent); transform: translateY(-1px); }

#faq h2 { margin-bottom: .7em; }
.faq { border-top: 1px solid var(--border); }
.faq details { border-bottom: 1px solid var(--border); }
.faq summary {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 56px; padding: 12px 4px; cursor: pointer; list-style: none; font-weight: 600; line-height: 1.4;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary:hover { color: var(--accent); }
.faq summary .i { color: var(--muted); transition: transform .2s ease; }
.faq details[open] summary .i { transform: rotate(180deg); }
.faq details p { margin: 0; padding: 0 4px 18px; }
.content .page-updated { margin: 32px 0 0; font-size: 14px; color: var(--muted); }
.content .page-updated a { color: inherit; }

.site-footer { background: var(--bg); border-top: 1px solid var(--border); }
.footer-inner { max-width: 1040px; margin: 0 auto; padding: 40px 20px 32px; font-size: 14px; color: var(--muted); }
.footer-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 1fr); gap: 24px; }
.footer-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.footer-h { margin: 0 0 8px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--fg); }
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col a {
  display: inline-flex; align-items: center; min-height: 30px; min-width: 24px;
  color: var(--muted); text-decoration: none; white-space: nowrap;
}
.footer-col a:hover { color: var(--fg); text-decoration: underline; }
.footer-col a[aria-current="true"] { color: var(--fg); font-weight: 700; }
.footer-meta { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border); }
.footer-meta p { margin: 4px 0; }
.footer-meta a { color: inherit; }
.trademark { font-size: 12px; }

.dialog {
  width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); padding: 0; overflow: auto;
  border: 0; border-radius: 18px; background: var(--surface); color: var(--fg); box-shadow: 0 24px 60px rgb(0 0 0 / .35);
  overscroll-behavior: contain;
}
.dialog-wide { width: min(760px, calc(100vw - 24px)); }
.dialog::backdrop { background: rgb(8 10 30 / .6); }
.dialog-body { padding: 0 24px 20px; }
.dialog h3 { margin: 20px 0 8px; font-size: 15px; }
.dialog-actions {
  position: sticky; bottom: 0; z-index: 1; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px;
  margin: 18px -24px -20px; padding: 14px 24px; background: var(--surface); border-top: 1px solid var(--border);
}
.dialog-actions-split { justify-content: space-between; align-items: center; }
.button-row { display: flex; flex-wrap: wrap; gap: 6px; }
fieldset { margin: 0 0 18px; padding: 0; border: 0; min-width: 0; }
legend { margin-bottom: 10px; padding: 0; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.tk-group + .tk-group { padding-top: 16px; border-top: 1px solid var(--border); }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 8px; }
.field-wide { grid-column: 1 / -1; }

.tk-switch { position: relative; display: flex; align-items: center; gap: 12px; min-height: 40px; margin: 4px 0; line-height: 1.35; cursor: pointer; }
/* The real checkbox sits invisibly on the track. */
.tk-switch input { position: absolute; left: 0; z-index: 1; width: 46px; height: 26px; margin: 0; opacity: 0; cursor: pointer; }
.tk-switch-track { position: relative; flex: none; width: 46px; height: 26px; border-radius: 999px; background: var(--border); transition: background-color .2s ease; }
.tk-switch-track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .3); transition: transform .2s ease;
}
.tk-switch input:checked + .tk-switch-track { background: var(--accent); }
.tk-switch input:checked + .tk-switch-track::after { transform: translateX(20px); }
.tk-switch input:focus-visible + .tk-switch-track { outline: 3px solid var(--ring); outline-offset: 2px; }
.tk-switch input:disabled + .tk-switch-track { opacity: .5; }

/* Field errors (settings-view.js) */
input[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
.field .error { margin: 2px 0 0; font-size: 13px; line-height: 1.4; }
.field .button-row { flex-wrap: nowrap; }
.field .button-row select { flex: 1; min-width: 0; }

/* Report: stat cards and the 7-day chart (--v 0–1 set through CSSOM) */
.tk-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.tk-stat { padding: 12px 14px; border-radius: 12px; background: var(--bg); }
.tk-stat p { margin: 0; }
.tk-stat-value { font-size: 24px; font-weight: 800; line-height: 1.25; font-variant-numeric: tabular-nums; }
.tk-stat-label { font-size: 13px; font-weight: 600; color: var(--fg); }
.tk-stat-sub { min-height: 1.3em; font-size: 13px; color: var(--muted); }
.tk-chart { margin: 8px 0 0; padding: 14px 14px 10px; border-radius: 12px; background: var(--bg); }
.tk-chart-bars { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; height: 160px; }
.tk-chart-bar { display: grid; grid-template-rows: minmax(0, 1fr) auto; justify-items: center; gap: 6px; min-width: 0; }
.tk-chart-fill {
  align-self: end; width: 100%; max-width: 40px; height: calc(var(--v, 0) * 100%); min-height: 4px;
  border-radius: 6px 6px 2px 2px; background: color-mix(in srgb, var(--accent) 55%, var(--bg)); transition: height .3s ease;
}
.tk-chart-bar.is-today .tk-chart-fill { background: var(--accent); }
.tk-chart-bar[data-value="0"] .tk-chart-fill { background: var(--border); }
.tk-chart-label { font-size: 12px; color: var(--muted); white-space: nowrap; }
.tk-chart-bar.is-today .tk-chart-label { color: var(--fg); font-weight: 700; }
.tk-chart figcaption { margin-top: 10px; font-size: 13px; color: var(--muted); }
.task-table, .shortcut-table { width: 100%; border-collapse: collapse; }
.task-table th, .task-table td, .shortcut-table td { text-align: left; padding: 8px; border-bottom: 1px solid var(--border); }
.shortcut-table td:first-child { width: 1%; padding-right: 20px; white-space: nowrap; color: var(--muted); }
/* Only the task name column wraps. */
.task-table th { white-space: nowrap; font-size: 13px; color: var(--muted); }
.task-table td:first-child { overflow-wrap: anywhere; width: 100%; }
.task-table th:not(:first-child), .task-table td:not(:first-child) { text-align: right; white-space: nowrap; }
kbd {
  display: inline-block; min-width: 28px; padding: 5px 7px; text-align: center;
  font: 600 13px/1 var(--font); color: var(--fg); border: 1px solid var(--border); border-bottom-width: 3px;
  border-radius: 6px; background: var(--bg);
}

.timer-card:fullscreen { display: flex; flex-direction: column; justify-content: center; padding: 40px; border-radius: 0; background: var(--stage); }
.timer-card:fullscreen .time { font-size: clamp(96px, 26vw, 260px); }
.timer-card:fullscreen .notice-bg { display: none; }

@media (max-width: 860px) {
  .tk-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 520px) {
  .page { padding: 36px 16px 48px; }
  .page-head { padding: 12px 16px 32px; }
  .content { font-size: 16px; }
  .lead { font-size: 17px; }
  .footer-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-grid { grid-template-columns: minmax(0, 1fr); }
  .dialog-body { padding: 0 18px 18px; }
    .dialog-actions { margin: 16px -18px -18px; padding: 12px 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
