/* ============================================================
   ZOEMC NETWORK — Pixel Pastel UI
   Style: Minecraft pixel / retro, fresh pastel
   Palette: light blue, white, soft black
   Fonts: VT323 (display, vi), Press Start 2P (ascii accents),
          Be Vietnam Pro (body), JetBrains Mono (code)
   ============================================================ */

/* ---------- 1. Design tokens ---------- */

:root {
  --font-display: "Chakra Petch", "Be Vietnam Pro", sans-serif;
  --font-game: "VT323", "Chakra Petch", monospace;
  --font-pixel: "Press Start 2P", "VT323", monospace;
  --font-body: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "Consolas", monospace;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 68px;
  --space-8: 100px;

  --container: 1180px;
  --header-h: 74px;

  --ease-pixel: steps(3, end);
  --t-fast: 150ms ease;
  --t-med: 240ms ease;
}

/* Light — "Ultramarine": nền trắng ánh tím #FCFAFF, primary #261FEC (default) */
:root,
:root[data-theme="light"] {
  color-scheme: light;

  --bg: #fcfaff;
  --bg-soft: #f5f3fc;
  --surface: #ffffff;
  --surface-2: #f4f2fc;
  --surface-3: #eae7f8;

  --ink: #12102e;
  --ink-soft: #45426e;
  --ink-faint: #625f8a;

  --line: #ddd9f0;
  --line-strong: #b9b3e0;

  --sky: #e9e7ff;
  --sky-soft: #dcd9ff;
  --sky-strong: #261fec;
  --sky-deep: #1e17c4;

  --mint: #12b886;
  --mint-deep: #046c4e;
  --sun: #f2b41e;
  --sun-deep: #8a5a00;

  --ok: #15803d;
  --warn: #96610a;
  --danger: #c22030;
  --mute-tone: #8f8bb8;

  --shadow-hard: rgba(18, 16, 46, 0.2);
  --shadow-soft: rgba(18, 16, 46, 0.09);

  --grid-dot: rgba(38, 31, 236, 0.05);
  --scrim: rgba(10, 8, 30, 0.55);
  --boss: #7c3aed;
}

/* Dark — indigo than đậm cùng họ #261FEC */
:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #08071a;
  --bg-soft: #0d0b24;
  --surface: #131130;
  --surface-2: #1a1740;
  --surface-3: #221e52;

  --ink: #ecebfa;
  --ink-soft: #aeabd6;
  --ink-faint: #8683b3;

  --line: #262254;
  --line-strong: #37327a;

  --sky: #1c1850;
  --sky-soft: #241f66;
  --sky-strong: #7b76ff;
  --sky-deep: #9d99ff;

  --mint: #22c08d;
  --mint-deep: #3ddba0;
  --sun: #e8a916;
  --sun-deep: #f5c445;

  --ok: #4ade80;
  --warn: #fbbf24;
  --danger: #ff7b72;
  --mute-tone: #6f6c95;

  --shadow-hard: rgba(0, 0, 0, 0.55);
  --shadow-soft: rgba(0, 0, 0, 0.35);

  --grid-dot: rgba(236, 235, 250, 0.05);
  --scrim: rgba(4, 3, 14, 0.72);
  --boss: #b48cff;
}

/* ---------- 2. Base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background-color: var(--bg);
  /* Bầu trời pixel 8-bit: dải màu chuyển bậc cứng + lớp dither caro mờ */
  background-image:
    repeating-conic-gradient(var(--grid-dot) 0% 25%, transparent 0% 50%),
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--bg) 68%, var(--sky-strong)) 0 16%,
      color-mix(in srgb, var(--bg) 80%, var(--sky-strong)) 16% 36%,
      color-mix(in srgb, var(--bg) 90%, var(--sky-strong)) 36% 58%,
      color-mix(in srgb, var(--bg) 96%, var(--sky-strong)) 58% 80%,
      var(--bg) 80% 100%
    );
  background-size: 16px 16px, 100% 100%;
  background-attachment: scroll, fixed;
  transition: background-color var(--t-med), color var(--t-med);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  touch-action: pan-y pinch-zoom;
}

img {
  max-width: 100%;
  display: block;
}

.brand__mark img,
.page-loader__logo {
  image-rendering: pixelated;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.005em;
  margin: 0 0 var(--space-3);
  color: var(--ink);
}

h1 { font-size: clamp(2.1rem, 4.5vw, 3.2rem); }
h2 { font-size: clamp(1.5rem, 2.8vw, 2.1rem); }
h3 { font-size: clamp(1.2rem, 2vw, 1.5rem); }

p {
  margin: 0 0 var(--space-3);
  color: var(--ink-soft);
  line-height: 1.7;
}

a {
  color: var(--sky-deep);
  text-decoration: none;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

::selection {
  background: var(--sky-strong);
  color: #ffffff;
}

:root[data-theme="dark"] ::selection {
  color: #0b1220;
}

:focus-visible {
  outline: 3px solid var(--sky-strong);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.container {
  width: min(var(--container), calc(100% - 2 * var(--space-5)));
  margin-inline: auto;
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.95em;
  letter-spacing: 0.01em;
}

/* Custom scrollbar — chunky pixel */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}
::-webkit-scrollbar-track {
  background: var(--surface-2);
}
::-webkit-scrollbar-thumb {
  background: var(--sky-strong);
  border: 3px solid var(--surface-2);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--sky-deep);
}

/* ---------- 3. Pixel primitives ---------- */

.eyebrow {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sky-deep);
  background: var(--sky-soft);
  border: 2px solid var(--line-strong);
  padding: 6px 10px;
  margin-bottom: var(--space-3);
  box-shadow: 3px 3px 0 var(--shadow-soft);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 7px 12px;
  border: 2px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--ink-soft);
  box-shadow: 3px 3px 0 var(--shadow-soft);
}

.badge--live::before {
  content: "";
  width: 8px;
  height: 8px;
  background: var(--ink-faint);
  box-shadow: 0 0 0 2px var(--surface);
  animation: px-blink 1.4s var(--ease-pixel) infinite;
}

.badge--live[data-state="online"] {
  border-color: var(--ok);
  color: var(--ok);
  background: color-mix(in srgb, var(--ok) 12%, var(--surface));
}
.badge--live[data-state="online"]::before { background: var(--ok); }

.badge--live[data-state="offline"] {
  border-color: var(--danger);
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, var(--surface));
}
.badge--live[data-state="offline"]::before {
  background: var(--danger);
  animation: none;
}

@keyframes px-blink {
  0%, 60% { opacity: 1; }
  61%, 100% { opacity: 0.25; }
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 4px 10px;
  border: 2px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-soft);
}

.tag--online {
  border-color: var(--ok);
  color: var(--ok);
  background: color-mix(in srgb, var(--ok) 10%, var(--surface));
}

/* ---------- 4. Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.03em;
  padding: 13px 22px;
  border: 2px solid var(--ink);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  user-select: none;
  text-align: center;
  box-shadow: 4px 4px 0 var(--shadow-hard);
  transition: transform var(--t-fast), box-shadow var(--t-fast),
    background-color var(--t-fast), color var(--t-fast), border-color var(--t-fast);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn:hover {
  transform: translate(-1px, -1px);
  box-shadow: 5px 5px 0 var(--shadow-hard);
}

.btn:active {
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0 var(--shadow-hard);
}

.btn--sm {
  font-size: 0.85rem;
  padding: 9px 14px;
  box-shadow: 3px 3px 0 var(--shadow-hard);
}

/* Primary — pastel sky */
.btn--gold {
  background: var(--sky-strong);
  border-color: color-mix(in srgb, var(--sky-deep) 80%, var(--ink));
  color: #ffffff;
}
:root[data-theme="dark"] .btn--gold {
  color: #16222c;
  border-color: var(--sky);
}
.btn--gold:hover {
  background: color-mix(in srgb, var(--sky-strong) 82%, #ffffff);
}

/* Secondary — pastel mint (Discord etc.) */
.btn--teal {
  background: var(--mint);
  border-color: var(--mint-deep);
  color: #14382a;
}
:root[data-theme="dark"] .btn--teal {
  color: #12271e;
  border-color: var(--mint-deep);
}
.btn--teal:hover {
  background: color-mix(in srgb, var(--mint) 82%, #ffffff);
}

/* Ghost — quiet surface */
.btn--ghost {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink-soft);
  box-shadow: 3px 3px 0 var(--shadow-soft);
}
.btn--ghost:hover {
  color: var(--ink);
  border-color: var(--sky-strong);
  background: var(--surface-2);
}

/* Outline — dashed pixel frame */
.btn--outline {
  background: transparent;
  border: 2px dashed var(--line-strong);
  color: var(--sky-deep);
  box-shadow: none;
}
.btn--outline:hover {
  border-style: solid;
  background: var(--sky-soft);
  transform: none;
  box-shadow: none;
}
.btn--outline:active {
  transform: translate(2px, 2px);
}

/* ---------- 5. Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 3px solid var(--line-strong);
  box-shadow: 0 4px 0 var(--shadow-soft);
  transition: transform var(--t-med), box-shadow var(--t-med);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  min-height: var(--header-h);
  padding-block: var(--space-2);
  flex-wrap: wrap;
}

body.header-compact .site-header {
  box-shadow: 0 6px 0 var(--shadow-soft);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--ink);
}

.brand__mark {
  width: 46px;
  height: 46px;
  padding: 3px;
  background: var(--surface);
  border: 2px solid var(--line-strong);
  box-shadow: 3px 3px 0 var(--shadow-soft);
  flex-shrink: 0;
}

.brand__mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand__copy {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand__copy strong {
  font-family: var(--font-pixel);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--ink);
}

.brand__copy small {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ink-faint);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-wrap: wrap;
  margin-inline: auto;
}

.site-nav a {
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  padding: 7px 12px;
  border: 2px solid transparent;
  transition: color var(--t-fast), background-color var(--t-fast), border-color var(--t-fast);
}

.site-nav a:hover {
  color: var(--sky-deep);
  background: var(--sky-soft);
}

.site-nav a.is-current {
  color: var(--sky-deep);
  background: var(--sky-soft);
  border-color: var(--line-strong);
  box-shadow: 2px 2px 0 var(--shadow-soft);
}

.site-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

/* ---------- 6. Page loader & transitions ---------- */

.page-loader {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  background: var(--bg);
  opacity: 1;
  visibility: visible;
  transition: opacity 320ms ease, visibility 320ms ease;
}

body.is-ready .page-loader {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.page-loader__island {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-6);
  background: var(--surface);
  border: 3px solid var(--line-strong);
  box-shadow: 6px 6px 0 var(--shadow-hard);
}

.page-loader__logo {
  width: 72px;
  height: 72px;
  border: 2px solid var(--line);
  animation: px-hop 1s var(--ease-pixel) infinite;
}

@keyframes px-hop {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.page-loader__copy {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.page-loader__status {
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--ink-faint);
}

.page-loader__label {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.08em;
  color: var(--sky-deep);
}

.page-loader__core {
  display: flex;
  gap: 6px;
}

.page-loader__pixel {
  width: 12px;
  height: 12px;
  background: var(--sky-strong);
  animation: px-wave 900ms var(--ease-pixel) infinite;
}
.page-loader__pixel:nth-child(2) { animation-delay: 150ms; background: var(--mint); }
.page-loader__pixel:nth-child(3) { animation-delay: 300ms; background: var(--sun); }

@keyframes px-wave {
  0%, 100% { transform: translateY(0); opacity: 1; }
  50% { transform: translateY(-8px); opacity: 0.6; }
}

body.is-leaving .site-main,
body.is-leaving .site-footer {
  opacity: 0.4;
  transition: opacity 200ms ease;
}

.site-main {
  opacity: 1;
  transition: opacity 260ms ease;
}

/* ---------- 7. Hero ---------- */

.page-hero {
  padding-block: var(--space-8) var(--space-7);
  position: relative;
  overflow: hidden;
}

.page-hero::after {
  /* pixel "grass line" strip under hero */
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 10px;
  background: repeating-linear-gradient(
    90deg,
    var(--sky-strong) 0 14px,
    var(--mint) 14px 28px,
    var(--sky) 28px 42px
  );
  opacity: 0.6;
}

.page-hero__grid {
  display: grid;
  grid-template-columns: 1.35fr 0.85fr;
  gap: 56px;
  align-items: start;
  position: relative;
  z-index: 1;
}

/* Cảnh 3D voxel (three.js) phủ nền hero */
.hero-3d {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.9;
}

.hero-3d canvas {
  display: block;
  width: 100%;
  height: 100%;
}

@media (max-width: 1024px) {
  .hero-3d {
    display: none;
  }
}

/* Kéo xoay đảo 3D */
.page-hero.fx-grab {
  cursor: grab;
}

.page-hero.is-dragging {
  cursor: grabbing;
  user-select: none;
}

.page-hero.fx-grab a,
.page-hero.fx-grab button,
.page-hero.fx-grab .metric-card,
.page-hero.fx-grab .hero-panel {
  cursor: auto;
}

.page-hero.fx-grab .btn,
.page-hero.fx-grab [data-mine-ip] {
  cursor: pointer;
}

.hero-copy h1 {
  margin-bottom: var(--space-3);
  text-shadow: 3px 3px 0 var(--sky-soft);
}

.hero-copy__lede {
  font-size: 1.06rem;
  max-width: 56ch;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-block: var(--space-6);
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
}

.metric-card {
  background: var(--surface);
  border: 2px solid var(--line);
  border-bottom: 4px solid var(--line-strong);
  padding: var(--space-3) var(--space-4);
  box-shadow: 3px 3px 0 var(--shadow-soft);
}

.metric-card span {
  display: block;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 6px;
}

.metric-card strong {
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--ink);
  word-break: break-word;
}

/* Hero status panel */
.hero-panel {
  background: var(--surface);
  border: 3px solid var(--line-strong);
  box-shadow: 6px 6px 0 var(--shadow-hard);
  padding: var(--space-5);
  position: relative;
}

.hero-panel::before {
  /* pixel corner notch */
  content: "";
  position: absolute;
  top: -3px;
  right: -3px;
  width: 14px;
  height: 14px;
  background: var(--sky-strong);
  border: 3px solid var(--line-strong);
}

.hero-panel[data-server-mode="online"] {
  border-color: color-mix(in srgb, var(--ok) 55%, var(--line-strong));
}

.hero-panel h2 {
  font-size: clamp(1.45rem, 2.4vw, 1.85rem);
  margin-block: var(--space-3) var(--space-2);
}

.hero-panel__rows {
  display: flex;
  flex-direction: column;
  margin-top: var(--space-4);
  border-top: 2px dashed var(--line);
}

.hero-panel__rows > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  padding-block: 10px;
  border-bottom: 2px dashed var(--line);
}

.hero-panel__rows span {
  font-size: 0.85rem;
  color: var(--ink-faint);
  flex-shrink: 0;
}

.hero-panel__rows strong {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  text-align: right;
}

/* ---------- 8. Sections ---------- */

.section-block {
  padding-block: var(--space-7);
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-5);
  margin-bottom: 44px;
  flex-wrap: wrap;
}

.section-head h2 {
  margin-bottom: 0;
}

.section-head > p {
  max-width: 44ch;
  margin: 0;
  color: var(--ink-faint);
}

.section-inline-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
}

.section-inline-head h2 {
  font-size: 1.3rem;
  margin: 0;
}

.two-column {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: var(--space-6);
  align-items: start;
}

.content-card {
  background: var(--surface);
  border: 2px solid var(--line);
  border-bottom: 4px solid var(--line-strong);
  box-shadow: 4px 4px 0 var(--shadow-soft);
  padding: var(--space-6);
}

.feature-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-block: var(--space-4);
}

.feature-list li {
  position: relative;
  padding-left: 24px;
  color: var(--ink-soft);
}

.feature-list li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 0.55em;
  width: 8px;
  height: 8px;
  background: var(--sky-strong);
  box-shadow: 2px 2px 0 var(--sky-soft);
}

/* ---------- 9. Card grids ---------- */

.quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: var(--space-5);
}

.quick-card {
  background: var(--surface);
  border: 2px solid var(--line);
  border-top: 4px solid var(--sky-strong);
  padding: var(--space-5) var(--space-6);
  box-shadow: 4px 4px 0 var(--shadow-soft);
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}

.quick-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--shadow-soft);
}

.quick-card > span {
  display: block;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: var(--space-2);
}

.quick-card strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: var(--space-2);
  word-break: break-word;
}

.quick-card p {
  font-size: 0.92rem;
  margin: 0;
  color: var(--ink-faint);
}

/* Portal cards */
.portal-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-5);
}

.portal-card {
  grid-column: span 2;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-6);
  background: var(--surface);
  border: 2px solid var(--line);
  border-left: 6px solid var(--sky-strong);
  box-shadow: 4px 4px 0 var(--shadow-soft);
  color: var(--ink);
  transition: transform var(--t-fast), box-shadow var(--t-fast), border-color var(--t-fast);
}

.portal-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 7px 7px 0 var(--shadow-soft);
}

.portal-card--wide {
  grid-column: span 4;
}

.portal-card--gold { border-left-color: var(--sun); }
.portal-card--teal { border-left-color: var(--mint); }
.portal-card--blue { border-left-color: var(--sky-strong); }
.portal-card--green { border-left-color: var(--ok); }

.portal-card__label {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.portal-card h3 {
  margin: 0;
}

.portal-card p {
  margin: 0;
  font-size: 0.94rem;
  color: var(--ink-faint);
}

.portal-card__cta {
  margin-top: auto;
  padding-top: var(--space-3);
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--sky-deep);
}

.portal-card__cta::after {
  content: " →";
}

.portal-card:hover .portal-card__cta {
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* Info / feature / FAQ */
.info-grid,
.feature-grid,
.faq-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-5);
}

.info-card,
.feature-card,
.faq-card {
  background: var(--surface);
  border: 2px solid var(--line);
  border-bottom: 4px solid var(--line-strong);
  padding: var(--space-6);
  box-shadow: 4px 4px 0 var(--shadow-soft);
}

.feature-card__icon {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: var(--space-3);
  background: var(--sky-soft);
  border: 2px solid var(--line-strong);
  box-shadow: 3px 3px 0 var(--shadow-soft);
  font-family: var(--font-pixel);
  font-size: 0.8rem;
  color: var(--sky-deep);
}

.faq-card h3 {
  font-size: 1.1rem;
}

/* ---------- 10. Masthead (subpages) ---------- */

.page-masthead {
  padding-block: var(--space-7) var(--space-5);
  border-bottom: 3px solid var(--line);
  background: color-mix(in srgb, var(--surface) 55%, transparent);
}

.page-masthead__inner {
  max-width: 70ch;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.page-masthead h1 {
  margin-bottom: var(--space-2);
  text-shadow: 3px 3px 0 var(--sky-soft);
}

.page-masthead p {
  margin: 0;
}

.breadcrumb {
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink-faint);
  margin-bottom: var(--space-3);
  transition: color var(--t-fast);
}

.breadcrumb:hover {
  color: var(--sky-deep);
}

/* ---------- 11. Guide layout & switch ---------- */

.guide-switch {
  display: inline-flex;
  border: 2px solid var(--line-strong);
  box-shadow: 4px 4px 0 var(--shadow-soft);
  margin-bottom: var(--space-5);
  background: var(--surface);
}

.guide-switch__link {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 10px 20px;
  color: var(--ink-soft);
  border-right: 2px solid var(--line);
  transition: background-color var(--t-fast), color var(--t-fast);
}

.guide-switch__link:last-child {
  border-right: 0;
}

.guide-switch__link:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.guide-switch__link.is-current {
  background: var(--sky-strong);
  color: #ffffff;
}
:root[data-theme="dark"] .guide-switch__link.is-current {
  color: #16222c;
}

.guide-layout {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: var(--space-6);
  align-items: start;
}

.guide-canvas {
  background: var(--surface);
  border: 3px solid var(--line-strong);
  box-shadow: 6px 6px 0 var(--shadow-hard);
  padding: var(--space-5);
}

.guide-sidebar__stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.step-card {
  display: flex;
  gap: var(--space-4);
  align-items: flex-start;
  background: var(--surface);
  border: 2px solid var(--line);
  border-left: 5px solid var(--sky-strong);
  padding: var(--space-4);
  box-shadow: 3px 3px 0 var(--shadow-soft);
}

.step-card__num {
  font-family: var(--font-pixel);
  font-size: 0.85rem;
  color: var(--sky-deep);
  background: var(--sky-soft);
  border: 2px solid var(--line-strong);
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 2px 2px 0 var(--shadow-soft);
}

.step-card h3 {
  font-size: 1.05rem;
  margin-bottom: 4px;
}

.step-card p {
  margin: 0;
  font-size: 0.92rem;
}

.steps-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.steps-list li {
  position: relative;
  padding-left: 26px;
  color: var(--ink-soft);
}

.steps-list li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 0.5em;
  width: 9px;
  height: 9px;
  background: var(--mint);
  box-shadow: 2px 2px 0 var(--sky-soft);
}

/* ---------- 12. Minecraft window mockups ---------- */

.mc-mockup {
  position: relative;
  min-height: 380px;
  display: grid;
  place-items: center;
  padding: var(--space-6) var(--space-4);
  background:
    repeating-conic-gradient(
      color-mix(in srgb, var(--sky-soft) 70%, transparent) 0% 25%,
      transparent 0% 50%
    )
    0 0 / 32px 32px,
    var(--surface-3);
  border: 2px solid var(--line);
  overflow: hidden;
}

.mc-mockup__scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 40%, var(--shadow-soft));
  pointer-events: none;
}

.mc-java-window,
.mc-bedrock-window {
  position: relative;
  z-index: 1;
  width: min(430px, 100%);
  background: var(--surface);
  border: 3px solid var(--ink);
  box-shadow: 6px 6px 0 var(--shadow-hard);
  padding: var(--space-5);
}

.mc-java-window h3,
.mc-bedrock-window h3 {
  text-align: center;
  font-size: 1.15rem;
}

.mc-java-window__field,
.mc-bedrock-window__field {
  margin-bottom: var(--space-3);
}

.mc-java-window__field label,
.mc-bedrock-window__field label {
  display: block;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 6px;
}

.mc-java-window__field > div,
.mc-bedrock-window__field > div,
.mc-bedrock-window__field input {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  width: 100%;
  padding: 10px 12px;
  color: var(--ink);
  background: var(--surface-2);
  border: 2px solid var(--line-strong);
  box-shadow: inset 2px 2px 0 var(--shadow-soft);
}

.mc-java-window__hint {
  font-size: 0.85rem;
  color: var(--ink-faint);
  margin-block: var(--space-3);
}

.mc-java-window__actions,
.mc-bedrock-window__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.mc-java-window__button,
.mc-bedrock-window__button {
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 600;
  padding: 10px 12px;
  cursor: pointer;
  border: 2px solid var(--ink);
  background: var(--sky-strong);
  color: #ffffff;
  box-shadow: 3px 3px 0 var(--shadow-hard);
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}
:root[data-theme="dark"] .mc-java-window__button,
:root[data-theme="dark"] .mc-bedrock-window__button {
  color: #16222c;
}

.mc-java-window__button:hover,
.mc-bedrock-window__button:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--shadow-hard);
}

.mc-java-window__button:active,
.mc-bedrock-window__button:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--shadow-hard);
}

.mc-java-window__button--dim {
  background: var(--surface-2);
  color: var(--ink-soft);
  border-color: var(--line-strong);
}
:root[data-theme="dark"] .mc-java-window__button--dim {
  color: var(--ink-soft);
}

.mc-bedrock-window__button--success {
  background: var(--mint);
  color: #14382a;
  border-color: var(--mint-deep);
}

.mc-bedrock-window__button--danger {
  background: var(--danger);
  color: #ffffff;
  border-color: color-mix(in srgb, var(--danger) 60%, var(--ink));
}

.mc-bedrock-window__bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: calc(-1 * var(--space-5)) calc(-1 * var(--space-5)) var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: var(--surface-2);
  border-bottom: 3px solid var(--ink);
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

.mc-bedrock-window__body {
  display: flex;
  flex-direction: column;
}

/* ---------- 13. Dynmap / map page ---------- */

.map-layout {
  display: grid;
  grid-template-columns: 1.5fr 0.5fr;
  gap: var(--space-6);
  align-items: start;
}

.dynmap-shell {
  background: var(--surface);
  border: 3px solid var(--line-strong);
  box-shadow: 6px 6px 0 var(--shadow-hard);
  overflow: hidden;
}

.dynmap-shell__bar {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-bottom: 3px solid var(--line-strong);
  background: var(--surface-2);
  flex-wrap: wrap;
}

.dynmap-shell__bar > span {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-right: auto;
}

.dynmap-cta {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.win-dots {
  display: flex;
  gap: 6px;
}

.wd {
  width: 12px;
  height: 12px;
  border: 2px solid var(--ink);
  background: var(--surface-3);
}

.wd--r { background: var(--danger); }
.wd--y { background: var(--sun); }
.wd--g { background: var(--mint); }

.dynmap-frame {
  position: relative;
  min-height: 520px;
  background: var(--surface-3);
}

.dynmap-frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 520px;
  border: 0;
}

.dynmap-ph {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  text-align: center;
  padding: var(--space-6);
  background:
    repeating-conic-gradient(
      color-mix(in srgb, var(--sky-soft) 55%, transparent) 0% 25%,
      transparent 0% 50%
    )
    0 0 / 40px 40px,
    var(--surface-2);
}

.dynmap-ph h3 {
  margin: 0;
}

.dynmap-ph p {
  max-width: 42ch;
  margin: 0;
}

/* Map modal */
.map-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: var(--space-5);
  background: var(--scrim);
}

.map-modal__panel {
  width: min(1200px, 100%);
  height: min(85vh, 100%);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 3px solid var(--line-strong);
  box-shadow: 8px 8px 0 var(--shadow-hard);
}

.map-modal__bar {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-bottom: 3px solid var(--line-strong);
  background: var(--surface-2);
}

.map-modal__bar span,
.map-modal__bar strong {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  margin-right: auto;
}

.map-modal__actions {
  display: flex;
  gap: var(--space-2);
}

.map-modal__body {
  flex: 1;
  min-height: 0;
}

.map-modal__body iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

body.modal-open {
  overflow: hidden;
}

/* Side panel */
.side-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.side-box {
  background: var(--surface);
  border: 2px solid var(--line);
  border-bottom: 4px solid var(--line-strong);
  padding: var(--space-4) var(--space-5);
  box-shadow: 4px 4px 0 var(--shadow-soft);
}

.side-box h3 {
  font-size: 1.1rem;
  margin-block: var(--space-2);
}

/* ---------- 14. Forms ---------- */

.search-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 220px;
}

.search-field span {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.search-field input {
  font-family: var(--font-mono);
  font-size: 0.98rem;
  padding: 12px 14px;
  color: var(--ink);
  background: var(--surface);
  border: 2px solid var(--line-strong);
  box-shadow: inset 2px 2px 0 var(--shadow-soft);
  transition: border-color var(--t-fast);
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  border-radius: 0;
  touch-action: manipulation;
}

.search-field input:focus {
  outline: none;
  border-color: var(--sky-strong);
  box-shadow: inset 2px 2px 0 var(--shadow-soft), 0 0 0 3px var(--sky-soft);
}

.search-field input::placeholder {
  color: var(--ink-faint);
}

.empty-state {
  padding: var(--space-6) var(--space-5);
  text-align: center;
  border: 2px dashed var(--line-strong);
  background: var(--surface-2);
  color: var(--ink-faint);
}

.empty-state strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 4px;
}

.empty-state p {
  margin: 0;
  font-size: 0.92rem;
}

/* ---------- 15. Bans / punish portal ---------- */

.punish-shell {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.punish-section {
  background: var(--surface);
  border: 2px solid var(--line);
  border-bottom: 4px solid var(--line-strong);
  box-shadow: 4px 4px 0 var(--shadow-soft);
  padding: var(--space-5);
}

.punish-search-panel {
  background: var(--surface);
  border: 3px solid var(--line-strong);
  box-shadow: 6px 6px 0 var(--shadow-hard);
  padding: var(--space-5);
  position: relative;
}

.punish-search-panel[data-loading="true"]::after {
  content: "";
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  cursor: progress;
}

.punish-search-panel__copy {
  max-width: 62ch;
}

.punish-search-panel__actions {
  display: flex;
  align-items: flex-end;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-block: var(--space-4);
}

.punish-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.punish-filter {
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 8px 14px;
  cursor: pointer;
  background: var(--surface-2);
  border: 2px solid var(--line);
  color: var(--ink-soft);
  box-shadow: 2px 2px 0 var(--shadow-soft);
  transition: background-color var(--t-fast), color var(--t-fast),
    border-color var(--t-fast), transform var(--t-fast);
}

.punish-filter:hover {
  border-color: var(--sky-strong);
  color: var(--ink);
}

.punish-filter:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}

.punish-filter.is-current {
  background: var(--sky-strong);
  border-color: var(--sky-deep);
  color: #ffffff;
}
:root[data-theme="dark"] .punish-filter.is-current {
  color: #16222c;
}

.punish-note {
  margin: var(--space-4) 0 0;
  padding: var(--space-3) var(--space-4);
  font-size: 0.92rem;
  border: 2px dashed var(--line-strong);
  background: var(--surface-2);
  color: var(--ink-soft);
}

.punish-note[data-tone="ok"] {
  border-color: var(--ok);
  color: var(--ok);
  background: color-mix(in srgb, var(--ok) 8%, var(--surface));
}

.punish-note[data-tone="warn"],
.punish-note[data-tone="warning"] {
  border-color: var(--warn);
  color: var(--warn);
  background: color-mix(in srgb, var(--warn) 8%, var(--surface));
}

.punish-callout {
  padding: var(--space-4);
  border: 2px solid var(--line-strong);
  border-left: 6px solid var(--sun);
  background: var(--surface-2);
}

/* Stat cards */
.punish-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-4);
}

.punish-stat-card {
  background: var(--surface);
  border: 2px solid var(--line);
  border-top: 5px solid var(--line-strong);
  padding: var(--space-4) var(--space-5);
  box-shadow: 4px 4px 0 var(--shadow-soft);
}

.punish-stat-card span {
  display: block;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: var(--space-2);
}

.punish-stat-card strong {
  font-family: var(--font-pixel);
  font-size: 1.3rem;
  color: var(--ink);
}

.punish-stat-card[data-tone="ban"] { border-top-color: var(--danger); }
.punish-stat-card[data-tone="mute"] { border-top-color: var(--mute-tone); }
.punish-stat-card[data-tone="warning"],
.punish-stat-card[data-tone="warn"] { border-top-color: var(--warn); }
.punish-stat-card[data-tone="kick"] { border-top-color: var(--sky-strong); }
.punish-stat-card[data-tone="ok"] { border-top-color: var(--ok); }

.punish-overview-row {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: var(--space-5);
  align-items: start;
}

/* Match chips */
.match-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.match-chip {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 8px 14px;
  cursor: pointer;
  background: var(--surface-2);
  border: 2px solid var(--line);
  color: var(--ink-soft);
  box-shadow: 2px 2px 0 var(--shadow-soft);
  transition: border-color var(--t-fast), color var(--t-fast), transform var(--t-fast);
}

.match-chip:hover {
  border-color: var(--sky-strong);
  color: var(--ink);
  transform: translate(-1px, -1px);
}

.match-chip.is-current {
  background: var(--sky-soft);
  border-color: var(--sky-strong);
  color: var(--sky-deep);
}

/* Profile card */
.profile-card__header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.profile-card__header img {
  width: 56px;
  height: 56px;
  border: 2px solid var(--line-strong);
  box-shadow: 3px 3px 0 var(--shadow-soft);
  image-rendering: pixelated;
}

.profile-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.profile-card__chip {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 5px 12px;
  border: 2px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--ink-soft);
}

.profile-card__chip[data-tone="ban"] { border-color: var(--danger); color: var(--danger); }
.profile-card__chip[data-tone="mute"] { border-color: var(--mute-tone); color: var(--mute-tone); }
.profile-card__chip[data-tone="warning"],
.profile-card__chip[data-tone="warn"] { border-color: var(--warn); color: var(--warn); }
.profile-card__chip[data-tone="kick"] { border-color: var(--sky-strong); color: var(--sky-deep); }
.profile-card__chip[data-tone="ok"] { border-color: var(--ok); color: var(--ok); }

/* History entries */
.punish-history {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.punish-history__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.punish-history__meta,
.punish-entry__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  font-size: 0.85rem;
  color: var(--ink-faint);
}

.punish-history__badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.punish-history__remove,
.punish-table__remove {
  font-size: 0.8rem;
  color: var(--ink-faint);
  border-top: 2px dashed var(--line);
  padding-top: var(--space-2);
  margin-top: var(--space-2);
}

.punish-entry {
  border: 2px solid var(--line);
  border-left: 5px solid var(--line-strong);
  background: var(--surface-2);
  padding: var(--space-4);
}

.punish-entry__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-2);
}

/* Punish table */
.punish-table {
  overflow-x: auto;
  border: 2px solid var(--line);
}

.punish-table__head,
.punish-table__row {
  display: grid;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-3) var(--space-4);
  min-width: 720px;
}

.punish-table__head--player,
.punish-table__row--player {
  grid-template-columns: 0.9fr 1.2fr 1fr 1.6fr 1fr 1fr 0.9fr;
}

.punish-table__head--recent,
.punish-table__row--recent {
  grid-template-columns: 0.9fr 1.2fr 1fr 1.8fr 1.1fr;
}

.punish-table__head {
  background: var(--surface-2);
  border-bottom: 3px solid var(--line-strong);
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.punish-table__row {
  border-bottom: 2px solid var(--line);
  transition: background-color var(--t-fast);
}

.punish-table__row:hover {
  background: var(--surface-2);
}

.punish-table__row:last-child {
  border-bottom: 0;
}

.punish-table__cell {
  font-size: 0.9rem;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}

.punish-table__cell--player {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-mono);
  color: var(--ink);
}

.punish-table__avatar {
  width: 28px;
  height: 28px;
  border: 2px solid var(--line-strong);
  image-rendering: pixelated;
  flex-shrink: 0;
}

.punish-table__stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.punish-table__sub {
  font-size: 0.75rem;
  color: var(--ink-faint);
}

.punish-table__reason {
  color: var(--ink-soft);
}

.punish-table__status {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  display: inline-block;
  padding: 3px 10px;
  border: 2px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--ink-soft);
}

.punish-table__status[data-tone="ok"] {
  border-color: var(--ok);
  color: var(--ok);
}

.punish-table__status[data-tone="ban"],
.punish-table__status[data-tone="warn"] {
  border-color: var(--danger);
  color: var(--danger);
}

.punish-table__body .empty-state {
  border: 0;
  min-width: 0;
}

/* Type / status pills (JS-rendered) */
.type-pill,
.status-pill {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.3;
  padding: 3px 10px;
  border: 2px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--ink-soft);
}

.type-pill--ban { border-color: var(--danger); color: var(--danger); background: color-mix(in srgb, var(--danger) 9%, var(--surface)); }
.type-pill--mute { border-color: var(--mute-tone); color: var(--mute-tone); background: color-mix(in srgb, var(--mute-tone) 9%, var(--surface)); }
.type-pill--warning { border-color: var(--warn); color: var(--warn); background: color-mix(in srgb, var(--warn) 9%, var(--surface)); }
.type-pill--kick { border-color: var(--sky-strong); color: var(--sky-deep); background: color-mix(in srgb, var(--sky-strong) 10%, var(--surface)); }

.status-pill--active { border-color: var(--danger); color: var(--danger); }
.status-pill--revoked,
.status-pill--expired,
.status-pill--inactive { border-color: var(--line-strong); color: var(--ink-faint); }
.status-pill--executed { border-color: var(--ok); color: var(--ok); }

.tag--muted {
  border-style: dashed;
  color: var(--ink-faint);
}

/* ---------- 15b. Gallery ---------- */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-5);
}

.gallery-card {
  margin: 0;
  position: relative;
  overflow: hidden;
  border: 3px solid var(--line-strong);
  background: var(--surface);
  box-shadow: 5px 5px 0 var(--shadow-soft);
  cursor: zoom-in;
  transition: transform var(--t-fast), box-shadow var(--t-fast), border-color var(--t-fast);
}

.gallery-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 8px 8px 0 var(--shadow-soft);
  border-color: var(--sky-strong);
}

.gallery-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  transition: transform 600ms cubic-bezier(0.16, 1, 0.3, 1);
}

.gallery-card:hover img {
  transform: scale(1.06);
}

.gallery-card figcaption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 26px var(--space-4) var(--space-3);
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #ffffff;
  background: linear-gradient(180deg, transparent, rgba(20, 30, 40, 0.82));
  transform: translateY(8px);
  opacity: 0.92;
  transition: transform var(--t-med), opacity var(--t-med);
  pointer-events: none;
}

.gallery-card:hover figcaption {
  transform: translateY(0);
  opacity: 1;
}

/* Lightbox xem ảnh lớn */
.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: grid;
  place-items: center;
  padding: var(--space-5);
  background: var(--scrim);
  cursor: zoom-out;
}

.gallery-lightbox figure {
  margin: 0;
  max-width: min(1240px, 100%);
  background: var(--surface);
  border: 3px solid var(--line-strong);
  box-shadow: 8px 8px 0 var(--shadow-hard);
}

.gallery-lightbox img {
  display: block;
  width: 100%;
  max-height: 78vh;
  object-fit: contain;
  background: #10161c;
}

.gallery-lightbox figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--ink);
  border-top: 3px solid var(--line-strong);
  background: var(--surface-2);
}

.gallery-lightbox figcaption span:last-child {
  color: var(--ink-faint);
  font-size: 1rem;
}

@media (max-width: 1024px) {
  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .gallery-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- 16. Footer ---------- */

.site-footer {
  margin-top: var(--space-7);
  border-top: 3px solid var(--line-strong);
  background: var(--surface);
  position: relative;
}

.site-footer::before {
  /* pixel grass strip on top of footer */
  content: "";
  position: absolute;
  top: -3px;
  left: 0;
  right: 0;
  height: 6px;
  background: repeating-linear-gradient(
    90deg,
    var(--sky-strong) 0 12px,
    var(--mint) 12px 24px,
    var(--sky) 24px 36px
  );
  opacity: 0.55;
}

.site-footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  padding-block: var(--space-7);
  flex-wrap: wrap;
}

.site-footer__brand {
  display: flex;
  flex-direction: column;
}

.site-footer__brand strong {
  font-family: var(--font-pixel);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--ink);
}

.site-footer__brand span {
  font-family: var(--font-display);
  font-size: 0.82rem;
  color: var(--ink-faint);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
}

.footer-links a {
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink-soft);
  transition: color var(--t-fast);
}

.footer-links a:hover {
  color: var(--sky-deep);
}

.footer-meta {
  font-family: var(--font-display);
  font-size: 0.82rem;
  color: var(--ink-faint);
}

/* ---------- 17. Responsive ---------- */

@media (max-width: 1024px) {
  .page-hero__grid,
  .guide-layout,
  .map-layout,
  .punish-overview-row,
  .two-column {
    grid-template-columns: 1fr;
  }

  .portal-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .portal-card,
  .portal-card--wide {
    grid-column: span 2;
  }

  .hero-metrics {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  }
}

@media (max-width: 720px) {
  :root {
    --space-5: 20px;
    --space-6: 28px;
    --space-7: 48px;
  }

  .site-header__inner {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-3);
    padding-block: var(--space-3);
  }

  .brand {
    justify-content: center;
  }

  .site-nav {
    justify-content: center;
    margin-inline: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .site-nav::-webkit-scrollbar {
    display: none;
  }

  .site-nav a {
    font-size: 1.05rem;
    padding: 6px 9px;
    white-space: nowrap;
  }

  .site-actions {
    justify-content: center;
  }

  .page-hero {
    padding-block: var(--space-6) var(--space-6);
  }

  .hero-actions {
    flex-direction: column;
    gap: var(--space-3);
    margin-block: var(--space-5);
  }

  .hero-actions .btn {
    width: 100%;
    justify-content: center;
    min-height: 48px;
  }

  .hero-metrics {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }

  .metric-card {
    padding: var(--space-3);
    text-align: center;
  }

  .hero-panel {
    padding: var(--space-4);
  }

  .hero-panel h2 {
    font-size: 1.35rem;
    text-align: center;
  }

  .hero-panel__rows > div {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
  }

  .hero-panel__rows strong {
    text-align: left;
    width: 100%;
  }

  .hero-copy__lede {
    font-size: 1rem;
    line-height: 1.6;
  }

  .section-block {
    padding-block: var(--space-6);
  }

  .section-head {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
  }

  .section-head h2 {
    font-size: 1.5rem;
  }

  .portal-grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  .portal-card,
  .portal-card--wide {
    grid-column: span 1;
  }

  .portal-card {
    padding: var(--space-4);
  }

  .portal-card h3 {
    font-size: 1.2rem;
  }

  .portal-card p {
    font-size: 0.95rem;
  }

  /* Improve section spacing */
  .section-head h2::after {
    width: 80px;
  }

  .section-head.is-in h2::after {
    width: 80px;
  }

  .punish-search-panel__actions {
    flex-direction: column;
    align-items: stretch;
  }

  /* Mobile form improvements */
  .search-field {
    min-width: 100%;
  }

  .search-field input {
    font-size: 16px;
    padding: 14px;
    min-height: 48px;
  }

  .punish-filters {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    justify-content: center;
  }

  .punish-filter {
    flex: 1 1 auto;
    min-width: 80px;
    font-size: 0.85rem;
    padding: 10px 12px;
  }

  /* Mobile table improvements */
  .punish-table {
    -webkit-overflow-scrolling: touch;
    border-radius: 0;
  }

  .punish-table__head,
  .punish-table__row {
    min-width: 600px;
    padding: var(--space-2) var(--space-3);
    gap: var(--space-2);
  }

  .punish-table__cell {
    font-size: 0.85rem;
  }

  .punish-table__avatar {
    width: 24px;
    height: 24px;
  }

  .punish-table__status {
    font-size: 0.75rem;
    padding: 2px 8px;
  }

  /* Scroll hint for tables */
  .punish-table::after {
    content: "← Vuốt để xem thêm →";
    display: block;
    text-align: center;
    padding: var(--space-2);
    font-size: 0.75rem;
    color: var(--ink-faint);
    background: var(--surface-2);
    border-top: 2px solid var(--line);
  }

  .dynmap-frame,
  .dynmap-frame iframe {
    min-height: 380px;
  }

  .site-footer__inner {
    flex-direction: column;
    align-items: flex-start;
  }

  /* Better touch targets */
  .btn,
  .site-nav a,
  .theme-toggle {
    min-height: 44px;
    min-width: 44px;
  }

  .theme-toggle {
    padding: 10px;
  }

  /* Improve readability on mobile */
  body {
    font-size: 1rem;
    line-height: 1.6;
  }

  h1 {
    font-size: 1.75rem !important;
    line-height: 1.2;
  }

  h2 {
    font-size: 1.5rem;
    line-height: 1.3;
  }

  h3 {
    font-size: 1.25rem;
    line-height: 1.3;
  }

  p {
    font-size: 1rem;
    margin-bottom: var(--space-4);
  }

  /* Better spacing for mobile */
  .container {
    padding-inline: var(--space-4);
    max-width: 100%;
  }

  /* Footer improvements */
  .site-footer__inner {
    padding-block: var(--space-6);
  }

  .footer-links {
    width: 100%;
    justify-content: center;
  }

  .footer-meta {
    width: 100%;
    text-align: center;
  }
}

/* Extra small devices (phones in portrait, less than 400px) */
@media (max-width: 400px) {
  :root {
    --space-2: 6px;
    --space-3: 10px;
    --space-4: 12px;
    --space-5: 16px;
    --space-6: 24px;
    --space-7: 40px;
  }

  .site-header__inner {
    padding-block: var(--space-2);
  }

  .brand__mark img {
    height: 36px;
  }

  .site-nav {
    gap: var(--space-2);
  }

  .site-nav a {
    font-size: 0.95rem;
    padding: 6px 8px;
  }

  .btn {
    font-size: 0.9rem;
    padding: 10px 16px;
    min-height: 44px;
  }

  h1 {
    font-size: 1.5rem !important;
    line-height: 1.2;
  }

  h2 {
    font-size: 1.3rem;
  }

  h3 {
    font-size: 1.1rem;
  }

  .hero-copy__lede {
    font-size: 0.95rem;
  }

  .portal-card h3 {
    font-size: 1rem;
  }

  .portal-card p {
    font-size: 0.9rem;
  }

  .container {
    padding-inline: var(--space-3);
  }

  .hero-panel {
    padding: var(--space-3);
  }

  .metric-card {
    padding: var(--space-2) var(--space-3);
  }

  .search-field input {
    font-size: 16px;
    padding: 12px;
  }

  .punish-filter {
    font-size: 0.8rem;
    padding: 8px 10px;
  }

  .section-head h2::after {
    width: 60px;
  }

  .section-head.is-in h2::after {
    width: 60px;
  }
}

/* ---------- 18. Fancy FX ---------- */

/* Lớp dither pixel trôi chậm (dải trời đứng yên) */
@keyframes grid-pan {
  to {
    background-position: 16px 16px, 0 0;
  }
}

body {
  animation: grid-pan 16s linear infinite;
}

/* Hiện dần khi cuộn tới */
.fx-reveal {
  opacity: 0;
  transform: translateY(22px);
  transition:
    opacity 560ms ease var(--fx-delay, 0ms),
    transform 560ms cubic-bezier(0.16, 1, 0.3, 1) var(--fx-delay, 0ms);
  will-change: opacity, transform;
}

.fx-reveal.is-in {
  opacity: 1;
  transform: translateY(0);
}

/* Gạch chân pixel chạy dưới tiêu đề section */
.section-head h2::after {
  content: "";
  display: block;
  width: 0;
  height: 5px;
  margin-top: 8px;
  background: repeating-linear-gradient(
    90deg,
    var(--sky-strong) 0 10px,
    var(--mint) 10px 20px,
    var(--sun) 20px 30px
  );
  transition: width 700ms cubic-bezier(0.16, 1, 0.3, 1) 180ms;
}

.section-head.is-in h2::after {
  width: 104px;
}

/* Vệt sáng quét qua nút khi hover */
@keyframes btn-shine {
  from { left: -60%; }
  to { left: 135%; }
}

.btn {
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: "";
  position: absolute;
  top: -6px;
  bottom: -6px;
  left: -60%;
  width: 38%;
  background: linear-gradient(
    105deg,
    transparent,
    rgba(255, 255, 255, 0.65),
    transparent
  );
  transform: skewX(-18deg);
  pointer-events: none;
  opacity: 0;
}

.btn:hover::before {
  opacity: 1;
  animation: btn-shine 550ms ease forwards;
}

/* Vệt sáng quét qua thẻ */
.portal-card,
.quick-card {
  position: relative;
  overflow: hidden;
}

.portal-card::after,
.quick-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 42%,
    rgba(255, 255, 255, 0.4) 50%,
    transparent 58%
  );
  transform: translateX(-130%);
  transition: transform 750ms ease;
  pointer-events: none;
}

:root[data-theme="dark"] .portal-card::after,
:root[data-theme="dark"] .quick-card::after {
  background: linear-gradient(
    105deg,
    transparent 42%,
    rgba(255, 255, 255, 0.09) 50%,
    transparent 58%
  );
}

.portal-card:hover::after,
.quick-card:hover::after {
  transform: translateX(130%);
}

/* Hero: tiêu đề lơ lửng + con trỏ terminal nhấp nháy */
@keyframes hero-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

@keyframes cursor-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

.hero-copy h1 {
  animation: hero-float 5.5s ease-in-out infinite;
}

.hero-copy h1::after {
  content: "";
  display: inline-block;
  width: 0.42ch;
  height: 0.72em;
  margin-left: 10px;
  background: var(--sky-strong);
  animation: cursor-blink 1.1s steps(1) infinite;
}

/* Logo nhảy khi hover brand */
.brand:hover .brand__mark img {
  animation: px-hop 480ms var(--ease-pixel) 2;
}

/* Badge online phát sáng theo nhịp */
@keyframes badge-glow {
  0%, 100% {
    box-shadow: 3px 3px 0 var(--shadow-soft), 0 0 0 0 color-mix(in srgb, var(--ok) 40%, transparent);
  }
  55% {
    box-shadow: 3px 3px 0 var(--shadow-soft), 0 0 0 9px transparent;
  }
}

.badge--live[data-state="online"] {
  animation: badge-glow 2.2s ease-out infinite;
}

/* Mũi tên portal nhích khi hover */
@keyframes arrow-nudge {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(6px); }
}

.portal-card__cta::after {
  display: inline-block;
}

.portal-card:hover .portal-card__cta::after {
  animation: arrow-nudge 800ms ease infinite;
}

/* Nghiêng 3D theo chuột */
.fx-tilt {
  transition: transform 220ms ease-out;
  will-change: transform;
}

/* Nảy nhẹ khi số online đổi */
@keyframes fx-bump {
  0% { transform: scale(1); }
  35% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

.fx-bump {
  animation: fx-bump 450ms cubic-bezier(0.2, 0.7, 0.3, 1.4);
}

/* Bầu trời pixel: mây + tia lấp lánh */
.fx-sky {
  position: relative;
  overflow: hidden;
}

.fx-sky > .container,
.fx-sky .page-hero__grid,
.fx-sky .page-masthead__inner {
  position: relative;
  z-index: 1;
}

.px-cloud {
  --cloud: rgba(255, 255, 255, 0.9);
  position: absolute;
  left: 0;
  width: 12px;
  height: 12px;
  background: transparent;
  pointer-events: none;
  z-index: 0;
  box-shadow:
    24px 0 0 var(--cloud), 36px 0 0 var(--cloud), 48px 0 0 var(--cloud),
    60px 0 0 var(--cloud),
    12px 12px 0 var(--cloud), 24px 12px 0 var(--cloud), 36px 12px 0 var(--cloud),
    48px 12px 0 var(--cloud), 60px 12px 0 var(--cloud), 72px 12px 0 var(--cloud),
    0 24px 0 var(--cloud), 12px 24px 0 var(--cloud), 24px 24px 0 var(--cloud),
    36px 24px 0 var(--cloud), 48px 24px 0 var(--cloud), 60px 24px 0 var(--cloud),
    72px 24px 0 var(--cloud), 84px 24px 0 var(--cloud);
  animation: cloud-drift 60s linear infinite;
}

:root[data-theme="dark"] .px-cloud {
  --cloud: rgba(143, 205, 236, 0.12);
}

@keyframes cloud-drift {
  from {
    transform: translateX(-140px) scale(var(--s, 1));
  }
  to {
    transform: translateX(108vw) scale(var(--s, 1));
  }
}

@keyframes spark-twinkle {
  0%, 100% {
    opacity: 0;
    transform: scale(0.35);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

.px-spark {
  position: absolute;
  width: 6px;
  height: 6px;
  background: var(--sun);
  pointer-events: none;
  z-index: 0;
  animation: spark-twinkle 2.6s steps(3) infinite;
}

.px-spark--mint { background: var(--mint); }
.px-spark--sky { background: var(--sky-strong); }

/* ---------- 19. Lớp tương tác game (play.js) ---------- */

/* --- Toast thành tựu kiểu Minecraft --- */
.mc-toasts {
  position: fixed;
  top: 86px;
  right: var(--space-4);
  z-index: 130;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}

.mc-toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 240px;
  max-width: 330px;
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  border: 3px solid var(--line-strong);
  box-shadow: 5px 5px 0 var(--shadow-hard);
  cursor: pointer;
  pointer-events: auto;
  transform: translateX(calc(100% + 32px));
  transition: transform 260ms cubic-bezier(0.16, 1, 0.3, 1);
}

.mc-toast.is-in {
  transform: translateX(0);
}

.mc-toast__icon {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border: 2px solid var(--line-strong);
  padding: 4px;
}

.mc-toast__icon svg {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  shape-rendering: crispEdges;
}

.mc-toast__copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.mc-toast__copy strong {
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sun-deep);
  margin-bottom: 3px;
}

.mc-toast__copy > span {
  font-family: var(--font-game);
  font-size: 1.1rem;
  line-height: 1.15;
  color: var(--ink);
}

.mc-toast__btn {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 10px;
  cursor: pointer;
  flex-shrink: 0;
  background: var(--sky-strong);
  border: 2px solid var(--sky-deep);
  color: #ffffff;
  box-shadow: 2px 2px 0 var(--shadow-hard);
}
:root[data-theme="dark"] .mc-toast__btn {
  color: #16222c;
}

/* --- Thanh XP --- */
.xp-dock {
  position: fixed;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  pointer-events: none;
}

.xp-dock__level {
  font-family: var(--font-game);
  font-size: 1.25rem;
  line-height: 1;
  color: var(--mint-deep);
  text-shadow: 2px 2px 0 var(--surface);
}

.xp-dock__bar {
  width: min(320px, 44vw);
  height: 10px;
  background: var(--surface-2);
  border: 2px solid var(--line-strong);
  box-shadow: 2px 2px 0 var(--shadow-soft);
  overflow: hidden;
  display: block;
}

.xp-dock__fill {
  display: block;
  height: 100%;
  width: 0;
  background: repeating-linear-gradient(
    90deg,
    var(--mint) 0 8px,
    color-mix(in srgb, var(--mint) 70%, #ffffff) 8px 10px
  );
  transition: width 300ms ease;
}

@keyframes xp-levelup {
  0%, 100% { transform: translateX(-50%) scale(1); }
  30% { transform: translateX(-50%) scale(1.12); }
}

.xp-dock.is-levelup {
  animation: xp-levelup 500ms cubic-bezier(0.2, 0.7, 0.3, 1.4);
}

.xp-orb {
  position: fixed;
  z-index: 140;
  width: 9px;
  height: 9px;
  background: var(--mint);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--mint) 45%, transparent);
  pointer-events: none;
}

/* --- Chat console --- */
.mc-chat {
  position: fixed;
  left: var(--space-4);
  bottom: var(--space-4);
  z-index: 90;
  width: min(440px, calc(100vw - 32px));
  transform: translateY(12px);
  opacity: 0;
  transition: transform 200ms ease, opacity 200ms ease;
}

.mc-chat.is-open {
  transform: translateY(0);
  opacity: 1;
}

.mc-chat__log {
  max-height: 220px;
  overflow-y: auto;
  padding: var(--space-2) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: color-mix(in srgb, #10161c 62%, transparent);
  backdrop-filter: blur(2px);
}

.mc-chat__line {
  font-family: var(--font-game);
  font-size: 1.12rem;
  line-height: 1.25;
  color: #f2f7fb;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.6);
  overflow-wrap: anywhere;
}

.mc-chat__line--you { color: #cfe3f1; opacity: 0.85; }
.mc-chat__line--sys { color: #a8d8f0; }
.mc-chat__line--ok { color: #9adfc5; }
.mc-chat__line--warn { color: #ffd98a; }
.mc-chat__line--err { color: #ff8f8f; }
.mc-chat__line--creeper { color: #6fe08a; }

.mc-chat__row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: color-mix(in srgb, #10161c 78%, transparent);
}

.mc-chat__row > span {
  font-family: var(--font-game);
  font-size: 1.15rem;
  color: #9adfc5;
}

.mc-chat__input {
  flex: 1;
  min-width: 0;
  font-family: var(--font-game);
  font-size: 1.15rem;
  color: #f2f7fb;
  background: transparent;
  border: 0;
  outline: none;
  caret-color: #9adfc5;
}

.mc-chat__input::placeholder {
  color: rgba(242, 247, 251, 0.45);
}

.mc-chat-toggle {
  position: fixed;
  left: var(--space-4);
  bottom: var(--space-4);
  z-index: 85;
  width: 46px;
  height: 46px;
  padding: 9px;
  cursor: pointer;
  background: var(--surface);
  border: 2px solid var(--line-strong);
  box-shadow: 3px 3px 0 var(--shadow-hard);
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}

.mc-chat-toggle:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--shadow-hard);
}

.mc-chat-toggle:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--shadow-hard);
}

.mc-chat-toggle svg {
  width: 100%;
  height: 100%;
  shape-rendering: crispEdges;
}

.mc-chat.is-open ~ .mc-chat-toggle,
.mc-chat:not([hidden]) ~ .mc-chat-toggle {
  opacity: 0;
  pointer-events: none;
}

/* --- Boss bar Ender Dragon --- */
.boss-bar {
  position: fixed;
  top: 86px;
  left: 50%;
  transform: translate(-50%, -16px);
  z-index: 70;
  width: min(420px, 60vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 250ms ease, transform 250ms ease;
}

.boss-bar.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.boss-bar.is-disabled {
  display: none;
}

.boss-bar__label {
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--boss);
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.25);
}

.boss-bar__track {
  width: 100%;
  height: 9px;
  background: color-mix(in srgb, var(--boss) 18%, var(--surface-2));
  border: 2px solid color-mix(in srgb, var(--boss) 55%, var(--ink));
  box-shadow: 2px 2px 0 var(--shadow-soft);
  overflow: hidden;
  display: block;
}

.boss-bar__fill {
  display: block;
  height: 100%;
  width: 100%;
  background: repeating-linear-gradient(
    90deg,
    var(--boss) 0 8px,
    color-mix(in srgb, var(--boss) 72%, #ffffff) 8px 10px
  );
  transition: width 150ms linear;
}

/* --- Đào block IP --- */
.mine-block {
  cursor: pointer;
  position: relative;
  user-select: none;
  touch-action: none;
}

.mine-block::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background:
    repeating-linear-gradient(45deg, transparent 0 7px, rgba(38, 49, 59, 0.5) 7px 9px),
    repeating-linear-gradient(-45deg, transparent 0 11px, rgba(38, 49, 59, 0.45) 11px 13px);
  background-size: 26px 26px, 34px 34px;
}

.mine-block[data-crack="1"]::after { opacity: 0.22; }
.mine-block[data-crack="2"]::after { opacity: 0.45; }
.mine-block[data-crack="3"]::after { opacity: 0.68; }
.mine-block[data-crack="4"]::after { opacity: 0.9; }

.mine-block[data-crack] {
  animation: mine-shake 180ms linear infinite;
}

@keyframes mine-shake {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(-1px, 1px); }
  75% { transform: translate(1px, -1px); }
}

.mine-block.is-broken strong {
  color: var(--ok);
}

.mine-particle {
  position: fixed;
  z-index: 140;
  width: 8px;
  height: 8px;
  background: var(--sky-strong);
  pointer-events: none;
}

.mine-particle:nth-child(odd) {
  background: var(--sun);
}

/* --- Điều hướng lightbox --- */
.gallery-lightbox figure {
  position: relative;
}

.gallery-lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  color: var(--ink);
  background: var(--surface);
  border: 2px solid var(--line-strong);
  box-shadow: 3px 3px 0 var(--shadow-hard);
  transition: transform var(--t-fast), background-color var(--t-fast);
}

.gallery-lightbox__nav:hover {
  background: var(--sky-soft);
}

.gallery-lightbox__nav:active {
  transform: translateY(calc(-50% + 2px));
}

.gallery-lightbox__nav--prev { left: 10px; }
.gallery-lightbox__nav--next { right: 10px; }

.gallery-lightbox__meta {
  color: var(--ink-faint);
  font-size: 0.8rem;
  font-weight: 500;
}

.gallery-lightbox__meta b {
  color: var(--sky-deep);
  font-weight: 400;
}

/* --- Responsive cho lớp game --- */
@media (max-width: 900px) {
  .boss-bar {
    display: none;
  }

  .mc-toasts {
    top: auto;
    bottom: 70px;
    right: var(--space-3);
  }
}

@media (max-width: 720px) {
  .xp-dock__bar {
    width: 34vw;
  }

  .gallery-lightbox__meta {
    display: none;
  }
}

/* ---------- 20. Motion preferences ---------- */

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

  html {
    scroll-behavior: auto;
  }
}
