/* Tone generator: control panel + prominent Play/Stop button. Theme tokens only. */

.tone-gen {
    max-width: 640px;
    margin-inline: auto;
}

.tg-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem;
    margin-block: 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
}

/* Main controls grid: two columns on wider screens, one on small. */
.tg-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem 1.25rem;
}

.tg-control {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 0;
}

.tg-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--muted);
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
}

.tg-readout {
    font-variant-numeric: tabular-nums;
    color: var(--text);
    font-weight: 700;
}

.tg-panel .field {
    width: 100%;
}

/* Volume / range slider styled to the accent. */
.tg-slider {
    width: 100%;
    height: 1.6rem;
    accent-color: var(--accent);
    cursor: pointer;
}

/* Pulse row. */
.tg-pulse {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    padding-top: 0.25rem;
    border-top: 1px solid var(--border);
}

.tg-check {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}

.tg-check input {
    width: 1.1rem;
    height: 1.1rem;
    accent-color: var(--accent);
    cursor: pointer;
}

.tg-pulse-rate {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tg-pulse-rate .tg-label {
    margin: 0;
}

.tg-rate {
    width: 5rem;
}

.tg-rate-unit {
    width: auto;
}

/* Big, prominent Play/Stop button. */
.tg-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    width: 100%;
    padding-block: 0.9rem;
    font-size: 1.15rem;
    font-weight: 700;
}

.tg-toggle .icon {
    width: 1.2em;
    height: 1.2em;
}

/* Clear playing state: switch to the "bad"/stop accent. */
.tg-toggle.is-playing {
    background: var(--bad);
    border-color: var(--bad);
    color: #fff;
    animation: tg-pulse-glow 1.6s ease-in-out infinite;
}

@keyframes tg-pulse-glow {
    0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--bad) 45%, transparent); }
    50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--bad) 0%, transparent); }
}

@media (prefers-reduced-motion: reduce) {
    .tg-toggle.is-playing {
        animation: none;
    }
}

@media (max-width: 480px) {
    .tg-grid {
        grid-template-columns: 1fr;
    }

    .tg-panel {
        padding: 1.1rem;
    }
}
