/*
  Tema CENTRAL RP: edisi CHRISTMAS. Dimuat paling akhir; hanya menambah atau
  menimpa tampilan editor. Tidak menyentuh .output, #output, atau area export.
  Token tiga lapis: primitif (--xm-*) lalu semantik (--accent, --panel, dst
  di ui.css) lalu komponen (variabel lokal per blok).
*/

:root {
  --xm-navy-950: #050b17;
  --xm-navy-900: #0a1424;
  --xm-navy-800: #0f1c33;
  --xm-navy-700: #122240;
  --xm-navy-600: #172a4d;
  --xm-navy-500: #1f3763;
  --xm-navy-400: #2c4572;
  --xm-red: #e63946;
  --xm-red-hi: #ff8a93;
  --xm-red-deep: #b3202f;
  --xm-pine: #2fbf71;
  --xm-gold: #ffd479;
  --xm-ice: #bfe3ff;
  --xm-snow: #f4f9ff;
  --xm-red-a: rgba(230, 57, 70, var(--a, 1));
  --display: 'Barlow Condensed', 'Oswald', 'Bebas Neue', Impact, sans-serif;
  --ease-out: cubic-bezier(.2, .9, .25, 1);
  --pad-x: clamp(12px, 2.2vw, 32px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

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

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Splash */

.splash {
  --px: 0;
  --py: 0;
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  overflow: hidden;
  padding: 24px 24px calc(50px + var(--safe-b));
  background: radial-gradient(90% 80% at 50% 45%, #1c4a8f 0%, #0b2150 62%, #050b17 100%);
  transition: opacity .5s ease, transform .5s ease;
  contain: layout paint;
}
.splash[hidden] { display: none; }
.splash.is-leaving { opacity: 0; transform: scale(1.04); pointer-events: none; }
.splash > * { pointer-events: none; }
.splash > .splash-content { pointer-events: auto; }

.splash-bg { position: absolute; inset: -3%; overflow: hidden; }
.splash-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 42%;
  translate: calc(var(--px) * -14px) calc(var(--py) * -9px);
  transition: translate .25s ease-out;
  will-change: translate;
  animation: bg-in 1s var(--ease-out) both;
}
@keyframes bg-in {
  from { opacity: 0; transform: scale(1.06); }
  to   { opacity: 1; transform: none; }
}

.xm-glow {
  position: absolute;
  left: 50%;
  top: 54%;
  width: min(64vw, 1100px);
  height: 38vh;
  translate: -50% -50%;
  background: radial-gradient(50% 50% at 50% 50%, rgba(170, 220, 255, .38), rgba(255, 212, 121, .1) 50%, transparent 74%);
  will-change: opacity, transform;
  animation: glow-pulse 4.2s ease-in-out infinite;
}
@keyframes glow-pulse {
  0%, 100% { opacity: .5; transform: scale(.96); }
  50%      { opacity: 1;  transform: scale(1.06); }
}

.xm-aurora {
  position: absolute;
  inset: -10% -10% 45% -10%;
  mix-blend-mode: screen;
  background:
    radial-gradient(40% 60% at 22% 30%, rgba(80, 255, 190, .16), transparent 70%),
    radial-gradient(45% 55% at 72% 18%, rgba(130, 170, 255, .22), transparent 70%);
  will-change: transform, opacity;
  animation: aurora 20s ease-in-out infinite alternate;
}
@keyframes aurora {
  from { transform: translateX(-6%) scale(1);    opacity: .55; }
  to   { transform: translateX(6%)  scale(1.08); opacity: .95; }
}

.xm-mist {
  position: absolute;
  left: -30%;
  width: 160%;
  height: 38vh;
  background:
    radial-gradient(40% 55% at 20% 60%, rgba(200, 225, 255, .22), transparent 70%),
    radial-gradient(35% 50% at 55% 45%, rgba(200, 225, 255, .15), transparent 70%),
    radial-gradient(40% 60% at 85% 65%, rgba(255, 220, 160, .1), transparent 70%);
  will-change: transform;
}
.xm-mist-a { bottom: -6vh; animation: mist-drift 40s linear infinite alternate; }
.xm-mist-b { bottom: 8vh; opacity: .55; animation: mist-drift 56s -20s linear infinite alternate-reverse; }
@keyframes mist-drift {
  from { transform: translateX(-9%); }
  to   { transform: translateX(9%); }
}

.xm-particles { position: absolute; inset: 0; width: 100%; height: 100%; }

.xm-shooters { position: absolute; inset: 0; overflow: hidden; }
.xm-shooters i {
  position: absolute;
  top: var(--y);
  left: var(--x);
  width: clamp(70px, 14vw, 160px);
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .95));
  opacity: 0;
  rotate: 18deg;
  will-change: transform, opacity;
  animation: shoot 11s var(--delay) linear infinite;
}
.xm-shooters .s1 { --x: 8%;  --y: 9%;  --delay: 3s; }
.xm-shooters .s2 { --x: 52%; --y: 5%;  --delay: 8s; }
.xm-shooters .s3 { --x: 30%; --y: 16%; --delay: 14s; }
@keyframes shoot {
  0%, 86% { opacity: 0; transform: translate(0, 0); }
  88%     { opacity: 1; }
  100%    { opacity: 0; transform: translate(34vw, 11vw); }
}

.xm-sleigh-lane { position: absolute; inset: 0; overflow: hidden; }
.xm-sleigh {
  position: absolute;
  left: 0;
  top: 17%;
  width: clamp(110px, 17vw, 230px);
  color: #040a16;
  opacity: 0;
  will-change: transform, opacity;
  filter: drop-shadow(0 0 5px rgba(170, 215, 255, .55));
  animation: sleigh-cross 42s 5s linear infinite;
}
.xm-sleigh svg { display: block; width: 100%; height: auto; transform: scaleX(-1); }
.xm-sleigh::after {
  content: '';
  position: absolute;
  right: 96%;
  top: 40%;
  width: 90%;
  height: 2px;
  background: linear-gradient(270deg, rgba(255, 224, 150, .85), transparent);
}
@keyframes sleigh-cross {
  0%   { opacity: 0;  transform: translate(-26vw, 3vh) rotate(5deg); }
  4%   { opacity: .95; }
  50%  { transform: translate(54vw, -4vh) rotate(-3deg); }
  92%  { opacity: .95; }
  100% { opacity: 0;  transform: translate(128vw, 4vh) rotate(4deg); }
}

.xm-trees, .xm-gifts, .xm-baubles { position: absolute; inset: 0; }
.xm-trees { z-index: 1; }
.xm-tree {
  position: absolute;
  bottom: var(--b, 2vh);
  left: var(--l, auto);
  right: var(--r, auto);
  width: var(--s, clamp(70px, 12vmin, 150px));
  isolation: isolate;
}
.xm-tree svg { opacity: 1; position: relative; display: block; width: 100%; height: auto; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .45)); }
.xm-tree::before {
  content: '';
  position: absolute;
  inset: -24% -30% 40%;
  z-index: -1;
  background: radial-gradient(closest-side, rgba(255, 212, 121, .55), rgba(255, 212, 121, 0));
  animation: star-glow 2.6s ease-in-out infinite;
}
.t1 { --l: 1.5%; rotate: -2deg; }
.t2 { --r: 1.5%; --s: clamp(58px, 10vmin, 126px); rotate: 3deg; }
@keyframes star-glow { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }

.xm-gifts { z-index: 1; }
.xm-gift {
  position: absolute;
  bottom: var(--b, 2vh);
  left: var(--l, auto);
  right: var(--r, auto);
  width: var(--s, clamp(40px, 8vmin, 86px));
  color: var(--body, #e63946);
  isolation: isolate;
  will-change: transform;
  animation: gift-bob var(--bd, 4.6s) ease-in-out infinite;
}
.xm-gift svg { position: relative; display: block; width: 100%; height: auto; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .4)); }
.xm-gift::before {
  content: '';
  position: absolute;
  inset: -40%;
  z-index: -1;
  background: radial-gradient(closest-side, rgba(255, 212, 121, .32), rgba(255, 212, 121, 0));
  animation: star-glow 3s ease-in-out infinite;
}
.k1 { --l: 8%;  --b: 1.5vh; --body: #e63946; --rib: #ffd479; rotate: -5deg; }
.k2 { --l: 15%; --b: .5vh;  --s: clamp(30px, 5.6vmin, 60px); --body: #2fbf71; --rib: #e63946; rotate: 6deg; --bd: 3.8s; }
.k3 { --r: 8%;  --b: 1.5vh; --body: #4aa8ff; --rib: #fff; rotate: 5deg; --bd: 5s; }
.k4 { --r: 15%; --b: .5vh;  --s: clamp(30px, 5.6vmin, 60px); --body: #ffd479; --rib: #e63946; rotate: -6deg; --bd: 4.1s; }
@keyframes gift-bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -6px; } }

.xm-baubles { z-index: 1; overflow: hidden; }
.xm-bauble {
  position: absolute;
  top: 0;
  left: var(--x);
  width: var(--s, clamp(26px, 4.4vmin, 44px));
  margin-left: calc(var(--s, 36px) / -2);
  color: var(--c, #e63946);
  transform-origin: 50% 0;
  will-change: transform;
  animation: swing var(--d, 4.6s) ease-in-out infinite alternate;
}
.xm-bauble i {
  display: block;
  width: 1.5px;
  height: var(--len, 12vh);
  margin: 0 auto;
  background: linear-gradient(180deg, rgba(255, 255, 255, .15), rgba(255, 255, 255, .7));
}
.xm-bauble svg { display: block; width: 100%; height: auto; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .4)); }
.b1 { --x: 9%;  --len: 12vh; --c: #e63946; --d: 4.4s; }
.b2 { --x: 22%; --len: 6vh;  --c: #4aa8ff; --d: 5.2s; --s: clamp(22px, 3.6vmin, 36px); animation-delay: -1.4s; }
.b3 { --x: 79%; --len: 8vh;  --c: #ffd479; --d: 4.9s; --s: clamp(22px, 3.8vmin, 38px); animation-delay: -2.2s; }
.b4 { --x: 92%; --len: 14vh; --c: #2fbf71; --d: 5.6s; animation-delay: -.8s; }
@keyframes swing {
  from { rotate: -5deg; }
  to   { rotate: 5deg; }
}

.xm-lights { position: absolute; left: 0; right: 0; top: 0; pointer-events: none; }
.xm-lights-splash { z-index: 2; height: clamp(46px, 8vh, 70px); }
.xm-lights svg { display: block; width: 100%; height: 100%; overflow: visible; }
.xm-wire { stroke: rgba(4, 10, 22, .9); stroke-width: 1.6; }
.xm-socket { fill: #1b2b46; }
.xm-bulb.c0 { fill: #ff5a68; }
.xm-bulb.c1 { fill: #5df29a; }
.xm-bulb.c2 { fill: #ffd479; }
.xm-bulb.c3 { fill: #6fb8ff; }
.xm-bulb-glow { animation: bulb-twinkle 1.8s ease-in-out infinite; }
@keyframes bulb-twinkle { 0%, 100% { opacity: .3; } 50% { opacity: 1; } }

.xm-vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 90% at 50% 40%, transparent 55%, rgba(3, 8, 20, .7) 100%),
    linear-gradient(180deg, transparent 62%, rgba(3, 8, 20, .75) 100%);
}

.splash-content {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.splash-sub {
  margin: 0 0 18px;
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(15px, 2.2vw, 22px);
  letter-spacing: .24em;
  color: #e6f3ff;
  text-shadow: 0 0 14px rgba(120, 190, 255, .8), 0 2px 8px rgba(0, 0, 0, .9);
  text-wrap: balance;
  animation: rise-in .7s 1s ease both;
}
.splash-sub span { color: var(--xm-gold); text-shadow: 0 0 12px rgba(255, 212, 121, .9); }
@keyframes rise-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

.enter-btn {
  --mx: 50%;
  --my: 50%;
  appearance: none;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 52px;
  padding: 14px 38px 14px 44px;
  border: 1px solid rgba(255, 226, 160, .85);
  border-radius: 999px;
  background: linear-gradient(135deg, #f0404f 0%, #b3202f 100%);
  color: #fff;
  font-family: var(--display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  text-shadow: 0 1px 6px rgba(60, 0, 8, .6);
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(230, 57, 70, .5), 0 0 0 3px rgba(255, 212, 121, .18), inset 0 1px 0 rgba(255, 255, 255, .35);
  transition: transform .2s var(--ease-out), box-shadow .25s ease, border-color .25s ease;
  animation: rise-in .7s 1.2s ease both;
}
.enter-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(150px circle at var(--mx) var(--my), rgba(255, 255, 255, .4), transparent 70%);
  opacity: 0;
  transition: opacity .25s ease;
}
.enter-btn::after {
  content: '';
  position: absolute;
  top: 0;
  left: -70%;
  z-index: -1;
  width: 45%;
  height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .38), transparent);
  transform: skewX(-18deg);
}
.enter-btn:hover {
  transform: translateY(-3px) scale(1.03);
  border-color: #fff0c2;
  box-shadow: 0 16px 46px rgba(230, 57, 70, .75), 0 0 0 4px rgba(255, 212, 121, .3), inset 0 1px 0 rgba(255, 255, 255, .45);
}
.enter-btn:hover::before { opacity: 1; }
.enter-btn:hover::after { left: 130%; transition: left .7s ease; }
.enter-btn:active { transform: translateY(0) scale(.97); }
.enter-btn:focus-visible { outline: 3px solid var(--xm-gold); outline-offset: 4px; }
.enter-btn-icon { transition: transform .25s var(--ease-out); }
.enter-btn:hover .enter-btn-icon { transform: translateX(6px); }

.splash-foot {
  position: absolute;
  z-index: 3;
  bottom: calc(16px + var(--safe-b));
  left: 0;
  right: 0;
  margin: 0;
  text-align: center;
  font-family: var(--display);
  font-size: 14px;
  letter-spacing: .3em;
  color: rgba(214, 232, 255, .65);
}

.xm-sound-btn {
  appearance: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(255, 226, 160, .5);
  border-radius: 50%;
  background: rgba(6, 16, 38, .6);
  color: #fff0c2;
  cursor: pointer;
  transition: transform .2s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.xm-sound-btn:hover { transform: scale(1.1); border-color: var(--xm-gold); background: rgba(230, 57, 70, .3); box-shadow: 0 0 16px rgba(230, 57, 70, .5); }
.xm-sound-btn .ico-off { display: none; }
.xm-sound-btn[aria-pressed="true"] .ico-on { display: none; }
.xm-sound-btn[aria-pressed="true"] .ico-off { display: block; opacity: .75; }
.splash > .xm-sound-btn { position: absolute; top: calc(14px + var(--safe-t)); right: 14px; z-index: 6; pointer-events: auto; }
.xm-sound-top { flex: none; align-self: center; width: 30px; height: 30px; margin-right: 12px; border-color: var(--border); background: transparent; }

.xm-sound-hint {
  position: absolute;
  top: calc(22px + var(--safe-t));
  right: 66px;
  z-index: 6;
  max-width: calc(100vw - 96px);
  padding: 8px 14px;
  border: 1px solid rgba(255, 226, 160, .55);
  border-radius: 999px;
  background: rgba(6, 16, 38, .72);
  color: #fff0c2;
  font: 600 12px/1.2 var(--ui);
  letter-spacing: .04em;
  pointer-events: none;
  opacity: 0;
  transform: translateX(8px);
  transition: opacity .3s ease, transform .3s ease;
}
.splash.sound-pending .xm-sound-hint { opacity: 1; transform: none; animation: hint-pulse 1.8s ease-in-out infinite; }
.splash.sound-pending #xmSoundSplash { animation: hint-ring 1.8s ease-in-out infinite; }
@keyframes hint-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(230, 57, 70, .4); } 50% { box-shadow: 0 0 18px 2px rgba(230, 57, 70, .5); } }
@keyframes hint-ring  { 0%, 100% { box-shadow: 0 0 0 0 rgba(230, 57, 70, .55); } 50% { box-shadow: 0 0 0 10px rgba(230, 57, 70, 0); } }

.xm-burst {
  position: fixed;
  z-index: 10001;
  left: 0;
  top: 0;
  width: 40px;
  margin: -20px 0 0 -20px;
  pointer-events: none;
}
.xm-burst svg { display: block; width: 100%; height: auto; }

.splash.xm-lite .xm-mist,
.splash.xm-lite .xm-aurora,
.splash.xm-lite .xm-shooters,
.splash.xm-lite .xm-sleigh-lane,
.splash.xm-lite .xm-particles,
.splash.xm-lite .k2, .splash.xm-lite .k4,
.splash.xm-lite .b2, .splash.xm-lite .b3 { display: none; }
.splash.xm-lite .xm-glow, .splash.xm-lite .xm-bulb-glow, .splash.xm-lite .xm-tree::before, .splash.xm-lite .xm-gift::before { animation: none; }

/* Layar potret: gambar dibesarkan supaya logo tetap utuh */
@media (max-aspect-ratio: 4/5) {
  .splash-bg { inset: 0; display: grid; align-items: center; background: linear-gradient(180deg, #063779 0%, #3b7fd5 50%, #1c4a8f 100%); }
  .splash-bg img {
    width: 160vw;
    max-width: none;
    height: auto;
    translate: -30vw 0;
    object-fit: initial;
    -webkit-mask-image: linear-gradient(180deg, transparent, #000 18%, #000 82%, transparent);
            mask-image: linear-gradient(180deg, transparent, #000 18%, #000 82%, transparent);
  }
  .xm-glow { width: 92vw; translate: -50% -50%; }
  .k2, .k4 { display: none; }
  .splash-sub { letter-spacing: .16em; }
  .splash-sub span { display: block; height: 0; font-size: 0; overflow: hidden; }
}
@media (max-width: 600px) {
  .xm-sound-hint { right: 14px; top: calc(66px + var(--safe-t)); }
  .b2, .b3 { display: none; }
}
@media (max-height: 520px) {
  .splash { padding-bottom: calc(40px + var(--safe-b)); }
  .splash-sub { margin-bottom: 10px; }
  .enter-btn { min-height: 44px; padding: 9px 30px 9px 34px; font-size: 18px; }
  .xm-trees, .xm-baubles { display: none; }
}

/* Editor: bar atas */

body {
  background:
    radial-gradient(900px 500px at 8% -10%, rgba(230, 57, 70, .10), transparent 60%),
    var(--bg);
}

.topbar {
  background: linear-gradient(90deg, #0b1830 0%, #14264a 55%, #0b1830 100%);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .35);
  position: relative;
  z-index: 30;
  padding-top: var(--safe-t);
  height: calc(40px + var(--safe-t));
}
.topbar::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 3px;
  pointer-events: none;
  background: repeating-linear-gradient(135deg, var(--xm-red) 0 7px, var(--xm-snow) 7px 14px);
  background-size: 19.8px 100%;
  opacity: .92;
  animation: ribbon 3s linear infinite;
}
@keyframes ribbon { to { background-position: 19.8px 0; } }

.brand {
  position: relative;
  flex: none;
  display: flex;
  align-items: center;
  padding: 0 16px 0 12px;
  margin-right: 4px;
  border-right: 1px solid var(--border-soft);
}
.brand img {
  display: block;
  height: 30px;
  width: auto;
  max-width: none;
  filter: drop-shadow(0 2px 8px rgba(230, 57, 70, .55));
  transition: transform .25s var(--ease-out), filter .25s ease;
}
.brand:hover img { transform: scale(1.08) rotate(-2deg); filter: drop-shadow(0 2px 12px rgba(230, 57, 70, .9)); }
.xm-hat {
  position: absolute;
  left: 7px;
  top: -1px;
  width: 15px;
  height: 12px;
  rotate: -16deg;
  pointer-events: none;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .5));
  transform-origin: 20% 90%;
  animation: hat-wobble 5s ease-in-out infinite;
}
@keyframes hat-wobble { 0%, 100% { rotate: -16deg; } 50% { rotate: -9deg; } }

.xm-topdeco { position: relative; flex: 1 1 0; min-width: 0; align-self: stretch; pointer-events: none; overflow: hidden; }

.tab { overflow: hidden; }
.tab::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  background: linear-gradient(90deg, var(--xm-red), var(--xm-gold));
  transform: scaleX(0);
  transition: transform .25s var(--ease-out);
}
.tab:hover::after, .tab.active::after { transform: scaleX(1); }
.tab:hover { color: #fff; background: rgba(230, 57, 70, .12); }
.tab.active {
  color: #fff;
  background: linear-gradient(180deg, rgba(230, 57, 70, .2), rgba(230, 57, 70, 0) 90%), var(--panel);
}

.selected-server-bar strong { letter-spacing: .06em; }
.change-server-btn:hover { border-color: var(--xm-red); background: rgba(230, 57, 70, .2); color: #fff; transform: translateY(-1px); }

/* Editor: sidebar */

.sidebar,
.layers-sidebar {
  background:
    radial-gradient(420px 260px at 50% -40px, rgba(230, 57, 70, .12), transparent 70%),
    linear-gradient(180deg, #14264a 0, var(--panel) 280px);
}
.sidebar { --sidebar-width: clamp(290px, 24vw, 400px); padding: 12px 0 40px; min-width: min(270px, 100%); }
.layers-sidebar { width: clamp(240px, 20vw, 320px); padding: 0 0 24px; }

details {
  position: relative;
  margin: 0 10px 10px;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(230, 57, 70, .06), rgba(255, 255, 255, .015));
  overflow: hidden;
  transition: border-color .2s ease, box-shadow .25s ease, background .25s ease;
}
details::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 8px;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(circle at 7px 0, var(--xm-snow) 0 5px, transparent 5.6px) 0 0 / 14px 8px repeat-x,
    radial-gradient(circle at 17px 0, rgba(255, 255, 255, .65) 0 3.4px, transparent 4px) 0 0 / 23px 6px repeat-x;
  opacity: .92;
}
details:hover { border-color: var(--border); }
details[open] {
  border-color: rgba(230, 57, 70, .45);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .28), inset 0 1px 0 rgba(255, 138, 147, .12);
}

details > summary {
  gap: 10px;
  min-height: 40px;
  padding: 12px 12px 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
}
details > summary::before { order: 5; margin-left: auto; width: 6px; height: 6px; border-color: var(--text-faint); }
details > summary:hover { background: rgba(230, 57, 70, .1); }
details[open] > summary::before { border-color: var(--xm-gold); }
details[open] > summary { border-bottom: 1px solid var(--border-soft); }

.sum-icon {
  order: -1;
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  color: var(--xm-gold);
  background: linear-gradient(135deg, rgba(47, 191, 113, .28), rgba(47, 191, 113, .08));
  box-shadow: inset 0 0 0 1px rgba(255, 212, 121, .26);
  transition: transform .25s var(--ease-out), background .2s ease, color .2s ease, box-shadow .2s ease;
}
details > summary:hover .sum-icon,
details[open] > summary .sum-icon {
  color: #fff;
  background: linear-gradient(135deg, #e63946, #b3202f);
  box-shadow: 0 4px 12px rgba(230, 57, 70, .45);
}
details > summary:hover .sum-icon { transform: scale(1.1) rotate(-6deg); }

.details-body { padding: 12px 14px 16px; }
details[open] > .details-body { animation: body-in .22s ease both; }
@keyframes body-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: none; }
}

.hint-text {
  margin: 12px 0 0;
  padding: 8px 10px;
  border-left: 2px solid rgba(255, 212, 121, .55);
  border-radius: 0 8px 8px 0;
  background: rgba(255, 255, 255, .03);
}
.layers-sidebar > .hint-text { margin: 4px 10px 10px; }

label.field-label { color: var(--text); font-weight: 600; }
textarea, input[type=text], input[type=number], select { border-radius: 8px; background-color: var(--input); }

.checkbox-row input[type=checkbox] {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 34px;
  height: 20px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background:
    radial-gradient(circle at center, #fff 0 6px, transparent 6.5px) no-repeat 2px center / 13px 13px,
    #1f3763;
  transition: background-color .2s ease, border-color .2s ease, background-position .22s var(--ease-out), box-shadow .2s ease;
}
.checkbox-row input[type=checkbox]:hover { border-color: #5b7bb0; }
.checkbox-row input[type=checkbox]:checked {
  border-color: #6df2a8;
  background:
    radial-gradient(circle at center, #fff 0 6px, transparent 6.5px) no-repeat 17px center / 13px 13px,
    var(--xm-pine);
  box-shadow: 0 0 12px rgba(47, 191, 113, .45);
}
.checkbox-row label { user-select: none; }

input[type=range] { margin: 6px 0 4px; }
input[type=range]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 4px;
  background:
    linear-gradient(90deg, var(--xm-red), var(--xm-gold)) 0 0 / var(--pct, 0%) 100% no-repeat,
    #2a4372;
}
input[type=range]::-moz-range-track { height: 4px; border-radius: 4px; background: #2a4372; }
input[type=range]::-moz-range-progress { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--xm-red), var(--xm-gold)); }
input[type=range]::-webkit-slider-thumb {
  width: 14px;
  height: 14px;
  margin-top: -5px;
  background: #fff;
  box-shadow: 0 0 0 2px var(--xm-red), 0 2px 6px rgba(0, 0, 0, .5);
}
input[type=range]::-moz-range-thumb { width: 12px; height: 12px; background: #fff; border: 2px solid var(--xm-red); }
input[type=range]:hover::-webkit-slider-thumb { box-shadow: 0 0 0 2px var(--xm-red), 0 0 0 7px rgba(230, 57, 70, .25); }
input[type=range]:active::-webkit-slider-thumb { box-shadow: 0 0 0 2px var(--xm-red-hi), 0 0 0 9px rgba(230, 57, 70, .3); transform: scale(1.1); }

.layers-header {
  height: 40px;
  padding: 0 10px 0 0;
  margin-bottom: 10px;
  background: linear-gradient(90deg, #0b1830, #14264a);
  border-bottom: 1px solid var(--xm-navy-950);
}
.layers-header strong { border-bottom-color: var(--xm-red); letter-spacing: .04em; }
.duplicate-btn:hover { border-color: var(--xm-red); background: rgba(230, 57, 70, .22); color: #fff; }
.duplicate-btn:active { transform: scale(.96); }

.layers-list { gap: 6px; padding: 0 10px 10px; border-bottom: 0; }
.layer-item {
  min-height: 54px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: rgba(255, 255, 255, .03);
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.layer-item:last-child { border-bottom: 1px solid var(--border-soft); }
.layer-item:hover { background: rgba(230, 57, 70, .1); border-color: var(--border); }
.layer-item.active {
  background: linear-gradient(90deg, rgba(230, 57, 70, .3), rgba(230, 57, 70, .08));
  border-color: rgba(230, 57, 70, .65);
  box-shadow: inset 3px 0 0 var(--xm-red), 0 6px 16px rgba(0, 0, 0, .25);
}
.layer-thumb { border-radius: 7px; box-shadow: 0 0 0 1px var(--xm-navy-950); }
.layer-visible:checked { background-color: var(--xm-red-hi); }
.layer-name { font-weight: 600; }

.sidebar-panel.active { animation: panel-in .28s ease both; }
@keyframes panel-in { from { opacity: 0; } to { opacity: 1; } }

textarea:hover, input[type=text]:hover, input[type=number]:hover, select:hover { border-color: #4a6796; }
textarea:focus, input[type=text]:focus, input[type=number]:focus, select:focus {
  border-color: var(--xm-gold);
  box-shadow: 0 0 0 3px rgba(255, 212, 121, .2);
}

.btn {
  --mx: 50%;
  --my: 50%;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  transition: transform .18s var(--ease-out), background .18s ease, border-color .18s ease, color .18s ease, box-shadow .2s ease;
}
.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(90px circle at var(--mx) var(--my), rgba(255, 138, 147, .32), transparent 70%);
  opacity: 0;
  transition: opacity .2s ease;
}
.btn:hover { background: #2a4372; border-color: var(--xm-red); transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0, 0, 0, .35); }
.btn:hover::before { opacity: 1; }
.btn:active { transform: translateY(0) scale(.97); background: #1c3158; }
.btn.primary {
  background: linear-gradient(135deg, #ee3e4c, #b3202f);
  border-color: #ff7b86;
  box-shadow: 0 4px 14px rgba(230, 57, 70, .35);
}
.btn.primary:hover { background: linear-gradient(135deg, #ff5260, #c9212f); border-color: #ffb3b9; box-shadow: 0 8px 22px rgba(230, 57, 70, .55); }
.btn.primary:active { background: #a11c2a; }
.btn.accent { box-shadow: 0 0 14px rgba(230, 57, 70, .3); }

.chip { border-color: var(--border); transition: border-color .15s ease, background .15s ease, transform .15s ease; }
.chip:hover { border-color: var(--xm-red); background: rgba(230, 57, 70, .18); transform: translateY(-1px); }

.upload-control { transition: border-color .2s ease, background .2s ease, color .2s ease, box-shadow .2s ease, transform .2s ease; }
.upload-control:hover { box-shadow: 0 0 0 3px rgba(255, 212, 121, .16); transform: translateY(-1px); }
.range-value { border-color: #2c4572; }

/* Editor: stage */

.stage {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background:
    radial-gradient(700px 420px at 85% 0%, rgba(120, 170, 255, .1), transparent 65%),
    var(--bg);
}
.stage-header { background: linear-gradient(90deg, #0b1830, #14264a); }
.stage-header h1 { display: flex; align-items: center; gap: 8px; text-shadow: 0 0 18px rgba(255, 212, 121, .3); }
.stage-header h1::before {
  content: '';
  width: 14px;
  height: 14px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23ffd479' d='M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01z'/%3E%3C/svg%3E") center / contain no-repeat;
  filter: drop-shadow(0 0 5px rgba(255, 212, 121, .8));
  animation: star-glow 2.6s ease-in-out infinite;
}
.stage-canvas {
  margin-left: var(--pad-x);
  max-width: calc(100% - 2 * var(--pad-x));
  box-shadow: 0 0 0 1px var(--xm-navy-950), 0 18px 44px rgba(0, 0, 0, .5), 0 0 0 4px rgba(255, 212, 121, .07);
}

.statusbar { background: linear-gradient(90deg, #0b1830, #14264a); }
.status-cell:first-child { color: var(--xm-gold); font-weight: 600; }
.status-cell:first-child::before {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 7px;
  vertical-align: -3px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%232fbf71' d='M12 2 18 11h-3l4 6H5l4-6H6z'/%3E%3Crect x='10.5' y='17' width='3' height='4' fill='%237a4624'/%3E%3Ccircle cx='10' cy='12' r='1' fill='%23e63946'/%3E%3Ccircle cx='14' cy='15' r='1' fill='%23ffd479'/%3E%3C/svg%3E") center / contain no-repeat;
}

* { scrollbar-color: #34507a transparent; }
::-webkit-scrollbar-thumb { background: #2f4a78; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--xm-red); background-clip: content-box; }

/* Toolbar Maker */

.tools-sidebar {
  position: relative;
  z-index: 6;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 54px;
  padding: 12px 0;
  background:
    radial-gradient(120px 200px at 50% -20px, rgba(230, 57, 70, .14), transparent 70%),
    linear-gradient(180deg, #11224a 0, var(--chrome) 260px);
  border-left: 1px solid var(--xm-navy-950);
  box-shadow: inset 1px 0 0 rgba(255, 138, 147, .06);
}
.tools-sidebar[hidden] { display: none; }

.tool-btn {
  appearance: none;
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: transform .18s var(--ease-out), background .18s ease, border-color .18s ease, color .18s ease, box-shadow .2s ease;
}
.tool-btn svg { transition: transform .22s var(--ease-out); }
.tool-btn:hover { color: #fff; background: rgba(230, 57, 70, .18); border-color: var(--border); transform: translateY(-1px); }
.tool-btn:hover svg { transform: scale(1.12) rotate(-4deg); }
.tool-btn:active { transform: translateY(0) scale(.94); }
.tool-btn.active {
  color: #fff;
  background: linear-gradient(135deg, #ee3e4c, #b3202f);
  border-color: #ff8a93;
  box-shadow: 0 6px 18px rgba(230, 57, 70, .5), inset 0 1px 0 rgba(255, 255, 255, .3);
}
.tool-btn::after {
  content: attr(data-tip) "   " attr(data-key);
  position: absolute;
  right: calc(100% + 12px);
  top: 50%;
  z-index: 60;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #081226;
  color: var(--text);
  font-size: 11.5px;
  font-weight: 600;
  white-space: pre;
  pointer-events: none;
  opacity: 0;
  transform: translate(4px, -50%);
  transition: opacity .15s ease, transform .15s ease;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .45);
}
.tool-btn:hover::after,
.tool-btn:focus-visible::after { opacity: 1; transform: translate(0, -50%); transition-delay: .25s; }

/* Navigasi bawah (hanya tampil di mode mobile, lihat layout.js) */

.xm-mnav { display: none; }

/* Tablet */

@media (max-width: 1100px) {
  .sidebar { --sidebar-width: clamp(260px, 32vw, 340px); }
  .stage-header p { display: none; }
}

/* Mode mobile: satu panel penuh per tampilan, dipilih lewat navigasi bawah */

html[data-layout="mobile"] .topbar {
  height: calc(48px + var(--safe-t));
  padding: var(--safe-t) 6px 0 0;
  overflow: visible;
}
html[data-layout="mobile"] .brand { padding: 0 10px 0 12px; margin-right: 0; }
html[data-layout="mobile"] .brand img { height: 26px; }
html[data-layout="mobile"] .xm-hat { left: 9px; top: 7px; }
html[data-layout="mobile"] .xm-topdeco { display: none; }
html[data-layout="mobile"] .tabs { flex: 1 1 auto; min-width: 0; }
html[data-layout="mobile"] .tab { flex: 1 1 auto; min-width: 0; padding: 0 6px; font-size: 12px; white-space: nowrap; }
html[data-layout="mobile"] .xm-sound-top { width: 36px; height: 36px; margin: 0 2px; }
html[data-layout="mobile"] .selected-server-bar { margin-left: 0; gap: 0; }
html[data-layout="mobile"] .selected-server-bar::before,
html[data-layout="mobile"] .selected-server-bar strong { display: none; }
html[data-layout="mobile"] .change-server-btn { min-height: 36px; padding: 0 10px; }

html[data-layout="mobile"] .workspace { position: relative; flex-direction: column; overflow: hidden; }
html[data-layout="mobile"] .sidebar-resizer { display: none; }
html[data-layout="mobile"] .workspace > .sidebar,
html[data-layout="mobile"] .workspace > .stage,
html[data-layout="mobile"] .workspace > .layers-sidebar,
html[data-layout="mobile"] .workspace > .tools-sidebar {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  max-height: none;
  border: 0;
  visibility: hidden;
  pointer-events: none;
}
html[data-layout="mobile"] .workspace[data-mview="controls"] > .sidebar,
html[data-layout="mobile"] .workspace[data-mview="preview"] > .stage,
html[data-layout="mobile"] .workspace[data-mview="layers"] > .layers-sidebar {
  position: relative;
  inset: auto;
  flex: 1 1 0;
  visibility: visible;
  pointer-events: auto;
  animation: panel-in .25s ease both;
}
html[data-layout="mobile"] .workspace[data-mview="preview"] > .tools-sidebar {
  position: relative;
  inset: auto;
  flex: none;
  width: 100%;
  height: auto;
  visibility: visible;
  pointer-events: auto;
  flex-direction: row;
  justify-content: center;
  gap: 10px;
  padding: 8px 12px;
  border-top: 1px solid var(--xm-navy-950);
}
html[data-layout="mobile"] .tool-btn { width: 44px; height: 44px; }
html[data-layout="mobile"] .tool-btn::after { display: none; }
html[data-layout="mobile"] .sidebar { padding-top: 10px; }
html[data-layout="mobile"] details { margin: 0 8px 10px; }
html[data-layout="mobile"] .stage { gap: 16px; padding-bottom: 16px; }
html[data-layout="mobile"] .stage-header { height: 40px; }
html[data-layout="mobile"] .stage-canvas { --pad-x: 10px; padding: 12px; }

html[data-layout="mobile"] .statusbar { height: 26px; font-size: 11px; }
html[data-layout="mobile"] .status-cell { padding: 0 10px; }
html[data-layout="mobile"] #statusServer { display: none; }

html[data-layout="mobile"] .xm-mnav:not([hidden]) {
  position: relative;
  flex: none;
  display: flex;
  gap: 6px;
  padding: 8px 10px calc(8px + var(--safe-b));
  background: linear-gradient(180deg, #0f1c33, #0b1830);
  border-top: 1px solid var(--xm-navy-950);
}
html[data-layout="mobile"] .xm-mnav::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: -1px;
  height: 3px;
  background: repeating-linear-gradient(135deg, var(--xm-red) 0 7px, var(--xm-snow) 7px 14px);
  opacity: .9;
}
.xm-mnav-btn {
  appearance: none;
  flex: 1 1 0;
  min-width: 0;
  min-height: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--text-dim);
  font: 600 11px/1.1 var(--ui);
  cursor: pointer;
  transition: background .18s ease, color .18s ease, transform .15s ease, box-shadow .2s ease;
}
.xm-mnav-btn[hidden] { display: none; }
.xm-mnav-btn:active { transform: scale(.96); }
.xm-mnav-btn[aria-pressed="true"] {
  color: #fff;
  background: linear-gradient(135deg, #ee3e4c, #b3202f);
  border-color: #ff8a93;
  box-shadow: 0 6px 16px rgba(230, 57, 70, .4), inset 0 1px 0 rgba(255, 255, 255, .25);
}

@media (max-height: 480px) {
  html[data-layout="mobile"] .xm-mnav:not([hidden]) { padding-top: 5px; padding-bottom: calc(5px + var(--safe-b)); }
  html[data-layout="mobile"] .xm-mnav-btn { flex-direction: row; gap: 8px; min-height: 38px; font-size: 12px; }
  html[data-layout="mobile"] .topbar { height: calc(42px + var(--safe-t)); }
}

/* Layar sentuh: target 44px dan font input 16px agar iOS tidak auto-zoom */

html[data-pointer="coarse"] textarea,
html[data-pointer="coarse"] input[type=text],
html[data-pointer="coarse"] input[type=number],
html[data-pointer="coarse"] select { font-size: 16px; }
html[data-pointer="coarse"] .btn { min-height: 40px; }
html[data-pointer="coarse"] details > summary { min-height: 46px; }
html[data-pointer="coarse"] .chip { min-height: 34px; }
html[data-pointer="coarse"] input[type=range]::-webkit-slider-runnable-track { height: 6px; }
html[data-pointer="coarse"] input[type=range]::-webkit-slider-thumb { width: 24px; height: 24px; margin-top: -9px; }
html[data-pointer="coarse"] input[type=range]::-moz-range-thumb { width: 20px; height: 20px; }
html[data-pointer="coarse"] .checkbox-row input[type=checkbox] { width: 42px; height: 24px; background-size: 16px 16px; }
html[data-pointer="coarse"] .checkbox-row input[type=checkbox]:checked { background-position: 21px center; }

.xm-app-snow {
  position: fixed;
  inset: 0;
  z-index: 24;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .splash-bg img, .xm-glow, .xm-aurora, .xm-mist, .xm-shooters i, .xm-sleigh, .xm-gift, .xm-gift::before,
  .xm-tree::before, .xm-bauble, .xm-bulb-glow, .enter-btn, .topbar::after, .xm-hat, .splash-sub,
  .stage-header h1::before { animation: none !important; }
  .xm-shooters, .xm-sleigh-lane, .xm-particles, .xm-app-snow { display: none; }
  .splash, .splash-bg img { transition: none !important; }
}
