:root[data-palette="cinema"] {
  color-scheme: dark;
  --bg: #171e22;
  --surface: #243136;
  --surface-strong: #2d3d40;
  --text: #f3f5f1;
  --muted: #b9cbc8;
  --line: #40575a;
  --accent: #8adbc4;
  --accent-text: #112921;
  --soft: #304e48;
  --warning: #ffd0bb;
  --warning-bg: #4a3535;
  --nav: #1e2a2e;
  --number: #f3b47b;
  --canvas: #1d292b;
}
:root[data-palette="light"] {
  color-scheme: light;
  --bg: #f7f8f5;
  --surface: #ffffff;
  --surface-strong: #eaf4f0;
  --text: #18282b;
  --muted: #50676a;
  --line: #cbdadb;
  --accent: #006b5b;
  --accent-text: #ffffff;
  --soft: #d8ede7;
  --warning: #a4372c;
  --warning-bg: #ffebe7;
  --nav: #e5efeb;
  --number: #a64b35;
  --canvas: #eef4f0;
}
:root[data-palette="contrast"] {
  color-scheme: dark;
  --bg: #0d1112;
  --surface: #1b2424;
  --surface-strong: #263434;
  --text: #ffffff;
  --muted: #d1ddda;
  --line: #68817d;
  --accent: #f8d475;
  --accent-text: #1a1a10;
  --soft: #41453a;
  --warning: #ffb6ab;
  --warning-bg: #52312e;
  --nav: #111b1b;
  --number: #f8d475;
  --canvas: #172020;
}

body { background: var(--bg); color: var(--text); }
.app { max-width: 760px; }
.masthead { background: var(--nav); border-bottom: 1px solid var(--line); padding-top: calc(11px + env(safe-area-inset-top)); padding-bottom: 11px; }
.brand-logo { width: 46px; height: 54px; }
.brand-logo img { width: 90px; left: -22px; filter: invert(1); mix-blend-mode: screen; }
:root[data-palette="light"] .brand-logo img { filter: none; mix-blend-mode: multiply; }
.brand-name { color: var(--accent); font-size: 12px; line-height: 1.25; }
.brand-subtitle { color: var(--muted); font-size: 11px; }
.masthead > div:nth-child(2) { flex: 1; }
.profile-shortcut { width: 42px; height: 42px; flex: none; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--text); }
.profile-shortcut svg { width: 21px; height: 21px; }
.view { padding-top: 24px; }
.section-title { align-items: start; margin-bottom: 16px; }
.section-title h1 { font-size: 32px; line-height: 1.13; letter-spacing: 0; }
.eyebrow { color: var(--accent); letter-spacing: 0; font-size: 11px; margin-bottom: 5px; }
.badge { background: var(--soft); color: var(--accent); font-size: 12px; margin-top: 6px; }
.project-note { color: var(--muted); border-color: var(--accent); margin-top: 0; }
.segmented { background: var(--canvas); border-color: var(--line); }
.segmented button { color: var(--muted); }
.segmented button.active { background: var(--soft); color: var(--text); }
input, select, textarea { background: var(--surface); border-color: var(--line); color: var(--text); }
.primary, .upload-control { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.secondary, .week-controls button { background: var(--surface); border-color: var(--line); color: var(--text); }
.next-panel { background: var(--soft); border-color: var(--accent); }
.next-panel small, .next-panel strong { color: var(--text); }
.next-panel span { color: var(--muted); }
.week-square { background: var(--surface); border-color: var(--line); color: var(--muted); }
.week-square b { color: var(--text); }
.week-square.active { background: var(--soft); border-color: var(--accent); color: var(--accent); }
.week-square i { background: var(--number); }
.week-toolbar { margin-top: 13px; }
.week-controls { align-items: center; }
.day-heading { align-items: start; }
.day-heading h2 { font-size: 20px; }
.lesson { grid-template-columns: 64px minmax(0, 1fr); gap: 0; background: var(--surface); border-color: var(--line); padding: 0; overflow: hidden; min-height: 112px; }
.lesson.is-next { background: var(--surface-strong); border-color: var(--accent); }
.lesson-index { display: flex; flex-direction: column; align-items: center; justify-content: center; border-right: 1px solid var(--line); color: var(--number); font-size: 32px; font-weight: 800; line-height: 1; }
.lesson-index small { margin-top: 8px; color: var(--muted); font-size: 9px; font-weight: 700; }
.lesson-body { min-width: 0; padding: 14px 16px; }
.lesson-top { display: flex; justify-content: flex-end; margin-bottom: 6px; }
.lesson-time { color: var(--muted); font-size: 12px; font-weight: 700; white-space: nowrap; }
.lesson h3 { font-size: 17px; line-height: 1.3; margin: 0 0 7px; overflow-wrap: anywhere; }
.lesson p { color: var(--muted); font-size: 13px; }
.empty { background: var(--surface); border-color: var(--line); }
.bottom-nav { width: min(100%, 760px); grid-template-columns: repeat(5, minmax(0, 1fr)); background: var(--nav); border-color: var(--line); }
body.has-admin .bottom-nav { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.bottom-nav button { position: relative; color: var(--muted); line-height: 1.1; overflow-wrap: anywhere; }
.bottom-nav button.active { color: var(--accent); }
.notice-badge { position: absolute; top: 0; right: calc(50% - 18px); width: 7px; height: 7px; border-radius: 50%; background: var(--number); }
.settings-block { grid-template-columns: minmax(0, 1fr); min-width: 0; max-width: none; border: 1px solid var(--line); border-radius: 8px; padding: 18px; margin-top: 14px; background: color-mix(in srgb, var(--surface) 82%, var(--bg)); }
.settings-block select, .settings-block .primary { width: 100%; min-width: 0; }
.settings-block h2 { margin: 0 0 4px; }
.settings-block label { margin-top: 2px; }
.identity { display: flex; align-items: center; gap: 15px; padding: 8px 0 20px; }
.identity > div:last-child { min-width: 0; }
.identity strong { display: block; font-size: 21px; overflow-wrap: anywhere; }
.identity span { display: block; color: var(--muted); font-size: 13px; }
.avatar { width: 58px; height: 58px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--soft); color: var(--accent); font-size: 24px; font-weight: 800; }
.palette-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.palette-options button { display: flex; justify-content: center; align-items: center; gap: 6px; min-width: 0; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--text); padding: 10px 5px; font-size: 12px; }
.palette-options button.active { border-color: var(--accent); background: var(--soft); }
.swatch { width: 16px; height: 16px; flex: none; border-radius: 50%; border: 1px solid var(--line); }
.swatch.cinema { background: #8adbc4; }.swatch.light { background: #ffffff; }.swatch.contrast { background: #f8d475; }
.settings-actions { display: grid; gap: 10px; margin: 14px 0 20px; }
.list-action { display: grid; grid-template-columns: 42px minmax(0,1fr) 18px; align-items: center; gap: 12px; width: 100%; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); padding: 13px; text-align: left; }
.list-action > span:nth-child(2) { min-width: 0; }
.list-action strong, .list-action small { display: block; }
.list-action strong { font-size: 15px; }
.list-action small { margin-top: 2px; color: var(--muted); font-size: 12px; font-weight: 500; }
.list-action b { color: var(--accent); font-size: 23px; font-weight: 500; }
.action-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 7px; background: var(--soft); color: var(--accent); font-size: 20px; font-weight: 800; }
.action-icon svg, .admin-entry-icon svg, .reminder-icon svg { width: 22px; height: 22px; }
.admin-entry { width: 100%; display: grid; grid-template-columns: 46px minmax(0,1fr) 18px; align-items: center; gap: 12px; margin: 0 0 18px; padding: 14px; border: 1px solid var(--accent); border-radius: 8px; background: var(--soft); color: var(--text); text-align: left; }
.admin-entry-icon { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 7px; background: var(--accent); color: var(--accent-text); font-size: 22px; }
.admin-entry strong, .admin-entry small { display: block; }
.admin-entry strong { font-size: 16px; }
.admin-entry small { margin-top: 2px; color: var(--muted); font-size: 12px; font-weight: 500; }
.admin-entry b { color: var(--accent); font-size: 25px; }
.reminder-panel { display: grid; gap: 14px; }
.reminder-intro { display: grid; grid-template-columns: 54px minmax(0,1fr); gap: 14px; align-items: center; padding: 17px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.reminder-icon { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 8px; background: var(--soft); color: var(--accent); font-size: 27px; }
.reminder-intro strong { font-size: 17px; }
.reminder-intro p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.reminder-toggle { min-height: 70px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.reminder-toggle span strong, .reminder-toggle span small { display: block; }
.reminder-toggle span small { margin-top: 3px; color: var(--muted); font-weight: 500; }
.reminder-toggle input { appearance: none; width: 48px; height: 28px; border: 1px solid var(--line); border-radius: 14px; background: var(--canvas); padding: 2px; transition: background .2s; }
.reminder-toggle input::before { content: ""; display: block; width: 22px; height: 22px; border-radius: 50%; background: var(--muted); transition: transform .2s, background .2s; }
.reminder-toggle input:checked { background: var(--accent); border-color: var(--accent); }
.reminder-toggle input:checked::before { transform: translateX(19px); background: var(--accent-text); }
.reminder-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.reminder-fields label { display: grid; gap: 6px; min-width: 0; font-weight: 700; }
.reminder-fields select { width: 100%; min-width: 0; }
.logout { margin-bottom: 12px; }
.help-steps { border-top: 1px solid var(--line); margin: 20px 0; }
.help-steps > div { border-bottom: 1px solid var(--line); padding: 16px 0; }
.help-steps p { margin: 7px 0 0; color: var(--muted); }
.project-disclaimer { border-left: 3px solid var(--number); padding-left: 12px; color: var(--muted); }
a { color: var(--accent); }
.notice-list, #admin-content .list { display: grid; gap: 10px; }
.notice { border: 1px solid var(--line); border-radius: 6px; padding: 17px; background: var(--surface); overflow-wrap: anywhere; }
.notice.unread { border-left: 3px solid var(--accent); }
.notice-meta { color: var(--muted); font-size: 12px; margin-bottom: 7px; }
.notice h2 { font-size: 17px; }
.notice p { white-space: pre-wrap; margin: 9px 0 0; }
.notice button { margin-top: 12px; }
dialog { background: var(--surface); color: var(--text); border-color: var(--line); }
.welcome { width: min(90vw, 430px); text-align: center; padding: 28px; }
.welcome-symbol { width: 80px; height: 80px; margin: 0 auto 14px; overflow: hidden; }
.welcome-symbol img { width: 120px; max-width: none; margin-left: -20px; filter: invert(1); mix-blend-mode: screen; }
:root[data-palette="light"] .welcome-symbol img { filter: none; mix-blend-mode: multiply; }
.welcome h2 { font-size: 24px; margin: 8px 0 12px; overflow-wrap: anywhere; }
.welcome p { color: var(--muted); }
.welcome .primary { width: 100%; margin-top: 10px; }
.privacy-link { width: 100%; text-decoration: none; }
.privacy-consent a { color: var(--accent); font-weight: 700; }
.privacy-consent .update-note { display: grid; gap: 5px; margin: 18px 0 8px; padding: 14px; border: 1px solid var(--line); border-radius: 7px; text-align: left; background: var(--bg); }
.privacy-consent .update-note span { color: var(--muted); font-size: 13px; }
#toast { background: var(--surface-strong); color: var(--text); border: 1px solid var(--line); }

@media (max-width: 520px) {
  .view { padding: 20px 14px 30px; }
  .section-title h1 { font-size: 30px; }
  .lesson { grid-template-columns: 55px minmax(0, 1fr); }
  .lesson-index { font-size: 29px; }
  .lesson-body { padding: 12px; }
  .bottom-nav button { font-size: 9px; }
  .bottom-nav button svg { width: 19px; height: 19px; }
  .week-controls input[type=date] { width: 130px; }
  .reminder-fields { grid-template-columns: 1fr; }
  .settings-block { padding: 15px; }
}
