:root {
    --bg: black;
    --fg: rgb(211, 211, 211);
    --muted: rgb(148, 145, 131);
    --overlay: rgba(0, 0, 0, 0.88);
}

body.light {
    --bg: whitesmoke;
    --fg: rgb(77, 76, 76);
    --overlay: rgba(245, 245, 245, 0.92);
}

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

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

canvas {
    display: block;
    flex: 1;
    min-height: 0;
    width: 100%;
}

h1 {
    margin-bottom: 5px;
}

p {
    padding: 0;
    margin: 0;
}

a {
    color: inherit;
}

.header {
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
}

.controls {
    display: flex;
    flex-direction: row;
    gap: 50px;
    align-items: center;
}

.mode {
    display: flex;
    flex-direction: column;
}

input {
    accent-color: var(--muted);
}

.visuals {
    display: flex;
    flex-direction: column;
}

.sound {
    display: flex;
    flex-direction: column;
}

.settings-toggle {
    display: none;
}

.text-button {
    margin-top: 6px;
    padding: 0;
    border: none;
    background: none;
    color: inherit;
    font: inherit;
    font-size: 0.85rem;
    text-decoration: underline;
    opacity: 0.8;
    cursor: pointer;
}

.text-button:hover {
    opacity: 1;
}

dialog {
    width: calc(100% - 32px);
    max-width: 32rem;
    border: 1px solid var(--muted);
    border-radius: 8px;
    background-color: var(--bg);
    color: var(--fg);
    line-height: 1.5;
}

dialog p {
    margin-bottom: 0.75em;
}

dialog::backdrop {
    background: rgba(0, 0, 0, 0.6);
}

.github-link {
    position: fixed;
    bottom: 16px;
    right: 20px;
}

.github-link span {
    color: var(--muted);
    font-size: 0.85rem;
    opacity: 0.7;
}

.github-link a {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.85rem;
    opacity: 0.7;
}

.github-link a:hover {
    opacity: 1;
}

body.display-mode {
    cursor: none;
}

body.display-mode .header,
body.display-mode .github-link {
    display: none;
}

.exit-hint {
    display: none;
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 14px;
    border-radius: 6px;
    background: var(--overlay);
    color: var(--fg);
    font-size: 0.85rem;
    white-space: nowrap;
    pointer-events: none;
}

body.display-mode .exit-hint {
    display: block;
    animation: hint-fade 4s forwards;
}

@keyframes hint-fade {
    0%, 70% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

@media (max-width: 700px) {
    .header {
        position: relative;
        display: block;
        padding: 8px 16px;
    }

    .title-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
    }

    .title-row h1 {
        margin: 0;
        font-size: 1.4rem;
    }

    .title-card p {
        font-size: 0.85rem;
    }

    .settings-toggle {
        display: block;
        flex-shrink: 0;
    }

    .controls {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        z-index: 1;
        padding: 16px;
        background: var(--overlay);
    }

    body.settings-open .controls {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
        align-items: start;
    }

    .controls label[for="collector"],
    .controls label[for="scale-mode"] {
        display: block;
    }

    .controls button,
    .controls select,
    .controls input[type="range"] {
        width: 100%;
        box-sizing: border-box;
    }

    .controls button {
        margin-top: 6px;
    }
}
