/* ==========================================================================
   MVG brand: tokens, base and shared components.
   Canonical copy: mvg-agent/brand/brand.css. The website and the store carry byte-identical copies
   (app/static/css/brand.css); git-scripts/brand.sh apply copies it, `scripts/test.sh static` checks
   it. Design reference: mvg-agent/docs/design-chart.md. Never edit a service's copy by hand.
   ========================================================================== */

@font-face {
  font-family: "Pixelify Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/pixelify-sans-latin.woff2") format("woff2");
  /* Latin without the digits (U+0030-0039): the pixel 5 reads like an S, so numbers in pixel-font
     text fall back to the UI font next in --font-pixel. */
  unicode-range: U+0000-002F, U+003A-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Pixelify Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/pixelify-sans-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308,
    U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113,
    U+2C60-2C7F, U+A720-A7FF;
}

/* ---------------------------------------------------------------- tokens (light = default) */
:root {
  color-scheme: light;

  /* Brand (fixed in both themes) */
  --mvg-monster: #C166E7;
  --mvg-guard: #747474;
  --mvg-vs: #E8E5E8;

  /* Surfaces and text */
  --bg: #F6F4F7;
  --bg-accent: #EFE7F4;
  --surface: #FFFFFF;
  --surface-2: #F1EEF2;
  --surface-3: #E8E5E8;
  --border: #DDD7DF;
  --border-strong: #C2B9C6;
  --text: #1D1A20;
  --text-muted: #5E5763;
  --text-faint: #7C7481;

  /* Team colours as usable text/fills (AA on this theme's surfaces) */
  --monster-ink: #8A3CB0;
  --monster-fill: #9B4BC4;
  --monster-fill-hover: #8A3CB0;
  --monster-soft: #F4E7FB;
  --on-monster: #FFFFFF;
  --guard-ink: #5B5B5B;
  --guard-fill: #666666;
  --guard-soft: #ECECEC;
  --on-guard: #FFFFFF;

  /* Meaning */
  --link: var(--monster-ink);
  --focus: #6C2B91;
  --success: #1F7A45;
  --success-soft: #E3F4EA;
  --warning: #8A5A00;
  --warning-soft: #FBF0D9;
  --danger: #B3261E;
  --danger-soft: #FBE7E5;
  --stardust: #9A6700;
  --stardust-soft: #FBF1D6;

  /* Shape */
  --radius-s: 4px;
  --radius-m: 8px;
  --radius-l: 12px;
  --bevel: inset 0 -3px 0 rgb(0 0 0 / 0.18);
  --shadow-1: 0 1px 2px rgb(29 20 36 / 0.08), 0 1px 1px rgb(29 20 36 / 0.04);
  --shadow-2: 0 8px 24px rgb(29 20 36 / 0.10), 0 2px 6px rgb(29 20 36 / 0.06);

  /* Type */
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-pixel: "Pixelify Sans", var(--font-ui);
  --font-mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  --fs-xs: 0.8125rem;
  --fs-s: 0.875rem;
  --fs-m: 1rem;
  --fs-l: 1.125rem;
  --fs-xl: 1.375rem;
  --fs-2xl: clamp(1.6rem, 1.25rem + 1.4vw, 2.1rem);
  --fs-3xl: clamp(2rem, 1.4rem + 2.6vw, 3.1rem);

  /* Space (4px grid) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 72px;
  --gutter: 16px;
  --content: 1180px;

  /* Minecraft tooltip (the same in both themes, like the game) */
  --mc-tooltip-bg: rgb(16 0 16 / 0.94);
  --mc-tooltip-border-top: #5000FF;
  --mc-tooltip-border-bottom: #28007F;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121014;
    --bg-accent: #1C1522;
    --surface: #1B181E;
    --surface-2: #242027;
    --surface-3: #2E2932;
    --border: #37303C;
    --border-strong: #4B4252;
    --text: #EDEAEE;
    --text-muted: #AFA6B4;
    --text-faint: #8C8391;
    --monster-ink: #D59BF0;
    --monster-fill: #C166E7;
    --monster-fill-hover: #CF86EE;
    --monster-soft: #2C1D36;
    --on-monster: #150C19;
    --guard-ink: #B3B3B3;
    --guard-fill: #8A8A8A;
    --guard-soft: #29272B;
    --on-guard: #111111;
    --focus: #E2B6F6;
    --success: #6FD39A;
    --success-soft: #16291E;
    --warning: #F0C05A;
    --warning-soft: #2E2410;
    --danger: #F28B82;
    --danger-soft: #34181A;
    --stardust: #F2C14E;
    --stardust-soft: #30260F;
    --bevel: inset 0 -3px 0 rgb(0 0 0 / 0.35);
    --shadow-1: 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow-2: 0 10px 28px rgb(0 0 0 / 0.45), 0 2px 6px rgb(0 0 0 / 0.3);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121014;
  --bg-accent: #1C1522;
  --surface: #1B181E;
  --surface-2: #242027;
  --surface-3: #2E2932;
  --border: #37303C;
  --border-strong: #4B4252;
  --text: #EDEAEE;
  --text-muted: #AFA6B4;
  --text-faint: #8C8391;
  --monster-ink: #D59BF0;
  --monster-fill: #C166E7;
  --monster-fill-hover: #CF86EE;
  --monster-soft: #2C1D36;
  --on-monster: #150C19;
  --guard-ink: #B3B3B3;
  --guard-fill: #8A8A8A;
  --guard-soft: #29272B;
  --on-guard: #111111;
  --focus: #E2B6F6;
  --success: #6FD39A;
  --success-soft: #16291E;
  --warning: #F0C05A;
  --warning-soft: #2E2410;
  --danger: #F28B82;
  --danger-soft: #34181A;
  --stardust: #F2C14E;
  --stardust-soft: #30260F;
  --bevel: inset 0 -3px 0 rgb(0 0 0 / 0.35);
  --shadow-1: 0 1px 2px rgb(0 0 0 / 0.4);
  --shadow-2: 0 10px 28px rgb(0 0 0 / 0.45), 0 2px 6px rgb(0 0 0 / 0.3);
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: var(--fs-m);
  line-height: 1.55;
  overflow-wrap: break-word;
}
[hidden] { display: none !important; }
img, svg, video { max-width: 100%; height: auto; }
img { display: block; }
h1, h2, h3, h4 { line-height: 1.15; margin: 0 0 var(--space-3); text-wrap: balance; }
h1, h2, h3 { font-family: var(--font-pixel); font-weight: 600; letter-spacing: 0.01em; }
h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-l); }
p { margin: 0 0 var(--space-3); }
a { color: var(--link); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--space-6) 0; }
code, kbd, samp, .mono { font-family: var(--font-mono); font-size: 0.92em; }
small, .small { font-size: var(--fs-s); }
.muted { color: var(--text-muted); }
.num { font-variant-numeric: tabular-nums; }
.pixel { image-rendering: pixelated; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: var(--radius-s); }
::selection { background: var(--monster-soft); color: var(--text); }

.container { width: min(100% - 2 * var(--gutter), var(--content)); margin-inline: auto; }
.stack > * + * { margin-top: var(--space-4); }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: var(--space-3); top: -60px; z-index: 100;
  background: var(--surface); color: var(--text); padding: var(--space-2) var(--space-4);
  border: 2px solid var(--focus); border-radius: var(--radius-m);
}
.skip-link:focus { top: var(--space-3); }

/* ---------------------------------------------------------------- logos */
/* minigame_logo.png is the whole wordmark, 2048x638, edge to edge: the frame shows it at its own
   aspect ratio (never stretched, never cropped), as tall as the frame. */
.wordmark { display: inline-block; aspect-ratio: 2048 / 638; height: 40px; }
.wordmark img { display: block; width: 100%; height: 100%; max-width: none; object-fit: contain; }
.wordmark--s { height: 32px; }
.wordmark--l { height: 56px; }
/* logo.png is a 64x64 pixel mark: only ever scaled by whole steps, pixel-crisp. */
.brandmark { image-rendering: pixelated; width: 128px; height: 128px; }
.brandmark--l { width: 192px; height: 192px; }
.brandmark--xl { width: 256px; height: 256px; }

/* ---------------------------------------------------------------- buttons */
.btn {
  --btn-bg: var(--surface-2); --btn-fg: var(--text); --btn-border: var(--border-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 44px; padding: 0 var(--space-5);
  font: 600 var(--fs-m)/1 var(--font-ui);
  color: var(--btn-fg); background: var(--btn-bg);
  border: 2px solid var(--btn-border); border-radius: var(--radius-m);
  box-shadow: var(--bevel);
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform 80ms ease, background-color 120ms ease, border-color 120ms ease;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn--primary { --btn-bg: var(--monster-fill); --btn-fg: var(--on-monster); --btn-border: var(--monster-fill); }
.btn--primary:hover { background: var(--monster-fill-hover); border-color: var(--monster-fill-hover); }
.btn--guard { --btn-bg: var(--guard-fill); --btn-fg: var(--on-guard); --btn-border: var(--guard-fill); }
.btn--guard:hover { background: var(--guard-ink); }
.btn--ghost { --btn-bg: transparent; --btn-border: transparent; box-shadow: none; }
.btn--ghost:hover { background: var(--surface-2); }
.btn--s { min-height: 36px; padding: 0 var(--space-4); font-size: var(--fs-s); }
.btn--l { min-height: 52px; padding: 0 var(--space-6); font-size: var(--fs-l); }
.btn--block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0;
  color: var(--text); background: transparent; border: 2px solid transparent;
  border-radius: var(--radius-m); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 20px; height: 20px; }

/* ---------------------------------------------------------------- surfaces */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-l);
  box-shadow: var(--shadow-1);
}
.card--pad { padding: var(--space-5); }
.panel { background: var(--surface-2); border-radius: var(--radius-l); padding: var(--space-5); }

.badge {
  display: inline-flex; align-items: center; gap: var(--space-1);
  padding: 2px var(--space-2); border-radius: var(--radius-s);
  font: 600 var(--fs-xs)/1.4 var(--font-ui); letter-spacing: 0.02em;
  background: var(--surface-3); color: var(--text-muted);
}
.badge--monster { background: var(--monster-soft); color: var(--monster-ink); }
.badge--guard { background: var(--guard-soft); color: var(--guard-ink); }
.badge--stardust { background: var(--stardust-soft); color: var(--stardust); }
.badge--success { background: var(--success-soft); color: var(--success); }
.badge--warning { background: var(--warning-soft); color: var(--warning); }
.badge--danger { background: var(--danger-soft); color: var(--danger); }

.notice {
  display: flex; gap: var(--space-3); align-items: flex-start;
  padding: var(--space-3) var(--space-4); border-radius: var(--radius-m);
  border: 1px solid var(--border); background: var(--surface-2);
}
.notice--success { background: var(--success-soft); border-color: transparent; }
.notice--warning { background: var(--warning-soft); border-color: transparent; }
.notice--danger { background: var(--danger-soft); border-color: transparent; }
.notice > :last-child { margin-bottom: 0; }

/* The Stardust amount: ✦ 1,250 */
.stardust { color: var(--stardust); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stardust::before { content: "✦"; margin-right: 0.25em; }

/* Player heads (from the store's head cache or the generated icons) */
.head { image-rendering: pixelated; border-radius: 3px; width: 24px; height: 24px; flex: none; }
.head--m { width: 32px; height: 32px; }
.head--l { width: 48px; height: 48px; }

/* ---------------------------------------------------------------- forms */
label { font-weight: 600; }
.field { display: grid; gap: var(--space-1); }
.field__hint { color: var(--text-muted); font-size: var(--fs-s); }
input[type="text"], input[type="search"], input[type="email"], input[type="number"], select, textarea {
  width: 100%; min-height: 44px; padding: var(--space-2) var(--space-3);
  font: inherit; color: var(--text); background: var(--surface);
  border: 2px solid var(--border-strong); border-radius: var(--radius-m);
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline-offset: 0; border-color: var(--focus); }
.check { display: flex; gap: var(--space-3); align-items: flex-start; font-weight: 400; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--monster-fill); flex: none; }

/* ---------------------------------------------------------------- theme toggle */
.theme-toggle { position: relative; }
.theme-toggle .icon-light, .theme-toggle .icon-dark { display: none; }
:root[data-theme="light"] .theme-toggle .icon-light, :root[data-theme="dark"] .theme-toggle .icon-dark { display: block; }
:root:not([data-theme="light"]):not([data-theme="dark"]) .theme-toggle .icon-light { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) .theme-toggle .icon-light { display: none; }
  :root:not([data-theme="light"]):not([data-theme="dark"]) .theme-toggle .icon-dark { display: block; }
}

/* ---------------------------------------------------------------- the shared footer */
.site-footer {
  margin-top: var(--space-8); padding: var(--space-7) 0 var(--space-6);
  background: var(--surface); border-top: 1px solid var(--border); color: var(--text-muted);
  font-size: var(--fs-s);
}
.site-footer__grid { display: grid; gap: var(--space-6); grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.site-footer h2 { font-size: var(--fs-m); color: var(--text); margin-bottom: var(--space-2); }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-1); }
.site-footer a { color: var(--text-muted); text-decoration: none; }
.site-footer a:hover { color: var(--text); text-decoration: underline; }
.site-footer__legal { margin-top: var(--space-6); padding-top: var(--space-4); border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); justify-content: space-between; }

/* ---------------------------------------------------------------- Minecraft text + tooltip */
.mc-black { color: #000000; } .mc-dark_blue { color: #0000AA; } .mc-dark_green { color: #00AA00; }
.mc-dark_aqua { color: #00AAAA; } .mc-dark_red { color: #AA0000; } .mc-dark_purple { color: #AA00AA; }
.mc-gold { color: #FFAA00; } .mc-gray { color: #AAAAAA; } .mc-dark_gray { color: #555555; }
.mc-blue { color: #5555FF; } .mc-green { color: #55FF55; } .mc-aqua { color: #55FFFF; }
.mc-red { color: #FF5555; } .mc-light_purple { color: #FF55FF; } .mc-yellow { color: #FFFF55; }
.mc-white { color: #FFFFFF; }
.mc-bold { font-weight: 700; } .mc-italic { font-style: italic; } .mc-underlined { text-decoration: underline; }
.mc-strikethrough { text-decoration: line-through; } .mc-underlined.mc-strikethrough { text-decoration: underline line-through; }
.mc-obfuscated { filter: blur(2px); }

.mc-tooltip {
  font-family: var(--font-pixel); font-size: 15px; line-height: 1.35; color: #FFFFFF;
  background: var(--mc-tooltip-bg); padding: 6px 9px 7px;
  border: 2px solid transparent; border-radius: 3px;
  border-image: linear-gradient(var(--mc-tooltip-border-top), var(--mc-tooltip-border-bottom)) 1;
  box-shadow: 0 0 0 2px rgb(16 0 16 / 0.94);
  text-shadow: 2px 2px 0 rgb(0 0 0 / 0.35);
  min-width: 160px; max-width: min(90vw, 360px);
}
.mc-tooltip__name { margin-bottom: 4px; }
.mc-tooltip__line { min-height: 1.35em; white-space: pre-wrap; }
.mc-tooltip .mc-strikethrough { text-shadow: none; }

/* ---------------------------------------------------------------- motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
