:root {
  color-scheme: light;
  --bg: #f4f7ff;
  --card: #ffffff;
  --text: #152033;
  --muted: #64748b;
  --accent: #0078BE;
  --accent-soft: #dce9ff;
  --special: #e4f2ff;
  --border: #e2e8f0;
  --gear: #64748b;
  --save-text: #ffffff;
}
body.dark-theme {
  color-scheme: dark;
  background: #08101f;
  --bg: #08101f;
  --card: #111827;
  --text: #e2e8f0;
  --muted: #9ca3af;
  --accent: #7dd3fc;
  --accent-soft: #1e40af;
  --special: #19334d;
  --border: #334155;
  --gear: #9ca3af;
  --save-text: #0f172a;
}

* { box-sizing: border-box; }
*:focus {
    outline: none;
    box-shadow: none;
}
*:focus-visible {
    outline: none;
}
html, body {
  height: 100%;
}
html {
  font-size: 14px;
}
body {
  margin: 0;
  font-family: 'Geologica', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
}
body.settings-open {
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: none;
}
body.install-open {
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: none;
}
body.notifications-open {
    overflow: hidden;
    overscroll-behavior: none;
}
.app-shell { 
    max-width: 900px; 
    min-height: calc(var(--vh, 1vh) * 100);
    margin: 0 auto; 
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.main-content {
    flex : 1 1 auto;
}
.hero {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin: 24px auto;
    max-width: 860px;
    width: min(860px, 100%);
}
.hero-left {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.hero-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}
.hero-right {
    display: flex;
    align-items: center;
    gap: 12px;
}
.hero-title {
    margin: 0;
    text-align: center;
}
.hero-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

/* When the selection screen is open we toggle `selection-mode` on the body
   and center the header action buttons without changing the normal layout. */
body.selection-mode .hero-meta {
    justify-content: center;
}
body.selection-mode .hero-actions {
    justify-content: center;
}

@media (max-width: 680px) {
    .hero {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 0 16px;
    }
    .hero-left {
        width: 100%;
        gap: 16px;
        align-items: center;
    }
    .footer {
        padding-bottom: calc(52px + env(safe-area-inset-bottom));
    }
    .hero-meta {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        width: 100%;
    }
    .hero-right {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        margin-top: 6px;
        gap: 12px;
        padding-right: 16px;
        box-sizing: border-box;
    }
    .schedule-updated {
        margin: 4px 0 12px;
        order: 1;
        white-space: normal;
        width: auto;
        justify-content: flex-start;
    }
    .hero-actions {
        order: 2;
        flex-direction: row;
        justify-content: flex-start;
        width: auto;
    }
    .hero-title {
        width: 100%;
    }
    .hero-meta {
        width: auto;
    }
    .settings-sheet {
        left: 0;
        right: 0;
        width: 100%;
        max-width: none;
        box-sizing: border-box;
        transform: translateX(0) translateY(105%);
    }
    .settings-popup.open .settings-sheet {
        transform: translateX(0) translateY(0);
    }
}
.gear-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #f1f5f9;
    border: 1px solid rgba(15, 23, 42, 0.08);
    color: var(--accent);
    display: inline-flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}
.notifications-btn {
    position: relative;
}
.notifications-btn[hidden] {
    display: none;
}
.notifications-count {
    position: absolute;
    top: -4px;
    right: -5px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border: 2px solid var(--card);
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 14px;
    text-align: center;
}
.notifications-sheet {
    display: flex;
    flex-direction: column;
    max-height: min(82vh, 720px);
    touch-action: pan-y;
    overscroll-behavior: contain;
}
.notifications-popup {
    touch-action: pan-y;
}
.notifications-header {
    align-items: center;
    flex-shrink: 0;
}
.notifications-list-wrapper {
    flex: 1 1 auto;
    min-height: 80px;
    margin-top: 18px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    overscroll-behavior: contain;
}
.notifications-empty {
    margin: 12px 0;
    color: var(--muted);
    text-align: center;
}
.notifications-list {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.notification-item {
    position: relative;
    padding: 12px 14px;
    padding-right: 94px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--card);
}
.notification-item h3 {
    margin: 0;
    color: var(--text);
    font-size: 1rem;
}
.notification-item time {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.8rem;
}
.notification-item p {
    margin: 8px 0 0;
    color: var(--text);
    line-height: 1.45;
    overflow-wrap: anywhere;
}
.notification-delete {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font: inherit;
    font-size: 0.85rem;
}
.notification-delete:hover {
    border-color: #dc2626;
    color: #dc2626;
}
.notification-delete:disabled {
    opacity: 0.5;
    cursor: wait;
}
.notifications-clear {
    flex-shrink: 0;
    margin-top: 14px;
    cursor: pointer;
}
.notifications-clear[hidden] {
    display: none;
}
.notifications-popup.open .notifications-sheet {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}
.notifications-popup.closing .notifications-sheet {
    transform: translateX(-50%) translateY(105%);
    opacity: 0;
}
@media (max-width: 680px) {
    .notifications-sheet {
        left: 0;
        right: 0;
        width: 100%;
        max-width: none;
        transform: translateX(0) translateY(105%);
    }
    .notifications-popup.open .notifications-sheet {
        transform: translateX(0) translateY(0);
    }
    .notifications-popup.closing .notifications-sheet {
        transform: translateX(0) translateY(105%);
    }
}
.refresh-btn {
    color: var(--accent);
}
.refresh-btn:disabled {
    color: var(--muted);
    opacity: 0.45;
    cursor: not-allowed;
}
.refresh-btn.loading svg {
    animation: refresh-spin 1.2s linear infinite;
    animation-play-state: running;
}
.refresh-btn.spin-paused svg {
    animation-play-state: paused;
}
.gear-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}
.print-btn {
    display: none;
}
html.windows-device .print-btn {
    display: inline-flex;
}
@keyframes refresh-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
body.dark-theme .gear-btn {
    background: var(--card);
    border-color: var(--border);
    color: var(--gear);
}
.card { 
    background: var(--card); 
    border-radius: 24px; 
    margin: 0px 20px;
    padding: 20px 25px 25px 25px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, .08); 
}
.hidden { 
    display: none; 
}
label { 
    display: block; 
    margin: 14px 0 6px; 
    font-weight: 600; 
}

#generalClass,
#specialClass {
    width: 100%;
    min-height: 54px;
    padding: 0 48px 0 18px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background-color: var(--card);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='m5 7.5 5 5 5-5' stroke='%232563eb' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-position: right 16px center;
    background-repeat: no-repeat;
    color: var(--text);
    font: inherit;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

#generalClass:hover,
#specialClass:hover {
    border-color: var(--accent);
}

#generalClass:focus-visible,
#specialClass:focus-visible {
    border-color: var(--accent);
    box-shadow: none;
}

#generalClass option,
#specialClass option {
    background: var(--card);
    color: var(--text);
}

body.dark-theme #generalClass,
body.dark-theme #specialClass {
    background-color: #172235;
    border-color: #3a4b65;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='m5 7.5 5 5 5-5' stroke='%237dd3fc' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

body.dark-theme #generalClass:hover,
body.dark-theme #specialClass:hover {
    border-color: var(--accent);
}
 
button { 
    border: 0; 
    cursor: pointer; 
    color: inherit;
}
body.dark-theme button {
    color: inherit;
}
#saveSelection { 
    display: block;
    margin: 32px auto 10px;
    background: var(--accent); 
    color: var(--save-text); 
    padding: 12px 16px; 
    border-radius: 15px; 
    min-width: 144px; 
}
body.dark-theme #saveSelection {
    color: var(--save-text);
}
.day-nav { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    gap: 12px; 
    margin-bottom: 16px; 
}
.icon-btn { 
    width: 46px; 
    height: 46px; 
    border-radius: 50%; 
    background: var(--accent-soft); 
    color: var(--accent); 
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.icon-btn svg {
    width: 28px;
    height: 28px;
}
body.dark-theme .icon-btn {
    color: #ffffff;
}
.lessons-list { 
    display: grid;
    gap: 10px;
    justify-content: center;
}
.lesson-card { 
    border: 1px solid var(--border); 
    border-radius: 18px; 
    padding: 12px; 
    background: var(--card); 
    width: 420px;
    max-width: 420px;
}
.lesson-card.special { 
    background: var(--special); 
    border-color: var(--border); 
}
.lesson-card.empty { 
    background: #eef1f4;
    border-color: #d7dde5;
    color: #7b8794;
}
.lesson-card.empty .lesson-number,
.lesson-card.empty .lesson-subject {
    color: #7b8794;
}
body.dark-theme .lesson-card.empty {
    background: #1c2430;
    border-color: #3b4654;
    color: #98a4b3;
}
body.dark-theme .lesson-card.empty .lesson-number,
body.dark-theme .lesson-card.empty .lesson-subject {
    color: #98a4b3;
}
.lesson-entry { 
    padding: 6px 0; 
    border-top: 1px solid var(--border); 
}
.lesson-entry:first-child { 
    border-top: none; 
}
.lesson-entry:last-child { 
    padding-bottom: 0; 
}
.lesson-entry-title { 
    font-size: 0.9rem; 
    font-weight: 700; 
    margin-bottom: 2px; 
    color: var(--text);
    white-space: normal;
    overflow-wrap: anywhere;
}
.lesson-entry-meta { 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 0.85rem;
}
.lesson-count { 
    font-size: 0.8rem; 
    color: var(--accent); 
    font-weight: 700; 
}
.lesson-subject, .lesson-teacher { 
    overflow: hidden; 
    text-overflow: ellipsis; 
    white-space: nowrap; 
}
.settings-popup {
    position: fixed;
    inset: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 1000;
    touch-action: none;
}
.settings-popup.notifications-popup {
    touch-action: pan-y;
}
.settings-popup.open, .settings-popup.closing {
    visibility: visible;
    pointer-events: auto;
}
.settings-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    opacity: 0;
    transition: opacity 0.25s ease;
}
.settings-popup.open .settings-backdrop {
    opacity: 1;
}
.settings-popup.closing .settings-backdrop {
    opacity: 0;
}
.settings-sheet {
    position: fixed;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%) translateY(105%);
    width: min(100%, 460px);
    background: var(--card);
    border-radius: 24px 24px 0 0;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-bottom: none;
    box-shadow: 0 -16px 40px rgba(15, 23, 42, 0.25);
    padding: 32px 20px 26px;
    transition: transform 0.3s ease, opacity 0.25s ease;
    opacity: 0;
    touch-action: none;
}
.settings-sheet.notifications-sheet {
    touch-action: pan-y;
}

.install-popup {
    position: fixed;
    inset: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 1100;
}
.install-popup.open,
.install-popup.closing {
    visibility: visible;
    pointer-events: auto;
}
.install-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.68);
    opacity: 0;
    transition: opacity 0.25s ease;
}
.install-popup.open .install-backdrop {
    opacity: 1;
}
.install-sheet {
    position: fixed;
    left: 50%;
    bottom: 0;
    width: min(100%, 460px);
    transform: translateX(-50%) translateY(105%);
    background: var(--card);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-bottom: none;
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -16px 40px rgba(15, 23, 42, 0.25);
    padding: 34px 22px calc(24px + env(safe-area-inset-bottom));
    transition: transform 0.3s ease, opacity 0.25s ease;
    opacity: 0;
    touch-action: none;
}
.install-popup.open .install-sheet {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}
.install-popup.closing .install-backdrop {
    opacity: 0;
}
.install-popup.closing .install-sheet {
    transform: translateX(-50%) translateY(105%);
    opacity: 0;
}
.install-handle {
    position: absolute;
    top: 12px;
    left: 50%;
    width: 44px;
    height: 4px;
    transform: translateX(-50%);
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.72);
    box-shadow: none;
}
.install-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}
.install-header h2 {
    margin: 0;
    font-size: 1.35rem;
}
.install-subtitle {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 0.95rem;
}
:root {
    --popup-content-gap: 18px;
    --popup-button-gap: 18px;
}
.install-instructions,
.push-welcome-text {
    margin: var(--popup-content-gap) 0 0;
    color: var(--text);
    font-size: 1rem;
    line-height: 1.55;
}
.install-instructions ol {
    margin: 0;
    padding-left: 22px;
}
.install-instructions li + li {
    margin-top: 8px;
}
.install-share-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.install-share-icon,
.install-menu-icon {
    width: 20px;
    height: 20px;
    color: var(--accent);
    vertical-align: middle;
}
.install-menu-icon {
    width: 22px;
    height: 22px;
    margin-left: 4px;
}
.print-instruction-btn {
    width: 30px;
    height: 30px;
    margin-left: 4px;
    border-radius: 50%;
    background: #f1f5f9;
    border: 1px solid rgba(15, 23, 42, 0.08);
    color: var(--accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
}
.print-instruction-btn svg {
    width: 15px;
    height: 15px;
}
body.dark-theme .print-instruction-btn {
    background: var(--card);
    border-color: var(--border);
    color: var(--gear);
}
.install-action,
.install-dismiss {
    width: 100%;
    min-height: 46px;
    margin-top: var(--popup-button-gap);
    padding: 10px 16px;
    border-radius: 14px;
    font: inherit;
    font-weight: 700;
}
.install-action {
    background: var(--accent);
    color: var(--save-text);
}
body.dark-theme .install-action {
    color: #0f172a;
}
.install-dismiss {
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text);
}
.push-welcome-text {
    color: var(--muted);
}
.settings-popup.open .settings-sheet {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}
@media (max-width: 680px) {
    .settings-sheet {
        left: 0;
        right: 0;
        width: 100%;
        max-width: none;
        transform: translateX(0) translateY(105%);
    }
    .settings-popup.open .settings-sheet {
        transform: translateX(0) translateY(0);
    }
    .settings-popup.closing .settings-sheet {
        transform: translateX(0) translateY(105%);
    }
}
.settings-popup.closing .settings-backdrop {
    opacity: 0;
}
.settings-popup.closing .settings-sheet {
    transform: translateX(-50%) translateY(105%);
    opacity: 0;
}
.sheet-handle {
    position: absolute;
    left: 50%;
    top: 12px;
    transform: translateX(-50%);
    width: 44px;
    height: 4px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.72);
    cursor: grab;
    box-shadow: none;
    touch-action: none;
    user-select: none;
}
.sheet-handle:active {
    cursor: grabbing;
}
.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 18px;
}
.settings-header h2 {
    margin: 0;
    font-size: 1.2rem;
}

.settings-body {
    display: grid;
    gap: 16px;
}
.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
#pushSettingsRow[hidden] {
    display: none;
}
#pushSettingsRow .settings-value {
    text-align: left;
}

.print-schedule {
    display: none;
}

@media print {
    @page { size: A4 landscape; margin: 5mm; }
    body { display: block;}
    body > .app-shell { display: block; max-width: none; min-height: 0; padding: 0; }
    body > .app-shell > *:not(.print-schedule) { display: none; }
    .print-schedule { display: block; max-width: none; min-height: auto; color: #111827; font-family: 'Geologica', 'Segoe UI', sans-serif; }
    .print-schedule header { border-bottom: 2px solid #0078BE; margin-bottom: 6px; padding: 0 2px 5px; }
    .print-schedule h1 { margin: 0; font-size: 20px; }
    .print-schedule header p { margin: 2px 0 0; font-size: 11px; font-weight: 600; color: #0078BE; }
    .print-days { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 12px; justify-content: space-between; align-items: start; }
    .print-day { break-inside: avoid; page-break-inside: avoid; margin: 0; border: 1px solid #dbeafe; border-radius: 9px; overflow: hidden; background: #fff; }
    .print-day:nth-child(1) { grid-column: 1; grid-row: 1; }
    .print-day:nth-child(2) { grid-column: 1; grid-row: 2; }
    .print-day:nth-child(3) { grid-column: 1; grid-row: 3; }
    .print-day:nth-child(4) { grid-column: 2; grid-row: 1; }
    .print-day:nth-child(5) { grid-column: 2; grid-row: 2; } 
    .print-day h2 { margin: 0; padding: 4px 7px 4px 12px; background: #dbeafe; -webkit-print-color-adjust: exact; print-color-adjust: exact; border-left: 4px solid #0078BE; font-size: 13px; position: relative; }

    .print-day table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 8px; line-height: 1.2; overflow: hidden; }
    .print-day th, .print-day td { border: 1px solid #dbeafe; padding: 3px 5px; vertical-align: top; text-align: left; }
    .print-day th { background: #f7faff; color: #64748b; font-size: 7px; text-transform: uppercase; }
    .print-day tbody tr:last-child td:first-child { border-bottom-left-radius: 8px; }
    .print-day tbody tr:last-child td:last-child { border-bottom-right-radius: 8px; }
    .print-day tbody tr:last-child td { border-bottom: 1px solid #dbeafe; }
    .print-period { width: 16%; color: #0078BE; font-weight: 700; white-space: nowrap; }
    .print-period small { color: #64748b; font-weight: 500; font-size: 8px; }
    .print-lesson { display: inline-flex; flex-direction: column; min-width: 42%; margin-right: 8px; margin-bottom: 1px; }
    .print-lesson span { color: #475569; }
    .print-empty { color: #64748b; font-style: normal; font-weight: 700; text-align: center !important; }
    .print-school-info { grid-column: 2; grid-row: 3; justify-self: end; align-self: end; margin-top: 0; margin-right: 25px; position: static; width: auto; box-sizing: border-box; display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 0; border: 0; background: transparent; box-shadow: none; color: #334155; text-align: left; }
    .print-school-info img {height: 100px; object-fit: contain; flex: 0 0 auto; position: relative; left: -10px; }
    .print-contact { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; font-size: 9px; line-height: 1.15; }
    .print-contact-row { display: flex; align-items: center; justify-content: flex-start; gap: 6px; white-space: nowrap; }
    .print-contact-row svg { width: 14px; height: 14px; flex: 0 0 14px; fill: none; stroke: #0078BE; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
    .print-contact strong { color: #0078BE; font-size: 11px; }
    .print-credits {
        position: absolute;
        top: 2mm;
        right: 3mm;
        font-size: 11px;
        color: #64748b;
        text-align: right;
        letter-spacing: 0.02em;
        font-weight: 600;
    }
}

/* Compact right-aligned select for settings */
.settings-row select {
    width: auto;
    max-width: 240px;
    padding: 8px 10px;
    border-radius: 12px;
    margin-left: auto;
    margin-right: 0;
    box-sizing: border-box;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}


.settings-row--spaced {
    margin-top: 8px;
}

/* Specific styling for the theme select control as requested */
#themeSelect,
#enablePushBtn {
    background: #2a313c;
    color: var(--muted);
    border: 1px solid #3d444d;
    font-weight: 700;
    box-shadow: none;
    appearance: none;
    -webkit-appearance: none;
}

/* Light-theme variants: make these controls blend with the light UI */
body:not(.dark-theme) #themeSelect,
body:not(.dark-theme) #enablePushBtn,
body:not(.dark-theme) #changeClassPopup.small-btn {
    background: var(--card);
    color: var(--muted);
    border: 1px solid var(--border);
    box-shadow: none;
    transition: none;
}

/* Keep the change-class button text red in light theme as well */
body:not(.dark-theme) #changeClassPopup.small-btn {
    color: #ea5c53;
}
.settings-label {
    font-weight: 600;
    color: var(--text);
}
.settings-row > .settings-label {
    flex-shrink: 0;
    white-space: nowrap;
}
.settings-value {
    color: var(--muted);
    text-align: right;
    white-space: pre-line;
    max-width: 100%;
    min-width: 0;
    overflow-wrap: anywhere;
}
.secondary-btn {
    display: inline-flex;
    justify-content: center;
    width: fit-content;
    min-width: 180px;
    max-width: 280px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--accent);
    border-radius: 15px;
    padding: 12px 24px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    box-shadow: none;
    outline: none;
    font-weight: 700;
    justify-self: center;
    text-align: center;
    white-space: nowrap;
}

.link-btn {
    background: transparent;
    border: none;
    color: var(--accent);
    padding: 6px 8px;
    font-weight: 700;
    cursor: pointer;
}

/* Right-aligned value + compact change button */
.settings-value-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    min-width: 0;
    max-width: 100%;
}
.settings-value {
    color: var(--muted);
}
.small-btn {
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--accent);
    padding: 8px 10px;
    border-radius: 12px;
    min-width: 110px;
    font-weight: 700;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    box-shadow: none;
    outline: none;
}
.small-btn:hover { filter: brightness(0.98); }

@media (min-width: 681px) {
    .settings-row select,
    .small-btn {
        padding: 10px 14px;
    }
}

/* Container for actions at bottom of settings */
.settings-row-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
}
.settings-row .small-btn {
    margin-top: 8px;
}

/* Dangerous action style for change-class button */
#changeClassPopup.small-btn {
    background: #2a313c;
    color: #ea5c53;
    border: 1px solid #3d444d;
    box-shadow: none;
    transition: none;
}

.small-btn:focus, .secondary-btn:focus { box-shadow: 0 0 0 3px rgba(37,99,235,0.12); }

.switch {
    position: relative;
    display: inline-flex;
    width: 44px;
    height: 24px;
}
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    inset: 0;
    background: var(--border);
    border-radius: 999px;
    transition: background 0.2s ease;
}
.slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: var(--card);
    border-radius: 50%;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.15);
}
.switch input:checked + .slider {
    background: var(--accent);
}
.switch input:checked + .slider::before {
    transform: translateX(20px);
}
.footer {
    text-align: center;
    color: var(--muted);
    padding: 18px;
    margin-top: auto;
}
.footer p {
    margin: 0;
    font-size: 0.95rem;
}


.lesson-top { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    gap: 8px; 
}
.lesson-number { 
    font-size: .85rem; 
    color: var(--accent); 
    font-weight: 700; 
}
.lesson-legend {
    display: flex;
    justify-content: center;
    gap: 18px;
    align-items: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}
.lesson-legend[hidden] {
    display: none !important;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-size: 0.95rem;
}
.legend-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: inline-block;
    border: 1px solid var(--border);
}
.legend-dot.general {
    background: var(--card);
}
.legend-dot.special {
    background: var(--special);
    border-color: var(--border);
}
body.dark-theme .legend-dot.special {
    background: var(--special);
    border-color: var(--border);
}
.schedule-updated {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1.3;
}
.schedule-updated[hidden] {
    display: none !important;
}
.schedule-updated[hidden]::before {
    content: none !important;
}
.schedule-updated::before {
    content: '';
    display: inline-flex;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='10' fill='none' stroke='%2364748b' stroke-width='2'/%3E%3Cpath d='M12 7v5l3 2' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
}
.lesson-time { font-weight: 700; }
.lesson-subject { font-size: 0.9rem; font-weight: 700; }
.lesson-teacher { color: var(--muted); margin-top: 4px; }

@media (max-width: 680px) {
    .install-sheet {
        left: 0;
        width: 100%;
        max-width: none;
        padding-left: 20px;
        padding-right: 20px;
        transform: translateX(0) translateY(105%);
    }
    .install-popup.open .install-sheet {
        transform: translateX(0) translateY(0);
    }
    .install-popup.closing .install-sheet {
        transform: translateX(0) translateY(105%);
    }
    html,
    body {
        width: 100%;
        max-width: 100%;
        height: auto;
        min-height: 100%;
        overflow-x: hidden;
        font-size: 13.5px;
    }
    html {
        font-size: 13.5px;
    }
    .app-shell,
    .main-content,
    .hero {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }
    .app-shell {
        padding-left: 20px;
        padding-right: 20px;
        min-height: 100svh;
    }
    .hero-meta {
        width: 100%;
        max-width: 100%;
        flex-wrap: wrap;
        row-gap: 6px;
    }
    .schedule-updated {
        max-width: 100%;
        min-width: 0;
    }
    .hero-actions {
        flex-shrink: 0;
    }
    .hero-title {
        font-size: 1.8rem;
    }
    .hero-title span {
        display: block;
    }
    .schedule-updated {
        font-size: 1rem;
    }
    .settings-sheet {
        padding: 36px 20px 30px;
    }
    .settings-header h2 {
        font-size: 1.4rem;
    }
    .settings-value,
    .settings-row select {
        font-size: 0.95rem;
    }
    .settings-label {
        font-size: 1rem;
    }
    .settings-row {
        align-items: center;
    }
    .settings-value {
        max-width: 100%;
        line-height: 1.35;
        overflow-wrap: anywhere;
    }
    #currentClassLabel {
        font-size: 1.2rem;
    }
    .settings-value-row {
        flex: 1 1 auto;
        min-width: 0;
        margin-left: 0;
        justify-content: flex-end;
    }
    .settings-row select {
        padding: 10px 12px;
    }
    .small-btn {
        font-size: 1rem;
        padding: 10px 12px;
    }
    .card {
        width: 100%;
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
        padding: 20px 12px 24px;
        overflow: hidden;
    }
    #selectionScreen {
        padding: 24px 20px 28px;
    }
    #selectionScreen h2 {
        margin: 0 0 26px;
        line-height: 1.2;
    }
    #selectionScreen label {
        margin: 0 0 10px;
    }
    #selectionScreen #specialWrapper {
        margin-top: 24px;
    }
    #selectionScreen .actions {
        margin-top: 28px;
    }
    #selectionScreen #saveSelection {
        margin-top: 0;
        margin-bottom: 0;
    }
    #scheduleScreen {
        padding-left: 12px;
        padding-right: 12px;
    }
    #scheduleScreen > .lessons-list {
        width: 100%;
        min-width: 0;
        margin-left: 0;
        margin-right: 0;
        grid-template-columns: minmax(0, 1fr);
    }
    .day-nav {
        width: calc(100% - 16px);
        min-width: 0;
        margin-left: auto;
        margin-right: auto;
    }
    .lessons-list {
        width: 100%;
    }
    .lesson-card {
        width: calc(100% - 16px);
        max-width: none;
        min-width: 0;
        justify-self: center;
    }
    .lesson-top {
        flex-wrap: wrap;
        min-width: 0;
    }
    .lesson-count {
        margin-left: auto;
        font-size: 0.85rem;
    }
    .current-day-label,
    #currentDayLabel {
        font-size: 1.35rem;
    }
    .lesson-number {
        font-size: 0.9rem;
    }
    .lesson-entry-title,
    .lesson-subject {
        font-size: 1rem;
    }
    .lesson-entry-meta,
    .lesson-teacher {
        font-size: 0.9rem;
    }
    .legend-item {
        font-size: 0.95rem;
    }
    .footer p {
        font-size: 1rem;
    }
}
