/* Trick or Draw — game-specific styles on top of the shared kit.css */
html, body { background: #1a0f40; }
.pill { background: rgba(26, 10, 60, 0.6); border-color: rgba(255, 255, 255, 0.18); }
.icon-btn { background: rgba(26, 10, 60, 0.6); border-color: rgba(255, 255, 255, 0.18); }
.candy-ic {
  display: inline-block; width: 1.25em; height: 1.25em; flex: none; border-radius: 50%;
  background: radial-gradient(circle at 36% 32%, #fff 0 14%, #ff7ab8 15% 52%, #e0377a 53% 100%);
  box-shadow: inset 0 -2px 0 rgba(120, 0, 50, 0.35), 0 1px 2px rgba(0, 0, 0, 0.3);
  position: relative;
}
.candy-ic::before, .candy-ic::after {
  content: ''; position: absolute; top: 28%; width: 38%; height: 44%; background: #ff4d8d;
  clip-path: polygon(0 50%, 100% 0, 100% 100%);
}
.candy-ic::before { left: -30%; transform: scaleX(-1); clip-path: polygon(0 0, 100% 50%, 0 100%); }
.candy-ic::after { right: -30%; clip-path: polygon(100% 0, 0 50%, 100% 100%); }

/* ---------- in-night HUD ---------- */
.hud-left { display: flex; flex-direction: column; align-items: flex-start; gap: calc(6px * var(--u)); }
.lanterns { display: flex; gap: calc(3px * var(--u)); padding-left: calc(4px * var(--u)); }
.lantern {
  width: calc(26px * var(--u)); height: calc(24px * var(--u)); border-radius: 46% 46% 42% 42%;
  background: radial-gradient(circle at 50% 55%, #ffe680 0 18%, #ff9f2e 40%, #e0640e 100%);
  box-shadow: 0 0 calc(10px * var(--u)) rgba(255, 170, 60, 0.7), inset 0 -2px 0 rgba(120, 40, 0, 0.35);
  position: relative; transition: filter 0.4s, box-shadow 0.4s, transform 0.3s;
}
.lantern::before { content: ''; position: absolute; left: 44%; top: -18%; width: 12%; height: 26%; background: #4f6f25; border-radius: 2px; }
.lantern.out { filter: grayscale(1) brightness(0.45); box-shadow: none; transform: scale(0.88); }
.lantern.pop { animation: lanternOut 0.6s ease; }
@keyframes lanternOut { 30% { transform: scale(1.4) rotate(-12deg); filter: brightness(2); } }
.hud-mid {
  position: absolute; left: 50%; top: 0; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: calc(5px * var(--u)); pointer-events: none;
}
.night-name { font-weight: 700; font-size: calc(17px * var(--u)); text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35); white-space: nowrap; }
.night-bar { width: calc(170px * var(--u)); height: calc(10px * var(--u)); border-radius: 99px; overflow: hidden; background: rgba(255, 255, 255, 0.16); border: 2px solid rgba(255, 255, 255, 0.15); }
.night-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #b98cff, #ffd23f); transition: width 0.3s; }
@media (max-width: 560px) { .hud-mid { top: calc(54px * var(--u)); } }

.bomb {
  position: absolute; z-index: 6; right: calc(14px * var(--u)); bottom: calc(16px * var(--u) + env(safe-area-inset-bottom));
  width: calc(66px * var(--u)); height: calc(66px * var(--u)); border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, #ffcf7a 0 12%, #ff8a1f 35%, #c4500a 100%);
  box-shadow: 0 calc(5px * var(--u)) 0 #8a3600, 0 0 calc(18px * var(--u)) rgba(255, 150, 40, 0.6);
  animation: pulse 1.6s ease-in-out infinite;
}
.bomb::before { content: ''; position: absolute; left: 46%; top: -12%; width: 10%; height: 22%; background: #4f6f25; border-radius: 3px; }
.bomb::after {
  content: ''; position: absolute; inset: 30% 22% 26%;
  background: #ffe680; clip-path: polygon(0 20%, 30% 0, 35% 45%, 65% 45%, 70% 0, 100% 20%, 85% 70%, 70% 55%, 50% 80%, 30% 55%, 15% 70%);
}
.bomb:active { transform: translateY(3px); box-shadow: 0 2px 0 #8a3600; animation: none; }
.bomb-n {
  position: absolute; top: -6%; right: -6%; z-index: 2; min-width: calc(24px * var(--u)); height: calc(24px * var(--u)); padding: 0 6px;
  border-radius: 99px; background: #fff; color: #8a3600; font-weight: 700; font-size: calc(15px * var(--u)); line-height: calc(24px * var(--u));
}

.legend {
  position: absolute; z-index: 4; left: calc(10px * var(--u)); bottom: calc(12px * var(--u) + env(safe-area-inset-bottom));
  display: flex; gap: calc(6px * var(--u)); pointer-events: none;
}
.legend .g {
  display: flex; flex-direction: column; align-items: center; gap: 2px; width: calc(48px * var(--u));
  padding: calc(5px * var(--u)) 0 calc(4px * var(--u)); border-radius: calc(12px * var(--u));
  background: rgba(26, 10, 60, 0.6); border: 2px solid rgba(255, 255, 255, 0.15);
  font-size: calc(10px * var(--u)); font-weight: 600; opacity: 0.92;
}
.legend .g img { width: calc(28px * var(--u)); height: calc(28px * var(--u)); }
.legend .g kbd { font: inherit; color: #ffd23f; }

/* ---------- hub ---------- */
#hub { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; pointer-events: none; }
#hub > * { pointer-events: auto; }
.hub-top { display: flex; justify-content: space-between; align-items: flex-start; padding: calc(8px * var(--u)); }
.hub-mid { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: calc(14px * var(--u)); pointer-events: none; padding-bottom: calc(150px * var(--u)); }
.hub-mid > * { pointer-events: auto; }
.loc-head { display: flex; align-items: center; gap: calc(14px * var(--u)); }
.loc-title { text-align: center; min-width: calc(220px * var(--u)); }
.loc-n { font-weight: 600; font-size: calc(13px * var(--u)); letter-spacing: 0.3em; opacity: 0.85; text-transform: uppercase; }
.loc-name { font-weight: 700; font-size: calc(34px * var(--u)); line-height: 1.05; text-shadow: 0 4px 0 rgba(0, 0, 0, 0.35), 0 0 22px rgba(185, 140, 255, 0.5); }
.loc-arrow {
  width: calc(42px * var(--u)); height: calc(42px * var(--u)); border-radius: 50%; font-size: calc(30px * var(--u)); font-weight: 700; line-height: 1;
  background: rgba(26, 10, 60, 0.6); border: 2px solid rgba(255, 255, 255, 0.2);
}
.loc-arrow:disabled { opacity: 0.25; cursor: default; }
.path { display: flex; align-items: center; gap: calc(8px * var(--u)); }
.node {
  position: relative; width: calc(46px * var(--u)); height: calc(46px * var(--u)); border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; font-size: calc(18px * var(--u));
  background: rgba(26, 10, 60, 0.7); border: 3px solid rgba(255, 255, 255, 0.25); color: rgba(255, 255, 255, 0.55);
}
.node.open { background: linear-gradient(#8f6bff, #5b36d6); border-color: #c9b8ff; color: #fff; box-shadow: 0 4px 0 #3b1f9a; }
.node.cur { animation: pulse 1.4s ease-in-out infinite; box-shadow: 0 4px 0 #3b1f9a, 0 0 0 4px rgba(255, 210, 63, 0.75); }
.node.sel { background: linear-gradient(#ffe066, #ff9f2e); border-color: #fff3c2; color: #5a2a00; box-shadow: 0 4px 0 #b05a00; }
.node.boss { width: calc(56px * var(--u)); height: calc(56px * var(--u)); font-size: calc(24px * var(--u)); }
.node .st { position: absolute; bottom: calc(-15px * var(--u)); left: 50%; transform: translateX(-50%); font-size: calc(11px * var(--u)); letter-spacing: -1px; color: #ffd23f; white-space: nowrap; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5); }
.node .lock { font-size: calc(16px * var(--u)); }
.chip-btn {
  padding: calc(7px * var(--u)) calc(16px * var(--u)); border-radius: 99px; font-weight: 700; font-size: calc(16px * var(--u));
  background: rgba(26, 10, 60, 0.7); border: 2px solid rgba(185, 140, 255, 0.6); box-shadow: 0 0 16px rgba(185, 140, 255, 0.35);
}
.chip-btn span { color: #ffd23f; font-size: 0.85em; }
.cast { background: linear-gradient(#ffb347, #ff7a1a); box-shadow: 0 calc(5px * var(--u)) 0 #b04a00, 0 calc(9px * var(--u)) calc(18px * var(--u)) rgba(0, 0, 0, 0.3); text-shadow: 0 2px 0 rgba(120, 40, 0, 0.55); }
.cast:active { box-shadow: 0 2px 0 #b04a00; }
#panel { padding-top: calc(8px * var(--u)); background: linear-gradient(transparent, rgba(10, 0, 30, 0.55)); }
#upgrades { grid-template-columns: repeat(5, minmax(0, 1fr)); width: min(100%, calc(660px * var(--u))); }
.shop-title { font-weight: 700; font-size: calc(14px * var(--u)); letter-spacing: 0.16em; text-transform: uppercase; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35); }
.card .price .candy-ic { width: 1em; height: 1em; }
.card.poor .price .candy-ic { filter: grayscale(1) opacity(0.6); }
.card.max .price .candy-ic { display: none; }
@media (max-width: 520px) {
  #upgrades { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hub-mid { padding-bottom: calc(220px * var(--u)); }
  .node { width: calc(40px * var(--u)); height: calc(40px * var(--u)); }
  .node.boss { width: calc(48px * var(--u)); height: calc(48px * var(--u)); }
}

/* ---------- title ---------- */
.logo span:first-child { color: #fff3e0; text-shadow: 0 calc(6px * var(--u)) 0 #6b3fb0, 0 calc(12px * var(--u)) calc(22px * var(--u)) rgba(0, 0, 0, 0.45); }
.logo span:last-child { color: #ff9f2e; font-size: 0.82em; text-shadow: 0 calc(6px * var(--u)) 0 #8a2f00, 0 calc(12px * var(--u)) calc(22px * var(--u)) rgba(0, 0, 0, 0.45); }
#title { background: radial-gradient(ellipse at 50% 45%, rgba(40, 10, 80, 0.05), rgba(10, 0, 30, 0.6)); }

/* ---------- modals ---------- */
.sheet { background: linear-gradient(#2c1a63, #1a0f40); }
.result { text-align: center; }
.result h2 { justify-content: center; font-size: 30px; }
.stars-row { display: flex; justify-content: center; gap: 10px; margin: 6px 0 10px; }
.bigstar { width: 54px; height: 54px; background: rgba(255, 255, 255, 0.15); clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
.bigstar.on { background: #ffd23f; animation: starIn 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.5) both; }
.bigstar:nth-child(2) { width: 66px; height: 66px; margin-top: -10px; }
@keyframes starIn { from { transform: scale(0) rotate(-90deg); } }
.gain { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 8px 0 4px; font-size: 38px; font-weight: 700; color: #ffd23f; }
.gain .candy-ic { width: 0.9em; height: 0.9em; }
.res-line { font-size: 15px; opacity: 0.85; margin: 2px 0; }
.res-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.btn.purple { background: #8f6bff; color: #fff; box-shadow: 0 4px 0 #5b36d6; }
.tip { margin-top: 12px; padding: 8px 12px; border-radius: 12px; background: rgba(0, 0, 0, 0.25); font-size: 14px; }
.newspell { text-align: center; }
.newspell canvas { position: relative; inset: auto; width: 180px; height: 180px; margin: 6px auto 4px; display: block; }
.newspell .k { display: inline-block; margin-top: 4px; padding: 2px 10px; border-radius: 8px; background: rgba(255, 255, 255, 0.12); font-size: 14px; }
.book { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; margin-top: 10px; }
.book .cell { padding: 6px; border-radius: 13px; text-align: center; background: rgba(255, 255, 255, 0.06); border: 2px solid transparent; }
.book .cell.on { background: rgba(185, 140, 255, 0.14); }
.book .cell.boss { border-color: rgba(255, 210, 63, 0.45); }
.book .cell.sel { border-color: #ffd23f; }
.book img { width: 100%; height: auto; aspect-ratio: 1; }
.book .n { font-weight: 600; font-size: 13px; }
.book .m { font-size: 11px; opacity: 0.75; }

.banner.boss .b2 { color: #ff9f2e; text-shadow: 0 4px 0 #6b1f00, 0 0 30px rgba(255, 140, 40, 0.8); }
.banner.good .b2 { color: #ffd23f; text-shadow: 0 4px 0 #8a5a00, 0 0 28px rgba(255, 210, 63, 0.75); }
.banner.bad .b2 { color: #ff5d6c; text-shadow: 0 4px 0 rgba(0, 0, 0, 0.35), 0 0 24px rgba(255, 93, 108, 0.6); }
.hint { top: calc(96px * var(--u)); bottom: auto; background: rgba(26, 10, 60, 0.85); }
.hint .hint-hand { display: none; }
#toasts { top: calc(110px * var(--u)); }
