:root {
    color-scheme: dark;
    --text: #eeeeee;
    --base: #d2d2d5;
    --mantle: #3d3db6;
    --crust: #181825;
    --back: rgba(3, 3, 25, 0.8);
}

html, body {
    height: 100%;
    margin: 0;
    font-family: russiangothic, ms ui gothic, nec_apc3, Tahoma, serif;
    overflow: hidden;
}

.back-button-wrapper {
    position: absolute;
    top: 15px;
    left: 25px;
}

.back-button {
    width: 150px;
    padding: 15px;
    display: flex;
    text-align: center;
    justify-content: center;
    background: var(--mantle);
    text-decoration: none;
    color: var(--text);
    font-size: 20px;
    border-radius: 8px;

}

.wrap {
    height: 100%;
    display: grid;
    place-items: center;
    padding: 15px;
}

.instructions-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    width: min(92vw, 640px);
    top: 0;
    right: 50%;
    transform: translate(50%);
    background: var(--base);
    height: 35px;
    z-index: 5;
    border-radius: 8px;
}

.top-instructions {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--crust);
}

.panel {
    top: -2vh;
    width: min(92vw, 640px);
    height: 102vh;
    position: relative;
    overflow: hidden;
}

.stack {
    position: absolute;
    inset: 0;
}


.title-wrapper {
    position: fixed;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
}

.page-title {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-size: 14px;
    letter-spacing: .4em;
    font-weight: 700;
    color: #9aa3b2;
    background: #0f1115;
    border: 1px solid #2a2f38;
    border-radius: 10px;
    padding: 14px 10px;
    text-transform: uppercase;
    opacity: .9;
}


.row {
    position: absolute;
    left: 50%;
    translate: -50% 0;
    width: min(92vw, 640px);
    max-width: 640px;
    height: 110px;
    display: flex;
    background: #CBCBCB;
    color: #1f2937;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
    cursor: pointer;
    transition: transform .12s ease, box-shadow .12s ease, opacity .3s ease;
    will-change: transform, top;
}

.row:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, .12);
}


.card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    padding-left: 10px;
}

.course-code {
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 1px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.title {
    font-weight: 600;
    font-size: 15px;
    color: #374151;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.subtitle {
    font-size: 13px;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.instructor {
    display: inline-block;
    width: fit-content;
    padding: 3px 8px;
    border-radius: 6px;
    background: #e5efff;
    color: #1e3a8a;
    font-size: 12px;
    font-weight: 700;
    border: 1px solid #dbeafe;
}

.thumb {
    flex: 0 0 150px;
    height: 100%;
    border-radius: 8px;
    object-fit: cover;
    margin-left: 12px;
}


.notes-statistics {
    position: fixed;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
    width: 320px;
    max-height: calc(100vh - 48px);
    overflow: auto;
    padding: 4px;
    z-index: 3;
}

.notes-statistics-wrapper {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stat-card {
    background: #ffffff;
    color: #111827;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
}

.stat-title {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 6px;
}

.stat-label {
    font-size: 12px;
    color: #6b7280;
}

.stat-value {
    font-size: 28px;
    font-weight: 800;
    line-height: 1;
}

.stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.chart {
    width: 100%;
    height: auto;
    display: block;
}

.donut-card {
    text-align: center;
}

.donut {
    --p: 0%;
    width: 120px;
    height: 120px;
    margin: 8px auto 4px;
    border-radius: 50%;
    background: conic-gradient(var(--mantle) var(--p), #e5e7eb 0);
    position: relative;
}

.donut::after {
    content: "";
    position: absolute;
    inset: 18px;
    border-radius: 50%;
    background: #ffffff;
}

.donut > span {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-weight: 800;
    color: #111827;
}

@media (max-width: 1100px) {
    .notes-statistics {
        display: none;
    }
}

/* semester card */
.stat-card {
    background: #fff;
    color: #111827;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
}

.stat-title {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 6px;
}

.sem-dates {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 8px;
}

.progress {
    height: 10px;
    background: #eef2f7;
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0;
    background: #3b82f6;
    transition: width .4s ease;
}

.sem-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    margin-top: 8px;
}

.mini-cal {
    margin-top: 10px;
}

.cal-head {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 6px;
}

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    font-size: 12px;
}

.note-viewer {
    position: fixed;
    inset: 0;
    display: none;
    grid-template-rows:44px 1fr;
    z-index: 9999;
    background: #0b0d14
}

.note-viewer.show {
    display: grid
}

.note-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: #0f111a;
    border-bottom: 1px solid #202636;
    color: #e5e7eb;
    font-family: system-ui
}

.note-toolbar .btn {
    border: 1px solid #394356;
    background: #111827;
    color: #e5e7eb;
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer
}

.note-path {
    opacity: .8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

#noteMount {
    height: 100%;
    overflow: auto;
    background: #1F1E1F
}

.cal-grid .dow {
    color: #9ca3af;
    text-align: center;
}

.cell {
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fff;
    color: #111827;
}

.cell.muted {
    color: #9ca3af;
    background: #fafafa;
}

.cell.today {
    outline: 2px solid #111827;
    outline-offset: -2px;
    font-weight: 700;
}

.cell.end {
    background: #dbeafe;
    border-color: #bfdbfe;
    font-weight: 700;
    color: #1e3a8a;
}

#bar-tooltip {
    z-index: 10;
}

@media (pointer: coarse) {
    .wrap {
        padding: 0;
    }

    .panel {
        height: auto;
        max-height: none;
        overflow: auto;
    }

    .stack {
        position: relative;
    }

    .row {
        position: relative;
        left: auto;
        translate: none;
        top: auto !important;
        margin: 8px 0;
        opacity: 1 !important;
        transform: none !important;
    }

    .instructions-wrapper {
        display: none;
    }

    .title-wrapper {
        position: fixed;
        left: 50%;
        top: 85%;
        transform: translateX(-50%);
        z-index: 2;
    }

    .page-title {
        rotate: 270deg;
        letter-spacing: 2px;
    }
}
