:root {
  color-scheme: light;
  font-family: "Hiragino Sans", "Yu Gothic", Meiryo, sans-serif;
  color: #172d25;
  background: var(--page, #f5f5ed);
  --sky: #e7f1fb;
  --lavender: #f0eafa;
  --pink: #faeceb;
  --mint: #e7f3ed;
  --sand: #f2e9d8;
  --mist: #e7edf0;
  --lemon: #f8f2cd;
  --blue: #1e5684;
  --purple: #5a3a82;
  --wine: #862e49;
  --teal: #0f615b;
  --amber: #795016;
  --navy: #354c68;
  --ink: #172d25;
  --muted: #526559;
  --forest: #174b3a;
  --deep: #11382c;
  --lime: #e4edb9;
  --paper: #fffefa;
  --border: #d9e0d1;
  --warm: #f3e8d8;
  --danger: #8d302a;
  --shadow: 0 8px 26px rgba(40, 63, 51, .045);
  font-size: 16px;
}

:root[data-background="1"] { --page: var(--sky); }
:root[data-background="2"] { --page: var(--lavender); }
:root[data-background="3"] { --page: var(--pink); }
:root[data-background="4"] { --page: var(--mint); }
:root[data-background="5"] { --page: var(--sand); }
:root[data-background="6"] { --page: var(--mist); }
:root[data-background="7"] { --page: var(--lemon); }
:root[data-accent="1"] { --forest: var(--blue); --deep: #183956; --lime: #dbeefa; }
:root[data-accent="2"] { --forest: var(--purple); --deep: #3c285a; --lime: #eae1f6; }
:root[data-accent="3"] { --forest: var(--wine); --deep: #5e2335; --lime: #f5dee5; }
:root[data-accent="4"] { --forest: var(--teal); --deep: #12433f; --lime: #d9efe7; }
:root[data-accent="5"] { --forest: var(--amber); --deep: #493316; --lime: #f6e5bf; }
:root[data-accent="6"] { --forest: var(--navy); --deep: #26364b; --lime: #e0e9f4; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; line-height: 1.65; }
body:has(dialog[open]) { overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .6; }
form[data-busy="yes"] [type="submit"] { cursor: wait; }
a { color: var(--forest); text-underline-offset: .2em; }
:focus-visible { outline: 3px solid var(--forest); outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.35; }
h1 { font-size: clamp(1.65rem, 3vw, 2.25rem); letter-spacing: -.035em; }
h2 { font-size: 1.19rem; letter-spacing: -.015em; }
h3 { font-size: 1.02rem; }
ul { margin: 0; padding: 0; }

.skip-link { position: absolute; top: -100px; z-index: 10; padding: 8px 14px; background: var(--paper); }
.skip-link:focus { top: 6px; left: 6px; }
.site-header { background: var(--paper); border-bottom: 1px solid var(--border); }
.header-inner, .nav-inner { display: flex; align-items: center; justify-content: space-between; width: min(1160px, 100% - 64px); margin-inline: auto; }
.header-inner { min-height: 73px; gap: 16px; }
.brand, .identity { display: flex; align-items: center; gap: 11px; }
.brand-name { font-size: 1.1rem; font-weight: 750; letter-spacing: -.035em; white-space: nowrap; }
.brand-mark { width: 31px; height: 33px; border-radius: 9px; background: var(--forest); position: relative; display: inline-block; }
.brand-mark::before { content: ""; position: absolute; inset: 7px 8px; border: 1.5px solid #f1f5dd; border-radius: 2px; }
.brand-mark::after { content: ""; position: absolute; width: 6px; height: 1.5px; background: #f1f5dd; left: 13px; top: 12px; box-shadow: 0 4px #f1f5dd; }
.identity { font-size: .84rem; min-width: 0; }
.identity span { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
.nickname-edit { min-width: 0; }
.navigation { background: var(--paper); border-bottom: 1px solid var(--border); }
.nav-inner { justify-content: start; gap: 26px; }
.nav-link { min-height: 51px; display: inline-flex; align-items: center; font-weight: 650; font-size: .9rem; color: var(--muted); text-decoration: none; border-bottom: 3px solid transparent; padding: 3px 3px 0; white-space: nowrap; }
.nav-link[aria-current="page"] { color: var(--deep); border-bottom-color: var(--forest); }

main { width: min(1160px, 100% - 64px); margin-inline: auto; padding: 36px 0 64px; }
main:focus { outline: none; }
main.auth-main { width: min(1020px, 100% - 64px); padding-top: clamp(34px, 7vw, 94px); }
.loading { padding: 2rem 0; text-align: center; color: var(--muted); }
.auth-layout { display: grid; grid-template-columns: .87fr 1fr; gap: 20px; align-items: stretch; }
.auth-layout-single { grid-template-columns: minmax(0, 1fr); max-width: 490px; margin-inline: auto; }
.intro-panel, .auth-panel { border-radius: 24px; }
.intro-panel { background: var(--deep); color: white; position: relative; isolation: isolate; overflow: hidden; padding: clamp(28px, 5vw, 58px); display: flex; flex-direction: column; justify-content: space-between; gap: 38px; }
.intro-panel .intro-title { color: #ffffff; margin: 0; font-size: clamp(2rem, 4.8vw, 3.65rem); letter-spacing: -.06em; line-height: 1.22; font-weight: 780; }
.intro-panel p { color: #d5e2d6; max-width: 26em; margin-top: 20px; }
.illustration { height: 131px; width: min(270px, 100%); display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); align-items: end; gap: 10px; padding: 13px 0 10px; background: repeating-linear-gradient(to top, #325749 0 1px, transparent 1px 33px); }
.illustration span { background: #47715b; height: 25%; border-radius: 5px 5px 0 0; }
.illustration span:nth-child(2) { height: 46%; }
.illustration span:nth-child(3) { height: 37%; }
.illustration span:nth-child(4) { background: #8aab77; height: 63%; }
.illustration span:nth-child(5) { height: 48%; }
.illustration span:nth-child(6) { background: #e4edb9; height: 90%; }
.illustration span:nth-child(7) { height: 67%; background: #88a679; }
.auth-panel { padding: clamp(22px, 4vw, 42px); background: var(--paper); border: 1px solid var(--border); box-shadow: var(--shadow); }
.auth-panel h1 { font-size: clamp(1.38rem, 3vw, 1.78rem); margin-bottom: 6px; }
.auth-panel form { margin-top: 22px; }
.auth-actions { display: flex; flex-wrap: wrap; column-gap: 16px; row-gap: 7px; margin-top: 19px; }
.auth-actions a { font-size: .84rem; font-weight: 670; }
.auth-role { display: flex; gap: 4px; background: #eff2e9; border-radius: 11px; padding: 4px; margin-bottom: 23px; }
.auth-role button { flex: 1; border: 0; background: transparent; font-size: .88rem; font-weight: 670; color: var(--muted); border-radius: 8px; min-height: 44px; padding: 5px 12px; }
.auth-role button[aria-pressed="true"] { background: white; color: var(--forest); box-shadow: 0 1px 3px #172d251a; }

.page-heading { margin-bottom: 23px; display: flex; justify-content: space-between; align-items: end; flex-wrap: wrap; gap: 14px; }
.page-heading p { color: var(--muted); margin-top: 7px; }
.eyebrow { color: var(--muted); font-size: .79rem; font-weight: 700; letter-spacing: .035em; margin-bottom: 4px; }
.muted, .help { color: var(--muted); }
.help { font-size: .82rem; }
.grid-two { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-two > * { min-width: 0; }
.stack { display: grid; gap: 18px; }
.form-stack { display: grid; gap: 13px; }
.card { border: 1px solid var(--border); border-radius: 19px; box-shadow: var(--shadow); background: var(--paper); padding: clamp(17px, 2.7vw, 29px); min-width: 0; }
.card h2 + .muted { margin-top: 4px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.section-heading .muted { font-size: .86rem; }
.hero { background: var(--deep); color: #fff; border-color: var(--deep); display: flex; flex-direction: column; justify-content: center; min-height: 235px; padding: clamp(23px, 4vw, 41px); }
.hero p { color: #d5e2d6; }
.hero .hero-number { color: white; font-size: clamp(2.7rem, 7vw, 4.9rem); line-height: 1.1; letter-spacing: -.055em; margin: 9px 0 8px; }
.hero-number small { font-size: .28em; font-weight: 650; letter-spacing: 0; margin-left: 6px; }
.hero .tag { background: #e4edb9; color: #234132; align-self: start; margin-top: 13px; }
.tag { background: #eef1e7; display: inline-flex; align-items: center; border-radius: 99px; padding: 3px 11px; color: #3a5144; font-size: .77rem; font-weight: 720; }
.tag.good { background: var(--lime); }
.tag.outside { background: var(--warm); }
.phase-banner { padding: 12px 16px; color: #4e421e; background: #f6edce; border: 1px solid #eadcae; border-radius: 11px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; white-space: nowrap; }

label { display: grid; gap: 5px; min-width: 0; font-size: .86rem; font-weight: 690; }
input, select { background: #fff; font-weight: 480; width: 100%; min-width: 0; min-height: 43px; line-height: normal; border: 1px solid #becbbb; border-radius: 9px; padding: 8px 10px; }
input::placeholder { color: #65736a; }
input[type="date"] { min-inline-size: 0; }
.button { border: 1px solid transparent; border-radius: 9px; padding: 8px 14px; min-height: 43px; display: inline-flex; align-items: center; justify-content: center; width: fit-content; gap: 6px; font-size: .87rem; font-weight: 720; line-height: 1.35; text-decoration: none; white-space: nowrap; }
.button.primary { background: var(--forest); color: white; }
.button.primary:hover { background: var(--deep); }
.button.secondary { color: var(--forest); border-color: #b6c8b4; background: #fffefa; }
.button.secondary:hover { background: #edf3e9; }
.button.ghost { color: var(--forest); border-color: transparent; background: transparent; padding-inline: 8px; }
.button.ghost:hover { background: #edf3e9; }
.button.danger { color: white; background: var(--danger); }
.button.danger:hover { background: #6e231e; }
.button.small { min-height: 34px; padding-block: 5px; font-size: .8rem; }
.button.full { width: 100%; }
.button-row { display: flex; align-items: center; column-gap: 8px; row-gap: 7px; flex-wrap: wrap; }
.stopwatch { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.stopwatch .help { margin-block: 6px; }
.stopwatch-time { margin: 4px 0; font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.class-import-form { margin-top: 14px; }
.class-preview { max-height: min(48vh, 400px); overflow: auto; }
.theme-card { max-width: 740px; }
.theme-card form { margin-top: 17px; gap: 20px; }
.theme-group { margin: 0; padding: 0; border: 0; min-width: 0; }
.theme-group legend { font-size: .9rem; font-weight: 720; margin-bottom: 8px; }
.theme-options { display: flex; flex-wrap: wrap; gap: 8px; }
.theme-option {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
}
.theme-option:has(input:checked), .theme-preset[aria-pressed="true"] { border-color: var(--forest); box-shadow: inset 0 0 0 1px var(--forest); }
.theme-option input { accent-color: var(--forest); width: 16px; height: 16px; min-height: 0; margin: 0; }
.theme-swatch { width: 18px; height: 18px; border: 1px solid #172d2552; border-radius: 50%; }
.theme-preset { background: var(--paper); font-weight: 690; }
.theme-option.is-locked { cursor: default; color: var(--muted); background: #f3f4ef; opacity: 1; }
.theme-option small, .curl-choice small { display: block; font-size: .7rem; line-height: 1.2; }
.reward-progress { margin-top: 7px; color: var(--muted); font-size: .85rem; }
.reward-progress strong { color: var(--forest); }
.theme-swatch-pair { width: 24px; display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; border-radius: 5px; }
.theme-option [data-color="background-0"] { background: #f5f5ed; }
.theme-option [data-color="background-1"] { background: var(--sky); }
.theme-option [data-color="background-2"] { background: var(--lavender); }
.theme-option [data-color="background-3"] { background: var(--pink); }
.theme-option [data-color="background-4"] { background: var(--mint); }
.theme-option [data-color="background-5"] { background: var(--sand); }
.theme-option [data-color="background-6"] { background: var(--mist); }
.theme-option [data-color="background-7"] { background: var(--lemon); }
.theme-option [data-color="accent-0"] { background: #174b3a; }
.theme-option [data-color="accent-1"] { background: var(--blue); }
.theme-option [data-color="accent-2"] { background: var(--purple); }
.theme-option [data-color="accent-3"] { background: var(--wine); }
.theme-option [data-color="accent-4"] { background: var(--teal); }
.theme-option [data-color="accent-5"] { background: var(--amber); }
.theme-option [data-color="accent-6"] { background: var(--navy); }
.form-error { color: var(--danger); font-size: .85rem; }
.form-error:empty { display: none; }

.range-form { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
.range-form label { flex: 0 1 159px; }
.range-form .search-label { flex: 1 1 210px; }
.range-form .button { align-self: end; }
.range-form .form-error { width: 100%; }
.add-form { margin-top: 14px; }
.home-entry-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.home-entry-actions .button { width: 100%; white-space: normal; text-align: center; padding-inline: 8px; }
.home-entry-actions [type="submit"] { grid-column: 1 / -1; }
.home-entry-actions .ghost { background: #f2f4ec; }
.add-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.day-list { list-style: none; display: grid; grid-template-columns: repeat(7, 1fr); gap: 7px; }
.day-chip { display: grid; min-height: 83px; align-content: center; justify-items: center; gap: 3px; padding: 7px 4px; background: #f7f8f1; color: var(--ink); border: 1px solid var(--border); border-radius: 10px; text-decoration: none; text-align: center; }
.day-chip:hover, .day-chip[aria-current="date"] { background: var(--lime); border-color: #8fa97f; }
.day-chip[aria-current="date"] { box-shadow: inset 0 0 0 1px var(--forest); }
.day-chip time { font-size: .81rem; color: var(--muted); }
.day-chip strong { font-weight: 730; font-size: .88rem; }
.history-date { max-width: 185px; }
.history-head { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 15px; }
.history-total { margin-right: auto; }
.history-calendar { padding: clamp(12px, 2.7vw, 29px); }
.history-calendar-controls { display: grid; grid-template-columns: 1fr auto 1fr; gap: 6px; align-items: center; margin: 4px 0 10px; }
.history-calendar-controls .button { min-height: 40px; padding-inline: 8px; }
.history-calendar-controls .button:disabled { opacity: .45; cursor: default; }
.history-calendar-controls .button:last-child { justify-self: end; }
.history-month-totals { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 5px; font-size: .84rem; color: var(--muted); margin-bottom: 6px; }
.history-month-count { color: #753a17; font-weight: 750; }
.history-month { table-layout: fixed; border: 1px solid var(--border); }
.history-month th, .history-month td { padding: 0; text-align: center; white-space: normal; border: 1px solid var(--border); }
.history-month th { height: 29px; font-size: .78rem; }
.history-month td, .history-month tbody tr:nth-child(even) { background: var(--paper); }
.history-month td { font-size: clamp(.66rem, 2.9vw, .91rem); line-height: 1.12; }
.history-month td a { display: flex; flex-direction: column; justify-content: center; gap: 4px; min-height: 46px; padding: 3px 0; color: inherit; text-decoration: none; }
.history-month td a:is(:hover, [aria-current="date"]) { box-shadow: inset 0 0 0 2px var(--forest); }
.history-month a:focus-visible { outline-offset: -3px; }
.history-month td time { display: block; color: var(--muted); font-size: .75rem; font-weight: 700; }
.history-month td.history-month-missing { color: #753a17; background: #fff0d9; }
.history-month td.history-month-empty { color: #687168; background: #f6f7f2; }
.history-month td.history-month-empty time { margin-bottom: 4px; }
.history-month td.history-month-outside { color: var(--muted); background: #f7f7ef; }
.entries { list-style: none; }
.entry-row { border-top: 1px solid var(--border); padding-block: 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.entry-row:last-child { padding-bottom: 0; }
.entry-row .entry-number { font-size: 1.1rem; font-weight: 750; line-height: 1.3; }
.empty { padding: 15px 0 4px; font-size: .9rem; color: var(--muted); }

.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 8.5rem), 1fr)); gap: 1px; background: var(--border); padding: 0; margin: 13px 0 0; border-radius: 10px; border: 1px solid var(--border); overflow: hidden; }
.stats-overview { align-items: start; }
.stats-own { border-top: 3px solid var(--forest); }
.stats-filters { display: grid; gap: 10px; }
.stats-range-label { color: var(--muted); font-size: .88rem; margin: -7px 2px 0; }
.chart-swipe { margin: 0; }
.metric small { display: block; font-size: .8rem; font-weight: 600; }
.stats-feedback { font-size: .83rem; font-weight: 700; color: var(--forest); }
.stats-period + .range-form, .rest-button, .season-settings { margin-top: 12px; }
.stats-leading { margin-top: 8px; font-size: 1.25rem; font-weight: 720; }
.study-chart-scroll { overflow-x: auto; margin-top: 12px; padding-bottom: 4px; }
.study-chart { list-style: none; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(2.75rem, 1fr); margin: 0; padding: 0; }
.study-chart-day { text-align: center; font-size: .8rem; white-space: nowrap; }
.study-chart-plot { height: 6rem; border-bottom: 1px solid var(--border); position: relative; }
.study-chart-bar { appearance: none; position: absolute; top: 50%; left: 50%; width: 6rem; height: 1rem; border: 0; background: transparent; transform: translate(-50%, -50%) rotate(-90deg); }
.study-chart-bar::-webkit-progress-bar { background: transparent; }
.study-chart-bar::-webkit-progress-value { background: var(--forest); border-radius: 0 4px 4px 0; }
.study-chart-bar::-moz-progress-bar { background: var(--forest); border-radius: 0 4px 4px 0; }
.study-chart-zero, .study-chart-missing { position: absolute; bottom: 3px; left: 50%; transform: translateX(-50%); }
.study-chart-zero { width: .46rem; height: .46rem; border-radius: 50%; background: var(--forest); }
.study-chart-missing { width: .64rem; border-bottom: 2px dashed var(--muted); }
.study-chart-day time { display: block; margin-top: 5px; color: var(--muted); }
.study-chart-value { font-weight: 650; }
.study-outside-label { display: block; color: var(--muted); }
.metric { min-width: 0; padding: 11px 9px; background: #fbfcf7; }
.metric dt { color: var(--muted); font-size: .75rem; line-height: 1.4; }
.metric dd { margin: 3px 0 0; font-size: clamp(1.09rem, 2.4vw, 1.55rem); font-weight: 770; font-variant-numeric: tabular-nums; }
.metric dd span { font-size: .7rem; margin-left: 3px; }
.coverage { display: grid; align-items: center; grid-template-columns: minmax(0, 1fr) auto; gap: 13px; margin: 10px 0 19px; }
.progress { appearance: none; width: 100%; height: 9px; border: 0; border-radius: 20px; background: #eaeee3; overflow: hidden; }
.progress::-webkit-progress-bar { background: #eaeee3; }
.progress::-webkit-progress-value { background: #5f8b61; border-radius: 20px; }
.progress::-moz-progress-bar { background: #5f8b61; border-radius: 20px; }
.missing-list { list-style: none; display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.missing-list a { font-size: .83rem; padding: 7px 11px; text-decoration: none; border-radius: 8px; border: 1px solid var(--border); display: block; background: #f8f9f3; }
.missing-list a:hover { background: #edf3df; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 11px; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: .9rem; }
th, td { padding: 11px 13px; border-bottom: 1px solid var(--border); white-space: nowrap; }
thead { background: #eff3e7; font-size: .82rem; text-align: left; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:nth-child(even) { background: #fafbf6; }
td:first-child a { font-weight: 720; }
td a:hover { color: #28664c; }
td.numeral, th.numeral { text-align: right; font-variant-numeric: tabular-nums; }
.export-panel { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.export-panel label { font-size: .77rem; }
.export-panel select { min-width: 122px; }
.target-days { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 6px; }
.target-cell { padding: 7px 9px; border: 1px solid var(--border); border-radius: 8px; font-size: .79rem; }
.target-cell time { display: block; font-weight: 680; }
.account-code { font-family: ui-monospace, monospace; width: 100%; display: block; background: #eff3e7; border: 1px solid var(--border); border-radius: 9px; padding: 11px 12px; font-size: 1rem; overflow-wrap: anywhere; }
.account-filters { margin-top: 10px; }
.account-filtered { margin-top: 12px; }

.notice { position: fixed; right: 24px; bottom: 24px; z-index: 2; max-width: min(440px, 100% - 48px); border-radius: 11px; background: #153e30; color: white; padding: 10px 15px; box-shadow: 0 6px 18px #17382b26; font-size: .9rem; }
.notice:empty { display: none; }
.notice { pointer-events: none; }
.notice-praise { display: block; margin-top: 4px; color: #fff; font-weight: 720; white-space: pre-line; }
.study-feedback { margin-top: 13px; border-inline-start: 3px solid var(--forest); border-radius: 7px; background: var(--lime); padding: 9px 12px; }
.study-feedback h3 { color: var(--forest); font-size: .8rem; }
.study-feedback p { margin-top: 3px; white-space: pre-line; font-weight: 680; }
.ranking-notice .button-row { margin-top: 8px; }
.ranking-settings { margin-top: 16px; scroll-margin-top: 12px; }
.ranking-check { display: flex; gap: 8px; align-items: center; min-height: 44px; }
.ranking-check input { width: 18px; min-height: 18px; height: 18px; accent-color: var(--forest); }
.ranking-guide { margin-top: 13px; border-top: 1px solid var(--border); padding-top: 9px; }
.ranking-guide summary { color: var(--forest); cursor: pointer; font-weight: 700; padding: 5px 0; }
.ranking-guide dl { margin: 6px 0 10px; font-size: .88rem; }
.ranking-guide dt { font-weight: 720; margin-top: 6px; }
.ranking-guide dd { margin: 0; }
.ranking-archive summary { color: var(--forest); font-weight: 720; cursor: pointer; }
.ranking-archive-list { list-style: none; margin-top: 10px; }
.ranking-archive-list li { border-top: 1px solid var(--border); }
.ranking-archive-list a { display: grid; gap: 3px; padding: 10px 2px; color: var(--ink); text-decoration: none; }
.ranking-archive-list a:hover strong, .ranking-archive-list a[aria-current="page"] strong { text-decoration: underline; }
.ranking-archive-title { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
/* Student ranking */
.ranking-layout { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: clamp(12px, 2vw, 20px); align-items: start; }
.ranking-layout .ranking-archive { grid-column: 1 / -1; }
.ranking-personal {
  background: linear-gradient(145deg, var(--forest), var(--deep) 73%);
  color: white; border-color: var(--deep); padding: clamp(19px, 3vw, 30px);
}
.ranking-personal-header, .ranking-board-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 7px 12px; }
.ranking-personal-header h2 { font-size: 1rem; }
.ranking-status { background: var(--lime); color: var(--deep); border-radius: 999px; padding: 3px 9px; font-size: .76rem; font-weight: 720; white-space: nowrap; }
.ranking-personal-season { color: #fff; opacity: .88; font-size: .87rem; margin-top: 7px; overflow-wrap: anywhere; }
.ranking-time { font-size: clamp(2.65rem, 6vw, 4.6rem); font-weight: 775; line-height: 1; letter-spacing: -.06em; margin-top: 15px; font-variant-numeric: tabular-nums; }
.ranking-time span { letter-spacing: 0; font-size: .33em; margin-inline-start: .32em; }
.ranking-hours { font-size: .9rem; margin-top: 5px; }
.ranking-praise { color: var(--lime); font-weight: 740; font-size: 1rem; margin-top: 13px; }
.ranking-personal-progress { border-top: 1px solid #ffffff40; margin-top: 15px; padding-top: 11px; }
.ranking-personal-progress p { display: flex; gap: 8px; align-items: baseline; margin-bottom: 6px; }
.ranking-personal-progress strong { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.ranking-personal-progress span, .ranking-personal-dates { opacity: .9; font-size: .78rem; }
.ranking-personal-dates { margin-top: 13px; }
.ranking-first-entry { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin-top: 7px; color: #fff; font-weight: 720; }
.ranking-first-entry:focus-visible { outline-color: var(--lime); }
.ranking-own-badge { color: var(--deep); background: var(--lime); margin-top: 9px; }
.ranking-board-controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 175px), 1fr)); gap: 9px; margin-bottom: 17px; }
.ranking-pick-season { margin-bottom: 12px; }
.ranking-board > a + .ranking-board-controls { margin-top: 12px; }
.ranking-choice > span { display: block; color: var(--muted); font-size: .79rem; font-weight: 700; margin-bottom: 4px; }
.ranking-toggle { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 3px; gap: 3px; border-radius: 9px; background: #eef1eb; }
.ranking-toggle a { display: grid; text-align: center; align-content: center; min-height: 44px; border-radius: 7px; padding: 3px 4px; text-decoration: none; color: var(--ink); font-size: .84rem; font-weight: 680; }
.ranking-toggle a[aria-current="page"] { background: var(--deep); color: white; }
.ranking-toggle a:not([aria-current="page"]):hover { background: var(--paper); }
.ranking-board-heading h2 { font-size: 1.08rem; }
.ranking-own-position { background: var(--lime); color: var(--deep); font-variant-numeric: tabular-nums; }
.ranking-groups { list-style: none; margin: 8px 0 0; padding: 0; }
.ranking-groups > li { border-block-start: 1px solid var(--border); }
.ranking-groups summary { cursor: pointer; list-style: none; }
.ranking-groups summary::-webkit-details-marker { display: none; }
.ranking-groups summary:hover { background: #f3f5ed; }
.ranking-row { display: grid; min-height: 50px; grid-template-columns: 2.55rem minmax(0, 1fr) max-content; align-items: center; gap: 9px; padding: 6px 3px; }
.ranking-position { font-weight: 765; letter-spacing: -.04em; font-variant-numeric: tabular-nums; padding-inline: 4px; }
.ranking-top .ranking-position { color: var(--deep); background: var(--lime); border-radius: 7px; padding: 3px 4px; }
.ranking-position small, .ranking-value small { font-size: .72em; letter-spacing: normal; margin-inline-start: 2px; }
.ranking-row-body { display: grid; gap: 4px; min-width: 0; }
.ranking-row-name { font-weight: 695; font-size: .89rem; overflow-wrap: anywhere; }
.ranking-value { font-weight: 747; font-variant-numeric: tabular-nums; text-align: end; }
.ranking-chevron { margin-inline-start: 3px; color: var(--forest); }
.ranking-groups details[open] .ranking-chevron { display: inline-block; transform: rotate(180deg); }
.ranking-tied-names { padding: 0 8px 10px 3.2rem; list-style: none; color: var(--muted); display: grid; gap: 4px; font-size: .88rem; overflow-wrap: anywhere; }
.ranking-row progress, .ranking-personal-progress progress { display: block; width: 100%; height: 5px; border: 0; border-radius: 20px; appearance: none; background: #e7ede5; color: var(--forest); }
.ranking-row progress::-webkit-progress-bar, .ranking-personal-progress progress::-webkit-progress-bar { background: transparent; border-radius: 20px; }
.ranking-row progress::-webkit-progress-value { background: currentColor; border-radius: 20px; }
.ranking-row progress::-moz-progress-bar { background: currentColor; border-radius: 20px; }
.ranking-personal-progress progress { color: var(--lime); background: #ffffff40; height: 6px; }
.ranking-personal-progress progress::-webkit-progress-value { background: currentColor; border-radius: 20px; }
.ranking-personal-progress progress::-moz-progress-bar { background: currentColor; border-radius: 20px; }
.teacher-assigned-class { align-self: end; padding: 5px 0 7px; color: var(--muted); }
.teacher-assigned-class strong { color: var(--ink); }
@media (max-width: 650px) {
  .ranking-layout { grid-template-columns: minmax(0, 1fr); }
  .ranking-board-controls { grid-template-columns: minmax(0, 1fr); }
}
dialog { width: min(460px, 100% - 32px); padding: 24px; border: 1px solid var(--border); border-radius: 19px; color: var(--ink); background: var(--paper); box-shadow: 0 14px 45px #18382d28; }
dialog:has(.entry-import-preview) { width: min(820px, 100% - 32px); }
.entry-import-preview { max-height: min(44vh, 390px); }
.entry-import-preview th { position: sticky; top: 0; background: #eff3e7; }
dialog::backdrop { background: #102c22a3; }
dialog h2 { margin-bottom: 9px; }
dialog p { margin-bottom: 9px; }
dialog .form-error { margin-bottom: 0; }

@media (max-width: 780px) {
  .header-inner, .nav-inner, main, main.auth-main { width: calc(100% - 36px); }
  .auth-layout { grid-template-columns: minmax(0, 1fr); max-width: 480px; margin-inline: auto; gap: 11px; }
  .intro-panel { min-height: auto; padding: 24px; gap: 0; }
  .intro-panel .intro-title { font-size: 1.78rem; }
  .intro-panel .intro-title br { display: none; }
  .intro-panel p { margin-top: 7px; font-size: .86rem; }
  .illustration { display: none; }
  main.auth-main { padding-top: 22px; }
  .grid-two { gap: 12px; }
  .day-list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 580px) {
  .header-inner, .nav-inner, main, main.auth-main { width: calc(100% - 30px); }
  .auth-layout .intro-panel { display: none; }
  .header-inner { min-height: 59px; gap: 8px; }
  .brand-mark { width: 29px; height: 31px; }
  .identity { gap: 4px; }
  .identity span { max-width: 28vw; }
  .nav-inner { justify-content: space-between; gap: 4px; }
  .nav-link { min-height: 46px; font-size: .82rem; }
  main { padding-top: 24px; }
  .grid-two { grid-template-columns: minmax(0, 1fr); }
  .hero { min-height: 163px; }
  .range-form label { flex: 1 1 128px; }
  .range-form .button { min-height: 42px; }
  .page-heading { margin-bottom: 17px; }
  .notice { bottom: 13px; right: 13px; max-width: calc(100% - 26px); }
  input, select { font-size: 1rem; }
}

@media (max-width: 340px) {
  .nav-link, .identity .button { font-size: .75rem; }
  .day-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .add-fields { grid-template-columns: minmax(0, 1fr); }
}

.home-window {
  height: 88px;
  padding: 5px;
  border: 1px solid #b2a993;
  border-radius: 13px;
  background: #ded5c1;
  box-shadow: inset 0 -2px #b8ac92, 0 3px 8px #172d2510;
  --sky-top: #9dbdd0;
  --sky-base: #f4dca9;
  --window-light: #fff1b3;
}
.home-window[data-home-window="day"] {
  --sky-top: #4195d5;
  --sky-base: #b9e2f1;
  --window-light: #eefbff;
}
.home-window[data-home-window="evening"] {
  --sky-top: #bf775a;
  --sky-base: #f5b971;
  --window-light: #ffdea0;
}
.home-window[data-home-window="night"] {
  --sky-top: #122345;
  --sky-base: #344c72;
  --window-light: #b4c8ee;
}
.window-view {
  position: relative;
  height: 100%;
  isolation: isolate;
  overflow: hidden;
  border: 1px solid #857e70;
  border-radius: 8px;
  background:
    radial-gradient(circle at 72% 37%, var(--window-light) 0 9px, transparent 10px),
    radial-gradient(ellipse at 72% 48%, var(--window-light) 0, transparent 38%),
    linear-gradient(180deg, var(--sky-top) 8%, var(--sky-base) 83%);
}
.window-view::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(90deg, transparent calc(50% - 1px), #cabda4 calc(50% - 1px) calc(50% + 2px), transparent calc(50% + 2px));
  box-shadow: inset 0 2px 5px #142d3c52;
}
.window-ridge, .window-hills { position: absolute; inset: 0; }
.window-ridge {
  background: #526962;
  clip-path: polygon(0 73%, 8% 63%, 17% 64%, 29% 32%, 34% 37%, 39% 51%, 49% 67%, 58% 65%, 67% 75%, 78% 64%, 89% 53%, 100% 64%, 100% 100%, 0 100%);
}
.window-hills {
  background: #344b43;
  clip-path: polygon(0 80%, 10% 88%, 18% 90%, 29% 77%, 40% 81%, 50% 90%, 62% 86%, 70% 91%, 84% 81%, 94% 73%, 100% 75%, 100% 100%, 0 100%);
}
.home-window + .page-heading { margin-bottom: 0; }
.home-season-badges { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; }
.home-season-badges .tag { background: var(--lime); color: var(--ink); overflow-wrap: anywhere; }

.ghost-legend { display: flex; flex-wrap: wrap; gap: 13px; color: var(--muted); font-size: .8rem; }
.ghost-legend span { display: inline-flex; align-items: center; gap: 5px; }
.ghost-legend i { width: 12px; height: 11px; border-radius: 2px; }
.ghost-key-current { background: var(--forest); }
.ghost-key-previous { border: 2px solid var(--muted); }
.ghost-chart {
  --plot-height: 96px;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  list-style: none;
}
.ghost-day { min-width: 0; text-align: center; }
.ghost-weekday { display: block; font-size: .8rem; font-weight: 700; }
.ghost-plot {
  position: relative;
  overflow: hidden;
  height: var(--plot-height);
  margin-top: 5px;
  border-bottom: 1px solid var(--border);
  background: repeating-linear-gradient(to top, transparent 0 calc(25% - 1px), #dfe5db calc(25% - 1px) 25%);
}
.ghost-bar {
  appearance: none;
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--plot-height);
  height: 12px;
  border: 0;
  background: transparent;
  transform: translate(-50%, -50%) rotate(-90deg);
}
.ghost-bar-previous { height: 23px; }
.ghost-bar::-webkit-progress-bar { background: transparent; }
.ghost-bar-current::-webkit-progress-value { background: var(--forest); border-radius: 0 3px 3px 0; }
.ghost-bar-current::-moz-progress-bar { background: var(--forest); border-radius: 0 3px 3px 0; }
.ghost-bar-previous::-webkit-progress-value { background: transparent; border: 2px solid var(--muted); border-radius: 0 4px 4px 0; }
.ghost-bar-previous::-moz-progress-bar { background: transparent; border: 2px solid var(--muted); border-radius: 0 4px 4px 0; }
.ghost-zero { position: absolute; bottom: 2px; left: 50%; transform: translateX(-50%); border-radius: 50%; }
.ghost-zero-current { bottom: 4px; width: 6px; height: 6px; background: var(--forest); }
.ghost-zero-previous { width: 10px; height: 10px; border: 1px solid var(--muted); }
.ghost-value { display: block; min-height: 1.6em; line-height: 1.6; white-space: nowrap; font-size: .81rem; }
.ghost-value-current { font-weight: 720; margin-top: 4px; }
.ghost-value-current a { display: inline-flex; justify-content: center; min-width: 100%; padding-block: 3px; }
.ghost-value-current a[aria-current="date"] { background: var(--lime); border-radius: 5px; }
.ghost-value-previous { color: var(--muted); }
.ghost-caption { margin-top: 10px; }
.ghost-total { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); font-size: .85rem; }
.ghost-delta { color: var(--forest); font-weight: 730; }

@media (max-width: 580px) {
  .home-record .add-fields { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
  .home-ghost { padding-inline: 12px; }
  .home-ghost .section-heading { gap: 6px; }
  .ghost-chart { --plot-height: 80px; gap: 2px; }
  .ghost-bar-previous { height: 18px; }
  .ghost-bar-current { height: 9px; }
  .ghost-value { font-size: .72rem; }
  .ghost-total strong { flex-basis: 100%; }
}

@media (max-width: 330px) {
  .home-record .add-fields { grid-template-columns: minmax(0, 1fr); }
}

.stopwatch-state { color: var(--forest); font-size: .83rem; font-weight: 750; }
.stopwatch-actions { margin-block-start: .55rem; }
.stopwatch-actions .button { min-height: 44px; }
[data-action="history-batch-start"] { min-height: 44px; margin-block-end: .65rem; }
.history-batch-dates { min-inline-size: 0; padding: 0; border: 0; }
.history-batch-dates legend { margin-block-end: .5rem; color: #663a17; font-weight: 720; }
.history-batch-day {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .3rem;
  min-height: 44px;
  padding-inline: .2rem;
  border: 1px solid var(--missing-edge);
  border-radius: .3rem;
  background: #fffcf4;
  color: #663a17;
  font-size: .8rem;
  cursor: pointer;
}
.history-batch-day:has(input:checked) { border-color: #8d5a25; background: #ffe5bc; }
.history-batch-day:has(input:focus-visible) { outline: 2px solid #8a581f; outline-offset: 2px; }
.history-batch-day input[type="checkbox"] {
  flex: 0 0 1rem;
  width: 1rem;
  height: 1rem;
  min-height: 0;
  margin: 0;
  accent-color: #784713;
}
.history-batch-count { font-size: .85rem; font-weight: 720; }
