* {
    margin: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --ink: #08306b;
    --blue: #1d6fd1;
    --mid: #5b9bd5;
    --pale: #eaf3fb;
    --line: #a9cce8;
}

body {
    font-family: "Comic Sans MS", "Comic Sans", cursive, sans-serif;
    background: var(--pale);
    color: var(--ink);
    line-height: 1.4;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 32px 16px;
}

.container {
    background: #fff;
    max-width: 480px;
    width: 100%;
    padding: 32px;
    border: 3px solid var(--blue);
    border-radius: 40px 12px 40px 12px;
}

h1 {
    font-size: 1.9em;
    color: var(--blue);
    display: inline-block;
    border-bottom: 5px solid var(--mid);
    padding-bottom: 2px;
    margin-bottom: 10px;
}

.confetti-btn {
    flex: none;
    display: block;
    margin: 4px 0 18px;
    padding: 8px 16px;
    font-size: 0.8em;
    border-radius: 20px 8px 20px 8px;
}

.confetti-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 999;
}

.confetti-piece {
    position: absolute;
    top: -14px;
    width: 8px;
    height: 14px;
    border-radius: 2px;
    animation: confetti-fall linear forwards;
}

@keyframes confetti-fall {
    to {
        transform: translateY(110vh) rotate(var(--spin, 720deg));
        opacity: 0.5;
    }
}

.subtitle,
.sample-label,
.info-box,
.confidence,
.bpm-label {
    color: var(--mid);
    font-weight: bold;
    font-size: 0.85em;
}

.subtitle {
    font-size: 0.95em;
    margin-bottom: 20px;
}

.settings-row,
.metro-row,
.result-head,
.drone-controls,
.sample-buttons,
.button-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.settings-row {
    color: var(--mid);
    font-size: 0.85em;
}

.settings-row label {
    font-weight: 700;
    color: var(--ink);
}

input {
    border: 2px solid var(--line);
    border-radius: 10px;
    padding: 6px;
    width: 60px;
    text-align: center;
    background: var(--pale);
    color: var(--ink);
    font: inherit;
}

input:focus {
    outline: none;
    border-color: var(--blue);
}

.btn,
.chip-btn {
    font: inherit;
    font-weight: 700;
    border: 2px solid var(--blue);
    border-radius: 16px;
    cursor: pointer;
}

.btn {
    flex: 1;
    padding: 13px;
    background: var(--blue);
    color: #fff;
    font-size: 0.95em;
}

.btn:active:not(:disabled) {
    background: var(--ink);
    border-color: var(--ink);
}

.btn:disabled,
.chip-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.btn-secondary {
    background: #fff;
    color: var(--blue);
}

.btn-secondary:active:not(:disabled) {
    background: var(--pale);
    color: var(--ink);
}

.btn-inline {
    flex: none;
    padding: 8px 16px;
}

.chip-btn {
    background: none;
    border-color: var(--mid);
    color: var(--mid);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75em;
}

.status {
    text-align: center;
    font-weight: bold;
    padding: 6px;
    border: 2px dashed var(--line);
    border-radius: 12px;
    margin-bottom: 16px;
}

.status.error {
    color: var(--blue);
    border-color: var(--blue);
    border-style: solid;
}

.meter,
.progress-bar {
    height: 8px;
    background: var(--pale);
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 8px;
}

.meter-fill,
.progress-fill {
    height: 100%;
    width: 0%;
    background: var(--blue);
    transition: width 0.15s;
}

.display-box,
.util-card {
    background: var(--pale);
    border-radius: 12px 32px 12px 32px;
    padding: 20px;
    margin-bottom: 16px;
    border: 2px solid var(--line);
    transition: transform 0.15s ease;
}

.display-box:hover,
.util-card:hover {
    transform: rotate(-0.4deg);
}

.lock-badge {
    background: var(--blue);
    color: #fff;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72em;
    font-weight: 700;
    visibility: hidden;
}

.lock-badge.on {
    visibility: visible;
    animation: pop 0.35s ease;
}

@keyframes pop {
    0% {
        transform: scale(0.6)
    }

    60% {
        transform: scale(1.15)
    }

    100% {
        transform: scale(1)
    }
}

.note-display {
    text-align: center;
    font-size: 3em;
    font-weight: 700;
    color: var(--ink);
}

.scale-display {
    text-align: center;
    font-size: 1.15em;
    font-weight: 700;
    color: var(--blue);
}

.sargam-display {
    text-align: center;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--mid);
    margin-bottom: 8px;
}

canvas {
    width: 100%;
    height: 130px;
    border-radius: 12px 32px 12px 32px;
    background: var(--ink);
    border: 3px solid var(--blue);
    margin-bottom: 16px;
}

.pill {
    background: var(--blue);
    color: #fff;
    padding: 6px 14px;
    border-radius: 20px 6px 20px 6px;
    font-weight: 700;
    font-size: 0.85em;
}

.pill:nth-child(even) {
    background: var(--mid);
}

.pill-swara {
    display: block;
    font-size: 0.7em;
    font-weight: 400;
    opacity: 0.9;
}

.card-title {
    font-weight: 700;
    color: var(--blue);
    margin-bottom: 10px;
}

.metro-beats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-top: 14px;
}

.beat-dot {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--mid);
    transition: transform 0.1s ease, background 0.1s ease;
}

.beat-dot:nth-child(1) {
    border-radius: 2px;
    transform: rotate(45deg);
}

.beat-dot:nth-child(3) {
    width: 18px;
    height: 12px;
    border-radius: 40% 60% 60% 40%;
}

.beat-dot:nth-child(4) {
    transform: rotate(20deg) scale(0.85);
}

.beat-dot.sam {
    border-color: var(--blue);
    border-width: 3px;
}

.beat-dot.now {
    background: var(--blue);
    border-color: var(--blue);
    transform: scale(1.5);
}

.beat-dot:nth-child(1).now {
    transform: scale(1.5) rotate(45deg);
}

.beat-dot:nth-child(4).now {
    transform: scale(1.5) rotate(20deg);
}

.history-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.history-list::-webkit-scrollbar {
    width: 6px;
}

.history-list::-webkit-scrollbar-thumb {
    background: var(--line);
    border-radius: 10px;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    border: 2px solid var(--line);
    border-radius: 14px;
    padding: 8px 12px;
}

.history-note {
    font-size: 1.3em;
    font-weight: 700;
    color: var(--blue);
}

.history-time {
    color: var(--mid);
    font-size: 0.72em;
    margin-left: auto;
}