html, body {
    height: 100%;
    margin: 0;
}

:root {
    --bg: white;
    --text: black;
    --footer: #F5F5F5;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: black;
        --text: white;
        --footer: #1A1A1A;
    }
}

:root[data-theme="dark"] {
    --bg: black;
    --text: white;
    --footer: #1A1A1A;
}

:root[data-theme="light"] {
    --bg: white;
    --text: black;
    --footer: #F5F5F5;
}

html {
    scrollbar-gutter: stable;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    -webkit-text-size-adjust: 100%;
}

body {
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;

    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.content {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding-left: 20px;
    line-height: 1.6;
    width: 100%;
    overflow-x: auto;
}

.content > div {
    width: 100vw;
    overflow-x: auto;
}

code {
    display: inline-block;
}

.footer {
    margin-top: auto;
    padding: 10px;
    text-align: center;
    font-size: 3px;
    word-break: break-word;
    background: var(--footer);
}

.toggle-switch {
    position: absolute;
    top: 16px;
    right: 20px;
    z-index: 10;
    display: flex;
    align-items: center;
    font-size: 12px;
    user-select: none;
}

.toggle-switch input {
    width: 0;
    height: 0;
    opacity: 0;
}

.switch-label {
    display: inline-block;
    width: 32px;
    height: 18px;
    background: #ccc;
    border-radius: 9px;
    position: relative;
    transition: background 0.3s;
    cursor: pointer;
    margin-right: 6px;
}

.switch-label::after {
    content: '';
    position: absolute;
    left: 2px;
    top: 2px;
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.3s;
}

.switch-label::before {
    content: "⏾";
    position: absolute;
    right: -19px;
    top: 50%;
    transform: translateY(-50%) scale(1);
    font-size: 16px;
    color: currentColor;
    font-family: "Apple Symbols", "Segoe UI Symbol", sans-serif;
    transition:
        transform 220ms cubic-bezier(0.22, 1, 0.36, 1),
        opacity 200ms ease;
}

#theme-toggle:checked + .switch-label::before {
    content: "☀";
    transform: translateY(calc(-50% + 1px)) scale(1.15);
    opacity: 1;
}

#theme-toggle:checked + .switch-label {
    background: #444;
}

#theme-toggle:checked + .switch-label::after {
    transform: translateX(14px);
    background: #222;
}

:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .switch-label::before {
        transition: none;
    }
}
