*, *::before, *::after {
    box-sizing: border-box;
    border: 0 solid transparent;
}

html {
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    background-color: #ffffff;
    color: #0f172a;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior: none;
    transition: background-color 0.25s ease, color 0.25s ease;
}

@media (min-width: 768px) {
    body { padding: 3rem; }
}

.dark body,
html.dark body {
    background-color: #020617;
    color: #f1f5f9;
}

button, input, a {
    font: inherit;
    color: inherit;
}

button {
    background: transparent;
    cursor: pointer;
    padding: 0;
}

a { text-decoration: none; }

.serif {
    font-family: 'Lora', Georgia, Cambria, 'Times New Roman', serif;
}

.hidden { display: none !important; }

/* Top bar */
.top-bar {
    width: 100%;
    max-width: 28rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0.5rem;
    margin-bottom: 1rem;
}

.stats-wrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.progress-ring {
    flex-shrink: 0;
}

.progress-ring__track {
    color: #f1f5f9;
}
html.dark .progress-ring__track {
    color: #1e293b;
}

.progress-ring__circle {
    color: #10b981;
    transition: stroke-dashoffset 0.6s ease;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
}

.stats-row {
    display: flex;
    align-items: baseline;
    gap: 0.3rem;
}

.stats-percent {
    font-size: 0.75rem;
    font-weight: 700;
    color: #334155;
    letter-spacing: -0.02em;
}
html.dark .stats-percent { color: #cbd5e1; }

.stats-count {
    font-size: 9px;
    font-weight: 500;
    color: #94a3b8;
}
html.dark .stats-count { color: #64748b; }

.stats-sub {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
    font-weight: 500;
}
html.dark .stats-sub { color: #64748b; }

.streak-badge {
    color: #10b981;
    font-weight: 700;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.pill-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.375rem 0.75rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 9999px;
    color: #64748b;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}
.pill-btn:hover { background: #f1f5f9; color: #0f172a; }
html.dark .pill-btn {
    background: #0f172a;
    border-color: #1e293b;
    color: #94a3b8;
}
html.dark .pill-btn:hover { background: #1e293b; color: #f8fafc; }

/* Main card */
.main-wrap {
    width: 100%;
    max-width: 28rem;
    position: relative;
    touch-action: pan-y;
}

.date-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3.5rem;
}

.date-center {
    text-align: center;
}

.date-picker {
    display: block;
    width: 100%;
    text-align: center;
    background: transparent;
    border: none;
    outline: none;
    font-size: 10px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #94a3b8;
    cursor: pointer;
    padding: 0;
}
html.dark .date-picker { color: #64748b; }

input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.25;
}
html.dark input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
}

.display-date {
    font-size: 0.75rem;
    margin-top: 0.5rem;
    font-weight: 500;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
html.dark .display-date { color: #94a3b8; }

.nav-btn {
    opacity: 0.35;
    transition: opacity 0.2s, transform 0.15s;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
    -webkit-tap-highlight-color: transparent;
}
.nav-btn:hover { opacity: 1; }
.nav-btn:active { transform: scale(0.92); }
.nav-btn:disabled { opacity: 0.08; cursor: default; }

.reading-main {
    text-align: center;
}

.reading-label {
    margin-bottom: 0.75rem;
    font-size: 10px;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: #cbd5e1;
    font-weight: 600;
}
html.dark .reading-label { color: #334155; }

.reading-portion {
    font-size: 1.875rem;
    font-weight: 400;
    line-height: 1.3;
    margin: 0 0 2.5rem 0;
    color: #0f172a;
    transition: opacity 0.18s ease, transform 0.18s ease;
}
@media (min-width: 768px) {
    .reading-portion { font-size: 2.25rem; }
}
html.dark .reading-portion { color: #f1f5f9; }

.actions-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
}

.action-button {
    transition: transform 0.12s ease, background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}
.action-button:active { transform: scale(0.96); }

.check-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 1rem 2.5rem;
    border: 2px solid #f1f5f9;
    border-radius: 0.375rem;
    color: #94a3b8;
    font-size: 0.75rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    font-weight: 600;
}
@media (min-width: 640px) {
    .check-btn { width: auto; }
}
html.dark .check-btn {
    border-color: #1e293b;
    color: #64748b;
}

.check-btn.completed {
    background-color: #10b981;
    color: #ffffff !important;
    border-color: #10b981;
}

@keyframes celebratePop {
    0% { transform: scale(1); }
    45% { transform: scale(1.05); }
    100% { transform: scale(1); }
}
.check-btn.pop {
    animation: celebratePop 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.read-link-wrap {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.read-link {
    display: inline-block;
    width: 100%;
    padding: 1rem 3rem;
    background-color: #0f172a;
    color: #ffffff;
    font-size: 0.75rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    border-radius: 0.375rem;
    font-weight: 500;
}
@media (min-width: 640px) {
    .read-link { width: auto; }
}
html.dark .read-link {
    background-color: #f1f5f9;
    color: #0f172a;
}

.sub-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.25rem;
    padding-top: 0.25rem;
}

.text-action {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #94a3b8;
    font-weight: 600;
    transition: color 0.2s;
}
.text-action:hover { color: #475569; }
html.dark .text-action { color: #64748b; }
html.dark .text-action:hover { color: #cbd5e1; }

.text-action--accent:hover { color: #10b981; }

/* Complete year banner */
.complete-banner {
    margin-top: 1.5rem;
    padding: 0.85rem 1.25rem;
    border-radius: 0.75rem;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
}
html.dark .complete-banner {
    background: #064e3b;
    border-color: #065f46;
    color: #d1fae5;
}

/* Footer */
.footer-bar {
    width: 100%;
    max-width: 28rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    padding: 1.5rem 0 1rem;
}

.settings-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
}

.settings-divider {
    width: 1px;
    height: 0.75rem;
    background: #e2e8f0;
}
html.dark .settings-divider { background: #1e293b; }

.settings-row {
    display: flex;
    background: #f1f5f9;
    padding: 2px;
    border-radius: 6px;
    gap: 2px;
}
html.dark .settings-row { background: #1e293b; }

.settings-row button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 4px;
    transition: all 0.2s;
    white-space: nowrap;
}
.settings-row button.active {
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}
html.dark .settings-row button.active {
    background: #334155;
    color: #f8fafc;
}
.settings-row button:not(.active) {
    color: #94a3b8;
}

.disclaimer {
    text-align: center;
    padding: 0 1rem;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #94a3b8;
    line-height: 1.6;
    max-width: 280px;
    margin: 0 auto;
}
html.dark .disclaimer { color: #475569; }

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    background: #0f172a;
    color: #ffffff;
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 700;
    padding: 0.65rem 1.1rem;
    border-radius: 9999px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    z-index: 60;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
}
html.dark .toast {
    background: #f1f5f9;
    color: #0f172a;
}
.toast.show {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.toast-undo {
    padding: 0.2rem 0.55rem;
    border-radius: 9999px;
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    font-weight: 700;
    letter-spacing: 0.12em;
}
html.dark .toast-undo {
    background: rgba(16, 185, 129, 0.18);
    color: #059669;
}

/* Modals */
.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.55);
    backdrop-filter: blur(8px);
    z-index: 50;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
}
.modal-backdrop.show {
    display: flex;
}

.modal-card {
    background: #ffffff;
    width: 100%;
    max-width: 26rem;
    border-radius: 1.25rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}
html.dark .modal-card {
    background: #0f172a;
    border: 1px solid #1e293b;
}

.modal-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
html.dark .modal-header { border-bottom-color: #1e293b; }

.modal-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: #94a3b8;
    margin: 0;
}

.modal-close {
    padding: 0.35rem;
    color: #94a3b8;
    display: inline-flex;
}
.modal-close:hover { color: #0f172a; }
html.dark .modal-close:hover { color: #f8fafc; }

.modal-tools {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
html.dark .modal-tools { border-bottom-color: #1e293b; }

.search-input {
    width: 100%;
    padding: 0.55rem 0.8rem;
    font-size: 0.8rem;
    border-radius: 0.5rem;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #0f172a;
    outline: none;
}
.search-input:focus { border-color: #94a3b8; }
html.dark .search-input {
    background: #020617;
    border-color: #1e293b;
    color: #f1f5f9;
}

.filter-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.jump-btn {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #10b981;
    padding: 4px 8px;
    border-radius: 4px;
}
.jump-btn:hover { background: rgba(16, 185, 129, 0.1); }

.schedule-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
    max-height: 62vh;
}

.schedule-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 0.75rem;
    border-radius: 0.5rem;
    margin-bottom: 2px;
    cursor: pointer;
    transition: background-color 0.15s;
}
.schedule-item:hover { background: #f8fafc; }
html.dark .schedule-item:hover { background: #1e293b; }

.schedule-item.is-current {
    background: #f1f5f9;
}
html.dark .schedule-item.is-current {
    background: #1e293b;
}

.schedule-item-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.schedule-idx {
    font-size: 10px;
    font-weight: 700;
    color: #94a3b8;
    min-width: 2.8rem;
}

.schedule-name {
    font-size: 0.8rem;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
html.dark .schedule-name { color: #f1f5f9; }

.schedule-name.is-done {
    color: #94a3b8;
    text-decoration: line-through;
}
.schedule-name.is-current {
    font-weight: 700;
}

.schedule-empty {
    text-align: center;
    padding: 2rem 1rem;
    font-size: 0.75rem;
    color: #94a3b8;
}

/* Backup / Install modal body */
.modal-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    text-align: center;
}

.modal-btn-primary {
    width: 100%;
    padding: 0.85rem 1rem;
    background: #0f172a;
    color: #ffffff;
    border-radius: 0.5rem;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.16em;
}
html.dark .modal-btn-primary {
    background: #f1f5f9;
    color: #0f172a;
}

.modal-btn-secondary {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: #64748b;
}
html.dark .modal-btn-secondary {
    border-color: #1e293b;
    color: #94a3b8;
}

.install-steps {
    text-align: left;
    background: #f8fafc;
    padding: 1rem 1.25rem;
    border-radius: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}
html.dark .install-steps { background: #020617; }

.install-step {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: #475569;
}
html.dark .install-step { color: #cbd5e1; }

.install-num {
    width: 1.4rem;
    height: 1.4rem;
    flex-shrink: 0;
    border-radius: 9999px;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
}
html.dark .install-num { background: #1e293b; }
