/* ==========================================================================
   R0W.net - tokens
   ========================================================================== */
:root {
    --bg: #0B0F1A;
    --panel: #141B2E;
    --panel-alt: #1B2540;
    --blue: #00A2FF;
    --blue-soft: #5FC4FF;
    --text: #EDEAE3;
    --muted: #8B96A8;
    --danger: #E2685C;
    --border: #263151;

    --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
    --font-sans: 'Work Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.55;
}

a { color: var(--blue-soft); }
a:hover { color: var(--blue); text-decoration: none; }

:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}

.wrap {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 24px;
}
.wrap--narrow { max-width: 620px; }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
    border-bottom: 1px solid var(--border);
    padding: 20px 0;
}
.site-header__inner,
.admin-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.wordmark {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 1.4rem;
    color: var(--text);
    text-decoration: none;
    letter-spacing: 0.02em;
}
.wordmark__dot { color: var(--blue); }

.site-nav {
    display: flex;
    align-items: center;
    gap: 24px;
    font-size: 0.95rem;
}
.site-nav a { color: var(--muted); text-decoration: none; }
.site-nav a:hover { color: var(--text); }
.site-nav__cta {
    color: var(--bg) !important;
    background: var(--blue);
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: 500;
}
.site-nav__cta:hover { background: var(--text); }

/* ==========================================================================
   Hero + dial
   ========================================================================== */
.hero { padding: 64px 0 48px; }

.hero__freq {
    font-family: var(--font-mono);
    color: var(--blue);
    font-size: 0.95rem;
    letter-spacing: 0.08em;
    margin: 0 0 12px;
}

.hero__title {
    font-family: var(--font-mono);
    font-size: clamp(1.9rem, 4vw, 3rem);
    line-height: 1.15;
    max-width: 14ch;
    margin: 0 0 20px;
}

.hero__subtitle {
    color: var(--muted);
    font-size: 1.1rem;
    max-width: 52ch;
    margin: 0 0 40px;
}

.dial {
    position: relative;
    height: 64px;
    margin: 0 0 40px;
    max-width: 620px;
}
.dial__track {
    position: relative;
    height: 2px;
    background: var(--border);
    margin-top: 40px;
}
.dial__tick {
    position: absolute;
    top: -28px;
    transform: translateX(-50%);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--muted);
}
.dial__tick::after {
    content: '';
    position: absolute;
    top: 26px;
    left: 50%;
    width: 1px;
    height: 8px;
    background: var(--border);
}
.dial__needle {
    position: absolute;
    top: -6px;
    left: 8%;
    width: 2px;
    height: 14px;
    background: var(--blue);
    box-shadow: 0 0 8px var(--blue);
    animation: dial-sweep 1.8s ease-out 1;
}
@keyframes dial-sweep {
    from { left: 0%; opacity: 0; }
    to { left: 8%; opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
    .dial__needle { animation: none; }
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: 4px;
    padding: 12px 22px;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    background: transparent;
}
.button--primary { background: var(--blue); color: var(--bg); }
.button--primary:hover { background: #f2b155; color: var(--bg); }
.button--ghost { border-color: var(--border); color: var(--text); }
.button--ghost:hover { border-color: var(--muted); color: var(--text); }
.button--danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.button--danger:hover { background: var(--danger); color: var(--bg); }
.button--small { padding: 6px 12px; font-size: 0.85rem; }

/* ==========================================================================
   Stations / presets
   ========================================================================== */
.stations { padding: 0 0 80px; }
.stations__heading {
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 1.1rem;
    color: var(--muted);
    margin: 0 0 24px;
}

.preset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}

.preset {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-left: 3px solid var(--border);
    border-radius: 4px;
    padding: 14px;
    transition: border-left-color 0.2s ease;
}
.preset.is-playing { border-left-color: var(--blue); }

.preset__logo {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    background: var(--panel-alt);
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.preset__logo img { width: 100%; height: 100%; object-fit: cover; }

.preset__body { flex: 1; min-width: 0; }
.preset__name {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: relative;
    padding-left: 0;
}
.preset.is-playing .preset__name { padding-left: 14px; }
.preset.is-playing .preset__name::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 6px var(--blue);
    animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}
@media (prefers-reduced-motion: reduce) {
    .preset.is-playing .preset__name::before { animation: none; }
}

.preset__play {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 6px 12px;
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    cursor: pointer;
}
.preset__play:hover { border-color: var(--blue); }
.preset__play-icon {
    width: 0;
    height: 0;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 8px solid var(--text);
}
.preset.is-playing .preset__play-icon {
    width: 8px;
    height: 10px;
    border: none;
    background:
        linear-gradient(to right, var(--blue) 3px, transparent 3px, transparent 5px, var(--blue) 5px);
}

.empty-state {
    color: var(--muted);
    padding: 32px 0;
}

/* ==========================================================================
   Forms
   ========================================================================== */
.form-section { padding: 56px 0 96px; }
.form-section h1 { font-family: var(--font-mono); font-size: 1.8rem; }

.form { display: flex; flex-direction: column; gap: 20px; margin-top: 24px; }
.form--card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 32px;
    max-width: 380px;
    margin: 80px auto;
}

.field { display: flex; flex-direction: column; gap: 8px; font-size: 0.95rem; }
.field span { color: var(--muted); }
.field input[type="text"],
.field input[type="url"],
.field input[type="email"],
.field input[type="password"],
.field input[type="file"] {
    background: var(--panel-alt);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 11px 14px;
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 0.95rem;
}
.field--radio { border: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.field--radio legend { color: var(--muted); padding: 0 0 4px; }
.field--radio label { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 400; }

.alert {
    list-style: none;
    margin: 0 0 8px;
    padding: 14px 16px;
    border-radius: 4px;
    font-size: 0.9rem;
}
.alert--error { background: rgba(226, 104, 92, 0.12); color: var(--danger); border: 1px solid var(--danger); }
.alert--success { background: rgba(0, 162, 255, 0.12); color: var(--blue-soft); border: 1px solid var(--blue); list-style: none; }

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 32px 0 64px;
    font-size: 0.9rem;
}
.site-footer p { margin: 0 0 6px; }

/* ==========================================================================
   Admin
   ========================================================================== */
.admin-body { background: var(--bg); color: var(--text); font-family: var(--font-sans); margin: 0; }
.admin-header { border-bottom: 1px solid var(--border); padding: 20px 0; margin-bottom: 32px; }
.admin-login { min-height: 100vh; display: flex; align-items: center; justify-content: center; }

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.admin-table th {
    text-align: left;
    color: var(--muted);
    font-weight: 500;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}
.admin-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.admin-table__name { display: flex; align-items: center; gap: 10px; }
.admin-table__logo { width: 32px; height: 32px; border-radius: 4px; object-fit: cover; background: var(--panel-alt); }
.admin-table__actions { display: flex; gap: 8px; white-space: nowrap; }
.row--hidden { opacity: 0.5; }

.tag {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    background: var(--panel-alt);
    border: 1px solid var(--border);
}
.tag--button { cursor: pointer; font-family: inherit; }
.tag--active { border-color: var(--blue); color: var(--blue); }
.tag--muted { color: var(--muted); }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 640px) {
    .dial__tick:nth-child(even) { display: none; }
    .admin-table { display: block; overflow-x: auto; }
    .form--card { margin: 40px 20px; padding: 24px; }
}