/* Aethelgard Phase 7 โ€” marketing / member site
   Theme: dark gold forge (aligned with in-game theme-forge) */

:root {
  --bg-deep: #0a0806;
  --bg-panel: #1a1410;
  --bg-panel-2: #241c14;
  --forge-top: #2e2418;
  --forge-bot: #14100c;
  --border: #6b4a28;
  --border-soft: rgba(107, 74, 40, 0.55);
  --gold: #fbd38d;
  --gold-mid: #c9a227;
  --gold-dim: #8a7020;
  --text: #e8e0d4;
  --text-muted: #a0aec0;
  --text-dim: #7a8494;
  --ok: #68d391;
  --warn: #f6ad55;
  --danger: #fc8181;
  --link: #ecc94b;
  --radius: 10px;
  --shadow: 0 14px 42px rgba(0, 0, 0, 0.48);
  --glow-gold: 0 0 22px rgba(201, 162, 39, 0.22);
  --inset-gold: inset 0 1px 0 rgba(251, 211, 141, 0.16);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --font-body: "Sarabun", "Segoe UI", Tahoma, sans-serif;
  --font-brand: "Cinzel", "Times New Roman", serif;
  --nav-h: 64px;
  --max: 1100px;
}

::selection {
  background: rgba(201, 162, 39, 0.38);
  color: #fff8e7;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100dvh;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg-deep);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: anywhere;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  color: var(--gold);
  text-decoration: underline;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

.hidden {
  display: none !important;
}

/* โ€”โ€” Page background: packed illustration + lighter vignette โ€”โ€” */
.site-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background-color: #1a1510;
  background-image:
    linear-gradient(180deg, rgba(20, 16, 12, 0.18) 0%, rgba(20, 16, 12, 0.32) 40%, rgba(12, 10, 8, 0.55) 100%),
    url("/web/assets/site_bg.png");
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  filter: brightness(1.18) contrast(1.02) saturate(1.05);
}

.site-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.05;
  background-image:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(0, 0, 0, 0.25) 2px,
      rgba(0, 0, 0, 0.25) 3px
    );
}

.site-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(0, 0, 0, 0.42) 100%);
}

.site-sparkles {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
  mix-blend-mode: screen;
}

.site-sparkles canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.site-sparkles::before,
.site-sparkles::after {
  content: "";
  position: absolute;
  inset: -18%;
  pointer-events: none;
}

.site-sparkles::before {
  background:
    radial-gradient(ellipse 48% 32% at 16% 12%, rgba(255, 236, 180, 0.14), transparent 68%),
    radial-gradient(ellipse 40% 28% at 86% 18%, rgba(251, 211, 141, 0.12), transparent 70%),
    radial-gradient(ellipse 46% 34% at 48% 82%, rgba(255, 248, 231, 0.08), transparent 72%);
  animation: sparkle-haze 22s ease-in-out infinite;
}

.site-sparkles::after {
  background: linear-gradient(
    118deg,
    transparent 38%,
    rgba(255, 244, 210, 0.08) 50%,
    transparent 62%
  );
  background-size: 240% 240%;
  animation: sparkle-shimmer 16s ease-in-out infinite;
}

.site-wrap {
  min-height: 100dvh;
  max-width: 100%;
  display: flex;
  flex-direction: column;
}

/* โ€”โ€” Nav โ€”โ€” */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  width: 100%;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0 max(1.25rem, env(safe-area-inset-right)) 0 max(1.25rem, env(safe-area-inset-left));
  background: linear-gradient(180deg, rgba(22, 17, 12, 0.97), rgba(16, 12, 9, 0.9));
  border-bottom: 1px solid rgba(201, 162, 39, 0.28);
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.28),
    inset 0 -1px 0 rgba(251, 211, 141, 0.08);
  backdrop-filter: blur(12px);
}

.nav-brand {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  text-decoration: none !important;
  min-width: 0;
}

.nav-brand-name {
  font-family: var(--font-brand);
  font-size: 1.15rem;
  letter-spacing: 0.06em;
  color: var(--gold);
  line-height: 1.1;
  text-shadow: 0 0 18px rgba(251, 211, 141, 0.35);
}

.nav-brand-tag {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem 0.85rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  position: relative;
  color: var(--text-muted);
  font-size: 0.92rem;
  text-decoration: none;
  padding: 0.2rem 0.05rem 0.28rem;
  border-bottom: none;
  transition: color 0.18s var(--ease-out);
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-mid), transparent);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.22s var(--ease-out);
  opacity: 0.9;
}

.nav-links a:hover,
.nav-links a.is-active {
  color: var(--gold);
  text-decoration: none;
}

.nav-links a:hover::after,
.nav-links a.is-active::after {
  transform: scaleX(1);
}

.nav-toggle {
  display: none;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 40px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--border);
  color: var(--gold);
  border-radius: 6px;
  padding: 0.35rem 0.65rem;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(251, 211, 141, 0.12);
}

/* โ€”โ€” Layout โ€”โ€” */
.site-main {
  flex: 1;
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.5rem max(1.25rem, env(safe-area-inset-right)) max(3rem, env(safe-area-inset-bottom)) max(1.25rem, env(safe-area-inset-left));
}

.site-footer {
  border-top: 1px solid rgba(201, 162, 39, 0.22);
  padding: 1.25rem;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
  background:
    linear-gradient(180deg, rgba(201, 162, 39, 0.06), transparent 40%),
    rgba(10, 8, 6, 0.72);
}

.site-footer a {
  color: var(--gold-mid);
}

/* โ€”โ€” Typography โ€”โ€” */
.page-title {
  font-size: 1.75rem;
  color: var(--gold);
  margin: 0 0 0.35rem;
  font-weight: 700;
  text-shadow: 0 0 22px rgba(201, 162, 39, 0.22);
}

.page-title .brand-en {
  font-family: var(--font-brand);
  font-weight: 600;
  letter-spacing: 0.04em;
}

.page-lead {
  margin: 0 0 1.5rem;
  color: var(--text-muted);
  max-width: 42rem;
}

.section-title {
  font-size: 1.25rem;
  color: var(--gold);
  margin: 0 0 0.75rem;
  font-weight: 700;
}

/* โ€”โ€” Panels / cards โ€”โ€” */
.panel {
  background:
    radial-gradient(120% 80% at 0% 0%, rgba(251, 211, 141, 0.08), transparent 42%),
    linear-gradient(165deg, var(--forge-top), var(--forge-bot));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow), var(--inset-gold);
  padding: 1.15rem 1.25rem;
}

.panel + .panel {
  margin-top: 1rem;
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}

.muted {
  color: var(--text-muted);
}

.dim {
  color: var(--text-dim);
}

/* โ€”โ€” Buttons โ€”โ€” */
.btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1.15rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #3a2e1e, #221810);
  color: var(--gold);
  cursor: pointer;
  font-weight: 600;
  text-decoration: none !important;
  isolation: isolate;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  transition: border-color 0.18s var(--ease-out), filter 0.18s, transform 0.12s, box-shadow 0.18s;
}

.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 28%, rgba(255, 248, 231, 0.22) 48%, transparent 68%);
  transform: translateX(-130%);
  transition: transform 0.5s var(--ease-out);
  pointer-events: none;
  mix-blend-mode: overlay;
}

.btn:hover {
  border-color: var(--gold-mid);
  filter: brightness(1.08);
  color: var(--gold);
  box-shadow: var(--glow-gold);
}

.btn:hover::after {
  transform: translateX(130%);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: linear-gradient(180deg, #6a5226, #2e2410);
  border-color: var(--gold-mid);
  color: #fff8e7;
  box-shadow: 0 0 18px rgba(201, 162, 39, 0.22);
}

.btn-ghost {
  background: transparent;
}

.btn-danger {
  border-color: #9b2c2c;
  color: var(--danger);
  background: linear-gradient(180deg, #3a1818, #1a0c0c);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.88rem;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

/* โ€”โ€” Hero (landing) โ€”โ€” */
.hero {
  position: relative;
  text-align: center;
  padding: 2.5rem 1.25rem 2rem;
  margin: -0.25rem 0 1.5rem;
  border-radius: var(--radius);
  border: 1px solid rgba(201, 162, 39, 0.38);
  background:
    radial-gradient(ellipse 80% 70% at 50% 20%, rgba(201, 162, 39, 0.2), transparent 60%),
    linear-gradient(165deg, rgba(46, 36, 24, 0.92), rgba(20, 16, 12, 0.95));
  overflow: hidden;
  box-shadow:
    var(--inset-gold),
    0 0 0 1px rgba(201, 162, 39, 0.08),
    0 18px 48px rgba(0, 0, 0, 0.32);
}

.hero::before {
  content: "";
  position: absolute;
  inset: auto 8% -46% 8%;
  height: 70%;
  background: radial-gradient(ellipse at center, rgba(251, 211, 141, 0.18), transparent 70%);
  pointer-events: none;
  animation: hero-glow 5.5s ease-in-out infinite;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1.5px 1.5px at 14% 28%, rgba(255, 248, 231, 0.7), transparent),
    radial-gradient(1.5px 1.5px at 78% 22%, rgba(251, 211, 141, 0.55), transparent),
    radial-gradient(1px 1px at 62% 68%, rgba(255, 248, 231, 0.5), transparent),
    radial-gradient(1.5px 1.5px at 32% 76%, rgba(201, 162, 39, 0.55), transparent),
    radial-gradient(1px 1px at 88% 58%, rgba(251, 211, 141, 0.45), transparent);
  animation: hero-spark 9s linear infinite;
  opacity: 0.7;
}

.hero-brand {
  font-family: var(--font-brand);
  font-size: clamp(2.1rem, 6vw, 3.4rem);
  letter-spacing: 0.08em;
  color: var(--gold);
  margin: 0 0 0.4rem;
  text-shadow:
    0 2px 24px rgba(201, 162, 39, 0.4),
    0 0 38px rgba(251, 211, 141, 0.18);
  position: relative;
}

.hero-tagline {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  color: var(--text-muted);
  margin: 0 0 0.35rem;
}

.hero-tagline-en {
  font-family: var(--font-brand);
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin: 0 0 1.5rem;
}

.hero-brand,
.hero-tagline,
.hero-tagline-en,
.hero-cta,
.hero-note {
  position: relative;
  z-index: 1;
}

.hero-cta {
  justify-content: center;
}

.hero-note {
  margin: 1rem 0 0;
  font-size: 0.85rem;
  color: var(--text-dim);
}

/* โ€”โ€” Landing grid โ€”โ€” */
.home-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1rem;
  align-items: start;
}

.home-side {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* โ€”โ€” Status โ€”โ€” */
.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: center;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.88rem;
  background: rgba(0, 0, 0, 0.25);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
}

.status-dot.is-online {
  background: var(--ok);
  box-shadow: 0 0 8px rgba(104, 211, 145, 0.6);
  animation: status-pulse 2.2s ease-in-out infinite;
}

.status-dot.is-offline {
  background: var(--danger);
}

.status-metric strong {
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

/* โ€”โ€” Social โ€”โ€” */
.social-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.social-list li {
  min-width: 0;
}

.social-list a {
  position: relative;
  display: grid;
  grid-template-columns: 2.55rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  min-height: 4.15rem;
  padding: 0.58rem 0.65rem;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.045), rgba(0, 0, 0, 0.24));
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--inset-gold);
  transition: border-color 0.18s, color 0.18s, box-shadow 0.18s, transform 0.12s, background 0.18s;
}

.social-icon {
  display: grid;
  place-items: center;
  width: 2.55rem;
  height: 2.55rem;
  border-radius: 10px;
  color: #fff;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.social-icon svg {
  width: 1.45rem;
  height: 1.45rem;
  fill: currentColor;
}

.social-link--facebook .social-icon {
  background: linear-gradient(145deg, #287be0, #1554ad);
}

.social-link--discord .social-icon {
  background: linear-gradient(145deg, #7788f8, #4f5dc7);
}

.social-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  line-height: 1.2;
}

.social-copy strong {
  color: #fff7e5;
  font-size: 0.94rem;
}

.social-copy small {
  margin-top: 0.2rem;
  color: var(--text-muted);
  font-size: 0.7rem;
  white-space: nowrap;
}

.social-arrow {
  color: var(--gold-dim);
  font-size: 0.9rem;
  transition: color 0.18s, transform 0.18s;
}

.social-list a:hover {
  border-color: var(--gold-mid);
  color: var(--gold);
  background: linear-gradient(145deg, rgba(201, 162, 39, 0.12), rgba(0, 0, 0, 0.25));
  box-shadow: var(--glow-gold), var(--inset-gold);
  text-decoration: none;
}

.social-list a:hover .social-arrow {
  color: var(--gold);
  transform: translate(2px, -2px);
}

@media (max-width: 420px) {
  .social-list {
    grid-template-columns: 1fr;
  }
}
/* โ€”โ€” News โ€”โ€” */
.news-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.news-item {
  padding: 0.85rem 0.35rem 0.85rem 0.85rem;
  border-bottom: 1px solid var(--border-soft);
  border-left: 2px solid transparent;
  border-radius: 0 8px 8px 0;
  transition: background 0.18s, border-color 0.18s;
}

.news-item:hover {
  background: rgba(201, 162, 39, 0.06);
  border-left-color: var(--gold-mid);
}

.news-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.news-item:first-child {
  padding-top: 0;
}

.news-meta {
  font-size: 0.8rem;
  color: var(--gold-mid);
  margin-bottom: 0.2rem;
}

.news-title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  color: var(--gold);
}

.news-summary {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.news-body {
  margin: 0.5rem 0 0;
  color: var(--text-dim);
  font-size: 0.9rem;
}

/* โ€”โ€” Forms โ€”โ€” */
.form-stack {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  max-width: 420px;
}

.form-stack.wide {
  max-width: 520px;
}

.field label {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="search"],
.field select,
.field textarea {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  outline: none;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--gold-mid);
  box-shadow: 0 0 0 2px rgba(201, 162, 39, 0.2);
}

.field-check {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.field-check input {
  margin-top: 0.25rem;
  accent-color: var(--gold-mid);
}

.form-hint {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin: 0;
}

.form-msg {
  margin: 0;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  font-size: 0.92rem;
  border: 1px solid transparent;
}

.form-msg.is-ok {
  background: rgba(56, 161, 105, 0.15);
  border-color: rgba(104, 211, 145, 0.35);
  color: var(--ok);
}

.form-msg.is-err {
  background: rgba(155, 44, 44, 0.18);
  border-color: rgba(252, 129, 129, 0.35);
  color: var(--danger);
}

.form-msg.is-info {
  background: rgba(201, 162, 39, 0.12);
  border-color: rgba(201, 162, 39, 0.3);
  color: var(--gold);
}

/* โ€”โ€” Tabs โ€”โ€” */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-soft);
  padding-bottom: 0.65rem;
}

.tab-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  padding: 0.4rem 0.85rem;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  font-weight: 600;
  transition: color 0.16s, background 0.16s, border-color 0.16s, box-shadow 0.16s;
}

.tab-btn:hover {
  color: var(--gold);
}

.tab-btn.is-active {
  color: var(--gold);
  border-color: var(--border);
  background: rgba(201, 162, 39, 0.1);
  border-bottom-color: transparent;
  box-shadow: inset 0 1px 0 rgba(251, 211, 141, 0.2);
}

.tab-panel.hidden {
  display: none !important;
}

/* โ€”โ€” Wiki โ€”โ€” */
.wiki-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
}

.wiki-toolbar .field {
  flex: 1;
  min-width: 180px;
  max-width: 360px;
}

.wiki-count {
  font-size: 0.85rem;
  color: var(--text-dim);
}

.wiki-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-soft);
}

.wiki-pager-btn {
  min-width: 2.1rem;
  height: 2.1rem;
  padding: 0 0.45rem;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.28);
  color: var(--text);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 600;
}

.wiki-pager-btn:hover:not(:disabled) {
  border-color: var(--gold-mid);
  color: var(--gold);
}

.wiki-pager-btn.is-active {
  background: rgba(201, 162, 39, 0.28);
  border-color: var(--gold-mid);
  color: var(--gold);
}

.wiki-pager-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.wiki-pager-info {
  width: 100%;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-bottom: 0.15rem;
}

.wiki-card-stats {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: #c6ddb0;
  line-height: 1.4;
}



.item-source-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.item-source-monster {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  padding: 0.65rem;
  border: 1px solid rgba(201, 162, 39, 0.24);
  border-radius: 8px;
  color: var(--text);
  background: rgba(18, 14, 10, 0.58);
}

.item-source-monster:hover {
  border-color: var(--gold-mid);
  color: var(--gold-light);
  box-shadow: var(--glow-gold);
}

.item-source-monster img,
.item-source-monster .wiki-glyph {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  object-fit: contain;
  image-rendering: pixelated;
}

.item-source-monster span:last-child {
  min-width: 0;
  font-weight: 600;
  line-height: 1.35;
}
.item-properties {
  margin: 0 0 1.1rem;
  padding: 0.8rem 1rem;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
}

.item-property-list {
  margin: 0;
  padding-left: 1.25rem;
  color: #c6ddb0;
}

.item-property-list li + li {
  margin-top: 0.35rem;
}

.item-detail-head {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1.4rem;
}

.item-detail-art-frame {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  overflow: hidden;
  border: 0;
  border-radius: 10px;
  background:
    radial-gradient(circle at 50% 45%, rgba(105, 56, 157, 0.28), transparent 58%),
    linear-gradient(145deg, rgba(38, 26, 22, 0.96), rgba(15, 12, 14, 0.98));
  box-shadow: inset 0 0 28px rgba(0, 0, 0, 0.55), 0 8px 24px rgba(0, 0, 0, 0.22);
}


.item-detail-art {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 0;
  filter: drop-shadow(0 10px 12px rgba(0, 0, 0, 0.48));
}

.item-detail-copy {
  min-width: 0;
}
.item-detail-art.is-pixel-art {
  image-rendering: pixelated;
}

@media (max-width: 520px) {
  .item-detail-head {
    grid-template-columns: 112px minmax(0, 1fr);
    align-items: start;
    gap: 1rem;
  }
}
.pet-wiki-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.wiki-card.pet-wiki-card {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 0.85rem;
  align-items: start;
}

.pet-wiki-evolutions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.55rem;
  padding: 0;
}

.pet-wiki-evolution {
  min-width: 0;
  margin: 0;
  text-align: center;
}

.pet-wiki-evolution img {
  display: block;
  width: 100%;
  height: 72px;
  object-fit: contain;
  image-rendering: pixelated;
}

.pet-wiki-evolution figcaption {
  margin-top: 0.1rem;
  color: var(--gold-light);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.pet-wiki-card section {
  margin-top: 0.7rem;
  padding-top: 0.65rem;
  border-top: 1px solid rgba(201, 162, 39, 0.18);
}

.pet-wiki-card h4 {
  margin: 0 0 0.3rem;
  color: var(--gold);
  font-size: 0.9rem;
}

.pet-wiki-card section p,
.pet-wiki-card ul {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.pet-wiki-card ul {
  padding-left: 1.05rem;
}

.pet-wiki-card li + li {
  margin-top: 0.2rem;
}

@media (max-width: 820px) {
  .pet-wiki-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .wiki-card.pet-wiki-card {
    grid-template-columns: 1fr;
  }

  .pet-wiki-evolutions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.3rem;
  }

  .pet-wiki-evolution img { height: 68px; }
}

.wiki-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
}

.wiki-card {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
  min-height: 88px;
  transition: border-color 0.18s var(--ease-out), background 0.18s, box-shadow 0.18s, transform 0.18s;
}

.wiki-thumb {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #0c0a08;
  object-fit: contain;
  image-rendering: pixelated;
}

.wiki-glyph {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #0c0a08;
  color: var(--gold-mid);
  font-size: 1.4rem;
  font-weight: 700;
}

.wiki-glyph.is-shown {
  display: flex;
}

.wiki-card-body {
  min-width: 0;
  flex: 1;
}

.wiki-card-title {
  margin: 0 0 0.25rem;
  color: var(--gold);
  font-size: 1rem;
  font-weight: 700;
}

.wiki-card-meta {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.wiki-card-desc {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  color: var(--text-dim);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.enhance-table,
.element-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  overflow-x: auto;
  display: block;
}

.enhance-table table,
.element-table table {
  width: 100%;
  border-collapse: collapse;
  min-width: 480px;
}

.enhance-table th,
.enhance-table td,
.element-table th,
.element-table td {
  border: 1px solid var(--border-soft);
  padding: 0.4rem 0.5rem;
  text-align: center;
}

.enhance-table th,
.element-table th {
  background: rgba(0, 0, 0, 0.35);
  color: var(--gold);
  font-weight: 600;
}

/* —— Elements wiki v2 (scoped .el2-*) —— */
.el2 {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.el2-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  align-items: flex-start;
}

.el2-title {
  margin: 0 0 0.35rem;
  color: var(--gold);
  font-size: 1.35rem;
  font-family: var(--font-brand);
  letter-spacing: 0.03em;
}

.el2-lead {
  margin: 0;
  max-width: 38rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.el2-key {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  font-size: 0.8rem;
}

.el2-key li {
  margin: 0;
}

.el2-key-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  box-sizing: border-box;
  padding: 0.4rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(107, 74, 40, 0.45);
  background: rgba(0, 0, 0, 0.32);
  color: var(--text-muted);
}

.el2-key-chip b {
  display: inline-grid;
  place-items: center;
  min-width: 1.25rem;
  font-weight: 700;
}

.el2-key-chip.is-strong {
  border-color: rgba(104, 211, 145, 0.4);
  background: rgba(56, 161, 105, 0.12);
}
.el2-key-chip.is-strong b { color: #9ae6b4; }
.el2-key-chip.is-flat b { color: #a0aec0; }
.el2-key-chip.is-weak {
  border-color: rgba(252, 129, 129, 0.35);
  background: rgba(197, 48, 48, 0.1);
}
.el2-key-chip.is-weak b { color: #feb2b2; }
.el2-key-chip.is-immune {
  border-color: rgba(197, 48, 48, 0.5);
  background: rgba(155, 44, 44, 0.18);
}
.el2-key-chip.is-immune b { color: #fc8181; }

.el2-boards {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 0.9rem;
}

.el2-board {
  position: relative;
  overflow: hidden;
  padding: 1.05rem 1.1rem 1.15rem;
  border-radius: 16px;
  border: 1px solid rgba(201, 162, 39, 0.35);
  background:
    radial-gradient(90% 70% at 50% -10%, rgba(251, 211, 141, 0.14), transparent 55%),
    radial-gradient(60% 50% at 100% 100%, rgba(107, 74, 40, 0.25), transparent 50%),
    linear-gradient(165deg, #2e2418, #100c09 70%);
  box-shadow:
    inset 0 1px 0 rgba(251, 211, 141, 0.12),
    0 10px 28px rgba(0, 0, 0, 0.28);
}

.el2-board::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 40%, rgba(251, 211, 141, 0.04) 50%, transparent 60%);
}

.el2-board-title {
  position: relative;
  margin: 0 0 0.2rem;
  color: var(--gold);
  font-size: 1.05rem;
}

.el2-board-sub {
  position: relative;
  margin: 0 0 0.85rem;
  color: var(--text-dim);
  font-size: 0.82rem;
}

.el2-board-sub strong {
  color: var(--text-muted);
  font-weight: 600;
}

.el2-board-foot {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.25rem;
  margin: 0.95rem 0 0;
}

.el2-foot-chip {
  padding: 0.18rem 0.45rem;
  border-radius: 999px;
  border: 1px solid currentColor;
  background: rgba(0, 0, 0, 0.35);
  font-size: 0.75rem;
  font-weight: 700;
}

.el2-foot-arrow {
  color: #c9a227;
  font-size: 0.85rem;
  opacity: 0.85;
}

.el2-cycle {
  position: relative;
  width: min(300px, 100%);
  aspect-ratio: 1;
  margin: 0.55rem auto 0;
}

.el2-cycle-glow {
  position: absolute;
  inset: 18%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(201, 162, 39, 0.16), transparent 70%);
  animation: el2-pulse 4.5s ease-in-out infinite;
}

.el2-cycle-core {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  width: 52px;
  height: 52px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px solid rgba(201, 162, 39, 0.45);
  background: radial-gradient(circle at 40% 35%, #3a2e1e, #120e0a 70%);
  display: grid;
  place-items: center;
  box-shadow: 0 0 20px rgba(201, 162, 39, 0.2);
}

.el2-cycle-core span {
  font-size: 0.72rem;
  font-weight: 700;
  color: #fbd38d;
  letter-spacing: 0.04em;
}

.el2-cycle-arrows {
  position: absolute;
  inset: 10%;
  width: 80%;
  height: 80%;
  pointer-events: none;
  z-index: 0;
}

.el2-cycle-slot {
  position: absolute;
  z-index: 1;
}

.el2-cycle-n { top: 0; left: 50%; transform: translateX(-50%); }
.el2-cycle-e { top: 50%; right: 0; transform: translateY(-50%); }
.el2-cycle-s { bottom: 0; left: 50%; transform: translateX(-50%); }
.el2-cycle-w { top: 50%; left: 0; transform: translateY(-50%); }

.el2-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  min-width: 4.6rem;
}

.el2-orb {
  position: relative;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 2px solid currentColor;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.45), transparent 38%),
    radial-gradient(circle at 50% 60%, currentColor, #0a0806 74%);
  box-shadow:
    0 0 0 4px rgba(0, 0, 0, 0.25),
    0 0 22px rgba(201, 162, 39, 0.12),
    0 0 20px currentColor;
  display: grid;
  place-items: center;
  animation: el2-breathe 3.8s ease-in-out infinite;
}

.el2-glyph {
  width: 16px;
  height: 16px;
  display: block;
  opacity: 0.92;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.45));
}

.el2-fire .el2-glyph {
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 15px solid #fff5f5;
}
.el2-water .el2-glyph {
  width: 12px;
  height: 12px;
  border-radius: 50% 50% 50% 0;
  background: #ebf8ff;
  transform: rotate(-45deg);
}
.el2-wind .el2-glyph {
  width: 16px;
  height: 10px;
  background:
    linear-gradient(#f0fff4, #f0fff4) 0 1px / 100% 2px no-repeat,
    linear-gradient(#f0fff4, #f0fff4) 2px 5px / 80% 2px no-repeat,
    linear-gradient(#f0fff4, #f0fff4) 0 9px / 90% 2px no-repeat;
}
.el2-earth .el2-glyph {
  width: 14px;
  height: 14px;
  background: #fffbeb;
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}
.el2-light .el2-glyph {
  width: 14px;
  height: 14px;
  background: #fffff0;
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}
.el2-dark .el2-glyph {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 65% 35%, #e9d8fd, #322659 60%, #1a202c 70%);
  box-shadow: inset -3px 0 0 rgba(255, 255, 255, 0.15);
}
.el2-neutral .el2-glyph {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid #e2e8f0;
  background: transparent;
}

.el2-name {
  font-size: 0.84rem;
  font-weight: 700;
  color: #f7e7c3;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
}

.el2-fire { color: #fc8181; }
.el2-water { color: #63b3ed; }
.el2-wind { color: #9ae6b4; }
.el2-earth { color: #ecc94b; }
.el2-light { color: #faf089; }
.el2-dark { color: #b794f4; }
.el2-neutral { color: #a0aec0; }

.el2-duel {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  min-height: 130px;
  margin-top: 0.65rem;
}

.el2-duel .el2-orb {
  width: 64px;
  height: 64px;
}

.el2-duel-mid {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--gold-mid);
  flex: 1;
  max-width: 8.5rem;
}

.el2-duel-line {
  flex: 1;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, #c9a227, transparent);
  animation: el2-shimmer 2.8s linear infinite;
  background-size: 200% 100%;
}

.el2-duel-badge {
  flex-shrink: 0;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(201, 162, 39, 0.55);
  background: rgba(46, 36, 24, 0.9);
  color: #fbd38d;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.el2-neutral-note {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.05rem;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  border: 1px solid rgba(160, 174, 192, 0.28);
  background: linear-gradient(90deg, rgba(160, 174, 192, 0.08), rgba(0, 0, 0, 0.22));
}

.el2-neutral-note .el2-node {
  flex-direction: row;
  min-width: 0;
  gap: 0.5rem;
}

.el2-neutral-note .el2-orb {
  width: 38px;
  height: 38px;
  animation: none;
}

.el2-neutral-note p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

.el2-matrix-card {
  padding: 1.05rem 1.1rem 1.15rem;
  border-radius: 16px;
  border: 1px solid var(--border-soft);
  background:
    radial-gradient(80% 60% at 0% 0%, rgba(201, 162, 39, 0.08), transparent 50%),
    rgba(0, 0, 0, 0.3);
  box-shadow: inset 0 1px 0 rgba(251, 211, 141, 0.06);
}

.el2-matrix-head {
  margin-bottom: 0.85rem;
}

.el2-matrix-scroll {
  width: 100%;
  overflow-x: auto;
  display: block;
  border-radius: 12px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

.el2-matrix {
  width: 100%;
  border-collapse: separate;
  border-spacing: 3px;
  min-width: 540px;
  table-layout: fixed;
}

.el2-matrix th,
.el2-matrix td {
  border: none;
  text-align: center;
  padding: 0.6rem 0.3rem;
  border-radius: 8px;
}

.el2-corner {
  background: rgba(46, 36, 24, 0.95);
  color: var(--gold-dim);
  font-size: 0.72rem;
  width: 5.6rem;
  box-shadow: inset 0 0 0 1px rgba(107, 74, 40, 0.45);
}

.el2-h {
  font-size: 0.78rem;
  font-weight: 700;
  color: currentColor;
  box-shadow: inset 0 0 0 1px rgba(107, 74, 40, 0.35);
}

.el2-h.el2-fire { background: rgba(252, 129, 129, 0.14); }
.el2-h.el2-water { background: rgba(99, 179, 237, 0.14); }
.el2-h.el2-wind { background: rgba(154, 230, 180, 0.14); }
.el2-h.el2-earth { background: rgba(236, 201, 75, 0.14); }
.el2-h.el2-light { background: rgba(250, 240, 137, 0.14); }
.el2-h.el2-dark { background: rgba(183, 148, 244, 0.14); }
.el2-h.el2-neutral { background: rgba(160, 174, 192, 0.12); }

.el2-row {
  text-align: left;
  padding-left: 0.6rem !important;
}

.el2-c {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: rgba(12, 10, 8, 0.62);
  color: #4a5568;
  font-size: 0.98rem;
  transition: transform 0.12s ease, background 0.12s ease;
  box-shadow: inset 0 0 0 1px rgba(107, 74, 40, 0.22);
}

.el2-c.is-strong {
  background: rgba(56, 161, 105, 0.26);
  color: #9ae6b4;
  box-shadow: inset 0 0 0 1px rgba(104, 211, 145, 0.45);
}

.el2-c.is-weak {
  background: rgba(197, 48, 48, 0.16);
  color: #feb2b2;
  box-shadow: inset 0 0 0 1px rgba(252, 129, 129, 0.35);
}

.el2-c.is-immune {
  background: rgba(155, 44, 44, 0.32);
  color: #fc8181;
  box-shadow: inset 0 0 0 1px rgba(197, 48, 48, 0.55);
}

.el2-c.is-flat {
  color: #4a5568;
}

.el2-matrix tbody tr:hover .el2-c.is-flat {
  background: rgba(46, 36, 24, 0.45);
  color: #a0aec0;
}

@keyframes el2-breathe {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.04); filter: brightness(1.08); }
}

@keyframes el2-pulse {
  0%, 100% { opacity: 0.55; transform: scale(0.96); }
  50% { opacity: 1; transform: scale(1.04); }
}

@keyframes el2-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .el2-orb,
  .el2-cycle-glow,
  .el2-duel-line {
    animation: none;
  }
}

/* Elements — tablet */
@media (max-width: 980px) {
  .el2-boards {
    grid-template-columns: 1fr;
  }

  .el2-top {
    flex-direction: column;
  }

  .el2-key {
    width: 100%;
    max-width: 28rem;
  }
}

/* Elements — phone portrait */
@media (max-width: 640px) {
  .el2 {
    gap: 0.85rem;
  }

  .el2-title {
    font-size: 1.15rem;
  }

  .el2-lead {
    font-size: 0.88rem;
  }

  .el2-key {
    max-width: none;
    grid-template-columns: 1fr 1fr;
    gap: 0.35rem;
  }

  .el2-key-chip {
    font-size: 0.74rem;
    padding: 0.35rem 0.45rem;
  }

  .el2-board {
    padding: 0.85rem 0.8rem 0.95rem;
    border-radius: 12px;
  }

  .el2-board-title {
    font-size: 0.98rem;
  }

  .el2-board-sub {
    font-size: 0.78rem;
    margin-bottom: 0.65rem;
  }

  .el2-cycle {
    width: min(260px, 86vw);
  }

  .el2-cycle-core {
    width: 44px;
    height: 44px;
  }

  .el2-cycle-core span {
    font-size: 0.66rem;
  }

  .el2-orb {
    width: 46px;
    height: 46px;
  }

  .el2-duel .el2-orb {
    width: 52px;
    height: 52px;
  }

  .el2-name {
    font-size: 0.78rem;
  }

  .el2-node {
    min-width: 3.8rem;
    gap: 0.28rem;
  }

  .el2-duel {
    min-height: 110px;
    gap: 0.4rem;
  }

  .el2-duel-mid {
    max-width: 6.5rem;
  }

  .el2-duel-badge {
    font-size: 0.66rem;
    padding: 0.22rem 0.4rem;
  }

  .el2-neutral-note {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.55rem;
    padding: 0.7rem;
  }

  .el2-board-foot {
    gap: 0.2rem;
  }

  .el2-foot-chip {
    font-size: 0.7rem;
    padding: 0.14rem 0.38rem;
  }

  .el2-matrix-card {
    padding: 0.85rem 0.7rem;
  }

  .el2-matrix {
    min-width: 460px;
    border-spacing: 2px;
  }

  .el2-matrix th,
  .el2-matrix td {
    padding: 0.45rem 0.18rem;
    font-size: 0.74rem;
  }

  .el2-corner {
    width: 4.4rem;
    font-size: 0.64rem;
  }

  .el2-c {
    font-size: 0.88rem;
  }

  .el2-row {
    padding-left: 0.4rem !important;
  }
}

/* Elements — very small phones */
@media (max-width: 380px) {
  .el2-key {
    grid-template-columns: 1fr;
  }

  .el2-cycle {
    width: min(230px, 92vw);
  }

  .el2-orb {
    width: 40px;
    height: 40px;
  }

  .el2-duel .el2-orb {
    width: 44px;
    height: 44px;
  }

  .el2-glyph {
    transform: scale(0.85);
  }

  .el2-foot-arrow {
    font-size: 0.72rem;
  }
}

/* Elements — phone landscape */
@media (orientation: landscape) and (max-height: 500px) {
  .el2-boards {
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
  }

  .el2-cycle {
    width: min(200px, 42vw);
    margin-top: 0.2rem;
  }

  .el2-orb {
    width: 40px;
    height: 40px;
  }

  .el2-duel {
    min-height: 88px;
    margin-top: 0.25rem;
  }

  .el2-duel .el2-orb {
    width: 44px;
    height: 44px;
  }

  .el2-neutral-note {
    margin-top: 0.55rem;
    padding: 0.45rem 0.55rem;
  }

  .el2-board-foot {
    margin-top: 0.45rem;
  }

  .el2-matrix-card {
    padding: 0.7rem;
  }
}

@media (orientation: landscape) and (max-height: 420px) {
  .el2-boards {
    grid-template-columns: 1fr;
  }
}


.wiki-block {
  padding: 0.95rem;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.28);
  margin-bottom: 0.85rem;
}

.wiki-block h3 {
  margin: 0 0 0.35rem;
  color: var(--gold);
  font-size: 1.05rem;
}

.mul-strong {
  color: var(--ok);
  font-weight: 700;
}

.mul-weak {
  color: var(--danger);
}

.mul-resist {
  color: var(--warn);
}

.quest-list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.quest-list .quest-card {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 0.95rem;
  padding: 0.95rem;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(107, 74, 40, 0.22), transparent 42%),
    rgba(0, 0, 0, 0.28);
  box-shadow: inset 0 1px 0 rgba(251, 211, 141, 0.06);
}

.quest-list .quest-card--story {
  background:
    linear-gradient(135deg, rgba(88, 56, 120, 0.28), transparent 45%),
    rgba(0, 0, 0, 0.28);
}

.quest-portrait {
  width: 112px;
  height: 112px;
  border-radius: 12px;
  border: 1px solid #6b4a28;
  background: linear-gradient(165deg, #2e2418, #14100c);
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
}

.quest-portrait-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}

.quest-portrait-fallback {
  color: var(--gold);
  font-size: 1.6rem;
}

.quest-portrait-seal {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid #c9a227;
  display: grid;
  place-items: center;
  color: #fbd38d;
  font-family: Cinzel, "Times New Roman", serif;
  font-size: 1.35rem;
  background: rgba(201, 162, 39, 0.12);
}

.quest-body {
  min-width: 0;
}

.quest-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.55rem;
  align-items: center;
  margin-bottom: 0.25rem;
}

.quest-order,
.quest-kind,
.quest-giver {
  font-size: 0.78rem;
  color: var(--text-dim);
}

.quest-order {
  color: #fbd38d;
  font-weight: 700;
}

.quest-kind {
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  border: 1px solid rgba(201, 162, 39, 0.35);
  background: rgba(201, 162, 39, 0.1);
  color: #f0d78c;
}

.quest-card--story .quest-kind {
  border-color: rgba(167, 139, 250, 0.4);
  background: rgba(109, 80, 160, 0.22);
  color: #ddd6fe;
}

.quest-title {
  margin: 0 0 0.3rem;
  color: var(--gold);
  font-size: 1.12rem;
  line-height: 1.3;
}

.quest-desc {
  margin: 0 0 0.55rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.quest-faces {
  display: flex;
  gap: 0.35rem;
  margin: 0 0 0.55rem;
}

.quest-face-mini {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid #6b4a28;
  background: #1a1410;
  object-fit: contain;
  image-rendering: pixelated;
}

.quest-objectives {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.quest-obj {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(107, 74, 40, 0.35);
  color: var(--text-muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.quest-obj-face {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid #5a4028;
  background: #16120e;
  object-fit: contain;
  image-rendering: pixelated;
  flex-shrink: 0;
}

.quest-obj-face-mon {
  image-rendering: pixelated;
}

.quest-obj-glyph {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: rgba(201, 162, 39, 0.12);
  border: 1px solid rgba(201, 162, 39, 0.28);
  color: #fbd38d;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.quest-rewards {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.7rem;
}

.quest-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(201, 162, 39, 0.32);
  background: rgba(46, 36, 24, 0.7);
  color: #f0d78c;
  font-size: 0.78rem;
}

.quest-chip-exp {
  border-color: rgba(104, 211, 145, 0.4);
  color: #9ae6b4;
}

.quest-chip-copper {
  border-color: rgba(237, 137, 54, 0.45);
  color: #f6ad55;
}

.quest-chip-item img {
  image-rendering: pixelated;
}

@media (max-width: 720px) {
  .quest-list .quest-card {
    grid-template-columns: 84px minmax(0, 1fr);
    gap: 0.7rem;
    padding: 0.75rem;
  }

  .quest-portrait {
    width: 84px;
    height: 84px;
    border-radius: 10px;
  }

  .quest-title {
    font-size: 1rem;
  }

  .quest-desc {
    font-size: 0.84rem;
  }

  .quest-obj {
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .quest-list .quest-card {
    grid-template-columns: 1fr;
  }

  .quest-portrait {
    width: 96px;
    height: 96px;
    margin: 0 auto;
  }

  .quest-head {
    justify-content: center;
  }

  .quest-title,
  .quest-desc {
    text-align: center;
  }

  .quest-faces {
    justify-content: center;
  }
}

/* โ€”โ€” Guides / systems โ€”โ€” */
.guide-list,
.system-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.guide-card,
.system-card {
  scroll-margin-top: calc(var(--nav-h) + 12px);
}

.guide-card h2,
.system-card h2 {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  color: var(--gold);
}

.guide-card ol {
  margin: 0.5rem 0 0;
  padding-left: 1.2rem;
  color: var(--text-muted);
}

.guide-card li + li {
  margin-top: 0.35rem;
}

.guide-sections {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.guide-section {
  padding-top: 0.85rem;
  border-top: 1px solid rgba(201, 162, 39, 0.25);
}

.guide-section h3 {
  margin: 0 0 0.55rem;
  color: var(--gold);
  font-size: 1rem;
}

.guide-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid rgba(201, 162, 39, 0.2);
  border-radius: 8px;
  -webkit-overflow-scrolling: touch;
}

.guide-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.guide-table th,
.guide-table td {
  padding: 0.55rem 0.65rem;
  text-align: left;
  border-bottom: 1px solid rgba(201, 162, 39, 0.14);
  white-space: nowrap;
}

.guide-table th {
  color: var(--gold);
  background: rgba(201, 162, 39, 0.08);
}

.guide-table tbody tr:last-child td {
  border-bottom: 0;
}

.guide-note {
  margin: 0.55rem 0 0;
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.55;
}

@media (max-width: 640px) {
  .guide-table {
    min-width: 470px;
    font-size: 0.8rem;
  }

  .guide-table th,
  .guide-table td {
    padding: 0.48rem 0.55rem;
  }
}

.system-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.65rem;
}

/* โ€”โ€” Member โ€”โ€” */
body.page-member .site-main,
#member-gate {
  max-width: min(1180px, 100%);
}

.member-user {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  align-items: center;
  margin-bottom: 1rem;
}

.member-user .uname {
  font-weight: 700;
  color: var(--gold);
  font-size: 1.15rem;
}

.char-grid,
.char-grid--slots {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  align-items: stretch;
}

.char-card {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background:
    linear-gradient(145deg, rgba(107, 74, 40, 0.18), transparent 48%),
    rgba(0, 0, 0, 0.32);
  padding: 0.85rem;
  box-shadow: inset 0 1px 0 rgba(251, 211, 141, 0.06);
}

.char-card.is-pending {
  border-color: #c53030;
  background:
    linear-gradient(145deg, rgba(155, 44, 44, 0.28), transparent 50%),
    rgba(0, 0, 0, 0.36);
}

.char-pending-ribbon {
  position: absolute;
  top: 12px;
  right: -28px;
  z-index: 2;
  width: 120px;
  padding: 0.28rem 0;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fff5f5;
  background: #c53030;
  transform: rotate(35deg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.char-card-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.55rem;
  margin-bottom: 0.65rem;
}

.char-portrait {
  width: 104px;
  height: 104px;
  border-radius: 12px;
  border: 1px solid #6b4a28;
  background: linear-gradient(165deg, #2e2418, #14100c);
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
}

.char-portrait img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}

.char-card.is-pending .char-portrait {
  border-color: #9b2c2c;
  filter: grayscale(0.35) brightness(0.88);
}

.char-card-meta {
  min-width: 0;
  width: 100%;
}

.char-name {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  color: var(--gold);
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.char-sub {
  margin: 0 0 0.45rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.char-stat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  justify-content: center;
}

.char-chip {
  display: inline-flex;
  padding: 0.14rem 0.42rem;
  border-radius: 999px;
  border: 1px solid rgba(201, 162, 39, 0.3);
  background: rgba(46, 36, 24, 0.65);
  color: #f0d78c;
  font-size: 0.7rem;
}

.char-pending-banner {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin: 0 0 0.55rem;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  border: 1px solid rgba(197, 48, 48, 0.55);
  background: rgba(155, 44, 44, 0.22);
  color: #feb2b2;
  font-size: 0.78rem;
}

.char-pending-banner strong {
  color: #fc8181;
  font-size: 0.84rem;
}

.char-stats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.2rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0.25rem 0 0.55rem;
}

.char-stats strong {
  color: var(--text);
  font-weight: 600;
}

.char-card .btn-row {
  margin-top: auto;
  padding-top: 0.55rem;
}

.char-card .equip-list {
  max-height: 9.5rem;
  overflow-y: auto;
}

@media (max-width: 900px) {
  .char-grid,
  .char-grid--slots {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.6rem;
  }

  .char-portrait {
    width: 84px;
    height: 84px;
  }

  .char-name {
    font-size: 0.95rem;
  }

  .char-chip {
    font-size: 0.66rem;
  }
}

@media (max-width: 720px) {
  .char-grid,
  .char-grid--slots {
    grid-template-columns: 1fr;
  }

  .char-card-hero {
    flex-direction: row;
    text-align: left;
    align-items: center;
  }

  .char-stat-chips {
    justify-content: flex-start;
  }

  .char-portrait {
    width: 88px;
    height: 88px;
  }

  .char-stats {
    grid-template-columns: 1fr 1fr;
  }
}

.equip-list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.equip-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.2rem 0;
  border-bottom: 1px solid rgba(107, 74, 40, 0.25);
}

.equip-list .slot {
  color: var(--gold-dim);
  min-width: 5.5rem;
}

.empty-state {
  text-align: center;
  padding: 1.5rem 1rem;
  color: var(--text-muted);
}

.loading {
  color: var(--text-dim);
  font-size: 0.95rem;
  padding: 0.5rem 0;
}

/* —— Compact nav: phone + tablet + short landscape —— */
@media (max-width: 980px), (orientation: landscape) and (max-height: 560px) {
  .site-nav .nav-toggle,
  .nav-toggle {
    display: inline-flex !important;
  }

  .site-nav .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    flex-wrap: nowrap;
    gap: 0;
    padding: 0.35rem 0 calc(0.35rem + env(safe-area-inset-bottom));
    background: rgba(20, 16, 12, 0.98);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 16px 28px rgba(0, 0, 0, 0.35);
    max-height: min(70dvh, 420px);
    overflow-y: auto;
    z-index: 120;
  }

  .site-nav .nav-links.is-open {
    display: flex;
  }

  .site-nav .nav-links li {
    border-bottom: 1px solid var(--border-soft);
  }

  .site-nav .nav-links a {
    display: block;
    padding: 0.75rem max(1.25rem, env(safe-area-inset-right)) 0.75rem max(1.25rem, env(safe-area-inset-left));
    border-bottom: none;
  }

  .site-nav .nav-links a::after {
    display: none;
  }
}

/* —— Mobile / tablet stacking —— */
@media (max-width: 820px) {
  .home-grid {
    grid-template-columns: 1fr;
  }

  .site-main {
    padding: 1.15rem max(0.9rem, env(safe-area-inset-right)) max(2.5rem, env(safe-area-inset-bottom)) max(0.9rem, env(safe-area-inset-left));
  }

  .page-title {
    font-size: 1.45rem;
  }

  .hero {
    padding: 1.75rem 0.85rem 1.5rem;
  }

  .hero-brand {
    font-size: clamp(1.45rem, 9vw, 2.4rem);
    letter-spacing: 0.05em;
  }

  .char-stats {
    grid-template-columns: 1fr;
  }
}

@media (orientation: landscape) and (max-height: 560px) {
  :root {
    --nav-h: 52px;
  }

  .site-nav {
    padding: 0 0.85rem;
  }

  .nav-brand-tag {
    display: none;
  }

  .hero {
    padding: 1.25rem 1rem;
  }

  .hero-brand {
    font-size: 1.85rem;
  }

  .site-main {
    padding-top: 0.85rem;
    padding-bottom: 1.5rem;
  }

  .panel {
    padding: 0.85rem 1rem;
  }
}

@media (max-width: 480px) {
  body {
    font-size: 15px;
  }

  .form-stack > .btn,
  .form-stack button.btn {
    width: 100%;
  }

  .btn-row .btn,
  .hero-cta .btn {
    width: auto;
    flex: 1 1 calc(50% - 0.45rem);
    min-width: 0;
  }

  .hero-brand {
    font-size: clamp(1.35rem, 8.4vw, 1.9rem);
    letter-spacing: 0.04em;
  }

  .wiki-grid {
    grid-template-columns: 1fr;
  }

  .page-lead,
  .hero-note {
    font-size: 0.88rem;
  }
}

/* โ€”โ€” Wiki maps: one large row per map โ€”โ€” */
.wiki-map-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

a.wiki-map-row {
  display: grid;
  grid-template-columns: minmax(200px, 320px) 1fr;
  gap: 1rem;
  align-items: stretch;
  padding: 0.85rem;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.28);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}

a.wiki-map-row:hover {
  border-color: var(--gold-mid);
  background: rgba(46, 36, 24, 0.55);
  text-decoration: none;
  color: inherit;
  transform: translateY(-1px);
}

.wiki-map-row-art {
  position: relative;
  min-height: 140px;
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow: hidden;
  background: #0c0a08;
}

.wiki-map-row-art .wiki-thumb {
  width: 100%;
  height: 100%;
  min-height: 140px;
  border: none;
  border-radius: 0;
  object-fit: cover;
  image-rendering: auto;
}

.wiki-map-row-art .wiki-glyph {
  width: 100%;
  height: 140px;
  border: none;
  border-radius: 0;
}

.wiki-map-row-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.35rem;
  min-width: 0;
}

.wiki-map-row-body h3 {
  margin: 0;
  color: var(--gold);
  font-size: 1.15rem;
}

.wiki-map-row-cta {
  margin-top: 0.35rem;
  color: var(--link);
  font-size: 0.9rem;
  font-weight: 600;
}

a.wiki-card-link {
  color: inherit;
  text-decoration: none;
}

a.wiki-card-link:hover {
  text-decoration: none;
  border-color: var(--gold-mid);
}

a.wiki-card-link:hover .wiki-card-title {
  color: #ffe6a8;
}

/* โ€”โ€” Detail pages (map / monster) FreedomRO-style โ€”โ€” */
.detail-panel {
  background: linear-gradient(165deg, rgba(46, 36, 24, 0.94), rgba(20, 16, 12, 0.96));
}

.detail-crumb {
  margin: 0 0 0.75rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.detail-crumb a {
  color: var(--link);
}

.detail-title {
  margin: 0 0 0.35rem;
  color: var(--gold);
  font-size: 1.35rem;
  font-weight: 700;
}

.detail-sub {
  margin: 0 0 1rem;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.map-detail-grid {
  display: grid;
  grid-template-columns: minmax(240px, 360px) 1fr;
  gap: 1.1rem;
  align-items: start;
}

.map-detail-visual {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #0c0a08;
}

.map-detail-visual img,
.map-detail-visual .map-preview-canvas {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  image-rendering: pixelated;
}

.map-detail-visual .map-preview-canvas {
  aspect-ratio: auto;
  image-rendering: pixelated;
  background: #0c0a08;
}

.wiki-map-row-art .map-preview-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
  background: #0c0a08;
}

.wiki-map-row-art .map-preview-canvas.is-ready + .map-preview-fallback,
.wiki-map-row-art .map-preview-fallback[hidden] {
  display: none;
}

.map-detail-side ul {
  margin: 0.35rem 0 0;
  padding-left: 1.2rem;
}

.warp-side {
  color: var(--gold);
  font-weight: 600;
  margin-left: 0.2rem;
}

.mobs-tab {
  display: inline-block;
  margin-bottom: 0.55rem;
  padding: 0.28rem 0.85rem;
  border-radius: 999px;
  background: #2b6cb0;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
}

.db-table-wrap {
  overflow: auto;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
  max-height: min(520px, 70dvh);
}

.db-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.db-table th,
.db-table td {
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid rgba(107, 74, 40, 0.28);
  text-align: left;
  vertical-align: middle;
}

.db-table th {
  position: sticky;
  top: 0;
  background: #241c14;
  color: var(--gold);
  font-weight: 700;
  z-index: 1;
}

.db-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.03);
}

.db-table tbody tr:hover {
  background: rgba(201, 162, 39, 0.08);
}

.db-mob-link {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: #7eb6ff;
  font-weight: 600;
  text-decoration: none;
}

.db-mob-link:hover {
  color: #a8d0ff;
  text-decoration: underline;
}

.db-mob-thumb {
  width: 40px;
  height: 40px;
  object-fit: contain;
  image-rendering: pixelated;
  background: #0c0a08;
  border: 1px solid var(--border-soft);
  border-radius: 4px;
}

.monster-hero {
  display: grid;
  grid-template-columns: 1.2fr minmax(120px, 160px) 1fr;
  gap: 0.85rem;
  margin-bottom: 1.1rem;
}

.monster-stat-box,
.monster-combat-box {
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
  padding: 0.75rem;
}

.monster-stat-box dl,
.monster-combat-box dl {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 0.65rem;
  font-size: 0.88rem;
}

.monster-stat-box dt,
.monster-combat-box dt {
  color: var(--text-dim);
}

.monster-stat-box dd,
.monster-combat-box dd {
  margin: 0;
  color: var(--text);
}

.monster-portrait {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  min-height: 140px;
  padding: 0.75rem;
}

.monster-portrait img {
  width: 96px;
  height: 96px;
  object-fit: contain;
  image-rendering: pixelated;
}

.drop-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
  image-rendering: pixelated;
}

.drop-item-link {
  display: inline-flex;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.drop-item-link:hover,
.drop-item-link:focus-visible {
  color: var(--gold);
  text-decoration: underline;
}

.zone-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.35rem 0 0;
  padding: 0;
  list-style: none;
}

.zone-chips a {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: rgba(0, 0, 0, 0.25);
  color: var(--link);
  font-size: 0.82rem;
}

@media (max-width: 860px) {
  a.wiki-map-row,
  .map-detail-grid,
  .monster-hero {
    grid-template-columns: 1fr;
  }

  .wiki-map-row-art img,
  .wiki-map-row-art .wiki-glyph {
    min-height: 180px;
    height: 180px;
  }

  .map-detail-visual img {
    aspect-ratio: 16 / 10;
  }
}

@media (orientation: landscape) and (max-height: 560px) {
  .wiki-map-row-art img,
  .wiki-map-row-art .wiki-glyph {
    min-height: 120px;
    height: 120px;
  }
}

/* โ€”โ€” Race wiki โ€”โ€” */
.race-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
}

a.race-card {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.85rem;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.28);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

a.race-card:hover {
  border-color: var(--gold-mid);
  background: rgba(46, 36, 24, 0.55);
  text-decoration: none;
  color: inherit;
}

.race-card-art {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  min-height: 140px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.35);
  padding: 0.5rem;
}

.race-card-art img {
  width: 112px;
  height: 112px;
  object-fit: contain;
  image-rendering: pixelated;
}

.race-card-body h3 {
  margin: 0 0 0.25rem;
  color: var(--gold);
  font-size: 1.05rem;
}

.race-detail-hero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  align-items: start;
  margin-bottom: 1rem;
}

.race-portraits {
  display: flex;
  gap: 0.75rem;
}

.race-portraits figure {
  margin: 0;
  text-align: center;
}

.race-portraits img {
  width: 128px;
  height: 128px;
  object-fit: contain;
  image-rendering: pixelated;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
}

.race-portraits figcaption {
  margin-top: 0.35rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.skill-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.skill-card {
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
  padding: 0.75rem 0.85rem;
}

.skill-card-head {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  margin-bottom: 0.45rem;
}

.skill-card-head h3 {
  margin: 0 0 0.2rem;
  color: var(--gold);
  font-size: 1rem;
}

.skill-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
  image-rendering: pixelated;
  flex-shrink: 0;
}

.skill-desc {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.5;
  white-space: normal;
}

@media (max-width: 860px) {
  .race-grid,
  .race-detail-hero {
    grid-template-columns: 1fr;
  }
}

/* —— Wiki / site responsive (desktop → tablet → phone) —— */
@media (max-width: 1100px) {
  .wiki-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  #wiki-root .tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    gap: 0.3rem;
    padding-bottom: 0.55rem;
    margin-bottom: 0.85rem;
  }

  #wiki-root .tab-btn {
    flex: 0 0 auto;
    white-space: nowrap;
    font-size: 0.88rem;
    padding: 0.38rem 0.7rem;
  }

  .wiki-toolbar {
    gap: 0.5rem;
  }

  .wiki-toolbar .field {
    max-width: none;
    min-width: 0;
    width: 100%;
  }

  .enhance-table table,
  .element-table table {
    min-width: 420px;
  }

  .wiki-block {
    padding: 0.8rem;
  }
}

@media (max-width: 640px) {
  .nav-toggle {
    display: inline-flex !important;
  }

  .nav-links:not(.is-open) {
    display: none !important;
  }

  .hero-brand {
    font-size: 1.4rem !important;
    letter-spacing: 0.03em;
  }

  #guide-toc,
  .system-links {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  #guide-toc .btn,
  .system-links .btn {
    width: 100%;
    justify-content: flex-start;
  }

  .wiki-grid {
    grid-template-columns: 1fr;
  }

  .wiki-card {
    min-height: 0;
    padding: 0.65rem;
  }

  .wiki-thumb,
  .wiki-glyph {
    width: 56px;
    height: 56px;
  }

  .wiki-pager {
    gap: 0.28rem;
  }

  .wiki-pager-btn {
    min-width: 2rem;
    height: 2rem;
    font-size: 0.82rem;
  }

  .quest-list .quest-card {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 0.55rem;
    padding: 0.7rem;
  }

  .quest-portrait {
    width: 72px;
    height: 72px;
  }

  .quest-title {
    font-size: 0.98rem;
  }

  .quest-desc,
  .quest-obj {
    font-size: 0.8rem;
  }

  .char-grid,
  .char-grid--slots {
    grid-template-columns: 1fr;
  }

  a.wiki-map-row {
    grid-template-columns: 1fr;
    padding: 0.7rem;
  }

  .panel {
    padding: 0.85rem 0.75rem;
  }

  .page-lead {
    font-size: 0.9rem;
  }
}

@media (max-width: 420px) {
  #wiki-root .tab-btn {
    font-size: 0.82rem;
    padding: 0.32rem 0.55rem;
  }

  .quest-list .quest-card {
    grid-template-columns: 1fr;
  }

  .quest-portrait {
    width: 88px;
    height: 88px;
    margin: 0 auto;
  }

  .quest-head,
  .quest-faces {
    justify-content: center;
  }

  .quest-title,
  .quest-desc {
    text-align: center;
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  #wiki-root .tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    margin-bottom: 0.55rem;
    padding-bottom: 0.4rem;
  }

  .wiki-toolbar {
    margin-bottom: 0.55rem;
  }

  .quest-list .quest-card {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .char-grid--slots {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.45rem;
  }

  .char-portrait {
    width: 72px;
    height: 72px;
  }

  .race-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.55rem;
  }
}

@media (orientation: landscape) and (max-height: 500px) and (max-width: 740px) {
  .char-grid--slots,
  .race-grid {
    grid-template-columns: 1fr;
  }
}

/* —— Visual polish — keep layout, add gold glow / hover / motion —— */

.site-main {
  animation: site-enter 0.55s var(--ease-out) both;
}

.wiki-card,
a.wiki-map-row,
.quest-list .quest-card,
a.race-card,
.skill-card,
.guide-card,
.system-card,
.char-card,
.news-item {
  animation: site-enter 0.42s var(--ease-out) both;
}

.wiki-card:nth-child(1),
a.wiki-map-row:nth-child(1),
.quest-list .quest-card:nth-child(1) { animation-delay: 0.02s; }
.wiki-card:nth-child(2),
a.wiki-map-row:nth-child(2),
.quest-list .quest-card:nth-child(2) { animation-delay: 0.05s; }
.wiki-card:nth-child(3),
a.wiki-map-row:nth-child(3),
.quest-list .quest-card:nth-child(3) { animation-delay: 0.08s; }
.wiki-card:nth-child(4),
a.wiki-map-row:nth-child(4),
.quest-list .quest-card:nth-child(4) { animation-delay: 0.11s; }
.wiki-card:nth-child(5),
a.wiki-map-row:nth-child(5) { animation-delay: 0.14s; }
.wiki-card:nth-child(6),
a.wiki-map-row:nth-child(6) { animation-delay: 0.17s; }

@media (hover: hover) and (pointer: fine) {
  .wiki-card:hover,
  a.wiki-card-link:hover {
    border-color: var(--gold-mid);
    background: rgba(46, 36, 24, 0.55);
    box-shadow: var(--glow-gold), var(--inset-gold);
    transform: translateY(-2px);
  }

  a.wiki-map-row:hover {
    box-shadow: var(--glow-gold);
    transform: translateY(-2px);
  }

  a.race-card:hover,
  .skill-card:hover,
  .char-card:hover,
  .quest-list .quest-card:hover {
    border-color: var(--gold-mid);
    box-shadow: var(--glow-gold);
    transform: translateY(-2px);
  }

  .guide-card:hover,
  .system-card:hover {
    border-color: rgba(201, 162, 39, 0.55);
    box-shadow: var(--shadow), var(--glow-gold);
  }

  .social-list a:hover {
    transform: translateY(-1px);
  }

  .wiki-pager-btn:hover:not(:disabled) {
    box-shadow: var(--glow-gold);
  }

  .db-table tbody tr:hover {
    background: rgba(201, 162, 39, 0.12);
  }

  .zone-chips a:hover {
    border-color: var(--gold-mid);
    color: var(--gold);
    box-shadow: 0 0 12px rgba(201, 162, 39, 0.18);
    text-decoration: none;
  }
}

a.race-card,
.skill-card,
.char-card,
.quest-list .quest-card,
.guide-card,
.system-card {
  transition: border-color 0.18s var(--ease-out), box-shadow 0.18s, transform 0.18s, background 0.18s;
}

.wiki-thumb,
.wiki-glyph,
.monster-portrait,
.race-card-art,
.char-portrait,
.quest-portrait,
.race-portraits img {
  box-shadow: inset 0 0 0 1px rgba(251, 211, 141, 0.08);
}

.mobs-tab {
  box-shadow: 0 0 14px rgba(43, 108, 176, 0.35);
}

.monster-portrait {
  background:
    radial-gradient(circle at 50% 20%, rgba(201, 162, 39, 0.16), transparent 60%),
    rgba(0, 0, 0, 0.35);
}

.race-card-art,
.char-portrait,
.quest-portrait {
  background:
    radial-gradient(circle at 50% 80%, rgba(201, 162, 39, 0.14), transparent 55%),
    rgba(0, 0, 0, 0.35);
}

.detail-title,
.el2-title,
.wiki-card-title,
.news-title,
.char-name,
.quest-title {
  text-shadow: 0 0 16px rgba(201, 162, 39, 0.16);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--gold-mid);
  box-shadow:
    0 0 0 2px rgba(201, 162, 39, 0.22),
    0 0 18px rgba(201, 162, 39, 0.12);
}

@keyframes site-enter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes hero-glow {
  0%, 100% { opacity: 0.7; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-8px); }
}

@keyframes hero-spark {
  0% { transform: translateY(0); opacity: 0.45; }
  50% { opacity: 0.85; }
  100% { transform: translateY(-12px); opacity: 0.45; }
}

@keyframes status-pulse {
  0%, 100% { box-shadow: 0 0 8px rgba(104, 211, 145, 0.55); }
  50% { box-shadow: 0 0 14px rgba(104, 211, 145, 0.95); }
}

@keyframes sparkle-haze {
  0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.5; }
  50% { transform: translate(-1.4%, 1.1%) scale(1.04); opacity: 0.9; }
}

@keyframes sparkle-shimmer {
  0% { background-position: 100% 0%; opacity: 0.35; }
  50% { background-position: 0% 100%; opacity: 0.8; }
  100% { background-position: 100% 0%; opacity: 0.35; }
}

@media (prefers-reduced-motion: reduce) {
  .site-sparkles {
    display: none !important;
  }

  .site-main,
  .wiki-card,
  a.wiki-map-row,
  .quest-list .quest-card,
  a.race-card,
  .skill-card,
  .guide-card,
  .system-card,
  .char-card,
  .news-item,
  .hero::before,
  .hero::after,
  .status-dot.is-online,
  .btn::after {
    animation: none !important;
    transition: none !important;
  }

  .wiki-card:hover,
  a.wiki-card-link:hover,
  a.wiki-map-row:hover,
  a.race-card:hover,
  .skill-card:hover,
  .char-card:hover,
  .quest-list .quest-card:hover {
    transform: none;
  }
}

/* —— Responsive lock: never spill past the screen —— */
img,
canvas,
svg,
video {
  max-width: 100%;
}

.page-title,
.page-lead,
.hero-brand,
.hero-note,
.wiki-card-title,
.wiki-card-meta,
.wiki-card-desc,
.detail-title,
.detail-sub,
.guide-card h2,
.system-card h2,
.section-title {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.system-links,
#guide-toc,
.btn-row,
.hero-cta {
  max-width: 100%;
}

.system-links .btn,
#guide-toc .btn {
  white-space: normal;
  line-height: 1.3;
  height: auto;
  min-height: 2.2rem;
  text-align: center;
}

.panel,
.wiki-card,
.detail-panel,
.form-stack,
.wiki-toolbar .field,
.wiki-toolbar .field input {
  max-width: 100%;
}

.wiki-card,
a.wiki-map-row,
.quest-list .quest-card,
.skill-card,
.char-card {
  min-width: 0;
}

.map-detail-visual,
.map-detail-visual img,
.map-preview-canvas,
.wiki-map-row-art,
.monster-portrait,
.race-card-art,
.race-portraits img {
  max-width: 100%;
}

.db-table-wrap,
.enhance-table,
.element-table {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tabs {
  max-width: 100%;
}

.wiki-pager {
  max-width: 100%;
}

@media (max-width: 640px) {
  .wiki-map-row-art .map-preview-canvas,
  .wiki-map-row-art img,
  .wiki-map-row-art .wiki-glyph {
    min-height: 140px;
    height: 140px;
  }

  .race-portraits {
    flex-wrap: wrap;
    justify-content: center;
  }

  .race-portraits img {
    width: 96px;
    height: 96px;
  }

  .monster-hero,
  .map-detail-grid {
    grid-template-columns: 1fr;
  }

  .status-row {
    gap: 0.45rem 0.75rem;
  }
}

@media (max-width: 360px) {
  .hero-cta .btn {
    flex: 1 1 100%;
  }

  .nav-brand-tag {
    display: none;
  }
}

@media (orientation: landscape) and (max-height: 560px) {
  .home-grid {
    grid-template-columns: 1.2fr 1fr;
  }

  .hero {
    padding: 1rem 0.85rem 0.85rem;
    margin-bottom: 0.85rem;
  }

  .site-footer {
    padding: 0.75rem 1rem;
  }
}

@media (orientation: landscape) and (max-height: 560px) and (max-width: 820px) {
  .home-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (orientation: landscape) and (max-height: 430px) {
  .home-grid {
    grid-template-columns: 1fr;
  }

  .hero-note {
    display: none;
  }
}
