/* Interface refinements. Keep expensive blur on stationary chrome, not lesson cards. */
:root { --font-delta: 0px; --type-scale: 1; }
:root[data-font-size="small"] { --font-delta: 0px; --type-scale: 1; --ui-scale: .88; }
:root[data-font-size="large"] { --font-delta: 0px; --type-scale: 1; --ui-scale: 1.12; }
:root { --ui-scale: 1; }
:root[data-theme="blue"] { --bg: #f4f5f7; --surface: #fff; }
:root:not([data-theme^="dark-"]) { --day-active-bg: var(--accent); --day-active-text: var(--button-text); }
body {
  font-size: 16px;
  zoom: var(--ui-scale);
  background: radial-gradient(ellipse 80% 38% at 10% 0%, color-mix(in srgb, var(--accent) 11%, transparent), transparent 72%), var(--bg);
  background-attachment: scroll;
}

.theme-card { padding-inline: 20px; }
.theme-card > h3, .theme-card > .theme-intro, .theme-card > .theme-group, .theme-card > .text-size-setting { margin-left: 0; margin-right: 0; }
.theme-card .theme-options { margin-inline: 0; }
.day-heading { display: block; }
.day-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; min-width: 0; }
.day-title-row h2 { flex: 1 1 auto; min-width: 0; margin: 0; }
.day-title-row .pill { flex: 0 0 auto; margin-top: 3px; white-space: nowrap; }
.day-parity { margin-top: 6px; }
.quick-edit { display: block; width: fit-content; min-height: 44px; margin: 18px 0 0 auto; padding: 9px 15px; border: 1px solid var(--accent-line); border-radius: 999px; background: var(--accent); color: var(--button-text); font-size: 12px; font-weight: 750; }
.quick-edit[hidden] { display: none; }
.board-card { box-sizing: border-box; display: flex; flex-direction: column; gap: 12px; height: clamp(420px, calc(100dvh - 165px), 680px); margin: 0 0 15px; padding: 18px; overflow: hidden; }
.board-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.board-heading h2 { margin: 0; font-size: 17px; }
.board-heading p { margin: 3px 0 0; color: var(--muted); font-size: 10px; }
.board-icon { display: block; width: 24px; height: 24px; color: var(--accent-deep); }
.board-messages { display: grid; align-content: start; flex: 1 1 auto; gap: 8px; min-height: 70px; overflow-y: auto; overscroll-behavior: contain; }
#board-form, .board-heading { flex: 0 0 auto; }
#board-form { padding-top: 10px; border-top: 1px solid var(--line); }
.board-ban-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11px; }
.board-ban-row button { width: auto; min-height: 44px; padding: 7px 10px; }
.board-message { padding: 10px 12px; border-radius: 11px; background: var(--surface-soft); }
.board-message p { margin: 0 0 5px; overflow-wrap: anywhere; }
.board-message small { color: var(--muted); }
.board-moderation { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.board-moderation button { width: auto; min-height: 44px; padding: 7px 10px; font-size: 10px; }
#board-form textarea { box-sizing: border-box; display: block; width: 100%; height: 80px; min-height: 80px; max-height: 80px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-soft); color: var(--text); font: inherit; resize: none; overflow-y: auto; }
.admin-card textarea, .admin-data-card textarea { box-sizing: border-box; max-height: min(28dvh, 220px); resize: none; overflow-y: auto; }
.board-form-bottom { display: flex; align-items: center; justify-content: space-between; gap: 9px; margin-top: 8px; }
.board-form-bottom small { color: var(--muted); font-size: 10px; }
.board-form-bottom button { width: auto; min-height: 38px; }
#board-send:disabled { border-color: var(--line); background: var(--surface-soft); color: var(--muted); box-shadow: none; opacity: 1; cursor: not-allowed; }
.themed-time-input { cursor: pointer; font-variant-numeric: tabular-nums; }
.time-input-dialog { width: min(100% - 28px, 360px); padding: 24px; }
.time-input-fields { display: grid; grid-template-columns: minmax(0,1fr) auto minmax(0,1fr); align-items: end; gap: 10px; margin: 20px 0; }
.time-input-fields label { display: grid; gap: 7px; min-width: 0; color: var(--muted); font-size: 12px; font-weight: 700; }
.time-input-fields input { box-sizing: border-box; width: 100%; min-height: 64px; border: 1px solid var(--accent-line); border-radius: 12px; background: var(--surface-soft); color: var(--text); text-align: center; font: inherit; font-size: 28px; font-variant-numeric: tabular-nums; }
.time-input-fields > span { padding-bottom: 14px; color: var(--accent-deep); font-size: 28px; font-weight: 700; }
#time-input-apply { min-height: 48px; }
.activity-scroll { max-height: min(60vh, 520px); overflow: auto; }
.admin-recent-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.admin-recent-heading h3 { margin: 0; }
.admin-recent-heading button { width: auto; min-height: 44px; padding: 8px 12px; }
.activity-table { width: 100%; table-layout: fixed; border-collapse: collapse; text-align: left; font-size: 10px; }
.activity-table th:nth-child(1), .activity-table td:nth-child(1) { width: 17%; }
.activity-table th:nth-child(2), .activity-table td:nth-child(2) { width: 34%; }
.activity-table th:nth-child(3), .activity-table td:nth-child(3) { width: 49%; }
.activity-table th, .activity-table td { padding: 8px 7px; border-bottom: 1px solid var(--line); }
.activity-table th { position: sticky; top: 0; z-index: 2; color: var(--muted); font-weight: 700; line-height: 1.35; background: var(--surface); overflow-wrap: anywhere; vertical-align: bottom; }
.admin-filter-panel { margin: 14px 0; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-soft); }
.admin-filter-panel > summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding: 9px 14px; cursor: pointer; list-style: none; font-weight: 700; }
.admin-filter-panel > summary > span:first-child { flex: 1 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.admin-filter-panel > summary::-webkit-details-marker { display: none; }
.admin-filter-panel > summary::after { width: 8px; height: 8px; flex: 0 0 8px; border-right: 2px solid var(--accent); border-bottom: 2px solid var(--accent); content: ""; transform: rotate(45deg) translateY(-2px); transition: transform .18s ease; }
.admin-filter-panel[open] > summary { border-bottom: 1px solid var(--line); }
.admin-filter-panel[open] > summary::after { transform: rotate(225deg) translate(-2px, -1px); }
.admin-filter-count { flex: 0 0 auto; margin-left: auto; color: var(--muted); font-size: .82rem; font-weight: 600; white-space: nowrap; }
.admin-filter-panel[open] > .admin-filter-grid { margin: 0; padding: 12px; }
.admin-filter-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 14px 0; }
.admin-filter-grid > label { display: grid; gap: 6px; min-width: 0; color: var(--muted); font-size: .84rem; }
.broadcast-new-period-field { grid-column: 1 / -1; }
.admin-filter-grid input { width: 100%; min-width: 0; }
@media (max-width: 360px) {
  .admin-filter-panel > summary { gap: 6px; padding: 8px 9px; font-size: 12px; }
  .admin-filter-panel > summary::after { width: 7px; height: 7px; flex-basis: 7px; }
  .admin-filter-count { font-size: 11px; }
}
.admin-filter-grid .custom-select { min-width: 0; }
@media (max-width: 430px) { .admin-filter-grid { grid-template-columns: minmax(0, 1fr); } }
.broadcast-history { display: grid; gap: 10px; }
.broadcast-history-item { display: grid; gap: 7px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-soft); }
.broadcast-history-item small { color: var(--muted); }
.broadcast-history-item p { margin: 0; overflow-wrap: anywhere; }
.broadcast-history-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.broadcast-history-actions button { min-height: 40px; }
.broadcast-recipient-details { max-height: 240px; overflow: auto; display: grid; gap: 6px; padding-top: 8px; }
.broadcast-recipient-row { color: var(--muted); font-size: .9em; overflow-wrap: anywhere; }
.group-announcements-details { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.group-announcements-details > summary { display: flex; justify-content: space-between; gap: 10px; cursor: pointer; font-weight: 700; }
.group-announcements-list, .announcement-list, .schedule-history { display: grid; gap: 9px; padding-top: 12px; }
.group-announcement-item, .announcement-history-item, .schedule-history-item { display: grid; gap: 6px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.group-announcement-item small, .announcement-history-item small, .schedule-history-item small { color: var(--muted); }
.group-announcement-item p, .announcement-history-item p, .schedule-history-item p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.announcement-list, .schedule-history { max-height: 440px; overflow-y: auto; }
.student-list { display: grid; }
.student-row { display: flex; justify-content: space-between; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; }
.student-row small { color: var(--accent-deep); }
.card, .live-card, .week-nav, .day-tabs, .lesson-card, .context-line { backdrop-filter: none; -webkit-backdrop-filter: none; }
.profile-hero, .about-sheet-card { background: var(--surface); }
.live-card, .week-nav, .day-tabs, .lesson-card { background: linear-gradient(105deg, var(--surface) 0%, color-mix(in srgb, var(--accent) 7%, var(--surface)) 52%, color-mix(in srgb, var(--accent) 20%, var(--surface)) 100%); }
.day-tab.active { box-shadow: none; }
.card { box-shadow: 0 4px 16px rgba(0,0,0,.04); }
.lesson-card { contain: content; box-shadow: 0 4px 14px rgba(0,0,0,.045); }
.lesson-card:hover { box-shadow: 0 7px 17px rgba(0,0,0,.08); }
.live-card { box-shadow: 0 7px 18px rgba(0,0,0,.055); }
.week-nav, .day-tabs { position: relative; z-index: 1; }
.day-tab { position: relative; z-index: 1; pointer-events: auto; touch-action: manipulation; }
.day-tab > span { pointer-events: none; }
.day-tabs { margin-bottom: 25px; }
.lesson-list { overflow-anchor: none; align-content: start; }
.lesson-subject { font-size: calc(17px + var(--font-delta)); font-weight: 650; }
.lesson-time, .lesson-end { font-weight: 650; }
.lesson-number { color: var(--text); font-weight: 700; }
.lesson-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 8px; font-size: calc(12px + var(--font-delta)); }
.lesson-meta span + span::before { display: none; }
.lesson-meta .meta-teacher { font-weight: 400; }
.lesson-meta .meta-room { margin-left: auto; padding: 4px 8px; border: 1px solid var(--accent-line); border-radius: 9px; background: var(--accent-soft); color: var(--accent-deep); font-weight: 600; overflow-wrap: anywhere; }
.lesson-card.current::after { content: ""; position: absolute; top: 23px; left: 8px; width: 6px; height: 6px; border-radius: 50%; background: var(--positive); box-shadow: 0 0 0 0 color-mix(in srgb, var(--positive) 45%, transparent); animation: current-pulse 2s ease-out infinite; }
.live-card:is([data-mode="next"],[data-mode="current"]) .live-state::before { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); animation: current-pulse 2s ease-out infinite; }
.live-card[data-mode="current"] .live-state::before { box-shadow: 0 0 0 3px color-mix(in srgb, var(--positive) 18%, transparent); }
@keyframes current-pulse { 50% { box-shadow: 0 0 0 7px transparent; } }
.bottom-nav { border-top: 1px solid var(--line); }
.view { padding-bottom: 96px; }
.app-header-title { min-width: 0; }
.info-button { position: relative; flex: 0 0 24px; }
.notification-shortcut { display: grid; place-items: center; flex: 0 0 48px; width: 48px; height: 48px; margin: 0; padding: 0; border: 0; border-radius: 12px; background: transparent; color: var(--accent); }
.notification-shortcut svg { width: 22px; height: 22px; }
.notification-shortcut:hover { background: transparent; color: var(--accent-deep); }
.notification-badge { position: absolute; top: -1px; right: -3px; display: grid; place-items: center; min-width: 16px; height: 16px; padding: 0 4px; border: 1px solid var(--surface); border-radius: 999px; background: var(--accent); color: var(--button-text); font-size: 9px; font-weight: 750; line-height: 1; }
.notification-badge[hidden] { display: none; }
.changelog-shortcut { font-size: 22px; }
.changelog-dot { position: absolute; top: 4px; right: 0; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.changelog-dot[hidden] { display: none; }
.context-line { flex-shrink: 1; margin-left: 7px; }
.context-line strong { max-width: 100%; }
.context-icon svg { width: 21px; height: 21px; }

/* Week rhythm: one compact card with an expanding chart. */
.rhythm-card { overflow: hidden; margin-top: 22px; padding: 0; }
.rhythm-toggle { display: flex; align-items: center; justify-content: space-between; gap: 14px; width: 100%; min-height: 60px; padding: 13px 19px; border: 0; background: transparent; color: var(--text); text-align: left; }
.rhythm-toggle > span:first-child { display: grid; gap: 2px; }
.rhythm-toggle strong { font-size: calc(14px + var(--font-delta)); font-weight: 680; }
.rhythm-toggle small { color: var(--muted); font-size: calc(10px + var(--font-delta)); }
.rhythm-chevron { color: var(--accent-deep); font-size: 24px; line-height: 1; transition: transform .3s ease; }
.rhythm-toggle[aria-expanded="true"] .rhythm-chevron { transform: rotate(180deg); }
.rhythm-content { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows .35s cubic-bezier(.16,1,.3,1), opacity .2s ease; }
.rhythm-toggle[aria-expanded="true"] + .rhythm-content { grid-template-rows: 1fr; opacity: 1; }
.rhythm-inner { min-height: 0; overflow: hidden; padding: 0 19px; }
.rhythm-toggle[aria-expanded="true"] + .rhythm-content .rhythm-inner { padding-bottom: 19px; }
.rhythm-card .week-summary-head { margin: 0 0 12px; padding: 13px 0 14px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.rhythm-hint { margin: 0; color: var(--muted); font-size: calc(10px + var(--font-delta)); }
.profile-rhythm { gap: 4px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.profile-hero .rhythm-day, .profile-hero .rhythm-day:hover { gap: 1px; padding: 0; border: 0; border-radius: 0; background: transparent; color: var(--muted); cursor: default; transform: none; transition: none; }
.profile-hero .rhythm-track { height: 19px; padding: 2px; border-radius: 5px; }
.profile-hero .rhythm-label, .profile-hero .rhythm-day strong { font-size: 8px; }

/* Profile has one group card that opens the group picker. */
.profile-group-button { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 49px; margin: 3px 0 0; padding: 0; border: 0; background: transparent; color: var(--text); text-align: left; }
.profile-group-button strong { font-size: calc(24px + var(--font-delta)); line-height: 1.2; font-weight: 720; overflow-wrap: anywhere; }
.profile-group-button > span { color: var(--accent-deep); font-size: 26px; }
.profile-hero .helper-note { margin: 2px 0 0; }
.support-card { box-sizing: border-box; display: flex; align-items: center; justify-content: space-between; gap: 14px; width: 100%; min-height: 68px; margin-top: 15px; padding: 13px 18px; color: var(--text); font-weight: 650; text-decoration: none; cursor: pointer; transition: border-color .16s ease, background-color .16s ease, transform .16s ease; }
.support-card:hover { border-color: var(--accent-line); }
.support-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.support-card-copy { display: grid; justify-items: start; gap: 3px; width: 100%; min-width: 0; text-align: left; }
.support-card-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.support-card-heading strong { font-size: calc(15px + var(--font-delta)); font-weight: 750; text-align: left; }
.support-card .support-status { display: inline-flex; align-items: center; gap: 5px; padding: 0; border-radius: 0; background: transparent; color: var(--accent-deep); font-size: 10px; font-weight: 700; }
.support-status::before { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); content: ""; }
.support-card-hint { display: block; width: 100%; margin: 0; color: var(--muted); font-size: 10px; font-weight: 500; text-align: left; }
.support-card-arrow { flex: 0 0 20px; width: 20px; height: 20px; color: var(--accent-deep); }
.profile-quiet-links { display: flex; flex-wrap: wrap; align-items: center; column-gap: 18px; row-gap: 2px; margin-top: 8px; }
.about-profile-link { box-sizing: border-box; display: flex; flex: 0 0 auto; align-items: center; gap: 8px; width: auto; min-height: 44px; margin: 0; padding: 8px 4px; border: 0; border-radius: 0; background: transparent; color: var(--muted); font: inherit; font-size: 12px; font-weight: 650; text-align: left; cursor: pointer; transition: color .16s ease; }
.about-profile-link:hover { color: var(--text); }
.about-profile-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.about-profile-icon { color: var(--accent); font-size: 17px; line-height: 1; }
.profile-quiet-links .easter-card { flex: 0 0 auto; min-width: 0; margin: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.profile-quiet-links .easter-card[open] { flex: 1 1 100%; }
.profile-quiet-links .easter-card summary { min-height: 44px; padding: 8px 4px; background: transparent; color: var(--muted); font-size: 12px; }
.profile-quiet-links .easter-card summary:hover { color: var(--text); }
.profile-quiet-links .easter-card img { box-sizing: border-box; width: 100%; margin: 0 0 8px; border-radius: 12px; }

/* One theme-coloured selection, without the old red/blue layers. */
.option-grid { position: relative; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 0; padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-soft); }
.option-grid::before { display: none; }
.option-button, .option-button.selected, .option-button.off.selected { position: relative; z-index: 1; min-height: 41px; border: 0; border-radius: 10px; background: transparent; box-shadow: none; color: var(--muted); font-size: calc(10px + var(--font-delta)); font-weight: 600; }
.option-button:hover { border: 0; color: var(--text); }
.option-grid .option-button.selected:not(.off) { background: var(--accent); color: var(--button-text); font-weight: 700; box-shadow: 0 3px 10px color-mix(in srgb, var(--accent) 16%, transparent); }
:root .option-grid .option-button.off.selected { border: 1px solid var(--line); background: var(--surface); color: var(--text); font-weight: 700; }
.wide-button, .wide-button:hover { border: 1px solid var(--accent-line); background: transparent; color: var(--accent-deep); box-shadow: none; }
.wide-button:disabled { border-color: var(--line); background: transparent; }
.toast { top: calc(74px + env(safe-area-inset-top)); bottom: auto; }
.custom-time-toggle { width: 100%; margin-top: 10px; padding: 10px 4px 2px; border: 0; background: transparent; color: var(--accent-deep); text-align: left; font-size: 11px; font-weight: 650; }
.custom-time-toggle span { float: right; }
.custom-time-form { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: end; gap: 9px; margin-top: 10px; }
.custom-time-form[hidden] { display: none; }
.custom-time-form label, .admin-data-card label, .leader-edit-form label, .admin-user-actions label { display: grid; gap: 6px; color: var(--muted); font-size: 10px; font-weight: 600; }
.custom-time-form input, .admin-data-card input, .admin-data-card select, .admin-data-card textarea, .leader-edit-form input, .leader-edit-form select, .admin-user-actions select { width: 100%; min-width: 0; min-height: 39px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); color: var(--text); font: inherit; }
.custom-time-form button { min-height: 39px; padding: 8px 13px; border: 1px solid var(--accent-line); border-radius: 10px; background: var(--accent-soft); color: var(--accent-deep); font-size: 10px; font-weight: 700; }
.custom-time-note { grid-column: 1 / -1; color: var(--muted); font-size: 9px; line-height: 1.4; }

/* Theme and type controls. */
.dark-mode-icon svg { display: block; width: 22px; height: 22px; }
.dark-mode-icon[data-mode="dark"] .mode-sun, .dark-mode-icon[data-mode="light"] .mode-moon { display: none; }
.reminder-preview-icon svg { display: block; width: 20px; height: 20px; }
.lesson-online-link svg { display: inline-block; width: 15px; height: 15px; margin-left: 5px; vertical-align: -3px; }
.text-size-setting { margin-top: 22px; }
.text-size-options { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 4px; margin-top: 9px; padding: 4px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-soft); }
.text-size-options button { display: grid; justify-items: center; align-content: center; gap: 2px; min-width: 0; min-height: 54px; padding: 7px 3px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--muted); font-size: calc(16px + var(--font-delta)); font-weight: 650; touch-action: manipulation; }
.text-size-options button small { font-size: 9px; font-weight: 500; }
.text-size-options button[aria-pressed="true"] { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent-deep); }
.theme-copy strong, .group-option, .nav-button small { font-weight: 600; }
.theme-copy small { font-weight: 400; }
.theme-options { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; }
.theme-button { gap: 8px; min-height: 58px; padding: 8px 10px; touch-action: manipulation; }
.theme-swatch { flex-basis: 24px; width: 24px; height: 24px; border-radius: 7px; }
.theme-button .theme-copy strong { font-size: calc(10px * var(--type-scale)); }
.theme-copy small { display: none; }
.theme-check { flex-basis: 18px; width: 18px; height: 18px; font-size: 10px; }
@media (min-width: 600px) { .theme-options { grid-template-columns: repeat(3,minmax(0,1fr)); } }

/* Picker, release notes and tap feedback. */
.sheet-field-label { display: block; margin: 14px 0 7px; color: var(--muted); font-size: 10px; font-weight: 650; text-transform: uppercase; }
.faculty-list { display: grid; gap: 5px; max-height: 143px; overflow-y: auto; padding-right: 3px; }
.faculty-option { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 39px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); color: var(--text); text-align: left; font-size: 10px; }
.faculty-option.selected { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent-deep); }
.faculty-option small { flex: 0 0 auto; color: var(--muted); font-size: 9px; }
.faculty-option.selected small { color: var(--accent-deep); }
.group-list { max-height: min(32dvh,270px); }
.about-detail { white-space: pre-line; }
.about-detail a { color: var(--accent-deep); text-decoration: underline; text-decoration-color: var(--accent-line); text-underline-offset: 3px; }
.about-creators { margin-top: 10px; border-top: 1px solid var(--line); }
.about-creators[hidden] { display: none; }
.about-creators summary { display: flex; align-items: center; min-height: 44px; padding: 8px 0; color: var(--text); cursor: pointer; font-size: calc(14px + var(--font-delta)); font-weight: 750; list-style: none; }
.about-creators summary::-webkit-details-marker { display: none; }
.about-creators-list { display: grid; gap: 7px; padding: 0 0 12px; }
.about-creators-list a { color: var(--accent-deep); text-decoration: underline; text-decoration-color: var(--accent-line); text-underline-offset: 3px; }
.release-card { margin: 0 0 12px; padding: 17px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-soft); }
.release-card span { color: var(--accent-deep); font-size: 10px; font-weight: 650; }
.release-card strong { display: block; margin-top: 4px; font-size: 15px; }
.release-card ul { margin: 10px 0 0; padding-left: 18px; color: var(--muted); font-size: 11px; line-height: 1.65; }
.tap-feedback { position: fixed; z-index: 100; pointer-events: none; color: var(--accent-deep); font-size: 26px; font-weight: 750; text-shadow: 0 2px 10px var(--bg); animation: tap-float .7s ease-out forwards; }
@keyframes tap-float { to { opacity: 0; transform: translate(-50%,-55px) scale(1.2); } }

/* Role-only controls: the server remains authoritative for permissions. */
[hidden] { display: none !important; }
.profile-privacy { margin-top: 16px; }
.role-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; padding: 15px 18px; }
.role-card > div, .role-card > span:first-child { display: grid; gap: 3px; text-align: left; }
.role-card strong { color: var(--text); font-size: 12px; }
.role-card small { color: var(--muted); font-size: 10px; }
.role-card > button { flex: 0 0 auto; padding: 8px 11px; border: 1px solid var(--accent-line); border-radius: 10px; background: var(--accent-soft); color: var(--accent-deep); font-size: 10px; font-weight: 700; }
.role-link { width: 100%; color: var(--text); }
.role-link > span:last-child { color: var(--accent-deep); font-size: 25px; }
.admin-section-tabs { display: flex; gap: 7px; overflow-x: auto; margin-bottom: 17px; padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-soft); scrollbar-width: none; }
.admin-section-tabs button { flex: 0 0 auto; padding: 9px 12px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 10px; font-weight: 650; }
.admin-section-tabs button.active { background: var(--accent-soft); color: var(--accent-deep); }
.admin-section-tabs .admin-tool-tab { margin-left: auto; color: var(--accent-deep); }
.admin-section { display: none; }
.admin-section.active { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; min-width: 0; }
.admin-section.active > * { min-width: 0; }
#admin-users > .admin-data-card { grid-template-columns: minmax(0, 1fr); }
.admin-metrics { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.admin-metrics .card { display: grid; gap: 5px; padding: 16px; }
.admin-metrics span { color: var(--muted); font-size: 10px; }
.admin-metrics strong { color: var(--text); font-size: 22px; }
.admin-data-card { display: grid; gap: 12px; padding: 18px; }
.admin-data-card h3 { margin: 0; font-size: 15px; }
.admin-extra-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 10px; }
.admin-summary-card { gap: 13px; }
.admin-summary-values { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; gap: 13px 10px; }
.admin-summary-values > div { display: grid; gap: 2px; min-width: 0; }
.admin-summary-values strong { color: var(--accent-deep); font-size: 20px; line-height: 1.1; }
.admin-summary-values span { color: var(--muted); font-size: 10px; line-height: 1.35; }
.admin-floating-refresh { position: fixed; z-index: 9; right: 16px; bottom: calc(92px + env(safe-area-inset-bottom)); display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid var(--accent-line); border-radius: 50%; background: var(--accent); color: var(--button-text); box-shadow: 0 8px 22px rgba(0,0,0,.19); cursor: pointer; }
.admin-floating-refresh svg { width: 22px; height: 22px; }
.admin-floating-refresh[hidden] { display: none; }
.admin-floating-refresh:disabled { opacity: .65; cursor: wait; }
.admin-chart-row, .admin-user-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 10px 0; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text); text-align: left; font-size: 11px; }
.admin-chart-row { display: grid; gap: 7px; }
.admin-chart-heading { display: flex; justify-content: space-between; gap: 10px; }
.admin-chart-track { height: 7px; overflow: hidden; border-radius: 99px; background: var(--surface-soft); }
.admin-chart-bar { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.admin-chart-row strong { color: var(--accent-deep); }
.admin-chart-title { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.chart-mode { display: flex; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); }
.chart-mode button { min-height: 34px; padding: 5px 9px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 10px; font-weight: 700; }
.chart-mode button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-deep); }
.admin-columns { display: grid; grid-template-columns: repeat(var(--chart-columns), minmax(0, 1fr)); align-items: end; gap: 7px; margin-top: 4px; }
.admin-column { display: grid; grid-template-rows: auto 110px minmax(32px, auto); justify-items: center; gap: 5px; min-width: 0; text-align: center; }
.admin-column strong { color: var(--accent-deep); font-size: 11px; }
.admin-column-bar { align-self: end; width: min(100%, 38px); min-height: 5px; border-radius: 7px 7px 3px 3px; }
.admin-column small { min-width: 0; color: var(--muted); font-size: 9px; line-height: 1.25; overflow-wrap: anywhere; }
.admin-pie { display: grid; place-items: center; width: min(180px, 70%); aspect-ratio: 1; margin: 6px auto; border-radius: 50%; }
.admin-pie-total { display: grid; place-items: center; width: 66%; aspect-ratio: 1; border-radius: 50%; background: var(--surface); color: var(--text); font-size: 22px; font-weight: 800; }
.admin-pie-legend { display: grid; gap: 6px; }
.admin-legend-row { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; align-items: center; gap: 8px; font-size: 10px; }
.admin-legend-row strong { color: var(--accent-deep); }
.admin-legend-dot { width: 10px; height: 10px; border-radius: 3px; }
.chart-total { margin: 0; color: var(--muted); font-size: 10px; }
.admin-user-row { display: grid; justify-content: stretch; }
.admin-user-row small { color: var(--muted); }
.admin-user-row.is-online { padding-left: 9px; border-left: 2px solid var(--positive); background: color-mix(in srgb, var(--positive) 6%, transparent); }
.admin-user-online { color: var(--positive); font-weight: 750; }
.broadcast-preview { display: grid; gap: 8px; padding: 14px; border: 1px solid var(--accent-line); border-radius: 12px; background: var(--accent-soft); color: var(--text); overflow-wrap: anywhere; }
.broadcast-preview p { margin: 0; white-space: pre-wrap; }
.broadcast-preview small { color: var(--muted); }
.inline-action { display: flex; gap: 8px; }
.inline-action input { flex: 1; }
#admin-admins .inline-action { display: grid; grid-template-columns: minmax(0,1fr) auto; }
#admin-admins .inline-action button { width: auto; min-width: 112px; }
@media (max-width: 520px) { #admin-admins .inline-action { grid-template-columns: 1fr; } #admin-admins .inline-action button { width: 100%; } }
.leader-edit-form, .admin-user-actions { display: grid; gap: 13px; }
.admin-action-section { display: grid; gap: 9px; padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.admin-action-section[hidden] { display: none; }
.admin-action-section h3 { margin: 0; color: var(--muted); font-size: 11px; }
.admin-action-section > button, .admin-action-section > a { display: flex; align-items: center; justify-content: center; box-sizing: border-box; width: 100%; min-height: 44px; padding: 9px 12px; text-align: center; text-decoration: none; }
.admin-action-section > a[hidden] { display: none; }
.admin-action-section .checkbox-row { min-height: 44px; color: var(--text); font-size: 11px; }
.admin-action-section .checkbox-row input { appearance: none; flex: 0 0 22px; box-sizing: border-box; width: 22px; height: 22px; margin: 0; border: 1.5px solid var(--accent-line); border-radius: 5px; background: var(--accent-soft); }
.admin-action-section .checkbox-row input:checked { border-color: var(--accent); background: var(--accent); }
.admin-action-section .checkbox-row input:checked::after { content: ""; display: block; width: 6px; height: 10px; margin: 3px 0 0 7px; border: solid var(--button-text); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.admin-action-section .checkbox-row input:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.admin-access-section { margin-top: 2px; }
.file-picker { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.file-picker input { position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; opacity: 0; }
.file-picker label { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 7px 12px; border: 1px solid var(--accent-line); border-radius: 9px; background: var(--accent-soft); color: var(--accent-deep); font-size: 10px; font-weight: 700; cursor: pointer; }
.file-picker input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 3px; }
.file-picker span { min-width: 0; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
#leader-view.active { display: grid; gap: 16px; align-content: start; }
#leader-view .leader-intro { gap: 8px; }
#leader-view .leader-intro h2 { margin: 0 0 6px; font-size: calc(23px * var(--type-scale)); }
#leader-view .helper-note { margin: 0; }
.invite-actions { display: grid; gap: 9px; margin-top: 17px; }
.invite-actions button, #role-notice-ack, #onboarding-save { width: 100%; }
#onboarding-save { margin-top: 13px; }
.checkbox-row { display: flex !important; align-items: center; gap: 8px; }
.checkbox-row input { width: auto; min-height: auto; }
.lesson-card .lesson-top { padding-right: 113px; }
.lesson-edit-button, .lesson-number, .lesson-meta .meta-room { box-sizing: border-box; min-width: 46px; height: 36px; padding: 0 8px; border: 1px solid var(--accent-line); border-radius: 10px; background: var(--accent-soft); color: var(--accent-deep); }
.lesson-edit-button { position: absolute; z-index: 2; top: 14px; right: 67px; display: grid; place-items: center; width: 46px; margin: 0; cursor: pointer; }
.lesson-edit-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.lesson-edit-button:hover, .lesson-edit-button:focus-visible { background: var(--accent); color: var(--button-text); }
.lesson-number { right: 13px; display: inline-flex; align-items: center; justify-content: center; }
.lesson-meta .meta-room { display: inline-flex; align-items: center; justify-content: center; }
.lesson-card.cancelled { opacity: .73; border-color: var(--line); }
.lesson-card.cancelled .lesson-subject { text-decoration: line-through; text-decoration-thickness: 1px; }
.lesson-override { display: inline-flex; margin-bottom: 9px; padding: 4px 7px; border: 1px solid var(--accent-line); border-radius: 7px; color: var(--accent-deep); font-size: 9px; font-weight: 700; }
.lesson-card.cancelled .lesson-override { border-color: var(--line); color: var(--muted); }
.lesson-online-link { color: var(--accent-deep); font-size: 11px; font-weight: 700; }
.quiz-option.quiz-chosen { border-width: 2px; transform: scale(.98); }
.quiz-option.quiz-correct { border-color: #50c590; background: color-mix(in srgb, #50c590 24%, var(--surface-soft)); color: var(--text); }
.quiz-option.quiz-incorrect { border-color: #e57082; background: color-mix(in srgb, #e57082 22%, var(--surface-soft)); color: var(--text); }
.quiz-answer-feedback { margin-top: 12px; padding: 10px 12px; border-radius: 10px; font-size: 11px; font-weight: 700; animation: quiz-feedback-in .25s ease-out; }
.quiz-answer-feedback.correct { background: color-mix(in srgb, #50c590 18%, var(--surface-soft)); color: #58cf98; }
.quiz-answer-feedback.incorrect { background: color-mix(in srgb, #e57082 17%, var(--surface-soft)); color: #ec8594; }
@keyframes quiz-feedback-in { from { opacity: 0; transform: translateY(5px); } }

/* Fixed-pixel component typography must participate in the accessibility setting. */
.app-header h1 { font-size: clamp(calc(21px * var(--type-scale)), calc(5.4vw * var(--type-scale)), calc(30px * var(--type-scale))); }
.live-subject { font-size: calc(21px * var(--type-scale)); }
.live-details, .live-state, .live-timer-caption { font-size: calc(11px * var(--type-scale)); }
.live-timer { font-size: calc(25px * var(--type-scale)); }
.week-nav-center > strong { font-size: calc(16px * var(--type-scale)); }
.week-nav-center small, .eyebrow { font-size: calc(10px * var(--type-scale)); }
.day-heading h2 { font-size: calc(23px * var(--type-scale)); }
.day-parity, .pill { font-size: calc(12px * var(--type-scale)); }
.day-tab .short { font-size: calc(11px * var(--type-scale)); }
.day-tab .number { font-size: calc(18px * var(--type-scale)); }
.day-load { font-size: calc(9px * var(--type-scale)); }
.lesson-time, .lesson-end { font-size: calc(14px * var(--type-scale)); }
.lesson-subject { font-size: calc(17px * var(--type-scale)); }
.lesson-meta { font-size: calc(12px * var(--type-scale)); }
.lesson-number, .lesson-status { font-size: calc(10px * var(--type-scale)); }
.setting-title h3, .theme-card h3 { font-size: calc(15px * var(--type-scale)); }
.option-button, .option-button.selected { font-size: calc(10px * var(--type-scale)); }
.custom-time-toggle, .custom-time-form, .wide-button { font-size: calc(11px * var(--type-scale)); }
.profile-group-button strong { font-size: calc(24px * var(--type-scale)); }
.profile-stats strong { font-size: calc(20px * var(--type-scale)); }
.profile-stats span, .profile-eyebrow, .theme-group-label { font-size: calc(10px * var(--type-scale)); }
.theme-copy strong, .game-name-toggle, .role-card strong { font-size: calc(12px * var(--type-scale)); }
.theme-copy small, .theme-intro, .role-card small { font-size: calc(10px * var(--type-scale)); }
.game-title h3 { font-size: calc(17px * var(--type-scale)); }
.game-title p, .game-muted, .games-heading p { font-size: calc(11px * var(--type-scale)); }
.quiz-question { font-size: calc(16px * var(--type-scale)); }
.quiz-option, .game-primary, .game-secondary, .battle-tap { font-size: calc(12px * var(--type-scale)); }
.nav-button small { font-size: calc(10px * var(--type-scale)); }
.admin-section-tabs button, .admin-user-row, .admin-data-card label { font-size: calc(11px * var(--type-scale)); }

@media (max-width: 355px) {
  .app-header { gap: 5px; }
  .info-button { flex-basis: 21px; width: 21px; }
  .notification-shortcut { flex-basis: 48px; width: 48px; height: 48px; }
  .context-line { max-width: 111px; }
  .context-line strong { font-size: 10px; }
  .option-button { font-size: 9px; }
}

/* Frontend polish: stable geometry for the calendar, sheets, and navigation. */
html { overscroll-behavior-y: none; scrollbar-gutter: stable; background: radial-gradient(ellipse 95% 115% at 112% 48%, color-mix(in srgb, var(--accent) 19%, transparent), transparent 72%), linear-gradient(165deg, color-mix(in srgb, var(--surface) 10%, var(--bg)), var(--bg) 72%); background-attachment: fixed; }
html, .sheet { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--accent) 38%, var(--surface)) transparent; }
html::-webkit-scrollbar, .sheet::-webkit-scrollbar { width: 7px; }
html::-webkit-scrollbar-track, .sheet::-webkit-scrollbar-track { background: transparent; }
html::-webkit-scrollbar-thumb, .sheet::-webkit-scrollbar-thumb { border-radius: 7px; background: color-mix(in srgb, var(--accent) 38%, var(--surface)); }
:root[data-theme^="dark-"] { color-scheme: dark; }
:root:not([data-theme^="dark-"]) { color-scheme: light; }
html:has(dialog.sheet[open]) { overflow: hidden; }
body { overscroll-behavior-y: none; background: transparent; }
@media (max-width: 600px) {
  html { background: var(--bg); background-attachment: scroll; }
  body { background: radial-gradient(ellipse 80% 260px at 100% 0%, color-mix(in srgb, var(--accent) 13%, transparent), transparent 75%) no-repeat, var(--bg); }
}
.view .card { background-image: linear-gradient(105deg, transparent 22%, color-mix(in srgb, var(--accent) 11%, transparent) 100%); }
:root:not([data-theme^="dark-"]) .view .card {
  background: linear-gradient(105deg, var(--surface) 0%, color-mix(in srgb, var(--accent) 7%, var(--surface)) 52%, color-mix(in srgb, var(--accent) 20%, var(--surface)) 100%);
}
button, a, summary { -webkit-tap-highlight-color: transparent; }
.info-button:not(:focus-visible) { outline: none; box-shadow: none; }
.info-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 5px; }
.bottom-nav { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px; padding: 5px; box-shadow: 0 7px 22px rgba(0,0,0,.14); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.bottom-nav:has(#admin-nav:not([hidden])) { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.nav-button { width: 100%; min-width: 0; padding: 5px 1px; }
.nav-button small { max-width: 100%; font-size: clamp(8px, 2.2vw, 10px); letter-spacing: -.025em; }
.week-nav { min-height: 75px; }
.today-button { padding: 2px 5px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); font-size: 9px; font-weight: 600; }
.today-button:hover { color: var(--accent-deep); }
.today-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.week-meta { display: none; }
.week-nav-center { min-width: 0; }
.day-heading > div { min-width: 0; }
.day-parity { width: fit-content; margin-top: 8px; }
.sheet { box-sizing: border-box; max-height: min(88dvh, 760px); overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: 0 -8px 26px rgba(0,0,0,.2); }
.sheet[open] { animation: sheet-fade 180ms ease-out both; }
@keyframes sheet-fade { from { opacity: .7; } to { opacity: 1; } }
.sheet-close { min-width: 44px; min-height: 44px; }
#time-input-dialog { inset: 0; width: min(calc(100% - 28px), 360px); max-height: min(calc(100dvh - 28px), 460px); margin: auto; padding: 24px; border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 16px 40px rgba(0,0,0,.24); }
#time-input-dialog .sheet-handle { display: none; }
#calendar-dialog { inset: 0; width: min(calc(100% - 24px), 400px); max-height: min(calc(100dvh - 24px), 630px); margin: auto; padding: 22px; border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 16px 40px rgba(0,0,0,.24); }
#calendar-dialog .sheet-handle { display: none; }
#calendar-dialog .calendar-grid button:disabled { opacity: .3; cursor: default; }
#group-dialog { inset: 0; width: min(calc(100% - 24px), 480px); max-height: min(calc(100dvh - 24px), 680px); margin: auto; padding: 18px; border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 16px 40px rgba(0,0,0,.24); scrollbar-gutter: stable; }
#group-dialog::-webkit-scrollbar { width: 10px; }
#group-dialog::-webkit-scrollbar-track { margin-block: 8px; background: transparent; }
#group-dialog::-webkit-scrollbar-thumb { border: 2px solid transparent; border-radius: 8px; background-color: color-mix(in srgb, var(--accent) 38%, var(--surface)); background-clip: padding-box; }
#group-dialog .sheet-handle { display: none; }
#group-dialog .sheet-heading { margin-bottom: 14px; }
#lesson-edit-dialog { max-height: calc(100dvh - env(safe-area-inset-top) - 12px); }
#lesson-edit-dialog .leader-edit-form { padding-bottom: env(safe-area-inset-bottom); }
.faculty-list { max-height: none; overflow: visible; }
#group-dialog .group-list { max-height: none; overflow: visible; }
#group-dialog .group-search { background: var(--surface); }
.picker-disclosure { border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.picker-disclosure > summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; padding: 10px 13px; color: var(--text); font-size: 12px; font-weight: 650; cursor: pointer; list-style: none; }
.picker-disclosure > summary::-webkit-details-marker { display: none; }
.picker-disclosure > summary span:last-child { color: var(--accent-deep); font-size: 17px; transition: transform 160ms ease-out; }
.picker-disclosure[open] > summary span:last-child { transform: rotate(180deg); }
.picker-disclosure > .faculty-list, .picker-disclosure > .group-list { padding: 5px 8px 9px; border-top: 1px solid var(--line); }
.picker-disclosure > .group-search { width: calc(100% - 16px); margin: 9px 8px 4px; }
.faculty-option:disabled { cursor: default; opacity: .62; }
@media (prefers-reduced-motion: reduce) { .picker-disclosure > summary span:last-child { transition: none; } }
.lesson-card { box-shadow: 0 2px 8px rgba(0,0,0,.04); }
.lesson-card:hover { box-shadow: 0 4px 11px rgba(0,0,0,.07); }
@media (hover: none), (pointer: coarse) { .lesson-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.04); transform: none; } }
.lesson-meta { border-top: 1px solid var(--line); padding-top: 9px; margin-top: 3px; }
.lesson-meta .meta-teacher { flex: 1 1 55%; }
.lesson-meta .meta-room { margin-left: 0; }
.schedule-edit-banner { display: grid; gap: 10px; margin-top: 20px; padding: 14px 16px; border-color: var(--accent-line); background: var(--accent-soft); }
.schedule-edit-banner[hidden] { display: none; }
.schedule-edit-banner strong { font-size: 13px; }
.schedule-edit-banner p { margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.4; }
.schedule-edit-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.schedule-edit-actions button { min-height: 44px; padding: 8px 12px; border: 1px solid var(--accent-line); border-radius: 10px; background: var(--surface); color: var(--accent-deep); font-weight: 700; }
.schedule-edit-actions button:disabled { opacity: .55; }
.lesson-time-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.lesson-time-fields input { width: 100%; }
#lesson-add-dialog .helper-note, #lesson-edit-dialog .helper-note { margin: 0; font-size: 11px; line-height: 1.4; }
.dark-mode-toggle { min-height: 68px; }
.haptic-card { margin-top: 12px; padding: 8px 12px; border-radius: 12px; }
.haptic-card[hidden] { display: none; }
.haptic-card .haptic-toggle { min-height: 58px; margin: 0; padding: 9px 4px; border: 0; background: transparent; }
.haptic-card .dark-mode-icon { flex-basis: 26px; width: 26px; height: 26px; border-radius: 7px; }
.haptic-toggle .dark-mode-icon svg { display: block; width: 23px; height: 23px; }
.haptic-toggle[aria-pressed="false"] .mode-switch { border-color: var(--line); background: var(--surface); }
.haptic-toggle[aria-pressed="false"] .mode-switch::after { transform: translateX(-15px); background: var(--muted); }
.dark-mode-toggle > span:nth-child(2) { min-width: 0; }
.dark-mode-toggle strong, .dark-mode-toggle small { display: block; min-height: 15px; }
.mode-switch, .mode-switch::after { transition: background-color 180ms ease-out, border-color 180ms ease-out, transform 180ms ease-out; }
.game-name-toggle { display: grid; grid-template-columns: 26px minmax(0, 1fr); min-height: 44px; align-items: center; gap: 10px; }
.game-name-toggle input { appearance: none; box-sizing: border-box; width: 26px; height: 26px; margin: 0; border: 1.5px solid var(--accent-line); border-radius: 6px; background: var(--accent-soft); cursor: pointer; }
.game-name-toggle input:checked { border-color: var(--accent); background: var(--accent); }
.game-name-toggle input:checked::after { content: ""; display: block; width: 7px; height: 12px; margin: 3px 0 0 8px; border: solid var(--button-text); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.game-name-toggle input:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.profile-privacy { padding: 8px 12px; border-radius: 12px; }
.profile-privacy .game-muted { margin: 0 0 3px 36px; font-size: 10px; }
.theme-options, .theme-options.theme-options { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.theme-button { position: relative; display: grid; justify-items: center; align-content: center; gap: 5px; min-height: 72px; padding: 8px 2px; text-align: center; }
.theme-swatch { flex: none; width: 25px; height: 25px; border-radius: 8px; }
.theme-copy { display: block; width: 100%; }
.theme-button .theme-copy strong { display: block; font-size: clamp(9px, 2vw, 10px); line-height: 1.2; overflow-wrap: anywhere; }
.theme-copy small { display: none; }
.theme-check { position: absolute; top: 5px; right: 4px; width: 16px; height: 16px; font-size: 11px; }
@media (min-width: 600px) { .theme-options, .theme-options.theme-options { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.card, .live-card { box-shadow: 0 3px 12px rgba(0,0,0,.04); }
@media (max-width: 355px) { .bottom-nav:has(#admin-nav:not([hidden])) .nav-button small { font-size: 7.5px; } }
@media (prefers-reduced-motion: reduce) { .mode-switch, .mode-switch::after { transition: none; } }
@media (prefers-reduced-motion: reduce) {
  .rhythm-content, .rhythm-chevron, .option-grid::before, .tap-feedback, .lesson-card.current::after, .live-state::before { animation: none; transition: none; }
}

/* Searchable choices share the same visual language as the group picker. */
.custom-select { position: relative; width: 100%; min-width: 0; }
.custom-select[hidden], .custom-select-option[hidden], .custom-select-search[hidden] { display: none !important; }
.custom-select > select { position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; opacity: 0; pointer-events: none; }
.custom-select-trigger { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 48px; padding: 10px 14px; border: 1px solid var(--accent-line); border-radius: 14px; background: var(--surface-soft); color: var(--text); text-align: left; font: inherit; font-weight: 650; }
.custom-select-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.custom-select-chevron { color: var(--accent-deep); font-size: 20px; line-height: 1; }
.custom-select.open .custom-select-trigger { border-radius: 14px 14px 0 0; }
.custom-select.open .custom-select-chevron { transform: rotate(180deg); }
.custom-select-menu { display: none; position: absolute; z-index: 30; top: calc(100% - 1px); left: 0; right: 0; max-height: min(310px, 45vh); padding: 10px; overflow-y: auto; border: 1px solid var(--accent-line); border-top: 0; border-radius: 0 0 14px 14px; background: var(--surface); box-shadow: 0 14px 24px rgba(0,0,0,.18); }
.custom-select.open .custom-select-menu { display: block; }
.custom-select-search { width: 100%; margin-bottom: 7px; }
.custom-select-option { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 43px; padding: 9px 13px; border: 1px solid transparent; border-radius: 11px; background: transparent; color: var(--text); text-align: left; font: inherit; font-weight: 600; }
.custom-select-option:hover, .custom-select-option:focus-visible, .custom-select-option.selected { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent-deep); }
.custom-select-check { font-size: 20px; }
.broadcast-message { display: grid; gap: 8px; justify-self: start; max-width: 100%; padding: 10px; border-radius: 12px 12px 4px 12px; background: var(--surface); }
.broadcast-preview-image { display: block; max-width: 100%; max-height: 240px; border-radius: 8px; object-fit: contain; }
.broadcast-preview-document { max-width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 8px; overflow-wrap: anywhere; }
.battle-icon svg { display: block; }

/* Browser zoom can leave less than 300 CSS pixels for the Mini App. */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
.app-shell { min-width: 0; }
.day-heading > div { min-width: 0; }
.day-heading h2 { overflow-wrap: anywhere; }
.day-heading .pill { flex: 0 0 auto; white-space: nowrap; text-align: right; }
@media (max-width: 500px) {
  .day-heading { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .day-heading .pill { justify-self: end; }
}
@media (max-width: 300px) {
  .app-shell * { min-width: 0; }
  .app-shell { padding-left: 10px; padding-right: 10px; }
  .app-header { flex-wrap: wrap; }
  .app-header-title { flex: 1 1 100%; }
  .context-line { max-width: none; flex: 1 1 auto; }
  .bottom-nav { width: calc(100% - 8px); }
  .nav-button small { display: none; }
  .day-heading { align-items: flex-start; }
  .live-timer { font-size: calc(20px * var(--type-scale)); }
}
#schedule-view .day-heading { display: block; }
#schedule-view .day-title-row { display: flex; align-items: flex-start; justify-content: space-between; }
.lesson-suggest-wrap { display: grid; gap: 5px; min-width: 0; }
.lesson-suggestions[hidden] { display: none; }
.lesson-suggestions { display: grid; gap: 2px; max-height: 190px; overflow-y: auto; padding: 5px; border: 1px solid var(--accent-line); border-radius: 11px; background: var(--surface); box-shadow: 0 8px 20px rgba(0,0,0,.08); }
.lesson-suggestions button { width: 100%; min-height: 44px; padding: 9px 11px; border: 0; border-radius: 8px; background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.lesson-suggestions button:hover, .lesson-suggestions button:focus-visible { background: var(--accent-soft); color: var(--accent-deep); outline: none; }
.admin-chart-insight { margin: 11px 0 3px; color: var(--muted); font-size: 11px; line-height: 1.5; }

.about-shortcuts { display: grid; gap: 9px; margin-top: 16px; }
.about-shortcuts > * { box-sizing: border-box; width: 100%; min-height: 44px; }
.notifications-sheet { inset: 0; width: min(calc(100% - 20px), 520px); max-height: min(calc(100dvh - 20px), 760px); margin: auto; padding: 20px; border: 1px solid var(--line); border-radius: 20px; }
.notifications-sheet .sheet-handle { display: none; }
.notifications-sheet .sheet-heading { margin-bottom: 15px; }
.notification-list { display: grid; gap: 9px; max-height: min(64dvh, 560px); overflow-y: auto; overscroll-behavior: contain; padding: 1px 2px 4px; }
.notification-item { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-soft); }
.notification-item.is-unread { border-color: var(--accent-line); background: color-mix(in srgb, var(--accent-soft) 40%, var(--surface)); }
.notification-item > summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 68px; padding: 12px; list-style: none; }
.notification-item > summary::-webkit-details-marker { display: none; }
.notification-item > summary::after { width: 8px; height: 8px; flex: 0 0 8px; border-right: 2px solid var(--accent-deep); border-bottom: 2px solid var(--accent-deep); content: ""; transform: rotate(45deg) translateY(-2px); transition: transform .16s ease; }
.notification-item[open] > summary::after { transform: rotate(225deg) translate(-2px, -1px); }
.notification-item-heading { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 3px 9px; min-width: 0; width: 100%; }
.notification-kind { grid-column: 1 / -1; color: var(--accent-deep); font-size: 10px; font-weight: 700; }
.notification-item-heading strong { min-width: 0; overflow-wrap: anywhere; font-size: 13px; line-height: 1.35; }
.notification-read-state { justify-self: end; color: var(--muted); font-size: 9px; white-space: nowrap; }
.notification-time { grid-column: 1 / -1; color: var(--muted); font-size: 10px; }
.notification-body { padding: 0 12px 12px; border-top: 1px solid var(--line); }
.notification-body p { margin: 10px 0 0; color: var(--text); font-size: 12px; line-height: 1.55; white-space: pre-line; overflow-wrap: anywhere; }
.notification-attachment { display: block; margin-top: 8px; color: var(--muted); overflow-wrap: anywhere; }
.notification-list > .helper-note { margin: 10px 4px; }
@media (prefers-reduced-motion: reduce) { .notification-item > summary::after { transition: none; } }
.admin-user-history { display: grid; gap: 0; max-height: 260px; overflow-y: auto; margin: 0; padding: 0; list-style: none; }
.admin-user-history-item { display: grid; gap: 2px; padding: 7px 2px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; }
.admin-user-history-item time, .admin-user-history-item small { color: var(--muted); font-size: 12px; }
.restricted-screen { min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: var(--bg); color: var(--text); }
.restricted-card { width: min(100%, 420px); display: grid; justify-items: center; gap: 14px; padding: 28px 22px; border: 1px solid var(--accent-line); border-radius: 24px; background: var(--surface); text-align: center; box-shadow: 0 12px 32px rgba(0,0,0,.1); }
.restricted-icon { font-size: 32px; }
.restricted-card h1, .restricted-card p { margin: 0; }
.restricted-card p { color: var(--muted); line-height: 1.5; }
.restricted-card a { display: inline-flex; justify-content: center; align-items: center; min-height: 48px; padding: 0 18px; text-decoration: none; }
