/* ------------------------------------------------------------------
   楓情報 · Maple preview skin. Only active when <html data-ui="maple">.
   Look: Henesys daytime sky, wooden signboards, parchment game windows,
   inventory tabs and slots, and the classic v83 status bar.
------------------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@600;800&family=Chiron+GoRound+TC:wght@400;600;800;900&display=swap');

html[data-ui=maple] {
  --mx-ink: #4a2c16;
  --mx-ink-soft: #7a5a3c;
  --mx-paper: #fff9ea;
  --mx-paper-2: #f6ead0;
  --mx-rim: #c28f52;
  --mx-rim-dark: #8c5a2b;
  --mx-wood-1: #b97a3f;
  --mx-wood-2: #9a602c;
  --mx-wood-3: #6f3f18;
  --mx-orange: #ff9a1f;
  --mx-orange-2: #f06a13;
  --mx-gold: #ffd54a;
  --mx-leaf: #58a83a;
  --mx-blue: #3a6fbf;
  --mx-navy: #1f2d4b;
  --mx-sky-1: #7fcaf5;
  --mx-sky-2: #d6f1ff;
  --mx-page: #f5eedb;
  --mx-slot: #efe2c4;
  --mx-slot-edge: #b99664;
  --mx-hover: #fff2b8;
  --mx-font: 'Chiron GoRound TC', 'Microsoft JhengHei', system-ui, sans-serif;
  --mx-num: 'Baloo 2', 'Chiron GoRound TC', sans-serif;
  /* Rounded arrow cursor with a chunky outline, gold when something is clickable. */
  --mx-cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='30' viewBox='0 0 28 30'%3E%3Cpath d='M4 3.5 4.6 23.2c0 1 1.2 1.5 1.9.8l4.4-4.3 3.4 7.2c.4.8 1.3 1.1 2.1.7l2.3-1.1c.8-.4 1.1-1.3.7-2.1l-3.4-7.1 6.1-.4c1-.1 1.4-1.3.7-2L6.5 2.4C5.5 1.5 4 2.2 4 3.5Z' fill='%23fff' stroke='%23233455' stroke-width='2.2' stroke-linejoin='round'/%3E%3Cpath d='M7 6.5v11' stroke='%23c9d6ea' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") 4 3, auto;
  --mx-cursor-hand: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='30' viewBox='0 0 28 30'%3E%3Cpath d='M4 3.5 4.6 23.2c0 1 1.2 1.5 1.9.8l4.4-4.3 3.4 7.2c.4.8 1.3 1.1 2.1.7l2.3-1.1c.8-.4 1.1-1.3.7-2.1l-3.4-7.1 6.1-.4c1-.1 1.4-1.3.7-2L6.5 2.4C5.5 1.5 4 2.2 4 3.5Z' fill='%23ffd54a' stroke='%236f3f18' stroke-width='2.2' stroke-linejoin='round'/%3E%3Cpath d='M7 6.5v11' stroke='%23fff3b0' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") 4 3, pointer;
}
html[data-ui=maple][data-theme=dark] {
  --mx-ink: #f3ead6;
  --mx-ink-soft: #c2b59b;
  --mx-paper: #26314f;
  --mx-paper-2: #1f2944;
  --mx-rim: #5d6f9c;
  --mx-rim-dark: #3b4a73;
  --mx-wood-1: #5b3d27;
  --mx-wood-2: #45301f;
  --mx-wood-3: #2a1c11;
  --mx-sky-1: #0c1633;
  --mx-sky-2: #2b3d72;
  --mx-page: #141c33;
  --mx-slot: #1b2440;
  --mx-slot-edge: #4d5f8c;
  --mx-hover: #33406a;
}

html[data-ui=maple] body { cursor: var(--mx-cursor); background: var(--mx-page); }
html[data-ui=maple] :is(a, button, select, summary, label[for], [role=button]) { cursor: var(--mx-cursor-hand); }
html[data-ui=maple] input { cursor: text; }
html[data-ui=maple] :is(input[type=checkbox], input[type=radio], label:has(> input[type=checkbox]), label:has(> input[type=radio])) { cursor: var(--mx-cursor-hand); }

/* ---------- Page ---------- */
html[data-ui=maple] .encyclopedia {
  font-family: var(--mx-font);
  color: var(--mx-ink);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cpath d='M30 18l3 7 6-3-2 7 7 1-6 4 4 5-7-1-1 7-4-6-4 6-1-7-7 1 4-5-6-4 7-1-2-7 6 3z' fill='%23d9b77a' opacity='.16'/%3E%3Cpath d='M90 78l2 5 4-2-1 5 5 1-4 3 3 3-5-1-1 5-3-4-3 4-1-5-5 1 3-3-4-3 5-1-1-5 4 2z' fill='%23d9b77a' opacity='.12'/%3E%3C/svg%3E"),
    linear-gradient(180deg, #e8f5fb 0, var(--mx-page) 520px);
}
html[data-ui=maple][data-theme=dark] .encyclopedia {
  background:
    radial-gradient(1px 1px at 20% 30%, #fff8 50%, transparent 51%) 0 0 / 180px 140px,
    radial-gradient(1px 1px at 70% 60%, #fff6 50%, transparent 51%) 0 0 / 230px 170px,
    linear-gradient(180deg, #16224a 0, var(--mx-page) 520px);
}
html[data-ui=maple] .encyclopedia :is(h1, h2, h3, h4) { font-family: var(--mx-font); font-weight: 900; color: var(--mx-ink); }
html[data-ui=maple] .encyclopedia p { color: var(--mx-ink-soft); }
html[data-ui=maple] ::selection { background: var(--mx-gold); color: #3b2410; }

/* ---------- Top bar: a wooden plank with game buttons ---------- */
html[data-ui=maple] header.topbar {
  position: relative;
  font-family: var(--mx-font);
  background:
    repeating-linear-gradient(90deg, transparent 0 180px, #0000001a 180px 182px, transparent 182px 360px),
    repeating-linear-gradient(0deg, #ffffff10 0 2px, transparent 2px 7px),
    linear-gradient(180deg, var(--mx-wood-1), var(--mx-wood-2));
  border-bottom: 0;
  box-shadow: inset 0 2px 0 #ffffff40, inset 0 -3px 0 var(--mx-wood-3), 0 4px 0 #00000026;
  min-height: 76px;
  z-index: 5;
}
html[data-ui=maple] header.topbar::after {
  /* nails */
  content: '';
  position: absolute;
  inset: 8px 14px auto;
  height: 6px;
  background: radial-gradient(circle, #f1d7a6 0 2px, #6f3f18 2.5px 3px, transparent 3.5px) left / 6px 6px no-repeat,
              radial-gradient(circle, #f1d7a6 0 2px, #6f3f18 2.5px 3px, transparent 3.5px) right / 6px 6px no-repeat;
  pointer-events: none;
}
html[data-ui=maple] header.topbar .brand {
  font-family: var(--mx-font);
  font-weight: 900;
  font-size: 23px;
  color: #fff;
  letter-spacing: .06em;
  -webkit-text-stroke: 5px #5a2f0e;
  paint-order: stroke fill;
  text-shadow: 0 3px 0 #3d1f08;
}
html[data-ui=maple] header.topbar .brand-icon {
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--mx-gold), 0 0 0 5px #6f3f18, 0 3px 0 5px #3d1f08;
  transition: transform .3s cubic-bezier(.3, 1.8, .5, 1);
}
html[data-ui=maple] header.topbar .brand:hover .brand-icon { transform: rotate(-12deg) scale(1.08); }
/* Two rows: brand + buttons on the plank, then every destination on a shelf below. */
html[data-ui=maple] header.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "brand actions" "nav nav";
  align-items: center;
  row-gap: 12px;
  padding-top: 12px;
  padding-bottom: 0;
}
html[data-ui=maple] header.topbar .topbar-left { display: contents; }
html[data-ui=maple] header.topbar .brand { grid-area: brand; }
html[data-ui=maple] header.topbar .topbar-actions { grid-area: actions; margin: 0; width: auto; flex-wrap: nowrap; }
html[data-ui=maple] header.topbar .mode-tabs {
  grid-area: nav;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 0;
  padding: 10px 12px 12px !important;
  /* full-bleed shelf without widening the page */
  border-image: linear-gradient(#0000002e, #00000014) fill 0 / 0 / 0 100vw;
  border-top: 2px solid #5a2f0e;
}
html[data-ui=maple] header.topbar .mode-tab { padding: 8px 13px; font-size: 14px; min-height: 40px; }
html[data-ui=maple] header.topbar :is(.mode-tab, .theme-toggle) {
  font-family: var(--mx-font);
  font-weight: 800;
  color: #5a3515;
  background: linear-gradient(180deg, #fff8e3, #f3dcae);
  border: 2px solid #7a4a1f;
  border-radius: 12px;
  box-shadow: inset 0 2px 0 #fff, inset 0 -3px 0 #e2c28a, 0 3px 0 #5a2f0e;
  transition: transform .08s, box-shadow .08s, filter .15s;
  min-height: 42px;
}
html[data-ui=maple] header.topbar :is(.mode-tab, .theme-toggle):hover { filter: brightness(1.06); transform: translateY(-2px); box-shadow: inset 0 2px 0 #fff, inset 0 -3px 0 #e2c28a, 0 5px 0 #5a2f0e; }
html[data-ui=maple] header.topbar :is(.mode-tab, .theme-toggle):active { transform: translateY(3px); box-shadow: inset 0 2px 0 #fff, inset 0 -1px 0 #e2c28a, 0 0 0 #5a2f0e; }
html[data-ui=maple] header.topbar .mode-tab.is-active {
  color: #fff;
  background: linear-gradient(180deg, #ffc15a, var(--mx-orange) 55%, var(--mx-orange-2));
  border-color: #8a3a06;
  box-shadow: inset 0 2px 0 #ffe3a6, inset 0 -3px 0 #c9500c, 0 3px 0 #5a2206;
  -webkit-text-stroke: 3px #8a3a06;
  paint-order: stroke fill;
}
html[data-ui=maple] header.topbar .discord-contact { color: #fff; -webkit-text-stroke: 4px #3c3f8f; paint-order: stroke fill; }
html[data-ui=maple][data-theme=dark] header.topbar :is(.mode-tab:not(.is-active), .theme-toggle) { color: #f3ead6; background: linear-gradient(180deg, #3c4a78, #2b365c); border-color: #151c33; box-shadow: inset 0 2px 0 #5d6f9c, inset 0 -3px 0 #232c4c, 0 3px 0 #0b0f1d; }

/* ---------- Hero stage ---------- */
.mx-stage {
  --pan: 0;
  position: relative;
  height: 430px;
  overflow: hidden;
  overflow: clip;
  isolation: isolate;
  background: linear-gradient(180deg, var(--mx-sky-1), var(--mx-sky-2) 70%);
  border-bottom: 6px solid #7a4a1f;
  box-shadow: 0 -6px 0 #a7d86a inset;
  user-select: none;
  -webkit-user-select: none;
}
.mx-stage-loading { background: linear-gradient(180deg, #7fcaf5, #d6f1ff); }
.mx-sky { position: absolute; inset: 0; z-index: -1; }
.mx-cloud {
  position: absolute;
  width: 190px;
  height: 56px;
  border-radius: 60px;
  background: #fff;
  opacity: .92;
  box-shadow: 40px -22px 0 6px #fff, 95px -8px 0 0 #fff, 0 8px 0 #dcefff;
  animation: mx-drift linear infinite;
}
.mx-cloud.c1 { top: 40px; animation-duration: 95s; animation-delay: -20s; }
.mx-cloud.c2 { top: 110px; transform: scale(.7); animation-duration: 140s; animation-delay: -80s; opacity: .8; }
.mx-cloud.c3 { top: 24px; transform: scale(.55); animation-duration: 120s; animation-delay: -50s; opacity: .7; }
.mx-cloud.c4 { top: 150px; transform: scale(.9); animation-duration: 170s; animation-delay: -130s; opacity: .6; }
@keyframes mx-drift { from { left: -260px; } to { left: 110%; } }
.mx-stars { position: absolute; inset: 0; opacity: 0; transition: opacity .6s; background:
  radial-gradient(1.5px 1.5px at 12% 20%, #fff 50%, transparent 52%), radial-gradient(1px 1px at 32% 12%, #fff 50%, transparent 52%),
  radial-gradient(2px 2px at 58% 26%, #fff6c2 50%, transparent 52%), radial-gradient(1px 1px at 76% 8%, #fff 50%, transparent 52%),
  radial-gradient(1.5px 1.5px at 88% 30%, #fff 50%, transparent 52%), radial-gradient(1px 1px at 46% 40%, #fff 50%, transparent 52%);
  animation: mx-twinkle 4s ease-in-out infinite alternate; }
@keyframes mx-twinkle { to { filter: brightness(.5); } }
html[data-theme=dark] .mx-stars { opacity: 1; }
html[data-theme=dark] .mx-cloud { opacity: .18 !important; }
.mx-layer {
  position: absolute;
  inset: auto -80px 0;
  height: 100%;
  background-repeat: repeat-x;
  background-position: left bottom;
  background-size: auto 100%;
  pointer-events: none;
  transition: transform .5s cubic-bezier(.2, .8, .3, 1);
}
.mx-far { height: 80%; bottom: 14%; transform: translateX(calc(var(--pan) * 12px)); opacity: .9; }
.mx-mid { height: 90%; transform: translateX(calc(var(--pan) * 26px)); }
.mx-near { height: 96%; bottom: -2%; transform: translateX(calc(var(--pan) * 48px)); }
html[data-theme=dark] .mx-layer { filter: brightness(.45) saturate(.75) hue-rotate(15deg); }
html[data-theme=dark] .mx-near { filter: brightness(.55) saturate(.8) hue-rotate(10deg); }

.mx-stage-content { position: absolute; inset: 0; z-index: 3; pointer-events: none; display: flex; align-items: flex-start; padding: 34px max(28px, calc((100vw - 1320px) / 2)); }
.mx-stage-content > * { pointer-events: auto; }

/* Hanging wooden signboard */
.mx-sign {
  position: relative;
  padding: 22px 30px 20px;
  border-radius: 16px;
  background:
    repeating-linear-gradient(0deg, #ffffff12 0 3px, transparent 3px 11px),
    linear-gradient(180deg, #c8894a, #a8672f);
  border: 3px solid #5a2f0e;
  box-shadow: inset 0 3px 0 #e8b27a, inset 0 -5px 0 #7d461b, 0 8px 0 #0000002e;
  transform-origin: 50% -30px;
  animation: mx-swing 6s ease-in-out infinite;
}
.mx-sign::before, .mx-sign::after {
  content: '';
  position: absolute;
  top: -40px;
  width: 4px;
  height: 42px;
  background: repeating-linear-gradient(180deg, #8b6a3e 0 4px, #6b4d28 4px 8px);
}
.mx-sign::before { left: 34px; }
.mx-sign::after { right: 34px; }
@keyframes mx-swing { 0%, 100% { transform: rotate(-1.2deg); } 50% { transform: rotate(1.2deg); } }
.mx-sign p { margin: 0; }
.mx-sign .mx-sign-kicker { font-size: 13px; font-weight: 800; letter-spacing: .12em; color: #ffe7b8; }
.mx-sign .mx-sign-title { display: flex; gap: 2px; margin: 4px 0 6px; }
.mx-sign .mx-sign-title span {
  display: inline-block;
  font-family: var(--mx-font);
  font-size: 68px;
  line-height: 1.05;
  font-weight: 900;
  color: #fff;
  background: linear-gradient(180deg, #fffbe0 0 40%, #ffd23f 60%, #ff9d1c);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  -webkit-text-stroke: 0;
  filter: drop-shadow(0 0 0 #5a2f0e) drop-shadow(2px 0 0 #5a2f0e) drop-shadow(-2px 0 0 #5a2f0e) drop-shadow(0 2px 0 #5a2f0e) drop-shadow(0 -2px 0 #5a2f0e) drop-shadow(0 5px 0 #3d1f08);
  transition: transform .25s cubic-bezier(.3, 1.9, .5, 1);
  animation: mx-bob 2.6s ease-in-out infinite;
}
.mx-sign .mx-sign-title span:nth-child(2) { animation-delay: .18s; }
.mx-sign .mx-sign-title span:nth-child(3) { animation-delay: .36s; }
.mx-sign .mx-sign-title span:hover { transform: translateY(-10px) rotate(-6deg) scale(1.08); }
@keyframes mx-bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -4px; } }
.mx-sign .mx-sign-sub { display: inline-block; color: #fff6dc; font-weight: 800; font-size: 15px; letter-spacing: .04em; background: #5a2f0e; padding: 5px 12px; border-radius: 99px; box-shadow: inset 0 2px 0 #00000040; }

.mx-leaves { position: absolute; inset: 0; z-index: 4; pointer-events: none; overflow: clip; }
.mx-leaf {
  position: absolute;
  top: -40px;
  padding: 0;
  border: 0;
  pointer-events: auto;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cpath d='M20 2l3.2 7.6 5.6-3.4-1.4 8.4 8-1.8-4 6.2 6 2.6-7.6 3 2.4 6.4-7.6-2.4L20 38l-4.6-9.4-7.6 2.4 2.4-6.4-7.6-3 6-2.6-4-6.2 8 1.8-1.4-8.4 5.6 3.4z' fill='%23f36b1c' stroke='%23a3370a' stroke-width='1.6' stroke-linejoin='round'/%3E%3Cpath d='M20 12v24M20 22l-6-5M20 22l6-5' stroke='%23a3370a' stroke-width='1.3' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  animation: mx-fall linear infinite;
  opacity: .95;
}
.mx-leaf:hover { scale: 1.3; }
@keyframes mx-fall {
  0% { transform: translate(0, 0) rotate(0); }
  25% { transform: translate(40px, 120px) rotate(90deg); }
  50% { transform: translate(-10px, 240px) rotate(200deg); }
  75% { transform: translate(35px, 360px) rotate(290deg); }
  100% { transform: translate(0, 480px) rotate(380deg); }
}

.mx-ground { position: absolute; left: 0; right: 0; bottom: 34px; height: 1px; z-index: 5; }
/* Page stylesheets style every <button>; monsters, leaves and coins must stay bare sprites. */
:is(.mx-mob, .mx-leaf, .mx-coin) {
  min-width: 0 !important;
  min-height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 0;
  background-color: transparent !important;
  box-shadow: none !important;
  outline-offset: 2px;
  font: inherit;
  color: inherit;
  -webkit-text-stroke: 0 !important;
}
.mx-mob {
  position: absolute;
  left: 0;
  bottom: 0;
  background: none !important;
  transform: translateX(var(--x));
  width: calc(var(--fw) * var(--s, 1));
  height: calc(var(--fh) * var(--s, 1));
}
.mx-mob-sprite {
  position: absolute;
  left: 50%;
  bottom: calc(var(--foot, 0px) * var(--s, 1) * -1);
  width: var(--fw);
  height: var(--fh);
  margin-left: calc(var(--fw) / -2);
  background-repeat: no-repeat;
  background-size: auto 100%;
  transform-origin: 50% 100%;
  transform: scale(calc(var(--s, 1) * var(--flip, 1)), var(--s, 1));
  animation: mx-frames var(--dur) steps(var(--frames)) infinite;
  image-rendering: auto;
  pointer-events: none;
}
@keyframes mx-frames { from { background-position-x: 0; } to { background-position-x: calc(var(--fw) * var(--frames) * -1); } }
.mx-mob.is-idle .mx-mob-sprite { animation-play-state: paused; }
.mx-mob:hover .mx-mob-sprite { filter: drop-shadow(0 0 3px #fff) drop-shadow(0 0 5px #ffe066); }
.mx-mob.is-hit .mx-mob-sprite { animation: mx-hit .38s linear; filter: brightness(1.8) saturate(.4); }
@keyframes mx-hit { 0%, 100% { translate: 0; } 25% { translate: 4px; } 50% { translate: -3px; } 75% { translate: 2px; } }
.mx-mob.is-die, .mx-mob.is-leave { pointer-events: none; }
.mx-mob.is-die .mx-mob-sprite { animation: mx-die .9s ease-out forwards; }
@keyframes mx-die { to { opacity: 0; translate: 0 -18px; filter: brightness(2.5) blur(1px); } }
.mx-mob.is-leave .mx-mob-sprite { animation: mx-leave .7s ease-in forwards; }
@keyframes mx-leave { to { opacity: 0; filter: blur(2px); } }
.mx-mob.is-spawn .mx-mob-sprite { animation: mx-frames var(--dur) steps(var(--frames)) infinite, mx-spawn .6s ease-out; }
@keyframes mx-spawn { from { opacity: 0; filter: brightness(3); } }
.mx-mob-tag {
  position: absolute;
  top: calc(100% + 4px);
  left: 50%;
  translate: -50% 0;
  white-space: nowrap;
  font: 700 11px/1 var(--mx-font);
  color: #fff;
  background: #000000a8;
  padding: 3px 6px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity .15s;
}
.mx-mob:hover .mx-mob-tag, .mx-mob:focus-visible .mx-mob-tag { opacity: 1; }
.mx-mob-hp { position: absolute; bottom: calc(100% + 6px); left: 50%; translate: -50% 0; width: 46px; height: 7px; background: #2b2b2b; border: 1px solid #000; border-radius: 2px; }
.mx-mob-hp i { display: block; height: 100%; background: linear-gradient(180deg, #ff8d8d, #e11d1d); transition: width .2s; }
html.mx-embedded body { padding-bottom: 0 !important; }
@keyframes mx-spin { to { rotate: 360deg; } }
.mx-stage-hint {
  position: absolute;
  z-index: 6;
  left: 50%;
  bottom: 6px;
  translate: -50% 0;
  margin: 0;
  font: 700 12px/1 var(--mx-font);
  color: #fff;
  background: #00000055;
  padding: 5px 10px;
  border-radius: 99px;
  white-space: nowrap;
}
.mx-stage-hint kbd { font: inherit; background: #fff; color: #333; border-radius: 3px; padding: 0 4px; }

/* ---------- Search as the chat bar ---------- */
html[data-ui=maple] .ec-heading {
  gap: 20px;
}
html[data-ui=maple] .ec-heading .ec-eyebrow { color: var(--mx-orange-2); font-weight: 800; letter-spacing: .1em; }
html[data-ui=maple] .ec-heading h1 { font-size: 30px; }
html[data-ui=maple] .ec-global-search {
  background: #fff;
  border: 3px solid #3b4d74;
  border-radius: 14px;
  box-shadow: inset 0 3px 0 #dfe8f7, 0 4px 0 #22304f;
  padding: 6px 14px;
}
html[data-ui=maple] .ec-global-search svg { color: #3b4d74; }
html[data-ui=maple] .ec-global-search input { font-family: var(--mx-font); font-weight: 600; color: #22304f; font-size: 16px; }
html[data-ui=maple] .ec-global-search:focus-within { outline: 0; border-color: var(--mx-orange-2); box-shadow: 0 0 0 4px #ffd54a88, 0 4px 0 #8a3a06; }
html[data-ui=maple][data-theme=dark] .ec-global-search { background: #0f1630; border-color: #6c80b8; box-shadow: inset 0 3px 0 #000, 0 4px 0 #0a0f22; }
html[data-ui=maple][data-theme=dark] .ec-global-search input { color: #f3ead6; }
html[data-ui=maple] .ec-notice {
  font-weight: 700;
  color: #3c5a19;
  background: #eaf7d4;
  border: 2px dashed #8cbf52;
  border-left-width: 2px;
  border-radius: 10px;
}
html[data-ui=maple][data-theme=dark] .encyclopedia .ec-notice { color: #cfeaa8; background: #1f3320; border-color: #4f7a35; }

/* ---------- Game windows ---------- */
html[data-ui=maple] :is(.ec-player-hub, .ec-list, .ec-detail, .ec-empty, .reference-intro, .site-help) {
  background: var(--mx-paper);
  border: 3px solid var(--mx-rim-dark);
  border-radius: 14px;
  box-shadow: inset 0 0 0 3px var(--mx-paper-2), inset 0 0 0 5px #e7cf9f, 0 6px 0 #00000022;
  color: var(--mx-ink);
}
html[data-ui=maple][data-theme=dark] :is(.ec-player-hub, .ec-list, .ec-detail, .ec-empty, .reference-intro, .site-help) { box-shadow: inset 0 0 0 3px var(--mx-paper-2), inset 0 0 0 5px #3a4a78, 0 6px 0 #0006; }
html[data-ui=maple] .ec-player-hub { padding: 0 18px 18px; overflow: hidden; }
html[data-ui=maple] .ec-hub-heading {
  margin: 0 -18px 16px;
  padding: 10px 18px;
  background: linear-gradient(180deg, #ffc15a, var(--mx-orange) 60%, var(--mx-orange-2));
  border-bottom: 3px solid #8a3a06;
}
html[data-ui=maple] .ec-hub-heading h2 { color: #fff !important; -webkit-text-stroke: 4px #8a3a06; paint-order: stroke fill; font-size: 20px; margin: 0; }
html[data-ui=maple] .ec-hub-heading button, html[data-ui=maple] .mx-btn {
  font: 800 13px/1 var(--mx-font);
  color: #5a3515;
  background: linear-gradient(180deg, #fffbe9, #f1d9a6);
  border: 2px solid #7a4a1f;
  border-radius: 9px;
  padding: 7px 10px;
  box-shadow: 0 3px 0 #5a2f0e;
}
html[data-ui=maple] .ec-hub-heading button:active, html[data-ui=maple] .mx-btn:active { transform: translateY(3px); box-shadow: none; }

/* Quest-scroll cards */
html[data-ui=maple] .ec-player-card {
  position: relative;
  background: linear-gradient(180deg, #fffdf4, #f7ebcd);
  border: 2px solid var(--mx-rim);
  border-radius: 12px;
  box-shadow: 0 4px 0 #c49a5e;
  transition: transform .2s cubic-bezier(.3, 1.8, .5, 1), box-shadow .2s;
  color: var(--mx-ink);
}
html[data-ui=maple] .ec-player-card:hover { transform: translateY(-5px) rotate(-.6deg); box-shadow: 0 9px 0 #c49a5e; border-color: var(--mx-orange-2); }
html[data-ui=maple] .ec-player-card:nth-child(even):hover { transform: translateY(-5px) rotate(.6deg); }
html[data-ui=maple] .ec-player-card strong { font-weight: 900; }
html[data-ui=maple] .ec-player-icon {
  background: radial-gradient(circle at 35% 30%, #fff6c9, var(--mx-gold) 55%, #d59a16) !important;
  color: #7a4a06 !important;
  border-radius: 50% !important;
  box-shadow: 0 0 0 2px #a8700c, 0 3px 0 2px #7a4a06;
}
html[data-ui=maple] .ec-player-card:hover .ec-player-icon { animation: mx-coin-spin .6s ease-in-out; }
@keyframes mx-coin-spin { 50% { transform: scaleX(-1); } }
html[data-ui=maple][data-theme=dark] .ec-player-card { background: linear-gradient(180deg, #2c3960, #222c4c); box-shadow: 0 4px 0 #0b0f1d; }
html[data-ui=maple][data-theme=dark] .ec-player-card:hover { box-shadow: 0 9px 0 #0b0f1d; }

/* ---------- Inventory tabs ---------- */
html[data-ui=maple] .ec-categories { gap: 4px; margin: 30px 0 0; padding: 8px 10px 0; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; position: relative; z-index: 1; }
html[data-ui=maple] .ec-categories::-webkit-scrollbar { display: none; }
html[data-ui=maple] .ec-categories button {
  font-family: var(--mx-font);
  font-weight: 800;
  font-size: 14px;
  color: #6b4a2a;
  padding: 7px 12px 9px;
  background: linear-gradient(180deg, #e7cf9f, #d4b37a);
  border: 3px solid var(--mx-rim-dark);
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
  translate: 0 4px;
  transition: translate .15s, background .15s;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  white-space: nowrap;
}
html[data-ui=maple] .ec-categories button:hover { translate: 0 0; background: linear-gradient(180deg, #f5e3bb, #e1c38d); }
html[data-ui=maple] .ec-categories button.active {
  color: var(--mx-ink);
  background: var(--mx-paper);
  translate: 0 3px;
  padding-bottom: 12px;
  box-shadow: inset 0 3px 0 #fff;
}
html[data-ui=maple] .ec-categories button span {
  font-family: var(--mx-num);
  font-size: 11px;
  opacity: 1;
  color: #fff;
  background: #7a4a1f;
  border-radius: 99px;
  padding: 1px 6px;
  line-height: 1.4;
}
html[data-ui=maple] .ec-categories button.active span { background: var(--mx-orange-2); }
html[data-ui=maple] .mx-tab-icon { width: 26px; height: 26px; object-fit: contain; transition: transform .25s cubic-bezier(.3, 2, .5, 1); }
html[data-ui=maple] .ec-categories button:hover .mx-tab-icon { transform: translateY(-3px) rotate(-10deg) scale(1.15); }
html[data-ui=maple] .ec-categories button.active .mx-tab-icon { animation: mx-bob 1.4s ease-in-out infinite; }
html[data-ui=maple][data-theme=dark] .ec-categories button { color: #d9ceb6; background: linear-gradient(180deg, #33406a, #283357); }
html[data-ui=maple][data-theme=dark] .ec-categories button.active { color: #fff; background: var(--mx-paper); box-shadow: inset 0 3px 0 #3d4c7c; }

html[data-ui=maple] .ec-compact-filter {
  margin: 0;
  padding: 16px;
  background: var(--mx-paper);
  border: 3px solid var(--mx-rim-dark);
  border-radius: 0 14px 0 0;
  border-bottom: 0;
}
html[data-ui=maple] .ec-compact-filter label { font-weight: 800; color: var(--mx-ink-soft); font-size: 14px; }
html[data-ui=maple] .ec-compact-filter select {
  font-family: var(--mx-font);
  font-weight: 700;
  color: var(--mx-ink);
  background: #fff;
  border: 2px solid var(--mx-slot-edge);
  border-radius: 9px;
  box-shadow: inset 0 2px 0 #f1e4c6;
}
html[data-ui=maple][data-theme=dark] .ec-compact-filter select { background: #0f1630; }
html[data-ui=maple] .ec-compact-filter > button {
  font-family: var(--mx-font);
  font-weight: 800;
  border: 2px solid #3f7a22;
  border-radius: 9px;
  color: #2e5a16;
  background: linear-gradient(180deg, #eafbd8, #bde59a);
  box-shadow: 0 3px 0 #3f7a22;
}
html[data-ui=maple] .ec-compact-filter > button[aria-pressed=true] { color: #fff; background: linear-gradient(180deg, #8fd95a, var(--mx-leaf)); -webkit-text-stroke: 3px #2e5a16; paint-order: stroke fill; }
html[data-ui=maple] .ec-compact-filter + .ec-notice, html[data-ui=maple] .ec-compact-filter + .ec-result-heading {
  margin: 0;
  border-radius: 0;
  border-left: 3px solid var(--mx-rim-dark);
  border-right: 3px solid var(--mx-rim-dark);
}
html[data-ui=maple] .ec-result-heading { margin: 0; padding: 4px 16px 12px; background: var(--mx-paper); border-left: 3px solid var(--mx-rim-dark); border-right: 3px solid var(--mx-rim-dark); }
html[data-ui=maple] .ec-result-heading h2 { font-size: 18px; }
html[data-ui=maple] .ec-result-heading span { font-family: var(--mx-num); font-weight: 800; color: var(--mx-orange-2); }
html[data-ui=maple] .ec-list { border-top: 0; border-radius: 0 0 14px 14px; }

/* Result rows as inventory slots */
html[data-ui=maple] .ec-list table { font-family: var(--mx-font); }
html[data-ui=maple] .ec-list th { background: var(--mx-paper-2); color: var(--mx-ink-soft); font-weight: 800; border-bottom: 2px dashed #d8bd8a; }
html[data-ui=maple] .ec-list td { border-bottom: 1px dashed #e2cfa6; }
html[data-ui=maple] .ec-list tbody tr:nth-child(even) { background: #fdf3dc66; }
html[data-ui=maple] .ec-list tbody tr { transition: background .12s; }
html[data-ui=maple] .ec-list tbody tr:hover { background: var(--mx-hover); }
html[data-ui=maple][data-theme=dark] .ec-list :is(th, td) { border-color: #3a4a78; }
html[data-ui=maple][data-theme=dark] .ec-list tbody tr:nth-child(even) { background: #ffffff06; }
html[data-ui=maple] .ec-image-cell {
  width: 60px;
  height: 60px;
  border-radius: 10px;
  background: radial-gradient(circle at 50% 40%, #fffdf4, var(--mx-slot));
  border: 2px solid var(--mx-slot-edge);
  box-shadow: inset 0 3px 4px #0000001a, inset 0 -2px 0 #fff8;
}
html[data-ui=maple] .ec-image-cell img { width: 50px; height: 50px; transition: transform .25s cubic-bezier(.3, 1.9, .5, 1); }
html[data-ui=maple] .ec-list tbody tr:hover .ec-image-cell { border-color: var(--mx-orange); box-shadow: 0 0 0 3px #ffd54a88, inset 0 3px 4px #0000001a; }
html[data-ui=maple] .ec-list tbody tr:hover .ec-image-cell img { transform: scale(1.18) rotate(-4deg); }
html[data-ui=maple] .encyclopedia .ec-list .ec-name-link { font-weight: 800; color: var(--mx-ink) !important; }
html[data-ui=maple] .encyclopedia .ec-list tbody tr:hover .ec-name-link { color: var(--mx-orange-2) !important; }
html[data-ui=maple] .ec-tag { font-weight: 700; background: #fff; border: 1.5px solid var(--mx-slot-edge); color: var(--mx-ink-soft); border-radius: 99px; }
html[data-ui=maple][data-theme=dark] .ec-tag { background: #0f1630; }
html[data-ui=maple] .ec-list-category { font-weight: 800; color: var(--mx-blue); }
html[data-ui=maple][data-theme=dark] .ec-list-category { color: #8fb4ff; }

/* Pagination as game buttons */
html[data-ui=maple] .ec-pagination { font-family: var(--mx-font); font-weight: 700; margin-top: 18px; }
html[data-ui=maple] .ec-pagination button {
  font-family: var(--mx-num);
  font-weight: 800;
  color: #5a3515;
  background: linear-gradient(180deg, #fffbe9, #f1d9a6);
  border: 2px solid #7a4a1f;
  border-radius: 9px;
  box-shadow: 0 3px 0 #5a2f0e;
}
html[data-ui=maple] .ec-pagination button:active:not(:disabled) { transform: translateY(3px); box-shadow: none; }
html[data-ui=maple] .ec-pagination button[aria-current=page], html[data-ui=maple] .ec-pagination button[aria-pressed=true] {
  color: #fff;
  background: linear-gradient(180deg, #ffc15a, var(--mx-orange-2));
  border-color: #8a3a06;
  -webkit-text-stroke: 3px #8a3a06;
  paint-order: stroke fill;
}
html[data-ui=maple] .ec-pagination input { border: 2px solid var(--mx-slot-edge); border-radius: 9px; background: #fff; }

/* ---------- Detail page: item-info window ---------- */
html[data-ui=maple] .ec-detail { position: relative; }
html[data-ui=maple] .ec-detail-image {
  background: radial-gradient(circle at 50% 40%, #fffdf4, var(--mx-slot));
  border: 3px solid var(--mx-slot-edge);
  border-radius: 14px;
  box-shadow: inset 0 4px 6px #0000001a;
}
html[data-ui=maple] .ec-detail-image:not(.ec-map-image) {
  float: left;
  display: grid;
  place-items: center;
  width: 150px;
  height: 150px;
  margin: 14px 22px 10px 0;
}
html[data-ui=maple] .ec-detail-image:not(.ec-map-image) img { width: auto; height: auto; max-width: 110px; max-height: 110px; min-width: 64px; object-fit: contain; image-rendering: auto; animation: mx-bob 2.4s ease-in-out infinite; }
html[data-ui=maple] .ec-detail-image:not(.ec-map-image) ~ h2 { margin-top: 22px; font-size: 30px; }
html[data-ui=maple] .ec-detail > dl, html[data-ui=maple] .ec-detail > section, html[data-ui=maple] .ec-detail > footer { clear: both; }
html[data-ui=maple] .ec-detail dl { background: var(--mx-paper-2); border: 2px dashed #d8bd8a; }
html[data-ui=maple] .ec-detail dl div { border-color: #e2cfa6; }
html[data-ui=maple] .ec-detail dt { font-weight: 800; color: var(--mx-ink-soft); }
html[data-ui=maple] .ec-detail h3 {
  display: inline-block;
  padding: 4px 16px 5px 14px;
  color: #fff !important;
  background: linear-gradient(180deg, #ffc15a, var(--mx-orange-2));
  border: 2px solid #8a3a06;
  border-radius: 8px 20px 20px 8px;
  -webkit-text-stroke: 3px #8a3a06;
  paint-order: stroke fill;
  font-size: 16px !important;
}
html[data-ui=maple] .ec-back { display: inline-flex; flex-direction: row; align-items: center; gap: 6px; font-family: var(--mx-font); font-weight: 800; border: 2px solid #7a4a1f; border-radius: 10px; box-shadow: 0 3px 0 #5a2f0e; background: linear-gradient(180deg, #fffbe9, #f1d9a6); color: #5a3515; }
html[data-ui=maple] :is(.ec-loot-card, .ec-quest-card) {
  font-family: var(--mx-font);
  background: #fff;
  border: 2px solid var(--mx-slot-edge);
  border-radius: 12px;
  box-shadow: 0 3px 0 #d6b98a;
  transition: transform .18s cubic-bezier(.3, 1.8, .5, 1), box-shadow .18s;
  color: var(--mx-ink);
}
html[data-ui=maple] :is(.ec-loot-card, .ec-quest-card):hover { transform: translateY(-3px); box-shadow: 0 6px 0 #d6b98a; border-color: var(--mx-orange); }
html[data-ui=maple][data-theme=dark] .encyclopedia :is(.ec-loot-card, .ec-quest-card) { background: #1b2440; box-shadow: 0 3px 0 #0b0f1d; }

/* Stat chips on detail pages */
html[data-ui=maple] .ec-monster-stats > div { background: #fff !important; border: 2px solid var(--mx-slot-edge) !important; border-radius: 99px !important; box-shadow: 0 2px 0 #d6b98a; }
html[data-ui=maple] .ec-monster-stats dt { color: var(--mx-orange-2) !important; font-weight: 800; }
html[data-ui=maple] .ec-text-facts > div { background: var(--mx-paper-2) !important; border: 1.5px dashed #d8bd8a; }
html[data-ui=maple] .ec-monster-section { border-top: 2px dashed #d8bd8a !important; }
html[data-ui=maple][data-theme=dark] :is(.ec-list tr:nth-child(even), .ec-list tr:nth-child(odd)) { background: transparent; color: var(--mx-ink); }
html[data-ui=maple][data-theme=dark] .ec-list tbody tr:hover { background: var(--mx-hover); }
html[data-ui=maple][data-theme=dark] :is(.ec-monster-stats > div, .ec-text-facts > div) { background: #1b2440 !important; color: var(--mx-ink); border-color: #4d5f8c !important; }
html[data-ui=maple][data-theme=dark] :is(.ec-loot-card, .ec-notice) { color: var(--mx-ink); }
html[data-ui=maple][data-theme=dark] .ec-original-intro { color: #e6d6b8 !important; }
html[data-ui=maple][data-theme=dark] .encyclopedia :is(h1, h2, h3, .ec-loot-name) { color: var(--mx-ink); }

/* ---------- Sidebar as a notice board ---------- */
html[data-ui=maple] .ec-original {
  font-family: var(--mx-font);
  padding: 20px 16px 18px !important;
  background:
    radial-gradient(#0000000d 1px, transparent 1.5px) 0 0 / 7px 7px,
    linear-gradient(180deg, #d6a86a, #c4924f);
  border: 10px solid transparent;
  border-image: repeating-linear-gradient(90deg, #7a4a1f 0 14px, #6a3d17 14px 28px) 10;
  box-shadow: 0 6px 0 #00000026;
  color: #3d2410;
}
html[data-ui=maple][data-theme=dark] .ec-original { background: radial-gradient(#0000002a 1px, transparent 1.5px) 0 0 / 7px 7px, linear-gradient(180deg, #5b4330, #4a3524); color: #f3ead6; }
html[data-ui=maple] .ec-original h2 { color: #fff !important; -webkit-text-stroke: 5px #5a2f0e; paint-order: stroke fill; font-size: 26px; }
html[data-ui=maple] .ec-original-kicker { color: #fff3d6 !important; font-weight: 800; }
html[data-ui=maple] .ec-original-intro { color: #4a2c16 !important; font-weight: 700; }
html[data-ui=maple][data-theme=dark] .ec-original-intro { color: #e6d6b8 !important; }
html[data-ui=maple] .encyclopedia .ec-original-all { color: #fff; background: #5a2f0e; padding: 4px 10px; border-radius: 99px; display: inline-block; }
html[data-ui=maple] .ec-original-feature, html[data-ui=maple] .ec-original nav a, html[data-ui=maple] .ec-orbis-preview {
  position: relative;
  display: block;
  background: #fffdf2 !important;
  color: #3d2410 !important;
  border: 0 !important;
  border-radius: 3px !important;
  box-shadow: 0 4px 8px #0000002e;
  padding: 18px 14px 14px !important;
  margin: 14px 0 !important;
  rotate: -1.2deg;
  transition: rotate .2s, transform .2s;
}
html[data-ui=maple] .ec-original nav a:nth-child(even) { rotate: 1.1deg; background: #fff6d6 !important; }
html[data-ui=maple] .ec-original nav a:nth-child(3n) { rotate: -.4deg; background: #eef8ff !important; }
html[data-ui=maple] .ec-original-feature::before, html[data-ui=maple] .ec-original nav a::before, html[data-ui=maple] .ec-orbis-preview::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  width: 14px;
  height: 14px;
  translate: -50% 0;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ff8a8a, #d4231d 60%, #8a0f0b);
  box-shadow: 0 2px 2px #0005;
}
html[data-ui=maple] .ec-original nav a:nth-child(3n+2)::before { background: radial-gradient(circle at 35% 35%, #a5d4ff, #2c6fd4 60%, #163c7a); }
html[data-ui=maple] .ec-original nav a:nth-child(3n)::before { background: radial-gradient(circle at 35% 35%, #fff2a3, #e2b50e 60%, #8a6a05); }
html[data-ui=maple] :is(.ec-original-feature, .ec-original nav a, .ec-orbis-preview):hover { rotate: 0deg; transform: translateY(-3px) scale(1.02); }
html[data-ui=maple] .ec-original :is(h3, p, span, small, b, strong) { color: inherit !important; }
html[data-ui=maple] .ec-original-feature svg { color: var(--mx-orange-2) !important; }
html[data-ui=maple] .ec-original-note { color: #4a2c16 !important; font-size: 12px; }
html[data-ui=maple][data-theme=dark] .ec-original-note { color: #d8c8a8 !important; }

/* ---------- Floating HUD (v83 status bar) ---------- */
.mx-hud {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 7px max(14px, calc((100vw - 1320px) / 2));
  font-family: var(--mx-font);
  color: #fff;
  background: linear-gradient(180deg, #3d4f78 0, #25324f 45%, #1a2338);
  border-top: 2px solid #c9a24a;
  box-shadow: 0 -1px 0 #000, inset 0 1px 0 #ffffff33, 0 -6px 18px #0000004d;
}
.mx-hud-id { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.mx-lv {
  font-family: var(--mx-num);
  font-weight: 800;
  font-size: 28px;
  line-height: 1;
  color: var(--mx-gold);
  -webkit-text-stroke: 5px #3b2200;
  paint-order: stroke fill;
}
.mx-lv small { font-size: 13px; margin-right: 2px; color: #ffe9a3; }
.mx-name { display: grid; line-height: 1.2; }
.mx-name strong { font-size: 14px; }
.mx-name small { font-size: 11px; color: #b9c6e4; }
.mx-hud-bars { flex: 1; display: grid; grid-template-columns: 1fr 1fr 1.6fr; gap: 8px; min-width: 0; }
.mx-bar { display: flex; align-items: center; gap: 5px; min-width: 0; }
.mx-bar b { font: 800 12px/1 var(--mx-num); color: #ffe9a3; -webkit-text-stroke: 3px #000; paint-order: stroke fill; }
.mx-bar-track { position: relative; flex: 1; height: 14px; border-radius: 3px; background: #0c111f; border: 1px solid #000; box-shadow: inset 0 1px 0 #ffffff1a, 0 0 0 1px #6b7ba3; overflow: hidden; }
.mx-bar-track i { position: absolute; inset: 0 auto 0 0; transition: width .35s cubic-bezier(.2, .8, .3, 1); }
.mx-bar-hp .mx-bar-track i { background: linear-gradient(180deg, #ffb3b3, #ff3b3b 45%, #b50f0f); }
.mx-bar-mp .mx-bar-track i { background: linear-gradient(180deg, #b3dcff, #3b8bff 45%, #1650b5); }
.mx-bar-exp .mx-bar-track i { background: linear-gradient(180deg, #f6ffb3, #d9e83b 45%, #8ea80f); }
.mx-bar small { position: absolute; font: 700 11px/1 var(--mx-num); }
.mx-bar { position: relative; }
.mx-bar small { left: 28px; right: 0; text-align: center; top: 50%; translate: 0 -45%; color: #fff; -webkit-text-stroke: 3px #000; paint-order: stroke fill; pointer-events: none; white-space: nowrap; }
.mx-hud-meso { display: flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 8px; background: #0c111f99; border: 1px solid #6b7ba3; font: 800 14px/1 var(--mx-num); color: #ffe9a3; flex-shrink: 0; }
.mx-meso-icon, .mx-coin { display: inline-block; width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff6c9, #ffd54a 45%, #c98d0c 80%); box-shadow: inset 0 0 0 2px #a8700c, 0 1px 0 #5a3a00; }
.mx-quickslot { display: flex; gap: 4px; flex-shrink: 0; }
.mx-quickslot button {
  position: relative;
  width: 40px;
  height: 40px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: linear-gradient(180deg, #56688f, #34426a);
  border: 1px solid #000;
  box-shadow: inset 0 1px 0 #ffffff40, inset 0 0 0 2px #1e2842;
}
.mx-quickslot button:hover { background: linear-gradient(180deg, #7688b0, #45558a); }
.mx-quickslot button:active, .mx-quickslot .is-cooling { filter: brightness(.6); transform: translateY(1px); }
.mx-quickslot img { width: 30px; height: 30px; object-fit: contain; }
.mx-quickslot kbd { position: absolute; left: 2px; top: 1px; font: 800 10px/1 var(--mx-num); color: #fff; -webkit-text-stroke: 2px #000; paint-order: stroke fill; }
.mx-hud-menu { position: relative; flex-shrink: 0; }
.mx-menu-btn { font: 800 13px/1 var(--mx-font); color: #3b2200; background: linear-gradient(180deg, #ffe38a, #f1b52a); border: 1px solid #5a3a00; border-radius: 8px; padding: 9px 12px; box-shadow: inset 0 1px 0 #fff8, 0 2px 0 #000; }
.mx-menu-pop { position: absolute; right: 0; bottom: calc(100% + 10px); display: grid; min-width: 160px; background: #1f2d4bf2; border: 1px solid #8fa2c2; border-radius: 8px; padding: 6px; box-shadow: 0 8px 20px #0008; }
.mx-menu-pop :is(button, a) { text-align: left; font: 700 13px/1.2 var(--mx-font); color: #fff; background: none; border: 0; padding: 9px 10px; border-radius: 5px; text-decoration: none; }
.mx-menu-pop :is(button, a):hover { background: #ffffff1f; color: var(--mx-gold); }
.mx-hud-reopen { position: fixed; left: 12px; bottom: 12px; z-index: 60; font: 800 22px/1 var(--mx-num); color: var(--mx-gold); -webkit-text-stroke: 4px #3b2200; paint-order: stroke fill; background: linear-gradient(180deg, #3d4f78, #1a2338); border: 2px solid #c9a24a; border-radius: 12px; padding: 8px 12px; }
.mx-hud-reopen span { font-size: 12px; }

/* ---------- NPC guide ---------- */
.mx-npc { position: fixed; right: 18px; bottom: 70px; z-index: 55; display: grid; justify-items: center; font-family: var(--mx-font); }
.mx-npc-body { position: relative; padding: 0; border: 0; background: none; display: grid; justify-items: center; }
.mx-npc-body img { max-height: 120px; max-width: 110px; object-fit: contain; filter: drop-shadow(0 4px 0 #0002); transition: transform .2s; }
.mx-npc-body:hover img { transform: translateY(-4px); filter: drop-shadow(0 0 4px #fff) drop-shadow(0 0 6px #ffe066); }
.mx-npc-name { margin-top: 2px; font: 800 12px/1 var(--mx-font); color: #ffea7a; background: #000000b8; padding: 4px 8px; border-radius: 4px; }
.mx-balloon {
  position: relative;
  max-width: 220px;
  margin-bottom: 10px;
  padding: 9px 12px;
  font: 700 13px/1.5 var(--mx-font);
  text-align: left;
  color: #222;
  background: #fff;
  border: 2px solid #444;
  border-radius: 10px;
  box-shadow: 0 3px 0 #0003;
  animation: mx-pop .35s cubic-bezier(.3, 1.8, .5, 1);
}
.mx-balloon::after { content: ''; position: absolute; left: 50%; bottom: -9px; translate: -50% 0; border: 8px solid transparent; border-top-color: #444; border-bottom: 0; }
.mx-balloon::before { content: ''; position: absolute; left: 50%; bottom: -6px; translate: -50% 0; border: 7px solid transparent; border-top-color: #fff; border-bottom: 0; z-index: 1; }
@keyframes mx-pop { from { transform: scale(.6); opacity: 0; } }
.mx-npc-tools { display: flex; gap: 4px; margin-top: 4px; opacity: 0; transition: opacity .2s; }
.mx-npc:hover .mx-npc-tools, .mx-npc:focus-within .mx-npc-tools { opacity: 1; }
.mx-npc-tools button { font: 700 11px/1 var(--mx-font); color: #fff; background: #1f2d4bd9; border: 1px solid #8fa2c2; border-radius: 5px; padding: 4px 7px; }
.mx-npc-return { position: fixed; right: 12px; bottom: 72px; z-index: 55; width: 52px; height: 52px; border-radius: 50%; border: 3px solid #c9a24a; background: #fff; overflow: hidden; padding: 0; box-shadow: 0 3px 0 #0004; }
.mx-npc-return img { width: 100%; height: 100%; object-fit: cover; object-position: top; }

.mx-dialog-backdrop { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; background: #0005; padding: 16px; animation: mx-fade .2s; }
@keyframes mx-fade { from { opacity: 0; } }
.mx-dialog {
  position: static;
  margin: 0;
  padding: 0;
  width: min(560px, 100%);
  display: grid;
  grid-template-columns: 130px 1fr;
  grid-template-rows: 1fr auto;
  font-family: var(--mx-font);
  background: #fff;
  border: 3px solid #7e8aa3;
  border-radius: 10px;
  box-shadow: inset 0 0 0 2px #e6ebf3, 0 0 0 2px #333b4d, 0 16px 40px #0007;
  overflow: hidden;
  animation: mx-pop .3s cubic-bezier(.3, 1.6, .5, 1);
}
.mx-dialog-portrait { display: grid; align-content: end; justify-items: center; padding: 18px 8px 12px; background: linear-gradient(180deg, #f3f6fb, #dfe6f1); border-right: 2px solid #c3cbda; }
.mx-dialog-portrait img { max-width: 110px; max-height: 150px; object-fit: contain; }
.mx-dialog-portrait span { margin-top: 8px; font: 800 12px/1 var(--mx-font); color: #ffea7a; background: #000000c0; padding: 4px 8px; border-radius: 4px; }
.mx-dialog-text { padding: 18px 20px 10px; color: #222; }
.mx-dialog-text p { margin: 0 0 12px; font-size: 15px; line-height: 1.7; color: #222 !important; }
.mx-dialog-text p small { display: block; color: #8a5a1c; font-weight: 800; font-size: 12px; }
.mx-dialog-text ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.mx-dialog-text li button { width: 100%; text-align: left; font: 700 14px/1.4 var(--mx-font); color: #2b56b8; background: none; border: 0; padding: 5px 8px 5px 24px; border-radius: 5px; position: relative; }
.mx-dialog-text li button::before { content: ''; position: absolute; left: 8px; top: 50%; translate: 0 -50%; width: 8px; height: 8px; border-radius: 50%; background: #2b56b8; }
.mx-dialog-text li button:hover { background: #e7efff; color: #d4520c; }
.mx-dialog-text li button:hover::before { background: #d4520c; }
.mx-dialog-actions { grid-column: 1 / -1; display: flex; justify-content: space-between; padding: 10px 14px; background: #eef1f6; border-top: 2px solid #c3cbda; }
.mx-dialog-actions .mx-btn { font: 800 13px/1 var(--mx-font); color: #5a3515; background: linear-gradient(180deg, #fffbe9, #f1d9a6); border: 2px solid #7a4a1f; border-radius: 9px; padding: 8px 12px; box-shadow: 0 3px 0 #5a2f0e; }
.mx-dialog .mx-dialog-actions .mx-btn.mx-btn-end { color: #fff; background: linear-gradient(180deg, #ff9a8a, #d8412c); border-color: #7a1a0e; box-shadow: 0 3px 0 #5a0f06; }

/* ---------- Tooltip ---------- */
.mx-tip {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 90;
  width: max-content;
  max-width: 290px;
  padding: 10px 12px;
  font-family: var(--mx-font);
  color: #fff;
  background: #12182cec;
  border: 1px solid #8fa2c2;
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px #000, 0 8px 18px #0006;
  pointer-events: none;
  opacity: 0;
  transition: opacity .1s;
}
.mx-tip.is-on { opacity: 1; }
.mx-tip strong { display: block; text-align: center; font-size: 15px; font-weight: 900; color: #fff; }
.mx-tip em { display: block; text-align: center; font-style: normal; font-size: 12px; color: #ffb54a; margin: 2px 0 6px; }
.mx-tip .mx-tip-row { display: flex; gap: 10px; align-items: flex-start; border-top: 1px dashed #4b5a7e; padding-top: 8px; }
.mx-tip-frame { flex-shrink: 0; width: 56px; height: 56px; display: grid; place-items: center; border-radius: 8px; background: #fff; box-shadow: inset 0 0 0 2px #c3cbda; }
.mx-tip-frame img { max-width: 48px; max-height: 48px; object-fit: contain; }
.mx-tip p { margin: 0; font-size: 12px; line-height: 1.6; color: #dfe6f5; white-space: pre-line; }

/* ---------- Effects layer ---------- */
.mx-fx { position: fixed; inset: 0; z-index: 70; pointer-events: none; overflow: hidden; }
.mx-dmg { position: absolute; translate: -50% -100%; display: flex; animation: mx-rise 1.25s ease-out forwards; white-space: nowrap; }
.mx-dmg span {
  display: inline-block;
  margin: 0 -1px;
  font: 800 30px/1 var(--mx-num);
  color: #ffc53d;
  -webkit-text-stroke: 6px #53230a;
  paint-order: stroke fill;
  text-shadow: 0 2px 0 #2b1004;
  animation: mx-digit .32s cubic-bezier(.3, 2.2, .5, 1) backwards;
}
.mx-dmg-crit span { font-size: 38px; color: #ff6a4d; -webkit-text-stroke: 6px #4a0a2e; }
.mx-dmg-crit::before { content: ''; position: absolute; left: -26px; top: 50%; width: 30px; height: 30px; translate: 0 -50%; background: radial-gradient(circle, #fff 0 20%, #ffd54a 21% 38%, transparent 40%); animation: mx-spin 1s linear infinite; }
.mx-dmg-hurt span { color: #c98cff; -webkit-text-stroke: 6px #2b0a4a; font-size: 26px; }
.mx-dmg-heal span { color: #8cf25a; -webkit-text-stroke: 6px #1d4a0a; font-size: 24px; }
.mx-dmg-mp span { color: #6cc8ff; -webkit-text-stroke: 6px #0a2a4a; font-size: 24px; }
.mx-dmg-miss span { color: #d8e2f5; -webkit-text-stroke: 5px #2b3550; font-size: 22px; }
@keyframes mx-digit { from { transform: scale(2.2) translateY(-8px); opacity: 0; } }
@keyframes mx-rise { 0%, 55% { transform: translateY(0); opacity: 1; } 100% { transform: translateY(-46px); opacity: 0; } }
.mx-spark { position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; animation: mx-spark .65s ease-out forwards; }
.mx-spark-gold { background: radial-gradient(#fff, #ffd54a 60%, transparent 70%); }
.mx-spark-leaf { background: radial-gradient(#fff, #ff8a2b 60%, transparent 70%); }
.mx-spark-blue { background: radial-gradient(#fff, #7fd8ff 60%, transparent 70%); }
@keyframes mx-spark { to { transform: translate(var(--dx), var(--dy)) scale(.2); opacity: 0; } }

.mx-coin {
  position: fixed;
  z-index: 65;
  padding: 0;
  border: 0;
  width: 22px;
  height: 22px;
  animation: mx-coin-drop .7s cubic-bezier(.3, .1, .6, 1) forwards, mx-coin-turn 1.1s linear .7s infinite;
}
.mx-coin-bronze { background: radial-gradient(circle at 35% 30%, #ffe0c2, #d98a4a 45%, #8f4b16 80%); box-shadow: inset 0 0 0 2px #7a3d0e, 0 1px 0 #3b1a04; }
.mx-coin-silver { background: radial-gradient(circle at 35% 30%, #fff, #cfd8e3 45%, #7d8a9c 80%); box-shadow: inset 0 0 0 2px #5a6474, 0 1px 0 #2b3038; }
.mx-coin-gold { width: 24px; height: 24px; }
.mx-coin-bag { width: 30px; height: 28px; border-radius: 40% 40% 45% 45%; background: radial-gradient(circle at 40% 60%, #ffe7a3, #e8b02a 50%, #9a6a08 85%); box-shadow: inset 0 0 0 2px #7a4f06, 0 2px 0 #3b2200; }
.mx-coin-bag::after { content: '$'; position: absolute; inset: 0; display: grid; place-items: center; font: 800 14px/1 var(--mx-num); color: #7a4f06; }
@keyframes mx-coin-drop {
  0% { transform: translate(0, 0); }
  45% { transform: translate(calc(var(--drift) * .5), -70px); }
  100% { transform: translate(var(--drift), var(--fall)); }
}
@keyframes mx-coin-turn { 0%, 100% { scale: 1 1; } 50% { scale: .2 1; } }
.mx-coin.is-taken { animation: mx-coin-take .5s cubic-bezier(.5, 0, .7, .4) forwards; }
@keyframes mx-coin-take { from { transform: translate(var(--drift), var(--fall)); } to { transform: translate(calc(var(--drift) + var(--tx, 0px)), calc(var(--fall) + var(--ty, 300px))) scale(.5); opacity: .4; } }

.mx-levelup { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; }
.mx-levelup-beam { position: absolute; left: 50%; top: 0; bottom: 0; width: 180px; translate: -50% 0; background: linear-gradient(90deg, transparent, #fff6b0aa 30%, #ffffffdd 50%, #fff6b0aa 70%, transparent); animation: mx-beam 2.4s ease-out forwards; }
@keyframes mx-beam { 0% { transform: scaleX(0); opacity: 0; } 15% { transform: scaleX(1); opacity: 1; } 70% { opacity: .8; } 100% { transform: scaleX(1.6); opacity: 0; } }
.mx-levelup strong { position: relative; font: 800 72px/1 var(--mx-num); letter-spacing: .02em; color: #ffe14d; -webkit-text-stroke: 10px #6a3a00; paint-order: stroke fill; text-shadow: 0 6px 0 #3b2000; animation: mx-level 2.4s cubic-bezier(.3, 1.8, .5, 1) forwards; }
.mx-levelup span { position: relative; font: 900 22px/1 var(--mx-font); color: #fff; -webkit-text-stroke: 5px #6a3a00; paint-order: stroke fill; margin-top: 10px; animation: mx-level 2.4s cubic-bezier(.3, 1.8, .5, 1) .1s backwards forwards; }
@keyframes mx-level { 0% { transform: scale(.2); opacity: 0; } 18% { transform: scale(1); opacity: 1; } 80% { transform: scale(1) translateY(-10px); opacity: 1; } 100% { transform: scale(1.05) translateY(-30px); opacity: 0; } }

.mx-log { position: fixed; left: 14px; bottom: 70px; z-index: 58; display: grid; gap: 2px; pointer-events: none; font-family: var(--mx-font); }
.mx-log p { justify-self: start; margin: 0; padding: 3px 10px; border-radius: 6px; background: #0b1020b3; font-size: 13px; font-weight: 700; color: #fff; animation: mx-log 4.2s ease forwards; }
.mx-log .mx-log-meso { color: #ffe066; }
.mx-log .mx-log-exp { color: #c7f25a; }
.mx-log .mx-log-item { color: #9fe0ff; }
@keyframes mx-log { 0% { opacity: 0; translate: -10px 0; } 6%, 80% { opacity: 1; translate: 0 0; } 100% { opacity: 0; } }

/* ---------- Footer grass ---------- */
html[data-ui=maple] .encyclopedia footer:last-child, html[data-ui=maple] .site-footer {
  position: relative;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .mx-hud { flex-wrap: wrap; gap: 6px 10px; padding: 6px 10px; }
  .mx-hud-bars { order: 5; flex-basis: 100%; grid-template-columns: 1fr 1fr 1.4fr; }
  .mx-name small { display: none; }
  html[data-ui=maple] .encyclopedia { padding-bottom: 110px; }
  .mx-npc { bottom: 108px; }
  .mx-log { bottom: 108px; }
}
@media (max-width: 640px) {
  .mx-stage { height: 330px; }
  .mx-stage-content { padding: 22px 16px; }
  .mx-sign { padding: 14px 18px; }
  .mx-sign .mx-sign-title span { font-size: 46px; }
  .mx-sign .mx-sign-sub { font-size: 13px; }
  .mx-stage-hint { display: none; }
  .mx-name { display: none; }
  .mx-quickslot button { width: 34px; height: 34px; }
  .mx-quickslot img { width: 24px; height: 24px; }
  .mx-hud-bars { gap: 5px; }
  .mx-bar b { display: none; }
  .mx-bar small { left: 0; font-size: 10px; }
  .mx-npc { right: 8px; }
  .mx-npc-body { width: 54px; height: 54px; border-radius: 50%; overflow: hidden; background: #fff; border: 3px solid #c9a24a; box-shadow: 0 3px 0 #0004; }
  .mx-npc-body img { max-height: none; max-width: none; width: 100%; height: 100%; object-fit: cover; object-position: top; filter: none; }
  .mx-npc-name, .mx-balloon, .mx-npc-tools { display: none; }
  .mx-dialog { grid-template-columns: 1fr; }
  .mx-dialog-portrait { grid-template-columns: auto 1fr; align-items: center; justify-items: start; gap: 10px; padding: 10px 14px; border-right: 0; border-bottom: 2px solid #c3cbda; }
  .mx-dialog-portrait img { max-height: 60px; }
  .mx-dialog-portrait span { margin: 0; }
  html[data-ui=maple] .ec-categories { padding: 0; }
  html[data-ui=maple] .ec-categories button { padding: 6px 8px 8px; font-size: 13px; }
  .mx-levelup strong { font-size: 48px; }
}
@media (prefers-reduced-motion: reduce) {
  .mx-cloud, .mx-leaf, .mx-sign, .mx-sign .mx-sign-title span, .mx-mob-sprite, .mx-stars { animation: none !important; }
  .mx-leaf { display: none; }
}

/* ==================================================================
   Other pages (static HTML): same world, different maps.
================================================================== */
html[data-ui=maple] body { padding-bottom: 72px; }
html[data-ui=maple].mx-hud-closed body { padding-bottom: 0; }
html[data-ui=maple] body:not(:has(#root, > .shell)) {
  font-family: var(--mx-font);
  color: var(--mx-ink);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cpath d='M30 18l3 7 6-3-2 7 7 1-6 4 4 5-7-1-1 7-4-6-4 6-1-7-7 1 4-5-6-4 7-1-2-7 6 3z' fill='%23d9b77a' opacity='.16'/%3E%3Cpath d='M90 78l2 5 4-2-1 5 5 1-4 3 3 3-5-1-1 5-3-4-3 4-1-5-5 1 3-3-4-3 5-1-1-5 4 2z' fill='%23d9b77a' opacity='.12'/%3E%3C/svg%3E"),
    var(--mx-page);
}
html[data-ui=maple][data-theme=dark] body:not(:has(#root, > .shell)) {
  background:
    radial-gradient(1px 1px at 20% 30%, #fff8 50%, transparent 51%) 0 0 / 180px 140px,
    radial-gradient(1px 1px at 70% 60%, #fff6 50%, transparent 51%) 0 0 / 230px 170px,
    var(--mx-page);
}
html[data-ui=maple] body:not(:has(#root, > .shell)) :is(h1, h2, h3, h4) { font-family: var(--mx-font); font-weight: 900; color: var(--mx-ink); }
html[data-ui=maple] body:not(:has(#root, > .shell)) :is(p, li, td, small, .note, .hint, .audience, .series-note) { color: var(--mx-ink-soft); }
html[data-ui=maple] body:not(:has(#root, > .shell)) main a:not(.card):not(.reward-card):not(.walk-object):not(.database-home-button):not(.atlas-card) { color: var(--mx-orange-2); }
html[data-ui=maple][data-theme=dark] body:not(:has(#root, > .shell)) main a:not(.card):not(.reward-card):not(.walk-object):not(.database-home-button):not(.atlas-card) { color: var(--mx-gold); }

/* Main windows */
html[data-ui=maple] body:not(:has(#root, > .shell)) > main,
html[data-ui=maple] :is(.article-content, .comments, .rank-main > .panel, .quest-series) {
  background: var(--mx-paper) !important;
  border: 3px solid var(--mx-rim-dark) !important;
  border-radius: 14px !important;
  box-shadow: inset 0 0 0 3px var(--mx-paper-2), inset 0 0 0 5px #e7cf9f, 0 6px 0 #00000022;
  color: var(--mx-ink);
}
html[data-ui=maple][data-theme=dark] :is(body:not(:has(#root, > .shell)) > main, .article-content, .comments, .rank-main > .panel, .quest-series) { box-shadow: inset 0 0 0 3px var(--mx-paper-2), inset 0 0 0 5px #3a4a78, 0 6px 0 #0006; }
html[data-ui=maple] body:not(:has(#root, > .shell)) > main.rank-main,
html[data-ui=maple] body:not(:has(#root, > .shell)) > main.article-page,
html[data-ui=maple] body:not(:has(#root, > .shell)) > main:has(.cards) { background: transparent !important; border: 0 !important; box-shadow: none; }
html[data-ui=maple] body:not(:has(#root, > .shell)) > main { margin-top: 28px; }

/* Buttons, fields */
html[data-ui=maple] body:not(:has(#root, > .shell)) :is(select, input:not([type=checkbox]):not([type=radio]), textarea) {
  font-family: var(--mx-font);
  font-weight: 700;
  color: var(--mx-ink);
  background-color: #fff !important;
  border: 2px solid var(--mx-slot-edge) !important;
  border-radius: 10px !important;
  box-shadow: inset 0 2px 0 #f1e4c6;
}
html[data-ui=maple][data-theme=dark] body:not(:has(#root, > .shell)) :is(select, input:not([type=checkbox]):not([type=radio]), textarea) { background-color: #0f1630 !important; box-shadow: inset 0 2px 0 #000; }
html[data-ui=maple] body:not(:has(#root, > .shell)) :is(select, input, textarea):focus-visible { outline: 0; border-color: var(--mx-orange-2) !important; box-shadow: 0 0 0 4px #ffd54a88; }
html[data-ui=maple] body:not(:has(#root, > .shell)) main button,
html[data-ui=maple] a.database-home-button {
  font-family: var(--mx-font);
  font-weight: 800;
  color: #5a3515 !important;
  background: linear-gradient(180deg, #fffbe9, #f1d9a6) !important;
  border: 2px solid #7a4a1f !important;
  border-radius: 10px !important;
  box-shadow: 0 3px 0 #5a2f0e;
  transition: transform .08s, box-shadow .08s;
}
html[data-ui=maple] body:not(:has(#root, > .shell)) main button:active,
html[data-ui=maple] a.database-home-button:active { transform: translateY(3px); box-shadow: none; }
html[data-ui=maple] body:not(:has(#root, > .shell)) main button[aria-pressed=true],
html[data-ui=maple] a.database-home-button {
  color: #fff !important;
  background: linear-gradient(180deg, #ffc15a, var(--mx-orange) 55%, var(--mx-orange-2)) !important;
  border-color: #8a3a06 !important;
  box-shadow: 0 3px 0 #5a2206;
  -webkit-text-stroke: 3px #8a3a06;
  paint-order: stroke fill;
}

/* Tables (update lists, training ranking) */
html[data-ui=maple] body:not(:has(#root, > .shell)) table { font-family: var(--mx-font); }
html[data-ui=maple] body:not(:has(#root, > .shell)) th { background: var(--mx-paper-2) !important; color: var(--mx-ink-soft) !important; font-weight: 800; border-bottom: 2px dashed #d8bd8a !important; }
html[data-ui=maple] body:not(:has(#root, > .shell)) td { border-bottom: 1px dashed #e2cfa6 !important; }
html[data-ui=maple][data-theme=dark] body:not(:has(#root, > .shell)) :is(th, td) { border-color: #3a4a78 !important; }
html[data-ui=maple] body:not(:has(#root, > .shell)) tbody tr:hover { background: var(--mx-hover) !important; }

/* Training ranking uses its own variables: map them onto the Maple palette. */
html[data-ui=maple]:has(.rank-main) { --bg: var(--mx-page); --panel: var(--mx-paper); --soft: var(--mx-paper-2); --ink: var(--mx-ink); --muted: var(--mx-ink-soft); --line: #e2cfa6; --accent: var(--mx-orange-2); }
html[data-ui=maple][data-theme=dark]:has(.rank-main) { --line: #3a4a78; --accent: var(--mx-gold); }
html[data-ui=maple] .rank-main td:nth-child(4) { font-family: var(--mx-num); font-size: 20px !important; color: var(--mx-orange-2) !important; }
html[data-ui=maple][data-theme=dark] .rank-main td:nth-child(4) { color: var(--mx-gold) !important; }
html[data-ui=maple] .rank-main td:first-child { font-family: var(--mx-num); font-weight: 800; color: var(--mx-ink) !important; white-space: nowrap; }
html[data-ui=maple] .rank-main tbody tr:nth-child(-n+3) td:first-child::before { content: ''; display: inline-block; width: 20px; height: 20px; margin-right: 6px; vertical-align: -4px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff6c9, #ffd54a 45%, #c98d0c 80%); box-shadow: inset 0 0 0 2px #a8700c; }
html[data-ui=maple] .rank-main tbody tr:nth-child(2) td:first-child::before { background: radial-gradient(circle at 35% 30%, #fff, #cfd8e3 45%, #7d8a9c 80%); box-shadow: inset 0 0 0 2px #5a6474; }
html[data-ui=maple] .rank-main tbody tr:nth-child(3) td:first-child::before { background: radial-gradient(circle at 35% 30%, #ffe0c2, #d98a4a 45%, #8f4b16 80%); box-shadow: inset 0 0 0 2px #7a3d0e; }
html[data-ui=maple] :is(.rank-heading h1, body:not(:has(#root, > .shell)) > main > h1, .intro h1, .article-hero h1) {
  color: #fff !important;
  -webkit-text-stroke: 6px #5a2f0e;
  paint-order: stroke fill;
  text-shadow: 0 4px 0 #3d1f08;
  letter-spacing: .04em;
}

/* Update page */
html[data-ui=maple] :is(.patch-picker, .counts article, .extra, .pending, main aside) {
  background: var(--mx-paper-2) !important;
  border: 2px dashed #d8bd8a !important;
  border-radius: 12px !important;
  color: var(--mx-ink);
}
html[data-ui=maple][data-theme=dark] :is(.patch-picker, .counts article, .extra, .pending, main aside) { border-color: #3a4a78 !important; }
html[data-ui=maple] .counts strong { font-family: var(--mx-num); font-size: 30px !important; color: var(--mx-orange-2); }
html[data-ui=maple] .version { color: var(--mx-orange-2) !important; font-weight: 900; }
html[data-ui=maple] .update-card { border-bottom: 2px dashed #d8bd8a !important; }
html[data-ui=maple] :is(.new-item, .reward-card, .walk-object, .atlas-card) {
  background: #fff !important;
  border: 2px solid var(--mx-slot-edge) !important;
  border-radius: 12px !important;
  box-shadow: 0 3px 0 #d6b98a;
  color: var(--mx-ink) !important;
  transition: transform .18s cubic-bezier(.3, 1.8, .5, 1), box-shadow .18s, border-color .18s;
}
html[data-ui=maple] :is(.new-item, .reward-card, .walk-object, .atlas-card):hover { transform: translateY(-3px); box-shadow: 0 6px 0 #d6b98a; border-color: var(--mx-orange) !important; }
html[data-ui=maple][data-theme=dark] :is(.new-item, .reward-card, .walk-object, .atlas-card) { background: #1b2440 !important; box-shadow: 0 3px 0 #0b0f1d; }
html[data-ui=maple] :is(.new-item, .reward-card, .walk-object) img {
  padding: 4px;
  box-sizing: content-box;
  border-radius: 10px;
  background: radial-gradient(circle at 50% 40%, #fffdf4, var(--mx-slot));
  box-shadow: inset 0 0 0 2px var(--mx-slot-edge), inset 0 3px 4px #0000001a;
  transition: transform .25s cubic-bezier(.3, 1.9, .5, 1);
}
html[data-ui=maple] :is(.new-item, .reward-card, .walk-object):hover img { transform: scale(1.12) rotate(-4deg); }
html[data-ui=maple] .reward-icon { width: auto !important; height: auto !important; flex-basis: auto !important; }

/* Quest reward & ring pages */
html[data-ui=maple] :is(.quest-series > h2, .ring-walkthrough > h2) {
  display: inline-block;
  padding: 5px 16px 6px 14px;
  color: #fff !important;
  background: linear-gradient(180deg, #ffc15a, var(--mx-orange-2));
  border: 2px solid #8a3a06;
  border-radius: 8px 22px 22px 8px;
  -webkit-text-stroke: 4px #8a3a06;
  paint-order: stroke fill;
  font-size: 20px;
}
html[data-ui=maple] .quest-series + .quest-series::before { background: repeating-linear-gradient(90deg, #d8bd8a 0 10px, transparent 10px 18px) !important; }
html[data-ui=maple] .series-details > summary { color: var(--mx-orange-2) !important; font-weight: 800; }
html[data-ui=maple] .walk-nav a {
  font-weight: 800;
  color: #5a3515 !important;
  background: linear-gradient(180deg, #fffbe9, #f1d9a6);
  border: 2px solid #7a4a1f !important;
  box-shadow: 0 3px 0 #5a2f0e;
  text-decoration: none;
  transition: transform .15s;
}
html[data-ui=maple] .walk-nav a:hover { transform: translateY(-2px); }
html[data-ui=maple] .walk-route { background: var(--mx-paper-2) !important; border: 2px dashed #d8bd8a !important; }
html[data-ui=maple] .walk-route b { background: radial-gradient(circle at 35% 30%, #fff6c9, #ffd54a 45%, #c98d0c 80%) !important; color: #5a3a00 !important; box-shadow: inset 0 0 0 2px #a8700c; font-family: var(--mx-num); }
html[data-ui=maple] .walk-kicker { color: var(--mx-orange-2) !important; font-weight: 800; }
html[data-ui=maple] .ring-walkthrough { border-top: 2px dashed #d8bd8a !important; }

/* Columns list: a notice board */
html[data-ui=maple] .intro small { color: var(--mx-orange-2) !important; }
html[data-ui=maple] .controls nav button { border-radius: 99px !important; }
html[data-ui=maple] .cards {
  border: 10px solid transparent !important;
  border-image: repeating-linear-gradient(90deg, #7a4a1f 0 14px, #6a3d17 14px 28px) 10 !important;
  background: radial-gradient(#0000000d 1px, transparent 1.5px) 0 0 / 7px 7px, linear-gradient(180deg, #d6a86a, #c4924f);
  padding: 22px 18px;
  gap: 18px !important;
  min-height: 120px;
}
html[data-ui=maple][data-theme=dark] .cards { background: radial-gradient(#0000002a 1px, transparent 1.5px) 0 0 / 7px 7px, linear-gradient(180deg, #5b4330, #4a3524); }
html[data-ui=maple] .cards .card {
  position: relative;
  background: #fffdf2 !important;
  border: 0 !important;
  border-radius: 3px !important;
  box-shadow: 0 4px 8px #0000002e;
  rotate: -.5deg;
  transition: rotate .2s, transform .2s;
}
html[data-ui=maple] .cards .card:nth-child(even) { rotate: .5deg; background: #fff6d6 !important; }
html[data-ui=maple] .cards .card:hover { rotate: 0deg; transform: translateY(-3px); }
html[data-ui=maple] .cards .card::before { content: ''; position: absolute; top: -6px; left: 50%; width: 14px; height: 14px; translate: -50% 0; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ff8a8a, #d4231d 60%, #8a0f0b); box-shadow: 0 2px 2px #0005; }
html[data-ui=maple] .cards .card :is(h2, p, b, span, .article-date) { color: #3d2410 !important; }
html[data-ui=maple] .cards .card span:first-child { color: #d4520c !important; font-weight: 800; }
html[data-ui=maple] .cards + p, html[data-ui=maple] main:has(.cards) > p { color: var(--mx-ink); }

/* Articles */
html[data-ui=maple] .article-hero {
  background: repeating-linear-gradient(0deg, #ffffff12 0 3px, transparent 3px 11px), linear-gradient(180deg, #c8894a, #a8672f) !important;
  border: 3px solid #5a2f0e !important;
  box-shadow: inset 0 3px 0 #e8b27a, inset 0 -5px 0 #7d461b, 0 8px 0 #0000002e;
}
html[data-ui=maple] .article-hero :is(small, .article-summary) { color: #fff3d6 !important; }
html[data-ui=maple] .category-badge { background: #5a2f0e !important; }
html[data-ui=maple] .article-content :is(h2, h3) { border-left: 6px solid var(--mx-orange) !important; }

/* Footer */
html[data-ui=maple] :is(.site-footer, body:not(:has(#root, > .shell)) main > footer) {
  border-top: 2px dashed #d8bd8a !important;
  color: var(--mx-ink-soft) !important;
}

/* ---------- Monster strip under the header ---------- */
.mx-strip {
  position: relative;
  height: 128px;
  overflow: hidden;
  overflow: clip;
  background: linear-gradient(180deg, var(--mx-sky-1), var(--mx-sky-2));
  border-bottom: 5px solid #7a4a1f;
  user-select: none;
  -webkit-user-select: none;
}
.mx-strip-bg { position: absolute; inset: 0; background-repeat: repeat-x; background-size: auto 250px; background-position: left bottom; }
html[data-theme=dark] .mx-strip-bg { filter: brightness(.5) saturate(.8) hue-rotate(12deg); }
.mx-strip-leaves { position: absolute; inset: 0; z-index: 4; pointer-events: none; overflow: clip; }
.mx-strip .mx-ground { bottom: 16px; }
.mx-strip-place {
  position: absolute;
  z-index: 6;
  left: max(16px, calc((100vw - 1180px) / 2));
  top: 12px;
  margin: 0;
  padding: 6px 14px 7px;
  font: 900 18px/1.2 var(--mx-font);
  color: #fff;
  background: linear-gradient(180deg, #c8894a, #a8672f);
  border: 3px solid #5a2f0e;
  border-radius: 12px;
  box-shadow: inset 0 2px 0 #e8b27a, 0 4px 0 #0000002e;
  -webkit-text-stroke: 4px #5a2f0e;
  paint-order: stroke fill;
}
.mx-strip-place small { display: block; font-size: 11px; letter-spacing: .12em; color: #ffe7b8; -webkit-text-stroke: 0; }

/* Map name banner when a page opens */
.mx-mapname {
  position: absolute;
  left: 50%;
  top: 22%;
  translate: -50% 0;
  display: grid;
  justify-items: center;
  padding: 12px 60px 14px;
  background: linear-gradient(90deg, transparent, #0b1020cc 20%, #0b1020cc 80%, transparent);
  font-family: var(--mx-font);
  animation: mx-mapname 3.2s ease forwards;
}
.mx-mapname small { font-size: 13px; font-weight: 800; letter-spacing: .2em; color: #ffd54a; }
.mx-mapname strong { font-size: 30px; font-weight: 900; color: #fff; -webkit-text-stroke: 5px #1b2440; paint-order: stroke fill; }
@keyframes mx-mapname { 0% { opacity: 0; transform: translateY(10px); } 12%, 75% { opacity: 1; transform: none; } 100% { opacity: 0; } }

@media (max-width: 900px) {
  html[data-ui=maple] body { padding-bottom: 110px; }
  html[data-ui=maple] header.topbar { grid-template-columns: 1fr; grid-template-areas: "brand" "actions" "nav"; }
  html[data-ui=maple] header.topbar .topbar-actions { justify-content: flex-start; flex-wrap: wrap; }
}
@media (max-width: 640px) {
  .mx-strip { height: 104px; }
  .mx-strip-place { font-size: 15px; }
  .mx-mapname strong { font-size: 22px; }
  html[data-ui=maple] header.topbar .mode-tab { padding: 7px 9px; font-size: 13px; }
}

/* The hidden attribute always wins over the display rules above. */
:is(.mx-hud, .mx-hud-reopen, .mx-menu-pop, .mx-npc, .mx-balloon, .mx-npc-return, .mx-mob-hp)[hidden] { display: none !important; }

/* ---------- Market page (React) ---------- */
html[data-ui=maple] .market-editorial-layout { font-family: var(--mx-font); color: var(--mx-ink); }
html[data-ui=maple] .market-editorial-layout :is(.buy-market, .price-history, .form-panel, .receipt) {
  background: var(--mx-paper) !important;
  border: 3px solid var(--mx-rim-dark) !important;
  border-radius: 14px !important;
  box-shadow: inset 0 0 0 3px var(--mx-paper-2), inset 0 0 0 5px #e7cf9f, 0 6px 0 #00000022 !important;
  color: var(--mx-ink);
}
html[data-ui=maple][data-theme=dark] .market-editorial-layout :is(.buy-market, .price-history, .form-panel, .receipt) { box-shadow: inset 0 0 0 3px var(--mx-paper-2), inset 0 0 0 5px #3a4a78, 0 6px 0 #0006 !important; }
html[data-ui=maple] .market-editorial-layout > main :is(h1, h2, h3, strong) { font-family: var(--mx-font); color: var(--mx-ink); }
html[data-ui=maple] .market-editorial-layout > main p { color: var(--mx-ink-soft); }
html[data-ui=maple] .market-brand-title {
  color: #fff !important;
  -webkit-text-stroke: 5px #5a2f0e;
  paint-order: stroke fill;
  text-shadow: 0 3px 0 #3d1f08;
  font-weight: 900;
}
html[data-ui=maple] .market-editorial-layout :is(.quick-compare, .market-quick-compare, .convert-box, .formula, .purchase-notice, .fee-note) {
  background: var(--mx-paper-2) !important;
  border: 2px dashed #d8bd8a !important;
  border-radius: 12px !important;
  color: var(--mx-ink) !important;
}
html[data-ui=maple][data-theme=dark] .market-editorial-layout :is(.quick-compare, .market-quick-compare, .convert-box, .formula, .purchase-notice, .fee-note) { border-color: #3a4a78 !important; }
html[data-ui=maple] .market-editorial-layout :is(.convert-row, .result-row) { border-color: #e2cfa6 !important; }
html[data-ui=maple] .market-editorial-layout :is(.convert-qty, .convert-coins, .result) { font-family: var(--mx-num); font-weight: 800; }
html[data-ui=maple] .market-editorial-layout .convert-coins { color: var(--mx-orange-2) !important; }
html[data-ui=maple] .market-editorial-layout :is(.convert-unit, .small-tag, .eyebrow.market-disclaimer + *, .price-status) { border-radius: 99px; }
html[data-ui=maple] .market-editorial-layout .convert-unit { background: #fff !important; border: 1.5px solid var(--mx-slot-edge) !important; color: var(--mx-ink-soft) !important; }
html[data-ui=maple][data-theme=dark] .market-editorial-layout .convert-unit { background: #0f1630 !important; }
/* Server picker: two game buttons, the chosen one glows orange. */
html[data-ui=maple] .market-editorial-layout :is(.server-select, .market-server-picker) button,
html[data-ui=maple] .market-editorial-layout .market-details-toggle,
html[data-ui=maple] .market-editorial-layout .price-actions button,
html[data-ui=maple] .market-editorial-layout .refresh-inline {
  font-family: var(--mx-font) !important;
  font-weight: 800 !important;
  color: #5a3515 !important;
  background: linear-gradient(180deg, #fffbe9, #f1d9a6) !important;
  border: 2px solid #7a4a1f !important;
  border-radius: 10px !important;
  box-shadow: 0 3px 0 #5a2f0e !important;
  transition: transform .08s, box-shadow .08s;
}
html[data-ui=maple] .market-editorial-layout :is(.server-select, .market-server-picker) button:active,
html[data-ui=maple] .market-editorial-layout .market-details-toggle:active { transform: translateY(3px); box-shadow: none !important; }
html[data-ui=maple] .market-editorial-layout :is(.server-select, .market-server-picker) button.selected,
html[data-ui=maple] .market-editorial-layout .price-actions button[aria-pressed=true] {
  color: #fff !important;
  background: linear-gradient(180deg, #ffc15a, var(--mx-orange) 55%, var(--mx-orange-2)) !important;
  border-color: #8a3a06 !important;
  box-shadow: 0 3px 0 #5a2206 !important;
  -webkit-text-stroke: 3px #8a3a06;
  paint-order: stroke fill;
}
html[data-ui=maple] .market-editorial-layout :is(.server-select, .market-server-picker) button::before {
  content: '';
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-right: 6px;
  vertical-align: -2px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6c9, #ffd54a 45%, #c98d0c 80%);
  box-shadow: inset 0 0 0 2px #a8700c;
}
html[data-ui=maple] .market-editorial-layout :is(input, select) {
  font-family: var(--mx-font);
  font-weight: 700;
  background: #fff !important;
  border: 2px solid var(--mx-slot-edge) !important;
  border-radius: 10px !important;
  color: var(--mx-ink) !important;
}
html[data-ui=maple][data-theme=dark] .market-editorial-layout :is(input, select) { background: #0f1630 !important; }
html[data-ui=maple] .market-editorial-layout .input-wrap { background: transparent !important; border: 0 !important; }

/* Pet index and the simple info pages */
html[data-ui=maple] .pet-grid a {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  text-decoration: none;
  color: var(--mx-ink) !important;
  background: #fff;
  border: 2px solid var(--mx-slot-edge) !important;
  border-radius: 12px !important;
  box-shadow: 0 3px 0 #d6b98a;
  transition: transform .18s cubic-bezier(.3, 1.8, .5, 1), box-shadow .18s, border-color .18s;
}
html[data-ui=maple] .pet-grid a:hover { transform: translateY(-3px); box-shadow: 0 6px 0 #d6b98a; border-color: var(--mx-orange) !important; }
html[data-ui=maple][data-theme=dark] .pet-grid a { background: #1b2440; box-shadow: 0 3px 0 #0b0f1d; }
html[data-ui=maple] .pet-grid img {
  flex-shrink: 0;
  padding: 3px;
  box-sizing: content-box;
  border-radius: 10px;
  background: radial-gradient(circle at 50% 40%, #fffdf4, var(--mx-slot));
  box-shadow: inset 0 0 0 2px var(--mx-slot-edge);
  transition: transform .25s cubic-bezier(.3, 1.9, .5, 1);
}
html[data-ui=maple] .pet-grid a:hover img { transform: scale(1.15) rotate(-6deg); }
html[data-ui=maple] body:not(:has(#root, > .shell)) > main > nav a {
  padding: 4px 12px;
  font-weight: 800;
  text-decoration: none;
  color: #fff !important;
  background: linear-gradient(180deg, #c8894a, #a8672f);
  border: 2px solid #5a2f0e;
  border-radius: 8px;
  box-shadow: 0 2px 0 #3d1f08;
}
html[data-ui=maple] body:not(:has(#root, > .shell)) > main > nav a:hover { transform: translateY(-2px); }

/* Market quick conversion: "楓幣" as a small gold tag instead of a cramped circle. */
html[data-ui=maple] .market-editorial-layout .convert-row > .convert-unit:not(.convert-currency) {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px 3px 6px;
  font: 800 14px/1.2 var(--mx-font) !important;
  letter-spacing: .08em;
  color: #6a3a00 !important;
  background: linear-gradient(180deg, #fff6c9, #ffd54a) !important;
  border: 2px solid #c98d0c !important;
  border-radius: 99px;
  box-shadow: 0 2px 0 #a8700c;
  white-space: nowrap;
}
html[data-ui=maple] .market-editorial-layout .convert-row > .convert-unit:not(.convert-currency)::before {
  content: '';
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6c9, #ffd54a 45%, #c98d0c 80%);
  box-shadow: inset 0 0 0 1.5px #a8700c;
}

/* Language switch (繁中 / 简中 / EN) in the Maple look */
html[data-ui=maple] header.topbar .lang-seg {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: #5a2f0e;
  border: 2px solid #3d1f08;
  border-radius: 12px;
  box-shadow: inset 0 2px 3px #0005, 0 2px 0 #ffffff22;
}
html[data-ui=maple] header.topbar .lang-seg button {
  font: 800 13px/1 var(--mx-font);
  color: #f3dcae;
  background: transparent;
  border: 0;
  border-radius: 9px;
  padding: 8px 10px;
  min-height: 0;
  cursor: var(--mx-cursor-hand);
}
html[data-ui=maple] header.topbar .lang-seg button:hover { color: #fff; background: #ffffff1a; }
html[data-ui=maple] header.topbar .lang-seg button[aria-pressed=true] {
  color: #fff;
  background: linear-gradient(180deg, #ffc15a, var(--mx-orange) 55%, var(--mx-orange-2));
  box-shadow: inset 0 1px 0 #ffe3a6, 0 2px 0 #3d1f08;
  -webkit-text-stroke: 3px #8a3a06;
  paint-order: stroke fill;
}

/* Category tabs: arrows to reach tabs scrolled out of view */
html[data-ui=maple] .ec-cat-scroller { position: relative; display: flex; align-items: flex-end; gap: 4px; margin-top: 30px; }
html[data-ui=maple] .ec-cat-scroller .ec-categories { flex: 1; min-width: 0; margin: 0; scroll-behavior: smooth; }
html[data-ui=maple] .ec-cat-arrow {
  flex-shrink: 0;
  align-self: center;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  font: 900 22px/1 var(--mx-font);
  color: #fff;
  background: linear-gradient(180deg, #ffc15a, var(--mx-orange-2));
  border: 2px solid #8a3a06;
  border-radius: 50%;
  box-shadow: 0 3px 0 #5a2206;
  -webkit-text-stroke: 3px #8a3a06;
  paint-order: stroke fill;
  transition: transform .1s;
}
html[data-ui=maple] .ec-cat-arrow:hover { transform: scale(1.1); }
html[data-ui=maple] .ec-cat-arrow:active { transform: translateY(3px); box-shadow: none; }

/* Light / dark switch: just a sun or moon icon */
html[data-ui=maple] header.topbar .theme-toggle.mx-icon-toggle {
  width: 42px;
  height: 42px;
  min-height: 0;
  padding: 0 !important;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
}
html[data-ui=maple] header.topbar .mx-icon-toggle svg { width: 20px; height: 20px; }

/* Destinations stay on one row: smaller buttons first, then the icons go, and only then does the row scroll. */
@media (min-width: 641px) {
  html[data-ui=maple] header.topbar .mode-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; justify-content: safe center; }
  html[data-ui=maple] header.topbar .mode-tabs::-webkit-scrollbar { display: none; }
  html[data-ui=maple] header.topbar .mode-tab { flex-shrink: 0; }
}
@media (min-width: 641px) and (max-width: 1365px) {
  html[data-ui=maple] header.topbar .mode-tab { padding: 7px 10px; font-size: 13.5px; min-height: 38px; }
}
/* The Classic World / Artale header shares its row with the brand, so its link icons go earlier. */
@media (min-width: 641px) and (max-width: 1365px) {
  html[data-ui=maple] #mxSiteTop .mode-tab svg { display: none; }
}
@media (min-width: 641px) and (max-width: 1180px) {
  html[data-ui=maple] header.topbar .mode-tab svg { display: none; }
}

/* Set by fitNav() in maple-site.js when the destinations do not fit on one row. */
@media (min-width: 641px) {
  html[data-ui=maple] header.topbar .mode-tabs[data-fit="1"] .mode-tab svg,
  html[data-ui=maple] header.topbar .mode-tabs[data-fit="2"] .mode-tab svg,
  html[data-ui=maple] header.topbar .mode-tabs[data-fit="3"] .mode-tab svg { display: none; }
  html[data-ui=maple] header.topbar .mode-tabs[data-fit="2"] .mode-tab,
  html[data-ui=maple] header.topbar .mode-tabs[data-fit="3"] .mode-tab { padding: 6px 8px; font-size: 12.5px; min-height: 34px; }
  html[data-ui=maple] header.topbar .mode-tabs[data-fit="3"] { flex-wrap: wrap; overflow: visible; row-gap: 6px; justify-content: center; }
}

/* Mobile: keep lookup content first; secondary destinations expand on demand. */
.mx-mobile-nav-toggle { display: none; }
@media (max-width: 700px) {
  html[data-ui=maple] header.topbar.mx-mobile-nav-ready,
  html[data-ui=maple] header#mxSiteTop.mx-mobile-nav-ready {
    grid-template-columns: minmax(0,1fr) auto;
    grid-template-areas: "brand toggle" "actions actions" "search search" "nav nav";
    gap: 8px; height: auto; min-height: 0; padding: 12px !important;
  }
  html[data-ui=maple] header.topbar .mx-mobile-nav-toggle {
    display: inline-flex; grid-area: toggle; align-items: center; justify-content: center;
    min-height: 44px; padding: 8px 10px; border: 2px solid #7a4a1f; border-radius: 10px;
    background: #fff3d5; color: #5a3515; font: 700 14px/1.3 var(--mx-font); cursor: pointer;
  }
  html[data-ui=maple] header.topbar.mx-mobile-nav-ready:not(.mx-nav-open) .mode-tabs { display: none !important; }
  html[data-ui=maple] header.topbar.mx-mobile-nav-ready.mx-nav-open .mode-tabs {
    display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); width: 100%;
    padding: 10px 0 4px !important; gap: 8px; overflow: visible; border-image: none;
  }
  html[data-ui=maple] header.topbar .mode-tab { white-space: normal; text-align: center; min-width: 0; min-height: 44px; }
  html[data-ui=maple] header.topbar .mode-tab svg { display: none; }
  html[data-ui=maple] header.topbar .brand { font-size: 19px; min-width: 0; gap: 8px; }
  html[data-ui=maple] header.topbar .brand-icon { width: 32px !important; height: 32px !important; }
  html[data-ui=maple] header.topbar .topbar-actions { flex-wrap: nowrap; gap: 8px; justify-content: flex-end; }
  html[data-ui=maple] header.topbar .discord-contact { display: none; }
  html[data-ui=maple] header.topbar :is(.lang-seg,.seg) button { min-height: 36px; padding: 6px 12px; }
  html[data-ui=maple] header#mxSiteTop .menu-btn { width: 40px; height: 44px; }
  html[data-ui=maple] header#mxSiteTop .brand { margin-left: 48px; }
  html[data-ui=maple] header.topbar .mx-cw-search { max-width: none; width: 100%; }
  html[data-ui=maple] :is(input[type=search],input.field,select.field,textarea) { font-size: 16px; }
  html[data-ui=maple] .ec-editorial-layout { display: flex; flex-direction: column; gap: 20px; }
  html[data-ui=maple] .ec-editorial-layout > main { order: -1; width: 100%; min-width: 0; }
  html[data-ui=maple] .ec-editorial-layout > .ec-original { width: 100%; }
  .mx-stage { height: 150px; }
  .mx-stage-content { padding: 12px; }
  .mx-sign { padding: 8px 14px; }
  .mx-sign .mx-sign-title span { font-size: 30px; }
  .mx-sign .mx-sign-sub { font-size: 12px; }
  .mx-stage .mx-leaf, .mx-mapname { display: none; }
  html[data-ui=maple].mx-hud-closed body,
  html[data-ui=maple].mx-hud-closed .encyclopedia { padding-bottom: 64px; }
  .mx-hud-reopen { min-width: 44px; min-height: 44px; bottom: max(8px,env(safe-area-inset-bottom)); font-size: 18px; }
  html.mx-hud-closed .mx-npc { bottom: max(8px,env(safe-area-inset-bottom)); }
  .mx-npc-body { width: 44px; height: 44px; }
  .mx-hud { padding-bottom: max(8px,env(safe-area-inset-bottom)); }
  html[data-ui=maple] .shell .main { min-width: 0; width: 100%; }
  html[data-ui=maple] .shell .view { padding: 16px 12px; }
  html[data-ui=maple] .shell :is(.card,.hero) { padding: 18px 14px; }
  html[data-ui=maple] .shell .hero h1 { font-size: 25px !important; line-height: 1.45; }
  html[data-ui=maple] .shell .hero p { font-size: 16px !important; line-height: 1.8; }
  html[data-ui=maple] .shell .artale-scene-banner { height: 120px; margin-bottom: 16px; }
  html[data-ui=maple] .shell .grid-stats { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; }
  html[data-ui=maple] .shell .stat { padding: 12px 8px; min-width: 0; }
  html[data-ui=maple] .shell .stat .num { font-size: 23px; }
  html[data-ui=maple] .shell .kv { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  html[data-ui=maple] .shell .kv > div { min-width: 0; padding: 10px; }
  html[data-ui=maple] .shell .kv dt { font-size: 13px; }
  html[data-ui=maple] .shell .kv dd { font-size: 16px; overflow-wrap: anywhere; }
  html[data-ui=maple] .shell :is(.rel-list,.raid-grid) { grid-template-columns: minmax(0,1fr); }
  html[data-ui=maple] .shell :is(.rel-name,.rel-list .sub) { white-space: normal; overflow-wrap: anywhere; }
  html[data-ui=maple] .shell .rel-list a { min-height: 52px; }
  html[data-ui=maple] .shell .toolbar .grow { flex-basis: 100%; }
  html[data-ui=maple] .shell :is(.field,.btn,.chip) { min-height: 44px; }
  html[data-ui=maple] .shell .pager { flex-wrap: wrap; }
  html[data-ui=maple] .shell .pager .btns { flex-wrap: wrap; }
  html[data-ui=maple] .shell .detail-head { gap: 12px; }
  html[data-ui=maple] .shell .detail-head h1 { font-size: 25px; }
  html[data-ui=maple] .shell .thumb.lg { width: 68px; height: 68px; }
  html[data-ui=maple] .shell .table-wrap { max-width: 100%; overscroll-behavior-x: contain; }
  html[data-ui=maple] .shell .table-wrap th:first-child,
  html[data-ui=maple] .shell .table-wrap td:first-child { position: sticky; left: 0; z-index: 1; min-width: 180px; background: var(--surface); }
  html[data-ui=maple] .shell .table-wrap th:first-child { z-index: 2; }
  html[data-ui=maple] .shell .table-wrap .name-cell { max-width: 170px; white-space: normal; }
  html[data-ui=maple] .shell .table-wrap td .alt { max-width: 110px; overflow-wrap: anywhere; }
  html[data-ui=maple] .shell .sidebar { height: 100dvh; padding-bottom: env(safe-area-inset-bottom); }
}

.mx-tool-nav > summary { display: none; }
@media (max-width: 700px) {
  html[data-ui=maple] .tracker-shell { display: block; min-width: 0; }
  html[data-ui=maple] .tracker-shell > .sidebar { width: auto; max-width: calc(100% - 24px); min-width: 0; height: auto; margin: 12px; position: relative; top: auto; }
  html[data-ui=maple] .tracker-shell .mx-tool-nav > summary { display: list-item; cursor: pointer; min-height: 44px; padding: 10px 4px; font-weight: 700; }
  html[data-ui=maple] .tracker-shell .mx-tool-nav nav { display: grid; grid-template-columns: minmax(0,1fr); overflow: visible; }
  html[data-ui=maple] .tracker-shell main { min-width: 0; padding: 16px 12px; }
  html[data-ui=maple] .tracker-shell :is(.panel,.row,.layout,.fields) { min-width: 0; max-width: 100%; }
  html[data-ui=maple] .tracker-shell .panel { padding: 16px; }
  html[data-ui=maple] .ec-original nav { grid-template-columns: minmax(0,1fr); }
}

/* Grouped destinations: one button, links drop down on hover (controller in maple-site.js). */
html[data-ui=maple] header .mode-group { display: flex; flex-shrink: 0; }
html[data-ui=maple] header .mode-caret { display: inline-block; margin-left: 6px; width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 6px solid currentColor; transition: transform .2s; }
html[data-ui=maple] header .mode-group[data-open] .mode-caret { transform: rotate(180deg); }
html[data-ui=maple] header .mode-menu { display: none; position: fixed; z-index: 2000; translate: -50% 0; padding-top: 8px; }
html[data-ui=maple] header .mode-group[data-open] .mode-menu { display: block; }
html[data-ui=maple] header .mode-menu-panel {
  position: relative; display: grid; gap: 6px; min-width: 200px; padding: 10px;
  background: #fff8e6; border: 3px solid #8c5a2b; border-radius: 12px; box-shadow: 0 8px 18px #0005, inset 0 0 0 2px #f6ead0;
  animation: mx-menu-in .16s ease-out;
}
html[data-ui=maple] header .mode-menu-panel::before {
  content: ''; position: absolute; top: -9px; left: 50%; width: 14px; height: 14px; translate: -50% 0; rotate: 45deg;
  background: #fff8e6; border-left: 3px solid #8c5a2b; border-top: 3px solid #8c5a2b;
}
html[data-ui=maple] header .mode-menu .mode-menu-item { justify-content: flex-start; width: 100%; white-space: nowrap; }
html[data-ui=maple] header .mode-menu .mode-menu-item svg { display: inline-block !important; }
html[data-ui=maple][data-theme=dark] header .mode-menu-panel, html[data-ui=maple][data-theme=dark] header .mode-menu-panel::before { background: #26314f; border-color: #3b4a73; }
html[data-ui=maple][data-theme=dark] header .mode-menu-panel { box-shadow: 0 8px 18px #0008, inset 0 0 0 2px #1f2944; }
@keyframes mx-menu-in { from { opacity: 0; transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { html[data-ui=maple] header .mode-menu-panel { animation: none; } }
/* Mobile: the 全站導覽 panel lists the grouped links like every other destination. */
@media (max-width: 700px) {
  html[data-ui=maple] header :is(.mode-group, .mode-menu, .mode-menu-panel) { display: contents !important; }
  html[data-ui=maple] header .mode-group-toggle, html[data-ui=maple] header .mode-menu-panel::before { display: none !important; }
  html[data-ui=maple] header .mode-menu .mode-menu-item { justify-content: center; white-space: normal; }
  html[data-ui=maple] header .mode-menu .mode-menu-item svg { display: none !important; }
}
