.chartListPage {
    width: min(1180px, calc(100% - 32px));
    margin: 32px auto 72px;
    color: #172033;
}

.chartListHeader {
    margin-bottom: 24px;
}

.chartListPage [hidden] {
    display: none !important;
}

.chartListGrammars,
.chartListYear {
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 16px 18px;
    background: #f7f9fc;
}

.chartListGrammars {
    margin-bottom: 30px;
}

.chartListGrammars > summary,
.chartListYear > summary {
    cursor: pointer;
    font-weight: 700;
    font-size: 1.1rem;
}

.chartListYear > .chartListMonths {
    margin-top: 20px;
}

.chartListGrammarButtons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.chartListGrammarGroups,
.chartListUsedGrammars {
    flex-direction: column;
}

.chartListGrammarGroup {
    width: 100%;
    min-width: 0;
    margin-top: 18px;
}

.chartListGrammarGroup > h3 {
    margin: 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #e2e8f0;
    font-size: 1rem;
    color: #147b87;
}

.chartListGrammarGroup > .chartListGrammarButtons {
    margin-top: 10px;
}

.chartListGrammarLink {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    max-width: 100%;
    overflow-wrap: anywhere;
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #fff;
    color: #172033;
    font: inherit;
    cursor: pointer;
}

.chartListGrammarLink:hover,
.chartListGrammarLink:focus-visible {
    background: var(--main-color-1, #40d4e5);
    color: #102a2e;
    border-color: #147b87;
    font-weight: 700;
}

.chartListHeader h1 {
    margin: 0 0 8px;
    font-size: clamp(1.7rem, 4vw, 2.5rem);
}

.chartListHeader p,
.chartListDate {
    color: #667085;
}

.yourSelectedChart { margin:24px 0; padding:20px; border:2px solid #147b87; border-radius:14px; background:#f2fafb; }
.yourSelectedChart > h2 { margin:0 0 14px; font-size:1.2em; }
.chartListMonths {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.chartListMonth h2 {
    margin: 0 0 12px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--main-color-1, #40d4e5);
    font-size: 1.25rem;
}

.chartListItems {
    overflow: hidden;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(23, 32, 51, .05);
}

.chartListItem {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 24px;
    align-items: center;
    padding: 16px 18px;
}

.chartListItem + .chartListItem {
    border-top: 1px solid #e8edf3;
}

.chartListItemMain {
    min-width: 0;
}

.chartListItem h3 {
    margin: 7px 0 0;
    font-size: 1.05rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.chartListType {
    display: inline-flex;
    padding: 5px 10px;
    border-radius: 999px;
    background: #eaf8fb;
    color: #147b87;
    font-size: .78rem;
    font-weight: 700;
}

.chartListOpenButton {
    min-width: 130px;
    padding: 11px 16px;
    border: 0;
    border-radius: 10px;
    background: var(--main-color-1, #40d4e5);
    color: #102a2e;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.chartListDate {
    margin: 0;
    white-space: nowrap;
    font-size: .9rem;
}

.chartListOpenButton:hover {
    filter: brightness(.96);
}

.chartListEmpty {
    grid-column: 1 / -1;
    padding: 40px 20px;
    border-radius: 16px;
    background: #f7f9fc;
    text-align: center;
    color: #667085;
}

.chartListDialog {
    width: min(1180px, calc(100vw - 32px));
    max-width: none;
    height: min(88vh, 900px);
    max-height: none;
    padding: 0;
    border: 0;
    border-radius: 18px;
    overflow: hidden;
    background: #fff;
    color: #172033;
}

.chartListDialog::backdrop {
    background: rgba(15, 23, 42, .68);
    backdrop-filter: blur(3px);
}

.chartListDialog {
    background: transparent;
}

.chartListDialog > .chartListDialogPanel {
    position: relative;
    width: 100%;
    height: 100%;
    padding: 0;
    border-radius: inherit;
    text-align: left;
    display: flex;
    flex-direction: column;
}

.chartListToolbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-shrink: 0;
    min-height: 68px;
    padding: 10px 18px 10px 56px;
    box-sizing: border-box;
    border-bottom: 1px solid #e2e8f0;
}

.chartListToolbar button {
    width: 44px;
    height: 44px;
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    color: #172033;
    cursor: pointer;
}

.chartListToolbar button:has(.zoomReset) {
    width: auto;
}
.chartListToolbar .chartListGrammarButton { width:auto; padding:8px 12px; font:inherit; }
.chartListCanvasRegion { position:relative; flex:1; min-height:0; display:flex; }
.chartListGrammarPopup { position:absolute; inset:12px; margin:auto; width:min(560px, calc(100% - 24px)); max-height:calc(100% - 24px); height:fit-content; box-sizing:border-box; overflow:auto; overscroll-behavior:contain; z-index:20; padding:18px; border:1px solid #cbd5e1; border-radius:14px; background:#fff; color:#172033; box-shadow:0 12px 40px #17203344; }
.chartListGrammarPopup[hidden] { display:none; }
.chartListGrammarPopup header { display:flex; align-items:center; justify-content:space-between; gap:12px; position:sticky; top:-18px; background:#fff; padding:8px 0; }
.chartListGrammarPopup h2 { margin:0; font-size:1.1em; }
.chartListGrammarClose { padding:8px 12px; border:1px solid #cbd5e1; border-radius:8px; background:#fff; cursor:pointer; font:inherit; }
.chartListUsedGrammars { display:flex; flex-wrap:wrap; gap:10px; padding-top:10px; }
.chartListUsedGrammars a { max-width:100%; overflow-wrap:anywhere; }

.chartListToolbar button:disabled {
    opacity: .4;
    cursor: default;
}

.chartListToolbar button:focus-visible {
    outline: 2px solid #147b87;
    outline-offset: 2px;
}

.chartListToolbar img {
    display: block;
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.chartListModalChart {
    flex: 1;
    min-height: 0;
    padding: 18px;
    box-sizing: border-box;
    overflow: auto;
    background: #f8fafc;
}

.chartListModalChart .grammarViewChart {
    margin: 0;
}

.chartListViewButtons {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 22rem;
    max-width: 100%;
}

.chartListViewButtons > .chartListOpenButton {
    box-sizing: border-box;
    min-width: 0;
    width: 100%;
    overflow-wrap: anywhere;
}
.chartListSequenceControls { flex-shrink:0; padding:12px 18px; border-top:1px solid #e2e8f0; background:#fff; }
.chartListNarration { box-sizing:border-box; white-space:pre-wrap; overflow-wrap:anywhere; height:120px; overflow:auto; overscroll-behavior:contain; line-height:1.7; margin-bottom:12px; }
.chartListNarrationFrame { position:relative; margin-bottom:12px; }
.chartListNarrationFrame:has(> .chartListNarration[hidden]) { display:none; }
.chartListNarrationFrame > .chartListNarration { margin-bottom:0; }
.chartListNarrationFade { position:absolute; left:0; right:0; height:22px; display:flex; justify-content:center; align-items:center; color:#64748b; font-size:12px; line-height:1; opacity:0; pointer-events:none; user-select:none; }
.chartListNarrationFadeTop { top:0; background:linear-gradient(to bottom,rgba(255,255,255,.96),rgba(255,255,255,0)); }
.chartListNarrationFadeBottom { bottom:0; background:linear-gradient(to top,rgba(255,255,255,.96),rgba(255,255,255,0)); }
.chartListNarrationFrame.canScrollUp > .chartListNarrationFadeTop,
.chartListNarrationFrame.canScrollDown > .chartListNarrationFadeBottom { opacity:1; }
.chartListModalChart { position:relative; overflow-anchor:none; }
.chartListZoomStage.jwsChartSequence .grammarViewChartViewport { overflow:visible; }
@media (max-height:600px) { .chartListNarration { height:80px; } }
.chartListSequenceNavigation { display:flex; align-items:center; justify-content:center; flex-wrap:wrap; gap:10px; }
.chartListSequenceNavigation button { min-height:44px; padding:8px 14px; border:1px solid #cbd5e1; border-radius:8px; background:#fff; color:#172033; font:inherit; cursor:pointer; }
.chartListSequenceNavigation button:disabled { opacity:.4; cursor:default; }
.chartListSequenceNavigation button:focus-visible { outline:2px solid #147b87; outline-offset:2px; }

@media (max-width: 1024px) {
    .chartListItem {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 12px 16px;
    }

    .chartListItemMain {
        grid-column: 1 / -1;
    }

    .chartListDate {
        white-space: normal;
        overflow-wrap: anywhere;
    }
}

@media (max-width: 640px) {
    .chartListPage {
        width: min(100% - 20px, 1180px);
        margin-top: 20px;
    }

    .chartListDialog {
        width: calc(100vw - 12px);
        height: calc(100vh - 20px);
        border-radius: 12px;
    }

    .chartListModalChart {
        padding: 10px;
    }

    .chartListMonths {
        gap: 24px;
    }

    .chartListItem {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 16px;
    }

    .chartListOpenButton {
        width: 100%;
    }

    .chartListViewButtons {
        width: 100%;
        grid-template-columns: minmax(0, 1fr);
        grid-auto-rows: minmax(44px, auto);
    }
}
