/* Beat Rail: styled like the game's own menu (MainMenu.cs) - the same colours, fonts and flat panels. */

@font-face {
    font-family: 'ZT Nature';
    src: url('/Games/BeatRail/fonts/ZTNature-Medium.ttf') format('truetype');
    font-weight: 500;
    font-display: swap;
}
@font-face {
    font-family: 'ZT Nature';
    src: url('/Games/BeatRail/fonts/ZTNature-Black.ttf') format('truetype');
    font-weight: 900;
    font-display: swap;
}

:root {
    /* The menu's colours */
    --background: #0a0a12;             /* backgroundColor (0.04, 0.04, 0.07) */
    --panel: #171721;                  /* panelColor (0.09, 0.09, 0.13) */
    --button: #20202e;                 /* panelColor * 1.4: buttons and tabs */
    --accent: #c240ff;                 /* accentColor (0.76, 0.25, 1) */
    --accent-soft: #752e9b;            /* Lerp(panel, accent, 0.55): the selected tab */
    --text: #ffffff;
    --dim: rgba(255, 255, 255, 0.55);  /* dimTextColor */
    --warning: #ffb347;
}

* { box-sizing: border-box; }

html { background: var(--background); }
body {
    margin: 0;
    min-height: 100vh;
    background: var(--background);
    color: var(--text);
    font-family: 'ZT Nature', 'Segoe UI', sans-serif;
    font-weight: 500;
    font-size: 17px;
    line-height: 1.55;
    padding: 0 80px 280px;
    overflow-x: hidden;
}

a { color: var(--accent); }
a:hover { color: #d98bff; }

/* The leaf from the rest of ChaosTree, small and quiet in the corner */
.leaf {
    position: absolute; top: 14px; left: 14px; z-index: 2;
    display: inline-block;
    padding: 13px 20px 11px;
    font-family: 'Syne Mono', monospace; font-size: 12px;
    color: #000; text-decoration: none;
    background: url('/CDN/Images/Leaf.png') center / contain no-repeat;
    opacity: 0.45;
    transition: opacity 0.2s, filter 0.2s;
}
.leaf:hover { color: #000; opacity: 0.9; filter: drop-shadow(0 0 8px rgba(0, 255, 149, 0.6)); }
@font-face {
    font-family: 'Syne Mono';
    src: url('/Font/SyneMono-Regular.ttf') format('truetype');
}

/* Header: the title with the subtitle under it, as in the menu */
.header { padding-top: 58px; margin-bottom: 28px; position: relative; z-index: 1; }
.title {
    margin: 0;
    font-weight: 900; font-size: 64px; line-height: 1;
    letter-spacing: 0.1em;
}
.subtitle {
    margin-top: 14px;
    color: var(--accent);
    font-size: 20px; letter-spacing: 0.45em;
}

/* Flat panels, like the menu's */
.panel {
    background: var(--panel);
    padding: 26px 30px 24px;
}
.panel p { margin: 10px 0; }
.section {
    margin: 0 0 16px 0;
    color: var(--accent);
    font-size: 19px; font-weight: 500; letter-spacing: 0.4em;
}
.dim { color: var(--dim); }
.small { font-size: 14px; }

/* DOWNLOAD reads like the menu's PLAY button: accent, title font, dark label */
.play {
    display: block; width: 100%;
    margin: 4px 0 12px;
    padding: 20px 24px 18px;
    border: none;
    background: var(--accent);
    color: var(--background);
    font-family: 'ZT Nature', sans-serif; font-weight: 900;
    font-size: 34px; letter-spacing: 0.08em;
    cursor: pointer;
    transition: filter 0.15s, transform 0.08s;
}
.play:hover { filter: brightness(1.15); }
.play:active { transform: scale(0.99); filter: brightness(0.85); }
.play:disabled {
    background: var(--button); color: var(--dim);
    cursor: default; filter: none; transform: none;
}
.meta { font-size: 18px; letter-spacing: 0.12em; }

/* Steps, and keys shown like the menu's buttons */
.steps { list-style: none; margin: 14px 0; padding: 0; }
.steps li { display: grid; grid-template-columns: 30px minmax(0, 1fr); align-items: start; gap: 14px; margin: 12px 0; }
.step {
    flex: none;
    width: 30px; height: 30px; line-height: 30px;
    text-align: center;
    background: var(--accent-soft);
    font-weight: 900;
    margin-top: -2px;
}
.key {
    display: inline-block;
    padding: 1px 9px;
    background: var(--button);
    font-size: 14px; letter-spacing: 0.15em;
}

#patch-notes h3 {
    margin: 18px 0 4px; font-size: 20px; font-weight: 900; letter-spacing: 0.06em;
}
#patch-notes h3:first-child { margin-top: 0; }
#patch-notes h3 small { color: var(--dim); font-size: 14px; font-weight: 500; margin-left: 12px; letter-spacing: 0.1em; }
#patch-notes ul { margin: 4px 0 10px; padding-left: 20px; }
#patch-notes li::marker { color: var(--accent); }

/* The menu's spectrum along the bottom: accent bars at low opacity */
.spectrum {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 0;
    height: 240px;
    display: flex; align-items: flex-end;
    pointer-events: none;
}
.spectrum span {
    flex: 1;
    margin: 0 3px;
    height: 6px;
    background: rgba(194, 64, 255, 0.22);
    transition: height 0.12s linear;
}

@media (max-width: 900px) {
    body { padding: 0 16px 200px; font-size: 16px; }
    .header { padding-top: 64px; }
    .title { font-size: 44px; }
    .subtitle { font-size: 14px; letter-spacing: 0.3em; }
    .panel { padding: 20px 18px; }
    .play { font-size: 26px; }
    .spectrum { height: 160px; }
    .spectrum span { margin: 0 2px; }
}

@media (prefers-reduced-motion: reduce) {
    .spectrum span { transition: none; }
}

/* ---- Header bar: the game on the left, finding songs on the right */
.bar {
    position: relative; z-index: 1;
    display: flex; gap: 20px; align-items: stretch; justify-content: space-between; flex-wrap: wrap;
    max-width: 1440px;
    margin-bottom: 20px;
    padding: 18px 20px;
    background: var(--panel);
}
.bar-game { display: flex; gap: 18px; align-items: center; min-width: 0; }
.bar-game .play { width: auto; margin: 0; padding: 14px 28px 12px; font-size: 26px; white-space: nowrap; }
.bar-game-info { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.bar-game .meta { font-size: 15px; }
.bar-links { display: flex; gap: 16px; flex-wrap: wrap; }
.link-button {
    padding: 0; background: none; border: none; cursor: pointer;
    color: var(--accent); font: inherit; font-size: 13px; letter-spacing: 0.2em;
}
.link-button:hover { color: #d98bff; text-decoration: underline; text-underline-offset: 4px; }
.bar-search { display: flex; gap: 12px; align-items: center; flex: 1 1 420px; justify-content: flex-end; flex-wrap: wrap; min-width: 0; }
.bar-search .tabs { flex-wrap: nowrap; }
#song-search {
    flex: 1 1 240px; min-width: 0; max-width: 520px;
    padding: 12px 16px;
    background: var(--button); color: var(--text);
    border: 1px solid transparent; border-radius: 0;
    font: inherit;
}
#song-search:focus { outline: none; border-color: var(--accent); }
#song-search::placeholder { color: var(--dim); font-style: italic; }

/* Tabs, like the menu's: flat, the picked one in the soft accent */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tabs button {
    padding: 10px 16px;
    background: var(--button); color: var(--text);
    border: none; cursor: pointer;
    font: inherit; font-size: 13px; letter-spacing: 0.2em;
}
.tabs button:hover { filter: brightness(1.3); }
.tabs button.selected { background: var(--accent-soft); }
.tabs button small { color: var(--dim); letter-spacing: 0.05em; margin-left: 8px; }

/* ---- Songs: the grid, and an opened song on the left */
.songs {
    position: relative; z-index: 1;
    display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px;
    max-width: 1440px;
    align-items: start;
}
.songs.open { grid-template-columns: minmax(340px, 460px) minmax(0, 1fr); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.card {
    display: flex; flex-direction: column;
    padding: 0; min-width: 0;
    background: var(--panel); color: var(--text);
    border: none; outline: 2px solid transparent; outline-offset: -2px;
    font: inherit; text-align: left; cursor: pointer;
    transition: transform 0.12s, outline-color 0.12s;
}
.card:hover { transform: translateY(-3px); outline-color: var(--accent-soft); }
.card:focus-visible { outline-color: var(--accent); }
.card.selected { outline-color: var(--accent); }
.card-cover, .detail-cover { position: relative; aspect-ratio: 1; overflow: hidden; background: var(--button); }
.card-cover img, .detail-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.no-cover {
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--accent-soft), var(--panel));
}
.no-cover span { font-weight: 900; font-size: 44px; letter-spacing: 0.08em; color: rgba(255, 255, 255, 0.8); }
.card-info { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.card-name { font-weight: 900; font-size: 17px; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-by { color: var(--dim); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-meta { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; color: var(--dim); font-size: 12px; letter-spacing: 0.08em; }
.card-meta span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-meta span:last-child { flex: none; }

.pages { display: flex; gap: 8px; justify-content: center; margin-top: 16px; }
.pages button {
    min-width: 40px; padding: 6px 10px;
    background: var(--button); color: var(--text); border: none; cursor: pointer; font: inherit;
}
.pages button.selected { background: var(--accent-soft); }

/* The opened song */
.detail { position: relative; }
.detail[hidden] { display: none; }
.close {
    position: absolute; top: 10px; right: 12px;
    width: 36px; height: 36px;
    background: var(--button); color: var(--text); border: none; cursor: pointer;
    font-size: 24px; line-height: 1;
}
.close:hover { background: var(--accent-soft); }
.detail-head { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 18px; align-items: end; margin: 0 40px 18px 0; }
.detail-cover .no-cover span, .detail-cover span { font-size: 36px; }
.detail-name { margin: 0; font-weight: 900; font-size: 26px; line-height: 1.15; overflow-wrap: anywhere; }
.detail-artist { color: var(--dim); font-size: 17px; margin-top: 4px; }
.get-song { display: block; text-align: center; text-decoration: none; font-size: 24px; padding: 14px 20px 12px; }
.get-song:hover { color: var(--background); }
.facts { margin: 16px 0 22px; }
.facts div { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 10px; padding: 5px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.facts dt { color: var(--dim); font-size: 12px; letter-spacing: 0.2em; padding-top: 3px; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.detail .section { font-size: 16px; margin-bottom: 10px; }
.detail .tabs { margin-bottom: 10px; }

.board { display: flex; flex-direction: column; }
.row {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto 96px;
    align-items: center; gap: 10px;
    padding: 8px 12px;
    background: var(--panel);
    font-size: 15px;
}
.row:nth-child(odd) { background: #1d1d29; }                 /* panelColor * 1.25, as the menu alternates rows */
.rank { color: var(--dim); }
.player { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player small { color: var(--dim); }
.mods { color: var(--dim); font-size: 12px; margin-left: 8px; letter-spacing: 0.1em; }
.grade { color: var(--accent); font-weight: 900; margin-right: 6px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.accuracy { text-align: right; white-space: nowrap; }
.report { display: block; margin-top: 22px; color: var(--dim); }

.footer { position: relative; z-index: 1; max-width: 1440px; margin-top: 28px; }

/* ---- Overlays */
.overlay {
    position: fixed; inset: 0; z-index: 10;
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
    background: rgba(5, 5, 10, 0.78);
}
.overlay[hidden] { display: none; }
body.overlay-open { overflow: hidden; }
.dialog {
    position: relative;
    width: min(640px, 100%); max-height: calc(100vh - 32px); overflow-y: auto;
    padding: 30px 32px 26px;
}
.dialog .section { margin-right: 44px; }
.dialog .section:not(:first-of-type) { margin-top: 26px; }
.report-song { font-weight: 900; margin-top: -4px; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 14px 0; }
.field[hidden], .check[hidden] { display: none; }
.field span { color: var(--dim); font-size: 13px; letter-spacing: 0.1em; }
.field select, .field textarea, .field input {
    padding: 10px 12px;
    background: var(--button); color: var(--text);
    border: 1px solid transparent; border-radius: 0;
    font: inherit; font-size: 15px;
}
.field select:focus, .field textarea:focus, .field input:focus { outline: none; border-color: var(--accent); }
.field textarea { resize: vertical; min-height: 100px; }
.check { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; align-items: start; margin: 14px 0; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--accent); }
.report-message { min-height: 1.4em; font-size: 14px; }
.report-message.good { color: var(--accent); }
.report-message.bad { color: #ff7a85; }
.small-play { font-size: 22px; padding: 12px 20px 10px; margin: 0; }

@media (max-width: 1100px) {
    .songs.open { grid-template-columns: minmax(0, 1fr); }
    .songs.open .browse { order: 2; }
}

@media (max-width: 900px) {
    .bar { padding: 14px; }
    .bar-game { flex-wrap: wrap; }
    .bar-game .play { font-size: 22px; padding: 12px 22px 10px; }
    .bar-search { flex-wrap: wrap; justify-content: stretch; }
    #song-search { max-width: none; flex-basis: 100%; }
    .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
    .no-cover span { font-size: 34px; }
    .detail-head { grid-template-columns: 90px minmax(0, 1fr); }
    .detail-name { font-size: 22px; }
    .facts div { grid-template-columns: 110px minmax(0, 1fr); }
    .row { grid-template-columns: 36px minmax(0, 1fr) auto; font-size: 14px; }
    .row .accuracy { grid-column: 2 / -1; text-align: left; color: var(--dim); font-size: 13px; margin-top: -4px; }
    .dialog { padding: 24px 18px 20px; }
}

/* ---- Admin subpage (admin.html) */
.admin-page .panel { position: relative; z-index: 1; max-width: 1100px; }
.admin { position: relative; z-index: 1; max-width: 1100px; }
.admin[hidden], #not-admin[hidden], .admin-panel[hidden] { display: none; }
.admin-tabs { margin-bottom: 16px; }
.admin-tabs small { color: var(--text); background: #c8555f; padding: 0 6px; margin-left: 8px; }
.admin-tabs small:empty { display: none; }
.admin-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.admin-sub { margin: 26px 0 10px; color: var(--dim); font-size: 13px; font-weight: 500; letter-spacing: 0.3em; }
.admin-list { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.admin-item { background: #1d1d29; padding: 16px 18px; border-left: 3px solid var(--accent-soft); }
.admin-item.copyright { border-left-color: #c8555f; }
.admin-item.closed { opacity: 0.55; border-left-color: transparent; }
.admin-item-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: baseline; }
.admin-item .facts { margin: 10px 0 6px; }
.admin-item .facts dd { white-space: pre-wrap; }
.admin-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.admin-songs { margin: 8px 0 0; padding-left: 18px; color: var(--dim); font-size: 14px; }
.admin-row {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 14px;
    padding: 10px 14px; background: #1d1d29; font-size: 15px;
}
.admin-row > :nth-child(3), .admin-row > :nth-child(4) { grid-column: 1 / -1; }
.admin-row > :nth-child(4) { margin-top: -4px; }
.badge { padding: 2px 8px; background: var(--button); font-size: 12px; letter-spacing: 0.15em; white-space: nowrap; }
.badge.bad { background: #6b2530; }
.admin-note { padding: 10px 14px; margin: 10px 0; border-left: 3px solid; font-size: 14px; }
.admin-note.good { border-color: var(--accent); color: var(--accent); }
.admin-note.bad { border-color: #ff7a85; color: #ff7a85; }
.tab-like {
    display: inline-block; padding: 9px 14px;
    background: var(--button); color: var(--text);
    border: none; cursor: pointer; text-decoration: none;
    font: inherit; font-size: 13px; letter-spacing: 0.2em;
}
.tab-like:hover { color: var(--text); filter: brightness(1.3); }
.tab-like.danger { background: #6b2530; }

/* The shared release admin (/gameReleasesAdmin.js), in Beat Rail's look */
.release-admin [hidden] { display: none !important; }
.release-admin .section-card + .section-card { margin-top: 28px; padding-top: 22px; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.release-admin .section-header { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.release-admin .section-title { margin: 0 0 8px; color: var(--accent); font-size: 17px; font-weight: 500; letter-spacing: 0.35em; }
.release-admin .section-icon { display: none; }
.release-admin .section-blurb { color: var(--dim); font-size: 14px; margin-top: 0; }
.release-admin .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.release-admin .full-width { grid-column: 1 / -1; }
.release-admin .form-group { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.release-admin label { color: var(--dim); font-size: 13px; letter-spacing: 0.08em; }
.release-admin input, .release-admin select, .release-admin textarea {
    width: 100%; min-width: 0; padding: 10px 12px;
    background: var(--button); color: var(--text);
    border: 1px solid transparent; border-radius: 0; font: inherit; font-size: 15px;
}
.release-admin input:focus, .release-admin select:focus, .release-admin textarea:focus { outline: none; border-color: var(--accent); }
.release-admin textarea { resize: vertical; }
.release-admin .release-minimum-row { display: flex; gap: 12px; }
.release-admin .form-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
.release-admin .btn {
    padding: 10px 16px; background: var(--accent); color: var(--background);
    border: none; cursor: pointer; font: inherit; font-weight: 900; font-size: 14px; letter-spacing: 0.12em;
}
.release-admin .btn:hover { filter: brightness(1.15); }
.release-admin .btn-secondary { background: var(--button); color: var(--text); font-weight: 500; }
.release-admin .btn-danger { background: #6b2530; color: var(--text); font-weight: 500; }
.release-admin .btn-sm { padding: 7px 12px; font-size: 12px; }
.release-admin .btn:disabled { opacity: 0.4; cursor: default; filter: none; }
.release-admin .build-row { border-left: 3px solid var(--accent-soft); padding: 4px 0 4px 14px; margin: 14px 0; }
.release-admin .build-row h3 { margin: 0 0 4px; font-size: 16px; }
.release-admin .build-current { color: var(--dim); font-size: 13px; margin-bottom: 10px; }
.release-admin .build-current .missing { color: #ff7a85; }
.release-admin .build-fields { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 12px; align-items: end; }
.release-admin .build-progress { color: var(--dim); font-size: 13px; margin-top: 8px; min-height: 1em; }
.release-admin .error-message, .release-admin .success-message { padding: 10px 14px; margin-top: 12px; border-left: 3px solid; font-size: 14px; }
.release-admin .error-message { color: #ff7a85; border-color: #ff7a85; }
.release-admin .success-message { color: var(--accent); border-color: var(--accent); }
.release-admin .loading { color: var(--dim); }

@media (max-width: 900px) {
    .release-admin .form-grid, .release-admin .build-fields { grid-template-columns: minmax(0, 1fr); }
    .release-admin .release-minimum-row { flex-direction: column; }
}

/* Plain lists in the overlays, and links that sit in running text */
.plain { margin: 8px 0; padding-left: 20px; }
.plain li { margin: 6px 0; }
.plain li::marker { color: var(--accent); }
.footer .link-button { font-size: inherit; letter-spacing: 0.1em; }
a.link-button[hidden] { display: none; }
.song-extras { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.open-in-game {
    display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 3px;
    padding: 11px 12px; min-height: 58px;
    background: var(--button); color: var(--text); border: none; cursor: pointer;
    text-align: center; text-decoration: none;
    font: inherit; font-size: 13px; letter-spacing: 0.18em;
}
.open-in-game small { color: var(--dim); font-size: 11px; letter-spacing: 0.03em; }
.open-in-game:hover { color: var(--text); background: var(--accent-soft); }
.open-in-game:disabled { cursor: default; color: var(--accent); background: var(--button); }
@media (max-width: 420px) { .song-extras { grid-template-columns: minmax(0, 1fr); } }
