.intro {
    position: absolute;
    top: calc(9% + var(--safe-top));
    left: 50%;
    z-index: 10;
    width: min(88%, 600px);
    text-align: center;
    pointer-events: none;
    transform: translateX(-50%);
    transition:
        opacity 1.6s ease,
        transform 1.6s ease;
}

.intro.is-hidden {
    opacity: 0;
    transform: translate(-50%, -10px);
}

.intro h1 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2rem, 7vw, 4.8rem);
    font-weight: 400;
    letter-spacing: 0.05em;
    text-shadow: 0 0 30px rgba(205, 255, 165, 0.12);
}

.intro p {
    margin: 0.8rem auto 0;
    color: var(--text-secondary);
    font-size: clamp(0.85rem, 2.4vw, 1rem);
    letter-spacing: 0.04em;
    line-height: 1.6;
}

.intro p span {
    display: inline;
}

.settings-button {
    position: absolute;
    top: calc(16px + var(--safe-top));
    right: calc(16px + var(--safe-right));
    z-index: 20;

    display: grid;
    width: 34px;
    height: 34px;
    padding: 0;
    place-items: center;

    border: 1px solid rgba(220, 255, 195, 0.1);
    border-radius: 50%;
    outline-offset: 4px;

    background: rgba(3, 10, 12, 0.18);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);

    font-size: 0.9rem;
    line-height: 1;
    cursor: pointer;
    transition:
        color 160ms ease,
        background-color 160ms ease,
        border-color 160ms ease,
        opacity 220ms ease,
        transform 220ms ease;
}

.forest.controls-idle .settings-button:not([aria-expanded="true"]) {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-6px);
}

.forest.controls-idle .intro,
.forest.controls-idle .bottom-message {
    opacity: 0;
    pointer-events: none;
}

.settings-button::before {
    width: 17px;
    height: 17px;
    content: "";
    background: rgba(230, 255, 210, 0.34);
    mask: url("../assets/gear_icon.png") center / contain no-repeat;
    -webkit-mask: url("../assets/gear_icon.png") center / contain no-repeat;
    transition: background-color 160ms ease;
}

.settings-button:hover,
.settings-button[aria-expanded="true"] {
    border-color: rgba(220, 255, 195, 0.2);
    background: rgba(5, 16, 17, 0.34);
}

.settings-button:hover::before,
.settings-button[aria-expanded="true"]::before {
    background: rgba(238, 255, 224, 0.62);
}

.settings-panel {
    position: absolute;
    top: calc(58px + var(--safe-top));
    right: calc(16px + var(--safe-right));
    z-index: 21;

    display: grid;
    width: min(210px, calc(100% - 32px - var(--safe-left) - var(--safe-right)));
    gap: 13px;
    padding: 14px;

    border: 1px solid rgba(218, 255, 186, 0.1);
    border-radius: 8px;

    color: rgba(232, 247, 222, 0.64);
    background: rgba(3, 10, 12, 0.28);
    backdrop-filter: blur(9px);
    -webkit-backdrop-filter: blur(9px);

    opacity: 0;
    pointer-events: none;
    transform: translateY(-4px);
    transition:
        opacity 160ms ease,
        transform 160ms ease;
}

.settings-panel.is-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.settings-panel label {
    display: grid;
    gap: 6px;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
}

.sound-switch {
    display: block !important;
    position: relative;
    width: 36px;
    height: 20px;
}

.sound-switch input {
    position: absolute;
    inset: 0;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.sound-switch span {
    position: absolute;
    inset: 0;
    border: 1px solid rgba(218, 255, 186, 0.12);
    border-radius: 999px;
    background: rgba(2, 9, 10, 0.42);
    transition:
        background-color 160ms ease,
        border-color 160ms ease;
}

.sound-switch span::before {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    content: "";
    background: rgba(230, 255, 210, 0.38);
    transition:
        background-color 160ms ease,
        transform 160ms ease;
}

.sound-switch input:checked + span {
    border-color: rgba(210, 255, 151, 0.24);
    background: rgba(126, 165, 102, 0.22);
}

.sound-switch input:checked + span::before {
    background: rgba(230, 255, 210, 0.72);
    transform: translateX(16px);
}

.settings-panel input,
.settings-panel select {
    width: 100%;
}

.settings-panel select {
    min-height: 28px;
    border: 1px solid rgba(218, 255, 186, 0.12);
    border-radius: 6px;
    color: rgba(232, 247, 222, 0.72);
    background: rgba(2, 9, 10, 0.42);
}

.settings-panel .burst-slider,
.settings-panel .count-slider {
    accent-color: rgba(205, 232, 167, 0.38);
}

.count-control {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 36px;
    align-items: center;
    gap: 8px;
}

.count-control output {
    color: rgba(232, 247, 222, 0.62);
    font-size: 0.68rem;
    text-align: right;
}

.bottom-message {
    position: absolute;
    bottom: calc(22px + var(--safe-bottom));
    left: 50%;
    z-index: 12;

    max-width: calc(100% - 48px);
    padding: 8px 13px;
    border: 1px solid rgba(224, 255, 200, 0.1);
    border-radius: 999px;

    color: rgba(226, 243, 219, 0.52);
    background: rgba(3, 10, 11, 0.22);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);

    font-size: 0.75rem;
    letter-spacing: 0.04em;
    text-align: center;
    white-space: nowrap;

    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 10px);

    transition:
        opacity 1s ease,
        transform 1s ease;
}

.bottom-message.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

.noscript-message {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 30;

    width: min(90%, 420px);
    margin: 0;
    padding: 20px;

    border-radius: 16px;
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.75);

    text-align: center;
    transform: translate(-50%, -50%);
}
