/* MD3 dark scheme, orange seed — same roles as the in-game menu (cs16client Settings::menuColors) */
:root {
    color-scheme: dark;

    --md-sys-color-primary: #FFB870;
    --md-sys-color-on-primary: #4A2800;
    --md-sys-color-primary-container: #693C00;
    --md-sys-color-on-primary-container: #FFDCBE;
    --md-sys-color-secondary: #E1C1A4;
    --md-sys-color-on-secondary: #402C19;
    --md-sys-color-secondary-container: #5A422D;
    --md-sys-color-on-secondary-container: #FFDCBE;
    --md-sys-color-tertiary: #C3CC99;
    --md-sys-color-on-tertiary: #2D3410;
    --md-sys-color-tertiary-container: #434B24;
    --md-sys-color-on-tertiary-container: #DFE8B3;
    --md-sys-color-error: #FFB4AB;
    --md-sys-color-on-error: #690005;
    --md-sys-color-error-container: #93000A;
    --md-sys-color-on-error-container: #FFDAD6;
    --md-sys-color-surface: #19120C;
    --md-sys-color-surface-container-lowest: #140D07;
    --md-sys-color-surface-container-low: #221A14;
    --md-sys-color-surface-container: #261E18;
    --md-sys-color-surface-container-high: #312822;
    --md-sys-color-surface-container-highest: #3C332C;
    --md-sys-color-on-surface: #EFE0D5;
    --md-sys-color-on-surface-variant: #D6C3B5;
    --md-sys-color-outline: #9F8D81;
    --md-sys-color-outline-variant: #51443A;
    --md-sys-color-inverse-surface: #EFE0D5;
    --md-sys-color-inverse-on-surface: #382F28;
    --md-sys-color-inverse-primary: #885200;

    --md-sys-shape-corner-extra-small: 4px;
    --md-sys-shape-corner-small: 8px;
    --md-sys-shape-corner-medium: 12px;
    --md-sys-shape-corner-large: 16px;
    --md-sys-shape-corner-extra-large: 28px;
    --md-sys-shape-corner-extra-large-increased: 32px;
    --md-sys-shape-corner-full: 9999px;

    --md-sys-motion-easing-standard: cubic-bezier(0.2, 0, 0, 1);
    --md-sys-motion-easing-emphasized-decelerate: cubic-bezier(0.05, 0.7, 0.1, 1);
    --md-sys-motion-easing-emphasized-accelerate: cubic-bezier(0.3, 0, 0.8, 0.15);

    --md-sys-state-hover: 0.08;
    --md-sys-state-pressed: 0.1;

    --elevation-1: 0 1px 2px rgba(0, 0, 0, .3), 0 1px 3px 1px rgba(0, 0, 0, .15);
    --elevation-3: 0 4px 8px 3px rgba(0, 0, 0, .15), 0 1px 3px rgba(0, 0, 0, .3);

    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-6: 24px;
    --space-8: 32px;
    --space-12: 48px;
    --space-16: 64px;

    --font: "Roboto Flex", Roboto, sans-serif;
    --content-max: 1200px;
    --reading-max: 760px;
    --article-max: 960px;
    --margin: 16px;
    --nav-bar-height: 80px;
}

@media (min-width: 600px) {
    :root { --margin: 24px; }
}

/* Typescale */
.display-large { font: 400 45px/52px var(--font); letter-spacing: -0.25px; }
.display-small { font: 400 36px/44px var(--font); }
.headline-large { font: 400 32px/40px var(--font); }
.headline-small { font: 400 24px/32px var(--font); }
.title-large { font: 400 22px/28px var(--font); }
.title-medium { font: 500 16px/24px var(--font); letter-spacing: 0.15px; }
.body-large { font: 400 16px/24px var(--font); letter-spacing: 0.5px; }
.body-medium { font: 400 14px/20px var(--font); letter-spacing: 0.25px; }
.body-small { font: 400 12px/16px var(--font); letter-spacing: 0.4px; }
.label-large { font: 500 14px/20px var(--font); letter-spacing: 0.1px; }
.label-medium { font: 500 12px/16px var(--font); letter-spacing: 0.5px; }

@media (min-width: 840px) {
    .display-large { font-size: 57px; line-height: 64px; }
    .display-small { font-size: 45px; line-height: 52px; }
}

/* Base */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

html, body { margin: 0; }

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
    font: 400 14px/20px var(--font);
    letter-spacing: 0.25px;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }

a { color: var(--md-sys-color-primary); }

img { display: block; max-width: 100%; }

.material-symbols-rounded {
    font-size: 24px;
    font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
    user-select: none;
}

.container {
    width: 100%;
    max-width: calc(var(--content-max) + 2 * var(--margin));
    margin: 0 auto;
    padding: 0 var(--margin);
}

.page { flex: 1; display: flex; flex-direction: column; }
.page > main { flex: 1; }

.muted { color: var(--md-sys-color-on-surface-variant); }

.clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.skip-link {
    position: absolute;
    left: var(--space-4);
    top: -48px;
    z-index: 30;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--md-sys-shape-corner-small);
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

.skip-link:focus { top: var(--space-2); }

:focus-visible {
    outline: 2px solid var(--md-sys-color-secondary);
    outline-offset: 2px;
}

/* Top app bar */
.top-app-bar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--md-sys-color-surface);
    transition: background-color 200ms var(--md-sys-motion-easing-standard);
}

.top-app-bar.scrolled { background: var(--md-sys-color-surface-container); }

.top-app-bar .container {
    height: 64px;
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    color: var(--md-sys-color-on-surface);
    text-decoration: none;
    white-space: nowrap;
}

.brand-accent { color: var(--md-sys-color-primary); font-weight: 600; }

.top-app-bar form { margin: 0; }

.top-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-left: auto;
}

/* Tabs in the top bar (expanded+) */
.nav-tabs {
    display: none;
    align-self: stretch;
    gap: var(--space-1);
    margin-left: var(--space-6);
}

.nav-tabs .nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 0 var(--space-4);
    color: var(--md-sys-color-on-surface-variant);
    text-decoration: none;
    font: 500 14px/20px var(--font);
    letter-spacing: 0.1px;
}

.nav-tabs .nav-indicator { display: contents; }
.nav-tabs .nav-indicator .material-symbols-rounded { font-size: 20px; }

.nav-tabs .nav-item::before {
    content: "";
    position: absolute;
    inset: 8px 0;
    border-radius: var(--md-sys-shape-corner-full);
    background: currentColor;
    opacity: 0;
    transition: opacity 150ms var(--md-sys-motion-easing-standard);
}

.nav-tabs .nav-item:hover::before { opacity: var(--md-sys-state-hover); }

.nav-tabs .nav-item.active { color: var(--md-sys-color-primary); }

.nav-tabs .nav-item.active::after {
    content: "";
    position: absolute;
    left: var(--space-4);
    right: var(--space-4);
    bottom: 0;
    height: 3px;
    border-radius: 3px 3px 0 0;
    background: var(--md-sys-color-primary);
}

.nav-tabs .nav-item.active .material-symbols-rounded { font-variation-settings: "FILL" 1; }

@media (min-width: 840px) {
    .nav-tabs { display: flex; }
}

/* Navigation bar (compact / medium) */
.nav-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    display: flex;
    height: var(--nav-bar-height);
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--md-sys-color-surface-container);
}

.nav-bar .nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
    color: var(--md-sys-color-on-surface-variant);
    text-decoration: none;
    font: 500 12px/16px var(--font);
    letter-spacing: 0.5px;
}

.nav-bar .nav-indicator {
    display: grid;
    place-items: center;
    width: 64px;
    height: 32px;
    border-radius: var(--md-sys-shape-corner-full);
    transition: background-color 200ms var(--md-sys-motion-easing-standard);
}

.nav-bar .nav-item:hover .nav-indicator {
    background: color-mix(in srgb, var(--md-sys-color-on-surface) 8%, transparent);
}

.nav-bar .nav-item.active { color: var(--md-sys-color-on-surface); }

.nav-bar .nav-item.active .nav-indicator {
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}

.nav-bar .nav-item.active .material-symbols-rounded { font-variation-settings: "FILL" 1; }

body { padding-bottom: var(--nav-bar-height); }

@media (min-width: 840px) {
    .nav-bar { display: none; }
    body { padding-bottom: 0; }
}

/* Buttons */
.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    height: 40px;
    min-width: 48px;
    padding: 0 var(--space-6);
    border: none;
    border-radius: var(--md-sys-shape-corner-full);
    background: transparent;
    color: var(--md-sys-color-primary);
    font: 500 14px/20px var(--font);
    letter-spacing: 0.1px;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    overflow: hidden;
    transition: box-shadow 200ms var(--md-sys-motion-easing-standard), border-radius 200ms var(--md-sys-motion-easing-standard);
}

.btn .material-symbols-rounded { font-size: 18px; margin-left: -8px; }
.btn .material-symbols-rounded.trailing { margin-left: 0; margin-right: -8px; }

/* State layer */
.btn::after, .icon-btn::after {
    content: "";
    position: absolute;
    inset: 0;
    background: currentColor;
    opacity: 0;
    transition: opacity 150ms var(--md-sys-motion-easing-standard);
    pointer-events: none;
}

.btn:hover::after, .icon-btn:hover::after { opacity: var(--md-sys-state-hover); }
.btn:active::after, .icon-btn:active::after { opacity: var(--md-sys-state-pressed); }

/* Expressive: pressed buttons square up a little */
.btn:active { border-radius: var(--md-sys-shape-corner-medium); }

.btn:disabled, .btn[aria-disabled="true"] {
    color: color-mix(in srgb, var(--md-sys-color-on-surface) 38%, transparent);
    cursor: default;
    pointer-events: none;
}

.btn-filled {
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

.btn-filled:hover { box-shadow: var(--elevation-1); }

.btn-tonal {
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}

.btn-outlined { border: 1px solid var(--md-sys-color-outline); }

.btn-filled:disabled, .btn-filled[aria-disabled="true"],
.btn-tonal:disabled, .btn-tonal[aria-disabled="true"] {
    background: color-mix(in srgb, var(--md-sys-color-on-surface) 12%, transparent);
}

.btn-outlined:disabled, .btn-outlined[aria-disabled="true"] {
    border-color: color-mix(in srgb, var(--md-sys-color-on-surface) 12%, transparent);
}

.btn-text { padding: 0 var(--space-3); }

.btn-large { height: 56px; padding: 0 var(--space-8); font-size: 16px; }

.btn-block { width: 100%; }

.icon-btn {
    position: relative;
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    border-radius: var(--md-sys-shape-corner-full);
    background: transparent;
    color: var(--md-sys-color-on-surface-variant);
    cursor: pointer;
    overflow: hidden;
}

.profile-chip { padding: 0 var(--space-4) 0 var(--space-1); }

.fab-small {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border: none;
    border-radius: var(--md-sys-shape-corner-large);
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    box-shadow: var(--elevation-3);
    cursor: pointer;
    transition: transform 200ms var(--md-sys-motion-easing-standard);
}

.fab-small:hover { transform: scale(1.06); }

@media (max-width: 599px) {
    .hide-compact { display: none; }
    .top-actions .nav-label { display: none; }
    .profile-chip { padding: 0 var(--space-1); }
}

/* Avatar */
.avatar {
    display: inline-grid;
    place-items: center;
    flex: none;
    border-radius: var(--md-sys-shape-corner-full);
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    font-weight: 500;
}

.avatar-small { width: 32px; height: 32px; font-size: 14px; }
.avatar-large { width: 72px; height: 72px; font-size: 32px; }

/* Cards */
.card {
    padding: var(--space-6);
    border-radius: var(--md-sys-shape-corner-medium);
    background: var(--md-sys-color-surface-container-low);
}

.card-filled { background: var(--md-sys-color-surface-container-highest); }

.card-outlined {
    background: var(--md-sys-color-surface);
    border: 1px solid var(--md-sys-color-outline-variant);
}

.card-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.card-header .material-symbols-rounded { color: var(--md-sys-color-primary); }

.card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-6);
}

/* Clickable media cards (news, catalog) */
.card-link {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    color: inherit;
    text-decoration: none;
    transition: background-color 200ms var(--md-sys-motion-easing-standard), box-shadow 200ms var(--md-sys-motion-easing-standard);
}

.card-link:hover {
    background: var(--md-sys-color-surface-container);
    box-shadow: var(--elevation-1);
}

.card-link:hover .card-media img { transform: scale(1.03); }

.card-media {
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--md-sys-color-surface-container-high);
}

.card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 400ms var(--md-sys-motion-easing-standard);
}

.card-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding: var(--space-4) var(--space-4) var(--space-6);
    color: inherit;
    text-decoration: none;
}

.card-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-4);
}

@media (min-width: 600px) {
    .card-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 840px) {
    .card-grid { grid-template-columns: repeat(3, 1fr); gap: var(--space-6); }
}

@media (min-width: 1200px) {
    .catalog-grid { grid-template-columns: repeat(4, 1fr); }
}

.media-placeholder {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    min-height: 100%;
    background:
        radial-gradient(circle at 30% 20%, color-mix(in srgb, var(--md-sys-color-primary) 18%, transparent), transparent 60%),
        var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-primary);
}

.media-placeholder .material-symbols-rounded { font-size: 56px; font-variation-settings: "FILL" 1, "opsz" 48; }

.media-placeholder-update {
    background:
        radial-gradient(circle at 70% 30%, color-mix(in srgb, var(--md-sys-color-tertiary) 22%, transparent), transparent 60%),
        var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-tertiary);
}

/* Meta row + badges */
.post-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-3);
    color: var(--md-sys-color-on-surface-variant);
}

.badge {
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 var(--space-2);
    border-radius: var(--md-sys-shape-corner-small);
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}

.badge-update, .badge-sound {
    background: var(--md-sys-color-tertiary-container);
    color: var(--md-sys-color-on-tertiary-container);
}

.badge-model {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

/* Chips */
.chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    height: 32px;
    padding: 0 var(--space-4);
    border-radius: var(--md-sys-shape-corner-small);
    border: 1px solid var(--md-sys-color-outline);
    color: var(--md-sys-color-on-surface-variant);
    text-decoration: none;
    white-space: nowrap;
}

.chip .material-symbols-rounded { font-size: 18px; margin-left: -8px; }

.chip-success {
    border-color: transparent;
    background: var(--md-sys-color-tertiary-container);
    color: var(--md-sys-color-on-tertiary-container);
}

.chip-warning {
    border-color: transparent;
    background: var(--md-sys-color-error-container);
    color: var(--md-sys-color-on-error-container);
}

.chip-assist {
    border-color: var(--md-sys-color-outline-variant);
    color: var(--md-sys-color-on-surface);
}

.chip-assist .material-symbols-rounded { color: var(--md-sys-color-primary); }

.chip-filter { transition: background-color 150ms var(--md-sys-motion-easing-standard); }
.chip-filter:hover { background: color-mix(in srgb, var(--md-sys-color-on-surface-variant) 8%, transparent); }

.chip-filter.selected {
    border-color: transparent;
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}

.filter-chips {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-6);
    overflow-x: auto;
    scrollbar-width: none;
}

/* Segmented button */
.segmented {
    display: inline-flex;
    margin-bottom: var(--space-4);
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-full);
    overflow: hidden;
}

.segment {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    height: 40px;
    padding: 0 var(--space-4);
    color: var(--md-sys-color-on-surface);
    text-decoration: none;
}

.segment + .segment { border-left: 1px solid var(--md-sys-color-outline); }
.segment .material-symbols-rounded { font-size: 18px; }
.segment:hover { background: color-mix(in srgb, var(--md-sys-color-on-surface) 8%, transparent); }

.segment.selected {
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}

/* Search bar */
.search-bar {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    max-width: 560px;
    height: 56px;
    margin-bottom: var(--space-4);
    padding: 0 var(--space-2) 0 var(--space-4);
    border-radius: var(--md-sys-shape-corner-full);
    background: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface-variant);
}

.search-bar input {
    flex: 1;
    min-width: 0;
    height: 100%;
    border: none;
    background: transparent;
    color: var(--md-sys-color-on-surface);
    outline: none;
}

.search-bar input::placeholder { color: var(--md-sys-color-on-surface-variant); }
.search-bar input::-webkit-search-cancel-button { display: none; }
.search-bar:focus-within { outline: 2px solid var(--md-sys-color-primary); }

/* Key/value list */
.kv {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: var(--space-2) var(--space-6);
    margin: 0;
}

.kv dt { color: var(--md-sys-color-on-surface-variant); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* Outlined text field (label floats via :placeholder-shown) */
.field { position: relative; margin-bottom: var(--space-4); }

.field input {
    width: 100%;
    height: 56px;
    padding: 0 var(--space-4);
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-extra-small);
    background: transparent;
    color: var(--md-sys-color-on-surface);
    font: 400 16px/24px var(--font);
    letter-spacing: 0.5px;
    caret-color: var(--md-sys-color-primary);
    outline: none;
}

.field input:hover { border-color: var(--md-sys-color-on-surface); }

.field input:focus {
    border: 2px solid var(--md-sys-color-primary);
    padding: 0 calc(var(--space-4) - 1px);
}

.field label {
    position: absolute;
    left: 12px;
    top: 16px;
    padding: 0 4px;
    background: var(--field-bg, var(--md-sys-color-surface));
    color: var(--md-sys-color-on-surface-variant);
    font: 400 16px/24px var(--font);
    letter-spacing: 0.5px;
    pointer-events: none;
    transition: all 150ms var(--md-sys-motion-easing-standard);
}

.field input:focus + label,
.field input:not(:placeholder-shown) + label {
    top: -8px;
    font-size: 12px;
    line-height: 16px;
}

/* Browser autofill fills the value before :placeholder-shown updates, so float the label for it too.
   Separate rules: an unknown selector would drop the whole list. */
.field input:-webkit-autofill + label { top: -8px; font-size: 12px; line-height: 16px; }
.field input:autofill + label { top: -8px; font-size: 12px; line-height: 16px; }

.field input:focus + label { color: var(--md-sys-color-primary); }

/* Keep our surface instead of the browser's autofill tint (it ignores background-color) */
.field input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 100px var(--field-bg, var(--md-sys-color-surface)) inset;
    -webkit-text-fill-color: var(--md-sys-color-on-surface);
    transition: background-color 9999s;
}

.field .supporting {
    display: block;
    padding: var(--space-1) var(--space-4) 0;
    color: var(--md-sys-color-on-surface-variant);
    font: 400 12px/16px var(--font);
    letter-spacing: 0.4px;
}

.field .supporting ul { margin: 0; padding-left: var(--space-4); }

.field.invalid input { border-color: var(--md-sys-color-error); }
.field.invalid label,
.field.invalid .supporting.error { color: var(--md-sys-color-error); }

.form-errors {
    margin-bottom: var(--space-4);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--md-sys-shape-corner-small);
    background: var(--md-sys-color-error-container);
    color: var(--md-sys-color-on-error-container);
}

/* Auth pages */
.auth {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-8) var(--margin);
}

.auth .card {
    --field-bg: var(--md-sys-color-surface-container-low);
    width: 100%;
    max-width: 400px;
    border-radius: var(--md-sys-shape-corner-extra-large);
    padding: var(--space-6);
}

.auth h1 { margin-bottom: var(--space-6); }

.auth .alt {
    margin-top: var(--space-4);
    text-align: center;
    color: var(--md-sys-color-on-surface-variant);
}

/* Page scaffolding */
.page-header {
    display: grid;
    gap: var(--space-2);
    max-width: var(--reading-max);
    padding: var(--space-8) 0 var(--space-6);
}

.section { padding-top: var(--space-12); }
.section:last-child { padding-bottom: var(--space-16); }

.section-title { margin-bottom: var(--space-8); }

.section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

main.container { padding-bottom: var(--space-12); }

.back-link { margin: var(--space-4) 0 0 calc(-1 * var(--space-3)); }

/* Hero */
.hero {
    position: relative;
    display: flex;
    align-items: center;
    min-height: calc(100svh - 64px - var(--nav-bar-height));
    overflow: hidden;
}

@media (min-width: 840px) {
    .hero { min-height: calc(100svh - 64px); }
}

.hero-glow {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(60% 50% at 75% 30%, color-mix(in srgb, var(--md-sys-color-primary) 22%, transparent), transparent 70%),
        radial-gradient(45% 40% at 15% 80%, color-mix(in srgb, var(--md-sys-color-tertiary) 12%, transparent), transparent 70%);
    /* Fade both ends so the glow has no hard edge under the top bar or where the hero ends */
    mask-image: linear-gradient(to bottom, transparent, black 20%, black 55%, transparent);
    pointer-events: none;
}

.hero-inner {
    position: relative;
    display: grid;
    justify-items: start;
    gap: var(--space-6);
    /* Vertically centered, nudged up a little: the geometric center reads as too low */
    padding-top: var(--space-12);
    padding-bottom: calc(var(--space-12) + 8vh);
}

.hero-title { font-size: clamp(48px, 9vw, 104px); line-height: 1.02; letter-spacing: -1.5px; }

.hero-text { max-width: 560px; color: var(--md-sys-color-on-surface-variant); font-size: 18px; line-height: 28px; }

.hero-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }

.features .cta-band { margin-bottom: var(--space-4); }

.scroll-cue {
    position: absolute;
    left: 50%;
    bottom: var(--space-4);
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: var(--md-sys-shape-corner-full);
    color: var(--md-sys-color-on-surface-variant);
    text-decoration: none;
    transform: translateX(-50%);
    animation: bob 2.4s var(--md-sys-motion-easing-standard) infinite;
}

@keyframes bob {
    50% { transform: translate(-50%, 6px); }
}

/* Showcase rows on the home page */
.features { padding-top: var(--space-12); }

.showcase {
    display: grid;
    gap: var(--space-6);
    align-items: center;
    margin-bottom: var(--space-12);
}

.showcase-media {
    aspect-ratio: 16 / 10;
    border-radius: var(--md-sys-shape-corner-extra-large);
    overflow: hidden;
    background: var(--md-sys-color-surface-container-low);
    box-shadow: var(--elevation-1);
}

.showcase-media img { width: 100%; height: 100%; object-fit: cover; }

.showcase-body {
    display: grid;
    justify-items: start;
    gap: var(--space-3);
}

.showcase-index { color: var(--md-sys-color-primary); }

@media (min-width: 840px) {
    .showcase {
        grid-template-columns: 7fr 5fr;
        gap: var(--space-12);
        margin-bottom: var(--space-16);
    }

    .showcase-reverse { grid-template-columns: 5fr 7fr; }
    .showcase-reverse .showcase-media { order: 2; }
}

.cta-band {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-6);
    padding: var(--space-8);
    border-radius: var(--md-sys-shape-corner-extra-large);
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

.cta-band > div { display: grid; gap: var(--space-2); max-width: 560px; }

/* Scroll reveal (app.js adds .visible) */
.js .reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 600ms var(--md-sys-motion-easing-emphasized-decelerate),
                transform 600ms var(--md-sys-motion-easing-emphasized-decelerate);
}

.js .reveal.visible { opacity: 1; transform: none; }

/* Article */
.article { max-width: var(--article-max); padding-top: var(--space-4); }

.article-header {
    display: grid;
    gap: var(--space-3);
    margin-bottom: var(--space-6);
}

.article-cover {
    width: 100%;
    margin-bottom: var(--space-8);
    border-radius: var(--md-sys-shape-corner-extra-large);
}

.prose { color: var(--md-sys-color-on-surface); overflow-wrap: anywhere; }
.prose > * + * { margin-top: var(--space-4); }
.prose h1, .prose h2 { font: 400 24px/32px var(--font); margin-top: var(--space-8); }
.prose h3, .prose h4 { font: 500 16px/24px var(--font); letter-spacing: 0.15px; margin-top: var(--space-6); }
.prose ul, .prose ol { padding-left: var(--space-6); }
.prose li + li { margin-top: var(--space-2); }
.prose img { border-radius: var(--md-sys-shape-corner-large); }
.prose blockquote {
    margin: var(--space-6) 0;
    padding: var(--space-3) var(--space-4);
    border-left: 4px solid var(--md-sys-color-primary);
    border-radius: 0 var(--md-sys-shape-corner-small) var(--md-sys-shape-corner-small) 0;
    background: var(--md-sys-color-surface-container-low);
}
.prose code {
    padding: 2px 6px;
    border-radius: var(--md-sys-shape-corner-extra-small);
    background: var(--md-sys-color-surface-container-high);
    font-size: 0.9em;
}
.prose pre {
    padding: var(--space-4);
    border-radius: var(--md-sys-shape-corner-medium);
    background: var(--md-sys-color-surface-container-lowest);
    overflow-x: auto;
}
.prose pre code { padding: 0; background: none; }
.prose hr { border: none; border-top: 1px solid var(--md-sys-color-outline-variant); margin: var(--space-8) 0; }
.prose table { width: 100%; border-collapse: collapse; }
.prose th, .prose td { padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--md-sys-color-outline-variant); text-align: left; }

/* Catalog */
.item-card { container-type: inline-size; }
.item-card .card-content { flex: 1; }

/* Straddles the bottom edge of the 16:9 media */
.play-btn {
    position: absolute;
    right: var(--space-4);
    top: calc(56.25cqw - 24px);
    z-index: 1;
}

.play-btn.playing {
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

.item-layout {
    display: grid;
    gap: var(--space-6);
    padding-top: var(--space-4);
}

@media (min-width: 840px) {
    .item-layout { grid-template-columns: 3fr 2fr; align-items: start; }
    .item-info { position: sticky; top: 80px; }
}

.gallery-main {
    aspect-ratio: 16 / 10;
    border-radius: var(--md-sys-shape-corner-extra-large);
    overflow: hidden;
    background: var(--md-sys-color-surface-container-low);
}

.gallery-main img { width: 100%; height: 100%; object-fit: contain; }

.gallery-thumbs {
    display: flex;
    gap: var(--space-2);
    margin-top: var(--space-3);
    overflow-x: auto;
}

.gallery-thumb {
    flex: none;
    width: 96px;
    aspect-ratio: 16 / 10;
    padding: 0;
    border: 2px solid transparent;
    border-radius: var(--md-sys-shape-corner-small);
    background: none;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.7;
}

.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; }
.gallery-thumb:hover { opacity: 1; }
.gallery-thumb.selected { border-color: var(--md-sys-color-primary); opacity: 1; }

.item-info { display: grid; gap: var(--space-3); justify-items: start; }
.item-description { color: var(--md-sys-color-on-surface-variant); }

.audio-preview { display: grid; gap: var(--space-2); width: 100%; }
.audio-preview audio { width: 100%; }

.install-note {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--md-sys-shape-corner-medium);
    background: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface-variant);
}

.install-note .material-symbols-rounded { color: var(--md-sys-color-primary); }

/* Empty state + pagination */
.empty-state {
    display: grid;
    justify-items: center;
    gap: var(--space-3);
    padding: var(--space-16) var(--space-4);
    text-align: center;
}

.empty-state > .material-symbols-rounded {
    display: grid;
    place-items: center;
    width: 80px;
    height: 80px;
    border-radius: var(--md-sys-shape-corner-extra-large);
    background: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-primary);
    font-size: 40px;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-4);
    margin-top: var(--space-8);
}

/* Profile */
.profile-layout {
    display: grid;
    gap: var(--space-4);
    align-items: start;
}

@media (min-width: 840px) {
    .profile-layout { grid-template-columns: 2fr 1fr; gap: var(--space-6); }
}

.profile-main, .profile-side { display: grid; gap: var(--space-4); }

@media (min-width: 840px) {
    .profile-main, .profile-side { gap: var(--space-6); }
}

.sub-hero {
    position: relative;
    display: grid;
    gap: var(--space-2);
    padding: var(--space-6);
    border-radius: var(--md-sys-shape-corner-extra-large);
    background:
        radial-gradient(70% 90% at 85% 15%, color-mix(in srgb, var(--md-sys-color-primary) 20%, transparent), transparent 70%),
        var(--md-sys-color-surface-container);
    overflow: hidden;
}

.sub-hero-inactive {
    background:
        radial-gradient(70% 90% at 85% 15%, color-mix(in srgb, var(--md-sys-color-error) 10%, transparent), transparent 70%),
        var(--md-sys-color-surface-container);
}

@media (min-width: 600px) {
    .sub-hero { padding: var(--space-8); }
}

.sub-hero-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-2);
}

.sub-days {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--space-1) var(--space-3);
}

.sub-days .display-small { font-weight: 500; }

.sub-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-4);
}

.badge-active {
    background: var(--md-sys-color-tertiary-container);
    color: var(--md-sys-color-on-tertiary-container);
}

.badge-inactive {
    background: var(--md-sys-color-error-container);
    color: var(--md-sys-color-on-error-container);
}

.install { display: grid; gap: var(--space-6); justify-items: start; }

@media (min-width: 600px) {
    .install { padding: var(--space-8); }
}

.steps {
    display: grid;
    gap: var(--space-4);
    margin: 0;
    padding: 0;
    list-style: none;
}

.steps li { display: flex; gap: var(--space-4); }
.steps li > div { display: grid; gap: var(--space-1); }

.step-num {
    display: grid;
    place-items: center;
    flex: none;
    width: 32px;
    height: 32px;
    border-radius: var(--md-sys-shape-corner-full);
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

.download-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3) var(--space-4);
}

.account-head {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}

.account-head > div { display: grid; gap: var(--space-1); min-width: 0; }
.account-head h2 { overflow-wrap: anywhere; }

.account-card form { margin: 0; }

.status-value { margin-bottom: var(--space-2); }

/* Footer */
footer {
    margin-top: auto;
    padding: var(--space-6) 0;
    border-top: 1px solid var(--md-sys-color-outline-variant);
    color: var(--md-sys-color-on-surface-variant);
}

.footer-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

.footer-links { display: flex; gap: var(--space-4); }
.footer-links a { color: inherit; text-decoration: none; }
.footer-links a:hover { color: var(--md-sys-color-primary); }

/* Snackbar */
.snackbars {
    position: fixed;
    left: 50%;
    bottom: calc(var(--space-4) + var(--nav-bar-height));
    z-index: 20;
    display: grid;
    gap: var(--space-2);
    width: min(560px, calc(100% - 2 * var(--margin)));
    transform: translateX(-50%);
}

@media (min-width: 840px) {
    .snackbars { bottom: var(--space-4); }
}

.snackbar {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-height: 48px;
    padding: var(--space-1) var(--space-2) var(--space-1) var(--space-4);
    border-radius: var(--md-sys-shape-corner-extra-small);
    background: var(--md-sys-color-inverse-surface);
    color: var(--md-sys-color-inverse-on-surface);
    box-shadow: var(--elevation-3);
    animation: snackbar-in 300ms var(--md-sys-motion-easing-emphasized-decelerate);
}

.snackbar p { flex: 1; padding: var(--space-3) 0; }

.snackbar .btn { color: var(--md-sys-color-inverse-primary); min-width: 40px; padding: 0; }
.snackbar .btn .material-symbols-rounded { margin: 0; font-size: 20px; color: var(--md-sys-color-inverse-on-surface); }

.snackbar.hiding {
    opacity: 0;
    transition: opacity 200ms var(--md-sys-motion-easing-emphasized-accelerate);
}

@keyframes snackbar-in {
    from { opacity: 0; transform: translateY(16px); }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation: none !important; transition: none !important; }
    .js .reveal { opacity: 1; transform: none; }
}
