
body {
    margin: 0;
    padding: 20px;
    background: var(--bg-gradient);
    color: var(--text-color);
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: var(--window-gradient);
    border-radius: 16px;
    padding: 28px;
    border: 1px solid var(--outline-color);
    backdrop-filter: blur(10px);
    box-shadow: 0 24px 60px rgba(0,0,0,0.35);
}

.page-header {
    text-align: center;
    margin-bottom: 3rem;
}

h1 {
    margin: 0 0 12px 0;
    font-size: 2.6rem;
    line-height: 1.1;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: none;
}

.subtitle {
    margin: 0 auto;
    max-width: 56ch;
    opacity: 0.85;
    font-size: 0.95rem;
}

/* --- Layout --- */
.main-content {
    display: grid;
    /* left can shrink, right capped */
    grid-template-columns: minmax(320px, 1fr) minmax(420px, 560px);
    gap: 24px;
    align-items: start;
    justify-content: center;
}

.control-rail {
    max-width: 560px;
    justify-self: start;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Wheel shell gives the canvas a premium bezel without changing its pixels */
.wheel-col {
    position: relative;
}

.wheel-shell {
    position: relative;
    width: min(100%, 600px);    /* never exceed the container */
    aspect-ratio: 1 / 1;        /* keep it perfectly circular */
    margin-inline: auto;
    border-radius: 50%;
    background: radial-gradient(120% 120% at 50% 10%, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.02) 18%, rgba(0,0,0,0.25) 100%), var(--tertiary-gradient);
    box-shadow:
        inset 0 1px 1px rgba(255,255,255,0.06),
        inset 0 -1px 1px rgba(0,0,0,0.5),
        0 24px 60px rgba(0,0,0,0.45);
    border: 1px solid var(--outline-color);
}

#musicWheel {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 50%, rgba(0,0,0,0.35) 0%, rgba(0,0,0,0.6) 60%, rgba(0,0,0,0.75) 100%);
}

.wheel-overlay .center-dot {
    position: absolute;
    inset: 50% auto auto 50%;
    width: 12px;
    height: 12px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: var(--accent-gradient);
    box-shadow: 0 0 0 2px rgba(0,0,0,0.5), 0 0 16px rgba(0,0,0,0.35);
}

/* --- Panels / controls --- */
.controls-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.controls-column {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.control-group {
    background: var(--window-color);
    padding: 18px;
    border-radius: 12px;
    border: 1px solid var(--outline-color);
}

.control-group h3 {
    margin: 0 0 12px 0;
    font-size: 1.1rem;
}

.info-display {
    background: var(--secondary-gradient);
    color: var(--on-secondary);
    padding: 12px;
    border-radius: 10px;
    border-left: 4px solid var(--accent-color);
}

.info-display.compact {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 16px;
}

.note-info {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 0.9rem;
    opacity: 0.95;
}

/* --- Buttons and inputs --- */
.scheme-buttons {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.chord-buttons {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.sequence-buttons {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

button {
    padding: 12px 14px;
    border-radius: 10px;
}

button.danger {
    border-color: #7a1a1a;
}

button:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid var(--outline-color);
    background: var(--tertiary-gradient);
    color: var(--on-tertiary);
    font-feature-settings: "tnum";
}

.label {
    min-width: 52px;
    opacity: 0.9;
}

/* --- Range input styling --- */
.angle-input {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

input[type="range"] {
    flex: 1;
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    outline: none;
    appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--window-color);
    border: 2px solid var(--primary-color);
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
    cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--window-color);
    border: 2px solid var(--primary-color);
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
    cursor: pointer;
}

/* --- Fraction inputs --- */
.custom-fraction {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}
.custom-fraction .slash { opacity: 0.6; }
.custom-fraction input {
    width: 72px;
    padding: 8px;
    border: 1px solid var(--outline-color);
    border-radius: 8px;
    text-align: center;
}

/* --- Responsive --- */

/* 2 → 1 column switch: keep things centered and reduce wheel size a bit */
@media (max-width: 1280px) { /* 1280px = 600 + 560 + gap + padding */
    .main-content {
        grid-template-columns: 1fr;
        justify-items: center;
        gap: 20px;
    }
    .wheel-col { place-self: center; }
    .wheel-shell {
        width: min(100%, 600px);
    }
    .control-rail {
        max-width: 720px;
        width: min(100%, 720px);
        justify-self: center;
    }
    .controls-row {
        grid-template-columns: 1fr;
    }
    .scheme-buttons {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Small tablets / large phones */
@media (max-width: 820px) {
    .container { padding: 20px; }
    .wheel-shell { width: min(100%, 560px); }
}

/* Phones */
@media (max-width: 520px) {
    .scheme-buttons,
    .chord-buttons {
        grid-template-columns: 1fr;
    }
    .custom-fraction {
        grid-template-columns: auto 1fr auto 1fr;
    }
}
