:root {
    --bg: #100f22;
    --panel-bg: rgba(255,255,255,0.05);
    --violet-1: #6a5cf5;
    --violet-2: #392fb0;
    --amber: #ffb648;
    --text: #f1efff;
    --muted: #8d8aac;
    --border: #322f6b;
    --danger: #ff6b6b;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    background-image:
        radial-gradient(circle at 15% 10%, rgba(106,92,245,0.18) 0%, transparent 45%),
        radial-gradient(circle at 85% 90%, rgba(255,182,72,0.08) 0%, transparent 40%);
    font-family: 'Inter', Arial, sans-serif;
    color: var(--text);
}

header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 28px 20px 6px;
    letter-spacing: 1px;
}

.logo-mark {
    color: var(--amber);
    display: inline-flex;
    transform: translateY(1px);
}

header h1 {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 26px;
    margin: 0;
}

header h1 .accent { color: var(--amber); }

.tagline {
    width: 100%;
    text-align: center;
    margin: 2px 0 0;
    font-size: 12px;
    color: var(--muted);
    letter-spacing: 3px;
    text-transform: uppercase;
}

.container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px 16px;
}

.panel-wrapper { position: relative; }

.panel-wrapper::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 760px;
    height: 540px;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(120, 90, 255, 0.45) 0%, rgba(120, 90, 255, 0) 70%);
    filter: blur(40px);
    z-index: -1;
}

.panel {
    width: 360px;
    max-width: 90vw;
    padding: 22px;
    border-radius: 20px;
    border: 1px solid transparent;
    background:
        linear-gradient(var(--panel-bg), var(--panel-bg)) padding-box,
        linear-gradient(135deg, #2e2e67, #37357c) border-box;
    backdrop-filter: blur(14px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* Readout / status strip */
.readout {
    border: 1px solid var(--border);
    background: rgba(0,0,0,0.25);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 18px;
}

.readout-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--muted);
    flex-shrink: 0;
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

.dot.live {
    background: var(--amber);
    box-shadow: 0 0 8px 2px rgba(255,182,72,0.6);
}

.dot.error { background: var(--danger); box-shadow: 0 0 8px 2px rgba(255,107,107,0.5); }

#ptext {
    margin: 0;
    font-family: 'Space Grotesk', monospace;
    font-size: 13.5px;
    color: var(--text);
    white-space: pre-wrap;
    word-break: break-word;
    flex: 1;
    min-height: 1.2em;
}

.eq {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 18px;
    margin-top: 10px;
    opacity: 0.25;
    transition: opacity 0.3s ease;
}

.eq.active { opacity: 1; }

.eq span {
    width: 4px;
    border-radius: 2px;
    background: linear-gradient(180deg, var(--amber), var(--violet-1));
    height: 4px;
}

.eq.active span {
    animation: bounce 0.9s ease-in-out infinite;
}
.eq.active span:nth-child(1) { animation-delay: 0s; }
.eq.active span:nth-child(2) { animation-delay: 0.12s; }
.eq.active span:nth-child(3) { animation-delay: 0.24s; }
.eq.active span:nth-child(4) { animation-delay: 0.08s; }
.eq.active span:nth-child(5) { animation-delay: 0.2s; }

@keyframes bounce {
    0%, 100% { height: 4px; }
    50% { height: 18px; }
}

@media (prefers-reduced-motion: reduce) {
    .eq.active span { animation: none; height: 10px; }
}

/* Buttons */
.btn-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 10px;
}

.tune-btn, .stop-btn, .own-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    background: linear-gradient(135deg, var(--violet-1), var(--violet-2));
    border-radius: 10px;
    min-height: 50px;
    box-shadow: 0 10px 25px rgba(88, 88, 245, 0.3);
    border: none;
    cursor: pointer;
    color: white;
    font-family: inherit;
    font-weight: 700;
    font-size: 14px;
    padding: 0 16px;
    text-align: left;
    transition: box-shadow 0.2s ease, transform 0.05s ease, background 0.2s ease;
}

.btn-ico { font-size: 12px; opacity: 0.85; flex-shrink: 0; }

.btn-label {
    display: flex;
    flex-direction: column;
    gap: 1px;
    line-height: 1.25;
}

.btn-label small {
    font-weight: 500;
    font-size: 11px;
    color: rgba(255,255,255,0.65);
    letter-spacing: 0.2px;
}

.tune-btn:hover, .own-btn:hover {
    box-shadow: 0 0 36px rgba(88, 88, 245, 0.55);
}

.tune-btn:active, .own-btn:active, .stop-btn:active {
    transform: scale(0.98);
}

.tune-btn:disabled {
    background: #4c4a63;
    box-shadow: none;
    cursor: not-allowed;
}

.tune-btn.is-active {
    background: linear-gradient(135deg, var(--amber), #d98f1f);
    box-shadow: 0 10px 28px rgba(255, 182, 72, 0.35);
}
.tune-btn.is-active .btn-label small { color: rgba(40,25,0,0.65); }

.stop-btn {
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border);
    justify-content: center;
    box-shadow: none;
    margin-bottom: 4px;
}
.stop-btn:not(:disabled):hover {
    border-color: var(--danger);
    color: var(--danger);
}
.stop-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 16px 0 12px;
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.divider::before, .divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}

.own-row {
    display: flex;
    gap: 8px;
}

.inp-url {
    flex: 1;
    min-width: 0;
    background-color: rgba(255,255,255,0.05);
    border-radius: 10px;
    height: 48px;
    border: 1px solid var(--border);
    box-sizing: border-box;
    text-align: left;
    padding: 0 14px;
    color: var(--text);
    font-family: inherit;
    font-size: 13.5px;
}
.inp-url:focus, button:focus-visible {
    outline: 2px solid var(--amber);
    outline-offset: 2px;
}
.inp-url::placeholder { color: #6e6c8a; }

.own-row .own-btn {
    width: 48px;
    flex-shrink: 0;
    justify-content: center;
    padding: 0;
}

footer {
    text-align: center;
    padding: 14px;
    color: rgba(255, 255, 255, 0.35);
    font-size: 12px;
}

@media (max-width: 420px) {
    .panel { width: 100%; padding: 18px; }
    header h1 { font-size: 22px; }
}
