/* ==========================================================================
   Royal Chess — court.css  (v7)
   The Royal Court in the royal skin: the home dashboard, the court hub and its tabs, missions, the ladder's
   medals, rewards and chests, popups (toasts, card, celebrations), the HUD objective tracker, the prologue
   bar, the result card's rewards, the dark-square colour picker, comfort settings.  Loaded after royal.css.
   Motion is transform / opacity only (compositor-friendly); body.calm and prefers-reduced-motion still it.
   ========================================================================== */

/* the hidden attribute always wins over a button's display (Next on the reward card, the stage's assist offer) */
.btn[hidden], .court-panel [hidden], .reward-panel [hidden], .stage-panel [hidden], .result-court [hidden] { display: none !important; }

/* ---------------------------------------------------------------- menu row + badges */
.btn-row3 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(4px, 0.8vh, 8px); width: 100%; animation: rcRise 0.8s 0.58s var(--royal-ease) both; }
.btn-row3 .btn { min-width: 0; min-height: clamp(28px, 4.2vh, 36px); padding: 0 0.35em; gap: 0.3em; font-size: clamp(9.5px, 1.35vh, 12px); letter-spacing: 0.04em; }
.btn-row3 .btn img { width: 1.15em; height: 1.15em; }
.court-badge { position: absolute; right: -6px; top: -7px; width: 14px; height: 14px; border-radius: 50%; display: none;
  background: radial-gradient(circle at 35% 30%, #ffd2c8, #e0303c 55%, #7a0a14); box-shadow: 0 0 0 2px #2a0a0c, 0 0 10px rgba(255, 70, 60, 0.8); }
.court-badge.on { display: block; animation: cbPulse 1.6s ease-in-out infinite; }
@keyframes cbPulse { 50% { transform: scale(1.25); } }

/* ---------------------------------------------------------------- the home dashboard */
.court-home {
  position: absolute; right: calc(18px + var(--safe-right)); top: calc(86px + var(--safe-top));
  width: clamp(270px, 22vw, 340px); display: flex; flex-direction: column; gap: 10px; z-index: 4;
  animation: rcFade 0.9s 0.7s both;
}
.court-home > * { pointer-events: auto; }
.ch-profile, .ch-card {
  position: relative; display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; text-align: left;
  border: 2px solid transparent; border-radius: 12px; color: var(--ivory);
  background: url('../assets/images/royal/damask.svg') 0 0 / 80px padding-box, linear-gradient(180deg, rgba(36, 16, 14, 0.94), rgba(14, 7, 6, 0.95)) padding-box, var(--gold-edge) border-box;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.7), 0 10px 22px rgba(0, 0, 0, 0.55);
  transition: transform 0.18s var(--royal-ease), box-shadow 0.2s ease;
}
button.ch-profile:hover, button.ch-card:hover { transform: translateY(-2px); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.7), 0 0 18px rgba(246, 200, 100, 0.25), 0 12px 24px rgba(0, 0, 0, 0.6); }
.ch-id { display: flex; flex-direction: column; flex: 1; min-width: 0; gap: 2px; }
.ch-id b { font-family: var(--font-head); font-weight: 800; font-size: 15px; letter-spacing: 0.06em; color: var(--gold-light); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-lvl { display: inline-block; padding: 0 7px; margin-right: 4px; border-radius: 999px; background: linear-gradient(180deg, var(--crimson-1), var(--crimson-3)); box-shadow: inset 0 0 0 1px rgba(246, 214, 130, 0.6); color: var(--gold-pale); font-size: 12px; }
.ch-id small { font-family: var(--font-body); font-style: italic; font-weight: 600; font-size: 13px; color: var(--ivory-2); }
.ch-xpbar { position: relative; height: 7px; border-radius: 4px; overflow: hidden; background: rgba(0, 0, 0, 0.6); box-shadow: inset 0 0 0 1px rgba(232, 190, 98, 0.35); }
.ch-xpbar i { position: absolute; inset: 0; transform-origin: left center; background: linear-gradient(90deg, #a8752a, #f3d27a 70%, #fff8dc); transition: transform 0.8s var(--royal-ease); }
.ch-ducats { display: flex; align-items: center; gap: 4px; font-family: var(--font-head); font-weight: 800; font-size: 15px; color: var(--gold-pale); text-shadow: 0 2px 0 #000; }
.ch-ducats b { color: #f3c95c; filter: drop-shadow(0 0 6px rgba(255, 200, 90, 0.6)); }
.ch-crest { position: relative; flex: none; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #2a3a7a, #0b1438 80%); box-shadow: 0 0 0 2px rgba(232, 190, 98, 0.65), 0 4px 10px rgba(0, 0, 0, 0.6); }
.ch-crest img { width: 78%; height: 78%; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.7)); }
/* frames around the coat of arms (Royal Treasury and boss rewards) */
.fr-bronze { box-shadow: 0 0 0 3px #b87333, 0 0 0 5px #4a2a10, 0 4px 10px rgba(0, 0, 0, 0.6); }
.fr-silver { box-shadow: 0 0 0 3px #d9dee6, 0 0 0 5px #4a5260, 0 0 12px rgba(220, 230, 255, 0.5); }
.fr-gold { box-shadow: 0 0 0 3px #f3c95c, 0 0 0 5px #6e4710, 0 0 14px rgba(255, 210, 110, 0.6); }
.fr-royal { box-shadow: 0 0 0 3px #f3c95c, 0 0 0 6px #9e1626, 0 0 0 8px #f3c95c, 0 0 18px rgba(255, 210, 110, 0.7); }
.fr-sovereign { box-shadow: 0 0 0 3px #fff3c4, 0 0 0 6px #3d1a6e, 0 0 0 8px #f3c95c, 0 0 22px rgba(200, 150, 255, 0.7); }
.fr-weekly { box-shadow: 0 0 0 3px #5fa8ff, 0 0 0 5px #0b1438, 0 0 12px rgba(95, 168, 255, 0.6); }
.fr-ruby { box-shadow: 0 0 0 3px #e0303c, 0 0 0 5px #3e050d, 0 0 12px rgba(224, 48, 60, 0.6); }
.fr-sapphire { box-shadow: 0 0 0 3px #3d6bff, 0 0 0 5px #070e2b, 0 0 12px rgba(61, 107, 255, 0.6); }
.fr-emerald { box-shadow: 0 0 0 3px #2fbf62, 0 0 0 5px #06201a, 0 0 14px rgba(47, 191, 98, 0.6); }
.fr-harvest { box-shadow: 0 0 0 3px #ff9a3c, 0 0 0 5px #4a1f0c, 0 0 0 7px #f3c95c, 0 0 16px rgba(255, 140, 50, 0.7); }
.fr-winter { box-shadow: 0 0 0 3px #bfe6ff, 0 0 0 5px #1b3442, 0 0 16px rgba(190, 230, 255, 0.7); }

.ch-ring { --p: 0; flex: none; width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle, #170908 56%, transparent 58%), conic-gradient(#f3d27a calc(var(--p) * 360deg), rgba(255, 255, 255, 0.1) 0); box-shadow: 0 0 0 1px rgba(232, 190, 98, 0.5); }
.ch-ring b { font-family: var(--font-head); font-weight: 800; font-size: 14px; color: var(--gold-pale); }
.ch-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.ch-text b, .ch-next b, .ch-season b { font-family: var(--font-head); font-weight: 800; font-size: 14px; letter-spacing: 0.05em; color: var(--gold-light); }
.ch-text small, .ch-next small, .ch-season small { font-family: var(--font-body); font-style: italic; font-weight: 600; font-size: 13px; color: var(--ivory-2); }
.ch-btns { display: flex; flex-direction: column; gap: 6px; }
.ch-btns .btn { min-height: 30px; font-size: 11px; padding: 0 0.7em; }
.ch-card.glow { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.7), 0 0 0 2px rgba(246, 214, 130, 0.35), 0 0 24px rgba(246, 196, 90, 0.4), 0 10px 22px rgba(0, 0, 0, 0.55); }
.ch-card.locked { filter: grayscale(0.7) brightness(0.7); }
.ch-next { flex-direction: column; align-items: flex-start; gap: 3px; }
.ch-next em, .cb-mission em, .cb-challenge em { font-family: var(--font-head); font-style: normal; font-weight: 700; font-size: 12px; letter-spacing: 0.04em; color: #f3c95c; }
.ch-next .btn { align-self: stretch; margin-top: 4px; min-height: 34px; }
.ch-next.boss { background: url('../assets/images/royal/damask.svg') 0 0 / 80px padding-box, radial-gradient(130% 120% at 50% 0%, rgba(150, 18, 32, 0.9), rgba(30, 4, 8, 0.95)) padding-box, var(--gold-edge-hot) border-box; }
.ch-k { font-family: var(--font-head) !important; font-style: normal !important; font-weight: 800 !important; font-size: 10.5px !important; letter-spacing: 0.24em; text-transform: uppercase; color: var(--gold) !important; }
.ch-season { flex-direction: column; align-items: flex-start; gap: 2px; background: url('../assets/images/royal/damask.svg') 0 0 / 80px padding-box, linear-gradient(120deg, rgba(160, 70, 10, 0.92), rgba(40, 12, 6, 0.95)) padding-box, var(--gold-edge) border-box; }
.court-home.compact .ch-next, .court-home.compact .ch-season { display: none; }
@media (max-height: 640px) and (orientation: landscape) { .court-home { top: calc(64px + var(--safe-top)); width: 250px; gap: 6px; } .ch-next small, .ch-next em, .ch-season { display: none; } .btn-row3 .btn { min-height: 30px; } }
@media (orientation: portrait) {
  .court-home { left: 50%; right: auto; transform: translateX(-50%); top: calc(64px + var(--safe-top)); width: min(92vw, 440px); }
  .court-home .ch-card { display: none; }
  .court-home .ch-profile { padding: 6px 10px; }
  .court-home .ch-crest { width: 40px; height: 40px; }
}
body.prologue .court-home { display: none; }

/* the Harvest Moon Festival on the title screen: a warm glow and a few drifting leaves */
body.season-harvest #screen-title .title-drapes::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 50% 40% at 78% 18%, rgba(255, 150, 50, 0.16), transparent 70%);
}
body.season-harvest #screen-title .td-rays { filter: sepia(0.6) hue-rotate(-15deg) saturate(1.4); }

/* ---------------------------------------------------------------- the HUD objective tracker */
.hud-objective {
  position: absolute; left: 50%; top: calc(10px + var(--safe-top)); transform: translateX(-50%); z-index: 12;
  display: flex; flex-direction: column; align-items: center; gap: 1px; max-width: min(56vw, 560px); padding: 6px 16px 7px;
  border: 2px solid transparent; border-radius: 999px; pointer-events: auto; cursor: pointer;
  background: linear-gradient(180deg, rgba(34, 16, 14, 0.9), rgba(12, 6, 5, 0.9)) padding-box, var(--gold-edge) border-box;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.55); animation: rcFade 0.6s both;
}
.hud-objective b { font-family: var(--font-head); font-weight: 800; font-size: clamp(11px, 1.6vh, 14px); letter-spacing: 0.06em; color: var(--gold-light); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.hud-objective small { font-family: var(--font-head); font-weight: 700; font-size: 11px; color: #f3c95c; }
.hud-objective.boss { background: linear-gradient(180deg, rgba(110, 10, 20, 0.92), rgba(30, 4, 8, 0.92)) padding-box, var(--gold-edge-hot) border-box; }
.hud-objective[hidden] { display: none; }
#app.portrait .hud-objective { top: calc(58px + var(--safe-top)); max-width: 90vw; }

/* ---------------------------------------------------------------- the prologue bar */
.prologue-bar {
  position: relative; flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 12px; padding: 12px 14px;
  border: 2px solid transparent; border-radius: 12px;
  background: url('../assets/images/royal/damask.svg') 0 0 / 80px padding-box, radial-gradient(130% 120% at 50% 0%, rgba(150, 18, 32, 0.92), rgba(40, 6, 12, 0.95)) padding-box, var(--gold-edge-hot) border-box;
  box-shadow: 0 0 22px rgba(246, 196, 90, 0.3), 0 10px 22px rgba(0, 0, 0, 0.55); animation: rcRise 0.6s var(--royal-ease) both;
}
.prologue-bar[hidden] { display: none; }
.pb-text { display: flex; flex-direction: column; flex: 1 1 100%; min-width: 0; }
.pb-dots { margin-right: auto; }
.pb-text small { font-family: var(--font-head); font-weight: 800; font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--gold); }
.pb-text b { font-family: var(--font-display); font-weight: 900; font-size: clamp(18px, 3vh, 26px); color: var(--gold-pale); text-shadow: 0 2px 0 #000; }
.pb-text span { font-family: var(--font-body); font-style: italic; font-weight: 600; font-size: 15px; color: var(--ivory-2); }
.pb-dots { display: flex; gap: 6px; }
.pb-dots i { width: 12px; height: 12px; border-radius: 50%; background: rgba(0, 0, 0, 0.5); box-shadow: inset 0 0 0 1px rgba(232, 190, 98, 0.6); }
.pb-dots i.done { background: radial-gradient(circle at 35% 30%, #fff8dc, #f0c862 45%, #9a6a1e); }
.pb-dots i.now { background: radial-gradient(circle at 35% 30%, #ffd2c8, #e0303c 55%, #7a0a14); animation: cbPulse 1.2s ease-in-out infinite; }
#app.portrait .prologue-bar { margin-bottom: 8px; padding: 8px 10px; }
#app.portrait .pb-text span { display: none; }

/* ---------------------------------------------------------------- the court hub */
.court-panel { width: min(920px, 96vw); max-height: calc(100vh - 24px); }
.court-tabs { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; width: 100%; }
.ct-tab { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 9px; border: 2px solid transparent;
  background: radial-gradient(120% 120% at 50% 0%, var(--navy-1), var(--navy-2) 50%, var(--navy-4)) padding-box, linear-gradient(180deg, rgba(232, 190, 98, 0.75), rgba(141, 95, 26, 0.7)) border-box;
  font-family: var(--font-head); font-weight: 700; font-size: 12.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ivory-2); transition: transform 0.18s var(--royal-ease), filter 0.2s ease; }
.ct-tab img { width: 18px; height: 18px; }
.ct-tab:hover { transform: translateY(-2px); filter: brightness(1.15); }
.ct-tab.active { background: radial-gradient(120% 120% at 50% 0%, var(--crimson-1), var(--crimson-2) 50%, var(--crimson-4)) padding-box, var(--gold-edge-hot) border-box; color: var(--gold-pale); box-shadow: 0 0 14px rgba(246, 200, 100, 0.35); }
.ct-tab.locked { filter: grayscale(0.8) brightness(0.65); }
.ct-tab.locked::after { content: ''; position: absolute; right: -5px; top: -6px; width: 16px; height: 16px; border-radius: 50%; background: url('../assets/images/icons/royal/lock.svg') center / 10px no-repeat, #2a050c; box-shadow: 0 0 0 1px #c8913a; }
.court-body { width: 100%; max-height: min(64vh, 640px); overflow-x: hidden; overflow-y: auto; padding: 4px 4px 8px; display: flex; flex-direction: column; gap: 14px; scrollbar-width: thin; scrollbar-color: var(--gold-dark) transparent; }
.cb-sec { display: flex; flex-direction: column; gap: 10px; }
.cb-sec h3 { margin: 0; font-family: var(--font-head); font-weight: 800; font-size: 14px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold-light); text-shadow: 0 2px 0 rgba(0, 0, 0, 0.8); border-bottom: 1px solid rgba(232, 190, 98, 0.25); padding-bottom: 4px; }
.cb-note { margin: 0; font-family: var(--font-body); font-style: italic; font-weight: 600; font-size: 15px; color: var(--ivory-2); }
.cb-note.small { font-size: 13px; color: var(--ivory-3); }
.cb-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cb-label { font-family: var(--font-head); font-weight: 700; font-size: 13px; color: var(--gold); min-width: 46px; }
.cb-locked { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 40px 10px; text-align: center; }
.cb-locked img { width: 48px; height: 48px; opacity: 0.85; }
.cb-locked b { font-family: var(--font-display); font-weight: 900; font-size: 26px; color: var(--gold-light); }
.cb-locked p { margin: 0; font-family: var(--font-body); font-style: italic; font-size: 17px; color: var(--ivory-2); }
.cb-locked small { font-family: var(--font-head); font-weight: 700; font-size: 13px; letter-spacing: 0.08em; color: #f0c98a; }
/* progress bars (with a text label, never colour alone) */
.cb-bar { position: relative; height: 16px; border-radius: 8px; overflow: hidden; background: rgba(0, 0, 0, 0.55); box-shadow: inset 0 0 0 1px rgba(232, 190, 98, 0.4); }
.cb-bar i { position: absolute; inset: 0; transform-origin: left center; background: linear-gradient(90deg, #a8752a, #f3d27a 70%, #fff8dc); transition: transform 0.6s var(--royal-ease); }
.cb-bar span { position: relative; display: block; text-align: center; font-family: var(--font-head); font-weight: 800; font-size: 11px; line-height: 16px; color: #fff; text-shadow: 0 1px 2px #000, 0 0 4px #000; }

/* missions */
.cb-missions { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 10px; }
.cb-mission { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; background: var(--well); box-shadow: var(--well-line); }
.cb-mission > .btn { min-width: 0; min-height: 34px; padding: 0 1em; font-size: 12px; }
.cb-mission > img { width: 32px; height: 32px; }
.cbm-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cbm-text small { font-family: var(--font-head); font-weight: 800; font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold); }
.cbm-text b { font-family: var(--font-body); font-weight: 700; font-size: 15.5px; line-height: 1.15; color: var(--ivory); }
.cb-mission.done { box-shadow: inset 0 0 0 1px var(--gold-light), 0 0 16px rgba(246, 200, 100, 0.25); }
.cb-mission.claimed { opacity: 0.65; }
.cb-mission.grand { grid-column: 1 / -1; background: url('../assets/images/royal/damask.svg') 0 0 / 80px, linear-gradient(180deg, rgba(110, 14, 26, 0.6), rgba(30, 4, 8, 0.6)); }
.cbm-chest { font-size: 30px; color: #f3c95c; text-align: center; filter: drop-shadow(0 0 8px rgba(255, 200, 90, 0.6)); }
.cbm-ok { font-family: var(--font-head); font-weight: 800; font-size: 12px; letter-spacing: 0.08em; color: #8fe39a; white-space: nowrap; }
.cb-login { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cbl-day { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border-radius: 9px; background: var(--well); box-shadow: var(--well-line); text-align: center; }
.cbl-day small { font-family: var(--font-head); font-weight: 700; font-size: 10.5px; color: var(--gold); }
.cbl-day b { font-size: 20px; color: #f3c95c; }
.cbl-day span { font-family: var(--font-head); font-size: 10px; color: var(--ivory-2); }
.cbl-day.got { opacity: 0.5; }
.cbl-day.got b::after { content: ' ✓'; font-size: 12px; color: #8fe39a; }
.cbl-day.today { box-shadow: inset 0 0 0 2px var(--gold-light), 0 0 14px rgba(246, 200, 100, 0.4); }
.cb-trackwrap { position: relative; padding: 8px 18px 40px; }
.cb-track { position: absolute; left: 18px; right: 18px; top: 0; height: 30px; }
.cbt-node { position: absolute; top: -2px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 2px; background: none; border: 0; }
.cbt-node b { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font-family: var(--font-head); font-size: 10px; color: var(--ivory); background: #1b0d0c; box-shadow: 0 0 0 2px rgba(232, 190, 98, 0.5); }
.cbt-node small { font-family: var(--font-head); font-size: 9.5px; color: var(--ivory-2); white-space: nowrap; }
.cbt-node.reached b { background: radial-gradient(circle at 35% 30%, #fff8dc, #f0c862 45%, #9a6a1e); color: #2a1505; }
.cbt-node.claimed b::after { content: '✓'; }
.cbt-node.claimed b { font-size: 0; }
.cbt-node.claimed b::after { font-size: 12px; }
.cbt-node.can { cursor: pointer; animation: cbPulse 1.4s ease-in-out infinite; }
.cbt-node.can b { box-shadow: 0 0 0 2px #fff3c4, 0 0 14px rgba(255, 210, 110, 0.9); }

/* the ladder: stages and medals */
.cb-stages { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.cb-stage { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 8px 10px; border-radius: 12px; border: 2px solid transparent; text-align: center; color: var(--ivory);
  background: linear-gradient(180deg, #2a1a14, #120a07) padding-box, linear-gradient(180deg, rgba(232, 190, 98, 0.7), rgba(141, 95, 26, 0.5)) border-box;
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.6), 0 6px 12px rgba(0, 0, 0, 0.45); transition: transform 0.18s var(--royal-ease), box-shadow 0.2s ease; }
.cb-stage:hover:not(:disabled) { transform: translateY(-3px); box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.5), 0 0 16px rgba(246, 200, 100, 0.25), 0 10px 16px rgba(0, 0, 0, 0.5); }
.cbs-n { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; font-family: var(--font-display); font-weight: 900; font-size: 16px; color: var(--gold-pale);
  background: radial-gradient(circle at 50% 30%, var(--navy-1), var(--navy-4)); box-shadow: 0 0 0 2px rgba(232, 190, 98, 0.7); }
.cb-stage b { font-family: var(--font-head); font-weight: 800; font-size: 13px; letter-spacing: 0.04em; color: var(--gold-light); }
.cb-stage small { font-family: var(--font-body); font-style: italic; font-size: 13px; color: var(--ivory-2); }
.cb-stage.boss { background: radial-gradient(120% 110% at 50% 0%, rgba(160, 20, 34, 0.9), rgba(30, 4, 8, 0.95)) padding-box, var(--gold-edge-hot) border-box; }
.cb-stage.boss .cbs-n { background: radial-gradient(circle at 50% 30%, var(--crimson-1), var(--crimson-4)); }
.cb-stage.cleared .cbs-n { background: radial-gradient(circle at 35% 30%, #fff8dc, #f0c862 45%, #9a6a1e); color: #2a1505; }
.cb-stage.crowned { box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.5), 0 0 0 2px rgba(255, 228, 150, 0.4), 0 0 20px rgba(246, 200, 100, 0.45); }
.cb-stage.locked { filter: grayscale(0.85) brightness(0.5); cursor: not-allowed; }
.cb-medals { display: flex; gap: 4px; }
.md { display: inline-block; width: 14px; height: 14px; border-radius: 50%; background: rgba(0, 0, 0, 0.55); box-shadow: inset 0 0 0 1px rgba(232, 190, 98, 0.45); flex: none; }
.md.on.md-primary { background: radial-gradient(circle at 35% 30%, #ffe0c0, #cd7f32 55%, #5a3010); }
.md.on.md-advanced { background: radial-gradient(circle at 35% 30%, #ffffff, #c0c8d4 55%, #5a6270); }
.md.on.md-special { background: radial-gradient(circle at 35% 30%, #d8e4ff, #5f86ff 55%, #142c7a); }
.md.on.md-expert { background: radial-gradient(circle at 35% 30%, #fff8dc, #f0c862 45%, #9a6a1e); }
.md.on.md-crown { background: radial-gradient(circle at 35% 30%, #ffe1f0, #c43a8a 55%, #4a0a30); box-shadow: 0 0 8px rgba(255, 120, 200, 0.7); }
.md-crown { border-radius: 3px; transform: rotate(45deg) scale(0.85); }

/* challenges + arena */
.cb-challenges { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.cb-challenge { display: flex; flex-direction: column; gap: 5px; padding: 12px; border-radius: 12px; background: var(--well); box-shadow: var(--well-line); }
.cb-challenge small { font-family: var(--font-head); font-weight: 800; font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold); }
.cb-challenge b { font-family: var(--font-head); font-weight: 800; font-size: 16px; color: var(--gold-light); }
.cb-challenge p { margin: 0; font-family: var(--font-body); font-weight: 600; font-size: 15px; color: var(--ivory); flex: 1; }
.cb-challenge.done { opacity: 0.6; }
.cb-arena { flex-direction: row; align-items: flex-start; gap: 16px; }
.cb-arena > div:last-child { display: flex; flex-direction: column; gap: 10px; flex: 1; min-width: 0; }
.cb-arena-board { width: 220px; height: 220px; border-radius: 6px; box-shadow: 0 0 0 3px rgba(232, 190, 98, 0.7), 0 10px 20px rgba(0, 0, 0, 0.6); }
.cb-arena-tiers, .st-goals, .cb-sgoals, .rc-objs, .cb-funnel, .cb-rank { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cb-arena-tiers li, .st-goals li { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 9px; background: var(--well); box-shadow: var(--well-line); }
.cb-arena-tiers li span, .st-goals li span { flex: 1; font-family: var(--font-body); font-weight: 700; font-size: 15px; color: var(--ivory); }
.cb-arena-tiers li small, .st-goals li small { font-family: var(--font-head); font-weight: 700; font-size: 11.5px; color: #f3c95c; white-space: nowrap; }
.cb-arena-tiers li.met, .st-goals li.met { box-shadow: inset 0 0 0 1px var(--gold-light); }
.cb-code { display: flex; align-items: center; gap: 8px; font-family: var(--font-head); font-size: 13px; color: var(--gold); }
.cb-code input { flex: 1; min-width: 0; padding: 7px 10px; border-radius: 8px; background: rgba(6, 3, 3, 0.75); color: var(--ivory); border: 1px solid rgba(232, 190, 98, 0.45); font-family: monospace; }
@media (max-width: 640px) { .cb-arena { flex-direction: column; align-items: center; } }

/* career */
.cbc-head { display: flex; align-items: center; gap: 14px; }
.cbc-head > div { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.cbc-rank { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; font-size: 36px; color: #2a1904; background: radial-gradient(circle at 35% 30%, #fff6d4, #f0c862 45%, #9a6a1e); box-shadow: 0 0 0 3px #5a3a0e, 0 0 18px rgba(255, 210, 110, 0.55); }
.cbc-head b { font-family: var(--font-display); font-weight: 900; font-size: 22px; color: var(--gold-light); }
.cbc-head small { font-family: var(--font-body); font-style: italic; font-size: 15px; color: var(--ivory-2); }
.cb-road { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; }
.cbr-step { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 74px; padding: 8px 6px; border-radius: 10px; background: var(--well); box-shadow: var(--well-line); opacity: 0.55; }
.cbr-step b { font-size: 22px; color: var(--ivory); }
.cbr-step span { font-family: var(--font-head); font-weight: 800; font-size: 11.5px; color: var(--gold-light); }
.cbr-step small { font-family: var(--font-head); font-size: 10px; color: var(--ivory-2); }
.cbr-step.got { opacity: 1; box-shadow: inset 0 0 0 1px var(--gold-light); }
.cb-chip { padding: 5px 12px; border-radius: 999px; font-family: var(--font-head); font-weight: 700; font-size: 12px; color: var(--ivory-2); background: rgba(0, 0, 0, 0.45); box-shadow: inset 0 0 0 1px rgba(232, 190, 98, 0.45); }
.cb-chip.on { color: #2a1505; background: linear-gradient(180deg, #f6d98a, #c8913a); }
.cb-milestones { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.cbms { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; background: var(--well); box-shadow: var(--well-line); }
.cbms > div { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.cbms-i { display: grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 50%; font-size: 20px; color: #2a1904; background: radial-gradient(circle at 35% 30%, #fff6d4, #f0c862 45%, #9a6a1e); }
.cbms span { font-family: var(--font-head); font-weight: 800; font-size: 12.5px; color: var(--gold-light); }
.cbms small { font-family: var(--font-head); font-size: 11px; color: var(--ivory-2); }
.cbms-steps { display: flex; gap: 3px; }
.cbms-steps i { width: 10px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.15); }
.cbms-steps i.on { background: #f3c95c; }
.cb-rank li { display: flex; justify-content: space-between; padding: 6px 12px; border-radius: 8px; background: var(--well); font-family: var(--font-head); font-size: 13.5px; color: var(--ivory); counter-increment: rk; }
.cb-rank li::before { content: counter(rk) '.'; width: 26px; color: var(--gold); }
.cb-rank li span { flex: 1; }
.cb-rank li.me { box-shadow: inset 0 0 0 2px var(--gold-light); background: linear-gradient(180deg, rgba(150, 22, 36, 0.5), rgba(60, 6, 14, 0.5)); }
.cb-rank { counter-reset: rk; }

/* records */
.cb-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.cbt { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px; border-radius: 10px; background: var(--well); box-shadow: var(--well-line); text-align: center; }
.cbt b { font-family: var(--font-head); font-weight: 800; font-size: 19px; color: var(--gold-light); }
.cbt small { font-family: var(--font-head); font-size: 11px; letter-spacing: 0.04em; color: var(--ivory-2); }
.cbt em { font-family: var(--font-body); font-size: 12px; color: var(--ivory-3); }
.cb-chart { width: 100%; max-width: 600px; height: auto; border-radius: 8px; background: rgba(0, 0, 0, 0.35); box-shadow: var(--well-line); }
.cb-history { display: flex; flex-direction: column; gap: 6px; }
.cbh { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 9px; background: var(--well); box-shadow: var(--well-line); }
.cbh b { width: 46px; font-family: var(--font-head); font-weight: 800; font-size: 12.5px; }
.cbh.win b { color: #8fe39a; } .cbh.loss b { color: #ff8f82; } .cbh.draw b, .cbh.pvp b { color: var(--ivory-2); }
.cbh span { flex: 1; font-family: var(--font-body); font-weight: 600; font-size: 14.5px; color: var(--ivory); }
.cbh .btn { min-height: 28px; font-size: 11px; }

/* treasury (rarity is written out too, never colour alone) */
.cb-shop { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.cbsh { --r: #c9b48a; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 8px; border-radius: 12px; text-align: center;
  background: linear-gradient(180deg, #2a1a14, #120a07); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--r) 70%, transparent), inset 0 0 18px rgba(0, 0, 0, 0.6); }
.cbsh.r-rare { --r: #5fa8ff; } .cbsh.r-epic { --r: #c38bff; } .cbsh.r-legendary { --r: #ffb547; }
.cbsh b { font-family: var(--font-head); font-weight: 800; font-size: 13px; color: var(--gold-light); }
.cbsh .rar { font-family: var(--font-head); font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--r); }
.cbsh.worn { box-shadow: inset 0 0 0 2px var(--gold-light), 0 0 16px rgba(246, 200, 100, 0.35); }
.cbsh-fx { width: 44px; height: 44px; border-radius: 50%; background: radial-gradient(circle, #fff 0%, var(--c) 35%, transparent 70%); box-shadow: 0 0 18px var(--c); }
.cbsh-title { font-family: var(--font-body); font-style: italic; font-weight: 700; font-size: 16px; color: var(--ivory); min-height: 44px; display: grid; place-items: center; }
.cbsh-src { font-family: var(--font-body); font-style: italic; font-size: 12.5px; color: var(--ivory-3); }
.cbsh .ch-crest { width: 44px; height: 44px; }
.cb-sgoals li { display: grid; grid-template-columns: 1fr 160px auto; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 9px; background: var(--well); box-shadow: var(--well-line); font-family: var(--font-body); font-weight: 700; font-size: 15px; }
.cb-sgoals li small { font-family: var(--font-head); font-size: 11px; color: #f3c95c; }
.cb-sgoals li.met { box-shadow: inset 0 0 0 1px var(--gold-light); }

/* the ledger */
.cb-funnel li { display: flex; justify-content: space-between; padding: 6px 12px; border-radius: 8px; background: var(--well); font-family: var(--font-head); font-size: 13px; color: var(--ivory-2); }
.cb-funnel li.met { color: var(--ivory); box-shadow: inset 3px 0 0 #8fe39a; }
.cb-table { width: 100%; border-collapse: collapse; font-family: var(--font-head); font-size: 12.5px; color: var(--ivory); }
.cb-table th { text-align: left; color: var(--gold); font-weight: 700; padding: 4px 6px; border-bottom: 1px solid rgba(232, 190, 98, 0.3); }
.cb-table td { padding: 4px 6px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.cb-table tr.hot td { color: #ff9b8c; }

/* ---------------------------------------------------------------- a stage */
.stage-panel { width: min(560px, 94vw); max-height: min(94vh, calc(100vh - 20px)); overflow-y: auto; overflow-x: hidden; }
.stage-panel.boss { background-image: url('../assets/images/royal/corner-tl.svg'), url('../assets/images/royal/corner-tr.svg'), url('../assets/images/royal/corner-bl.svg'), url('../assets/images/royal/corner-br.svg'),
  linear-gradient(90deg, transparent, var(--gold-line) 12%, var(--gold-line) 88%, transparent), linear-gradient(90deg, transparent, var(--gold-line) 12%, var(--gold-line) 88%, transparent),
  linear-gradient(180deg, transparent, var(--gold-line) 12%, var(--gold-line) 88%, transparent), linear-gradient(180deg, transparent, var(--gold-line) 12%, var(--gold-line) 88%, transparent),
  url('../assets/images/royal/damask.svg'), radial-gradient(130% 70% at 50% 0%, rgba(220, 30, 46, 0.7), rgba(140, 18, 34, 0) 70%), linear-gradient(180deg, #2a0c0e 0%, #170707 55%, #0e0404 100%), var(--gold-edge-hot); }
.st-kicker { font-family: var(--font-head); font-weight: 800; font-size: 11.5px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--gold); }
.st-goals { width: 100%; }
.st-best, .st-tip { margin: 0; text-align: center; font-family: var(--font-body); font-style: italic; font-weight: 600; font-size: 15px; color: var(--ivory-2); }
.st-tip { color: #f0d9a8; }

/* ---------------------------------------------------------------- rewards and the chest */
.reward-panel { width: min(440px, 92vw); max-height: min(94vh, calc(100vh - 20px)); overflow-y: auto; overflow-x: hidden; }
.rw-art { position: relative; width: 120px; height: 104px; margin: -10px 0 4px; display: grid; place-items: center; }
.rw-rays { position: absolute; left: 50%; top: 50%; width: 320px; height: 320px; transform: translate(-50%, -50%) scale(0.6); opacity: 0; pointer-events: none;
  background: repeating-conic-gradient(from 0deg, rgba(255, 212, 110, 0) 0deg 8deg, rgba(255, 212, 110, 0.35) 10deg 12deg, rgba(255, 212, 110, 0) 14deg 22deg);
  -webkit-mask-image: radial-gradient(circle, #000 10%, transparent 64%); mask-image: radial-gradient(circle, #000 10%, transparent 64%); transition: opacity 0.5s ease, transform 1.2s var(--royal-ease); }
.rw-art.open .rw-rays { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(20deg); }
.rw-coins { font-size: 72px; color: #f3c95c; filter: drop-shadow(0 0 16px rgba(255, 200, 90, 0.8)) drop-shadow(0 4px 2px #000); transform: scale(0.6); transition: transform 0.5s cubic-bezier(.2, 1.6, .4, 1); }
.rw-art.coins.open .rw-coins { transform: scale(1); }
.rw-art.coins .rw-chest, .rw-art.chest .rw-coins { display: none; }
.rw-chest { position: relative; width: 96px; height: 80px; }
.rw-box { position: absolute; left: 0; right: 0; bottom: 0; height: 52px; border-radius: 6px; background: linear-gradient(180deg, #7a3a16, #3a1606); box-shadow: inset 0 0 0 3px #e2b456, inset 0 -8px 12px rgba(0, 0, 0, 0.5), 0 8px 14px rgba(0, 0, 0, 0.6); }
.rw-box::after { content: ''; position: absolute; left: 50%; top: 4px; width: 16px; height: 20px; transform: translateX(-50%); border-radius: 3px; background: linear-gradient(180deg, #fff1b8, #b07a26); }
.rw-lid { position: absolute; left: -2px; right: -2px; top: 4px; height: 30px; border-radius: 40px 40px 6px 6px; background: linear-gradient(180deg, #9a4a1c, #4a1c08); box-shadow: inset 0 0 0 3px #e2b456; transform-origin: 50% 100%; }
.rw-art.chest:not(.open) .rw-chest { animation: rwShake 0.6s ease-in-out infinite; }
.rw-art.chest.open .rw-lid { transform: translateY(-14px) rotate(-24deg); transition: transform 0.45s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes rwShake { 20% { transform: rotate(-4deg); } 40% { transform: rotate(4deg); } 60% { transform: rotate(-2deg); } 80% { transform: rotate(2deg); } }
.rw-items { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.rw-row { display: grid; grid-template-columns: 34px 1fr; grid-template-rows: auto auto; align-items: center; column-gap: 10px; padding: 8px 12px; border-radius: 10px; background: var(--well); box-shadow: var(--well-line); animation: rcRise 0.5s var(--royal-ease) both; }
.rw-row:nth-child(2) { animation-delay: 0.12s; } .rw-row:nth-child(3) { animation-delay: 0.24s; } .rw-row:nth-child(4) { animation-delay: 0.36s; }
.rw-row b { grid-row: 1 / 3; font-size: 26px; color: #f3c95c; text-align: center; }
.rw-v { font-family: var(--font-head); font-weight: 800; font-size: 22px; color: var(--gold-pale); font-variant-numeric: tabular-nums; }
.rw-row small { font-family: var(--font-head); font-size: 12px; letter-spacing: 0.06em; color: var(--ivory-2); }
.rw-row.item { box-shadow: inset 0 0 0 1px var(--gold-light), 0 0 14px rgba(246, 200, 100, 0.3); }
.rw-row.r-rare b { color: #5fa8ff; } .rw-row.r-epic b { color: #c38bff; } .rw-row.r-legendary b { color: #ffb547; }

/* ---------------------------------------------------------------- popups */
.court-toasts { position: absolute; z-index: 65; left: calc(14px + var(--safe-left)); bottom: calc(14px + var(--safe-bottom)); display: flex; flex-direction: column; gap: 8px; pointer-events: none; max-width: min(380px, 88vw); }
.ct-toast { display: flex; align-items: center; gap: 10px; padding: 9px 14px 9px 10px; border-radius: 12px; border: 2px solid transparent;
  background: url('../assets/images/royal/damask.svg') 0 0 / 80px padding-box, linear-gradient(180deg, rgba(36, 16, 14, 0.97), rgba(12, 6, 5, 0.96)) padding-box, var(--gold-edge) border-box;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.6); animation: ctIn 0.45s cubic-bezier(.2, 1.3, .4, 1) both; }
.ct-toast img { width: 30px; height: 30px; flex: none; }
.ct-toast > b { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; font-size: 17px; color: #2a1904; background: radial-gradient(circle at 35% 30%, #fff6d4, #f0c862 45%, #9a6a1e); }
.ct-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ct-text span { font-family: var(--font-head); font-weight: 800; font-size: 13.5px; letter-spacing: 0.03em; color: var(--gold-light); }
.ct-text small { font-family: var(--font-body); font-style: italic; font-weight: 600; font-size: 13.5px; color: var(--ivory-2); }
.ct-bar { display: block; width: 180px; height: 5px; border-radius: 3px; overflow: hidden; background: rgba(0, 0, 0, 0.6); }
.ct-bar u { display: block; height: 100%; transform-origin: left; background: linear-gradient(90deg, #a8752a, #f3d27a); }
.ct-toast.good { background: url('../assets/images/royal/damask.svg') 0 0 / 80px padding-box, linear-gradient(180deg, rgba(20, 70, 40, 0.97), rgba(6, 26, 14, 0.96)) padding-box, var(--gold-edge) border-box; }
.ct-toast.gold { background: url('../assets/images/royal/damask.svg') 0 0 / 80px padding-box, linear-gradient(180deg, rgba(120, 16, 28, 0.97), rgba(36, 6, 10, 0.96)) padding-box, var(--gold-edge-hot) border-box; }
.ct-toast.bad .ct-text span { color: #ffb4a6; }
.ct-toast.out { animation: ctOut 0.4s ease-in both; }
@keyframes ctIn { from { opacity: 0; transform: translateX(-40px) scale(0.92); } }
@keyframes ctOut { to { opacity: 0; transform: translateX(-30px); } }
.court-card { position: absolute; z-index: 66; right: calc(14px + var(--safe-right)); bottom: calc(14px + var(--safe-bottom)); width: min(360px, 90vw); padding: 14px 16px 14px;
  display: flex; flex-direction: column; gap: 8px; border-radius: 14px; border: 2px solid transparent; pointer-events: auto;
  background: url('../assets/images/royal/damask.svg') 0 0 / 80px padding-box, radial-gradient(130% 110% at 50% 0%, rgba(150, 18, 32, 0.95), rgba(26, 4, 8, 0.97)) padding-box, var(--gold-edge-hot) border-box;
  box-shadow: 0 0 26px rgba(246, 196, 90, 0.3), 0 16px 34px rgba(0, 0, 0, 0.65);
  opacity: 0; visibility: hidden; transform: translateY(30px) scale(0.95); transition: opacity 0.35s ease, transform 0.4s cubic-bezier(.2, 1.3, .4, 1), visibility 0s linear 0.4s; }
.court-card.show { opacity: 1; visibility: visible; transform: none; transition: opacity 0.35s ease, transform 0.4s cubic-bezier(.2, 1.3, .4, 1), visibility 0s; }
.cc-head { display: flex; align-items: center; gap: 10px; padding-right: 20px; }
.cc-head img { width: 36px; height: 36px; }
.cc-art { font-size: 30px; color: #f3c95c; }
.cc-head small { display: block; font-family: var(--font-head); font-weight: 800; font-size: 10.5px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--gold); }
.cc-head b { font-family: var(--font-display); font-weight: 900; font-size: 19px; color: var(--gold-pale); }
.court-card p { margin: 0; font-family: var(--font-body); font-weight: 600; font-size: 15px; color: var(--ivory); }
.cc-btns { display: flex; gap: 8px; }
.cc-btns .btn { flex: 1; }
.cc-x { position: absolute; right: 8px; top: 6px; width: 26px; height: 26px; border-radius: 50%; color: var(--gold-light); font-size: 14px; background: rgba(0, 0, 0, 0.35); }
.court-celebrate { position: absolute; inset: 0; z-index: 68; display: grid; place-items: center; pointer-events: none; opacity: 0; visibility: hidden;
  background: radial-gradient(ellipse at center, rgba(40, 6, 12, 0.6), rgba(4, 1, 2, 0.85)); transition: opacity 0.35s ease, visibility 0s linear 0.35s; }
.court-celebrate.show { opacity: 1; visibility: visible; pointer-events: auto; cursor: pointer; transition: opacity 0.35s ease, visibility 0s; }
.ccl-rays { position: absolute; left: 50%; top: 46%; width: 120vmin; height: 120vmin; transform: translate(-50%, -50%); border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(255, 212, 110, 0) 0deg 7deg, rgba(255, 212, 110, 0.3) 9deg 11deg, rgba(255, 212, 110, 0) 13deg 20deg);
  -webkit-mask-image: radial-gradient(circle, #000 8%, transparent 62%); mask-image: radial-gradient(circle, #000 8%, transparent 62%); }
.court-celebrate.show .ccl-rays { animation: cclRays 6s linear infinite; }
@keyframes cclRays { to { transform: translate(-50%, -50%) rotate(360deg); } }
.ccl-inner { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.court-celebrate.show .ccl-inner { animation: cclSlam 0.7s cubic-bezier(.2, 1, .3, 1) both; }
@keyframes cclSlam { 0% { opacity: 0; transform: scale(2.4); } 40% { opacity: 1; transform: scale(0.95); } 65% { transform: scale(1.03); } 100% { transform: none; } }
.ccl-art { display: grid; place-items: center; width: 110px; height: 110px; border-radius: 50%; font-size: 62px; color: #2a1904;
  background: radial-gradient(circle at 35% 30%, #fff6d4, #f0c862 45%, #9a6a1e); box-shadow: 0 0 0 4px #5a3a0e, 0 0 50px rgba(255, 210, 110, 0.8); }
.ccl-kicker { font-family: var(--font-head); font-weight: 800; font-size: clamp(12px, 2vh, 16px); letter-spacing: 0.4em; text-transform: uppercase; color: var(--gold-light); }
.ccl-title { font-family: var(--font-display); font-weight: 900; font-size: clamp(40px, 9vmin, 100px); line-height: 1.05;
  background: var(--gold-text); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 3px 0 #000) drop-shadow(0 0 24px rgba(255, 210, 120, 0.7)); }
.ccl-sub { font-family: var(--font-body); font-style: italic; font-weight: 600; font-size: clamp(16px, 2.6vh, 24px); color: var(--ivory); text-shadow: 0 2px 6px #000; }
.ccl-inner em { margin-top: 10px; font-family: var(--font-body); font-size: 13px; color: var(--ivory-3); }
.court-celebrate.rank .ccl-art { background: radial-gradient(circle at 35% 30%, #ffe1f0, #c43a8a 55%, #4a0a30); color: #fff3c4; }
.court-celebrate.calm .ccl-rays { display: none; }
.court-celebrate.calm.show .ccl-inner { animation: none; }

/* ---------------------------------------------------------------- the result card */
.result-court { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.result-court[hidden] { display: none; }
.rc-gain { display: flex; align-items: center; gap: 14px; padding: 8px 12px; border-radius: 10px; background: var(--well); box-shadow: var(--well-line); }
.rc-xp, .rc-du { display: flex; flex-direction: column; align-items: center; }
.rc-xp b, .rc-du b { font-family: var(--font-head); font-weight: 800; font-size: 22px; color: var(--gold-pale); font-variant-numeric: tabular-nums; }
.rc-du b { color: #f3c95c; }
.rc-xp small, .rc-du small { font-family: var(--font-head); font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); }
.rc-lv { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.rc-lv small { font-family: var(--font-head); font-size: 12px; color: var(--ivory-2); }
.rc-objs li { display: flex; align-items: center; gap: 8px; font-family: var(--font-body); font-weight: 700; font-size: 14.5px; color: var(--ivory-2); }
.rc-objs li i { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; font-style: normal; font-size: 12px; background: rgba(255, 80, 60, 0.25); color: #ffb4a6; }
.rc-objs li.met { color: var(--ivory); }
.rc-objs li.met i { background: rgba(80, 220, 120, 0.25); color: #8fe39a; }
.rc-medals, .rc-record { margin: 0; font-family: var(--font-head); font-weight: 700; font-size: 13px; color: var(--gold-pale); }
.rc-near { display: flex; flex-direction: column; gap: 3px; padding: 8px 12px; border-radius: 10px; background: linear-gradient(180deg, rgba(60, 20, 10, 0.6), rgba(20, 6, 4, 0.6)); box-shadow: inset 0 0 0 1px rgba(255, 160, 90, 0.45); }
.rc-near b { font-family: var(--font-head); font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: #ffb06a; }
.rc-near span { font-family: var(--font-body); font-weight: 700; font-size: 14.5px; color: var(--ivory); }
.rc-near em { font-family: var(--font-body); font-weight: 600; font-size: 14px; color: #f0d9a8; }
.rc-next { display: flex; flex-wrap: wrap; gap: 8px; }
.rc-next .btn { flex: 1 1 140px; }
#modal-run.court-set .panel-actions { display: none; }
.panel-result { max-height: calc(100vh - 24px); }

/* ---------------------------------------------------------------- settings: dark squares, volumes, theme grid */
.theme-grid { max-height: min(34vh, 330px); overflow: auto; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); padding: 2px; }
.th-swatch.bright span::after { content: ' ☀'; color: #f3c95c; }
.dark-pick { display: flex; align-items: center; gap: 14px; width: 100%; padding: 10px 12px; border-radius: 10px; background: var(--well); box-shadow: var(--well-line); }
#dp-preview { width: 76px; height: 76px; flex: none; border-radius: 6px; box-shadow: 0 0 0 2px rgba(232, 190, 98, 0.6), 0 6px 12px rgba(0, 0, 0, 0.5); }
.dp-body { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 0; }
.dp-title { font-family: var(--font-head); font-weight: 700; font-size: 15px; letter-spacing: 0.05em; color: var(--ivory); }
.dp-swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.dp-sw { --c: #333; width: 30px; height: 30px; border-radius: 8px; background: var(--c); box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(232, 190, 98, 0.55); transition: transform 0.15s ease; }
.dp-sw:hover { transform: translateY(-2px); }
.dp-sw.selected { box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.4), 0 0 0 3px var(--gold-pale), 0 0 12px rgba(246, 200, 100, 0.6); }
.dp-sw.dp-theme { width: auto; padding: 0 10px; font-family: var(--font-head); font-weight: 700; font-size: 11px; color: var(--gold-light); background: linear-gradient(180deg, #2a1a14, #120a07); }
.dp-custom { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-body); font-style: italic; font-weight: 600; font-size: 14px; color: var(--ivory-2); cursor: pointer; }
.dp-custom input { width: 42px; height: 30px; padding: 0; border: 0; border-radius: 6px; background: none; cursor: pointer; }
.setting.vol input[type=range] { position: static; opacity: 1; pointer-events: auto; width: min(220px, 40%); margin-left: auto; }
.setting.vol { cursor: default; }

/* ---------------------------------------------------------------- the boss's herald card */
.bc-intro.boss .bc-intro-card { background-image: url('../assets/images/royal/corner-tl.svg'), url('../assets/images/royal/corner-tr.svg'), url('../assets/images/royal/corner-bl.svg'), url('../assets/images/royal/corner-br.svg'),
  linear-gradient(90deg, transparent, var(--gold-line) 12%, var(--gold-line) 88%, transparent), linear-gradient(90deg, transparent, var(--gold-line) 12%, var(--gold-line) 88%, transparent),
  linear-gradient(180deg, transparent, var(--gold-line) 12%, var(--gold-line) 88%, transparent), linear-gradient(180deg, transparent, var(--gold-line) 12%, var(--gold-line) 88%, transparent),
  url('../assets/images/royal/damask.svg'), radial-gradient(130% 80% at 50% 0%, rgba(230, 30, 46, 0.75), rgba(140, 18, 34, 0) 70%), linear-gradient(180deg, #300a0c 0%, #170506 60%, #0c0202 100%), var(--gold-edge-hot);
  box-shadow: 0 0 60px rgba(220, 30, 40, 0.5), 0 26px 60px rgba(0, 0, 0, 0.72); }
.bc-intro.boss .bc-intro-event { filter: drop-shadow(0 3px 0 #1a0a03) drop-shadow(0 0 24px rgba(255, 60, 50, 0.6)); }

/* ---------------------------------------------------------------- comfort: large text, reduced motion */
body.text-large .panel, body.text-large .court-home, body.text-large .side-panel, body.text-large .court-toasts, body.text-large .court-card, body.text-large .hud-objective { zoom: 1.1; }
body.text-large .co-sub, body.text-large .cine-chip { zoom: 1.12; }
body.calm *, body.calm *::before, body.calm *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
@media (prefers-reduced-motion: reduce) {
  .court-badge.on, .cbt-node.can, .pb-dots i.now, .rw-art.chest .rw-chest { animation: none !important; }
  .court-celebrate.show .ccl-rays { animation: none; }
}
@media (max-width: 520px) {
  .cb-login { grid-template-columns: repeat(4, 1fr); }
  .cb-sgoals li { grid-template-columns: 1fr; }
  .court-tabs { gap: 4px; }
  .ct-tab span { display: none; }
  .ct-tab { padding: 7px 9px; }
}
