/* «Обрезать песню онлайн» (/tools/obrezat-pesnyu). Логика — cutter.js. */

.ac-app {
    --ink: #141414;
    --muted: #6b6457;
    --line: #e3ddd1;
    --paper: #fbf9f5;
    --card: #fffdf9;
    --accent: #1d4e89;
    --red: #b5432a;
    --sel: rgba(29, 78, 137, .12);
    color: var(--ink);
    font-family: Inter, system-ui, sans-serif;
    font-size: 15px;
    -webkit-tap-highlight-color: transparent;
}
.ac-app *, .ac-app *::before, .ac-app *::after { box-sizing: border-box; }
.ac-app [hidden] { display: none !important; }

/* --- кнопки --- */
.ac-btn {
    appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    border: 1px solid #d6cfc0; background: #fff; color: var(--ink); border-radius: 8px;
    padding: 7px 12px; font: 600 14px/1.2 Inter, sans-serif; cursor: pointer; white-space: nowrap; text-decoration: none;
    transition: background .12s, border-color .12s, color .12s;
}
.ac-btn:hover { border-color: var(--ink); }
.ac-btn:disabled { opacity: .45; cursor: default; border-color: #d6cfc0; }
.ac-btn.ac-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.ac-btn.ac-primary:hover { background: #163d6c; }
.ac-btn.ac-big { padding: 11px 18px; font-size: 15px; }
.ac-sq { width: 34px; padding: 7px 0; }

/* --- загрузка --- */
.ac-drop {
    border: 2px dashed #cfc7b8; border-radius: 14px; background: var(--card); padding: 38px 20px; text-align: center;
    transition: border-color .15s, background .15s;
}
.ac-drop.is-over { border-color: var(--accent); background: #f1f5fb; }
.ac-drop.is-busy { opacity: .7; pointer-events: none; }
.ac-drop-ico { color: var(--accent); margin-bottom: 8px; }
.ac-drop-title { font: 700 22px/1.25 'PT Serif', Georgia, serif; margin-bottom: 14px; }
.ac-drop .ac-btn { padding: 12px 26px; font-size: 16px; }
.ac-drop-hint { color: var(--muted); font-size: 14px; line-height: 1.5; margin-top: 14px; }
.ac-drop-err { color: var(--red); font-weight: 600; margin-top: 12px; }

/* --- рабочая область --- */
.ac-file { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.ac-file-name { font: 700 18px/1.3 'PT Serif', Georgia, serif; word-break: break-word; }
.ac-file-meta { color: var(--muted); font-size: 14px; }
.ac-file .ac-btn { margin-left: auto; }

.ac-wave {
    position: relative; height: 170px; background: var(--card); border: 1px solid var(--line); border-radius: 10px;
    overflow: hidden; touch-action: none; cursor: crosshair; user-select: none;
}
.ac-wave canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.ac-shade { position: absolute; top: 0; bottom: 0; background: rgba(251, 249, 245, .72); pointer-events: none; }
.ac-shade-l { left: 0; }
.ac-shade-r { right: 0; }
.ac-sel { position: absolute; top: 0; bottom: 0; background: var(--sel); border-top: 3px solid var(--accent); border-bottom: 3px solid var(--accent); cursor: grab; }
/* в режиме «Вырезать» выделенное — то, что пропадёт */
.ac-wave.is-cut .ac-shade { background: transparent; }
.ac-wave.is-cut .ac-sel {
    background: repeating-linear-gradient(135deg, rgba(181, 67, 42, .16) 0 8px, rgba(181, 67, 42, .28) 8px 16px);
    border-color: var(--red);
}
.ac-wave.is-cut .ac-handle span { background: var(--red); }
.ac-handle { position: absolute; top: 0; bottom: 0; width: 24px; margin-left: -12px; cursor: ew-resize; z-index: 2; }
.ac-handle::before { content: ''; position: absolute; left: 11px; top: 0; bottom: 0; width: 2px; background: var(--ink); }
.ac-handle span {
    position: absolute; left: 4px; top: 50%; width: 16px; height: 36px; margin-top: -18px; border-radius: 5px;
    background: var(--accent); box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
}
.ac-handle span::after { content: ''; position: absolute; left: 7px; top: 10px; width: 2px; height: 16px; background: rgba(255, 255, 255, .8); }
.ac-cursor { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--red); opacity: .55; pointer-events: none; }
.ac-play { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--red); pointer-events: none; z-index: 3; }

.ac-ruler { position: relative; height: 20px; margin: 2px 0 10px; color: var(--muted); font-size: 12px; }
.ac-ruler span { position: absolute; top: 2px; transform: translateX(-50%); white-space: nowrap; }
.ac-ruler span:first-child { transform: none; }

.ac-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.ac-transport .ac-big { min-width: 230px; }
.ac-lbl { color: var(--muted); font-size: 14px; }

.ac-times { gap: 14px 22px; }
.ac-time { display: inline-flex; align-items: center; gap: 6px; }
.ac-time > span { font-weight: 600; min-width: 56px; }
.ac-time input {
    width: 92px; padding: 7px 8px; border: 1px solid #d6cfc0; border-radius: 8px; background: #fff;
    font: 600 15px/1.2 Inter, sans-serif; text-align: center; font-variant-numeric: tabular-nums;
}
.ac-time input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.ac-len { font-size: 15px; }
.ac-len b { font-variant-numeric: tabular-nums; }

.ac-panels { display: grid; grid-template-columns: 1fr 1.4fr; gap: 14px; margin: 16px 0; }
.ac-panel, .ac-save { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.ac-panel-h { font: 700 17px/1.3 'PT Serif', Georgia, serif; margin-bottom: 10px; }
.ac-radio { display: flex; gap: 8px; align-items: flex-start; margin: 8px 0; cursor: pointer; line-height: 1.4; }
.ac-radio input { margin-top: 3px; accent-color: var(--accent); }
.ac-check { display: flex; gap: 8px; align-items: center; margin: 8px 0; cursor: pointer; font-size: 14px; }
.ac-check input { accent-color: var(--accent); }
.ac-slider { display: grid; grid-template-columns: 130px 1fr 54px; align-items: center; gap: 10px; margin: 6px 0; font-size: 14px; }
.ac-slider input { width: 100%; accent-color: var(--accent); }
.ac-slider input:disabled { opacity: .4; }
.ac-slider output { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

.ac-formats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.ac-fmt {
    appearance: none; border: 1.5px solid #d6cfc0; background: #fff; border-radius: 10px; padding: 10px 8px; cursor: pointer;
    display: flex; flex-direction: column; gap: 2px; align-items: center; color: var(--ink); font-family: Inter, sans-serif;
}
.ac-fmt b { font-size: 16px; }
.ac-fmt small { font-size: 12px; color: var(--muted); }
.ac-fmt[aria-pressed="true"] { border-color: var(--accent); background: #f1f5fb; box-shadow: inset 0 0 0 1px var(--accent); }
.ac-radio-i { display: inline-flex; gap: 5px; align-items: center; font-size: 14px; cursor: pointer; }
.ac-radio-i input { accent-color: var(--accent); }
.ac-fmt-note { background: #fdf6e7; border: 1px solid #ecdcb4; border-radius: 8px; padding: 9px 12px; font-size: 14px; line-height: 1.45; margin: 8px 0; }

.ac-progress { flex: 1 1 160px; max-width: 260px; height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.ac-progress div { height: 100%; width: 0; background: var(--accent); transition: width .15s; }
.ac-status { color: var(--muted); font-size: 14px; }
.ac-result { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.ac-result audio { height: 40px; flex: 1 1 260px; max-width: 420px; }
.ac-res-meta { color: var(--muted); font-size: 13px; word-break: break-all; }

@media (max-width: 760px) {
    .ac-panels { grid-template-columns: 1fr; }
    .ac-formats { grid-template-columns: repeat(2, 1fr); }
    .ac-wave { height: 140px; }
    .ac-transport .ac-big { min-width: 0; flex: 1 1 100%; }
    .ac-time { flex-wrap: wrap; }
    .ac-slider { grid-template-columns: 110px 1fr 48px; }
    .ac-file .ac-btn { margin-left: 0; }
}
