* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ============ My Dark (default) ============ */
:root {
    --bg-body: #1a1a1a;
    --bg-chrome: #262626;
    --bg-hd: #2d2d2d;
    --sec-hover: #3d3d3d;
    --bg-item-hover: #2d2d2d;
    --border: #3d3d3d;
    --border-item: #2d2d2d;
    --text-hi: #fff;
    --text-sub: #aaa;
    --text-muted: #888;
    --accent: #00d4ff;
    --btn: #0078d7;
    --btn-hover: #0098ff;
    --btn-fg: #fff;
    --overlay: rgba(0, 0, 0, 0.7);
    --overlay-strong: rgba(0, 0, 0, 0.8);
    color-scheme: dark;
}

/* ============ My Light (parchment, matches help files) ============ */
html[data-theme="light"] {
    --bg-body: #FFFEE0;
    --bg-chrome: #FCF5E6;
    --bg-hd: #F4E6AB;
    --sec-hover: #F9F0CE;
    --bg-item-hover: #F7E4B8;
    --border: #E2D5A6;
    --border-item: #EEE3C0;
    --text-hi: #000;
    --text-sub: #333;
    --text-muted: #666;
    --accent: #000;
    --btn: #DFC47E;
    --btn-hover: #E8D698;
    --btn-fg: #333;
    --overlay: rgba(0, 0, 0, 0.4);
    --overlay-strong: rgba(0, 0, 0, 0.5);
    color-scheme: light;
}

body {
    font-family: Verdana, Arial, sans-serif;
    background: var(--bg-body);
    color: var(--text-hi);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header (mobile base) */
header {
    background: var(--bg-hd);
    padding: 8px 10px;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.header-left, .header-right {
    display: flex;
    gap: 8px;
    align-items: center;
}

header h3 {
    color: var(--text-hi);
    font-size: 1.1rem;
    font-weight: bold;
    margin-left: 10px;
}

.header-btn {
    background: var(--btn);
    color: var(--btn-fg);
    border: none;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
}

.header-btn:hover {
    background: var(--btn-hover);
}

.theme-btn {
    font-family: inherit;
    font-size: 1rem;
    background: var(--btn);
    color: var(--btn-fg);
    border: none;
    padding: 6px 6px;
    border-radius: 6px;
    cursor: pointer;
}

.theme-btn:hover {
    background: var(--btn-hover);
}

.theme-label {
    color: var(--text-hi);
    font-size: 1rem;
}

.header-btn-text {
    display: none;
}

.header-btn-icon {
    display: inline;
}

/* Main content */
main {
    flex: 1;
    margin-top: 48px;
    overflow: hidden;
    position: relative;
}

iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Side panel / Menu */
.panel-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--overlay);
    z-index: 200;
}

.panel-overlay.open {
    display: block;
}

.side-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 85vw;
    max-width: 85vw;
    height: 100%;
    background: var(--bg-chrome);
    overflow-y: auto;
    z-index: 300;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.side-panel.open {
    transform: translateX(0);
}

.panel-header {
    background: var(--bg-hd);
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h3 {
    color: var(--accent);
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-hi);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px 10px;
}

.close-btn:hover {
    color: var(--accent);
}

/* Accordion */
.accordion {
    padding: 10px 0;
}

.accordion-section {
    border-bottom: 1px solid var(--border);
}

.accordion-header {
    padding: 12px 15px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-hd);
    transition: background 0.2s;
}

.accordion-header:hover {
    background: var(--sec-hover);
}

.accordion-header h4 {
    color: var(--text-hi);
    font-size: 0.9rem;
    font-weight: normal;
}

.accordion-arrow {
    color: var(--accent);
    transition: transform 0.3s;
}

.accordion-section.open .accordion-arrow {
    transform: rotate(180deg);
}

.accordion-content {
    display: none;
    background: var(--bg-body);
}

.accordion-section.open .accordion-content {
    display: block;
}

.menu-list {
    list-style: none;
}

.accordion-content .menu-item {
    padding-left: 30px;
}

.menu-item {
    padding: 14px 15px;
    min-height: 48px;
    font-size: 0.95rem;
    border-bottom: 1px solid var(--border-item);
    cursor: pointer;
    transition: background 0.2s;
}

.menu-item:hover {
    background: var(--bg-item-hover);
}

.menu-item a {
    color: var(--text-hi);
    text-decoration: none;
    display: block;
}

.menu-item a:hover {
    color: var(--accent);
}

.menu-comment {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 4px;
}

/* Copyright Modal */
.copyright-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--overlay-strong);
    z-index: 500;
    align-items: center;
    justify-content: center;
}

.copyright-modal.open {
    display: flex;
}

.copyright-content {
    background: var(--bg-hd);
    padding: 30px;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    position: relative;
}

.copyright-header {
    background: var(--bg-body);
    color: var(--accent);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 1.1rem;
}

.copyright-text {
    line-height: 1.6;
    color: var(--text-sub);
}

.copyright-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    color: var(--text-hi);
    font-size: 1.5rem;
    cursor: pointer;
}

.copyright-close:hover {
    color: var(--accent);
}

/* Desktop — opt-in via min-width */
@media (min-width: 601px) {
    header {
        padding: 10px 15px;
        justify-content: space-between;
    }

    header h3 {
        font-size: 1.7rem;
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        margin-left: 0;
    }

    .header-right {
        margin-left: auto;
    }

    main {
        margin-top: 50px;
    }

    .header-btn-text {
        display: inline;
    }

    .header-btn-icon {
        display: none;
    }

    .header-btn {
        padding: 8px 16px;
        min-width: 44px;
    }

    .theme-btn {
        padding: 8px 12px;
    }

    .side-panel {
        width: 300px;
        max-width: 300px;
    }

    .menu-item {
        padding: 12px 15px;
        min-height: auto;
        font-size: 1rem;
    }

    .accordion-header {
        padding: 15px;
    }

    .accordion-header h4 {
        font-size: 0.95rem;
    }
}
