:root {
  --bg: #1b1f1a; --panel: #262c24; --line: #3a4237; --text: #e9eee4; --dim: #a3ad9c; --accent: #7bc96f;
  color-scheme: dark;
  font-family: system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
a { color: var(--accent); }
img { image-rendering: pixelated; }
header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .9rem 1.5rem; border-bottom: 3px solid var(--line); background: var(--panel); }
.logo { font: 700 1.4rem ui-monospace, monospace; color: var(--accent); text-decoration: none; letter-spacing: .05em; }
#updated { color: var(--dim); font-size: .85rem; }
main { max-width: 1100px; margin: 0 auto; padding: 1.5rem; }
h2 { margin: 2rem 0 .75rem; font-family: ui-monospace, monospace; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .75rem; }
.tile, .panel, .card { background: var(--panel); border: 2px solid var(--line); border-radius: 4px; }
.tile { padding: .9rem; }
.tile b { display: block; font: 700 1.6rem ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.tile span { color: var(--dim); font-size: .85rem; }

.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: .5rem .6rem; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th button { all: unset; cursor: pointer; color: var(--dim); font-size: .85rem; }
th button:focus-visible { outline: 2px solid var(--accent); }
th button[aria-pressed="true"] { color: var(--accent); font-weight: 700; }
td a { display: inline-flex; align-items: center; gap: .5rem; text-decoration: none; color: var(--text); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 1rem; }
.card { display: flex; flex-direction: column; align-items: center; gap: .4rem; padding: 1.2rem; text-decoration: none;
  color: var(--text); border-top: 6px solid var(--c); transition: transform .1s; }
.card:hover, .card:focus-visible { transform: translateY(-3px); border-color: var(--c); }
.card span { color: var(--dim); font-size: .85rem; }

.hero { display: flex; gap: 1.5rem; align-items: center; flex-wrap: wrap; margin-bottom: 1.5rem;
  padding: 1.5rem; background: var(--panel); border-left: 8px solid var(--c); border-radius: 4px; }
.hero img { width: 160px; height: 160px; border-radius: 4px; }
.hero h1 { margin: 0; font-family: ui-monospace, monospace; color: var(--c); }
.mc { color: var(--dim); margin: .2rem 0 .8rem; font-family: ui-monospace, monospace; }
.links a { margin-right: 1rem; }
.panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; margin-top: 1rem; }
.panel { padding: 1rem; }
.panel h3 { margin: 0 0 .5rem; font-size: 1rem; }
.panel ol { margin: 0; padding: 0; list-style: none; }
.panel li { display: flex; justify-content: space-between; padding: .3rem 0; border-bottom: 1px solid var(--line); text-transform: capitalize; }
.error { color: #ff8a80; }
header nav { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; margin-right: auto; margin-left: 1rem; }
header nav a { color: var(--dim); text-decoration: none; font-weight: 600; }
header nav a:hover, header nav a[aria-current="page"] { color: var(--accent); }
h1 { font-family: ui-monospace, monospace; }
.card span { text-align: center; }

/* themed critter pages */
body.themed { --accent: var(--c); background: linear-gradient(color-mix(in srgb, var(--c) 22%, var(--bg)), var(--bg) 480px) no-repeat, var(--bg); }
.hero { position: relative; overflow: hidden; background: var(--banner, none) center / cover, var(--panel); }
.hero::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, var(--panel) 30%, color-mix(in srgb, var(--panel) 55%, transparent)); }
.hero > * { position: relative; }
.hero img { object-fit: cover; image-rendering: auto; }
h2 small, .mc { font-size: .8rem; font-weight: 400; }

/* badges */
.badges:empty { display: none; }
.badge { display: inline-block; padding: .1rem .45rem; margin-right: .3rem; border-radius: 3px; font: 700 .7rem ui-monospace, monospace; letter-spacing: .05em; }
.badge.live { background: #e5383b; color: #fff; }
.badge.mc { background: #3c7a34; color: #fff; }

/* cards: avatars may be art, not pixel heads */
.card img { width: 128px; height: 128px; object-fit: cover; border-radius: 4px; image-rendering: auto; }
img[src*="mc-heads"] { image-rendering: pixelated; }

/* live now + clips */
.lives, .clips { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.livecard, .clips a { position: relative; display: flex; flex-direction: column; gap: .25rem; padding-bottom: .8rem; text-decoration: none; color: var(--text);
  background: var(--panel); border: 2px solid var(--line); border-radius: 4px; overflow: hidden; }
.livecard { border-color: #e5383b; }
.livecard img, .clips img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; image-rendering: auto; }
.livecard .badge { position: absolute; top: .5rem; left: .5rem; }
.livecard b, .livecard span, .livecard small, .clips b, .clips small { padding: 0 .8rem; }
.livecard small, .clips small { color: var(--dim); }

.empty { color: var(--dim); }

/* minecraft server status + map */
.status { display: flex; flex-wrap: wrap; gap: .4rem 1.5rem; align-items: center; padding: 1rem 1.2rem; background: var(--panel); border: 2px solid var(--line); border-left: 8px solid #777; border-radius: 4px; }
.status.up { border-left-color: var(--accent); }
.status b::before { content: "●"; margin-right: .5rem; color: #777; }
.status.up b::before { color: var(--accent); }
.status span { color: var(--dim); }
.status .online { flex-basis: 100%; color: var(--text); }
code { background: var(--bg); padding: .1rem .4rem; border-radius: 3px; }
#map iframe { width: 100%; height: 520px; border: 2px solid var(--line); border-radius: 4px; }

/* fan art */
.gallery { columns: 3 220px; gap: 1rem; }
.gallery figure { margin: 0 0 1rem; break-inside: avoid; }
.gallery img { width: 100%; border-radius: 4px; image-rendering: auto; }
.gallery figcaption { color: var(--dim); font-size: .85rem; }
#week b { font-size: 1.1rem; overflow-wrap: anywhere; }

/* mods */
.modbar { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.modbar input { flex: 1 1 260px; max-width: 420px; padding: .55rem .8rem; font: inherit; color: var(--text); background: var(--panel); border: 2px solid var(--line); border-radius: 4px; }
.modbar input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
#modcount { color: var(--dim); font-size: .9rem; }
.mods { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: .75rem; }
.mods li { padding: .8rem 1rem; background: var(--panel); border: 2px solid var(--line); border-radius: 4px; }
.mods b a { color: var(--text); }
.mods b a:hover { color: var(--accent); }
.mods small { color: var(--dim); font-family: ui-monospace, monospace; }
.mods p { margin: .4rem 0 0; color: var(--dim); font-size: .88rem; display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.badge.kind { background: var(--line); color: var(--text); text-transform: uppercase; }

/* discord-fed pages */
.shots { columns: 3 280px; gap: 1rem; }
.shot { margin: 0 0 1rem; break-inside: avoid; background: var(--panel); border: 2px solid var(--line); border-radius: 4px; overflow: hidden; }
.shot img { display: block; width: 100%; height: auto; image-rendering: auto; }
.shot figcaption { padding: .6rem .8rem; font-size: .9rem; }
.shot figcaption:empty { display: none; }
.shot figcaption p { margin: 0 0 .4rem; }
.byline { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; color: var(--dim); font-size: .85rem; }
.who { display: inline-flex; align-items: center; gap: .4rem; font-weight: 600; color: var(--text); text-decoration: none; }
a.who { color: var(--c); }
.who img { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; image-rendering: auto; }
.timeline { list-style: none; padding: 0 0 0 1.4rem; margin: 0; border-left: 3px solid var(--line); }
.timeline li { position: relative; margin-bottom: 1.25rem; }
.timeline li::before { content: ""; position: absolute; left: calc(-1.4rem - 8px); top: 1rem; width: 13px; height: 13px; background: var(--accent); border-radius: 2px; }
.timeline article, .issue { padding: 1rem 1.2rem; background: var(--panel); border: 2px solid var(--line); border-radius: 4px; }
.timeline .shots { margin-top: .75rem; }
.issue { max-width: 760px; line-height: 1.6; }
.issue .shots { margin-top: 1rem; }
.issues { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; max-width: 760px; }
.issues a { display: flex; justify-content: space-between; gap: 1rem; padding: .8rem 1rem; background: var(--panel); border: 2px solid var(--line); border-radius: 4px; text-decoration: none; color: var(--text); }
.issues a:hover, .issues a:focus-visible { border-color: var(--accent); }
.issues time { color: var(--dim); white-space: nowrap; }
.mention { color: var(--accent); font-weight: 600; }
.emoji { width: 1.4em; height: 1.4em; vertical-align: -.3em; image-rendering: auto; }
.spoiler { background: var(--text); color: transparent; border-radius: 3px; cursor: pointer; }
.spoiler:hover, .spoiler:focus { background: var(--line); color: var(--text); }
blockquote { margin: .5rem 0; padding-left: .8rem; border-left: 4px solid var(--line); color: var(--dim); }
pre { overflow-x: auto; padding: .75rem; background: var(--bg); border-radius: 4px; }

/* sessions, advancements, history */
.seen { color: var(--dim); font-size: .9rem; }
.feed { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; }
.feed li { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; padding: .55rem .8rem; background: var(--panel); border: 2px solid var(--line); border-radius: 4px; }
.feed .who img { border-radius: 2px; image-rendering: pixelated; }
.feed time { margin-left: auto; color: var(--dim); font-size: .85rem; }
.advs { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .5rem; }
.advs li { display: flex; flex-direction: column; padding: .55rem .8rem; background: var(--panel); border: 2px solid var(--line); border-radius: 4px; }
.advs small { color: var(--dim); text-transform: capitalize; }
.picker { display: block; margin-bottom: .6rem; color: var(--dim); font-size: .9rem; }
.picker select { font: inherit; color: var(--text); background: var(--bg); border: 2px solid var(--line); border-radius: 4px; padding: .2rem .4rem; }
#chart svg { display: block; width: 100%; height: auto; }
#chart .bar { fill: var(--accent); }
#chart .hit { fill: transparent; }
#chart g:hover .bar { fill: color-mix(in srgb, var(--accent) 70%, var(--text)); }
#chart .axis { stroke: var(--line); stroke-width: 1; }
#chart text { fill: var(--dim); font: 12px ui-monospace, monospace; }

/* OBS overlay */
body.overlay { background: transparent; }
#overlay { display: inline-flex; gap: .8rem; align-items: center; margin: 0; padding: .7rem 1rem; max-width: none;
  background: color-mix(in srgb, var(--panel) 85%, transparent); border-left: 6px solid var(--c); border-radius: 4px; }
#overlay img { width: 64px; height: 64px; image-rendering: pixelated; }
#overlay b { font: 700 1.2rem ui-monospace, monospace; color: var(--c); margin-right: .5rem; }
#overlay span:not(.badge) { display: block; color: var(--text); font-size: .9rem; }

/* phones: logo + updated time on one row, the menu on its own full-width row below */
@media (max-width: 640px) {
  header { padding: .6rem 1rem; gap: .2rem 1rem; }
  header nav { order: 3; flex-basis: 100%; margin: 0; display: grid; grid-template-columns: repeat(3, max-content); gap: 0 1.4rem; }
  header nav a { padding: .45rem 0; } /* bigger tap targets */
  #updated { font-size: .75rem; text-align: right; }
  main { padding: 1rem; }
}

/* mod pack download */
.pack { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin-bottom: 1.25rem; padding: 1rem 1.2rem; background: var(--panel); border: 2px solid var(--line); border-left: 8px solid var(--accent); border-radius: 4px; }
.download { display: inline-block; padding: .6rem 1.1rem; background: var(--accent); color: var(--bg); font-weight: 700; text-decoration: none; border-radius: 4px; }
.download:hover, .download:focus-visible { filter: brightness(1.1); outline: 2px solid var(--text); outline-offset: 2px; }
.pack span { color: var(--dim); font-size: .9rem; }
.pack p { flex-basis: 100%; margin: 0; color: var(--dim); font-size: .88rem; }

/* hall of fame */
.tile.fame { display: flex; flex-direction: column; gap: .15rem; text-decoration: none; color: var(--text); border-top: 4px solid var(--c); }
.tile.fame:hover, .tile.fame:focus-visible { border-color: var(--c); }
.tile.fame b { font-size: 1.1rem; overflow-wrap: anywhere; color: var(--c); }

/* leaderboard: phones show the critter plus the picked stat */
.boardpick { display: none; }
th.sel button { color: var(--accent); }
@media (max-width: 640px) {
  .boardpick { display: block; }
  #board th:not(:first-child):not(.sel), #board td:not(:first-child):not(.sel) { display: none; }
}
