﻿/* Calm, high-contrast, big targets, no animation. Sizes are in rem so the A / A+ / A++ switch scales everything.
   Every colour is a variable: the dark palette below simply swaps them.
   html[data-mode] is "auto" (follow the system, light when the system says nothing), "light" or "dark". */
:root {
  --bg: #fffdf8;
  --surface: #ffffff;
  --fg: #1a1a1a;
  --muted: #4a4a4a;
  --link: #0b5cad;
  --link-hover: #08457f;
  --btn: #0b5cad;
  --btn-hover: #08457f;
  --btn-fg: #ffffff;
  --ghost-fg: #0b5cad;
  --ghost-hover: #eef5fc;
  --ghost-edge: #b9c9db;
  --chip: #0b5cad;
  --chip-on: #0b5cad;
  --danger: #a31515;
  --danger-hover: #7d1010;
  --ok-bg: #e6f4ea;
  --ok-fg: #0f5223;
  --err-bg: #fdecea;
  --err-fg: #7a1010;
  --warn-bg: #fff6dc;
  --warn-fg: #6b4700;
  --gray-bg: #eeeeee;
  --gray-fg: #444444;
  --soft: #e4dfd2;
  --border: #6b6b6b;
  --focus: #e08a00;
  --code-bg: #f1ede2;
  --addr-bg: #f6f3ea;
  --input-bg: #ffffff;
  --thumb-bg: #e4dfd2;
  --radius: 12px;
  color-scheme: light;
}
html[data-mode="auto"] { color-scheme: light dark; }

/* ---- dark palette: forced ... */
html[data-mode="dark"] {
  --bg: #14161a;
  --surface: #1e2228;
  --fg: #ececec;
  --muted: #b4bbc5;
  --link: #8cc4ff;
  --link-hover: #b9dcff;
  --btn: #1f6fc4;
  --btn-hover: #185ba3;
  --ghost-fg: #8cc4ff;
  --ghost-hover: #252c36;
  --ghost-edge: #0f1114;
  --chip: #8cc4ff;
  --chip-on: #1f6fc4;
  --danger: #c53030;
  --danger-hover: #a32525;
  --ok-bg: #15301f;
  --ok-fg: #9be2b0;
  --err-bg: #3b1b1b;
  --err-fg: #ffb9b9;
  --warn-bg: #3a3010;
  --warn-fg: #ffd77a;
  --gray-bg: #2b3038;
  --gray-fg: #c9cfd8;
  --soft: #353b45;
  --border: #8b94a1;
  --focus: #ffb703;
  --code-bg: #2a2f37;
  --addr-bg: #262b33;
  --input-bg: #171a1f;
  --thumb-bg: #2a2f37;
  color-scheme: dark;
}
/* ... and automatic (the system asks for dark, and the visitor did not choose) */
@media (prefers-color-scheme: dark) {
  html[data-mode="auto"] {
    --bg: #14161a;
    --surface: #1e2228;
    --fg: #ececec;
    --muted: #b4bbc5;
    --link: #8cc4ff;
    --link-hover: #b9dcff;
    --btn: #1f6fc4;
    --btn-hover: #185ba3;
    --ghost-fg: #8cc4ff;
    --ghost-hover: #252c36;
    --ghost-edge: #0f1114;
    --chip: #8cc4ff;
    --chip-on: #1f6fc4;
    --danger: #c53030;
    --danger-hover: #a32525;
    --ok-bg: #15301f;
    --ok-fg: #9be2b0;
    --err-bg: #3b1b1b;
    --err-fg: #ffb9b9;
    --warn-bg: #3a3010;
    --warn-fg: #ffd77a;
    --gray-bg: #2b3038;
    --gray-fg: #c9cfd8;
    --soft: #353b45;
    --border: #8b94a1;
    --focus: #ffb703;
    --code-bg: #2a2f37;
    --addr-bg: #262b33;
    --input-bg: #171a1f;
    --thumb-bg: #2a2f37;
  }
}

html { font-size: 18px; -webkit-text-size-adjust: 100%; }
html.fs2 { font-size: 21px; }
html.fs3 { font-size: 25px; }
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.55;
}
.wrap { max-width: 46rem; margin: 0 auto; padding: 0 1rem; }
main.wrap { padding-top: 1rem; padding-bottom: 3rem; }
h1 { font-size: 1.7rem; line-height: 1.25; margin: 1rem 0 .6rem; }
h2 { font-size: 1.3rem; line-height: 1.3; margin: 1.6rem 0 .5rem; }
h3 { font-size: 1.1rem; margin: 1.2rem 0 .4rem; }
p { margin: .6rem 0; }
a { color: var(--link); text-underline-offset: .15em; }
a:hover { color: var(--link-hover); }
:focus-visible { outline: 4px solid var(--focus); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: #000; color: #fff; padding: .6rem 1rem; z-index: 10; }
.skip:focus { left: 0; }
.muted, .hint { color: var(--muted); }
.hint { font-size: .9rem; margin: .1rem 0 .4rem; }
.lead { font-size: 1.15rem; }

/* header */
.top { background: var(--surface); border-bottom: 3px solid var(--soft); }
.top .wrap { padding-top: .6rem; padding-bottom: .6rem; }
.brand { font-size: 1.3rem; font-weight: 800; color: var(--fg); text-decoration: none; display: inline-block; padding: .2rem 0; }
.brand:hover { color: var(--fg); }
.menu { display: flex; flex-wrap: wrap; gap: .3rem 1.1rem; align-items: center; margin: .3rem 0; }
.menu a, .linkbtn { font-size: 1rem; padding: .4rem 0; }
.menu a.strong { font-weight: 700; }
.inline { display: inline; margin: 0; }
.linkbtn { background: none; border: 0; color: var(--link); font: inherit; cursor: pointer; text-decoration: underline; padding: .4rem 0; }
.tools { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; font-size: .9rem; color: var(--muted); padding-top: .4rem; }
/* on a phone the four setting rows are folded into one line; app.js opens them on wide screens */
.toolbox > summary { cursor: pointer; display: inline-block; padding: .35rem .8rem; border: 2px solid var(--chip); border-radius: 999px; color: var(--chip); font-weight: 600; font-size: .9rem; background: var(--surface); }
.toolbox[open] > summary { margin-bottom: .2rem; }
.tool { display: inline-flex; align-items: center; gap: .3rem; flex-wrap: wrap; }
.chip { display: inline-block; min-width: 2.4rem; text-align: center; padding: .25rem .5rem; border: 2px solid var(--chip); border-radius: 8px; text-decoration: none; font-weight: 600; background: var(--surface); color: var(--chip); }
.chip:hover { color: var(--chip); }
.chip.on { background: var(--chip-on); color: #fff; }

/* the light / auto / dark switch: one pill, three segments */
.seg { display: inline-flex; border: 2px solid var(--chip); border-radius: 999px; overflow: hidden; }
.seg > * { padding: .25rem .7rem; font-weight: 600; text-decoration: none; background: var(--surface); color: var(--chip); }
.seg > * + * { border-left: 2px solid var(--chip); }
.seg > strong { background: var(--chip-on); color: #fff; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 3.1rem; padding: .55rem 1.3rem;
  font: inherit; font-weight: 700; text-decoration: none; text-align: center;
  color: var(--btn-fg); background: var(--btn); border: 2px solid var(--btn);
  border-radius: var(--radius); cursor: pointer;
}
.btn:hover { background: var(--btn-hover); border-color: var(--btn-hover); color: var(--btn-fg); }
.btn.big { min-height: 3.5rem; font-size: 1.1rem; width: 100%; }
.btn.small { min-height: 2.4rem; padding: .3rem .9rem; font-size: .9rem; }
.btn.ghost { background: var(--surface); color: var(--ghost-fg); }
.btn.ghost:hover { background: var(--ghost-hover); color: var(--ghost-fg); border-color: var(--btn); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); color: #fff; }
.actions { display: flex; flex-direction: column; gap: .8rem; margin: 1rem 0; }

/* forms */
.form { display: block; margin: 1rem 0; }
.field { margin: 0 0 1.1rem; }
label { display: block; font-weight: 700; margin-bottom: .25rem; }
label.check { display: flex; gap: .7rem; align-items: flex-start; font-weight: 400; margin: 1.2rem 0; }
input[type=checkbox] { width: 1.6rem; height: 1.6rem; flex: none; margin-top: .1rem; }
input[type=text], input[type=email], input[type=password], input[type=file], select, textarea {
  width: 100%; font: inherit; color: var(--fg); background: var(--input-bg);
  padding: .7rem .8rem; border: 2px solid var(--border); border-radius: 10px; min-height: 3rem;
}
input[type=file] { padding: .5rem; }
textarea { resize: vertical; }
.pw { display: flex; gap: .5rem; }
.pw input { flex: 1; }
.pw button { display: none; flex: none; }
html.js .pw button { display: inline-flex; }

/* messages */
.flash { padding: .8rem 1rem; border-radius: var(--radius); border: 2px solid; margin: 1rem 0; font-weight: 600; }
.flash ul { margin: 0; padding-left: 1.2rem; }
.flash.ok { background: var(--ok-bg); color: var(--ok-fg); border-color: var(--ok-fg); }
.flash.err { background: var(--err-bg); color: var(--err-fg); border-color: var(--err-fg); }
.flash a { color: inherit; }

/* landing */
.hero { padding: 1rem 0 .5rem; }
.hero-art { display: none; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: .7rem; margin: 1rem 0; }
.stats > div { background: var(--surface); border: 2px solid var(--soft); border-radius: var(--radius); padding: .7rem .9rem; }
.stats dt { color: var(--muted); font-size: .9rem; }
.stats dd { margin: 0; font-size: 1.7rem; font-weight: 800; }
.stats.two { grid-template-columns: repeat(2, 1fr); }
.steps { padding-left: 1.5rem; }
.steps li { margin: .7rem 0; }
.rules { padding-left: 1.5rem; }
.rules h2 { font-size: 1.15rem; margin: 1rem 0 .2rem; }

/* cabinet */
.actions-grid { display: grid; gap: 1rem; margin: 1rem 0; }
.panel { background: var(--surface); border: 2px solid var(--soft); border-radius: var(--radius); padding: 1rem; margin: 1rem 0; }
.panel h2 { margin-top: .2rem; }
.panel.danger { border-color: var(--danger); }
.cards { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
.rowlink { display: flex; gap: .8rem; align-items: center; padding: .7rem; background: var(--surface); border: 2px solid var(--soft); border-radius: var(--radius); text-decoration: none; color: var(--fg); }
.rowlink:hover { border-color: var(--btn); color: var(--fg); }
.meta { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.thumb { width: 4.2rem; height: 4.2rem; object-fit: cover; border-radius: 8px; flex: none; background: var(--thumb-bg); }
.thumb.ph { display: inline-flex; align-items: center; justify-content: center; font-size: 1.6rem; }
.badge { display: inline-block; align-self: flex-start; padding: .1rem .6rem; border-radius: 999px; font-size: .85rem; font-weight: 700; border: 2px solid; }
.badge.s-sent { background: var(--warn-bg); color: var(--warn-fg); border-color: var(--warn-fg); }
.badge.s-registered { background: var(--ok-bg); color: var(--ok-fg); border-color: var(--ok-fg); }
.badge.s-expired { background: var(--gray-bg); color: var(--gray-fg); border-color: var(--gray-fg); }

/* card page */
.steps-panel { border-color: var(--btn); }
.bigcode { font-size: 2.1rem; font-weight: 800; letter-spacing: .06em; text-align: center; background: var(--warn-bg); color: var(--warn-fg); border: 3px dashed var(--warn-fg); border-radius: var(--radius); padding: .6rem; margin: .5rem 0 1rem; user-select: all; }
.address { font: inherit; font-size: 1.25rem; font-weight: 600; white-space: pre-wrap; word-break: break-word; background: var(--addr-bg); color: var(--fg); border: 2px solid var(--border); border-radius: var(--radius); padding: 1rem; margin: .5rem 0; }
.facts { display: grid; gap: .5rem; margin: 1rem 0; }
.facts > div { display: flex; flex-wrap: wrap; gap: .3rem 1rem; border-bottom: 1px solid var(--soft); padding-bottom: .4rem; }
.facts dt { color: var(--muted); min-width: 9rem; }
.facts dd { margin: 0; font-weight: 600; }
blockquote { margin: .5rem 0; padding: .5rem 1rem; border-left: 5px solid var(--soft); background: var(--surface); }
.about { white-space: pre-wrap; }
img.full { max-width: 100%; height: auto; border-radius: var(--radius); border: 2px solid var(--soft); }
.photo { margin: 1rem 0 1.5rem; }

.adminnav { display: flex; flex-wrap: wrap; gap: .5rem; margin: .5rem 0 1rem; }
details.report { margin: 2rem 0; padding: .6rem 1rem; border: 2px solid var(--soft); border-radius: var(--radius); background: var(--surface); }
details.report summary { cursor: pointer; font-weight: 700; padding: .4rem 0; }
code { background: var(--code-bg); padding: .1rem .35rem; border-radius: 5px; }

.foot { border-top: 3px solid var(--soft); color: var(--muted); font-size: .9rem; padding: 1rem 0 2rem; background: var(--surface); }

@media (min-width: 40rem) {
  .actions { flex-direction: row; }
  .btn.big { width: auto; min-width: 14rem; }
  .actions-grid { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .stats.two { grid-template-columns: repeat(2, 1fr); }
}

/* =====================================================================================================
   v2: tiles, gallery, avatars, social circles, bell, moderator queue, photo cropper
   ===================================================================================================== */

/* stats tiles fit whatever width they get: no more squeezed Russian captions */
.stats { grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); }
.stats.two { grid-template-columns: repeat(2, 1fr); }

/* header: brand + bell on one line */
.topline { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.bell { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 2.9rem; height: 2.9rem; border-radius: 50%; color: var(--link); border: 2px solid var(--soft); background: var(--surface); }
.bell:hover { color: var(--link-hover); border-color: var(--btn); }
.bell svg { width: 1.5rem; height: 1.5rem; fill: currentColor; }
.nbadge { position: absolute; top: -.35rem; right: -.35rem; min-width: 1.4rem; height: 1.4rem; padding: 0 .3rem; border-radius: 999px; background: var(--danger); color: #fff; font-size: .75rem; font-weight: 800; line-height: 1.4rem; text-align: center; }
.nbadge.inl { position: static; display: inline-block; vertical-align: middle; }

/* flags and avatars */
.flag { display: inline-block; width: 1.25rem; height: auto; vertical-align: -.1em; border-radius: 2px; box-shadow: 0 0 0 1px var(--soft); }
.avatar { display: inline-block; border-radius: 50%; object-fit: cover; flex: none; vertical-align: middle; background: var(--thumb-bg); }
.avatar.sm { width: 1.6rem; height: 1.6rem; }
.avatar.md { width: 2.4rem; height: 2.4rem; }
.avatar.lg { width: 5.5rem; height: 5.5rem; }
.avatar.ph { display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; }
.avatar.sm.ph { font-size: .8rem; }
.avatar.md.ph { font-size: 1.1rem; }
.avatar.lg.ph { font-size: 2.4rem; }
.avatar.h0 { background: #1f6fc4; } .avatar.h1 { background: #0b7a6e; } .avatar.h2 { background: #a82e10; }
.avatar.h3 { background: #6a4bb5; } .avatar.h4 { background: #8a5a00; } .avatar.h5 { background: #b0286e; }
.profile-head { display: flex; align-items: center; gap: 1rem; margin: 1rem 0; }
.profile-head h1 { margin: 0; }

/* round social links, like on a player profile */
.socials { display: flex; gap: .6rem; list-style: none; padding: 0; margin: .6rem 0; }
.soc { display: inline-flex; align-items: center; justify-content: center; width: 2.8rem; height: 2.8rem; border-radius: 50%; color: #fff; font-weight: 800; text-decoration: none; }
.soc svg { width: 1.4rem; height: 1.4rem; fill: #fff; }
.soc.tg { background: #1c90c9; } .soc.vk { background: #0077ff; }
.soc:hover { color: #fff; filter: brightness(1.1); }

/* picture tiles: cabinet, gallery, favorites */
.tiles { list-style: none; padding: 0; margin: 0; display: grid; gap: .8rem; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); }
.nowrap { white-space: nowrap; }
.tile { position: relative; background: var(--surface); border: 2px solid var(--soft); border-radius: var(--radius); overflow: hidden; }
.tile:hover { border-color: var(--btn); }
.tile-link { display: block; color: var(--fg); text-decoration: none; }
.tile-link:hover { color: var(--fg); }
.tile-img { position: relative; display: block; aspect-ratio: 4 / 3; background: var(--thumb-bg); overflow: hidden; }
.tile-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.tile-img.ph { display: flex; align-items: center; justify-content: center; font-size: 2.4rem; color: var(--muted); }
.tile-flag { position: absolute; left: .4rem; bottom: .4rem; padding: .1rem .5rem; border-radius: 999px; background: var(--warn-bg); color: var(--warn-fg); font-size: .75rem; font-weight: 700; border: 1px solid var(--warn-fg); }
.tile-body { display: flex; flex-direction: column; gap: .3rem; padding: .6rem .7rem .8rem; font-size: .92rem; }
.tile-body .code { font-size: 1rem; }
.tile-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.route { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .25rem; font-weight: 600; }
.route .arrow { color: var(--muted); }
.who { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; }
.fav-form { position: absolute; top: .4rem; right: .4rem; margin: 0; }
.heart { width: 2.6rem; height: 2.6rem; border-radius: 50%; border: 2px solid var(--soft); background: var(--surface); color: var(--muted); font-size: 1.3rem; line-height: 1; cursor: pointer; }
.heart.on { color: #d6246e; border-color: #d6246e; }
.heart:hover { border-color: #d6246e; }
.gallery { grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); }
@media (min-width: 40rem) { .gallery { grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); } }
.filter { display: flex; flex-wrap: wrap; align-items: end; gap: .6rem; }
.filter label { flex-basis: 100%; margin: 0; }
.filter select { width: auto; min-width: 12rem; }
.center { text-align: center; }
.detail .full { width: 100%; }
.detail-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem; margin: .8rem 0; }
.detail-row .fav-form { position: static; }
.stamps { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); margin: 1rem 0; }
.stamps figure { margin: 0; }
.stamps figcaption { color: var(--muted); font-size: .9rem; margin-top: .3rem; }

/* cabinet: "what next" and cards that are still on their way */
.nextstep { background: var(--surface); border: 3px solid var(--btn); border-radius: var(--radius); padding: .8rem 1rem 1rem; margin: 1rem 0; }
.nextstep h2 { margin: .2rem 0 .4rem; }
.next-text { font-size: 1.1rem; font-weight: 600; }
.next-panel { border-color: var(--btn); }
.offer { border-color: var(--warn-fg); background: var(--warn-bg); }
.openrow { background: var(--surface); border: 2px solid var(--soft); border-radius: var(--radius); padding: .4rem; }
.openrow .rowlink { border: 0; padding: .4rem; background: transparent; }
.openrow .dates { display: flex; flex-wrap: wrap; gap: .1rem .9rem; font-size: .9rem; color: var(--muted); }
.openrow .urgent { color: var(--err-fg); font-weight: 800; }
.inline-form { display: inline-block; margin: 0; }
.openrow .inline-form { margin: .2rem .4rem .4rem; }
.note { margin: .2rem .5rem .4rem; padding: .4rem .7rem; background: var(--warn-bg); color: var(--warn-fg); border-radius: 8px; font-size: .95rem; white-space: pre-wrap; }
.linkrow { margin-top: 1.5rem; }

/* photos on the card page */
.slot { margin: 1rem 0 1.6rem; padding: 1rem; border: 2px solid var(--soft); border-radius: var(--radius); background: var(--surface); }
.slot h3 { margin-top: 0; }
.slot-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: .5rem 0; }
.photo-state { padding: .4rem .7rem; border-radius: 8px; font-weight: 700; border: 2px solid; margin: .5rem 0; }
.photo-state.s-pending { background: var(--warn-bg); color: var(--warn-fg); border-color: var(--warn-fg); }
.photo-state.s-approved { background: var(--ok-bg); color: var(--ok-fg); border-color: var(--ok-fg); }
.photo-state.s-rejected { background: var(--err-bg); color: var(--err-fg); border-color: var(--err-fg); }
.rule-note { font-weight: 800; padding: .5rem .8rem; border-radius: 8px; background: var(--warn-bg); color: var(--warn-fg); border: 2px solid var(--warn-fg); }

/* notifications */
.notifs { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.notifs li { padding: .7rem .9rem; border: 2px solid var(--soft); border-radius: var(--radius); background: var(--surface); }
.notifs li.unread { border-color: var(--btn); font-weight: 700; }
.notifs .when { display: inline-block; margin-right: .5rem; color: var(--muted); font-weight: 400; font-size: .9rem; }

/* the moderator's queue */
.queue { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .8rem; }
.queue li { display: grid; gap: .6rem; grid-template-columns: 1fr; padding: .7rem; border: 2px solid var(--soft); border-radius: var(--radius); background: var(--surface); }
.queue li > a > img { display: block; width: 100%; max-height: 22rem; object-fit: contain; background: var(--thumb-bg); border-radius: 8px; }
.qact { display: flex; flex-direction: column; gap: .4rem; }
.qact .radio { display: flex; align-items: center; gap: .5rem; font-weight: 700; margin: 0; }
.qact input[type=radio] { width: 1.4rem; height: 1.4rem; }
@media (min-width: 40rem) { .queue li { grid-template-columns: 14rem 1fr 16rem; align-items: start; } }

/* photo cropper (stamps and profile pictures) */
.crop-ui { margin: .8rem 0; padding: .8rem; border: 2px solid var(--btn); border-radius: var(--radius); background: var(--surface); }
.crop-stage { position: relative; display: inline-block; max-width: 100%; touch-action: none; user-select: none; line-height: 0; }
.crop-stage canvas { display: block; max-width: 100%; border-radius: 6px; }
.crop-box { position: absolute; border: 3px solid #ffb703; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .55); cursor: move; touch-action: none; }
.crop-box i { position: absolute; width: 1.7rem; height: 1.7rem; background: #ffb703; border: 2px solid #fff; border-radius: 50%; touch-action: none; }
.crop-box i.tl { left: -.9rem; top: -.9rem; cursor: nwse-resize; } .crop-box i.tr { right: -.9rem; top: -.9rem; cursor: nesw-resize; }
.crop-box i.bl { left: -.9rem; bottom: -.9rem; cursor: nesw-resize; } .crop-box i.br { right: -.9rem; bottom: -.9rem; cursor: nwse-resize; }
.crop-actions { display: flex; gap: .5rem; margin-top: .6rem; }
.crop-done { margin: .4rem 0; color: var(--ok-fg); font-weight: 700; }

/* personal statistics */
.stats.three { grid-template-columns: repeat(3, 1fr); }
.tiny { font-size: .82rem; display: block; margin-top: .2rem; }
.plain { padding-left: 1.2rem; margin: .4rem 0; }
.plain li { margin: .25rem 0; }
.bars { list-style: none; padding: 0; margin: .4rem 0; display: grid; gap: .5rem; }
.bars li { display: grid; grid-template-columns: minmax(7rem, 11rem) 1fr 2.5rem; align-items: center; gap: .6rem; }
.bar-n { text-align: right; }
progress { width: 100%; height: 1.1rem; accent-color: var(--btn); }
.months { width: 100%; border-collapse: collapse; }
.months th, .months td { padding: .35rem .4rem; text-align: left; border-bottom: 1px solid var(--soft); vertical-align: middle; }
.months td progress { width: calc(100% - 3rem); max-width: 14rem; }
@media (max-width: 34rem) { .bars li { grid-template-columns: 1fr 2.5rem; } .bars progress { grid-column: 1 / -1; grid-row: 2; } .bar-n { grid-row: 1; grid-column: 2; } }

/* bars follow the theme colours (the browser default is a bright white track in the dark theme) */
progress { -webkit-appearance: none; appearance: none; border: 0; background: var(--thumb-bg); border-radius: 999px; overflow: hidden; }
progress::-webkit-progress-bar { background: var(--thumb-bg); border-radius: 999px; }
progress::-webkit-progress-value { background: var(--btn); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--btn); border-radius: 999px; }
@media (max-width: 34rem) { .stats.three { grid-template-columns: 1fr; } }

/* ---- logo, centred badges, tidy action panels ---- */
.brand .logo { display: block; width: 15rem; max-width: 60vw; height: auto; color: var(--fg); }
.nbadge { display: flex; align-items: center; justify-content: center; line-height: 1; padding: 0 .35rem; box-sizing: border-box; font-variant-numeric: tabular-nums; }
.nbadge.inl { display: inline-flex; vertical-align: middle; margin-left: .2rem; }

/* a select followed directly by a button used to touch it */
.form > select + .btn, .form > select + button { margin-top: 1rem; }
.actions-grid { align-items: stretch; }
.actions-grid .panel { display: flex; flex-direction: column; margin: 0; }
.actions-grid .panel > form { display: flex; flex-direction: column; gap: 1rem; flex: 1; margin: .5rem 0 0; }
.actions-grid .panel .field { margin: 0; }
.actions-grid .panel .btn { margin-top: auto; align-self: flex-start; }
.actions-grid .panel > form > select + .btn { margin-top: auto; }
@media (max-width: 40rem) { .actions-grid .panel .btn { align-self: stretch; } }

/* ---- profile page: member card, tabs, side column ---- */
.avatar.xl { width: 8.5rem; height: 8.5rem; border-radius: 4px; }
.avatar.xl.ph { font-size: 3.6rem; border-radius: 4px; }
/* the picture sits in a postage-stamp frame */
.stamp { flex: none; padding: .55rem; background: #fff; border: 4px dotted var(--ghost-edge); box-shadow: 0 2px 8px rgba(0, 0, 0, .18); }
.stamp .avatar { display: block; }
.pcard { display: grid; gap: 1rem 1.4rem; grid-template-columns: auto 1fr; align-items: center; background: var(--surface); border: 2px solid var(--soft); border-radius: var(--radius); padding: 1rem; margin: 1rem 0; }
.pinfo h1 { margin: 0 0 .4rem; overflow-wrap: anywhere; }
.pfacts { list-style: none; margin: 0; padding: 0; }
.pfacts li { padding: .35rem 0; border-bottom: 2px dotted var(--soft); }
.pfacts li:last-child { border-bottom: 0; }
.pnums { grid-column: 1 / -1; display: flex; gap: 1rem; margin: 0; padding-top: .8rem; border-top: 2px dotted var(--soft); }
.pnums > div { flex: 1; text-align: center; }
.pnums dd { margin: 0; font-size: 2.2rem; font-weight: 800; line-height: 1.1; color: var(--link); }
.pnums dt { color: var(--muted); }
@media (min-width: 46rem) {
  .pcard { grid-template-columns: auto 1fr auto; }
  .pnums { grid-column: auto; flex-direction: column; border-top: 0; padding-top: 0; min-width: 8rem; }
}
.tabs { display: flex; flex-wrap: wrap; gap: .2rem .3rem; border-bottom: 3px solid var(--soft); margin: 1.2rem 0 0; }
.tabs a, .tabs strong { display: inline-block; padding: .6rem 1rem; font-weight: 700; text-decoration: none; border-bottom: 4px solid transparent; margin-bottom: -3px; }
.tabs a:hover { background: var(--ghost-hover); }
.tabs strong { color: var(--fg); border-bottom-color: var(--btn); }
.pbody { display: grid; gap: 1.2rem; margin-top: 1rem; }
.pmain, .pside { min-width: 0; }
.pedit { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 .5rem; }
.pside h2 { margin-top: .2rem; }
.thumbs { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.thumbs a { display: block; text-align: center; font-size: .9rem; text-decoration: none; }
.thumbs img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--thumb-bg); border: 4px solid #fff; box-shadow: 0 1px 5px rgba(0, 0, 0, .25); margin-bottom: .3rem; }
@media (min-width: 46rem) { .pbody { grid-template-columns: minmax(0, 1fr) 18rem; } }

/* profile on a phone: smaller stamp so the nickname gets room; tabs stay readable; flags in the side column stay flags */
.thumbs a > img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.thumbs img.flag { display: inline-block; width: 1.25rem; height: auto; aspect-ratio: auto; border: 0; box-shadow: 0 0 0 1px var(--soft); margin: 0; }
.thumbs a > img.flag { display: inline-block; width: 1.25rem; }
.thumbs img:not(.flag) { border: 4px solid #fff; box-shadow: 0 1px 5px rgba(0, 0, 0, .25); }
@media (max-width: 34rem) {
  .avatar.xl { width: 6rem; height: 6rem; }
  .avatar.xl.ph { font-size: 2.6rem; }
  .stamp { padding: .4rem; border-width: 3px; }
  .pcard { gap: .8rem 1rem; padding: .8rem; }
  .pinfo h1 { font-size: 1.5rem; }
  .tabs a, .tabs strong { padding: .55rem .7rem; }
}

/* =====================================================================================================
   header v3: logo + settings dropdown + bell on top, a real menu of pills below
   ===================================================================================================== */
.top .wrap { position: relative; }
.topline { flex-wrap: wrap; }
.topright { display: flex; align-items: center; justify-content: flex-end; gap: .7rem; flex-wrap: wrap; }
.ico { width: 1.2em; height: 1.2em; fill: currentColor; flex: none; }
.bell .ico { width: 1.5rem; height: 1.5rem; }

/* settings: one pill with a gear, the panel rolls out from it and floats over the page */
.toolbox { position: relative; }
.toolbox > summary { display: inline-flex; align-items: center; gap: .5rem; list-style: none; user-select: none; }
.toolbox > summary::-webkit-details-marker { display: none; }
.toolbox[open] > summary { margin-bottom: 0; background: var(--chip-on); color: #fff; border-color: var(--chip-on); }
.toolbox .tools { position: absolute; z-index: 30; right: 0; top: calc(100% + .5rem); width: min(24rem, calc(100vw - 2rem)); display: grid; gap: .9rem; padding: 1rem; margin: 0; background: var(--surface); color: var(--fg); border: 2px solid var(--soft); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(0, 0, 0, .28); }
.toolbox .tool { flex-wrap: wrap; gap: .4rem .5rem; }
.toolbox .lbl { min-width: 8.5rem; color: var(--muted); }
@media (max-width: 40rem) {
  .toolbox { position: static; }
  .toolbox .tools { left: 1rem; right: 1rem; top: auto; width: auto; }
}

/* the menu */
.menu { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: .8rem 0 .2rem; }
.menu a, .menubtn { display: inline-flex; align-items: center; gap: .5rem; min-height: 2.8rem; padding: .5rem 1.05rem; border: 2px solid var(--soft); border-radius: 999px; background: var(--surface); color: var(--link); font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.menu a:hover, .menubtn:hover { border-color: var(--btn); background: var(--ghost-hover); color: var(--link-hover); }
.menu a.on, .menu a.cta { background: var(--btn); border-color: var(--btn); color: var(--btn-fg); }
.menu a.on:hover, .menu a.cta:hover { background: var(--btn-hover); border-color: var(--btn-hover); color: var(--btn-fg); }
.menu .logout { margin-left: auto; }
@media (max-width: 40rem) { .menu .logout { margin-left: 0; } .menu a, .menubtn { padding: .5rem .9rem; } }

/* footer centred */
.foot { text-align: center; }

/* the profile buttons sit under the facts */
.pedit { margin-top: .7rem; }
.pbody.wide { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 46rem) { .pbody.wide { grid-template-columns: minmax(0, 1fr); } }

/* statistics by month: the month name never wraps */
.months th[scope=row] { white-space: nowrap; padding-right: 1rem; font-weight: 700; }
.months td { white-space: nowrap; }

/* tabs fit on one line on a normal screen; header and settings panel on a phone */
.tabs a, .tabs strong { padding: .6rem .75rem; }
@media (max-width: 40rem) {
  .toolbox .lbl { flex-basis: 100%; min-width: 0; }
}

/* =====================================================================================================
   header v4: the gear is a round button of the same size as the bell; the menu is ONE row
   ===================================================================================================== */
.toolbox > summary { width: 2.9rem; height: 2.9rem; padding: 0; justify-content: center; border: 2px solid var(--soft); border-radius: 50%; background: var(--surface); color: var(--link); font-size: 1rem; }
.toolbox > summary:hover { color: var(--link-hover); border-color: var(--btn); }
.toolbox > summary .ico { width: 1.5rem; height: 1.5rem; }
.toolbox[open] > summary { background: var(--btn); border-color: var(--btn); color: var(--btn-fg); }
.tools-title { display: block; font-size: 1rem; color: var(--fg); padding-bottom: .5rem; border-bottom: 2px dotted var(--soft); }
.topline .toolbox, .topline .bell { flex: none; }

.menu { flex-wrap: nowrap; gap: .4rem; overflow-x: auto; padding-bottom: .3rem; margin-top: .6rem; }
.menu a, .menubtn { flex: none; white-space: nowrap; gap: .4rem; min-height: 2.6rem; padding: .35rem .85rem; font-size: .95rem; }
.menu .logout { margin-left: auto; flex: none; }

@media (max-width: 40rem) {
  /* on a phone: icon above a short word, six equal buttons, still one row */
  .toolbox { position: static; }
  .toolbox .tools { left: 1rem; right: 1rem; top: auto; width: auto; }
  .topright { display: flex; flex: none; flex-wrap: nowrap; gap: .5rem; }
  .menu { overflow-x: visible; gap: .3rem; }
  .menu > a, .menu > .logout { flex: 1 1 0; min-width: 0; margin-left: 0; }
  .menu .logout { display: flex; }
  .menu a, .menubtn { flex-direction: column; justify-content: center; gap: .15rem; width: 100%; min-height: 3.7rem; padding: .4rem .15rem; border-radius: 14px; font-size: .72rem; line-height: 1.15; text-align: center; box-sizing: border-box; }
  .menu .ico { width: 1.45rem; height: 1.45rem; }
}

/* photo preview with turn buttons; the cropper's buttons may wrap on a phone */
.rot-preview { display: block; max-width: 100%; height: auto; border-radius: 6px; margin: .5rem 0; background: var(--thumb-bg); }
.crop-actions { flex-wrap: wrap; }

/* the captcha widget sits in the middle of the form */
.cf-turnstile { display: flex; justify-content: center; margin: 1rem 0; }

/* =====================================================================================================
   header v5: the menu is a row of equal buttons, an icon above a short word: ONE row at any width and any text size
   ===================================================================================================== */
.menu { flex-wrap: nowrap; overflow: visible; gap: .4rem; padding-bottom: .2rem; }
.menu > a, .menu > .logout { flex: 1 1 0; min-width: 0; margin-left: 0; }
.menu .logout { display: flex; }
.menu a, .menubtn { position: relative; flex-direction: column; justify-content: center; gap: .2rem; width: 100%; min-height: 3.6rem; padding: .4rem .2rem; border-radius: 14px; font-size: .85rem; line-height: 1.15; text-align: center; box-sizing: border-box; }
.menu a span, .menubtn span { max-width: 100%; overflow-wrap: anywhere; }
.menu .ico { width: 1.5rem; height: 1.5rem; }
/* the moderator's counter sits on the icon instead of widening the button */
.menu .nbadge.inl { position: absolute; top: .25rem; right: calc(50% - 2.1rem); margin: 0; }
.topright { flex: none; flex-wrap: nowrap; }
@media (max-width: 40rem) {
  .menu { gap: .3rem; }
  .menu a, .menubtn { min-height: 3.7rem; padding: .4rem .1rem; font-size: .72rem; }
  .menu .ico { width: 1.45rem; height: 1.45rem; }
  .menu .nbadge.inl { right: calc(50% - 1.9rem); }
  .brand .logo { width: 12.5rem; }
}

/* sign-in, sign-up, password pages: the captcha, the button and the link under it all sit in the middle */
.auth form > .btn { display: flex; justify-content: center; width: fit-content; margin: 1.2rem auto 0; }
.auth form > .btn.big { min-width: 14rem; }
.auth > p { text-align: center; }
.auth .cf-turnstile { margin: 1.2rem 0 0; }

/* The scrollbar's place is always reserved, so short pages (admin, a small gallery) do not shift sideways
   compared with long ones. Older browsers without scrollbar-gutter get a permanent scrollbar instead. */
html { scrollbar-gutter: stable; }
@supports not (scrollbar-gutter: stable) { html { overflow-y: scroll; } }

/* the moderator's mark: a plate with ADMIN and a banhammer, right of the nickname */
.adminmark { display: inline-flex; align-items: center; gap: .45rem; margin-left: .7rem; vertical-align: middle; font-size: 1rem; }
.adminplate { display: inline-block; padding: .15rem .6rem; border-radius: 8px; background: var(--danger); color: #fff; font-size: .8rem; font-weight: 800; letter-spacing: .12em; line-height: 1.4; }
.adminmark .hammer { width: 2rem; height: 2rem; fill: var(--danger); flex: none; overflow: visible; }

