:root {
    color-scheme: dark;
    --red: #480911;
    --red-hover: #68101c;
    --panel: rgba(0, 0, 0, 0.55);
    --border: #3a3a3a;
    --text: #dbdbdb;
    --muted: #878787;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
    margin: 0;
    background: #000 url('../images/BG_shrooms.png') repeat;
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.45;
}
a { color: inherit; }
.page-wrap { min-height: calc(100vh - 34px); }
.container { width: min(1020px, calc(100% - 32px)); margin-inline: auto; }
.site-header { height: 230px; overflow: hidden; }
.banner {
    display: block;
    width: 100%;
    height: 230px;
    background: url('../images/MR_bannerxmas.png') center top / auto 230px no-repeat;
}
.layout { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 8px; padding: 20px 0 40px; }
.navigation { padding-top: 10px; }
.navigation h2 { margin: 0 0 12px; color: #444; font-size: 14px; }
.navigation h2:not(:first-child) { margin-top: 38px; }
.side-links { border-bottom: 1px solid #2e2e2e; }
.side-links a {
    display: block;
    padding: 11px 15px;
    border-top: 1px solid #2e2e2e;
    color: var(--muted);
    font-size: 14px;
    text-decoration: none;
}
.side-links a:hover, .side-links a.active { color: #fff; background: rgba(255,255,255,.035); }
.side-links a.active { border-left: 3px solid var(--red-hover); padding-left: 12px; }
.content {
    min-width: 0;
    min-height: 500px;
    padding: 16px;
    border: 1px solid var(--border);
    background: var(--panel);
}
.leaderboard-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 52px; }
.eyebrow { margin: 0 0 4px; color: var(--muted); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
h1 { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 18px; font-weight: 400; letter-spacing: .04em; }
.submit-time {
    flex: none;
    padding: 10px 14px;
    border-radius: 4px;
    background: var(--red);
    color: #fff;
    font-size: 13px;
    text-decoration: none;
}
.submit-time:hover { background: var(--red-hover); }
.table-scroll { width: 100%; margin-top: 14px; overflow-x: auto; }
table { width: 100%; min-width: 760px; border-collapse: collapse; }
th { padding: 7px 10px; background: var(--red); color: var(--text); font-size: 13px; text-align: left; }
td { padding: 7px 10px; font-size: 13px; }
td a { text-decoration: none; }
td a:hover { text-decoration: underline; }
.rank { width: 64px; }
.time { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Put the row colour onto every cell. This avoids collapsed-table painting
   quirks where only the cell directly under the pointer appeared highlighted. */
tbody tr {
    --row-bg: #242424;
    --row-hover: #111111;
    color: #A3A3A3;
}

tbody tr > td {
    background-color: var(--row-bg);
    transition: background-color 90ms linear;
}

tbody tr:hover > td,
tbody tr:focus-within > td {
    background-color: var(--row-hover) !important;
}

tbody tr > td:first-child {
    border-left: 3px solid transparent;
}

.tier-1 {
    --row-bg: #3b3115;
    --row-hover: #51431b;
    color: #fff83d;
}
.tier-1 > td:first-child { border-left-color: #e7db28; }

.tier-2 {
    --row-bg: #545454;
    --row-hover: #626262;
    color: #e0e0e0;
}
.tier-2 > td:first-child { border-left-color: #dbdbdb; }

.tier-3 {
    --row-bg: #321e06;
    --row-hover: #49300e;
    color: #f7941c;
}
.tier-3 > td:first-child { border-left-color: #f7941c; }

/* Match the original MarioRuns leaderboard: regular runs alternate between
   the two dark grey row colours used by the 2015 site. */
.tier-4:nth-child(even) { --row-bg: #2E2E2E; }
.tier-4:nth-child(odd) { --row-bg: #242424; }
.tier-4 a { color: #A3A3A3; }

.verified { color: #77d68a; font-weight: 700; }
.notice, .error { margin: 16px 0; padding: 12px 14px; border: 1px solid var(--border); background: rgba(255,255,255,.04); font-size: 14px; }
.error { border-color: #7a2630; }
.error p { margin: 6px 0 0; }
code { padding: 2px 5px; background: #111; }
.source-note { margin: 16px 2px 0; color: var(--muted); font-size: 12px; }
.source-note a { color: var(--text); }
.site-footer { height: 34px; background: #2e2e2e; text-align: center; }
.site-footer p { margin: 0; padding-top: 8px; font-size: 12px; }

@media (max-width: 760px) {
    .site-header, .banner { height: 150px; }
    .banner { background-size: auto 150px; }
    .layout { grid-template-columns: 1fr; }
    .navigation { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
    .navigation h2 { grid-column: 1 / -1; margin: 0; }
    .navigation h2:not(:first-child) { margin-top: 12px; }
    .leaderboard-heading { align-items: flex-start; flex-direction: column; }
}

/* Player country and console-region flags */
.player-cell,
.platform-cell {
    white-space: nowrap;
}

.runner-name {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.platform-cell {
    vertical-align: middle;
}

.runner-separator {
    color: #777;
}

.flag-icon {
    display: block;
    width: 20px;
    height: 14px;
    flex: 0 0 20px;
    object-fit: fill;
    border: 0;
    outline: 0;
    box-shadow: none;
}

/* Speedrun.com profile colours */
.runner-link {
    font-weight: 600;
    text-decoration: none;
}

.runner-link-gradient {
    color: var(--runner-colour-from, currentColor);
    background-image: linear-gradient(90deg, var(--runner-colour-from), var(--runner-colour-to));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.runner-link:hover {
    text-decoration: underline;
    text-decoration-color: currentColor;
}

/* Compact platform labels */
.platform-label {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
    min-width: 42px;
}

.platform-main {
    white-space: nowrap;
}

.platform-label small {
    color: #9a9a9a;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: .08em;
    line-height: 1;
    text-transform: uppercase;
}

/* Speedrun.com-style run comment bubble and hover/focus tooltip */
.comment-heading,
.comment-cell {
    width: 34px;
    padding-left: 4px;
    padding-right: 4px;
    text-align: center;
}

.comment-trigger {
    position: relative;
    display: inline-block;
    width: 20px;
    height: 20px;
    vertical-align: middle;
    cursor: help;
}

.comment-trigger > span,
.comment-trigger > span::after {
    position: absolute;
    display: block;
    content: '';
}

.comment-trigger > span {
    top: 4px;
    left: 3px;
    width: 12px;
    height: 10px;
    border: 1px solid #aeb8d2;
    border-radius: 50%;
}

.comment-trigger > span::after {
    right: -2px;
    bottom: -2px;
    width: 4px;
    height: 4px;
    border-right: 1px solid #aeb8d2;
    border-bottom: 1px solid #aeb8d2;
    transform: rotate(18deg);
}

.comment-trigger:hover > span,
.comment-trigger:focus-visible > span,
.comment-trigger:hover > span::after,
.comment-trigger:focus-visible > span::after {
    border-color: #fff;
}

.comment-trigger:focus-visible {
    outline: 1px solid #fff;
    outline-offset: 2px;
}

.comment-tooltip {
    position: fixed;
    z-index: 1000;
    width: min(460px, calc(100vw - 20px));
    max-height: min(620px, calc(100vh - 20px));
    overflow: auto;
    padding: 12px;
    border: 1px solid #5c5c5c;
    border-radius: 3px;
    background: #171717;
    color: #ddd;
    box-shadow: 0 14px 50px rgba(0, 0, 0, .8);
}

.comment-tooltip[hidden] {
    display: none;
}

.comment-tooltip-title {
    margin-bottom: 8px;
    padding-bottom: 7px;
    border-bottom: 1px solid #353535;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.comment-text {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-size: 13px;
    line-height: 1.5;
}

.comment-link {
    color: #72aaff;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.comment-link:hover,
.comment-link:focus-visible {
    color: #a8c8ff;
}

.comment-media {
    display: grid;
    gap: 10px;
    margin-top: 11px;
}

.comment-video {
    position: relative;
    width: 100%;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    border: 1px solid #3c3c3c;
    background: #000;
}

.comment-video iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* v7: preserve table-cell layout for platform cells and remove flag export seam. */


/* v8: keep the region flag and platform text on a single horizontal line. */
.platform-value {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    vertical-align: middle;
}

.platform-value .flag-icon {
    display: inline-block;
    flex: 0 0 20px;
}

.platform-value .platform-label {
    vertical-align: middle;
}
