:root {
  color-scheme: dark;
  --background: #141917;
  --surface: #1c231f;
  --raised: #242d27;
  --border: #3c4940;
  --text: #f0f3ed;
  --muted: #b2bdb3;
  --accent: #b4cfb2;
  --accent-text: #152315;
  --radius: 12px;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 17px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--background); color: var(--text); line-height: 1.5; }
button, input, select, textarea { font: inherit; }
button, summary, .choice, .checklist label { -webkit-tap-highlight-color: transparent; }
button { min-height: 48px; padding: .625rem 1rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); cursor: pointer; }
button:hover { background: var(--raised); }
button:disabled { opacity: .6; cursor: default; }
button.primary { border-color: var(--accent); background: var(--accent); color: var(--accent-text); font-weight: 650; }
button.primary:hover { background: #c7dec5; }
.text-button { border-color: transparent; background: transparent; color: var(--muted); padding-inline: .5rem; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
input:not([type="checkbox"]):not([type="radio"]), select, textarea { display: block; width: 100%; min-width: 0; min-height: 52px; padding: .75rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
textarea { resize: vertical; }
label, legend { font-size: .95rem; font-weight: 550; }
form > label, .numeric-fields label { display: block; margin-bottom: .5rem; }
fieldset { min-width: 0; border: 0; padding: 0; margin: 0; }
legend { margin-bottom: .625rem; padding: 0; }
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(1.75rem, 4vw, 2.25rem); line-height: 1.25; margin-bottom: .5rem; letter-spacing: -.03em; font-weight: 600; }
h2 { font-size: 1.25rem; margin: 0; }
.muted { color: var(--muted); }
.eyebrow { display: block; font-size: .75rem; letter-spacing: .08em; color: var(--muted); }
.app-shell { max-width: 1024px; margin: 0 auto; padding: 1.25rem 1rem; }
.app-header { display: flex; gap: .75rem; align-items: center; margin-bottom: 1.75rem; }
.brand-mark { width: 42px; height: 42px; border: 2px solid var(--accent); border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto; }
.brand-mark span { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.brand-name { margin: 0; font-size: 1.125rem; font-weight: 600; }
.brand-tagline { margin: 0; font-size: .8rem; }
.realm-strip { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: 1rem 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin-bottom: 1.75rem; font-size: .8rem; }
.realm-strip strong { font-size: 1rem; margin-right: .625rem; }
.realm-strip > .muted { text-align: right; }
.screen-heading { margin-bottom: 1.5rem; }
.screen-heading p { margin: 0; max-width: 38rem; }
.choice-field { margin-top: 1.25rem; }
.choices { display: flex; flex-wrap: wrap; gap: .5rem; }
.choice { position: relative; cursor: pointer; }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice span { display: flex; justify-content: center; align-items: center; min-height: 48px; padding: .5rem .875rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); font-weight: 500; }
.choice input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 650; }
.choice input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 4px; }
.durations .choice { flex: 1; }
.inline-add { display: flex; flex-wrap: wrap; gap: .5rem; margin-block: .5rem; }
.inline-add input { flex: 1 1 55%; }
.preparation-aside { margin-top: 1.5rem; }
.checklist label { display: flex; gap: .625rem; align-items: center; min-height: 44px; font-size: .875rem; font-weight: 400; color: var(--muted); cursor: pointer; }
input[type="checkbox"] { width: 21px; height: 21px; flex: 0 0 auto; accent-color: var(--accent); }
details { border-top: 1px solid var(--border); margin-top: 1rem; padding-top: .5rem; }
summary { cursor: pointer; min-height: 44px; padding: .5rem 0; font-size: .9rem; }
.breathing-guide p { font-size: .8rem; }
.breathing-visual { position: relative; min-height: 140px; display: grid; place-items: center; }
.breathing-circle { width: 80px; height: 80px; border-radius: 50%; border: 1px solid var(--accent); background: var(--raised); transform: scale(.8); }
.breathing-visual span { position: absolute; font-size: .9rem; }
.breathing-caption { text-align: center; min-height: 1.5rem; }
.breathing-guide button { width: 100%; }
.primary-action { margin-top: 1.5rem; }
.primary-action button { width: 100%; min-height: 56px; }
.home-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; margin-top: .5rem; font-size: .8rem; }
.home-footer button { font-size: inherit; }
.numeric-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.25rem; }
.numeric-fields > div { min-width: 0; }
input.large-input { font-size: 1.75rem; font-weight: 550; padding-block: .5rem; }
.rating-field { margin-bottom: 1.25rem; }
.rating-choices { display: grid; grid-template-columns: repeat(5, 1fr); gap: .5rem; }
.rating-choices .choice span { font-size: 1.125rem; padding-inline: .5rem; }
.rating-endpoints { display: flex; justify-content: space-between; margin-top: .25rem; font-size: .75rem; color: var(--muted); }
.rating-description { font-size: .85rem; margin: .5rem 0; }
.depth-help { margin-top: .25rem; padding-top: 0; }
.depth-help p, .depth-help li, .focus-guide p { font-size: .85rem; }
.depth-help ol { padding-left: 1.5rem; }
.depth-help li { margin-bottom: .375rem; }
.focus-guide .guide-current { color: var(--accent); }
.guide-lesson { margin-top: .5rem; }
.guide-lesson p { margin-block: .5rem; }
.narrow-screen { max-width: 560px; margin: 0 auto; }
.focus-screen { min-height: calc(100vh - 2.5rem); min-height: calc(100dvh - 2.5rem); display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 2rem; }
.timer { font-variant-numeric: tabular-nums; line-height: 1.1; letter-spacing: -.06em; font-weight: 400; }
.focus-timer { font-size: clamp(5rem, 21vw, 10rem); }
.focus-actions { display: flex; flex-direction: column; align-items: center; gap: .75rem; }
.focus-actions > button:first-child { min-width: 200px; }
.parking-form { width: min(100%, 440px); }
.parking-form .button-row { margin-top: .75rem; }
.break-screen { text-align: center; padding-top: 1rem; }
.score-summary { display: flex; justify-content: center; gap: 3rem; padding: 1.5rem 0 1rem; }
.score-summary strong { display: block; font-size: 2.5rem; font-weight: 500; }
.rest-timer { margin-block: 2rem 1.5rem; font-size: 5rem; color: var(--accent); }
.break-screen > button { width: 100%; margin-top: 1rem; }
.level-up { color: var(--accent); animation: appear 1.5s ease-out; }
@keyframes appear { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
dialog { width: min(560px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); max-height: calc(100dvh - 2rem); overflow: auto; background: var(--background); color: var(--text); border: 1px solid var(--border); border-radius: 16px; padding: 1.25rem; }
dialog::backdrop { background: rgb(0 0 0 / .7); }
.dialog-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .75rem; }
dialog > .muted { font-size: .875rem; }
dialog form > button { width: 100%; }
.button-row { display: flex; flex-wrap: wrap; gap: .75rem; }
.button-row > button { flex: 1; }
.import-section { border-top: 1px solid var(--border); padding-top: 1rem; margin-top: 1rem; }
.import-section p { font-size: .875rem; }
.sleep-total { color: var(--accent); margin-top: 1rem; }
.sleep-time { margin-bottom: 1rem; }
.time-parts { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: .5rem; align-items: end; }
.time-parts label { display: block; margin-bottom: .25rem; font-size: .8rem; color: var(--muted); }
.time-parts > span { padding-bottom: .75rem; }
.parking-list ul { padding-left: 1.25rem; overflow-wrap: anywhere; }
.parking-list li { margin-bottom: 1rem; }
.parking-list time { display: block; font-size: .75rem; color: var(--muted); }
.message { padding: .75rem; border-left: 2px solid var(--accent); background: var(--raised); color: var(--text); font-size: .875rem; margin-top: 1rem; }
.status-message { position: fixed; left: 1rem; right: 1rem; bottom: 1rem; max-width: 560px; margin: auto; background: var(--raised); border: 1px solid var(--border); padding: .75rem 1rem; border-radius: var(--radius); z-index: 5; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.progress-heading { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: .5rem; }
.progress-heading .screen-heading { flex: 1 1 250px; }
.progress-heading > button { margin-bottom: 1rem; }
.progress-overview { border-block: 1px solid var(--border); padding-block: 1.25rem; }
.progress-realm { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem 1rem; margin-block: .5rem .875rem; }
.progress-realm h2 { font-size: 1.75rem; font-weight: 500; }
.progress-realm > span:last-child { margin-left: auto; }
#realm_progress { display: block; appearance: none; width: 100%; height: 8px; border: 0; border-radius: 8px; background: var(--raised); color: var(--accent); accent-color: var(--accent); }
#realm_progress::-webkit-progress-bar { background: var(--raised); border-radius: 8px; }
#realm_progress::-webkit-progress-value { background: var(--accent); border-radius: 8px; }
#realm_progress::-moz-progress-bar { background: var(--accent); border-radius: 8px; }
.progress-overview p, .baseline-panel p { font-size: .875rem; margin: .5rem 0 0; }
.progress-overview .practice-days { margin-top: 1.25rem; font-size: 1.125rem; }
.baseline-panel { padding-block: 1.25rem; margin-bottom: 1rem; }
.baseline-panel h2 { font-size: 1.0625rem; font-weight: 500; color: var(--accent); }
.progress-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.25rem; }
.progress-panel { min-width: 0; padding: 1.25rem 1rem; border: 1px solid var(--border); border-radius: var(--radius); }
.progress-panel > p { font-size: .875rem; margin-block: .5rem 1rem; }
.progress-value { display: block; font-size: 1.75rem; font-weight: 500; margin-top: .25rem; }
.chart-container { margin-top: 1rem; }
.chart-container svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-axis-label { font: 18px "Segoe UI", system-ui, sans-serif; fill: var(--muted); }
.chart-grid-line { stroke: var(--border); stroke-width: 1; }
.chart-series { fill: var(--accent); stroke: var(--accent); stroke-width: 2; }
path.chart-series { fill: none; }
.chart-series-1 { fill: #dfc7a2; stroke: #dfc7a2; stroke-dasharray: 5 4; }
.chart-baseline { stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 2 5; }
.chart-legend { display: flex; flex-wrap: wrap; gap: .5rem 1rem; font-size: .8rem; color: var(--muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: .375rem; }
.chart-legend span::before { content: ""; display: inline-block; width: 1rem; border-top: 2px solid var(--accent); }
.chart-legend .legend-series-1::before { border-color: #dfc7a2; border-top-style: dashed; }
.chart-legend .legend-baseline::before { border-color: var(--muted); border-top-style: dotted; }
.chart-empty { padding: 1rem 0; font-size: .875rem; }
.chart-container details { margin-top: .75rem; }
.chart-table-wrapper { max-height: 320px; overflow: auto; }
.chart-table-wrapper table { width: 100%; border-collapse: collapse; font-size: .8rem; font-variant-numeric: tabular-nums; }
.chart-table-wrapper th, .chart-table-wrapper td { padding: .5rem; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; }
.chart-table-wrapper th:first-child { text-align: left; }
.chart-table-wrapper thead { background: var(--surface); }
@media (max-width: 600px) {
  #prepare_screen, #log_screen, #progress_screen { padding-bottom: calc(100px + env(safe-area-inset-bottom)); }
  #progress_back_button { position: fixed; left: 1rem; right: 1rem; bottom: max(.75rem, env(safe-area-inset-bottom)); z-index: 1; min-height: 56px; margin: 0; border-color: var(--border); background: var(--surface); }
  .status-message { bottom: calc(100px + env(safe-area-inset-bottom)); }
  .primary-action { position: fixed; left: 1rem; right: 1rem; bottom: 0; z-index: 1; margin-top: 0; background: var(--background); padding-block: .75rem max(.75rem, env(safe-area-inset-bottom)); }
  .numeric-fields { gap: .75rem; }
  .numeric-fields label { font-size: .85rem; }
}
@media (min-width: 768px) {
  .progress-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .app-shell { padding: 2rem 2.5rem; }
  .app-header { margin-bottom: 2.5rem; }
  .prepare-layout { display: grid; grid-template-columns: 1.4fr 1fr; gap: 3rem; }
  .preparation-aside { margin-top: 0; border-left: 1px solid var(--border); padding-left: 2rem; }
  #prepare_screen > .primary-action { max-width: 500px; margin-top: 2rem; }
  .home-footer { justify-content: flex-start; margin-top: 1.5rem; }
  .focus-screen { min-height: calc(100vh - 4rem); min-height: calc(100dvh - 4rem); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
