:root {
    --grr-gold: #d6a84f;
    --grr-gold-2: #f3d28a;
    --grr-amber: #a86f21;
    --grr-black: #0d0b08;
    --grr-black-2: #15120d;
    --grr-panel: rgba(255, 255, 255, 0.08);
    --grr-panel-strong: rgba(255, 255, 255, 0.13);
    --grr-border: rgba(255, 255, 255, 0.16);
    --grr-text: #f7efe1;
    --grr-muted: rgba(247, 239, 225, 0.68);
    --grr-muted-strong: rgba(247, 239, 225, 0.82);
    --grr-danger: #ff6b5f;
    --grr-warning: #ffd166;
    --grr-success: #58d68d;
    --grr-blue: #7bb7ff;
    --grr-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 10px;
    --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: light) {
    :root {
        --grr-black: #f8f2e8;
        --grr-black-2: #fffaf1;
        --grr-panel: rgba(255, 255, 255, 0.74);
        --grr-panel-strong: rgba(255, 255, 255, 0.92);
        --grr-border: rgba(80, 52, 14, 0.16);
        --grr-text: #1c160e;
        --grr-muted: rgba(28, 22, 14, 0.64);
        --grr-muted-strong: rgba(28, 22, 14, 0.82);
        --grr-shadow: 0 24px 80px rgba(80, 52, 14, 0.18);
    }
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    min-height: 100%;
    font-family: var(--font);
    color: var(--grr-text);
    background:
        radial-gradient(circle at top left, rgba(214, 168, 79, 0.24), transparent 34rem),
        radial-gradient(circle at 80% 10%, rgba(123, 183, 255, 0.12), transparent 28rem),
        linear-gradient(135deg, var(--grr-black), var(--grr-black-2));
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    display: flex;
    flex-direction: column;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image: linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.8), transparent 75%);
}

body > main {
    width: 100%;
    flex: 1;
}

a {
    color: var(--grr-gold-2);
    text-decoration: none;
}

a:hover {
    color: #fff2c7;
    text-decoration: underline;
}

code {
    color: var(--grr-gold-2);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.95em;
}

h1, h2, h3, h4, h5 {
    margin: 0;
    color: var(--grr-text);
    line-height: 1.15;
}

h1, h2 {
    letter-spacing: -0.04em;
}

p {
    margin: 0;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    border-bottom: 1px solid var(--grr-border);
    background: rgba(13, 11, 8, 0.72);
    backdrop-filter: blur(22px);
}

@media (prefers-color-scheme: light) {
    .site-header {
        background: rgba(255, 250, 241, 0.78);
    }
}

.main-nav, #main-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    width: min(1120px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 0.85rem 0;
}

.brand, #main-nav a#branding {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    color: var(--grr-text);
    text-decoration: none;
}

.brand-symbol {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 1px solid rgba(243, 210, 138, 0.55);
    border-radius: 16px;
    background: linear-gradient(145deg, rgba(214, 168, 79, 0.28), rgba(214, 168, 79, 0.05));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24), 0 12px 34px rgba(214, 168, 79, 0.16);
    color: var(--grr-gold-2);
    font-size: 1.35rem;
    font-weight: 800;
}

#main-nav a#branding > img {
    width: 38px;
    height: 38px;
    border-radius: 12px;
}

.brand-name {
    display: block;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.brand-tagline {
    display: block;
    color: var(--grr-muted);
    font-size: 0.78rem;
    letter-spacing: 0.02em;
}

#main-nav h1 {
    margin: 0;
    color: var(--grr-text);
    font: 800 1rem var(--font);
    letter-spacing: -0.02em;
}

.nav-links, #main-nav > ul, nav > ul, div.nav ul, ul.boxnav, ul.playlists {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-links {
    gap: 0.35rem;
}

.nav-links a, #main-nav > ul > li > a, nav > ul > li > a, div.nav ul > li > a, ul.boxnav > li > a, ul.boxnav > li input[type='submit'], ul.playlists > li > a, td.actions > a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0.55rem 0.85rem;
    border: 1px solid transparent;
    border-radius: 999px;
    color: var(--grr-muted-strong);
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.nav-links a:hover, #main-nav > ul > li > a:hover, nav > ul > li > a:hover, div.nav ul > li > a:hover, ul.boxnav > li > a:hover, ul.boxnav > li input[type='submit']:hover, ul.playlists > li > a:hover, td.actions > a:hover {
    color: var(--grr-text);
    border-color: var(--grr-border);
    background: var(--grr-panel);
    transform: translateY(-1px);
    text-decoration: none;
}

.nav-links .right, #main-nav > ul > li.right, nav > ul > li.right {
    margin-left: auto;
}

.page-shell {
    position: relative;
    z-index: 1;
    width: min(1120px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 2rem 0 3rem;
}

.hero-card {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1.25rem;
    padding: clamp(1.25rem, 3vw, 2rem);
    border: 1px solid var(--grr-border);
    border-radius: var(--radius-xl);
    background:
        linear-gradient(135deg, rgba(214, 168, 79, 0.18), rgba(123, 183, 255, 0.08)),
        var(--grr-panel);
    box-shadow: var(--grr-shadow);
    overflow: hidden;
}

.hero-card::after {
    content: "";
    position: absolute;
    right: -5rem;
    top: -5rem;
    width: 18rem;
    height: 18rem;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(243, 210, 138, 0.24), transparent 68%);
    pointer-events: none;
}

.hero-card.compact {
    display: block;
}

.hero-card h2 {
    max-width: 760px;
    margin-top: 0.35rem;
    font-size: clamp(2rem, 5vw, 4.25rem);
}

.hero-copy {
    max-width: 680px;
    margin-top: 0.75rem;
    color: var(--grr-muted-strong);
    font-size: 1.05rem;
}

.eyebrow {
    margin: 0 0 0.45rem;
    color: var(--grr-gold-2);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.hero-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(120px, 1fr));
    gap: 0.8rem;
    min-width: 280px;
}

.hero-metrics div, .detail-card, section.box, .auth-card, .playlist-card {
    border: 1px solid var(--grr-border);
    border-radius: var(--radius-lg);
    background: var(--grr-panel);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.hero-metrics div {
    display: grid;
    align-content: center;
    justify-items: start;
    padding: 1rem;
}

.hero-metrics strong {
    color: var(--grr-gold-2);
    font-size: 2rem;
    line-height: 1;
}

.hero-metrics span {
    color: var(--grr-muted);
    font-weight: 700;
}

.box {
    margin-bottom: 1.25rem;
    padding: clamp(1rem, 2.5vw, 1.35rem);
    border: 1px solid var(--grr-border);
    border-radius: var(--radius-xl);
    background: var(--grr-panel);
    box-shadow: var(--grr-shadow);
}

.stream-card {
    position: relative;
    overflow: hidden;
}

.stream-card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(214, 168, 79, 0.16), transparent 44%);
    pointer-events: none;
}

.stream-card > * {
    position: relative;
}

.card-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.box_title {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--grr-border);
    font-size: 1.1rem;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.75rem;
    border: 1px solid rgba(88, 214, 141, 0.35);
    border-radius: 999px;
    background: rgba(88, 214, 141, 0.12);
    color: var(--grr-success);
    font-size: 0.8rem;
    font-weight: 800;
    white-space: nowrap;
}

.status-pill.offline {
    border-color: rgba(255, 107, 95, 0.35);
    background: rgba(255, 107, 95, 0.12);
    color: var(--grr-danger);
}

.stream-player {
    display: grid;
    gap: 0.85rem;
    margin-bottom: 1rem;
    padding: 1rem;
    border: 1px solid var(--grr-border);
    border-radius: var(--radius-lg);
    background: var(--grr-panel-strong);
}

.stream-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.pill-link, .submit-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0.7rem 1rem;
    border: 1px solid rgba(214, 168, 79, 0.45);
    border-radius: 999px;
    background: rgba(214, 168, 79, 0.14);
    color: var(--grr-gold-2);
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.pill-link.primary {
    background: linear-gradient(135deg, var(--grr-gold), var(--grr-amber));
    color: #140f08;
    box-shadow: 0 14px 34px rgba(214, 168, 79, 0.22);
}

.pill-link:hover, .submit-button:hover {
    transform: translateY(-1px);
    border-color: rgba(243, 210, 138, 0.9);
    text-decoration: none;
}

.player-label {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--grr-muted-strong);
    font-weight: 800;
}

.live-dot {
    width: 0.65rem;
    height: 0.65rem;
    border-radius: 999px;
    background: var(--grr-danger);
    box-shadow: 0 0 0 0 rgba(255, 107, 95, 0.7);
    animation: pulse 1.6s infinite;
}

@keyframes pulse {
    70% {
        box-shadow: 0 0 0 10px rgba(255, 107, 95, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 107, 95, 0);
    }
}

audio {
    width: 100%;
}

.now-playing {
    margin-bottom: 1rem;
    padding: 1rem;
    border: 1px solid rgba(214, 168, 79, 0.26);
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, rgba(214, 168, 79, 0.16), rgba(255, 255, 255, 0.04));
}

.now-playing span {
    display: block;
    color: var(--grr-muted);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.now-playing strong {
    display: block;
    margin-top: 0.3rem;
    font-size: 1.25rem;
}

.now-playing strong.is-updated, .playlist-titles li.is-updated {
    animation: titleFlash 900ms ease;
}

@keyframes titleFlash {
    0% {
        color: var(--grr-gold-2);
    }
    100% {
        color: var(--grr-text);
    }
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.8rem;
}

.detail-card {
    display: grid;
    gap: 0.3rem;
    padding: 1rem;
}

.detail-card span {
    color: var(--grr-muted);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.detail-card strong {
    overflow-wrap: anywhere;
    color: var(--grr-text);
    font-size: 1rem;
}

.detail-card-wide {
    grid-column: span 2;
}

.playlist-card {
    margin-top: 1rem;
    padding: 1rem;
}

.playlist-card h4 {
    margin-bottom: 0.85rem;
}

.playlist-titles {
    display: grid;
    gap: 0.55rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.playlist-titles li {
    padding: 0.85rem 1rem;
    border: 1px solid var(--grr-border);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.045);
    overflow-wrap: anywhere;
}

.playlist-container {
    overflow-x: auto;
}

.table-keys, .table-block, .table-flipscroll {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
}

.table-keys tr, .table-block tr, .table-flipscroll tr {
    border-bottom: 1px solid var(--grr-border);
}

.table-keys tr:last-child, .table-block tr:last-child, .table-flipscroll tr:last-child {
    border-bottom: 0;
}

.table-keys tr:hover, .table-block tbody tr:hover, .table-flipscroll tbody tr:hover {
    background: rgba(255, 255, 255, 0.06);
}

.table-keys tr > *, .table-block th, .table-block td, .table-flipscroll th, .table-flipscroll td {
    padding: 0.75rem 0.85rem;
    text-align: left;
    vertical-align: top;
}

.table-keys tr > *:first-child {
    width: 34%;
    color: var(--grr-muted-strong);
    font-weight: 800;
}

.table-block thead, .table-flipscroll thead {
    color: var(--grr-gold-2);
    font-size: 0.82rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.bartable td:last-child {
    width: min-content;
    white-space: nowrap;
}

meter {
    width: 100%;
    min-width: 120px;
}

.help {
    float: right;
}

.help a, .references a {
    color: var(--grr-gold-2);
}

.side-by-side {
    display: flex;
    gap: 1rem;
    width: 100%;
}

.side-by-side > * {
    flex: 1;
}

.section {
    display: grid;
    gap: 1rem;
}

.trafficlight {
    width: 4.5rem;
    height: 4.5rem;
    border: 1px solid var(--grr-border);
    border-radius: 999px;
}

.colour-red, .maintenance-level-error {
    background: var(--grr-danger);
}

.colour-yellow, .maintenance-level-warning {
    background: var(--grr-warning);
}

.colour-green, .maintenance-level-info, .maintenance-level-todo {
    background: var(--grr-success);
}

.maintenance-container, .references {
    list-style: none;
    padding: 0;
}

.maintenance-container li {
    margin-bottom: 0.75rem;
    padding: 0.85rem;
    border-left: 4px solid var(--grr-gold);
    border-radius: var(--radius-md);
    background: var(--grr-panel);
}

.maintenance-level-error {
    border-left-color: var(--grr-danger);
}

.maintenance-level-warning {
    border-left-color: var(--grr-warning);
}

.maintenance-level-info, .maintenance-level-todo {
    border-left-color: var(--grr-blue);
}

.references {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.references > li {
    display: inline;
}

.boxnav {
    flex-wrap: wrap;
    gap: 0.55rem;
    margin-bottom: 1rem;
}

ul.boxnav > li.critical > a, a.critical, input[type='submit'].critical, td.actions > a.critical {
    border-color: rgba(255, 107, 95, 0.45);
    background: rgba(255, 107, 95, 0.14);
    color: var(--grr-danger);
}

ul.boxnav > li.disabled > a, a.disabled, input[type='submit'].disabled {
    border-color: var(--grr-border);
    background: rgba(128, 128, 128, 0.12);
    color: var(--grr-muted);
    cursor: not-allowed;
}

td.actions {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 8rem;
}

td.actions > a {
    min-height: 34px;
    padding: 0.45rem 0.65rem;
}

ul.playlists {
    float: right;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.audioplayer {
    margin-top: 0.75rem;
}

.alignedform {
    display: grid;
    gap: 0.8rem;
}

.form-grid {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 0.75rem 1rem;
    align-items: center;
}

label {
    color: var(--grr-muted-strong);
    font-weight: 800;
}

input[type='text'], input[type='password'] {
    width: 100%;
    min-height: 44px;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--grr-border);
    border-radius: var(--radius-md);
    background: rgba(0, 0, 0, 0.22);
    color: var(--grr-text);
    font: inherit;
    outline: none;
}

@media (prefers-color-scheme: light) {
    input[type='text'], input[type='password'] {
        background: rgba(255, 255, 255, 0.72);
    }
}

input[type='text']:focus, input[type='password']:focus {
    border-color: rgba(214, 168, 79, 0.8);
    box-shadow: 0 0 0 4px rgba(214, 168, 79, 0.14);
}

.submit-button {
    width: fit-content;
    border: 0;
}

.roundbox {
    padding: 1rem;
    border: 1px solid var(--grr-border);
    border-radius: var(--radius-xl);
    background: var(--grr-panel);
}

.roundbox h3, .auth-card h3 {
    margin-bottom: 1rem;
}

.info, .warning, .error {
    margin: 1rem 0;
    padding: 1rem 1.25rem;
    border: 1px solid var(--grr-border);
    border-radius: var(--radius-lg);
}

.info {
    background: rgba(123, 183, 255, 0.12);
}

.warning {
    background: rgba(255, 209, 102, 0.13);
}

.error {
    background: rgba(255, 107, 95, 0.13);
}

.info strong, .warning strong, .error strong {
    display: block;
    margin-bottom: 0.25rem;
}

.empty-state {
    margin-top: 1rem;
}

.site-footer, .footer {
    width: 100%;
    padding: 1.25rem;
    border-top: 1px solid var(--grr-border);
    background: rgba(0, 0, 0, 0.24);
    color: var(--grr-muted);
    text-align: center;
}

.site-footer p, .footer p {
    margin: 0;
}

.site-footer a, .footer a {
    color: var(--grr-gold-2);
}

@media (max-width: 860px) {
    .main-nav, #main-nav {
        align-items: flex-start;
        flex-direction: column;
    }

    .nav-links, #main-nav > ul {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 0.2rem;
    }

    .hero-card {
        flex-direction: column;
    }

    .hero-metrics, .details-grid {
        grid-template-columns: 1fr;
    }

    .detail-card-wide {
        grid-column: auto;
    }

    .side-by-side {
        flex-direction: column;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .page-shell, .main-nav, #main-nav {
        width: min(100% - 1rem, 1120px);
    }

    .box, .hero-card {
        border-radius: 20px;
    }

    .card-heading {
        flex-direction: column;
    }

    .stream-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .pill-link {
        width: 100%;
    }
}
