.audio-tool {
    width: 100%;
    max-width: 800px;
    min-height: 600px;
    margin: 30px auto !important;
    padding: 24px;
    background: #fff;
    border: 1px solid #e8e9ed;
    border-radius: 18px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, .08);
}

/* Centered heading */
.tool-heading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 11px;
    margin-bottom: 22px;
}

.tool-heading h1 {
    margin: 0 0 7px;
    font-size: 32px;
    font-weight: 750;
    letter-spacing: -.6px;
}

.tool-heading p {
    margin: 0;
    color: #737781;
    font-size: 15px;
    line-height: 1.5;
}

.status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 15px;
    border-radius: 30px;
    background: #f0f1f3;
    color: #50535a;
    font-size: 12px;
    font-weight: 600;
}

.status.running {
    background: #e9f8ee;
    color: #18763b;
}

.status.finished {
    background: #eaf1ff;
    color: #2458b8;
}

.tool-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.panel {
    min-width: 0;
    padding: 18px;
    background: #fff;
    border: 1px solid #e9eaee;
    border-radius: 14px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .045);
}

.panel-title {
    margin: 0 0 15px;
    font-size: 15px;
    font-weight: 700;
}

.label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
    font-size: 13px;
    color: #4c4f56;
}

.bpm-value {
    font-size: 20px;
    font-weight: 750;
    color: #17181b;
}

.form-range {
    accent-color: #111;
}

.bpm-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
}

.preset {
    flex: 1;
    min-width: 42px;
    padding: 7px 5px;
    border: 1px solid #e0e1e5;
    border-radius: 8px;
    background: #fff;
    color: #333;
    font-size: 11px;
    cursor: pointer;
}

.preset:hover,
.preset.active {
    border-color: #111;
    background: #f0f0f0;
}

.black-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: 100%;
    min-height: 42px;
    padding: 10px 14px;
    border: 1px solid #292929;
    border-radius: 9px;
    background: linear-gradient(135deg, #303030, #050505);
    color: #fff;
    font-size: 13px;
    font-weight: 650;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, .12);
    transition: transform .15s, opacity .15s;
}

.black-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    color: #fff;
    background: linear-gradient(135deg, #222, #000);
}

.black-btn:disabled {
    opacity: .42;
    cursor: not-allowed;
    box-shadow: none;
}

.secondary-btn {
    width: 100%;
    min-height: 39px;
    padding: 9px 12px;
    border: 1px solid #dedfe4;
    border-radius: 9px;
    background: #fff;
    color: #292a2e;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.secondary-btn:hover:not(:disabled) {
    background: #f5f5f6;
}

.secondary-btn:disabled {
    opacity: .4;
    cursor: not-allowed;
}

.beat-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 176px;
    margin-bottom: 15px;
    padding: 15px;
    border: 1px solid #eeeef1;
    border-radius: 12px;
    background: #fafafa;
    text-align: center;
}

.beat-circle {
    width: 76px;
    height: 76px;
    margin-bottom: 12px;
    border: 5px solid #e0e1e5;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 0 7px rgba(0, 0, 0, .025);
    transition: background .08s, transform .08s, box-shadow .08s;
}

.beat-circle.flash {
    transform: scale(1.09);
    border-color: #242424;
    background: #242424;
    box-shadow: 0 0 0 10px rgba(0, 0, 0, .09);
}

.beat-caption {
    margin: 0;
    color: #72747b;
    font-size: 12px;
}

.beat-number {
    margin-top: 5px;
    font-size: 14px;
    font-weight: 700;
}

.tap-btn {
    min-height: 54px;
    font-size: 15px;
}

.tap-btn:active:not(:disabled) {
    transform: scale(.98);
}

.small-note {
    margin: 10px 0 0;
    color: #777a82;
    font-size: 11px;
    line-height: 1.5;
    text-align: center;
}

.metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
}

.metric {
    min-width: 0;
    padding: 12px;
    border: 1px solid #ececf0;
    border-radius: 10px;
    background: #fcfcfd;
}

.metric-label {
    margin-bottom: 7px;
    color: #737680;
    font-size: 11px;
    line-height: 1.4;
}

.metric-value {
    font-size: 19px;
    font-weight: 750;
    overflow-wrap: anywhere;
}

.metric-unit {
    margin-left: 3px;
    color: #777a82;
    font-size: 11px;
    font-weight: 500;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
    max-height: 128px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid #eeeef1;
    border-radius: 8px;
    background: #fff;
    font-size: 12px;
}

.history-item span:last-child {
    font-weight: 700;
}

.empty-history {
    padding: 15px 5px;
    color: #858790;
    font-size: 12px;
    text-align: center;
}

.results {
    display: none;
    margin-top: 16px;
    padding: 17px;
    border: 1px solid #e3e7ef;
    border-radius: 12px;
    background: #f9fafc;
}

.results.show {
    display: block;
}

.results h3 {
    margin: 0 0 12px;
    font-size: 15px;
    font-weight: 750;
}

.result-summary {
    margin-bottom: 12px;
    color: #454850;
    font-size: 13px;
    line-height: 1.7;
}

.result-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
}

.footer-note {
    margin: 17px 0 0;
    padding-top: 13px;
    border-top: 1px solid #eeeef1;
    color: #777a82;
    font-size: 11px;
    line-height: 1.6;
}

@media (max-width: 600px) {
    body {
        padding: 10px;
    }

    .audio-tool {
        min-height: auto;
        padding: 16px;
        border-radius: 14px;
    }

    .tool-heading h2 {
        font-size: 22px;
    }

    .tool-grid {
        grid-template-columns: 1fr;
    }

    .panel {
        padding: 15px;
    }
}

@media (max-width: 360px) {
    .metrics {
        grid-template-columns: 1fr 1fr;
    }

    .metric {
        padding: 9px;
    }

    .metric-value {
        font-size: 16px;
    }

    .result-actions {
        grid-template-columns: 1fr;
    }
}