@font-face {
  font-family: "Monocraft";
  src: url("/assets/fonts/monocraft/Monocraft.woff2?v=1") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Monocraft";
  src: url("/assets/fonts/monocraft/Monocraft-Bold.woff2?v=1") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/*
 * Minecraft-inspired design system.
 *
 * Every colour and shape here is original — no Mojang textures, artwork or
 * fonts are used. The "in-game" feel comes from three reusable primitives:
 *   1. hard beveled edges (no blur, no gradients) via --bevel-raised/inset
 *   2. square corners + a black outline on every panel and control
 *   3. the Monocraft pixel font on Latin UI chrome
 * Thai text never renders in Monocraft (it has no Thai glyphs) — the font
 * stacks fall back to Noto Sans Thai per-glyph, so mixed Thai/Latin strings
 * stay readable.
 */
:root {
  --mc-grass: #6aa84f;
  --mc-grass-deep: #4a7c30;
  --mc-grass-bright: #7cc45c;
  --mc-dirt: #7a5233;
  --mc-outline: #16181a;
  --mc-deep: #191b1e;
  --mc-deep-raised: #2b2f34;
  --mc-stone: #c6c6c6;
  --mc-stone-muted: #b2b2b2;
  --mc-slot: #e4e4e4;
  --mc-gold: #e3a92c;
  --mc-redstone: #c23b30;
  --mc-emerald: #2f7d4f;
  --mc-aqua: #63d3e6;

  --color-primary: var(--mc-grass-deep);
  --color-primary-hover: #57913a;
  --color-primary-soft: #dfeed3;
  --color-accent: var(--mc-aqua);
  --color-bg: var(--mc-deep);
  --color-surface: var(--mc-stone);
  --color-surface-muted: var(--mc-stone-muted);
  --color-text: #e8eaec;
  --color-text-muted: #a6aeb6;
  --color-border: var(--mc-outline);
  --color-success: #2f7d4f;
  --color-warning: #8a5a00;
  --color-danger: #a32b21;
  --color-eyebrow: var(--mc-grass-bright);
  --color-code-bg: #0e1012;
  --color-code-text: #d9e7d6;

  /* Hard-edged bevels. rgba (not fixed colours) so the same two values give
     correct light/dark edges over any panel or button colour. */
  --bevel-raised:
    inset 3px 3px 0 0 rgba(255, 255, 255, 0.5),
    inset -3px -3px 0 0 rgba(0, 0, 0, 0.32);
  --bevel-inset:
    inset 3px 3px 0 0 rgba(0, 0, 0, 0.34),
    inset -3px -3px 0 0 rgba(255, 255, 255, 0.45);
  --shadow-sm: 0 4px 0 0 rgba(0, 0, 0, 0.4);

  /* Square by design — kept as variables so existing component rules that
     reference them need no changes. */
  --radius-sm: 0;
  --radius-md: 0;
  --radius-lg: 0;

  --font-sans: Inter, "Noto Sans Thai", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-ui: "Monocraft", "Noto Sans Thai", Inter, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", Consolas, "SFMono-Regular", monospace;
  --font-pixel: "Monocraft", "JetBrains Mono", monospace;
  --content-max: 1280px;
}

* {
  box-sizing: border-box;
}

/*
 * Browsers do not make form controls inherit the page font by default (they
 * use a platform UI font instead), so every button/input/select/textarea
 * would otherwise look inconsistent with body text unless this is set once,
 * globally, here.
 */
button,
input,
select,
textarea {
  font-family: inherit;
}

/* Baseline "inventory slot" look for bare controls (e.g. the admin scaffold).
   Component rules like .field input / .tool-search are more specific and
   still win where they apply. */
input:not([type]),
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="search"],
textarea {
  min-height: 44px;
  padding: 0 12px;
  border: 2px solid var(--mc-outline);
  box-shadow: var(--bevel-inset);
  background: var(--mc-slot);
  color: #23262a;
  font-size: 1rem;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-width: 0;
  background-color: var(--color-bg);
  /* A faint 32px block grid — evokes the game's world without putting a busy
     texture behind the forms. */
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px);
  background-size: 32px 32px;
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
}

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

a {
  color: var(--color-accent);
}

code,
pre,
kbd,
.mono {
  font-family: var(--font-mono);
}

h1,
h2,
h3 {
  font-family: var(--font-ui);
  line-height: 1.4;
}

.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 20px;
}

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

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

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--color-surface);
  color: #23262a;
  padding: 10px 16px;
  border: 2px solid var(--mc-outline);
  z-index: 100;
}

.skip-link:focus {
  left: 0;
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--mc-deep-raised);
  border-bottom: 2px solid var(--mc-outline);
}

/* Grass-block edge under the header: solid grass, a row of grass/dirt teeth,
   then dirt — built from gradients, no image assets. */
.site-header::after {
  content: "";
  display: block;
  height: 14px;
  background-color: var(--mc-dirt);
  background-image:
    linear-gradient(var(--mc-grass) 0 6px, transparent 6px),
    repeating-linear-gradient(90deg, var(--mc-grass) 0 10px, transparent 10px 20px);
  background-size: 100% 100%, 100% 10px;
  background-repeat: no-repeat, repeat-x;
  border-bottom: 2px solid var(--mc-outline);
}

.site-header__inner {
  max-width: 1520px;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 64px;
}

.brand {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 1.05rem;
  color: #f2f4f5;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.55);
}

.brand__mark {
  width: 32px;
  height: 32px;
  display: block;
  object-fit: contain;
  image-rendering: pixelated;
  flex: 0 0 auto;
}

.site-nav {
  display: flex;
  flex-wrap: nowrap;
  gap: 2px;
  margin-left: auto;
  min-width: 0;
}

.site-nav a,
.site-nav__trigger {
  font-family: var(--font-ui);
  color: #cdd4da;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.88rem;
  min-height: 44px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  border: 2px solid transparent;
}

.site-nav a:hover,
.site-nav a[aria-current="page"],
.site-nav__trigger:hover,
.site-nav__trigger[aria-expanded="true"],
.site-nav__group.is-current > .site-nav__trigger {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--mc-outline);
  box-shadow: var(--bevel-raised);
}

.site-nav__group {
  position: relative;
  display: flex;
}

.site-nav__trigger {
  gap: 8px;
  background: transparent;
  cursor: pointer;
}

.site-nav__chevron {
  font-size: 0.8rem;
  transition: transform 140ms ease;
}

.site-nav__group.is-open .site-nav__chevron {
  transform: rotate(180deg);
}

.site-nav__submenu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 2;
  display: none;
  gap: 4px;
  min-width: 250px;
  padding: 8px;
  background: var(--mc-deep-raised);
  border: 2px solid var(--mc-outline);
  box-shadow: var(--bevel-raised), 0 10px 22px rgba(0, 0, 0, 0.45);
}

.site-nav__group.is-open .site-nav__submenu {
  display: grid;
}

.site-nav__submenu a {
  width: 100%;
  white-space: nowrap;
}

/* Selectors are qualified with `a` so they outrank `.site-nav a:hover` and
   `.site-nav a[aria-current]` on specificity instead of needing !important. */
.site-nav a.site-nav__feedback {
  gap: 7px;
  background: var(--mc-gold);
  color: #3a2a00;
  border-color: var(--mc-outline);
  box-shadow: var(--bevel-raised);
}

:where(.site-nav__feedback, .btn-feedback) > span[aria-hidden="true"] {
  font-family: var(--font-sans);
  line-height: 1;
}

.site-nav a.site-nav__feedback:hover,
.site-nav a.site-nav__feedback[aria-current="page"] {
  background: #f0bc4a;
  color: #3a2a00;
}

.site-nav a.site-nav__report {
  gap: 6px;
  color: #aeb6bc;
  font-size: 0.82rem;
}

.site-nav a.site-nav__report:hover,
.site-nav a.site-nav__report[aria-current="page"] {
  color: #eef1f3;
  background: rgba(255, 255, 255, 0.06);
}

.site-nav__report-icon {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border: 1px solid currentColor;
  font-family: var(--font-pixel);
  font-size: 0.66rem;
  flex: 0 0 auto;
}

.site-nav__lang {
  flex: 0 0 auto;
  margin-left: 4px;
}

.site-nav__lang-trigger {
  min-width: 58px;
  padding: 0 8px;
  gap: 4px;
  justify-content: center;
  border-color: var(--mc-outline);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: var(--bevel-raised);
}

.site-nav__lang-trigger .site-nav__chevron {
  width: 0;
  height: 0;
  border-right: 4px solid transparent;
  border-left: 4px solid transparent;
  border-top: 5px solid currentColor;
  font-size: 0;
  line-height: 0;
}

.site-nav__flag {
  display: block;
  flex: 0 0 auto;
  outline: 1px solid rgba(255, 255, 255, 0.25);
  outline-offset: -1px;
}

.site-nav__submenu--lang {
  grid-auto-flow: column;
  min-width: 0;
  width: max-content;
  right: 0;
}

.site-nav__submenu--lang a {
  width: auto;
  padding: 4px;
  justify-content: center;
}

.site-nav__submenu--lang a[aria-current="true"] {
  color: #3a2a00;
  background: var(--mc-gold);
}

.install-app-btn {
  min-height: 40px;
  padding: 0 14px;
  font-size: 0.82rem;
  white-space: nowrap;
  flex: 0 0 auto;
}

.nav-toggle {
  display: none;
}

/*
 * Width handles every compact iPad layout; coarse pointer also catches the
 * 1366px landscape viewport used by the largest iPad Pro without forcing the
 * collapsed navigation onto desktop screens at the same width.
 */
@media (max-width: 1279px), (max-width: 1366px) and (pointer: coarse) {
  .site-header__inner {
    gap: 12px;
  }

  .site-nav {
    position: absolute;
    inset: 64px 0 auto 0;
    background: var(--mc-deep-raised);
    border-bottom: 2px solid var(--mc-outline);
    flex-direction: column;
    gap: 6px;
    padding: 8px 20px 16px;
    max-height: calc(100vh - 64px);
    max-height: calc(100dvh - 64px);
    overflow-y: auto;
    overscroll-behavior: contain;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.38);
    display: none;
  }

  .site-nav.is-open {
    display: flex;
  }

  .site-nav a {
    width: 100%;
    min-height: 48px;
    padding: 0 16px;
    white-space: nowrap;
  }

  /*
   * Scoped to descendants of .site-nav (e.g. the "My stuff" group) — the
   * language switcher reuses the same .site-nav__group/__trigger/__submenu
   * classes but lives outside .site-nav in the always-visible header row,
   * so it must stay untouched by the collapsed-nav mobile styling below.
   */
  .site-nav .site-nav__group {
    width: 100%;
    flex-direction: column;
  }

  .site-nav .site-nav__trigger {
    justify-content: space-between;
    width: 100%;
    min-height: 48px;
    padding: 0 16px;
  }

  .site-nav .site-nav__submenu {
    position: static;
    min-width: 0;
    margin: 0 8px;
    padding: 6px 0 0 12px;
    background: rgba(0, 0, 0, 0.2);
    border-width: 0 0 0 2px;
    box-shadow: none;
  }

  .site-nav .site-nav__submenu a {
    padding-left: 18px;
  }

  .install-app-btn:not([hidden]) {
    margin-left: auto;
  }

  .install-app-btn[hidden] + .nav-toggle {
    margin-left: auto;
  }

  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    min-width: 44px;
    font-family: var(--font-ui);
    font-weight: 700;
    color: #f2f4f5;
    border: 2px solid var(--mc-outline);
    background: var(--mc-deep-raised);
    box-shadow: var(--bevel-raised);
    cursor: pointer;
  }
}

@media (max-width: 520px) {
  .brand {
    gap: 0;
  }

  .brand__name {
    display: none;
  }
}

/* Footer */

.site-footer {
  border-top: 2px solid var(--mc-outline);
  background: #131518;
  margin-top: 60px;
  padding-top: 32px;
  padding-bottom: 32px;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  justify-content: space-between;
}

.site-footer__credit {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
}

.site-footer__credit a {
  font-weight: 700;
}

/* About / contact / privacy. Given its own row so it never wraps into the
   middle of the credit line — ad networks and readers both look for it. */
.site-footer__legal {
  flex-basis: 100%;
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.site-footer__legal a {
  font-weight: 700;
}

.footer-feedback-link {
  color: #f2bf48;
  font-weight: 700;
}

.footer-report-link {
  font-size: 0.82rem;
  opacity: 0.82;
}

/* Buttons — raised MC-style widgets that visibly depress when pressed */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 2px solid var(--mc-outline);
  box-shadow: var(--bevel-raised);
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  text-decoration: none;
  background: #9d9d9d;
  color: #1c1f22;
}

.btn[hidden] {
  display: none;
}

.btn:hover {
  background: #adadad;
}

.btn:active {
  box-shadow: var(--bevel-inset);
  transform: translateY(1px);
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.45);
}

.btn-primary:hover {
  background: var(--color-primary-hover);
}

.btn-feedback {
  background: var(--mc-gold);
  color: #3a2a00;
  text-shadow: none;
}

.btn-feedback:hover {
  background: #f0bc4a;
  color: #3a2a00;
}

.btn-outline {
  background: var(--mc-deep-raised);
  color: #eef1f3;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.45);
}

.btn-outline:hover {
  background: #3a3f45;
  color: #fff;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: var(--bevel-raised);
  transform: none;
}

/* Utility */

/*
 * padding-top/bottom only (not the shorthand) so this doesn't zero out the
 * left/right padding coming from the .container class most of these elements
 * are combined with (e.g. <section class="section container">).
 */
.section {
  padding-top: 48px;
  padding-bottom: 48px;
}

.section-tight {
  padding-top: 28px;
  padding-bottom: 28px;
}

.eyebrow {
  font-family: var(--font-ui);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-eyebrow);
}

.text-muted {
  color: var(--color-text-muted);
}

/* Non-blocking "view in English" banner — see modules/lang-suggest.js */
.lang-suggest {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--mc-deep-raised);
  border-top: 2px solid var(--mc-outline);
  box-shadow: 0 -8px 18px rgba(0, 0, 0, 0.38);
  color: #eef1f3;
  font-family: var(--font-ui);
  font-size: 0.88rem;
}

.lang-suggest__text {
  flex: 1 1 260px;
}

.lang-suggest__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.lang-suggest__link {
  min-height: 40px;
  padding: 0 14px;
  font-size: 0.82rem;
  white-space: nowrap;
}

.lang-suggest__close {
  min-height: 40px;
  min-width: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  line-height: 1;
  color: #cdd4da;
  background: transparent;
  border: 2px solid var(--mc-outline);
  cursor: pointer;
}

.lang-suggest__close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

@media (max-width: 520px) {
  .lang-suggest {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }

  .lang-suggest__actions {
    justify-content: center;
  }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
