/* Loomys Match Maker - UI stylesheet
   Dark-purple gradient theme, high contrast, modern glassy surfaces.
   Written from scratch for this build. */
:root {
  --bg0: #0c0517;
  --bg1: #1a0e35;
  --bg2: #2e1863;
  --panel: #2b1a54;
  --panel2: #3b2480;
  --glass: rgba(255, 255, 255, .07);
  --line: rgba(196, 168, 255, .28);
  --gold: #ffce46;
  --gold-d: #c8870f;
  --violet: #a877ff;
  --pink: #ff5fa8;
  --text: #ffffff;
  --muted: #c9baf2;
  --green: #5fe08a;
  --red: #ff6b7f;
  --shadow: 0 14px 34px rgba(6, 2, 18, .55);
  --r: 18px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; height: 100%;
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(140% 70% at 50% -15%, #5b31b8 0%, rgba(91, 49, 184, 0) 55%),
    radial-gradient(100% 60% at 100% 100%, #47209a 0%, rgba(71, 32, 154, 0) 60%),
    linear-gradient(180deg, var(--bg2) 0%, var(--bg1) 45%, var(--bg0) 100%);
  background-attachment: fixed;
  overscroll-behavior: none;
  -webkit-user-select: none; user-select: none;
  touch-action: manipulation;
}
button { font-family: inherit; cursor: pointer; }

#app { position: fixed; inset: 0; overflow: hidden; }

/* ---------------- screens ---------------- */
.screen {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  opacity: 0; visibility: hidden; transform: translateY(14px);
  transition: opacity .28s ease, transform .28s ease, visibility .28s;
}
.screen.active { opacity: 1; visibility: visible; transform: none; }

/* ---------------- top bar ---------------- */
.topbar {
  display: flex; align-items: center; gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 10px 8px;
  background: linear-gradient(180deg, rgba(20, 8, 44, .92), rgba(20, 8, 44, .55));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 6px 22px rgba(8, 3, 22, .5);
  z-index: 5;
}
.logo {
  display: flex; align-items: center; gap: 8px;
  flex: 1 1 auto; min-width: 0;
}
.bar-logo {
  width: 32px; height: 32px; flex: 0 0 auto;
  object-fit: cover; border-radius: 10px;
  border: 2px solid var(--gold);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .5), 0 0 0 1px rgba(255, 255, 255, .25);
}
.logo-text {
  font-weight: 800; font-size: 15px; letter-spacing: .2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: linear-gradient(90deg, #ffffff 10%, var(--gold) 95%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

.wallet { display: flex; gap: 6px; flex: 0 0 auto; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .14), rgba(255, 255, 255, .05));
  border: 1px solid rgba(255, 255, 255, .26);
  border-radius: 999px; padding: 5px 10px; font-size: 13px; font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25);
}
.chip b { font-weight: 800; }
.chip:nth-child(1) { color: #ffe9a3; }
.chip.coins { color: #ffe08a; }
.chip.hearts { color: #ff9db0; }

.tools { display: flex; gap: 6px; flex: 0 0 auto; }
.tbtn {
  width: 38px; height: 38px; border-radius: 13px;
  border: 1.5px solid rgba(255, 255, 255, .55);
  background: linear-gradient(180deg, rgba(255, 255, 255, .3), rgba(255, 255, 255, .1));
  color: #fff; font-size: 17px; font-weight: 800;
  display: grid; place-items: center; padding: 0;
  box-shadow: 0 4px 12px rgba(8, 3, 22, .45), inset 0 1px 0 rgba(255, 255, 255, .35);
  transition: transform .12s ease, filter .15s ease;
}
.tbtn:hover { filter: brightness(1.15); }
.tbtn:active { transform: scale(.93); }
.tbtn.off { opacity: .5; }

/* ---------------- landing background ----------------
   Sharp artwork, never blurred. Picked by screen shape:
   portrait (phone) -> 9x16, wide/horizontal -> 16x9, square -> 1x1
   (each rule stacks the next image behind it, so a file that has not been
   dropped in yet simply falls through to the wide one). */
.landing-bg {
  position: absolute; inset: 0; z-index: 0;
  background-image: url("../art/Landing-Page-background-9x16.jpg");
  background-size: cover;
  background-position: center 30%;
  background-repeat: no-repeat;
  image-rendering: auto;
  filter: none;
}
@media (min-aspect-ratio: 1/1) {
  .landing-bg { background-image: url("../art/Landing-Page-background-16x9.jpg"); }
}
@media (min-aspect-ratio: 99/100) and (max-aspect-ratio: 100/99) {
  .landing-bg { background-image: url("../art/Landing-Page-background-1x1.jpg"),
                              url("../art/Landing-Page-background-16x9.jpg"); }
}
.landing-scrim {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(180deg,
    rgba(10, 4, 22, .38) 0%, rgba(10, 4, 22, .10) 20%,
    rgba(10, 4, 22, 0) 55%, rgba(10, 4, 22, .18) 88%, rgba(10, 4, 22, .3) 100%);
}
#screen-map .topbar { position: relative; z-index: 5; }
#screen-map .map-scroll { position: relative; z-index: 2; }
.map-scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 12px 14px 44px; }
.map-head { text-align: center; padding: 8px 6px 8px; }
.hero {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  margin-bottom: 6px;
}
.hero-logo {
  width: clamp(56px, 15vw, 84px); height: auto;
  border-radius: 18px;
  border: 3px solid var(--gold);
  background: #150a2c;
  box-shadow: 0 10px 26px rgba(255, 201, 70, .4), 0 0 0 1.5px rgba(255, 255, 255, .3),
              inset 0 0 0 1px rgba(0, 0, 0, .5);
  animation: floaty 4s ease-in-out infinite;
}
@keyframes floaty { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-6px) rotate(2deg); } }
.map-head h1 {
  margin: 0; font-size: clamp(26px, 7vw, 38px); font-weight: 900; letter-spacing: .5px;
  background: linear-gradient(90deg, #ffffff 5%, #ffd76a 55%, var(--pink) 115%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  text-shadow: 0 3px 14px rgba(8, 3, 22, .95), 0 6px 30px rgba(255, 95, 168, .3);
}
.map-head p { margin: 4px 0 14px; color: #efe7ff; font-size: 14px; font-weight: 600;
  text-shadow: 0 2px 10px rgba(8, 3, 22, .95); }
.hero-character {
  display: flex; align-items: center; justify-content: center; gap: 11px;
  margin: 8px 0 13px;
}
.hero-king {
  width: clamp(56px, 15vw, 74px); height: auto; flex: 0 0 auto;
  border-radius: 50%; border: 3px solid var(--gold);
  background: #2a1656;
  box-shadow: 0 10px 22px rgba(0, 0, 0, .6), 0 0 0 1.5px rgba(255, 255, 255, .3);
  animation: floaty 4.5s ease-in-out infinite;
}
.hero-bubble {
  position: relative;
  background: rgba(6, 2, 18, .72);
  border: 1.5px solid rgba(255, 206, 70, .75);
  color: #fff; font-size: 13.5px; font-weight: 700; line-height: 1.35;
  padding: 9px 14px; border-radius: 16px;
  max-width: 62%; text-align: left;
  box-shadow: 0 8px 18px rgba(4, 1, 14, .5);
  backdrop-filter: blur(4px);
}
.hero-bubble::before {
  content: ""; position: absolute; left: -9px; top: 50%;
  transform: translateY(-50%);
  border: 8px solid transparent;
  border-right-color: rgba(255, 206, 70, .9);
}
.hero-art {
  max-width: 480px; margin: 0 auto 14px;
  height: clamp(112px, 23vw, 158px);
  border-radius: 22px; overflow: hidden;
  border: 2px solid var(--line);
  background: #1a0e35 url("../art/landing-hero.png") center 45% / cover no-repeat;
  box-shadow: var(--shadow), inset 0 -40px 60px rgba(10, 4, 24, .55);
}
.sheet-king {
  display: block; width: 76px; height: 76px;
  margin: 0 auto 6px; border-radius: 50%;
  object-fit: cover; border: 3px solid var(--gold);
  box-shadow: 0 10px 22px rgba(0, 0, 0, .55), 0 0 0 1.5px rgba(255, 255, 255, .3);
}
.versions { margin-top: 16px; }
.ver-label {
  display: block; font-size: 12px; font-weight: 800; letter-spacing: 1.4px;
  text-transform: uppercase; color: #ffffff;
  text-shadow: 0 2px 8px rgba(8, 3, 22, .95); margin-bottom: 8px;
}
.ver-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.chip-btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: #180a33; color: #fff;
  border: 2px solid rgba(255, 255, 255, .75);
  border-radius: 999px; padding: 10px 16px;
  font-size: 13.5px; font-weight: 800; text-decoration: none;
  box-shadow: 0 8px 18px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .25);
  transition: transform .12s ease, background .15s ease;
}
.chip-btn:hover { background: #2a1656; transform: translateY(-2px); color: #fff; }
.chip-btn.web { background: #14432a; border-color: #7dffb0; }
.chip-btn.web:hover { background: #1b6a3f; }
.chip-btn.android { background: #180a33; border-color: var(--gold); }
.chip-btn.android:hover { background: #2a1656; }
.chip-btn.ios { background: #0f1e3d; border-color: #9ecbff; }
.chip-btn.ios:hover { background: #16305e; }

.progress {
  height: 16px; border-radius: 999px; overflow: hidden;
  background: rgba(255, 255, 255, .16);
  border: 1.5px solid rgba(255, 255, 255, .45);
  max-width: 360px; margin: 0 auto;
  box-shadow: inset 0 3px 8px rgba(0, 0, 0, .6);
}
#map-progress {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--pink), var(--gold));
  transition: width .6s cubic-bezier(.2, .8, .2, 1);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .6), 0 0 14px rgba(255, 206, 70, .5);
}
.progress-label { font-size: 13px; color: #efe7ff; font-weight: 700; margin-top: 7px; text-shadow: 0 2px 6px rgba(0, 0, 0, .6); }

.reset-btn {
  margin-top: 12px;
  border: 2px solid #241046;
  background: #fff6e6;              /* light pill, dark label reads on any artwork */
  color: #2a1656;                   /* dark purple label */
  font-weight: 800; font-size: 13.5px;
  border-radius: 999px; padding: 9px 18px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, .45);
  transition: all .15s ease;
}
.reset-btn:hover { background: #ffffff; color: #180a33; transform: translateY(-1px); }
.reset-btn.armed {
  background: linear-gradient(180deg, #ff5f7a, #d81f45);
  border-color: #ffffff; color: #ffffff;
  box-shadow: 0 8px 20px rgba(216, 31, 69, .6);
}

#level-path { position: relative; max-width: 470px; margin: 4px auto 0; padding-bottom: 10px; }
#level-path::before {
  content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 7px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, rgba(255, 206, 70, .85), rgba(255, 95, 168, .35));
  border-radius: 999px;
  box-shadow: 0 0 14px rgba(255, 206, 70, .45);
}
.node-row { position: relative; display: flex; margin: 11px 0; min-height: 76px; }
.node-row.left { justify-content: flex-start; padding-left: 5%; }
.node-row.right { justify-content: flex-end; padding-right: 5%; }
.node-row.current .node {
  box-shadow: 0 0 0 4px rgba(255, 206, 70, .4), 0 14px 28px rgba(255, 140, 40, .28);
  animation: bob 1.6s ease-in-out infinite;
}
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }

.node {
  position: relative; width: 104px; min-height: 78px;
  border-radius: 22px; border: 2px solid rgba(255, 255, 255, .3);
  background: linear-gradient(180deg, #6f47d6, #4a2ba3);
  color: #fff; padding: 9px 6px 7px; text-align: center;
  box-shadow: var(--shadow), inset 0 2px 0 rgba(255, 255, 255, .3);
  transition: transform .14s ease, filter .15s ease;
}
.node:hover:not(:disabled) { transform: translateY(-3px); filter: brightness(1.1); }
.node .n { display: block; font-size: 21px; font-weight: 900; line-height: 1.1; }
.node .t { display: block; font-size: 11px; color: #efe8ff; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .9; }
.node .s { display: block; margin-top: 5px; font-size: 14px; color: #7a63c4; letter-spacing: 2px; }
.node .s .on { color: var(--gold); text-shadow: 0 0 10px rgba(255, 206, 70, .7); }
.node.locked {
  background: linear-gradient(180deg, #2f1c5e, #241448);
  border-color: rgba(178, 148, 255, .4);
  color: #d9cdff;
}
.node.locked .n { color: #cfc1ff; }
.node.locked .t { color: #a996e6; }
.node.locked .s { color: #9078db; }
.node.open { background: linear-gradient(180deg, #7d55e6, #5431b8); border-color: var(--gold); }
.node.done { background: linear-gradient(180deg, #8a5ce8, #5b34c4); }
.node .lock {
  position: absolute; top: -11px; left: -7px; font-size: 13px;
  background: rgba(6, 2, 18, .9);
  border: 1.5px solid rgba(178, 148, 255, .6);
  border-radius: 999px; width: 26px; height: 26px;
  display: grid; place-items: center;
  box-shadow: 0 6px 14px rgba(0, 0, 0, .5);
}
.node .badge {
  position: absolute; top: -10px; right: -7px; font-size: 10px;
  background: linear-gradient(180deg, #ff6b7f, #e02b4e);
  border: 1.5px solid #ffd0da;
  border-radius: 999px; padding: 3px 8px; font-weight: 900; letter-spacing: .5px;
  box-shadow: 0 6px 14px rgba(224, 43, 78, .5);
}
.map-foot { text-align: center; color: var(--muted); font-size: 12.5px; padding: 16px 20px 0; font-weight: 600; }

/* ---------------- game screen ---------------- */
.hud {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 10px 8px;
  background: linear-gradient(180deg, rgba(20, 8, 44, .92), rgba(20, 8, 44, .45));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 4;
}
.hud-left { min-width: 0; }
.lvl-badge { font-size: 12.5px; color: var(--muted); font-weight: 700; }
.lvl-badge b { color: var(--gold); }
#hud-objectives { display: flex; gap: 8px; margin-top: 5px; flex-wrap: wrap; }
.obj {
  display: flex; align-items: center; gap: 6px;
  background: rgba(6, 2, 18, .6);
  border: 1.5px solid rgba(255, 255, 255, .3);
  border-radius: 13px; padding: 5px 9px; font-size: 13.5px; font-weight: 700;
  box-shadow: 0 6px 14px rgba(4, 1, 12, .5), inset 0 1px 0 rgba(255, 255, 255, .14);
}
.obj .ic { width: 20px; height: 20px; border-radius: 7px; display: grid; place-items: center; font-size: 12px; box-shadow: inset 0 -2px 4px rgba(0, 0, 0, .45); }
.obj.done { border-color: var(--green); background: rgba(18, 84, 50, .55); box-shadow: 0 0 14px rgba(95, 224, 138, .35); }
.obj .cnt { font-weight: 900; }
.obj.done .cnt { color: var(--green); }

.hud-right { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.moves {
  min-width: 66px; text-align: center;
  background: linear-gradient(180deg, #ffe27e, #ffab2e);
  color: #43270a; border-radius: 16px; padding: 5px 9px;
  border: 2.5px solid #fff4d2;
  box-shadow: 0 8px 20px rgba(255, 140, 40, .45), inset 0 2px 0 rgba(255, 255, 255, .7);
}
.moves b { display: block; font-size: 24px; line-height: 1; font-weight: 900; }
.moves span { font-size: 9.5px; font-weight: 900; text-transform: uppercase; letter-spacing: 1.4px; }
.moves.low { animation: lowPulse .7s ease-in-out infinite; }
.moves.low b { color: #b21f1f; }
@keyframes lowPulse { 50% { transform: scale(1.06); box-shadow: 0 0 22px rgba(255, 107, 127, .8); } }
.score-chip {
  font-size: 13.5px; color: #ffe9a3; font-weight: 800;
  background: rgba(6, 2, 18, .6); border: 1.5px solid rgba(255, 255, 255, .28);
  padding: 6px 11px; border-radius: 999px;
}

#board-wrap { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
#board { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

#booster-bar {
  position: relative; z-index: 3;
  display: flex; gap: 9px; justify-content: center; flex-wrap: wrap;
  padding: 8px 10px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(12, 5, 23, 0), rgba(12, 5, 23, .85) 55%);
}
.boost {
  position: relative; width: 56px; height: 56px; border-radius: 18px;
  border: 2px solid rgba(255, 255, 255, .38);
  background: linear-gradient(180deg, #754ee0, #4a2ba3);
  color: #fff; font-size: 23px; padding: 0;
  display: grid; place-items: center;
  box-shadow: 0 8px 18px rgba(6, 2, 18, .55), inset 0 2px 0 rgba(255, 255, 255, .35);
  transition: transform .12s ease, box-shadow .15s ease;
}
.boost:hover { transform: translateY(-2px); }
.boost .cnt {
  position: absolute; bottom: -8px; right: -8px;
  min-width: 23px; height: 23px; padding: 0 5px;
  border-radius: 999px; background: var(--gold); color: #43270a;
  font-size: 12.5px; font-weight: 900; display: grid; place-items: center;
  border: 2.5px solid #2a1656;
}
.boost.empty { opacity: .45; filter: grayscale(.5); }
.boost.armed {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(255, 206, 70, .35), 0 10px 22px rgba(255, 140, 40, .4);
  transform: translateY(-4px);
}
.boost:active { transform: scale(.94); }

/* ---------------- castle ---------------- */
.castle-scroll { flex: 1; overflow-y: auto; padding: 16px 14px 44px; }
.room {
  max-width: 540px; margin: 0 auto 16px;
  background: linear-gradient(180deg, rgba(63, 40, 130, .95), rgba(40, 24, 84, .95));
  border: 1.5px solid var(--line);
  border-radius: 22px; padding: 15px; box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}
.room-head { display: flex; align-items: center; gap: 11px; }
.room-emoji { font-size: 32px; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .5)); }
.room-name { font-weight: 900; font-size: 16.5px; }
.room-state { font-size: 12.5px; color: var(--muted); font-weight: 700; }
.room.done .room-state { color: var(--green); }
.room-bar { height: 12px; border-radius: 999px; background: rgba(4, 1, 12, .6); margin: 11px 0; overflow: hidden; border: 1px solid rgba(255, 255, 255, .22); }
.room-bar > div { height: 100%; background: linear-gradient(90deg, var(--pink), var(--gold)); transition: width .5s; box-shadow: inset 0 2px 0 rgba(255, 255, 255, .5); }
.task {
  display: flex; align-items: center; gap: 10px;
  background: rgba(6, 2, 18, .45); border: 1.5px solid rgba(255, 255, 255, .16);
  border-radius: 14px; padding: 10px 11px; margin-top: 9px;
}
.task .label { flex: 1; font-size: 14px; font-weight: 600; }
.task .cost { font-size: 13px; color: var(--gold); font-weight: 900; white-space: nowrap; }
.task button {
  border: 0; border-radius: 12px; padding: 8px 14px; font-weight: 900; font-size: 13.5px;
  background: linear-gradient(180deg, #ffe27e, #ffab2e); color: #43270a;
  box-shadow: 0 6px 14px rgba(255, 140, 40, .4), inset 0 2px 0 rgba(255, 255, 255, .6);
  transition: transform .12s ease;
}
.task button:hover:not(:disabled) { transform: translateY(-2px); }
.task button:disabled { background: #3a2f66; color: #9c8ed6; box-shadow: none; cursor: default; }
.task.done { border-color: rgba(95, 224, 138, .65); }
.task.done .label { color: var(--muted); text-decoration: line-through; }

/* ---------------- modals ---------------- */
.modal {
  position: absolute; inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
  background: rgba(10, 4, 24, .74);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0; visibility: hidden; transition: opacity .25s ease, visibility .25s;
}
.modal.open { opacity: 1; visibility: visible; }
.sheet {
  width: min(430px, 100%);
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(168, 119, 255, .35), rgba(168, 119, 255, 0) 60%),
    linear-gradient(180deg, #3d2685, #2a1a5c);
  border: 2px solid rgba(255, 255, 255, .3);
  border-radius: 26px; padding: 20px;
  box-shadow: 0 30px 60px rgba(4, 1, 14, .7), inset 0 2px 0 rgba(255, 255, 255, .25);
  transform: translateY(16px) scale(.97); transition: transform .25s ease;
  max-height: 92vh; overflow-y: auto;
}
.modal.open .sheet { transform: none; }
.sheet-head { text-align: center; margin-bottom: 12px; }
.sheet-level { font-size: 26px; font-weight: 900; }
.sheet-sub { font-size: 13.5px; color: var(--muted); font-weight: 600; }

.obj-list { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 10px; }
.moves-badge {
  text-align: center; font-size: 13.5px; color: var(--muted); font-weight: 700;
  background: rgba(6, 2, 18, .5); border: 1.5px solid rgba(255, 255, 255, .22);
  border-radius: 999px; padding: 7px 16px;
  display: table; margin: 0 auto 14px;
}
.moves-badge b { color: var(--gold); font-size: 17px; }

.pre-block { margin-bottom: 6px; }
.pre-label { text-align: center; font-size: 12.5px; color: var(--muted); margin-bottom: 9px; font-weight: 600; }
.pre-label span { opacity: .8; }
.pre-boosters { display: flex; gap: 9px; justify-content: center; }
.pre-boosters .boost { width: 52px; height: 52px; }

.sheet-actions { display: flex; gap: 10px; margin-top: 16px; }
.sheet-actions.col { flex-direction: column; }
.btn {
  flex: 1; border: 0; border-radius: 16px; padding: 14px 15px;
  font-size: 15.5px; font-weight: 900; letter-spacing: .2px;
  transition: transform .12s ease, filter .15s, box-shadow .15s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.97); }
.btn.primary {
  background: linear-gradient(180deg, #ffe27e, #ffab2e);
  color: #43270a;
  box-shadow: 0 10px 22px rgba(255, 140, 40, .45), inset 0 2px 0 rgba(255, 255, 255, .7);
}
.btn.gold {
  background: linear-gradient(180deg, #7d55e6, #5330b6);
  color: #fff;
  box-shadow: 0 10px 22px rgba(80, 44, 180, .55), inset 0 2px 0 rgba(255, 255, 255, .3);
}
.btn.ghost {
  background: rgba(255, 255, 255, .1);
  color: #fff; border: 1.5px solid rgba(255, 255, 255, .32);
}
.btn:disabled { filter: grayscale(.6) brightness(.7); cursor: default; }

.confetti-line {
  text-align: center; font-weight: 900; letter-spacing: 2.5px; font-size: 17px;
  background: linear-gradient(90deg, #fff, var(--gold));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.confetti-line.bad {
  background: linear-gradient(90deg, #fff, var(--red));
  -webkit-background-clip: text; background-clip: text;
}
.stars-row { display: flex; justify-content: center; gap: 14px; margin: 16px 0 6px; }
.big-star {
  font-size: 58px; color: #55409e; text-shadow: 0 5px 0 rgba(0, 0, 0, .4);
  transform: scale(.7); transition: transform .4s cubic-bezier(.2, 1.6, .4, 1), color .4s;
}
.big-star.on { color: var(--gold); transform: scale(1); text-shadow: 0 0 26px rgba(255, 206, 70, .8), 0 5px 0 rgba(0, 0, 0, .4); }
.win-score { text-align: center; color: var(--muted); font-size: 14.5px; font-weight: 600; }
.win-score b { color: #fff; font-size: 19px; }
.rewards { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.reward {
  background: rgba(6, 2, 18, .5); border: 1.5px solid rgba(255, 206, 70, .55);
  border-radius: 14px; padding: 8px 12px; font-size: 13.5px; color: #ffe9a3; font-weight: 800;
}
.fail-text { text-align: center; color: var(--muted); font-size: 14.5px; margin: 10px 0; font-weight: 600; }
.fail-note { text-align: center; font-size: 12.5px; color: var(--muted); margin-top: 12px; }

.help-list { margin: 6px 0 4px; padding-left: 18px; font-size: 14px; line-height: 1.6; color: #e8e1ff; }
.help-list li { margin-bottom: 8px; }
.help-list b { color: var(--gold); }

/* ---------------- toast ---------------- */
#toast {
  position: absolute; left: 50%; bottom: 92px; transform: translate(-50%, 20px);
  background: linear-gradient(180deg, #4a2ba3, #33206e);
  border: 1.5px solid rgba(255, 206, 70, .7);
  color: #fff; padding: 11px 18px; border-radius: 999px;
  font-size: 14px; font-weight: 800; z-index: 60;
  opacity: 0; visibility: hidden;
  transition: opacity .25s, transform .25s, visibility .25s;
  box-shadow: 0 14px 30px rgba(4, 1, 14, .7);
  white-space: nowrap; max-width: 92vw; overflow: hidden; text-overflow: ellipsis;
}
#toast.show { opacity: 1; visibility: visible; transform: translate(-50%, 0); }

/* ---------------- small screens ---------------- */
@media (max-width: 420px) {
  .logo-text { font-size: 13.5px; }
  .bar-logo { width: 28px; height: 28px; }
  .chip { padding: 4px 8px; font-size: 12px; }
  .tbtn { width: 34px; height: 34px; font-size: 15px; }
  .moves b { font-size: 21px; }
  .node { width: 92px; }
  .hero { gap: 10px; }
}
@media (min-width: 900px) {
  .map-scroll, .castle-scroll { max-width: 740px; margin: 0 auto; width: 100%; }
}
