/* Minecraft-style UI. The font has an 8px grid, so sizes are multiples of 8 (16 / 24 / 32 / 48). */
@font-face {
  font-family: 'Minecraft';
  src: url('https://cdn.jsdelivr.net/npm/typeface-minecraft@1.0.0/files/minecraft.woff2') format('woff2'),
       url('https://cdn.jsdelivr.net/npm/typeface-minecraft@1.0.0/files/minecraft.woff') format('woff');
  font-display: swap;
}

:root {
  --font: 'Minecraft', 'Monocraft', 'Courier New', monospace;
  --page: #161616;
  --panel: #202020;
  --panel-hi: #3d3d3d;
  --panel-lo: #0c0c0c;
  --slot: #111;
  --line: #2c2c2c;
  --text: #ffffff;
  --gray: #aaaaaa;
  --dark: #6f6f6f;
  --sh: #3f3f3f;
  --xp: #80ff20;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  font: 16px/24px var(--font); color: var(--text); letter-spacing: 0;
  background-color: var(--page); background-image: var(--noise, none); background-size: 128px 128px; image-rendering: pixelated;
}
body, body * { text-shadow: 0.125em 0.125em 0 var(--sh); }
img, canvas { display: block; image-rendering: pixelated; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; letter-spacing: inherit; }
::selection { background: #3a3aff; color: #fff; }
:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* Minecraft colour codes (text colour + matching 1/4-brightness shadow) */
.c-0 { color: #000000; --sh: #000000; } .c-1 { color: #0000AA; --sh: #00002a; } .c-2 { color: #00AA00; --sh: #002a00; }
.c-3 { color: #00AAAA; --sh: #002a2a; } .c-4 { color: #AA0000; --sh: #2a0000; } .c-5 { color: #AA00AA; --sh: #2a002a; }
.c-6 { color: #FFAA00; --sh: #3f2a00; } .c-7 { color: #AAAAAA; --sh: #2a2a2a; } .c-8 { color: #555555; --sh: #151515; }
.c-9 { color: #5555FF; --sh: #15153f; } .c-a { color: #55FF55; --sh: #153f15; } .c-b { color: #55FFFF; --sh: #153f3f; }
.c-c { color: #FF5555; --sh: #3f1515; } .c-d { color: #FF55FF; --sh: #3f153f; } .c-e { color: #FFFF55; --sh: #3f3f15; }
.c-f { color: #FFFFFF; --sh: #3f3f3f; }
.bold { font-weight: 700; }

/* ---------- Building blocks ---------- */
.panel {
  background: var(--panel); border: 2px solid #000;
  box-shadow: inset 2px 2px 0 var(--panel-hi), inset -2px -2px 0 var(--panel-lo);
  padding: 16px;
}
.inset {
  background: var(--slot); border: 2px solid; border-color: #0a0a0a #4a4a4a #4a4a4a #0a0a0a;
}
.mcbtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 6px 16px; cursor: pointer;
  background: #5a5a5a; border: 2px solid #000; color: #e0e0e0; white-space: nowrap; user-select: none;
  box-shadow: inset 2px 2px 0 #8f8f8f, inset -2px -4px 0 #383838;
}
.mcbtn:hover { background: #6a72b0; box-shadow: inset 2px 2px 0 #a3aae0, inset -2px -4px 0 #3c4170; color: #ffffa0; --sh: #3f3f28; }
.mcbtn:active, .mcbtn.on { background: #2e2e2e; box-shadow: inset 2px 2px 0 #1a1a1a, inset -2px -2px 0 #454545; color: #FFFF55; --sh: #3f3f15; }
.mcbtn.small { min-height: 32px; padding: 2px 10px; }
.mcbtn[disabled] { color: #a0a0a0; cursor: default; background: #2c2c2c; box-shadow: none; }
.field {
  background: #000; border: 2px solid #a0a0a0; color: #e0e0e0; padding: 6px 10px; outline: 0; min-width: 0;
}
.field:focus { border-color: #fff; }
.field::placeholder { color: #707070; text-shadow: none; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 24px;
  padding: 12px clamp(12px, 4vw, 40px); background: rgba(0, 0, 0, .82); border-bottom: 2px solid #000;
  box-shadow: inset 0 -2px 0 #2f2f2f;
}
.brand { font-size: 24px; line-height: 32px; color: #FFAA00; --sh: #3f2a00; }
.search { display: flex; gap: 8px; margin-left: auto; width: min(440px, 100%); }
.search input { flex: 1 1 0; width: 0; min-width: 0; }
.search--top { flex: 1 1 auto; min-width: 0; }
body.landing .search--top { visibility: hidden; }

/* ---------- Layout ---------- */
#app { width: 100%; max-width: 1200px; margin: 0 auto; padding: 24px clamp(12px, 4vw, 40px) 56px; flex: 1; }
.footer { text-align: center; color: var(--dark); --sh: #1c1c1c; padding: 24px 16px 32px; border-top: 2px solid #000; background: rgba(0,0,0,.35); }
.footer a { color: var(--gray); --sh: #2a2a2a; }
.footer a:hover { color: #fff; }
.head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 32px 0 12px; }
.head:first-child { margin-top: 0; }
.head h2 { margin: 0; font-size: 24px; line-height: 32px; font-weight: 400; }
.head span { color: var(--gray); --sh: #2a2a2a; }
.muted { color: var(--gray); --sh: #2a2a2a; }
.dim { color: var(--dark); --sh: #1c1c1c; }

/* ---------- Landing ---------- */
.title-screen { text-align: center; padding: clamp(32px, 9vh, 96px) 0 24px; }
.logo { position: relative; display: inline-block; font-size: 64px; line-height: 64px; color: #FFAA00; --sh: #3f2a00; margin: 0; font-weight: 400; }
.logo { text-shadow: 6px 6px 0 #3f2a00; }
.splash {
  position: absolute; left: calc(100% - 24px); top: 40px; font-size: 16px; color: #FFFF55; --sh: #3f3f15; white-space: nowrap;
  transform: rotate(-16deg); animation: splash .5s ease-in-out infinite alternate;
}
@keyframes splash { to { transform: rotate(-16deg) scale(1.08); } }
.title-screen p { color: var(--gray); --sh: #2a2a2a; margin: 24px 0 32px; }
.search--big { margin: 0 auto; width: min(560px, 100%); }
.search--big input { padding: 8px 12px; }
.recent { margin-top: 48px; }
.recent .label { color: var(--gray); --sh: #2a2a2a; margin-bottom: 8px; }
.slots { display: inline-flex; flex-wrap: wrap; max-width: min(100%, 600px); justify-content: center; padding: 8px; margin-bottom: 8px; }
.slots .slot { width: 56px; height: 56px; padding: 6px; border: 2px solid; border-color: #0a0a0a #4a4a4a #4a4a4a #0a0a0a; background: #1a1a1a; }
.slots .slot:hover { background: #4a4a4a; }
.slots .slot img { width: 40px; height: 40px; }
.examples { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

/* ---------- Profile header ---------- */
.profile { display: grid; grid-template-columns: 288px minmax(0, 1fr); gap: 16px; padding: 16px; }
.skin-col { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.skin-stage { position: relative; height: 368px; display: grid; place-items: center; overflow: hidden; cursor: grab; }
.skin-stage:active { cursor: grabbing; }
.skin-stage canvas { width: 100% !important; height: 100% !important; }
.skin-stage img { max-height: 320px; max-width: 88%; object-fit: contain; }
.skin-stage img.flat { width: 192px; max-height: none; background: repeating-conic-gradient(#222 0% 25%, #1a1a1a 0% 50%) 0 0 / 16px 16px; }
.skin-modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.skin-modes .mcbtn, .skin-links .mcbtn { padding: 2px 6px; min-height: 32px; }
.skin-links { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.loading-text { color: var(--gray); --sh: #2a2a2a; }

.info-col { min-width: 0; display: flex; flex-direction: column; gap: 16px; padding: 8px 8px 8px 16px; }
.name-row { display: flex; gap: 16px; align-items: center; }
.name-row img { width: 64px; height: 64px; flex: none; }
.name { margin: 0; font-size: 32px; line-height: 40px; font-weight: 400; overflow-wrap: anywhere; }
.status { margin-top: 4px; }
.status .dot { display: inline-block; width: 8px; height: 8px; margin-right: 8px; vertical-align: 2px; background: #555; box-shadow: 2px 2px 0 #151515; }
.status.online .dot { background: #55FF55; animation: blink 1.2s steps(2) infinite; }
@keyframes blink { 50% { opacity: .35; } }
.copy { cursor: pointer; border: 0; background: none; padding: 0; color: var(--dark); --sh: #1c1c1c; text-align: left; overflow-wrap: anywhere; }
.copy:hover { color: #fff; --sh: #3f3f3f; }

.xp { text-align: center; }
.xp .lvl { font-size: 24px; line-height: 32px; color: var(--xp); text-shadow: 2px 0 0 #000, -2px 0 0 #000, 0 2px 0 #000, 0 -2px 0 #000; }
.xpbar { position: relative; height: 14px; background: #000; border: 2px solid #000; margin: 4px 0 6px; }
.xpbar i {
  display: block; height: 100%; background: var(--xp); box-shadow: inset 0 -4px 0 #3f9a10;
  animation: fill .8s steps(20) both;
}
.xpbar::after { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 calc(5.555% - 2px), #000 calc(5.555% - 2px) 5.555%); pointer-events: none; }
@keyframes fill { from { width: 0; } }
.xp small { font-size: 16px; color: var(--gray); --sh: #2a2a2a; }

.lines { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); column-gap: 32px; }
.line { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-bottom: 2px solid var(--line); min-width: 0; text-shadow: none; }
.line > span:first-child { color: var(--gray); --sh: #2a2a2a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.line > span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: right; }
.line > * { text-shadow: 0.125em 0.125em 0 var(--sh); }
.links { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; margin: 16px 0 24px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs .mcbtn { flex: 1 0 auto; }
.tabs small { color: var(--gray); --sh: #2a2a2a; font-size: 16px; }
.tabs .on small { color: #FFAA00; --sh: #3f2a00; }

/* ---------- Game cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(256px, 1fr)); gap: 8px; }
.card { display: block; padding: 12px 14px; }
a.card:hover { outline: 2px solid #fff; outline-offset: -2px; }
.card-title { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.swatch { width: 16px; height: 16px; flex: none; background: var(--c); box-shadow: inset -2px -2px 0 rgba(0,0,0,.35), inset 2px 2px 0 rgba(255,255,255,.25), 2px 2px 0 #000; }
.card-title .badge { margin-left: auto; white-space: nowrap; }
.card .line:last-child { border-bottom: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { padding: 2px 10px; background: #111; border: 2px solid #2a2a2a; color: var(--dark); --sh: #1c1c1c; }

/* ---------- Game detail ---------- */
.games-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 16px; align-items: start; }
.gamelist { position: sticky; top: 80px; padding: 8px; max-height: calc(100vh - 100px); overflow-y: auto; scrollbar-width: thin; scrollbar-color: #555 #111; }
.gamelist a { display: flex; align-items: center; gap: 10px; padding: 4px 8px; border: 2px solid transparent; }
.gamelist a:hover { background: #2e2e2e; }
.gamelist a.on { background: #000; border-color: #fff; }
.gamelist a.off { color: var(--dark); --sh: #1c1c1c; }
.gamelist .badge { margin-left: auto; }
.gamelist .sep { color: var(--dark); --sh: #1c1c1c; padding: 12px 8px 4px; }
.detail-head { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.detail-head .swatch { width: 24px; height: 24px; }
.detail-head h2 { margin: 0; font-size: 32px; line-height: 40px; font-weight: 400; }
.detail-head .badge { font-size: 24px; line-height: 32px; }
.boards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; align-items: start; }
.board { padding: 10px 14px 6px; background: rgba(0, 0, 0, .55); border: 2px solid #000; }
.board h4 { margin: 0 0 6px; text-align: center; font-weight: 700; color: #FFFF55; --sh: #3f3f15; }
.board .line { border-bottom-color: #1e1e1e; }
.board .line:last-child { border-bottom: 0; }

.table-wrap { overflow-x: auto; margin-top: 8px; border: 2px solid #000; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 4px 12px; text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { font-weight: 400; color: #FFFF55; --sh: #3f3f15; background: #000; }
tbody tr:nth-child(odd) td { background: #1b1b1b; }
tbody tr:nth-child(even) td { background: #232323; }
tbody tr:hover td { background: #34344a; }

/* ---------- Guild ---------- */
.guild-head { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 24px; align-items: center; }
.guild-head h2 { margin: 0; font-size: 32px; line-height: 40px; font-weight: 400; overflow-wrap: anywhere; }
.guild-head p { margin: 8px 0 0; color: var(--gray); --sh: #2a2a2a; }
.two-col { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 8px; margin-top: 8px; align-items: start; }
.panel h3 { margin: 0; font-size: 16px; font-weight: 400; color: #FFFF55; --sh: #3f3f15; }
.panel .sub { color: var(--dark); --sh: #1c1c1c; margin: 0 0 12px; }

/* bar charts: one series, one colour, square pixel ends */
.vchart { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; height: 176px; align-items: end; border-bottom: 2px solid #555; padding-top: 8px; }
.vcol { height: 100%; display: flex; align-items: flex-end; justify-content: center; cursor: default; }
.vcol i { display: block; width: min(32px, 70%); min-height: 2px; background: #55FF55; box-shadow: inset -4px 0 0 #2fbf2f, inset 0 4px 0 #a0ffa0; animation: rise .6s steps(12) both; }
.vcol:hover i { background: #a0ffa0; }
@keyframes rise { from { transform: scaleY(0); transform-origin: bottom; } to { transform-origin: bottom; } }
.vlabels { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; text-align: center; color: var(--gray); --sh: #2a2a2a; margin-top: 4px; }
.hbars { display: flex; flex-direction: column; gap: 6px; }
.hrow { display: grid; grid-template-columns: 160px minmax(0, 1fr) 72px; gap: 12px; align-items: center; cursor: default; }
.hrow > span { color: var(--gray); --sh: #2a2a2a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hrow > b { font-weight: 400; text-align: right; color: #55FF55; --sh: #153f15; }
.hrow .track { height: 12px; background: #000; }
.hrow .track i { display: block; height: 100%; min-width: 2px; background: #55FF55; box-shadow: inset 0 -4px 0 #2fbf2f; }
.hrow:hover .track i { background: #a0ffa0; }

.rows { display: flex; flex-direction: column; }
.prow { display: flex; align-items: center; gap: 12px; padding: 4px 6px; }
.prow:hover { background: #2e2e2e; }
.prow .pos { width: 48px; color: var(--dark); --sh: #1c1c1c; }
.prow img { width: 24px; height: 24px; }
.prow .gx { margin-left: auto; color: #55FF55; --sh: #153f15; }

.tools { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.tools .field { width: min(320px, 100%); }
.tools select { cursor: pointer; }
.members { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 4px; }
.member { display: flex; align-items: center; gap: 12px; padding: 6px 10px; background: #1b1b1b; border: 2px solid #000; min-width: 0; }
.member:hover { background: #2e2e2e; border-color: #fff; }
.member.me { border-color: #FFAA00; }
.member img { width: 32px; height: 32px; flex: none; }
.member .mi { flex: 1; min-width: 0; }
.member .mn, .member .mr { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member .mn.loading { color: var(--dark); --sh: #1c1c1c; }
.member .mr { color: var(--gray); --sh: #2a2a2a; }
.member .gx { color: #55FF55; --sh: #153f15; white-space: nowrap; }

/* ---------- SkyBlock ---------- */
.profiles { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 16px; }
.skills { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.skill { padding: 10px 12px; background: rgba(0,0,0,.55); border: 2px solid #000; }
.skill .top { display: flex; justify-content: space-between; }
.skill .xpbar { height: 12px; margin: 6px 0 2px; }
.skill .xpbar::after { display: none; }

/* ---------- History ---------- */
.history { display: flex; flex-direction: column; gap: 4px; }
.hist { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 8px 14px; }
.hist .when { text-align: right; }

/* ---------- States ---------- */
.empty { text-align: center; padding: 40px 16px; }
.empty h3 { margin: 0 0 8px; font-size: 24px; line-height: 32px; font-weight: 400; }
.empty p { margin: 0 auto; max-width: 520px; color: var(--gray); --sh: #2a2a2a; }
.error { max-width: 600px; margin: 48px auto; text-align: center; padding: 32px; }
.error img { width: 64px; height: 64px; margin: 0 auto 16px; }
.error h2 { margin: 0 0 8px; font-size: 24px; line-height: 32px; font-weight: 400; color: #FF5555; --sh: #3f1515; }
.error p { color: var(--gray); --sh: #2a2a2a; margin: 0 0 24px; }
.notice { padding: 10px 14px; background: #2a2208; border: 2px solid #000; color: #FFFF55; --sh: #3f3f15; }
.loading { text-align: center; padding: 96px 0; color: var(--gray); --sh: #2a2a2a; }
.loading .bar { width: 240px; height: 12px; margin: 16px auto 0; border: 2px solid #fff; padding: 2px; }
.loading .bar i { display: block; height: 100%; background: #55FF55; animation: load 1.4s steps(16) infinite; }
@keyframes load { from { width: 0; } to { width: 100%; } }

#toast {
  position: fixed; right: 16px; top: 80px; z-index: 50; padding: 12px 16px; transform: translateX(calc(100% + 32px)); transition: transform .2s steps(6);
  background: #212121; border: 2px solid #000; box-shadow: inset 2px 2px 0 #555, inset -2px -2px 0 #0c0c0c; color: #FFFF55; --sh: #3f3f15;
}
#toast.show { transform: none; }
/* Minecraft item tooltip */
#tooltip {
  position: fixed; z-index: 60; pointer-events: none; display: none; padding: 4px 8px; white-space: nowrap;
  background: rgba(16, 0, 16, .94); border: 2px solid #28007f; border-top-color: #5000ff; outline: 2px solid rgba(16, 0, 16, .94);
}
#tooltip.show { display: block; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .profile { grid-template-columns: minmax(0, 1fr); }
  .skin-stage { height: 320px; }
  .info-col { padding: 0; }
  .games-layout { grid-template-columns: minmax(0, 1fr); }
  .gamelist { position: static; max-height: none; display: flex; overflow-x: auto; }
  .gamelist a { flex: none; }
  .gamelist .badge, .gamelist .sep { display: none; }
  .two-col, .guild-head { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .topbar { gap: 12px; }
  .logo { font-size: 48px; line-height: 48px; }
  .splash { left: auto; right: -8px; top: 52px; }
  .name { font-size: 24px; line-height: 32px; }
  .name-row img { width: 48px; height: 48px; }
  .hrow { grid-template-columns: 96px minmax(0, 1fr) 56px; }
  .lines { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- Navigation, server line, credit ---------- */
.nav { display: flex; gap: 20px; }
.nav a { color: var(--gray); --sh: #2a2a2a; }
.nav a:hover { color: #fff; --sh: #3f3f3f; }
.nav a.on { color: #FFFF55; --sh: #3f3f15; }
.server-line { display: inline-flex; align-items: center; gap: 10px; margin-top: 40px; padding: 8px 14px; background: rgba(0, 0, 0, .55); border: 2px solid #000; }
.server-line:hover { outline: 2px solid #fff; outline-offset: -2px; }
.server-line .bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 16px; }
.server-line .bars i { width: 4px; background: #55FF55; box-shadow: 2px 2px 0 #153f15; }
.server-line .bars i:nth-child(1) { height: 4px; } .server-line .bars i:nth-child(2) { height: 7px; }
.server-line .bars i:nth-child(3) { height: 10px; } .server-line .bars i:nth-child(4) { height: 13px; }
.server-line .bars i:nth-child(5) { height: 16px; }
.board-title { text-align: center; font-weight: 700; margin-bottom: 8px; }
@media (max-width: 760px) { .nav { display: none; } }
