/* =========================================================
   AIMP3.RU - дизайн-система
   Один и тот же файл подключается и на главной (index.php),
   и на странице результата (api.php), чтобы весь путь
   пользователя выглядел как один продукт.

   Принципы:
   - никаких внешних шрифтов и внешних запросов, только
     системный шрифтовой стек;
   - один сдержанный акцент вместо градиентов;
   - небольшой единообразный радиус везде (не круги, не пилюли);
   - минимум декоративных плашек, порядок важнее украшений.
   ========================================================= */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    /* Цвет: нейтральный тёмный фон, один акцент (сигнальный янтарный,
       как индикатор записи в студии - единственная отсылка к теме,
       которая не превращается в decor ради decor) */
    --bg: #131315;
    --bg-panel: #1b1b1f;
    --accent: #e8622c;
    --accent-dark: #c94f1f;
    --accent-soft: #fdeee6;
    --gold: #c98a1a;
    --ok: #1f8a52;
    --error: #c94040;
    --ink: #1c1c1f;
    --ink-soft: #62626b;
    --ink-faint: #93939c;
    --line: #e4e3e0;
    --surface: #ffffff;
    --surface-muted: #f5f4f1;

    /* Форма: единый небольшой радиус, никаких пилюль/кругов */
    --radius-lg: 10px;
    --radius-md: 8px;
    --radius-sm: 6px;
    --shadow-panel: 0 1px 2px rgba(20,20,20,0.06), 0 12px 32px -18px rgba(20,20,20,0.35);
    --shadow-card: 0 1px 3px rgba(20,20,20,0.08);
    --container-w: 1240px;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
}

html { scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background: var(--bg);
    min-height: 100vh;
    color: var(--ink);
    line-height: 1.5;
}

a { color: inherit; }

.page { max-width: var(--container-w); margin: 0 auto; padding: 20px; }

/* ---------- header ---------- */
.site-header {
    background: var(--bg-panel);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: var(--radius-lg);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    color: rgba(255,255,255,0.92);
}
.site-header .logo {
    font-weight: 800;
    font-size: 17px;
    letter-spacing: 0.1px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.site-header .logo a { text-decoration: none; color: inherit; }
.site-header nav { display: flex; gap: 22px; }
.site-header nav a {
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: color .15s ease;
}
.site-header nav a:hover { color: #fff; }

/* ---------- generic surfaces ---------- */
.panel {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-panel);
    border: 1px solid var(--line);
}

h1 { font-size: 24px; font-weight: 800; letter-spacing: -0.1px; color: var(--ink); }
h2 { font-weight: 800; color: var(--ink); }
h3 { font-weight: 800; color: var(--ink); }
.subtitle { color: var(--ink-soft); margin-top: 4px; font-size: 14px; }

/* ---------- form ---------- */
label { display: block; font-weight: 700; margin: 16px 0 6px; color: var(--ink); font-size: 13.5px; }
input, textarea, select {
    width: 100%;
    padding: 11px 13px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    background: var(--surface);
    color: var(--ink);
    transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, textarea:focus, select:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px rgba(232,98,44,0.14);
}
textarea { min-height: 80px; resize: vertical; }

.label-row { display: flex; align-items: center; gap: 6px; margin: 16px 0 6px; }
.label-row label { margin: 0; }
.help-icon {
    width: 16px; height: 16px;
    border-radius: 50%;
    background: var(--surface-muted);
    border: 1px solid var(--line);
    color: var(--ink-soft);
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    user-select: none;
}
.help-icon:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.help-tooltip {
    display: none;
    position: absolute;
    top: 22px; left: 0;
    background: var(--ink);
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    width: 220px;
    line-height: 1.45;
    z-index: 10;
    box-shadow: 0 8px 20px rgba(0,0,0,0.25);
}
.help-icon.open .help-tooltip { display: block; }

.tags-container { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 10px; }
.tags-container .tag-btn, .tags-container .genre-btn { flex: 1 1 auto; text-align: center; }
.tag-btn, .genre-btn {
    padding: 9px 14px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--ink-soft);
    transition: all .15s ease;
    user-select: none;
    white-space: nowrap;
    font-family: inherit;
}
.tag-btn:hover, .genre-btn:hover { border-color: var(--accent); color: var(--accent-dark); background: var(--accent-soft); }
.tag-btn.active, .genre-btn.active { background: var(--ink); border-color: var(--ink); color: #fff; }

.extra-options { display: none; }
.extra-options.expanded { display: flex; }
.show-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 4px 0 6px;
    padding: 4px 0;
    background: none;
    border: none;
    color: var(--accent-dark);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
}
.show-more-btn:hover { text-decoration: underline; }

.vocal-group { display: flex; gap: 8px; margin-top: 6px; }
.vocal-btn {
    flex: 1;
    padding: 10px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--ink-soft);
    text-align: center;
    transition: all .15s ease;
    font-family: inherit;
}
.vocal-btn:hover { border-color: var(--accent); color: var(--accent-dark); }
.vocal-btn.active { background: var(--ink); border-color: var(--ink); color: #fff; }

.style-field-wrap {
    margin: 18px 0 4px;
    padding: 14px 16px;
    background: var(--surface-muted);
    border: 1.5px solid var(--line);
    border-radius: var(--radius-md);
}
.style-field-wrap label { margin: 0 0 8px; font-size: 13px; }
.style-warning {
    font-size: 11.5px;
    color: #8a6d00;
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    margin-bottom: 8px;
    line-height: 1.4;
}
#styleField {
    border: 1.5px solid var(--line);
    background: var(--surface);
    min-height: 64px;
    font-size: 13px;
}
.style-char-count { text-align: right; font-size: 11px; color: var(--ink-faint); margin-top: 4px; font-family: var(--mono); }

.price-line {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    font-size: 13px;
    color: var(--ink-soft);
}
.price-line .price-amount { font-family: var(--mono); font-size: 15px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }

button[type="submit"] {
    width: 100%;
    padding: 15px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15.5px;
    font-weight: 800;
    letter-spacing: 0.1px;
    cursor: pointer;
    margin-top: 14px;
    transition: background .15s ease;
    font-family: inherit;
}
button[type="submit"]:hover { background: var(--accent-dark); }
button[type="submit"]:active { background: var(--accent-dark); }

.footer-note {
    margin-top: 18px;
    padding: 14px 16px;
    background: var(--surface-muted);
    border-radius: var(--radius-md);
    text-align: center;
    font-size: 13px;
    color: var(--ink-soft);
    border: 1px solid var(--line);
}
.footer-note strong { color: var(--ink); }
.footer-note a { color: var(--accent-dark); text-decoration: none; font-weight: 700; border-bottom: 1px dashed var(--accent-dark); }
.footer-note a:hover { opacity: .8; }

/* ---------- layout ---------- */
.container { background: var(--surface); width: 100%; padding: 30px; }
.layout { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
.sidebar-col {
    display: flex; flex-direction: column; gap: 20px;
    position: sticky; top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #d8d7d3 transparent;
}
.sidebar-col::-webkit-scrollbar { width: 6px; }
.sidebar-col::-webkit-scrollbar-thumb { background: #d8d7d3; border-radius: 10px; }
.sidebar { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-panel); border: 1px solid var(--line); padding: 22px; }

.history-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; flex-wrap: wrap; gap: 10px; }
.history-header h3 { font-size: 15.5px; }
.history-header .meta { font-size: 11.5px; color: var(--ink-faint); font-family: var(--mono); }
.clear-btn {
    padding: 7px 14px; background: var(--surface); color: var(--ink-soft);
    border: 1.5px solid var(--line); border-radius: var(--radius-sm);
    cursor: pointer; font-size: 13px; font-weight: 700; font-family: inherit;
    transition: all .15s ease;
}
.clear-btn:hover { border-color: var(--error); color: var(--error); }
.clear-btn:disabled { opacity: .45; cursor: not-allowed; }

.history-item { border: 1px solid var(--line); border-radius: var(--radius-md); margin: 8px 0; background: var(--surface-muted); overflow: hidden; }
.history-item-header { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; cursor: pointer; user-select: none; }
.history-item-header:hover { background: var(--accent-soft); }
.history-item .title { font-weight: 700; font-size: 14px; color: var(--ink); }
.history-item .date { font-size: 11px; color: var(--ink-faint); margin-top: 2px; font-family: var(--mono); }
.history-item-chevron { font-size: 12px; color: var(--ink-faint); transition: transform .2s; flex-shrink: 0; margin-left: 8px; }
.history-item.open .history-item-chevron { transform: rotate(180deg); }
.history-item-body { max-height: 0; overflow: hidden; transition: max-height .25s ease; }
.history-item.open .history-item-body { max-height: 500px; }
.history-item-body-inner { padding: 0 14px 14px; }
.empty-history { color: var(--ink-faint); text-align: center; padding: 24px 10px; font-size: 13.5px; }
.history-item .variants { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.variant-label { font-size: 11px; color: var(--ink-faint); font-weight: 700; margin-bottom: 4px; text-transform: uppercase; letter-spacing: .4px; font-family: var(--mono); }

/* ---------- reviews ---------- */
.reviews-header { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.reviews-header h3 { font-size: 15.5px; }
.reviews-rating { font-size: 12.5px; color: var(--ink-faint); font-family: var(--mono); }
.reviews-rating b { color: var(--gold); }
.review-item { border: 1px solid var(--line); border-radius: var(--radius-md); padding: 12px 14px; margin: 10px 0; background: var(--surface-muted); }
.review-item.user-review { border-color: var(--accent); background: var(--accent-soft); }
.review-item .review-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; gap: 8px; }
.review-item .review-name { font-weight: 700; font-size: 13px; color: var(--ink); }
.review-item .review-name .review-mine { color: var(--accent-dark); font-weight: 600; font-size: 11px; }
.review-item .review-stars { font-size: 12px; color: var(--gold); letter-spacing: 1px; }
.review-item .review-text { font-size: 13px; color: var(--ink-soft); line-height: 1.5; }
.write-review-btn {
    width: 100%; padding: 11px; background: var(--surface);
    border: 1.5px dashed var(--line); color: var(--ink-soft);
    border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; font-weight: 700;
    font-family: inherit; margin-top: 10px; transition: all .15s ease;
}
.write-review-btn:hover { border-color: var(--accent); color: var(--accent-dark); }

.review-form { display: none; margin-top: 10px; border: 1px solid var(--line); border-radius: var(--radius-md); padding: 14px; background: var(--surface-muted); }
.review-form.open { display: block; }
.review-form .stars-pick { display: flex; gap: 4px; margin-bottom: 10px; }
.review-form .star-btn { font-size: 22px; cursor: pointer; color: #d8d7d3; background: none; border: none; padding: 0; line-height: 1; transition: color .1s; }
.review-form .star-btn.active { color: var(--gold); }
.review-form input, .review-form textarea { margin-bottom: 8px; font-size: 13px; }
.review-form textarea { min-height: 80px; }
.review-form .submit-review-btn {
    width: 100%; padding: 10px; background: var(--ink); color: #fff; border: none;
    border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; font-weight: 700; font-family: inherit;
}
.review-form .submit-review-btn:hover { background: #000; }
.review-thanks { display: none; text-align: center; padding: 12px; color: var(--ok); font-size: 13px; font-weight: 700; }

/* ---------- custom audio player ----------
   Панель управления, а не "кружочки": прямоугольные кнопки с
   небольшим радиусом, тонкая дорожка перемотки. */
.mp-player {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
}
.mp-toggle {
    flex-shrink: 0;
    width: 34px; height: 34px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--ink);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: background .15s ease;
}
.mp-toggle:hover { background: var(--accent-dark); }
.mp-toggle svg { width: 13px; height: 13px; }
.mp-toggle .mp-icon-pause { display: none; }
.mp-player.playing .mp-icon-play { display: none; }
.mp-player.playing .mp-icon-pause { display: block; }
.mp-player.playing .mp-toggle { background: var(--accent); }

.mp-body { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.mp-time { font-size: 11px; font-variant-numeric: tabular-nums; color: var(--ink-faint); font-weight: 700; width: 30px; flex-shrink: 0; font-family: var(--mono); }
.mp-time.mp-current { text-align: right; }

.mp-seek {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 3px;
    border-radius: 2px;
    background: linear-gradient(to right, var(--accent) 0%, var(--accent) var(--mp-progress, 0%), var(--line) var(--mp-progress, 0%), var(--line) 100%);
    outline: none;
    cursor: pointer;
}
.mp-seek::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 3px; height: 13px;
    border-radius: 1px;
    background: var(--ink);
    cursor: pointer;
}
.mp-seek::-moz-range-thumb {
    width: 3px; height: 13px; border: none; border-radius: 1px;
    background: var(--ink); cursor: pointer;
}
.mp-seek::-moz-range-progress { background: var(--accent); height: 3px; border-radius: 2px; }

.mp-download {
    flex-shrink: 0;
    width: 30px; height: 30px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--line);
    background: var(--surface);
    color: var(--ink-soft);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: all .15s ease;
}
.mp-download:hover { border-color: var(--accent); color: var(--accent-dark); }
.mp-download svg { width: 13px; height: 13px; }
.mp-download.downloading { pointer-events: none; opacity: .6; }

@media (max-width: 480px) {
    .mp-time { width: 26px; font-size: 10.5px; }
}

/* ---------- footer ---------- */
.site-footer {
    margin-top: 20px;
    background: var(--bg-panel);
    border-radius: var(--radius-lg);
    padding: 36px 30px 26px;
    color: rgba(255,255,255,0.9);
    border: 1px solid rgba(255,255,255,0.06);
}
.footer-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; margin-bottom: 28px; }
.footer-cols h4 { font-size: 12px; font-weight: 800; color: rgba(255,255,255,0.55); margin-bottom: 12px; letter-spacing: 0.5px; text-transform: uppercase; }
.footer-cols ul { list-style: none; }
.footer-cols ul li { margin-bottom: 7px; }
.footer-cols a { color: rgba(255,255,255,0.68); text-decoration: none; font-size: 13.5px; transition: color .15s ease; }
.footer-cols a:hover { color: white; }

.payments-block {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 16px;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 22px;
}
.payments-block .label { font-size: 12.5px; color: rgba(255,255,255,0.5); font-weight: 600; letter-spacing: 0.3px; }
.payment-logos { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.payment-logo {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 14px;
    background: rgba(255,255,255,0.96);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255,255,255,0.1);
}
.payment-logo svg { height: 20px; width: auto; display: block; flex-shrink: 0; }
.payment-label { font-size: 11px; font-weight: 800; color: var(--ink-soft); letter-spacing: 0.4px; }
.copyright { text-align: center; margin-top: 22px; font-size: 12px; color: rgba(255,255,255,0.32); font-family: var(--mono); }

/* ---------- examples ---------- */
.examples-block { max-width: var(--container-w); margin: 20px auto 0; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-panel); border: 1px solid var(--line); padding: 26px; }
.examples-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 18px; flex-wrap: wrap; gap: 10px; }
.examples-header h3 { font-size: 17px; }
.examples-header .meta { font-size: 12px; color: var(--ink-faint); }
.examples-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.demo-card { border: 1px solid var(--line); border-radius: var(--radius-md); padding: 14px; background: var(--surface-muted); }
.demo-card-title { font-weight: 700; font-size: 13.5px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.demo-card-meta { font-size: 11.5px; color: var(--ink-faint); margin-bottom: 10px; }
.examples-footnote { text-align: center; margin-top: 16px; font-size: 12px; color: var(--ink-faint); }

/* ---------- FAQ ---------- */
.faq-block { max-width: var(--container-w); margin: 20px auto 0; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-panel); border: 1px solid var(--line); padding: 26px 28px 28px; }
.faq-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 18px; flex-wrap: wrap; gap: 10px; }
.faq-header h3 { font-size: 18px; }
.faq-header .meta { font-size: 12px; color: var(--ink-faint); }
.faq-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-content: start; }
.faq-item { border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; transition: border-color .15s ease; align-self: start; }
.faq-item:hover { border-color: var(--ink-faint); }
.faq-question { display: flex; align-items: center; padding: 14px 16px; cursor: pointer; user-select: none; font-weight: 700; font-size: 13.5px; color: var(--ink); background: var(--surface-muted); transition: background .15s ease; gap: 12px; }
.faq-question:hover { background: var(--accent-soft); }
.faq-question span.faq-q-text { flex: 1; }
.faq-arrow { font-size: 11px; color: var(--ink-faint); transition: transform .25s ease; flex-shrink: 0; font-family: var(--mono); }
.faq-item.open .faq-arrow { transform: rotate(45deg); }
.faq-answer { max-height: 0; overflow: hidden; transition: max-height .3s ease, padding .3s ease; padding: 0 16px; font-size: 13.5px; color: var(--ink-soft); line-height: 1.6; }
.faq-item.open .faq-answer { max-height: 320px; padding: 4px 16px 16px; }
.faq-answer strong { color: var(--ink); }
.faq-footer { grid-column: 1 / -1; text-align: center; margin-top: 6px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-faint); }
.faq-footer a { color: var(--accent-dark); text-decoration: none; font-weight: 700; border-bottom: 1px dashed var(--accent-dark); }
.faq-footer a:hover { opacity: .8; }

.examples-block:target { border-color: var(--accent); }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
    .layout { grid-template-columns: 1fr; }
    .sidebar-col { position: static; max-height: none; order: 2; }
    .container { order: 1; }
    .footer-cols { grid-template-columns: 1fr 1fr; gap: 20px; }
    .faq-list { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
    .page { padding: 10px; }
    .container, .sidebar, .site-header, .examples-block, .faq-block { padding: 16px; }
    .site-footer { padding: 22px 16px 18px; }
    .vocal-group { flex-direction: column; }
    .payments-block { flex-direction: column; align-items: flex-start; }
    .footer-cols { grid-template-columns: 1fr; gap: 16px; }
    .payment-logo { padding: 6px 10px; }
    .payment-logo svg { height: 18px; }
    h1 { font-size: 20px; }
    .tags-container { gap: 8px; }
    .genre-btn, .tag-btn { padding: 10px 14px; font-size: 13px; min-height: 40px; display: flex; align-items: center; justify-content: center; }
    .show-more-btn { font-size: 14px; padding: 8px 0; }
}