/* Noktus – dark, Minecraft-flavoured UI */

:root {
  --bg: #0f0d15;
  --panel: #1b1824;
  --panel-2: #24202f;
  --slot: #0b0a10;
  --line: #000;
  --text: #ece8f5;
  --muted: #9a93ad;
  --green: #3c8527;
  --green-hi: #4fa833;
  --stone: #5d5d66;
  --stone-hi: #74747e;
  --purple: #a970ff;
  --gold: #ffaa00;
  --red: #ff5555;
  --aqua: #55ffff;
  --yellow: #ffff55;
  --font-pixel: 'Noktus Pixel', 'Courier New', monospace;
  --font-body: 'Noktus Pixel', ui-monospace, Menlo, monospace;
  --bevel: inset 2px 2px 0 rgba(255, 255, 255, .09), inset -2px -2px 0 rgba(0, 0, 0, .45);
  --shadow: 0 6px 0 rgba(0, 0, 0, .35);
  color-scheme: dark;
}

* { box-sizing: border-box; }

/* scrollbars like a Minecraft slider (desktop only; phones keep their own thin overlay bars) */
@media (hover: hover) and (pointer: fine) {
  ::-webkit-scrollbar { width: 14px; height: 14px; }
  ::-webkit-scrollbar-track { background: var(--slot); box-shadow: inset 2px 2px 0 rgba(0, 0, 0, .5), inset -2px -2px 0 rgba(255, 255, 255, .06); }
  ::-webkit-scrollbar-thumb { background: var(--stone); border: 2px solid #000; box-shadow: inset 2px 2px 0 rgba(255, 255, 255, .25), inset -2px -2px 0 rgba(0, 0, 0, .4); }
  ::-webkit-scrollbar-thumb:hover { background: var(--stone-hi); }
  ::-webkit-scrollbar-thumb:active { background: #8b8b96; }
  ::-webkit-scrollbar-corner { background: var(--slot); }
  ::-webkit-scrollbar-button { display: none; }
  /* the page always has its scrollbar (empty on short pages), so nothing jumps sideways when switching pages; while a
     dialog locks the page (overflow hidden below), the same room stays free (scrollbar-gutter doesn't work with these bars) */
  html { overflow-y: scroll; }
  @supports not (-moz-appearance: none) { html:has(dialog[open]) { padding-right: 14px; } }
  /* Firefox only knows colors (Chrome would ignore the rules above if it saw scrollbar-color) */
  @supports (-moz-appearance: none) { * { scrollbar-color: var(--stone) var(--slot); } }
}

html { scroll-behavior: smooth; touch-action: manipulation; } /* no zoom on double tap, pinch still works */
body {
  margin: 0;
  /* app.html reaches under the iPhone notch (viewport-fit=cover, for the Noktagram bar); keep the content beside it */
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font: 16px/1.65 var(--font-body);
  color: var(--text);
  background-color: var(--bg);
  background-image:
    linear-gradient(180deg, rgba(15, 13, 21, .80), rgba(15, 13, 21, .94)),
    url('/img/deepslate.png');
  background-size: auto, 128px 128px;
  image-rendering: pixelated;
}
img { image-rendering: pixelated; }
.px-icon { width: 18px; height: 18px; flex: none; display: inline-block; vertical-align: -3px; }
.px-icon.inline { width: 14px; height: 14px; margin-right: .35rem; vertical-align: -2px; }
.btn .px-icon { width: 16px; height: 16px; }
.prose img { image-rendering: auto; }
a { color: var(--purple); }
a:hover { color: #c9a6ff; }
h1, h2, h3, h4 { font-family: var(--font-pixel); font-weight: 400; line-height: 1.2; margin: 0 0 .6em; letter-spacing: .5px; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
code, .mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: .92em; }
hr { border: 0; border-top: 2px solid #000; box-shadow: 0 2px 0 rgba(255, 255, 255, .05); margin: 1.5rem 0; }
.mc-shadow { text-shadow: 2px 2px 0 #000; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hidden { display: none !important; }
.center { text-align: center; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 1rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.grow { flex: 1; }

.container { width: 100%; max-width: 1600px; margin: 0 auto; padding: 0 clamp(16px, 2.5vw, 40px); }
main { flex: 1; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(12, 10, 17, .92);
  backdrop-filter: blur(6px);
  border-bottom: 3px solid #000;
  box-shadow: 0 2px 0 rgba(169, 112, 255, .15);
}
.site-header .container { display: flex; align-items: center; gap: 1rem; height: 60px; }
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--text); font-family: var(--font-pixel); font-size: 1.35rem; font-weight: 400; text-shadow: 2px 2px 0 #000; }
.brand img { width: 32px; height: 32px; border: 2px solid #000; }
.brand:hover { color: #fff; }
.brand b { font-weight: 400; color: var(--gold-soft); }
.brand.brand-gram img { border: 0; }
.nav [data-gram] .count { background: var(--red); color: #fff; font-size: .72rem; padding: 0 .35rem; border: 2px solid #000; text-shadow: none; margin-left: .4rem; }
.nav [data-gram] .count[hidden] { display: none; }
.nav { display: flex; gap: .25rem; margin-left: auto; align-items: center; }
.nav a { color: var(--text); text-decoration: none; font-family: var(--font-pixel); padding: .35rem .7rem; text-shadow: 2px 2px 0 #000; }
.nav a:hover, .nav a.active { color: var(--yellow); }
.lang-toggle { display: flex; border: 2px solid #000; box-shadow: var(--bevel); margin-left: .5rem; }
.lang-toggle button { background: var(--panel-2); color: var(--muted); border: 0; font-family: var(--font-pixel); padding: .25rem .5rem; cursor: pointer; }
.lang-toggle button.on { background: var(--purple); color: #fff; text-shadow: 1px 1px 0 #000; }
.site-header .menu-btn { display: none; }
@media (max-width: 760px) {
  .site-header .menu-btn { display: inline-flex; margin-left: auto; }
  .nav { display: none; position: absolute; top: 60px; left: 0; right: 0; flex-direction: column; align-items: stretch; background: #0c0a11; border-bottom: 3px solid #000; padding: .5rem 16px 1rem; }
  .nav.open { display: flex; max-height: calc(100dvh - 60px); overflow-y: auto; }
  .lang-toggle { margin: .5rem 0 0; align-self: flex-start; }
  /* the pages of the player area / admin dashboard, indented under their link (instead of the sidebar) */
  .nav a[data-area] { display: flex; justify-content: space-between; align-items: center; }
  .nav a[data-area]::after { content: '▸'; color: var(--muted); }
  .nav a[data-area]:has(+ .nav-sub.open)::after { content: '▾'; }
  .nav-sub.open:not(:empty) { display: flex; flex-direction: column; margin: 0 0 .4rem 1.1rem; padding-left: .5rem; border-left: 2px solid #2c2638; }
  .nav-sub a { display: flex; align-items: center; gap: .6rem; padding: .55rem .7rem; font-size: .95rem; }
  .nav-sub a .px-icon { opacity: .75; }
  .nav-sub a.active .px-icon { opacity: 1; }
  .nav-sub a.disabled { opacity: .35; }
  .nav-sub .count { background: var(--red); color: #fff; font-size: .72rem; padding: 0 .35rem; border: 2px solid #000; text-shadow: none; }
}
.nav-sub { display: none; }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font: 400 1rem var(--font-pixel);
  color: #fff; text-shadow: 2px 2px 0 #333; text-decoration: none;
  background: var(--stone);
  border: 2px solid #000;
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, .25), inset -2px -3px 0 rgba(0, 0, 0, .35);
  padding: .55rem 1.1rem;
  cursor: pointer; user-select: none;
  min-height: 42px;
}
.btn:hover { background: var(--stone-hi); color: var(--yellow); }
.btn:active { box-shadow: inset 2px 2px 0 rgba(0, 0, 0, .35); }
.btn:disabled { opacity: .5; cursor: not-allowed; color: #ccc; }
.btn.primary { background: var(--green); }
.btn.primary:hover { background: var(--green-hi); }
.btn.purple { background: #7a4fc0; }
.btn.purple:hover { background: #8e60d8; }
.btn.danger { background: #a33232; }
.btn.danger:hover { background: #c03c3c; }
.btn.small { min-height: 32px; padding: .25rem .65rem; font-size: .9rem; }
.btn.ghost { background: transparent; box-shadow: none; border-color: #3a3546; }
.btn.ghost:hover { background: var(--panel-2); }
.btn.block { width: 100%; }

label { display: block; font-weight: 600; margin-bottom: .3rem; }
.field { margin-bottom: 1rem; }
.field .hint { font-size: .82rem; color: var(--muted); margin-top: .25rem; }
input[type=text], input[type=password], input[type=number], input[type=datetime-local], input[type=search], select, textarea {
  width: 100%;
  font: inherit; color: var(--text);
  background: var(--slot);
  border: 2px solid #6b6b75;
  outline: 0;
  padding: .55rem .7rem;
  border-radius: 0;
  min-width: 0; /* in flex rows, inputs may shrink below their default ~20 characters (narrow phones, large text) */
  max-width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: #fff; }
textarea { min-height: 110px; resize: vertical; }
textarea.code { font-family: ui-monospace, Menlo, monospace; font-size: .88rem; min-height: 260px; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--green); vertical-align: middle; }
.check { display: flex; gap: .5rem; align-items: center; font-weight: 500; cursor: pointer; }

/* ---------- panels ---------- */
.panel {
  background: var(--panel);
  border: 3px solid #000;
  box-shadow: var(--bevel), var(--shadow);
  padding: 1.4rem;
}
.panel.tight { padding: 1rem; }
.panel > h2:first-child, .panel > h3:first-child { margin-top: 0; }
.panel-title { display: flex; align-items: center; gap: .6rem; font-family: var(--font-pixel); font-size: 1.25rem; margin: 0 0 1rem; text-shadow: 2px 2px 0 #000; }
.slot { background: var(--slot); border: 2px solid #000; box-shadow: inset 2px 2px 0 rgba(0, 0, 0, .5), inset -2px -2px 0 rgba(255, 255, 255, .06); padding: .75rem; }

.badge { display: inline-block; white-space: nowrap; font: 400 .75rem var(--font-pixel); padding: .1rem .45rem; border: 2px solid #000; background: var(--panel-2); color: var(--text); vertical-align: middle; letter-spacing: .5px; }
.badge.green { background: #2a5f1c; }
.badge.red { background: #7d2424; }
.badge.gold { background: #8a5c00; }
.badge.purple { background: #5b3a91; }
.badge.gray { background: #3b3747; color: var(--muted); }
.badge.rank { background: color-mix(in srgb, var(--rank) 60%, #000); }

.notice { border: 2px solid #000; padding: .8rem 1rem; background: #2a2236; box-shadow: var(--bevel); margin-bottom: 1rem; }
.notice.warn { background: #3d2e0a; border-color: #000; }
.notice.error { background: #3d1414; }
.notice.ok { background: #18331a; }

.head { width: 24px; height: 24px; border: 2px solid #000; background: #222; flex-shrink: 0; }
.head.md { width: 36px; height: 36px; }
.head.lg { width: 64px; height: 64px; border-width: 3px; }
.player { display: inline-flex; align-items: center; gap: .45rem; font-weight: 600; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: .55rem .6rem; border-bottom: 2px solid #000; vertical-align: middle; }
th { font-family: var(--font-pixel); font-weight: 400; color: var(--muted); white-space: nowrap; }
tr:hover td { background: rgba(255, 255, 255, .02); }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: rgba(255, 255, 255, .06); }
td.nowrap { white-space: nowrap; }
/* action buttons at the end of a row; never make a <td> itself flex, that breaks the table */
td.actions { white-space: nowrap; text-align: right; width: 1%; }
td.actions .btn + .btn { margin-left: .3rem; }
td .code-chip { font-size: .9rem; letter-spacing: 1px; }

.empty { color: var(--muted); text-align: center; padding: 1.5rem; font-style: italic; }

/* ---------- shared content ---------- */
.status-pill { display: inline-flex; align-items: center; gap: .55rem; background: rgba(11, 10, 16, .85); border: 2px solid #000; padding: .35rem .8rem; font-family: var(--font-pixel); }
.dot { width: 10px; height: 10px; background: #666; border: 2px solid #000; display: inline-block; }
.dot.on { background: #55ff55; box-shadow: 0 0 8px #55ff55; }
.dot.off { background: var(--red); }
.status-heads { display: inline-flex; flex-wrap: wrap; gap: 2px; margin-left: .3rem; }
.status-heads img { width: 20px; height: 20px; border: 1px solid #000; }
/* phones: the heads get their own row under the text instead of squeezing it into one word per line */
@media (max-width: 600px) {
  .status-pill { flex-wrap: wrap; justify-content: center; row-gap: .45rem; max-width: 100%; text-align: center; }
  .status-heads { flex-basis: 100%; justify-content: center; margin-left: 0; }
  .status-pill > span:not(.dot):not(.status-heads) { flex: 1 1 0; min-width: 0; } /* the text stays next to the dot */
}

.prose h2, .prose h3 { margin-top: 1.4em; }
.prose h2:first-child, .prose h3:first-child { margin-top: 0; }
.prose ul, .prose ol { padding-left: 1.4rem; }
.prose li { margin-bottom: .35rem; }
.prose strong { color: #fff; }
.prose ol li::marker { color: var(--gold); font-family: var(--font-pixel); }
.prose ul li::marker { color: var(--purple); }
.prose img { max-width: 100%; border: 3px solid #000; }
.prose table { width: 100%; border-collapse: collapse; margin: .4rem 0 1rem; font-size: .92rem; }
.prose th { text-align: left; color: var(--muted); font-weight: 400; font-size: .8rem; padding: .25rem .5rem; }
.prose td { padding: .35rem .5rem; border-top: 2px solid #000; background: var(--slot); vertical-align: top; }
.prose td:first-child { width: 40%; }
.prose code { font: 400 .85rem var(--font-pixel); padding: .05rem .4rem; background: var(--stone); color: #fff; border: 2px solid #000;
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, .25), inset -2px -2px 0 rgba(0, 0, 0, .4); text-shadow: 1px 1px 0 #000; white-space: nowrap; }
.prose.keys h3 { margin: 1.2rem 0 .3rem; font: 400 1rem var(--font-pixel); }
.prose.keys h3:first-child { margin-top: 0; }

/* ---------- modpack: single mods ---------- */
.mod-legend { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .3rem; }
.mod-group { font-family: var(--font-pixel); font-weight: 400; font-size: 1.05rem; margin: 1.4rem 0 .5rem; text-shadow: 2px 2px 0 #000; }
.mod-row { display: flex; gap: .7rem; align-items: flex-start; padding: .6rem 0; border-bottom: 2px solid rgba(0, 0, 0, .45); }
.mod-row > input[type=checkbox], .mod-nocheck { margin-top: .15rem; flex: 0 0 18px; }
.mod-row.off .mod-name strong { color: var(--muted); }
.mod-name { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-bottom: .15rem; }
.mod-links { display: flex; gap: .3rem; flex-shrink: 0; }
.mod-bar { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin: 1rem -1.4rem -1.4rem; padding: .8rem 1.4rem;
  background: var(--panel-2); border-top: 3px solid #000; font-family: var(--font-pixel); }
@media (max-width: 560px) { .mod-links .ghost { display: none; } }

.announcement .meta { display: flex; align-items: center; gap: .4rem; font-size: .8rem; color: var(--muted); margin-bottom: .5rem; }
.announcement.pinned .meta { color: var(--gold); }

.site-footer {
  border-top: 3px solid #000;
  background: url('/img/dirt.png'); background-size: 64px 64px;
  padding: 1.5rem 0;
  text-shadow: 2px 2px 0 #000;
  color: #d8cfbf;
  font-family: var(--font-pixel);
}
.site-footer .container { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; }

/* ---------- auth pages ---------- */
.auth-wrap { max-width: 480px; margin: 3rem auto; padding: 0 16px; width: 100%; }
.method-choice { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-bottom: 1rem; }
.method-choice label { margin: 0; cursor: pointer; }
.method-choice input { display: none; }
.method-choice .opt { display: block; padding: .8rem; text-align: center; background: var(--slot); border: 2px solid #4a4555; font-family: var(--font-pixel); font-weight: 400; }
.method-choice .opt small { display: block; font-family: var(--font-body); color: var(--muted); font-weight: 400; font-size: .78rem; }
.method-choice input:checked + .opt { border-color: var(--green-hi); background: #18291a; }
.method-choice input:disabled + .opt { opacity: .4; cursor: not-allowed; }
.divider { display: flex; align-items: center; gap: .8rem; color: var(--muted); font-family: var(--font-pixel); margin: 1.2rem 0; }
.divider::before, .divider::after { content: ''; flex: 1; border-top: 2px solid #000; }
.mc-preview { display: flex; gap: .8rem; align-items: center; }

/* ---------- app layout ---------- */
.app { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 1.25rem; padding: 1.5rem 0 3rem; align-items: start; }
.sidebar { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 2px; background: var(--panel); border: 3px solid #000; box-shadow: var(--bevel), var(--shadow); padding: .4rem; }
.sidebar .me { display: flex; align-items: center; gap: .6rem; padding: .6rem; border-bottom: 2px solid #000; margin-bottom: .3rem; font-family: var(--font-pixel); overflow: hidden; }
.sidebar .me div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar button { all: unset; display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .55rem .7rem; font-family: var(--font-pixel); cursor: pointer; color: var(--text); }
.sidebar button:hover { background: var(--panel-2); color: var(--yellow); }
.sidebar button.active { background: #3a3150; color: #fff; box-shadow: inset 2px 2px 0 rgba(0, 0, 0, .35); }
.nav-label { display: flex; align-items: center; gap: .6rem; }
.sidebar .px-icon { opacity: .75; }
.sidebar button.active .px-icon, .sidebar button:hover .px-icon { opacity: 1; }
.sidebar button:disabled { opacity: .35; cursor: not-allowed; }
.sidebar .count { background: var(--red); color: #fff; font-size: .72rem; padding: 0 .35rem; border: 2px solid #000; }
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; flex-direction: row; overflow-x: auto; }
  .sidebar .me { display: none; }
  .sidebar button { white-space: nowrap; }
}

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .8rem; }
.stat { background: var(--slot); border: 2px solid #000; padding: .9rem; box-shadow: inset 2px 2px 0 rgba(0, 0, 0, .5); }
.stat .v { font: 400 1.7rem/1.1 var(--font-pixel); color: #fff; text-shadow: 2px 2px 0 #000; }
.stat .k { font-size: .8rem; color: var(--muted); font-family: var(--font-pixel); text-transform: uppercase; margin-top: .25rem; }

/* ---------- chat ---------- */
.chat { display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: 1rem; height: calc(100vh - 170px); min-height: 460px; }
.chat-main { display: flex; flex-direction: column; min-height: 0; background: rgba(0, 0, 0, .55); border: 3px solid #000; }
.chat-log-wrap { flex: 1; min-height: 0; position: relative; display: flex; flex-direction: column; }
.chat-log { flex: 1; overflow-y: auto; overflow-x: hidden; padding: .75rem; display: flex; flex-direction: column; gap: 2px; }
.msg { display: flex; gap: .55rem; padding: .3rem .4rem; position: relative; }
.msg:hover { background: rgba(255, 255, 255, .04); }
.msg .head { margin-top: 2px; }
.msg .body { min-width: 0; flex: 1; }
.msg .name { font-family: var(--font-pixel); font-weight: 400; color: #fff; text-shadow: 1px 1px 0 #000; }
.msg .name.ranked { color: var(--rank); }
.msg .time { font-size: .72rem; color: var(--muted); margin-left: .4rem; }
.msg .text { white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; }
.msg.cont { padding-top: 0; }
.msg.event { align-items: center; padding-top: .15rem; padding-bottom: .15rem; font-size: .88rem; }
.msg.event .head { width: 18px; height: 18px; margin: 0 9px; }
.msg.event .ev-text { text-shadow: 1px 1px 0 #000; overflow-wrap: anywhere; }
.msg.event .ev-text [title] { cursor: help; }
.msg.cont .head { visibility: hidden; height: 0; }
.msg.mention { background: rgba(255, 170, 0, .09); }
.msg-actions { position: absolute; right: .3rem; top: .1rem; display: none; gap: 2px; background: var(--panel); border: 2px solid #000; padding: 2px; }
.msg:hover .msg-actions, .msg:focus-within .msg-actions { display: flex; }
.msg-actions .btn { min-height: 26px; padding: 0 .45rem; }
.msg .pin-mark { display: none; margin-left: .35rem; font-size: .8rem; }
.msg.pinned .pin-mark { display: inline; }
.msg.flash { animation: flash 1.5s ease-out; }
@keyframes flash { from { background: rgba(169, 112, 255, .35); } }
.msg .at { color: var(--gold); font-weight: 600; }
/* touch screens have no hover: tapping a message shows its actions */
/* touch screens: tapping a message opens the same popup as on hover (top right), with bigger buttons */
@media (hover: none) {
  .msg:hover .msg-actions { display: none; }
  .msg.show-actions { background: rgba(255, 255, 255, .08); }
  .msg.show-actions .msg-actions { display: flex; top: 0; gap: 4px; padding: 3px; z-index: 5; box-shadow: 0 4px 0 rgba(0, 0, 0, .45); }
  .msg-actions .btn { min-height: 44px; min-width: 48px; padding: 0 .6rem; }
  .msg-actions .btn .px-icon { width: 22px; height: 22px; }
  .chat .btn.small { min-height: 42px; min-width: 42px; }
  .pins-head { padding: .8rem 1rem; }
  .reply-ref { padding: .35rem .6rem; }
  /* swipe a message to the right to reply (like WhatsApp); the arrow shows up on its left while swiping */
  .msg { touch-action: pan-y pinch-zoom; }
  .msg.swiping::before { content: ''; position: absolute; left: -2.4rem; top: 50%; width: 22px; height: 22px; margin-top: -11px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 9' shape-rendering='crispEdges' fill='%239a93ad'%3E%3Crect x='3' y='0' width='1' height='1'/%3E%3Crect x='2' y='1' width='1' height='1'/%3E%3Crect x='3' y='1' width='1' height='1'/%3E%3Crect x='1' y='2' width='1' height='1'/%3E%3Crect x='2' y='2' width='1' height='1'/%3E%3Crect x='3' y='2' width='1' height='1'/%3E%3Crect x='0' y='3' width='1' height='1'/%3E%3Crect x='1' y='3' width='1' height='1'/%3E%3Crect x='2' y='3' width='1' height='1'/%3E%3Crect x='3' y='3' width='1' height='1'/%3E%3Crect x='4' y='3' width='1' height='1'/%3E%3Crect x='5' y='3' width='1' height='1'/%3E%3Crect x='6' y='3' width='1' height='1'/%3E%3Crect x='7' y='3' width='1' height='1'/%3E%3Crect x='0' y='4' width='1' height='1'/%3E%3Crect x='1' y='4' width='1' height='1'/%3E%3Crect x='2' y='4' width='1' height='1'/%3E%3Crect x='3' y='4' width='1' height='1'/%3E%3Crect x='4' y='4' width='1' height='1'/%3E%3Crect x='5' y='4' width='1' height='1'/%3E%3Crect x='6' y='4' width='1' height='1'/%3E%3Crect x='7' y='4' width='1' height='1'/%3E%3Crect x='8' y='4' width='1' height='1'/%3E%3Crect x='1' y='5' width='1' height='1'/%3E%3Crect x='2' y='5' width='1' height='1'/%3E%3Crect x='3' y='5' width='1' height='1'/%3E%3Crect x='7' y='5' width='1' height='1'/%3E%3Crect x='8' y='5' width='1' height='1'/%3E%3Crect x='2' y='6' width='1' height='1'/%3E%3Crect x='3' y='6' width='1' height='1'/%3E%3Crect x='7' y='6' width='1' height='1'/%3E%3Crect x='8' y='6' width='1' height='1'/%3E%3Crect x='3' y='7' width='1' height='1'/%3E%3Crect x='7' y='7' width='1' height='1'/%3E%3Crect x='8' y='7' width='1' height='1'/%3E%3Crect x='7' y='8' width='1' height='1'/%3E%3Crect x='8' y='8' width='1' height='1'/%3E%3C/svg%3E") center / contain no-repeat; }
  .msg.swipe-ready::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 9' shape-rendering='crispEdges' fill='%23ffffff'%3E%3Crect x='3' y='0' width='1' height='1'/%3E%3Crect x='2' y='1' width='1' height='1'/%3E%3Crect x='3' y='1' width='1' height='1'/%3E%3Crect x='1' y='2' width='1' height='1'/%3E%3Crect x='2' y='2' width='1' height='1'/%3E%3Crect x='3' y='2' width='1' height='1'/%3E%3Crect x='0' y='3' width='1' height='1'/%3E%3Crect x='1' y='3' width='1' height='1'/%3E%3Crect x='2' y='3' width='1' height='1'/%3E%3Crect x='3' y='3' width='1' height='1'/%3E%3Crect x='4' y='3' width='1' height='1'/%3E%3Crect x='5' y='3' width='1' height='1'/%3E%3Crect x='6' y='3' width='1' height='1'/%3E%3Crect x='7' y='3' width='1' height='1'/%3E%3Crect x='0' y='4' width='1' height='1'/%3E%3Crect x='1' y='4' width='1' height='1'/%3E%3Crect x='2' y='4' width='1' height='1'/%3E%3Crect x='3' y='4' width='1' height='1'/%3E%3Crect x='4' y='4' width='1' height='1'/%3E%3Crect x='5' y='4' width='1' height='1'/%3E%3Crect x='6' y='4' width='1' height='1'/%3E%3Crect x='7' y='4' width='1' height='1'/%3E%3Crect x='8' y='4' width='1' height='1'/%3E%3Crect x='1' y='5' width='1' height='1'/%3E%3Crect x='2' y='5' width='1' height='1'/%3E%3Crect x='3' y='5' width='1' height='1'/%3E%3Crect x='7' y='5' width='1' height='1'/%3E%3Crect x='8' y='5' width='1' height='1'/%3E%3Crect x='2' y='6' width='1' height='1'/%3E%3Crect x='3' y='6' width='1' height='1'/%3E%3Crect x='7' y='6' width='1' height='1'/%3E%3Crect x='8' y='6' width='1' height='1'/%3E%3Crect x='3' y='7' width='1' height='1'/%3E%3Crect x='7' y='7' width='1' height='1'/%3E%3Crect x='8' y='7' width='1' height='1'/%3E%3Crect x='7' y='8' width='1' height='1'/%3E%3Crect x='8' y='8' width='1' height='1'/%3E%3C/svg%3E"); }
  .msg.swipe-back { transition: transform .2s; }
}
}
}

.reply-ref { all: unset; display: block; cursor: pointer; font-size: .82rem; color: var(--muted); border-left: 3px solid var(--purple); padding: .1rem .5rem; margin: .15rem 0 .25rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-ref:hover { color: var(--text); }
.reply-ref strong { color: var(--text); }
.reply-bar, .att-preview { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .4rem .7rem; background: var(--panel-2); border-top: 2px solid #000; font-size: .88rem; }
.reply-bar[hidden], .att-preview[hidden] { display: none; }
.mute-bar { padding: .45rem .7rem; background: var(--panel-2); border-top: 2px solid #000; color: var(--yellow); font-size: .88rem; }
.mute-bar[hidden] { display: none; }
.att-chip { display: inline-flex; align-items: center; gap: .5rem; }
.att-chip img { width: 36px; height: 36px; object-fit: cover; border: 2px solid #000; image-rendering: auto; }
.att-wrap { margin-top: .35rem; }
.att { display: block; max-width: min(340px, 100%); max-height: 320px; border: 3px solid #000; background: #000; image-rendering: auto; }
img.att { cursor: zoom-in; }
.thread .att { max-width: min(480px, 100%); max-height: 420px; }
.chat-main.dragging { outline: 3px dashed var(--purple); outline-offset: -6px; }
textarea.dragging { border-color: var(--purple); }
.btn.icon { padding: .3rem .6rem; min-width: 42px; }
button.link { all: unset; cursor: pointer; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button.link:hover { color: var(--yellow); }

.poll { background: var(--slot); border: 2px solid #000; padding: .7rem; margin-top: .25rem; max-width: 460px; }
.poll-q { font-family: var(--font-pixel); font-size: 1.05rem; margin-bottom: .5rem; }
.poll-opt { all: unset; box-sizing: border-box; position: relative; display: flex; align-items: center; gap: .5rem; width: 100%; padding: .45rem .6rem; margin-bottom: .35rem; border: 2px solid #3a3546; background: #15131c; cursor: pointer; overflow: hidden; }
.poll-opt:hover:not(:disabled) { border-color: #6b6378; }
.poll-opt:disabled { cursor: default; }
.poll-opt.mine { border-color: var(--green-hi); }
.poll-opt .fill { position: absolute; inset: 0 auto 0 0; background: rgba(169, 112, 255, .22); transition: width .3s; }
.poll-opt.mine .fill { background: rgba(79, 168, 51, .3); }
.poll-opt > span:not(.fill) { position: relative; }
.poll-opt .label { flex: 1; }
.poll-opt .voters { display: inline-flex; gap: 1px; }
.poll-opt .voters img { width: 16px; height: 16px; border: 1px solid #000; }
.poll-opt .pct { font-family: var(--font-pixel); color: var(--muted); font-size: .9rem; white-space: nowrap; }
.poll-foot { display: flex; align-items: center; justify-content: space-between; gap: .5rem; font-size: .82rem; color: var(--muted); }
.poll.closed .poll-q { color: var(--muted); }

.pins-bar { border-bottom: 3px solid #000; background: #1c1726; }
.pins-head { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: .4rem; width: 100%; padding: .5rem .8rem; cursor: pointer; font-size: .9rem; }
.pins-head:hover { background: #241e31; }
.pins-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.pins-count { color: var(--muted); font-family: var(--font-pixel); white-space: nowrap; }
.pins-list { max-height: 260px; overflow-y: auto; padding: .3rem .8rem .6rem; }
.pins-item { display: flex; align-items: center; gap: .5rem; padding: .35rem 0; border-top: 1px solid #2c2638; font-size: .9rem; flex-wrap: wrap; }
.pins-item .att { max-height: 120px; max-width: 160px; }
.vc-members { display: flex; flex-wrap: wrap; gap: .35rem .9rem; margin-top: .45rem; }
.vc-member { display: inline-flex; align-items: center; gap: .35rem; font-size: .9rem; padding: .1rem .3rem; border: 2px solid transparent; }
.vc-member.speaking { border-color: var(--green); background: rgba(90, 165, 58, .15); }
.vc-group.active { outline: 2px solid var(--green); outline-offset: -2px; }
.vc-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-top: .75rem; }
/* mute: gray while you can talk, glowing red while muted */
.vc-mute.on { box-shadow: 0 0 10px 2px rgba(220, 60, 60, .7), inset 2px 2px 0 rgba(255, 255, 255, .25), inset -2px -3px 0 rgba(0, 0, 0, .35); }
.vc-volume { display: inline-flex; align-items: center; gap: .4rem; margin: 0; font-weight: 400; }
.vc-volume input { width: 110px; }
#nav .count.live { background: var(--green); }
.vote-evidence { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .4rem; }
.vote-evidence .att { max-height: 120px; max-width: 180px; }

.lightbox { position: fixed; inset: 0; z-index: 300; background: rgba(0, 0, 0, .88); display: grid; place-items: center; cursor: zoom-out; padding: 16px; }
.lightbox img { max-width: 100%; max-height: 100%; border: 3px solid #000; image-rendering: auto; }
.chat-input { display: flex; gap: .5rem; padding: .6rem; border-top: 3px solid #000; background: var(--panel); }
.chat-input input { flex: 1; width: auto; min-width: 0; }
.chat-online { background: var(--panel); border: 3px solid #000; padding: .8rem; overflow-y: auto; }
.chat-online h4 { font-size: .9rem; color: var(--muted); margin-bottom: .6rem; }
.chat-online .pl { display: flex; align-items: center; gap: .4rem; margin-bottom: .45rem; font-size: .92rem; cursor: pointer; }
.chat-online .pl:hover .player > span { text-decoration: underline; }
.chat-online .pl .player { min-width: 0; }
.chat-online .pl .player > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } /* long names don't run into the dot */
.chat-online .offline .pl { opacity: .55; }
.chat-online .pl.ingame { opacity: 1; }
.chat-online .pl.ingame .player > span { color: #55ff55; }
.chat-online .game-dot { width: 8px; height: 8px; flex: none; background: #55ff55; box-shadow: 0 0 6px #55ff55; } /* same green as the server status dot */
.chat-online #offline-title { margin-top: 1.2rem; }
.chat-more { display: grid; place-items: center; padding: .6rem; }
.like-btn { all: unset; display: inline-flex; align-items: center; gap: .3rem; cursor: pointer; color: var(--muted); font-family: var(--font-pixel); padding: .1rem .3rem; }
.like-btn:hover:not(:disabled) { color: var(--text); }
.like-btn.on { color: var(--red); }
.like-btn:disabled { cursor: default; }
.like-btn .px-icon { width: 18px; height: 18px; }
/* tabs over the chat: general, own clan, direct messages */
.chat-tabs { display: flex; gap: 2px; padding: .4rem .5rem 0; border-bottom: 3px solid #000; background: var(--panel); overflow-x: auto; flex: none; }
.chat-tabs button { all: unset; box-sizing: border-box; display: inline-flex; align-items: center; gap: .4rem; padding: .45rem .8rem; cursor: pointer; font-family: var(--font-pixel); color: var(--muted); white-space: nowrap; border: 2px solid transparent; border-bottom: 0; }
.chat-tabs button:hover { color: var(--text); }
.chat-tabs button.on { color: #fff; background: rgba(0, 0, 0, .55); border-color: #000; }
.chat-tabs .count, .dm-item .count { background: var(--red); color: #fff; font-size: .72rem; padding: 0 .35rem; border: 2px solid #000; text-shadow: none; }
.clan-dot { width: 10px; height: 10px; border: 1px solid #000; flex: none; }
.chat-pane { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chat-pane[hidden] { display: none; }
.chat-pane.dragging { outline: 3px dashed var(--purple); outline-offset: -6px; }
.dm-pane { flex-direction: row; }
.dm-list { width: 230px; flex: none; overflow-y: auto; border-right: 3px solid #000; background: rgba(0, 0, 0, .25); }
.dm-list .empty { padding: .8rem; }
.dm-item { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: .55rem; width: 100%; padding: .55rem .7rem; cursor: pointer; border-bottom: 1px solid #2c2638; }
.dm-item:hover { background: rgba(255, 255, 255, .05); }
.dm-item.on { background: rgba(169, 112, 255, .18); }
.dm-who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dm-name { font-family: var(--font-pixel); color: #fff; }
.dm-last { font-size: .82rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-item.unread .dm-last { color: var(--text); }
.dm-conv { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dm-head { display: flex; align-items: center; gap: .4rem; padding: .45rem .7rem; border-bottom: 2px solid #000; background: var(--panel-2); min-height: 2.6rem; }
.dm-head:empty { display: none; }
.dm-head .link { flex: none; }
.dm-back { display: none; }
.chat-input[hidden] { display: none; }
.adm-chats { display: flex; height: calc(100vh - 250px); min-height: 420px; background: rgba(0, 0, 0, .55); border: 3px solid #000; }
.adm-chats .dm-list { width: 280px; }
.dm-heads { display: flex; flex: none; }
.dm-heads .head + .head { margin-left: -6px; }
@media (max-width: 860px) {
  /* phones: the list or one conversation */
  .dm-list { width: 100%; border-right: 0; }
  .dm-pane.open .dm-list, .dm-pane:not(.open) .dm-conv { display: none; }
  .dm-back { display: inline-flex; }
  .adm-chats .dm-list { width: 100%; }
  .chat-tabs { padding: .3rem .3rem 0; }
  .chat-tabs button { padding: .45rem .5rem; font-size: .88rem; }
  .chat-tabs button[data-tab="clan"] { max-width: 7.5rem; overflow: hidden; text-overflow: ellipsis; }
}
.chat-sys { color: var(--yellow); font-family: var(--font-pixel); font-size: .9rem; padding: .3rem .4rem; }
.chat { position: relative; }
.players-btn, .players-close { display: none; }
@media (max-width: 860px) {
  .chat { grid-template-columns: minmax(0, 1fr); height: calc(100vh - 210px); }
  .chat-online { display: none; }
  /* the player list: a button floating over the top right of the chat, the list slides in from the right */
  .players-btn { display: inline-flex; position: absolute; top: .5rem; right: .9rem; z-index: 8; min-width: 46px; min-height: 46px; padding: 0;
    box-shadow: inset 2px 2px 0 rgba(255, 255, 255, .25), inset -2px -3px 0 rgba(0, 0, 0, .35), 0 4px 0 rgba(0, 0, 0, .45); }
  .players-btn .px-icon { width: 22px; height: 22px; }
  .chat.show-players .chat-online { display: block; position: absolute; top: 0; right: 0; bottom: 0; width: min(260px, 85%); z-index: 20; box-shadow: -6px 0 0 rgba(0, 0, 0, .45); }
  .chat.show-players .players-close { display: inline-flex; float: right; margin: -.3rem -.3rem 0 0; min-width: 44px; min-height: 44px; justify-content: center; align-items: center; font-size: 1.1rem; }
  .chat-online .pl { margin-bottom: .7rem; font-size: 1rem; }
}

/* chat tab: like a chat app, the chat fills the window and only the message list scrolls */
body.chat-mode { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
body.chat-mode .site-footer { display: none; }
body.gram-mode .app { grid-template-columns: minmax(0, 1fr); }
body.gram-mode .app > .sidebar { display: none; }
body.chat-mode main { min-height: 0; display: flex; flex-direction: column; }
body.chat-mode .app { flex: 1; min-height: 0; padding-bottom: 1rem; align-items: stretch; grid-template-rows: minmax(0, 1fr); }
body.chat-mode .sidebar { align-self: start; }
body.chat-mode #view { min-height: 0; }
body.chat-mode .chat { height: 100%; min-height: 0; }
@media (max-width: 860px) {
  body.chat-mode .app { grid-template-rows: auto minmax(0, 1fr); gap: .75rem; padding-top: .75rem; }
}

/* ---------- steps (modpack) ---------- */
.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; }
.steps > li { counter-increment: step; position: relative; padding: 0 0 1.4rem 3.2rem; }
.steps > li::before {
  content: counter(step);
  position: absolute; left: 0; top: -2px;
  width: 2.3rem; height: 2.3rem; display: grid; place-items: center;
  font: 400 1.1rem var(--font-pixel);
  background: var(--green); border: 2px solid #000; box-shadow: var(--bevel);
  text-shadow: 2px 2px 0 #000;
}
.steps h4 { margin: 0 0 .3rem; font-size: 1.05rem; }

/* ---------- misc ---------- */
.toast-box { position: fixed; bottom: 1rem; right: 1rem; z-index: 200; display: flex; flex-direction: column; gap: .5rem; max-width: calc(100vw - 2rem); }
.toast { background: var(--panel-2); border: 3px solid #000; box-shadow: var(--bevel), var(--shadow); padding: .7rem 1rem; font-family: var(--font-pixel); animation: pop .15s ease-out; }
.toast.ok { border-color: #1f4d17; background: #1a2b1a; }
.toast.error { border-color: #5c1a1a; background: #2e1717; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }

.tabs { display: flex; gap: 2px; margin-bottom: 1rem; flex-wrap: wrap; }
.tabs button { font: 400 .95rem var(--font-pixel); background: var(--panel-2); color: var(--muted); border: 2px solid #000; padding: .4rem .9rem; cursor: pointer; }
.tabs button.on { background: var(--purple); color: #fff; text-shadow: 1px 1px 0 #000; }

.thread { display: flex; flex-direction: column; gap: .7rem; margin-bottom: 1rem; }
.thread .m { background: var(--slot); border: 2px solid #000; padding: .7rem .9rem; }
.thread .m.admin { background: #221a24; border-color: #3d2c44; }
.thread .m .meta { display: flex; align-items: center; gap: .5rem; font-size: .82rem; color: var(--muted); margin-bottom: .35rem; }
.thread .m .text { white-space: pre-wrap; overflow-wrap: anywhere; }

.list-item { display: flex; align-items: center; gap: .8rem; padding: .7rem .8rem; background: var(--slot); border: 2px solid #000; margin-bottom: .5rem; cursor: pointer; }
.list-item:hover { border-color: #5a5468; }
.list-item.unread strong { color: #fff; }

.player-picker { max-height: 240px; overflow-y: auto; border: 2px solid #000; background: var(--slot); }
.player-picker button { all: unset; display: flex; align-items: center; gap: .55rem; width: 100%; box-sizing: border-box; padding: .4rem .6rem; cursor: pointer; }
.player-picker button:hover { background: var(--panel-2); }
.player-picker button.sel { background: #3a2a55; }

/* invite tree: top-down org chart with wooden branches; each inviter is a card with their players stacked inside */
.otree { overflow-x: auto; padding: .5rem 0 1rem; --branch: #7a5530; cursor: grab; user-select: none; }
.otree.dragging { cursor: grabbing; }
.otree [data-move] { cursor: pointer; }
.otree.readonly [data-move] { cursor: inherit; }
.otree.readonly [data-move]:hover .leaf-name, .otree.readonly [data-move]:hover strong { color: inherit; }
.otree [data-move]:hover .leaf-name, .otree [data-move]:hover strong { color: var(--yellow); }
.otree ul.tb { list-style: none; margin: 0; padding: 28px 0 0; display: flex; justify-content: center; position: relative; }
.otree > ul.tb { padding-top: 0; min-width: max-content; }
.otree li.tn { position: relative; display: flex; flex-direction: column; align-items: center; padding: 28px 7px 0; }
.otree > ul.tb > li.tn { padding-top: 0; }
/* horizontal branch to siblings + short vertical twig into each card */
.otree li.tn::before, .otree li.tn::after { content: ''; position: absolute; top: 0; width: 50%; height: 28px; border-top: 4px solid var(--branch); }
.otree li.tn::before { right: 50%; }
.otree li.tn::after { left: 50%; border-left: 4px solid var(--branch); margin-left: -2px; }
.otree li.tn:first-child::before, .otree li.tn:last-child::after { border-top: 0; }
.otree li.tn:last-child::before { border-right: 4px solid var(--branch); margin-right: -2px; }
.otree li.tn:only-child::before { display: none; }
.otree li.tn:only-child::after { border-top: 0; }
.otree > ul.tb > li.tn::before, .otree > ul.tb > li.tn::after { display: none; }
/* trunk from a card down to its children */
.otree ul.tb ul.tb::before { content: ''; position: absolute; top: 0; left: 50%; margin-left: -2px; height: 28px; border-left: 4px solid var(--branch); }

.tcard, .tcard.player { display: block; } /* .player is also the class of player chips (display: flex) */
.tcard { width: 210px; background: var(--slot); border: 3px solid #000; box-shadow: var(--bevel), 0 5px 0 rgba(0, 0, 0, .4); position: relative; z-index: 1; }
.tcard-head { display: flex; align-items: center; gap: .55rem; padding: .55rem .6rem; border-bottom: 3px solid #000; background: #2a2337; }
.tcard[style*="--rank"] .tcard-head { background: color-mix(in srgb, var(--rank) 22%, #2a2337); }
.tcard-who { flex: 1; min-width: 0; line-height: 1.3; }
.tcard-who strong { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; margin-right: .25rem; }
.tcard-count { font: 400 1.5rem/1 var(--font-pixel); color: #fff; text-shadow: 2px 2px 0 #000; min-width: 1.4em; text-align: center; }
.tcard-meta { font-size: .78rem; color: #ff9c9c; padding: .3rem .6rem 0; }
.tcard-list { list-style: none; margin: 0; padding: .3rem 0; }
.tcard-list li.leaf { display: flex; flex-direction: row; align-items: center; gap: .4rem; padding: .22rem .6rem; font-size: .88rem; }
.tcard-list li.leaf:hover { background: rgba(255, 255, 255, .04); }
.tcard-list li.leaf.banned .leaf-name { color: var(--muted); text-decoration: line-through; }
.tcard-list .head { width: 20px; height: 20px; }
.leaf-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leaf-date { font-size: .72rem; color: var(--muted); white-space: nowrap; }

.code-chip { display: inline-block; white-space: nowrap; font: 400 1rem var(--font-pixel); letter-spacing: 1.5px; background: var(--slot); border: 2px solid #000; padding: .25rem .6rem; }
.spinner { display: inline-block; width: 14px; height: 14px; background: var(--purple); animation: spin 1s steps(4) infinite; border: 2px solid #000; }
@keyframes spin { to { transform: rotate(360deg); } }

dialog { background: var(--panel); color: var(--text); border: 3px solid #000; box-shadow: var(--bevel), 0 10px 0 rgba(0, 0, 0, .5); padding: 1.4rem; max-width: min(560px, calc(100vw - 32px)); width: 100%; }
dialog::backdrop { background: rgba(0, 0, 0, .7); }
/* while a dialog is open the page behind stays still: no scrolling along or bouncing at the dialog's ends (that made
   the blurred header and the page flicker through the backdrop) */
dialog { overscroll-behavior: contain; }
html:has(dialog[open]) { overflow: hidden; }
html:has(dialog[open]) .site-header { backdrop-filter: none; }

/* ranks and permissions (admin) */
.rank-mc { font: 400 .9rem var(--font-pixel); background: rgba(0, 0, 0, .55); padding: .15rem .5rem; color: #fff; text-shadow: 1px 1px 0 #3f3f3f; white-space: nowrap; }
.perm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .3rem 1.2rem; }
.perm-grid > div > .small { margin-bottom: .2rem; }
/* same size for every box (a flex item would shrink next to long labels), always on the first line */
.perm-grid .check { align-items: flex-start; margin: .35rem 0; font-weight: 400; font-size: .9rem; line-height: 1.35; }
.perm-grid .check input { flex: 0 0 18px; margin: 0; }
@media (max-width: 640px) { .perm-grid { grid-template-columns: 1fr; } }

/* player card: 3D skin and playtime */
.head-btn, .name-btn { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-shadow: inherit; cursor: pointer; }
.head-btn:hover img, .head-btn:focus-visible img { outline: 3px solid var(--green-hi); }
.name-btn { text-decoration: underline dotted 2px; text-underline-offset: 4px; }
.name-btn:hover, .name-btn:focus-visible { color: var(--green-hi); }
.skin-stage { height: 320px; background: radial-gradient(circle at 50% 40%, #2c2638, var(--slot) 70%); border: 3px solid #000; box-shadow: var(--bevel); display: grid; place-items: center; }
.skin-stage canvas { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
.skin-stage canvas:active { cursor: grabbing; }
.pt-hero { margin-bottom: .8rem; }
.pt-hero .v { font: 400 2rem/1 var(--font-pixel); color: #fff; text-shadow: 2px 2px 0 #000; }
.pt-hero .k { color: var(--muted); }
.pt-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.pt-tile { background: var(--slot); border: 2px solid #000; padding: .45rem .6rem; }
.pt-tile .k { font-size: .75rem; color: var(--muted); }
.pt-tile .v { font-family: var(--font-pixel); color: var(--text); }
.pt-year { display: grid; grid-template-rows: repeat(7, auto); grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; }
.pt-year i { aspect-ratio: 1; border-radius: 2px; background: var(--slot); }
.pt-year i.pad { background: none; }
.pt-year i.l1 { background: #23401a; }
.pt-year i.l2 { background: #2f6b22; }
.pt-year i.l3 { background: #3f962c; }
.pt-year i.l4 { background: #5bd13d; }
@media (max-width: 480px) { .pt-grid { grid-template-columns: repeat(2, 1fr); } .skin-stage { height: 260px; } }
.rank-previews { display: grid; grid-template-columns: auto 1fr; gap: .5rem 1rem; align-items: center; justify-items: start; }
.u-facts { display: flex; flex-wrap: wrap; gap: .2rem 1rem; margin-bottom: 1rem; }
.mod-icon { width: 32px; height: 32px; flex: 0 0 32px; border: 2px solid #000; image-rendering: auto; object-fit: cover; background: var(--slot); }
.mod-icon.none { display: grid; place-items: center; color: var(--muted); }

/* phones: the sidebar moves into the menu (see .nav-sub), the chat gets the whole height */
@media (max-width: 760px) {
  .app > .sidebar { display: none; }
  body.chat-mode .app { grid-template-rows: minmax(0, 1fr); }
}

/* ---------- stickers ---------- */
.btn[hidden], .sticker-picker[hidden] { display: none; }
.msg .sticker { display: block; width: auto; max-width: 140px; max-height: 140px; margin-top: .2rem; image-rendering: auto; }
.sticker-picker { border-top: 2px solid #000; background: var(--panel); height: 260px; max-height: 40vh; overflow-y: auto; overscroll-behavior: contain; padding: .5rem .6rem; }
.sticker-tabs { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: .5rem; }
.sticker-tabs button { all: unset; cursor: pointer; padding: .3rem .6rem; font-family: var(--font-pixel); font-size: .85rem; color: var(--muted); background: var(--slot); border: 2px solid #000; }
.sticker-tabs button.on { color: #fff; background: #3a3150; }
.sticker-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .4rem; } /* 5 across, scrolls down */
.sticker-grid button { all: unset; box-sizing: border-box; cursor: pointer; aspect-ratio: 1; position: relative;
  background: rgba(255, 255, 255, .03); } /* square cells, whatever shape the sticker has */
.sticker-grid button:hover, .sticker-grid button:focus-visible { background: rgba(255, 255, 255, .08); }
.sticker-grid img { position: absolute; inset: .25rem; width: calc(100% - .5rem); height: calc(100% - .5rem); object-fit: contain; }
.send-btn .px-icon { display: none; }
/* the conversation next to the list is narrow: send as an icon, so the text field keeps room */
.dm-conv .send-btn { min-width: 46px; padding: .3rem .65rem; }
.dm-conv .send-btn .px-icon { display: block; width: 18px; height: 18px; }
.dm-conv .send-label { display: none; }
.chat-input input[type="text"] { min-width: 5rem; }

/* phones: an icon as send button, and while typing the other buttons make room for the text */
@media (max-width: 760px) {
  .send-btn { min-width: 46px; padding: .3rem .65rem; }
  .send-btn .px-icon { display: block; width: 18px; height: 18px; }
  .send-label { display: none; }
  .chat-input.typing .btn.icon { display: none; }
}
.sticker-admin { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: .6rem; }
.sticker-cell { position: relative; aspect-ratio: 1; display: grid; place-items: center; background: var(--slot); border: 2px solid #000; padding: .3rem; }
.sticker-cell img { max-width: 100%; max-height: 100%; object-fit: contain; }
.sticker-cell .btn { position: absolute; top: 2px; right: 2px; min-height: 30px; min-width: 30px; padding: 0; }
.row.nowrap { flex-wrap: nowrap; }
.color-pick { width: 3.2rem; height: 2.6rem; padding: .15rem; flex: 0 0 auto; cursor: pointer; }
.rank-web { font-family: var(--font-pixel); text-shadow: 1px 1px 0 #000; }

/* ---------- statistics ---------- */
.pt-tops { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-top: 1rem; }
.pt-top .k { font-size: .8rem; color: var(--muted); margin-bottom: .3rem; }
.pt-top ol { margin: 0; padding-left: 1.4rem; font-size: .88rem; }
.pt-top li { margin-bottom: .1rem; }
.pt-top li > span:first-child { margin-right: .4rem; }
.pt-adv-bar { height: 8px; background: var(--slot); border: 2px solid #000; margin: .6rem 0; }
.pt-adv-bar span { display: block; height: 100%; background: var(--green-hi); }
.pt-adv-list { display: flex; flex-wrap: wrap; gap: .3rem; }
.pt-adv-list span { font-size: .78rem; padding: .15rem .45rem; background: var(--slot); border: 1px solid #2c2638; color: var(--muted); }
.pt-adv-list span.done { color: #fff; border-color: var(--green); background: rgba(79, 168, 51, .18); }

/* player card: wide, skin left, playtime right, then the numbers and the advancement map */
dialog.player-dlg { max-width: min(1200px, calc(100vw - 32px)); }
.pc-head { margin-bottom: 1rem; }
.pc-top { display: grid; grid-template-columns: 320px 1fr; gap: 1.4rem; align-items: start; }
.pc-top .skin-stage { height: 360px; }
.pt-yearwrap { margin-top: 1rem; }
.pc-section { margin-top: 1.6rem; }
.pc-section > .panel-title { margin-bottom: .7rem; }
.pc-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .6rem; }
.pc-stat { display: flex; align-items: center; gap: .7rem; padding: .55rem .7rem; border: 2px solid #000;
  background: color-mix(in srgb, var(--c) 14%, var(--slot)); box-shadow: inset 3px 0 0 var(--c); }
.pc-stat > div { min-width: 0; flex: 1; }
.pc-stat .k { font-size: .75rem; color: var(--muted); }
.pc-stat .v { font: 400 1.05rem var(--font-pixel); white-space: nowrap; }
.pc-place { font: 400 .8rem var(--font-pixel); padding: .15rem .4rem; border: 2px solid #000; background: var(--panel-2); color: var(--muted); }
.pc-place.p1 { background: #ffcf3a; color: #000; }
.pc-place.p2 { background: #c9ccd6; color: #000; }
.pc-place.p3 { background: #d98a4a; color: #000; }
.pt-grid.wide { grid-template-columns: repeat(4, 1fr); }
.adv-title { justify-content: space-between; }
.adv-title .muted { font: 400 .9rem var(--font-pixel); text-shadow: none; }

/* advancements like the screen in Minecraft: tabs on top, a window with the map to drag around */
/* like in the game: the other tabs sit behind the window, the chosen one in front of it, joined to it without a border */
.adv-tabs { display: flex; gap: 4px; padding-left: 8px; }
.adv-tab { all: unset; cursor: pointer; width: 52px; height: 48px; display: grid; place-items: center; background: #8b8b8b; border: 3px solid #000; border-bottom: 0;
  box-shadow: inset 3px 3px 0 #dbdbdb, inset -3px 0 0 #555; position: relative; top: 6px; z-index: 0; }
.adv-tab.on { background: #c6c6c6; top: 3px; height: 51px; z-index: 2; box-shadow: inset 3px 3px 0 #fff, inset -3px 0 0 #555; }
.adv-tab .mc-img { width: 32px; height: 32px; }
.adv-window { position: relative; z-index: 1; background: #c6c6c6; border: 3px solid #000; box-shadow: inset 3px 3px 0 #fff, inset -3px -3px 0 #555; padding: 8px 12px 12px; }
.adv-name { display: flex; justify-content: space-between; color: #3f3f3f; font: 400 .95rem var(--font-pixel); padding: 0 2px 8px; }
.adv-name .muted { color: #555; }
.adv-view { position: relative; height: 420px; overflow: hidden; border: 2px solid #000; background-color: #1d1d1d; background-size: 32px 32px;
  image-rendering: pixelated; cursor: grab; touch-action: none; user-select: none; box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .35); }
.adv-view.dragging { cursor: grabbing; }
.adv-map { position: absolute; left: 0; top: 0; }
.adv-lines { position: absolute; inset: 0; pointer-events: none; }
.adv-node { all: unset; position: absolute; width: 52px; height: 52px; background-size: 52px 52px; image-rendering: pixelated; cursor: pointer; }
.adv-node .mc-img { position: absolute; left: 10px; top: 10px; width: 32px; height: 32px; pointer-events: none; }
.adv-node:focus-visible { outline: 2px solid #fff; }
.adv-tip { position: absolute; z-index: 2; max-width: 280px; pointer-events: none; font-size: .85rem; text-shadow: 2px 2px 0 #000; }
.adv-tip .t { background: #0e4d8c; border: 2px solid #000; box-shadow: inset 2px 2px 0 #3a8bd6, inset -2px -2px 0 #052a50; padding: .35rem .6rem; color: #fff; }
.adv-tip.done .t { background: #a8780e; box-shadow: inset 2px 2px 0 #e6b737, inset -2px -2px 0 #5e4006; }
.adv-tip .d { background: #212121; border: 2px solid #000; border-top: 0; padding: .4rem .6rem; color: #55ff55; }
.adv-tip.challenge .d { color: #ff55ff; }
@media (max-width: 760px) {
  .pc-top { grid-template-columns: 1fr; }
  .pc-top .skin-stage { height: 280px; }
  .pt-grid.wide { grid-template-columns: repeat(2, 1fr); }
  .adv-view { height: 340px; }
  .adv-tab { width: 44px; height: 42px; }
  .adv-tab.on { height: 45px; }
  .adv-window { padding: 6px; }
}
/* leaderboard: one card per value, in its own color */
.lb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(330px, 100%), 1fr)); gap: 1.4rem; }
.lb-card { border: 3px solid #000; background: var(--panel); box-shadow: var(--bevel), var(--shadow); }
.lb-card .empty { padding: 1rem; }
.lb-head { display: flex; align-items: center; gap: .7rem; padding: .8rem 1rem; border-bottom: 3px solid #000;
  background: color-mix(in srgb, var(--c) 30%, var(--panel)); box-shadow: inset 2px 2px 0 rgba(255, 255, 255, .12), inset -2px -2px 0 rgba(0, 0, 0, .35); }
.lb-icon { width: 40px; height: 40px; display: grid; place-items: center; flex: none; background: #000; color: var(--c); box-shadow: inset 2px 2px 0 rgba(255, 255, 255, .08); }
.lb-icon .px-icon { width: 24px; height: 24px; }
.mc-img { image-rendering: pixelated; }
.lb-icon .mc-img { width: 32px; height: 32px; }
.lb-title { font: 400 1.05rem var(--font-pixel); text-shadow: 2px 2px 0 #000; }
button.lb-head { width: 100%; border: 0; border-bottom: 3px solid #000; color: inherit; font: inherit; text-align: left; cursor: pointer; }
button.lb-head:hover .lb-title, button.lb-head:focus-visible .lb-title { text-decoration: underline; }
/* the whole list of one value (click on a card's head) */
dialog.lb-dlg { width: min(460px, calc(100vw - 32px)); padding: 0; }
dialog.lb-dlg .lb-head { cursor: default; }
dialog.lb-dlg .lb-all { max-height: min(70vh, 640px); overflow-y: auto; }
.lb-list { list-style: none; margin: 0; padding: .4rem 0; }
.lb-row { display: grid; grid-template-columns: 1.7rem 22px 1fr auto; align-items: center; gap: .6rem; padding: .32rem 1rem; cursor: pointer; }
.lb-row:nth-child(even) { background: rgba(255, 255, 255, .025); }
.lb-row:hover { background: color-mix(in srgb, var(--c) 14%, transparent); }
.lb-row.me { background: color-mix(in srgb, var(--c) 18%, transparent); }
.lb-row .head { width: 22px; height: 22px; image-rendering: pixelated; border: 2px solid #000; }
.lb-place { width: 1.7rem; height: 1.7rem; display: grid; place-items: center; font: 400 .8rem var(--font-pixel); color: var(--muted); }
.lb-row:is(.p1, .p2, .p3) .lb-place { color: #000; border: 2px solid #000; box-shadow: inset 2px 2px 0 rgba(255, 255, 255, .45), inset -2px -2px 0 rgba(0, 0, 0, .25); }
.lb-row.p1 .lb-place { background: #ffcf3a; }
.lb-row.p2 .lb-place { background: #c9ccd6; }
.lb-row.p3 .lb-place { background: #d98a4a; }
.lb-row:is(.p1, .p2, .p3) .lb-name { font-weight: 700; }
.lb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-val { font: 400 .85rem var(--font-pixel); white-space: nowrap; }
@media (max-width: 900px) { .pt-tops { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .pt-tops { grid-template-columns: 1fr; } }

/* ---------- clans ---------- */
/* like behind the name in game: grey brackets, green name */
.clan-tag { color: #aaa; font-weight: 600; white-space: nowrap; }
.clan-tag > span { color: #55ff55; }
.chat-online .clan-tag { font-size: .8rem; }
.clan-dot { display: inline-block; width: 14px; height: 14px; flex: none; background: var(--c); border: 2px solid #000; }
.clan-colors { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .7rem; }
.clan-color { width: 28px; height: 28px; padding: 0; background: var(--c); border: 2px solid #000; cursor: pointer; }
.clan-color.on { outline: 3px solid #fff; outline-offset: 1px; }
.clan-heads { display: inline-flex; flex-wrap: wrap; gap: 2px; }
.clan-settings > summary { cursor: pointer; color: var(--muted); }

/* ---------- other pages over the player area while in voice (voicekeep.js) ---------- */
.page-frame { position: fixed; inset: 0; width: 100%; height: 100%; border: 0; z-index: 180; background: var(--bg); }
html.framed, html.framed body { overflow: hidden; }
.vc-pill { display: none; position: fixed; left: 16px; bottom: 16px; z-index: 190; align-items: center; gap: .5rem; padding: .45rem .55rem;
  background: var(--panel-2); border: 3px solid #000; box-shadow: var(--bevel), var(--shadow); max-width: calc(100vw - 32px); }
html.framed .vc-pill { display: flex; }
.vc-pill-name { all: unset; display: inline-flex; align-items: center; gap: .4rem; cursor: pointer; font-family: var(--font-pixel); color: #55ff55;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vc-pill-name:hover span { text-decoration: underline; }
.vc-create { margin-top: 1rem; }
.vc-create input { flex: 1 1 8rem; min-width: 0; width: auto; }
.vc-create select { width: auto; }

/* ---------- map (squaremap tiles + clan areas, public/js/map.js) ---------- */
.map-top { margin-bottom: .8rem; flex-wrap: wrap; gap: .6rem; }
.map-dims { margin: 0; }
/* isolation: Leaflet's own z-indexes (controls up to 1000) stay inside the map, under the menu */
.map-box { position: relative; isolation: isolate; height: min(70vh, 720px); min-height: 320px; border: 3px solid #000; background: #0b0a10; }
.map-box.leaflet-container { background: #0b0a10; font-family: var(--font-pixel); }
.map-box .leaflet-tile { image-rendering: pixelated; }
.map-box.drawing, .map-box.drawing .leaflet-interactive { cursor: crosshair; }
.map-coords { position: absolute; left: 8px; bottom: 8px; z-index: 500; pointer-events: none; font-family: var(--font-pixel); font-size: .8rem;
  background: rgba(0, 0, 0, .6); padding: .15rem .45rem; color: #ddd; }
.map-coords:empty { display: none; }
.map-drawbar { position: absolute; left: 50%; top: 8px; transform: translateX(-50%); z-index: 600; display: flex; align-items: center; gap: .5rem;
  background: var(--panel-2); border: 3px solid #000; padding: .35rem .6rem; max-width: calc(100% - 16px); flex-wrap: wrap; }
.map-drawbar[hidden] { display: none; }
#map-draw.on { outline: 3px solid #fff; outline-offset: 1px; }
.map-box .leaflet-popup-content-wrapper, .map-box .leaflet-popup-tip { background: var(--panel-2); color: var(--text, #eee); border-radius: 0; border: 2px solid #000; }
.map-pop .small { white-space: nowrap; }
.map-pop { display: flex; flex-direction: column; gap: .35rem; align-items: flex-start; font-family: var(--font-pixel); }
.map-tip { font-family: var(--font-pixel); }
.leaflet-tooltip.map-label { background: none; border: 0; box-shadow: none; padding: 0; color: #fff; font-family: var(--font-pixel);
  font-size: .85rem; text-shadow: 1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000; white-space: nowrap; pointer-events: none; }
.leaflet-tooltip.map-label::before { display: none; }
.map-box.far .map-label { display: none; }
.map-drawbar input { width: 10rem; min-height: 30px; padding: .2rem .5rem; }
.map-box .leaflet-bar a { background: var(--panel-2); color: #eee; border-bottom-color: #000; }

/* ---------- ticket list in the dashboard: fixed columns, so status and buttons line up in every row ---------- */
.ticket-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .75rem; }
.ticket-info { min-width: 0; overflow-wrap: anywhere; }
.ticket-actions { display: flex; align-items: center; justify-content: flex-end; gap: .5rem; }
.ticket-status { min-width: 7.5rem; text-align: center; }
.ticket-arch { min-width: 10rem; justify-content: center; text-align: center; }
.ticket-buttons #del-ticket { margin-left: auto; }
.thread .meta { flex-wrap: wrap; }
@media (max-width: 800px) {
  /* buttons below an open ticket: one under the other, all the same width */
  .ticket-buttons { display: grid; grid-template-columns: minmax(0, 1fr); }
  .ticket-buttons #del-ticket { margin-left: 0; }
  .ticket-row { grid-template-columns: auto minmax(0, 1fr); }
  .ticket-actions { grid-column: 1 / -1; flex-wrap: wrap; justify-content: flex-start; }
  .ticket-status { min-width: 0; }
  /* first line the badges, second line the archive button (fills it) with the delete button next to it */
  .ticket-arch { min-width: 0; flex: 1 1 calc(100% - 3rem); }
}

/* dashboard: what the clients report */
.client-row > summary { list-style: none; flex-wrap: wrap; }
.client-row > summary::-webkit-details-marker { display: none; }
.client-body { padding: .8rem .4rem .2rem; overflow-wrap: anywhere; }
.client-body p:last-child { margin-bottom: 0; }

/* Noktagram (public/js/gram.js) */
.gram { --gold-soft: #ffd36b; }
.gram img:not(.head), .gram video, .gram-card img, .gram-card video { image-rendering: auto; }
.gram button.link, .gram-dlg button.link { flex: none; display: inline; white-space: normal; color: inherit; }
.gram .gname { color: var(--text); text-decoration: none; font-family: var(--font-pixel); }
.gram .gname:hover { color: var(--yellow); }
.gram .gname .head { display: block; }
.gram-bar { display: flex; align-items: center; justify-content: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.gram-tabs { display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; }
.gram-tabs a { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .6rem; color: var(--muted); text-decoration: none; font-family: var(--font-pixel); border: 2px solid transparent; }
.gram-tabs a:hover { color: var(--text); }
.gram-tabs a.on { color: var(--text); background: var(--panel); border-color: #000; }
.gram-tabs .count { background: var(--red); color: #fff; font-size: .72rem; padding: 0 .35rem; border: 2px solid #000; }
.gram-new { margin: 0 .3rem; }
@media (max-width: 700px) {
  /* on the phone the tabs sit at the bottom like in Instagram/TikTok: the bar reaches the edge, the icons stay just above the iPhone's home bar */
  .gram-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 150; margin: 0; gap: .5rem;
    padding: .35rem .6rem max(.35rem, calc(env(safe-area-inset-bottom) - 12px)); background: var(--panel); border-top: 3px solid #000; }
  body.gram-mode { padding-bottom: calc(4rem + env(safe-area-inset-bottom)); }
  body.gram-mode .vc-pill, body.gram-mode .toast-box { bottom: calc(4.5rem + env(safe-area-inset-bottom)); }
  .gram-tabs { margin-left: 0; width: 100%; justify-content: space-between; flex-wrap: nowrap; }
  /* Home, Noks, +, Activity, Profile (then Reports for moderators) */
  .gram-tabs .gram-new { margin: 0; }
  .gram-tabs a span:not(.count) { display: none; }
  .gram-tabs a { padding: .45rem .6rem; }
  .gram-tabs .px-icon { width: 20px; height: 20px; }
  .gram-new span { display: none; }
}

.gbtn { all: unset; display: inline-flex; align-items: center; gap: .3rem; cursor: pointer; color: var(--text); font-family: var(--font-pixel); padding: .25rem; }
.gbtn .px-icon { width: 22px; height: 22px; }
.gbtn:hover:not(:disabled) { color: var(--yellow); }
.gbtn.on, .gbtn.on:hover { color: var(--red); }
.gbtn:disabled { opacity: .5; cursor: default; }
.gbtn:focus-visible { outline: 2px solid var(--yellow); }
.gclose .px-icon { width: 18px; height: 18px; }

/* feed */
.gfeed { max-width: 840px; margin: 0 auto; }
.gstories { display: flex; gap: .9rem; overflow-x: auto; padding: .3rem .2rem .8rem; margin-bottom: .6rem; scrollbar-width: thin; }
.gstory { all: unset; display: flex; flex-direction: column; align-items: center; gap: .3rem; cursor: pointer; width: 84px; flex-shrink: 0; position: relative; }
.gstory-name { font-size: .72rem; max-width: 84px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }
.ringbtn { all: unset; cursor: pointer; display: block; }
.ring { display: grid; place-items: center; padding: 3px; background: linear-gradient(135deg, var(--gold-soft), #a970ff 55%, #511457); }
.ring.seen { background: #4a4555; }
.ring.none { background: transparent; }
.ring .head { width: 58px; height: 58px; border: 3px solid var(--bg); }
.ring.big .head, .big .ring .head { width: 96px; height: 96px; }
.gplus { all: unset; position: absolute; top: 46px; right: 10px; width: 20px; height: 20px; display: grid; place-items: center; background: var(--green); border: 2px solid #000; cursor: pointer; color: #fff; }
.gplus .px-icon { width: 10px; height: 10px; }

.gpost { background: var(--panel); border: 3px solid #000; box-shadow: var(--bevel), var(--shadow); margin-bottom: 1.4rem; }
.gpost header, .pd-side header { display: flex; align-items: center; gap: .6rem; padding: .55rem .7rem; }
.gwho { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.2; }
.gpost .badge.purple { background: #7a4fc0; color: #fff; text-decoration: none; display: inline-flex; align-items: center; gap: .3rem; }
.gtext { display: contents; }
.gcaption { padding: 0 .8rem .4rem; overflow-wrap: anywhere; white-space: pre-wrap; }
.gtags { padding: 0 .8rem .4rem; color: var(--muted); display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.gtags .px-icon { width: 12px; height: 12px; }
.gall { padding: 0 .8rem .7rem !important; display: block !important; }
.gactions { display: flex; align-items: center; gap: .5rem; padding: .35rem .55rem; }
.gmore { height: 1px; }

.gmedia { position: relative; background: #000; aspect-ratio: 1; overflow: hidden; border-top: 3px solid #000; border-bottom: 3px solid #000; user-select: none; }
.gtrack { display: flex; height: 100%; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; scrollbar-width: none; }
.gtrack::-webkit-scrollbar { display: none; }
.gslide { flex: 0 0 100%; height: 100%; min-height: 0; overflow: hidden; scroll-snap-align: center; display: grid; place-items: center; }
/* in the feed cut to the box from the middle (a 9:16 Nok too); uncut in the post itself and in Noks */
.gslide img, .gslide video { width: 100%; height: 100%; min-height: 0; object-fit: cover; display: block; }
.pd-media .gslide img, .pd-media .gslide video { object-fit: contain; }
.gnav { all: unset; position: absolute; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; display: grid; place-items: center; cursor: pointer;
  background: rgba(0, 0, 0, .55); color: #fff; font: 400 1.3rem var(--font-pixel); border: 2px solid #000; }
.gnav.prev { left: 8px; } .gnav.next { right: 8px; }
.gnav:hover { color: var(--yellow); }
.gnav[hidden] { display: none; }
@media (hover: none) { .gnav { display: none; } }
.gdots { position: absolute; bottom: 8px; left: 0; right: 0; display: flex; justify-content: center; gap: 5px; pointer-events: none; }
.gdots i { width: 6px; height: 6px; background: rgba(255, 255, 255, .45); border: 1px solid #000; }
.gdots i.on { background: #fff; }
.gsound { all: unset; position: absolute; right: 8px; bottom: 8px; width: 30px; height: 30px; display: grid; place-items: center; cursor: pointer; background: rgba(0, 0, 0, .6); color: #fff; border: 2px solid #000; z-index: 2; }
.gsound .px-icon { width: 16px; height: 16px; }
/* sound button with volume slider (the slider only on PC, while the mouse is over it) */
.gvol { display: inline-flex; align-items: center; gap: .35rem; }
.gvol.abs { position: absolute; right: 8px; bottom: 8px; z-index: 2; }
.gvol .gsound { position: static; }
.gvol-range { display: none; }
@media (hover: hover) and (pointer: fine) {
  .gvol:hover .gvol-range, .gvol:focus-within .gvol-range { display: block; }
  .gvol-range { -webkit-appearance: none; appearance: none; width: 96px; height: 30px; margin: 0; padding: 0 .5rem; box-sizing: border-box;
    background: rgba(0, 0, 0, .6); border: 2px solid #000; cursor: pointer; }
  .gvol-range:focus { outline: none; }
  .gvol-range::-webkit-slider-runnable-track { height: 4px; background: linear-gradient(#fff, #fff) 0 0 / var(--p) 100% no-repeat, rgba(255, 255, 255, .3); }
  .gvol-range::-webkit-slider-thumb { -webkit-appearance: none; width: 10px; height: 10px; margin-top: -3px; background: #fff; border: 0; box-shadow: 1px 1px 0 #000; }
  .gvol-range::-moz-range-track { height: 4px; background: rgba(255, 255, 255, .3); }
  .gvol-range::-moz-range-progress { height: 4px; background: #fff; }
  .gvol-range::-moz-range-thumb { width: 10px; height: 10px; background: #fff; border: 0; border-radius: 0; }
}
/* opens the post big (PC) */
.gexpand { all: unset; position: absolute; right: 8px; top: 8px; width: 30px; height: 30px; display: none; place-items: center; cursor: pointer; background: rgba(0, 0, 0, .6); color: #fff; border: 2px solid #000; z-index: 2; }
.gexpand .px-icon { width: 16px; height: 16px; }
.gexpand:hover { color: var(--yellow); }
@media (hover: hover) and (pointer: fine) { .gmedia:hover .gexpand { display: grid; } .gpost .gmedia .gslide img { cursor: zoom-in; } }
.gburst { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; color: #fff; opacity: 0; filter: drop-shadow(3px 3px 0 #000); }
.gburst .px-icon { width: 90px; height: 90px; }
.gburst.go { animation: gburst .8s ease-out; }
@keyframes gburst { 0% { opacity: 0; transform: scale(.4); } 20% { opacity: 1; transform: scale(1.1); } 70% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1); } }

/* dialogs of Noktagram */
.gram-dlg { padding: 1rem; }
.gram-dlg input[type="text"], .gram-dlg input[type="search"], .gram-dlg textarea { width: 100%; }
.post-dlg { width: calc(100vw - 48px); height: calc(100dvh - 48px); max-width: none; max-height: none; padding: 0; }
.pd { display: grid; grid-template-columns: minmax(0, 1fr) clamp(320px, 28vw, 440px); height: 100%; }
.pd-media { background: #000; display: grid; align-items: center; min-height: 0; }
.pd-media .gmedia { border: 0; max-height: 100%; width: 100%; margin: auto; aspect-ratio: auto !important; height: 100%; }
.pd-side { display: flex; flex-direction: column; min-height: 0; border-left: 3px solid #000; }
.pd-side header { border-bottom: 2px solid #000; }
.pd-comments { flex: 1; overflow-y: auto; padding: .6rem .7rem; overscroll-behavior: contain; }
.pd-actions { border-top: 2px solid #000; padding-bottom: .3rem; }
.pd-actions .gtags { padding: 0 .7rem; }
.pd-form { display: flex; gap: .4rem; padding: .5rem; border-top: 2px solid #000; }
.pd-form input { flex: 1; min-width: 0; }
.post-dlg .sticker-picker { height: 200px; }
@media (max-width: 760px) {
  .post-dlg { width: 100vw; max-height: 100dvh; height: 100dvh; margin: 0; border: 0; }
  .pd { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); height: 100dvh; }
  .pd-media .gmedia { height: auto; max-height: 45dvh; aspect-ratio: 1 !important; }
  .pd-side { border-left: 0; border-top: 3px solid #000; }
  .pd-side header { order: -1; }
}
.gc { display: flex; gap: .55rem; margin-bottom: .75rem; overflow-wrap: anywhere; }
.gc.sub { margin-left: 2.4rem; }
.gc.caption { padding-bottom: .7rem; border-bottom: 2px solid #2a2635; }
.gc-body { flex: 1; min-width: 0; }
.gc-who .gname, .gcaption .gname { color: var(--purple); }
.gc-who { font-size: .9rem; line-height: 1.3; }
.gc-text { white-space: pre-wrap; }
.gc-meta { display: flex; gap: .7rem; margin-top: .15rem; flex-wrap: wrap; }
.gc-meta .link:hover { color: var(--yellow); }
.gc .sticker { max-width: 110px; max-height: 110px; display: block; margin-top: .2rem; }

/* stories */
.story-dlg { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #000; }
.story { position: relative; height: 100%; max-width: calc(100dvh * 9 / 16); margin: 0 auto; display: flex; flex-direction: column; }
.sbars { display: flex; gap: 4px; padding: 10px 10px 0; position: relative; z-index: 3; }
.sbars span { flex: 1; height: 3px; background: rgba(255, 255, 255, .3); }
.sbars i { display: block; height: 100%; background: #fff; }
.shead { display: flex; align-items: center; gap: .5rem; padding: .5rem .7rem; position: relative; z-index: 3; text-shadow: 1px 1px 0 #000; }
.smedia { flex: 1; min-height: 0; display: grid; place-items: center; }
.smedia img, .smedia video { max-width: 100%; max-height: 100%; object-fit: contain; }
.szone { all: unset; position: absolute; top: 70px; bottom: 80px; width: 35%; cursor: pointer; z-index: 2; }
.szone.prev { left: 0; } .szone.next { right: 0; }
.sfoot { display: flex; align-items: center; gap: .5rem; padding: .6rem .7rem calc(.6rem + env(safe-area-inset-bottom)); position: relative; z-index: 3; }
.sreply { flex: 1; }
.sreply input { width: 100%; background: transparent; border: 2px solid rgba(255, 255, 255, .5); color: #fff; }
.sviewers { position: absolute; left: 0; right: 0; bottom: 0; max-height: 60%; overflow-y: auto; background: var(--panel); border-top: 3px solid #000; padding: .8rem; z-index: 4; }
.sviewers[hidden] { display: none; }
.like-on { color: var(--red); margin-left: auto; }

/* Noks */
.noks-dlg { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #000; }
.noks-top { position: absolute; top: 0; left: 0; z-index: 5; display: flex; align-items: center; gap: .5rem; padding: .6rem .8rem; font: 400 1.2rem var(--font-pixel); text-shadow: 2px 2px 0 #000; }
.noks-top img { width: 28px; height: 28px; image-rendering: pixelated !important; }
.noks-feed { height: 100%; overflow-y: auto; scroll-snap-type: y mandatory; scrollbar-width: none; }
.noks-feed::-webkit-scrollbar { display: none; }
.nok { height: 100dvh; scroll-snap-align: start; scroll-snap-stop: always; display: grid; place-items: center; }
.nok-frame { position: relative; width: 100%; height: 100%; min-width: 0; min-height: 0; background: #0b0a10; user-select: none; }
.nok-frame video { width: 100%; height: 100%; object-fit: contain; display: block; }
.nok-info { position: absolute; left: 0; right: 64px; bottom: 0; padding: 1rem .9rem calc(1.5rem + env(safe-area-inset-bottom)); text-shadow: 1px 1px 0 #000;
  background: linear-gradient(transparent, rgba(0, 0, 0, .7)); }
.nok-info .row { gap: .5rem; }
.nok-caption { margin-top: .4rem; overflow-wrap: anywhere; max-height: 6em; overflow-y: auto; }
.nok-side { position: absolute; right: 6px; bottom: calc(1.2rem + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; gap: .8rem; z-index: 2; }
.nok-side .gbtn { flex-direction: column; gap: .15rem; font-size: .8rem; filter: drop-shadow(2px 2px 0 #000); }
.nok-side .gbtn .px-icon { width: 28px; height: 28px; }
.nok-frame .gvol.abs { top: 56px; bottom: auto; }
.nok-paused { position: absolute; inset: 0; display: none; place-items: center; pointer-events: none; color: #fff; opacity: .85; filter: drop-shadow(3px 3px 0 #000); }
.nok-paused .px-icon { width: 72px; height: 72px; }
.nok-frame.paused .nok-paused { display: grid; }
.nok-seek { position: absolute; left: 0; right: 0; bottom: env(safe-area-inset-bottom); width: 100%; height: 16px; margin: 0; padding: 0; z-index: 3;
  appearance: none; -webkit-appearance: none; background: transparent; border: 0; cursor: pointer; --p: 0%; }
.nok-seek:focus { outline: none; }
.nok-seek::-webkit-slider-runnable-track { height: 4px; background: linear-gradient(#fff, #fff) 0 0 / var(--p) 100% no-repeat, rgba(255, 255, 255, .3); }
.nok-seek::-webkit-slider-thumb { -webkit-appearance: none; width: 10px; height: 10px; margin-top: -3px; background: #fff; border: 0; box-shadow: 1px 1px 0 #000; opacity: 0; }
.nok-seek::-moz-range-track { height: 4px; background: rgba(255, 255, 255, .3); }
.nok-seek::-moz-range-progress { height: 4px; background: #fff; }
.nok-seek::-moz-range-thumb { width: 10px; height: 10px; background: #fff; border: 0; border-radius: 0; opacity: 0; }
.nok-frame:hover .nok-seek::-webkit-slider-thumb, .nok-frame.paused .nok-seek::-webkit-slider-thumb { opacity: 1; }
.nok-frame:hover .nok-seek::-moz-range-thumb, .nok-frame.paused .nok-seek::-moz-range-thumb { opacity: 1; }
/* the same seek bar under videos in a post opened big */
.pd-media .gslide { position: relative; }
.gslide:hover .gseek::-webkit-slider-thumb { opacity: 1; }
.gslide:hover .gseek::-moz-range-thumb { opacity: 1; }
.pd-media .gvol.abs, .pd-media .gdots { bottom: 22px; }
@media (min-width: 900px) {
  /* the frame takes the shape of its video (--ar from the metadata, upright until then) and fits the screen next to the buttons */
  .nok-frame { width: min(calc(100vw - 160px), calc(100dvh * var(--ar, .5625))); height: auto; aspect-ratio: var(--ar, .5625); }
  .nok-side { right: -64px; }
  .nok-info { right: 0; }
}

/* sharing, menu, new post */
.share-dlg { width: min(420px, calc(100vw - 32px)); }
.share-dlg input { margin: .7rem 0; }
.gpeople { max-height: 50dvh; overflow-y: auto; }
.gperson { display: flex; align-items: center; gap: .6rem; padding: .35rem 0; }
.more-dlg { width: min(320px, calc(100vw - 32px)); padding: 0; }
.gmenu { display: flex; flex-direction: column; }
.gmenu button { all: unset; padding: .85rem 1rem; text-align: center; cursor: pointer; font-family: var(--font-pixel); border-bottom: 2px solid #000; }
.gmenu button:last-child { border-bottom: 0; color: var(--muted); }
.gmenu button:hover { background: var(--panel-2); color: var(--yellow); }
.gmenu .red { color: var(--red); }
.new-dlg { width: min(560px, calc(100vw - 32px)); display: none; }
.new-dlg[open] { display: flex; flex-direction: column; gap: .8rem; }
.seg { display: flex; border: 2px solid #000; }
.seg button { all: unset; flex: 1; text-align: center; padding: .5rem; cursor: pointer; font-family: var(--font-pixel); color: var(--muted); background: var(--slot); }
.seg button + button { border-left: 2px solid #000; }
.seg button.on { color: var(--text); background: var(--purple); text-shadow: 1px 1px 0 #000; }
.new-files { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: .5rem; }
.new-file, .new-add { position: relative; aspect-ratio: 1; border: 2px solid #000; background: var(--slot); overflow: hidden; display: grid; place-items: center; }
.new-file img, .new-file video { width: 100%; height: 100%; object-fit: cover; }
.new-add { all: unset; aspect-ratio: 1; border: 2px dashed #4a4555; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem; cursor: pointer; color: var(--muted); font-size: .75rem; text-align: center; padding: .3rem; }
.new-add:hover { color: var(--text); border-color: var(--purple); }
.new-pct { font-family: var(--font-pixel); color: var(--muted); }
.new-x { all: unset; position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; display: grid; place-items: center; background: rgba(0, 0, 0, .7); color: #fff; cursor: pointer; font-size: .8rem; }
.new-more { display: flex; flex-direction: column; gap: .6rem; }
.new-more[hidden] { display: none; }
.new-tagbox { display: flex; flex-direction: column; gap: .6rem; }
.new-tags { display: flex; flex-wrap: wrap; gap: .4rem; }
.new-tags:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: .35rem; background: var(--panel-2); border: 2px solid #000; padding: .1rem .2rem .1rem .1rem; font-size: .85rem; }
.chip button { all: unset; cursor: pointer; padding: 0 .3rem; color: var(--muted); }
.new-tag-search { position: relative; }
.new-hits { display: flex; flex-direction: column; }
.new-hits button { all: unset; display: flex; align-items: center; gap: .5rem; padding: .35rem .4rem; cursor: pointer; }
.new-hits button:hover { background: var(--panel-2); }

/* profile, activity, reports */
.gprofile { max-width: 940px; margin: 0 auto; }
.gp-head { display: flex; align-items: center; gap: 1.6rem; padding: .5rem 0 1.2rem; flex-wrap: wrap; }
.gp-info { display: flex; flex-direction: column; gap: .6rem; align-items: flex-start; }
.gp-name { font: 400 1.6rem var(--font-pixel); }
.gp-counts { display: flex; gap: 1.2rem; flex-wrap: wrap; }
.gp-counts b { font-family: var(--font-pixel); font-weight: 400; color: #fff; }
.gp-tabs { display: flex; justify-content: center; gap: 1.4rem; border-top: 2px solid #000; margin-bottom: .6rem; flex-wrap: wrap; }
.gp-tabs a { display: inline-flex; align-items: center; gap: .4rem; padding: .7rem .2rem; color: var(--muted); text-decoration: none; font-family: var(--font-pixel); border-top: 3px solid transparent; margin-top: -2px; }
.gp-tabs a.on { color: var(--text); border-top-color: var(--text); }
@media (max-width: 600px) { .gp-tabs { gap: .4rem; justify-content: space-around; } .gp-tabs a span { display: none; } .gp-tabs .px-icon { width: 20px; height: 20px; } }
.ggrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.ggrid .empty { grid-column: 1 / -1; }
.gtile { all: unset; position: relative; aspect-ratio: 1; background: var(--slot); cursor: pointer; overflow: hidden; }
.gtile img, .gtile video { width: 100%; height: 100%; object-fit: cover; display: block; transition: filter .15s; }
.gtile:hover img, .gtile:hover video { filter: brightness(.75); }
.gtile-ic { position: absolute; top: 6px; right: 6px; color: #fff; filter: drop-shadow(2px 2px 0 #000); }
.gtile-ic .px-icon { width: 18px; height: 18px; }
.glist { max-width: 640px; margin: 0 auto; }
.gact { display: flex; align-items: center; gap: .7rem; padding: .6rem .7rem; background: var(--panel); border: 3px solid #000; margin-bottom: .5rem; overflow-wrap: anywhere; flex-wrap: wrap; }
.gact.unread { border-color: var(--purple); }
.gact-thumb { all: unset; width: 48px; height: 48px; cursor: pointer; flex-shrink: 0; background: var(--slot); overflow: hidden; }
.gact-thumb img, .gact-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }

/* a shared post or story in the direct messages */
.gram-card { display: flex; align-items: center; gap: .6rem; max-width: 300px; margin-top: .3rem; padding: .4rem; background: var(--slot); border: 2px solid #000; color: var(--text); text-decoration: none; }
.gram-card:hover { border-color: var(--purple); }
.gram-card img, .gram-card video { width: 56px; height: 56px; object-fit: cover; flex-shrink: 0; }
.gram-card > span { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.gram-card.gone { display: block; }
.gram-btn img { width: 20px; height: 20px; image-rendering: pixelated; display: block; }
.tabs .count { background: var(--red); color: #fff; font-size: .72rem; padding: 0 .35rem; border: 2px solid #000; margin-left: .25rem; }
