/* The stats pages' look, shared by every server's Hall of Fame and Player List.
 * Source: wrapper templates/stats.css; scripts/stats-generator.js copies it beside each page.
 * Each server's accent (--accent) and background (--bg-1) come from the theme block of the
 * sites' site.css (generated from config.json), which the page loads as menu.css. */

body {
    font-family: 'Press Start 2P', monospace !important;
    background-color: #000;
    background-image: linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.8)), var(--bg-1) !important;
    background-size: cover !important;
    background-position: center !important;
    background-attachment: fixed !important;
    background-repeat: no-repeat !important;
    color: white !important;
    line-height: 1.7 !important;
    text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.5) !important;
}
a { color: var(--accent); }

/* --- HEADER, SEARCH, LAST UPDATED --- */
.top-left-header { position: fixed; top: 20px; left: 20px; z-index: 1000; }
.header-wrapper { position: relative; display: inline-block; }
.top-left-header a { color: white !important; text-decoration: none !important; font-size: 1.3em !important; }
.top-left-header a:hover { color: var(--accent) !important; }
.splash-text {
    position: absolute; right: -40px; bottom: -20px; color: #ffff00; font-size: 0.6em;
    transform: rotate(-15deg); text-shadow: 2px 2px 0px #3f3f00;
    animation: splash-pulse 0.4s infinite alternate; white-space: nowrap; pointer-events: none;
}
@keyframes splash-pulse { from { transform: rotate(-15deg) scale(1); } to { transform: rotate(-15deg) scale(1.1); } }

.search-widget { position: fixed; top: 20px; right: 20px; z-index: 100; width: 300px; }
#playerSearch, #hof-search {
    width: 100%; padding: 15px; font-family: 'Press Start 2P', monospace; font-size: 0.65em;
    background-color: rgba(20, 20, 20, 0.95); color: #fff; border: 2px solid #555;
    outline: none; box-sizing: border-box; text-shadow: 2px 2px 0px #000; transition: border-color 0.2s;
}
#hof-search { padding: 12px; }
#playerSearch::placeholder, #hof-search::placeholder { color: #888; text-shadow: none; }
#playerSearch:focus, #hof-search:focus { border-color: var(--accent); box-shadow: 0 0 10px var(--accent); }

.update-info { position: fixed; top: 85px; right: 20px; text-align: right; font-size: 0.7em; color: #999; z-index: 10; }
.update-info time { color: var(--accent); }

/* --- TABS --- */
.nav-tabs { border-bottom: 2px solid var(--accent) !important; margin-top: 150px; }
.nav-tabs .nav-link { color: #ccc !important; border: none !important; font-size: 0.8em !important; }
.nav-tabs .nav-link:hover { border: none !important; background-color: rgba(0,0,0,0.3) !important; }
.nav-tabs .nav-link.active { background-color: rgba(10,10,10,0.95) !important; border: 2px solid var(--accent) !important; border-bottom: none !important; color: #fff !important; }

/* --- BOXES AND TILES --- */
@keyframes fadeUp { 0% { opacity: 0; transform: translateY(30px); } 100% { opacity: 1; transform: translateY(0); } }
.round-box, .mcstats-entry {
    background-color: rgba(10, 10, 10, 0.95) !important;
    border: 4px solid #444 !important;
    image-rendering: pixelated !important;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease !important;
    animation: fadeUp 0.6s ease-out both;
}
.mcstats-entry:hover {
    transform: scale(1.03) translateY(-5px);
    box-shadow: 0px 10px 20px rgba(0,0,0,0.7), 0 0 15px var(--accent) !important;
    border-color: var(--accent) !important;
    z-index: 10;
}
.mcstats-entry table { width: 100%; table-layout: fixed; }
.mcstats-entry td { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; font-size: 0.8em; }
.hof-r { width: 15%; text-align: center; font-weight: bold; }
.hof-p { width: 50%; }
.hof-v { width: 35%; text-align: right; }
.hof-title { font-size: 0.7em; }
a.player-name, a.player-name:visited { color: inherit; text-decoration: none; }
a.player-name:hover, a.player-name:focus { color: var(--accent); text-decoration: underline; }

/* --- EVERY BLOCK, ITEM AND MOB (drawn by the page as you scroll) --- */
.hof-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.hof-head h2 { font-size: 1em; }
.hof-count { color: #999; font-size: 0.65em; }
.hof-kinds { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.hof-kind { font-family: 'Press Start 2P', monospace; font-size: 0.6em; color: #ccc; background: rgba(20,20,20,0.95); border: 2px solid #555; padding: 8px 10px; cursor: pointer; text-shadow: 2px 2px 0 #000; }
.hof-kind span { color: #888; }
.hof-kind:hover, .hof-kind.active { border-color: var(--accent); color: #fff; }

/* --- PLAYER LIST --- */
.players-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.players-head h1 { font-size: 1.2em; margin: 0; }
.players-count { color: #999; font-size: 0.65em; }
.players-table th { white-space: nowrap; }
.players-table th button { all: unset; cursor: pointer; }
.players-table th button:hover, .players-table th button:focus-visible { color: var(--accent); }
.players-table th[aria-sort] button::after { content: ' \25BC'; font-size: 0.7em; color: var(--accent); }
.players-table th[aria-sort="ascending"] button::after { content: ' \25B2'; }
.players-table td.pl-when { font-size: 0.8em; }
.players-table .pl-name img { margin-right: 10px; vertical-align: middle; }
.players-table .pl-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 0; width: 34%; }
.players-sort { display: none; color: #999; font-size: 0.65em; }
.players-sort select { font-family: inherit; font-size: 1em; color: #fff; background: rgba(20, 20, 20, 0.95); border: 2px solid #555; padding: 6px; margin-left: 6px; }
.players-sort select:focus { outline: 0; border-color: var(--accent); }
#players-more { margin-top: 12px; }

/* Narrower screens: each player is a two-line row (the six columns do not fit) */
@media (max-width: 899.98px) {
    .players-box { padding: 14px !important; }
    .players-sort { display: block; width: 100%; }
    .players-table thead { display: none; }
    .players-table, .players-table tbody { display: block; width: 100%; }
    .players-table tbody tr { display: grid; grid-template-columns: 2.6em minmax(0, 1fr) auto auto; column-gap: 10px; row-gap: 4px; align-items: center; padding: 10px 0; border-bottom: 1px dashed #444; }
    .players-table tbody tr > * { padding: 0 !important; border: 0 !important; background: none; }
    .players-table .pl-rank { grid-column: 1; grid-row: 1 / span 2; }
    .players-table .pl-name { grid-column: 2 / 4; grid-row: 1; max-width: none; width: auto; font-size: 0.8em; }
    .players-table .pl-time { grid-column: 4; grid-row: 1; font-size: 0.75em; }
    .players-table .pl-when { grid-column: 2; grid-row: 2; text-align: left !important; font-size: 0.55em !important; color: #aaa; }
    .players-table .pl-deaths { grid-column: 3; grid-row: 2; font-size: 0.55em; }
    .players-table .pl-adv { grid-column: 4; grid-row: 2; font-size: 0.55em; }
    .players-table .pl-deaths::before, .players-table .pl-adv::before { content: attr(data-label) ' '; color: #888; }
    .players-table tr.you-row { background: rgba(var(--accent-rgb, 85, 255, 85), 0.18); }
    .players-table tr.you-row > * { background: none !important; }   /* one band for the row, not a patch per cell */
}

/* --- PHONES --- */
@media (max-width: 900px) {
    .search-widget { position: relative; top: 0; right: 0; width: 100%; margin-bottom: 30px; margin-top: 80px; z-index: 50; }
    .update-info { position: static; text-align: left; margin-bottom: 20px; }
    .top-left-header { position: absolute; top: 10px; left: 10px; }   /* pinned, it covered the cards when scrolling */
    .top-left-header a { font-size: 1em; }
    .splash-text { right: 12px; font-size: 0.5em; }   /* further out, its pulse would hang past a phone's edge */
}

/* --- SUPERFLAT (stats.js adds the class and the moving background) --- */
body.superflat-theme { cursor: url('https://sams.tj/assets/cursor.png'), auto !important; }
body.superflat-theme a,
body.superflat-theme button,
body.superflat-theme input,
body.superflat-theme .nav-link,
body.superflat-theme .site-menu,
body.superflat-theme .roaming-slime { cursor: url('https://sams.tj/assets/diamond_sword.png'), pointer !important; }

#bg-slideshow { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: -2; background-color: #000; }
.bg-slide { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-size: cover; background-position: center; object-fit: cover; opacity: 0; transition: opacity 2s ease-in-out; }
.bg-slide.active { opacity: 1; }
#vignette-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: -1; pointer-events: none; background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.8)); }

body.superflat-theme .crt-effect { position: relative; overflow: hidden; }
body.superflat-theme .crt-effect::after { content: " "; display: block; position: absolute; top: 0; left: 0; bottom: 0; right: 0; background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06)); z-index: 2; background-size: 100% 4px, 3px 100%; pointer-events: none; }

.slime-splat { position: absolute; width: 30px; height: 30px; background: radial-gradient(circle, #55ff55 20%, transparent 70%); border-radius: 50%; pointer-events: none; z-index: 9999; transform: translate(-50%, -50%) scale(0.5); opacity: 0.8; animation: splat-anim 0.4s ease-out forwards; }
@keyframes splat-anim { 0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0.8; } 100% { transform: translate(-50%, -50%) scale(2); opacity: 0; } }

.falling-sapling { position: fixed; top: -50px; z-index: 9999; pointer-events: none; width: 32px; height: 32px; image-rendering: pixelated; animation: fall-to-void 3.5s ease-in forwards; }
@keyframes fall-to-void { 0% { top: -50px; transform: rotate(0deg); } 100% { top: 110vh; transform: rotate(180deg); } }

.roaming-slime { position: fixed; z-index: 9000; width: 40px; height: 40px; image-rendering: pixelated; animation: slime-move-x 15s linear forwards, slime-hop 2s infinite; }
@keyframes slime-move-x { 0% { left: -50px; } 100% { left: 100vw; } }
@keyframes slime-hop { 0%, 100% { transform: translateY(0) scaleY(1); } 50% { transform: translateY(-20px) scaleY(1.1); } 80% { transform: translateY(0) scaleY(0.8); } }
.mini-slime { position: fixed; z-index: 9000; width: 20px; height: 20px; pointer-events: none; image-rendering: pixelated; transition: all 0.5s ease-out; }

/* --- YOUR STATS: the sidebar beside the Hall of Fame (stats.js youPanel) --- */
.hof-layout { display: block; }
.hof-tools { display: flex; justify-content: flex-end; margin-bottom: 14px; }
.hof-of { margin-left: auto; padding-left: 8px; font-size: 0.55em; color: #888; white-space: nowrap; }
.mcstats-entry:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.mcstats-entry tr.you-row td { background: rgba(var(--accent-rgb, 85, 255, 85), 0.18) !important; }
.mcstats-entry tr.you-row .player-name { color: var(--accent); }
.mcstats-entry tbody tr:first-child td { background: rgba(255, 204, 0, 0.07); }
.players-table tr.you-row > * { background: rgba(var(--accent-rgb, 85, 255, 85), 0.18) !important; }
.players-table tr.you-flash > * { animation: you-flash 1.6s ease-out; }
@keyframes you-flash { 0%, 40% { background: rgba(var(--accent-rgb, 85, 255, 85), 0.55); } }

.hof-you { font-size: 0.62em; padding: 16px !important; animation: none !important; }
.you-title { display: flex; align-items: center; gap: 8px; color: var(--accent); font-size: 1.1em; margin-bottom: 12px; }
.you-change, .you-fold, .you-more { all: unset; cursor: pointer; font-size: 0.75em; color: #888; border: 2px solid #444; padding: 3px 6px; }
.you-change { margin-left: auto; }
.you-title .you-fold:first-child, .you-title > .you-fold:only-of-type { margin-left: auto; }
.you-change:hover, .you-fold:hover, .you-more:hover, .you-change:focus-visible, .you-fold:focus-visible, .you-more:focus-visible { color: #fff; border-color: var(--accent); }
.you-who { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; font-size: 1.1em; }
.you-who img { border: 2px solid #444; }
.you-note, .you-hint { color: #aaa; line-height: 1.8; }
.you-hint { color: #888; }
.you-pick { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 14px; }
.you-pick label { color: #ddd; }
.you-pick input { font-family: inherit; font-size: 1em; padding: 10px; color: #fff; background: rgba(20, 20, 20, 0.95); border: 2px solid #555; outline: none; }
.you-pick input:focus { border-color: var(--accent); box-shadow: 0 0 10px var(--accent); }
.you-pick .hof-kind { font-size: 1em; }

.you-focus { border: 2px solid var(--accent); background: rgba(0, 0, 0, 0.45); padding: 12px; margin-bottom: 14px; animation: you-pop 0.25s ease-out; }
@keyframes you-pop { from { transform: scale(0.96); opacity: 0.4; } to { transform: none; opacity: 1; } }
.you-focus-head { display: flex; align-items: center; gap: 10px; color: #5ff; margin-bottom: 10px; line-height: 1.6; }
.you-value { font-size: 1.6em; color: #ffa; margin: 0 0 6px; }
.you-line { margin: 0 0 8px; color: #ddd; }
.you-cheer { margin: 8px 0 0; color: #aaa; line-height: 1.7; }
.you-bar { height: 10px; background: #222; border: 2px solid #444; }
.you-bar i { display: block; height: 100%; background: var(--accent); box-shadow: 0 0 8px var(--accent); transition: width 0.4s ease-out; }
.you-place { color: #fff; }
.you-place.place-1 { color: #fc0; } .you-place.place-2 { color: #ddf; } .you-place.place-3 { color: #a80; }

.you-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.you-stats div { background: rgba(0, 0, 0, 0.4); border: 2px solid #333; padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.you-stats span { color: #888; font-size: 0.8em; }
.you-stats b { color: #ffa; font-weight: normal; }
.you-stats em { color: #aaa; font-style: normal; font-size: 0.85em; }
.you-sub { color: #888; margin-bottom: 6px; }
.you-best { list-style: none; margin: 0; padding: 0; }
.you-best-title { margin-left: 8px; }
.you-best button { all: unset; cursor: pointer; display: block; width: 100%; box-sizing: border-box; padding: 6px 4px; border-bottom: 1px dashed #333; line-height: 1.6; color: #ddd; }
.you-best button:hover, .you-best button:focus-visible { color: var(--accent); background: rgba(255, 255, 255, 0.04); }

/* Wide screens (from 992px, which a laptop at 125-150% display scaling still is): the sidebar left of the cards,
   staying in view while scrolling */
@media (min-width: 992px) {
    .hof-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 20px; align-items: start; }
    .hof-you { order: -1; position: sticky; top: 20px; max-height: calc(100vh - 220px); overflow-y: auto; }   /* stats.js fit() keeps it above the corner menu */
    .you-fold, .you-more { display: none; }
}
@media (min-width: 1400px) { .hof-layout { grid-template-columns: 300px minmax(0, 1fr); gap: 24px; } }
/* Narrower screens: a panel at the bottom right, clear of the corner menu; folds down to its title */
@media (max-width: 991.98px) {
    .hof-you { position: fixed; right: 8px; bottom: 8px; z-index: 1500; width: min(360px, calc(100vw - 130px)); max-height: 55vh; overflow-y: auto; box-shadow: 0 0 20px rgba(0, 0, 0, 0.8); }
    .hof-you { max-height: 45vh; }
    .hof-you.you-folded .you-who, .hof-you.you-folded .you-body { display: none; }
    .hof-you.you-folded .you-title { margin-bottom: 0; }
    .hof-you:not(.you-open) .you-summary { display: none; }
    .hof-you:not(.you-open) .you-who { margin-bottom: 8px; }
    .hof-you:not(.you-open) .you-who img { width: 24px; height: 24px; }
    .hof-you.you-folded .you-more { display: none; }
    .you-focus { margin-bottom: 0; }
    .hof-you.you-open .you-focus { margin-bottom: 14px; }
    #content { padding-bottom: 120px; }
}

/* --- PERIODS, LINKS, FILTERS (stats.js) --- */
.hof-tools { justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.hof-periods { display: flex; flex-wrap: wrap; gap: 8px; }
.hof-period.active { background: rgba(var(--accent-rgb, 85, 255, 85), 0.18); }
.hof-note { color: #aaa; font-size: 0.6em; line-height: 1.9; margin: 0 0 14px; min-height: 1px; }
.hof-note b { color: var(--accent); font-weight: normal; }
.hof-estimated { color: #888; }
a.hof-link, a.hof-link:visited { color: inherit; text-decoration: none; }
a.hof-link:hover, a.hof-link:focus-visible { color: var(--accent); text-decoration: underline; }
a.pl-link, a.pl-link:visited { color: inherit; text-decoration: none; }
a.pl-link:hover, a.pl-link:focus-visible { color: var(--accent); text-decoration: underline; }
.mcstats-entry.you-flash, .players-table tr.you-flash > * { animation: you-flash 1.6s ease-out; }
.mcstats-entry.you-flash { box-shadow: 0 0 0 4px var(--accent) !important; }

.pl-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.pl-filter.active { border-color: var(--accent); color: #fff; background: rgba(var(--accent-rgb, 85, 255, 85), 0.18); }
.players-table tr.is-online .player-name::after { content: ''; display: inline-block; width: 8px; height: 8px; margin-left: 8px; background: #5f5; box-shadow: 0 0 6px #5f5; vertical-align: middle; }
.pl-server { display: inline-block; margin-left: 6px; padding: 1px 4px; font-size: 0.6em; color: #000; background: #888; vertical-align: middle; text-transform: uppercase; }
.pl-server[data-server-tag="sams"] { background: #5f5; }
.pl-server[data-server-tag="hardcore"] { background: #f55; }
.pl-server[data-server-tag="skyblock"] { background: #f5f; }
.pl-server[data-server-tag="superflat"] { background: #ff5; }
.pl-server[data-server-tag="earth"] { background: #5ff; }
.pl-server[data-server-tag="mods"] { background: #fa0; }
.players-table .pl-name { max-width: none; }

#stats-toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); z-index: 3000; padding: 10px 14px; font-size: 0.6em; color: #000; background: var(--accent); box-shadow: 0 0 12px var(--accent); opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; }
#stats-toast.show { opacity: 1; transform: translate(-50%, 0); }

.you-alltime { margin-left: auto; font-style: normal; font-size: 0.75em; color: #888; border: 1px solid #444; padding: 2px 4px; }
.you-them { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px; padding-top: 8px; border-top: 1px dashed #444; color: #ddd; }
.you-them b { color: #ffa; font-weight: normal; }
.you-them em { color: #aaa; font-style: normal; }
.you-win { color: var(--accent) !important; }
.you-lose { color: #f88 !important; }
.you-vs { margin-bottom: 14px; }
.you-vs-score { display: grid; grid-template-columns: auto 1fr auto 1fr auto; align-items: center; gap: 6px; background: rgba(0, 0, 0, 0.4); border: 2px solid #333; padding: 8px; }
.you-vs-score b { color: #ffa; font-weight: normal; font-size: 1.3em; }
.you-vs-score span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.you-vs-score span:last-of-type { text-align: right; }
.you-vs-score i { font-style: normal; color: var(--accent); }
.you-unvs { all: unset; cursor: pointer; color: #888; font-size: 0.9em; }
.you-unvs:hover, .you-unvs:focus-visible { color: #fff; }
.you-rival { margin: 0 0 14px; }
.you-row-in { display: flex; gap: 6px; }
.you-row-in input { flex: 1; min-width: 0; }

/* --- HOW THESE STATS WORK --- */
.stats-about { margin: 30px 0 10px; padding: 16px; font-size: 0.6em; line-height: 2; color: #aaa; background: rgba(10, 10, 10, 0.85); border: 2px solid #333; }
.stats-about h2 { font-size: 1.2em; color: #ddd; margin-bottom: 8px; }
.stats-about p { margin: 0; }
