.sp-map-page {
  --sp-hud-h: clamp(82px, 12dvh, 112px);
  --sp-ink: #26180d;
  --sp-parchment: #f7e8bd;
  --sp-parchment-shadow: #c49a55;
  --sp-forest: #264b2c;
  --sp-forest-deep: #12331d;
  --sp-gold: #f5ce69;
  --sp-focus: #fff1b2;
  box-sizing: border-box;
  width: min(100%, 480px);
  height: 100dvh;
  max-height: 100dvh;
  margin-inline: auto;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  display: grid;
  grid-template-rows: var(--sp-hud-h) minmax(180px, 1fr) minmax(250px, 38dvh);
  overflow: hidden;
  isolation: isolate;
  color: var(--sp-ink);
  background: #102c1a;
  font-family: Georgia, 'Times New Roman', serif;
}

html.capacitor .sp-map-page {
  /* MainActivity reports Android insets in physical pixels. Use the app-wide
     clamped value so high-density screens do not turn the status inset into
     a large empty band. */
  --sp-safe-top: var(--cap-safe-top, 0px);
  width: 100%;
  height: 100%;
  max-height: 100%;
  padding-block: 0;
  grid-template-rows: calc(var(--sp-hud-h) + var(--sp-safe-top)) minmax(180px, 1fr) minmax(250px, 38dvh);
}

html.capacitor .sp-map-page .sp-map-hud {
  padding-top: calc(4px + var(--sp-safe-top));
}

.sp-map-fixture {
  margin: 0;
  overflow: hidden;
}

.sp-map-page *,
.sp-map-page *::before,
.sp-map-page *::after {
  box-sizing: border-box;
}

.sp-map-hud {
  min-height: 0;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 2px solid #93632a;
  color: #fff4cf;
  background:
    linear-gradient(180deg, rgba(68, 39, 16, 0.98), rgba(36, 21, 10, 0.98)),
    repeating-linear-gradient(135deg, rgba(255, 220, 136, 0.06) 0 2px, transparent 2px 8px);
  box-shadow: inset 0 -1px 0 rgba(255, 239, 182, 0.25);
}

.sp-map-back {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid rgba(255, 230, 164, 0.68);
  border-radius: 50%;
  padding: 0;
  color: #fff4cf;
  background: rgba(13, 8, 4, 0.38);
  font: 700 0.69rem/1 Georgia, 'Times New Roman', serif;
  cursor: pointer;
}

.sp-map-hud__journey {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 2px 7px;
  align-items: baseline;
  font-size: 0.68rem;
  line-height: 1.05;
}

.sp-map-hud__journey strong {
  grid-column: 1 / -1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.92rem;
}

.sp-map-hud__exam {
  color: #f8d77d;
  font-weight: 700;
}

.sp-map-hud__stage {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: rgba(255, 244, 207, 0.9);
}

.sp-map-hud__stats {
  display: grid;
  justify-items: end;
  gap: 3px;
  color: #fff4cf;
  font: 700 0.66rem/1 Georgia, 'Times New Roman', serif;
  white-space: nowrap;
}

.sp-map-hud__exam::after {
  content: ' ·';
}

.sp-map-hud__level::before { content: '★ '; color: var(--sp-gold); }
.sp-map-hud__xp::before { content: 'XP '; color: #bfe8ff; }
.sp-map-hud__gold::before { content: '● '; color: var(--sp-gold); }

.sp-map-board {
  position: relative;
  min-height: 0;
  overflow: hidden;
  contain: layout paint;
  background:
    radial-gradient(circle at 25% 70%, rgba(238, 200, 106, 0.15), transparent 36%),
    linear-gradient(160deg, #497844 0%, #274d32 55%, #193520 100%) center / cover no-repeat;
}

.sp-map-dock {
  min-height: 0;
  display: grid;
  grid-template-rows: 52px minmax(0, 1fr);
  border-top: 3px solid #9f7538;
  background: var(--sp-parchment);
  box-shadow: 0 -8px 22px rgba(7, 18, 9, 0.28);
}

.sp-map-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px 8px;
  background: #d8bc78;
}

.sp-map-tabs [role='tab'] {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid #76502b;
  border-radius: 9px 9px 0 0;
  padding: 8px 12px;
  color: #4b321b;
  background: #cbb27b;
  font: 700 0.875rem/1.1 Georgia, 'Times New Roman', serif;
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

.sp-map-tabs [role='tab'][aria-selected='true'] {
  color: var(--sp-ink);
  background: var(--sp-parchment);
  box-shadow: inset 0 3px 0 var(--sp-gold);
}

.sp-map-tabs [role='tab']:active {
  background-color: #b99755;
}

.sp-map-panel {
  min-height: 0;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(110, 68, 29, 0.1), transparent 8%, transparent 92%, rgba(110, 68, 29, 0.1)),
    var(--sp-parchment);
}

.sp-map-task-list {
  min-height: 0;
  max-height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: var(--sp-parchment-shadow) transparent;
}

.sp-map-task-panel {
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 8px;
}

.sp-map-task-panel--daily {
  --sp-daily-ink: #132f4c;
  --sp-daily-surface: #dce8f0;
  --sp-daily-border: #6d91ad;
  grid-template-rows: auto auto minmax(0, 1fr);
  color: var(--sp-daily-ink);
  background: var(--sp-daily-surface);
}

.sp-map-task-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  margin-bottom: 8px;
  border: 1px solid rgba(112, 73, 31, 0.45);
  border-radius: 10px;
  padding: 10px;
  background: rgba(255, 250, 227, 0.76);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.62) inset;
}

.sp-map-topic-list {
  margin-bottom: 8px;
}

.sp-map-topic-list__title {
  margin: 0 0 6px;
  color: #5b3b17;
  font-size: 0.86rem;
}

.sp-map-topic-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  border: 1px solid rgba(112, 73, 31, 0.35);
  border-radius: 9px;
  padding: 8px;
  background: rgba(255, 250, 227, 0.58);
}

.sp-map-topic-row__title {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 0.84rem;
  line-height: 1.2;
}

.sp-map-task-row--daily {
  border-color: var(--sp-daily-border);
  background: rgba(248, 252, 255, 0.85);
}

.sp-map-task-row__title,
.sp-map-task-row__progress,
.sp-map-task-row__reward,
.sp-map-task-row__status,
.sp-map-daily-caption,
.sp-map-daily-date,
.sp-map-task-empty {
  margin: 0;
}

.sp-map-task-row__title {
  min-width: 0;
  overflow-wrap: anywhere;
  color: inherit;
  font-size: 0.94rem;
  line-height: 1.2;
}

.sp-map-task-row__progress,
.sp-map-task-row__reward,
.sp-map-daily-date,
.sp-map-task-empty {
  font-size: 0.78rem;
  line-height: 1.25;
}

.sp-map-task-row__progress {
  align-self: end;
  white-space: nowrap;
  color: #6c4b29;
}

.sp-map-task-row--daily .sp-map-task-row__progress {
  color: #315b79;
}

.sp-map-task-row__reward {
  grid-column: 1 / -1;
  color: #73521f;
  font-weight: 700;
}

.sp-map-task-row--daily .sp-map-task-row__reward {
  color: #245675;
}

.sp-map-task-row__action,
.sp-map-topic-row__action,
.sp-map-secondary-action,
.sp-map-advance {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid #755021;
  border-radius: 8px;
  padding: 9px 12px;
  color: #fff7dc;
  background: #4c7435;
  font: 700 0.78rem/1.1 Georgia, 'Times New Roman', serif;
  cursor: pointer;
  transition: background-color 140ms ease, opacity 140ms ease;
}

.sp-map-main-actions {
  display: grid;
  gap: 6px;
}

.sp-map-main-actions__utilities {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.sp-map-secondary-action {
  border-color: #76502b;
  color: #4b321b;
  background: #e4cd96;
}

.sp-map-task-row--daily .sp-map-task-row__action {
  border-color: #315b79;
  background: #2e668d;
}

.sp-map-task-row__action:active,
.sp-map-topic-row__action:active,
.sp-map-secondary-action:active,
.sp-map-advance:active {
  background-color: #345323;
}

.sp-map-task-row__status {
  min-height: 44px;
  display: grid;
  place-items: center end;
  color: #1e6e35;
  font-size: 0.78rem;
  font-weight: 700;
}

.sp-map-task-row--daily .sp-map-task-row__status {
  color: #245675;
}

.sp-map-daily-caption {
  color: #173f61;
  font-size: 0.82rem;
  font-weight: 700;
}

.sp-map-daily-date {
  color: #315b79;
}

.sp-map-daily-error-state {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 16px 8px;
  text-align: center;
}

.sp-map-daily-error {
  margin: 0;
  color: #8f1f28;
  font-size: 0.82rem;
  line-height: 1.3;
}

.sp-map-task-empty {
  padding: 16px 8px;
  text-align: center;
  color: #6c4b29;
}

.sp-map-task-panel--daily .sp-map-task-empty {
  color: #315b79;
}

.sp-map-advance {
  width: 100%;
  border-color: #315720;
  background: #356f37;
  box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.45) inset;
}

.sp-map-advance:disabled {
  border-color: #8d7b5d;
  color: #665c4c;
  background: #c5b89c;
  cursor: not-allowed;
  opacity: 0.88;
}

.sp-map-page button:focus-visible,
.sp-map-page [role='tab']:focus-visible,
.sp-map-stage:focus-visible {
  outline: 3px solid var(--sp-focus);
  outline-offset: -4px;
  box-shadow: 0 0 0 5px rgba(62, 36, 14, 0.95);
}

.sp-map-stage {
  position: absolute;
  left: var(--sp-x, 50%);
  top: var(--sp-y, 50%);
  width: max(44px, calc(48px * var(--sp-scale, 1)));
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 3px solid #62401c;
  border-radius: 50%;
  display: grid;
  place-items: center;
  padding: 0;
  color: #fff8d9;
  background: #5d6f4a;
  font: 700 clamp(0.72rem, 3.6vw, 0.98rem)/1 Georgia, 'Times New Roman', serif;
  cursor: pointer;
}

.sp-map-stage--completed { background: var(--sp-forest); }
.sp-map-stage--active { border-color: #fff0a7; background: #b47428; box-shadow: 0 0 0 4px rgba(245, 206, 105, 0.42), 0 0 18px rgba(255, 225, 119, 0.84); }
.sp-map-stage--locked { opacity: 0.64; background: #5d5c50; }

.sp-map-stage__number {
  position: relative;
  z-index: 2;
  text-shadow: 0 1px 2px #241307;
}

.sp-map-stage__state {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.sp-map-page .sp-map-knight,
.sp-map-page [data-sp-knight] {
  position: absolute;
  z-index: 1;
  left: 50%;
  bottom: 38%;
  width: clamp(34px, 11vw, 48px);
  height: clamp(34px, 11vw, 48px);
  object-fit: contain;
  transform: translateX(-50%);
  filter: drop-shadow(0 3px 2px rgba(12, 8, 3, 0.52));
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .sp-map-page *,
  .sp-map-page *::before,
  .sp-map-page *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (min-width: 481px) {
  .sp-map-page {
    box-shadow: 0 0 0 1px rgba(245, 206, 105, 0.25), 0 18px 56px rgba(4, 12, 6, 0.42);
  }
}

/* medieval campaign UI — visual redesign */
.sp-map-page {
  --sp-hud-h: clamp(104px, 13dvh, 118px);
  --sp-oak-950: #160e08;
  --sp-oak-900: #24150b;
  --sp-oak-800: #3c2413;
  --sp-iron: #252721;
  --sp-iron-light: #4b4b40;
  --sp-brass: #bd8430;
  --sp-brass-light: #f0c66a;
  --sp-parchment: #ead3a4;
  --sp-parchment-light: #f7e6bd;
  --sp-ink: #24170c;
  --sp-slate: #253649;
  --sp-success: #347a35;
  grid-template-rows: var(--sp-hud-h) minmax(210px, 1fr) minmax(238px, 37dvh);
  border-inline: 3px solid #17130d;
  color: var(--sp-ink);
  background: #0d160e;
  font-family: Georgia, 'Times New Roman', serif;
  box-shadow:
    0 0 0 1px #6b4a23,
    0 20px 60px rgba(0, 0, 0, 0.5);
}

.sp-map-hud {
  position: relative;
  z-index: 40;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(50px, 1fr) 42px;
  gap: 5px;
  padding: 6px 8px 7px;
  border: 0;
  border-bottom: 4px ridge #6d4a24;
  color: #f8e8bd;
  background:
    linear-gradient(90deg, rgba(255, 223, 145, 0.04), transparent 18% 82%, rgba(255, 223, 145, 0.04)),
    repeating-linear-gradient(90deg, transparent 0 36px, rgba(0, 0, 0, 0.13) 37px 39px),
    linear-gradient(180deg, #2b2016 0%, #17130f 52%, #0b0d0b 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 225, 159, 0.28),
    inset 0 -2px 0 rgba(0, 0, 0, 0.7),
    0 5px 14px rgba(0, 0, 0, 0.42);
}

.sp-map-hud::before,
.sp-map-hud::after {
  content: '';
  position: absolute;
  top: 5px;
  bottom: 7px;
  width: 4px;
  border-radius: 3px;
  background: linear-gradient(90deg, #151612, #777362 45%, #24251f);
  box-shadow: 0 0 0 1px #0c0d0b;
}

.sp-map-hud::before { left: 2px; }
.sp-map-hud::after { right: 2px; }

.sp-map-hud__primary {
  min-width: 0;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 5px;
}

.sp-map-back,
.sp-map-hud__title,
.sp-map-hud__journey,
.sp-map-hud__stats > span {
  border: 2px ridge #6f5128;
  border-radius: 4px;
  background:
    linear-gradient(180deg, rgba(255, 232, 167, 0.09), transparent 42%),
    linear-gradient(180deg, #32261a, #17140f);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.72),
    0 2px 3px rgba(0, 0, 0, 0.55);
}

.sp-map-back {
  min-width: 46px;
  min-height: 46px;
  border-radius: 5px;
  display: grid;
  place-items: center;
  color: var(--sp-brass-light);
}

.sp-map-back__arrow,
.sp-map-task-row__arrow {
  position: relative;
  width: 27px;
  height: 18px;
  display: block;
  background: linear-gradient(180deg, #ffe27c, #d78b19 72%, #9b520a);
  clip-path: polygon(0 50%, 36% 0, 36% 29%, 100% 29%, 100% 71%, 36% 71%, 36% 100%);
  filter: drop-shadow(0 1px 0 #fff0a6) drop-shadow(0 2px 1px #140c05);
}

.sp-map-back__arrow::after,
.sp-map-task-row__arrow::after {
  content: '';
  position: absolute;
  inset: 3px;
  background: rgba(255, 246, 181, 0.34);
  clip-path: inherit;
}

.sp-map-hud__title {
  min-width: 0;
  min-height: 46px;
  padding: 5px 10px;
  overflow: hidden;
  border-color: #a16c25;
  color: #f5c75c;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 800 clamp(0.9rem, 4.1vw, 1.2rem)/1 Georgia, serif;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-shadow: 0 2px 0 #261308, 0 0 9px rgba(222, 165, 64, 0.34);
  cursor: pointer;
}

.sp-map-hud__title:active,
.sp-map-back:active {
  background: linear-gradient(180deg, #17140f, #2d2116);
  transform: translateY(1px);
}

.sp-map-hud__journey {
  min-width: 94px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 3px;
  padding: 4px 7px;
  color: #d9c699;
  font-size: clamp(0.61rem, 2.5vw, 0.72rem);
  line-height: 1;
  white-space: nowrap;
}

.sp-map-hud__journey strong {
  grid-column: auto;
  color: #fff0c5;
  font-size: inherit;
  text-transform: uppercase;
}

.sp-map-hud__exam { color: #d9c699; }
.sp-map-hud__stage { color: #fff0c5; }

.sp-map-hud__stats {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(72px, 0.72fr) minmax(132px, 1.6fr) minmax(76px, 0.8fr);
  align-items: stretch;
  gap: 6px;
  color: #fff0c5;
  font: 700 clamp(0.62rem, 2.7vw, 0.75rem)/1 Georgia, serif;
}

.sp-map-hud__stats > span {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 4px 6px;
}

.sp-map-hud__level::before {
  content: '';
  width: 19px;
  height: 22px;
  flex: 0 0 auto;
  clip-path: polygon(50% 0, 94% 18%, 86% 76%, 50% 100%, 14% 76%, 6% 18%);
  background: linear-gradient(135deg, #4d7ba5, #173653);
  box-shadow: inset 0 0 0 2px #e8bd55;
}

.sp-map-hud__xp::before { content: none; }
.sp-map-hud__gold::before { content: none; }

.sp-map-hud__xp-label {
  color: #f2c65d;
  font-size: 0.72rem;
}

.sp-map-hud__xp-track {
  position: relative;
  min-width: 38px;
  height: 9px;
  flex: 1 1 auto;
  overflow: hidden;
  border: 1px solid #0b0c0a;
  border-radius: 2px;
  background: #080d10;
  box-shadow: inset 0 1px 3px #000, 0 0 0 1px #5c543f;
}

.sp-map-hud__xp-fill,
.sp-map-hud__xp-track > span {
  display: block;
  width: var(--sp-xp, 0%);
  height: 100%;
  background: linear-gradient(180deg, #63d9ff, #087ec8 60%, #07528b);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 0 7px rgba(50, 186, 255, 0.55);
}

.sp-map-hud__xp-value { white-space: nowrap; }

.sp-map-hud__gold::before {
  content: none;
}

.sp-map-hud__gold img {
  width: 23px;
  height: 23px;
  flex: 0 0 auto;
  object-fit: contain;
  filter: drop-shadow(0 1px 1px #120b04) drop-shadow(0 0 3px rgba(255, 202, 70, 0.38));
}

.sp-map-board {
  position: relative;
  min-height: 0;
  overflow: hidden;
  container-type: size;
  contain: layout paint;
  border-inline: 1px solid #0e100c;
  background: #142519;
  isolation: isolate;
}

.sp-map-scene {
  position: absolute;
  z-index: 0;
  left: 50%;
  top: 50%;
  width: 100%;
  height: 100%;
  transform: translate(-50%, -50%);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

@supports (width: 1cqw) {
  .sp-map-scene {
    width: max(100cqw, 100cqh);
    height: max(100cqw, 100cqh);
    background-size: 100% 100%;
  }
}

.sp-map-scene::after {
  content: '';
  position: absolute;
  z-index: 1;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(6, 12, 7, 0.12), transparent 22% 72%, rgba(7, 12, 7, 0.22)),
    radial-gradient(circle at 50% 50%, transparent 58%, rgba(5, 10, 6, 0.28) 100%);
}

.sp-map-scene::before {
  content: '';
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
  opacity: 0.82;
  background: center / 100% 100% no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cpath d='M18 79 C27 79 31 77 36 75 S48 71 53 68 S69 64 67 58 S55 53 60 48 S76 45 72 39 S62 35 67 31 S82 29 78 25 S69 23 73 20 S82 19 86 19' fill='none' stroke='%23332619' stroke-width='11' stroke-linecap='round' stroke-linejoin='round' opacity='.72'/%3E%3Cpath d='M18 79 C27 79 31 77 36 75 S48 71 53 68 S69 64 67 58 S55 53 60 48 S76 45 72 39 S62 35 67 31 S82 29 78 25 S69 23 73 20 S82 19 86 19' fill='none' stroke='%23927a52' stroke-width='7.5' stroke-linecap='round' stroke-linejoin='round' opacity='.76'/%3E%3Cpath d='M18 79 C27 79 31 77 36 75 S48 71 53 68 S69 64 67 58 S55 53 60 48 S76 45 72 39 S62 35 67 31 S82 29 78 25 S69 23 73 20 S82 19 86 19' fill='none' stroke='%23d1bc8c' stroke-width='.9' stroke-dasharray='2 2' stroke-linecap='round' opacity='.62'/%3E%3C/svg%3E");
  filter: drop-shadow(0 3px 2px rgba(16, 10, 5, 0.5));
  mix-blend-mode: multiply;
}

.sp-map-location {
  position: absolute;
  z-index: 30;
  top: 8px;
  left: 8px;
  max-width: calc(100% - 16px);
  min-height: 34px;
  display: grid;
  align-content: center;
  border: 2px ridge #75552a;
  border-radius: 3px;
  padding: 7px 11px 6px 35px;
  overflow: hidden;
  color: #f4dfaa;
  text-transform: none;
  background: linear-gradient(180deg, rgba(54, 40, 25, 0.96), rgba(20, 18, 14, 0.96));
  box-shadow: inset 0 0 0 1px #111, 0 3px 8px rgba(0, 0, 0, 0.5);
  font-size: clamp(0.66rem, 2.7vw, 0.78rem);
  font-weight: 800;
  line-height: 1.05;
}

.sp-map-location strong {
  color: #f0c568;
  font-size: 0.62rem;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.sp-map-location span {
  min-width: 0;
  overflow: hidden;
  color: #fff0c6;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sp-map-location::before {
  content: '';
  position: absolute;
  left: 9px;
  width: 16px;
  height: 16px;
  border: 1px solid #6a4a20;
  background: linear-gradient(135deg, #d5c28b 49%, #7d9b62 50%);
  transform: rotate(-7deg);
}

.sp-map-stage {
  z-index: 5;
  width: clamp(38px, calc(67px * var(--sp-scale, 1)), 72px);
  min-width: 38px;
  min-height: 38px;
  aspect-ratio: 1;
  border: 0;
  border-radius: 0;
  padding: 0;
  color: #2d1b0e;
  background: center / contain no-repeat url('../img/success-path/ui/stage-platform.webp');
  filter: drop-shadow(0 4px 3px rgba(18, 11, 5, 0.58));
  font-size: clamp(0.9rem, 4vw, 1.16rem);
  cursor: default;
  isolation: isolate;
}

.sp-map-stage::before {
  content: '';
  position: absolute;
  z-index: 1;
  inset: 10%;
  border-radius: 50%;
  pointer-events: none;
}

.sp-map-stage--completed {
  background-color: transparent;
  filter: sepia(0.12) saturate(0.8) drop-shadow(0 4px 3px rgba(18, 11, 5, 0.58));
}

.sp-map-stage--completed::after {
  content: '✓';
  position: absolute;
  z-index: 5;
  right: -3px;
  top: -5px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 2px solid #dbc27c;
  border-radius: 50%;
  color: #fffbd4;
  background: linear-gradient(180deg, #559e48, #215d2a);
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.48);
  font: 900 0.82rem/1 Arial, sans-serif;
}

.sp-map-stage--active {
  z-index: 16;
  border: 0;
  background-color: transparent;
  box-shadow: none;
  filter:
    sepia(0.14)
    saturate(1.2)
    drop-shadow(0 0 4px #ffd463)
    drop-shadow(0 0 10px rgba(255, 193, 55, 0.82));
}

.sp-map-stage--active::before {
  border: 3px solid #ffd76d;
  box-shadow: inset 0 0 10px rgba(255, 204, 80, 0.55), 0 0 8px rgba(255, 205, 78, 0.75);
}

.sp-map-stage--locked {
  opacity: 0.84;
  background-color: transparent;
  filter: grayscale(0.72) brightness(0.72) drop-shadow(0 3px 2px rgba(9, 8, 6, 0.52));
}

.sp-map-stage__number {
  z-index: 4;
  color: #29190c;
  text-shadow: 0 1px 0 rgba(255, 242, 194, 0.95), 0 2px 2px rgba(25, 13, 5, 0.38);
}

.sp-map-page .sp-map-knight,
.sp-map-page [data-sp-knight] {
  z-index: 6;
  bottom: 38%;
  width: clamp(64px, 19vw, 92px);
  height: clamp(64px, 19vw, 92px);
  filter: drop-shadow(0 5px 3px rgba(10, 7, 3, 0.72));
}

.sp-map-dock {
  position: relative;
  z-index: 35;
  grid-template-rows: 52px minmax(0, 1fr);
  border: 5px ridge #6e4c25;
  border-bottom-width: 7px;
  background: #191913;
  box-shadow: 0 -7px 18px rgba(0, 0, 0, 0.48), inset 0 0 0 2px #17130d;
}

.sp-map-tabs {
  gap: 7px;
  padding: 4px 6px 0;
  background: linear-gradient(180deg, #2f2519, #171712);
}

.sp-map-tabs [role='tab'] {
  min-height: 44px;
  border: 2px ridge #676052;
  border-radius: 4px 4px 0 0;
  padding: 8px 7px;
  color: #cbd3dc;
  background: linear-gradient(180deg, #35475d, #1d2b3b);
  box-shadow: inset 0 0 0 1px #111922;
  font-size: clamp(0.76rem, 3.5vw, 0.92rem);
  text-transform: uppercase;
}

.sp-map-tabs [role='tab'][aria-selected='true'] {
  border-color: #b17620;
  color: #402305;
  background: linear-gradient(180deg, #ffd36c, #e69a22);
  box-shadow: inset 0 1px 0 #fff0a4, inset 0 0 0 1px #8d5312;
}

.sp-map-tabs [role='tab']:active { background-color: #bd7820; }

.sp-map-panel {
  border: 3px ridge #8b6634;
  background:
    radial-gradient(circle at 18% 22%, rgba(255, 255, 255, 0.26), transparent 25%),
    linear-gradient(90deg, rgba(95, 60, 25, 0.12), transparent 8% 92%, rgba(95, 60, 25, 0.12)),
    var(--sp-parchment);
  box-shadow: inset 0 0 18px rgba(105, 64, 25, 0.22);
}

.sp-map-task-panel {
  gap: 6px;
  padding: 7px 9px 8px;
}

.sp-map-task-list {
  padding-inline: 2px;
  scrollbar-width: thin;
}

.sp-map-task-row {
  min-height: 72px;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 48px;
  align-items: center;
  gap: 8px;
  margin: 0;
  border: 0;
  border-bottom: 1px solid rgba(92, 57, 23, 0.28);
  border-radius: 0;
  padding: 7px 2px;
  background: transparent;
  box-shadow: 0 1px 0 rgba(255, 250, 222, 0.42);
}

.sp-map-task-row__icon {
  width: 48px;
  height: 48px;
  border: 3px ridge #6e512d;
  border-radius: 5px;
  background: #25231d center / 72% 72% no-repeat url('../img/success-path/ui/task-scroll.svg');
  box-shadow: inset 0 0 0 1px #0f100d, 0 2px 3px rgba(67, 40, 17, 0.35);
}

.sp-map-task-row[data-task-kind='study_topic'] .sp-map-task-row__icon,
.sp-map-task-row[data-task-kind='review_topic'] .sp-map-task-row__icon {
  background-image: url('../img/success-path/ui/task-book.svg');
}

.sp-map-task-row[data-task-kind='topic_correct_answers'] .sp-map-task-row__icon {
  background-image: url('../img/success-path/ui/task-swords.svg');
}

.sp-map-task-row[data-task-kind='mock_exam_complete'] .sp-map-task-row__icon {
  background-image: url('../img/success-path/ui/task-chest.svg');
}

.sp-map-task-row__content {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 8px;
  align-items: center;
}

.sp-map-task-row__title {
  grid-column: 1 / -1;
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: #21150b;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: clamp(0.85rem, 3.6vw, 1rem);
  line-height: 1.12;
}

.sp-map-task-row__progress {
  align-self: center;
  color: #624525;
  font-size: 0.73rem;
}

.sp-map-task-row__reward {
  grid-column: auto;
  display: flex;
  align-items: center;
  justify-content: end;
  gap: 8px;
  color: #4f3315;
  font-size: 0.74rem;
}

.sp-map-task-row__reward-xp,
.sp-map-task-row__reward-gold {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}

.sp-map-task-row__reward-xp::before {
  content: 'XP';
  width: 21px;
  height: 21px;
  display: grid;
  place-items: center;
  clip-path: polygon(50% 0, 63% 31%, 98% 35%, 72% 58%, 80% 94%, 50% 75%, 20% 94%, 28% 58%, 2% 35%, 37% 31%);
  color: #4c2a08;
  background: #efb52d;
  font: 800 0.48rem/1 Arial, sans-serif;
}

.sp-map-task-row__reward-gold::before {
  content: none;
}

.sp-map-task-row__reward-gold img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  filter: drop-shadow(0 1px 1px rgba(63, 34, 8, 0.55));
}

.sp-map-task-row__reward-gold .sp-map-gold-value {
  color: #142a46 !important;
}

.sp-map-task-row__action,
.sp-map-task-row__status {
  min-width: 44px;
  width: 44px;
  min-height: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  margin: 0;
  border: 2px ridge #6f5128;
  border-radius: 50%;
  padding: 4px;
  color: #fff4ce;
  background: linear-gradient(180deg, #4c7f40, #285c2b);
  font-size: 1.35rem;
  font-weight: 900;
  line-height: 1;
  text-align: center;
}

.sp-map-daily-error-state .sp-map-task-row__action--retry {
  width: auto;
  min-width: 112px;
  padding-inline: 18px;
  border-radius: 6px;
  font-size: 0.82rem;
}

.sp-map-task-row__status {
  color: #fffbd8;
  font: 900 1.5rem/1 Arial, sans-serif;
}

.sp-map-task-row.is-completed:not(.is-claimed) .sp-map-task-row__action {
  border-radius: 5px;
  color: #482803;
  background: linear-gradient(180deg, #ffd671, #dda02d);
}

.sp-map-task-row__action--open {
  border-radius: 5px;
  background:
    linear-gradient(180deg, rgba(255, 226, 129, 0.12), transparent 45%),
    linear-gradient(180deg, #3b2b1c, #17140f);
  box-shadow: inset 0 0 0 1px #0b0b09, 0 2px 3px rgba(50, 29, 10, 0.42);
}

.sp-map-task-row__action--open .sp-map-task-row__arrow {
  width: 26px;
  height: 17px;
  transform: rotate(180deg);
}

.sp-map-task-row.is-completed:not(.is-claimed) .sp-map-task-row__action--claim {
  position: relative;
  overflow: visible;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 42%, #fff2a8, #e3a126 58%, #8e4b0a 100%);
  box-shadow: inset 0 0 0 2px #6b3608, 0 0 0 2px #f3cf68, 0 0 12px rgba(255, 185, 48, 0.7);
  animation: sp-claim-ready 1.8s ease-in-out infinite;
}

.sp-map-task-row__action--claim img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  filter: drop-shadow(0 2px 1px rgba(63, 31, 5, 0.52));
}

.sp-map-task-row__action--claim::after {
  content: '';
  position: absolute;
  inset: -6px;
  border: 2px solid rgba(255, 224, 119, 0.72);
  border-radius: 50%;
  opacity: 0;
  animation: sp-claim-ring 1.8s ease-out infinite;
}

.sp-map-task-row.is-claiming {
  pointer-events: none;
}

.sp-map-task-row.is-claiming .sp-map-task-row__action--claim {
  animation: sp-claim-collect 420ms cubic-bezier(0.2, 0.9, 0.25, 1) both;
}

.sp-map-task-row.is-claiming .sp-map-task-row__reward {
  animation: sp-reward-values 360ms ease-out both;
}

@keyframes sp-claim-ready {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-2px) scale(1.04); }
}

@keyframes sp-claim-ring {
  0% { transform: scale(0.72); opacity: 0; }
  30% { opacity: 0.72; }
  75%, 100% { transform: scale(1.22); opacity: 0; }
}

@keyframes sp-claim-collect {
  0% { transform: translateY(0) rotate(0) scale(1); opacity: 1; }
  42% { transform: translateY(-8px) rotate(-8deg) scale(1.18); opacity: 1; }
  100% { transform: translateY(-18px) rotate(7deg) scale(0.72); opacity: 0; }
}

@keyframes sp-reward-values {
  from { transform: translateY(0); opacity: 1; }
  to { transform: translateY(-7px); opacity: 0.3; }
}

@media (prefers-reduced-motion: reduce) {
  .sp-map-task-row.is-completed:not(.is-claimed) .sp-map-task-row__action--claim,
  .sp-map-task-row__action--claim::after,
  .sp-map-task-row.is-claiming .sp-map-task-row__action--claim,
  .sp-map-task-row.is-claiming .sp-map-task-row__reward {
    animation: none !important;
  }
}

.sp-map-task-panel--daily {
  color: #182535;
  background: linear-gradient(180deg, #d9e0e1, #b9c8d0);
}

.sp-map-task-panel--daily .sp-map-task-row {
  border-color: rgba(36, 64, 86, 0.25);
  background: transparent;
}

.sp-map-main-actions {
  display: block;
  padding-top: 2px;
}

.sp-map-main-actions__utilities,
.sp-map-secondary-action,
.sp-map-topic-list {
  display: none;
}

.sp-map-advance {
  position: relative;
  width: min(100%, 330px);
  min-height: 48px;
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 3px ridge #ae792a;
  border-radius: 5px;
  padding: 8px 46px 8px 20px;
  color: #3d2408;
  background: linear-gradient(180deg, #ffd672, #d99725);
  box-shadow: inset 0 1px 0 #fff0a2, 0 2px 3px rgba(66, 38, 12, 0.38);
  font-size: clamp(0.78rem, 3.5vw, 0.94rem);
  text-transform: uppercase;
}

.sp-map-advance:disabled {
  border-color: #706858;
  color: #4e4a43;
  background: linear-gradient(180deg, #b4aa98, #898174);
  box-shadow: inset 0 1px 0 #d8d0c2, 0 2px 3px rgba(52, 42, 31, 0.32);
  opacity: 1;
}

.sp-map-advance__lock {
  position: absolute;
  right: 18px;
  bottom: 11px;
  width: 15px;
  height: 14px;
  border: 2px solid #514b40;
  border-radius: 2px;
}

.sp-map-advance__lock::before {
  content: '';
  position: absolute;
  left: 2px;
  top: -10px;
  width: 7px;
  height: 9px;
  border: 2px solid #514b40;
  border-bottom: 0;
  border-radius: 7px 7px 0 0;
}

.sp-map-page button:focus-visible,
.sp-map-page [role='tab']:focus-visible,
.sp-map-stage:focus-visible {
  outline: 3px solid #fff3a6;
  outline-offset: -3px;
  box-shadow: 0 0 0 5px rgba(35, 22, 9, 0.95);
}

@media (max-width: 390px) {
  .sp-map-hud__primary {
    grid-template-columns: 44px minmax(0, 1fr) 104px;
  }

  .sp-map-hud__title {
    padding-inline: 5px;
    font-size: 0.78rem;
    letter-spacing: 0;
  }

  .sp-map-hud__journey {
    min-width: 104px;
    padding-inline: 2px;
    font-size: 0.52rem;
  }

  .sp-map-hud__stats {
    grid-template-columns: 68px minmax(122px, 1fr) 72px;
    gap: 4px;
  }

  .sp-map-hud__xp-value { font-size: 0.58rem; }
  .sp-map-location { font-size: 0.61rem; }
}

@media (max-height: 700px) {
  .sp-map-page {
    --sp-hud-h: 100px;
    grid-template-rows: var(--sp-hud-h) minmax(190px, 1fr) minmax(224px, 36dvh);
  }

  .sp-map-task-row { min-height: 64px; }
  .sp-map-task-row__icon { width: 42px; height: 42px; }
}

@media (orientation: landscape) and (max-height: 500px) {
  .sp-map-page {
    --sp-hud-h: 88px;
    grid-template-rows: var(--sp-hud-h) minmax(126px, 1fr) minmax(148px, 40dvh);
  }

  .sp-map-hud {
    grid-template-rows: 40px 34px;
    gap: 3px;
    padding-block: 4px;
  }

  .sp-map-back,
  .sp-map-hud__title {
    min-height: 40px;
  }

  .sp-map-hud__stats > span {
    padding-block: 2px;
  }

  .sp-map-dock {
    grid-template-rows: 44px minmax(0, 1fr);
  }

  .sp-map-tabs [role='tab'] {
    min-height: 40px;
    padding-block: 5px;
  }

  .sp-map-task-row {
    min-height: 58px;
    padding-block: 4px;
  }
}

/* reference fidelity pass — compact medieval HUD and task dock */
.sp-map-page {
  --sp-hud-h: clamp(102px, 12.5dvh, 110px);
  grid-template-rows: var(--sp-hud-h) minmax(190px, 1fr) minmax(286px, 40dvh);
}

.sp-map-hud {
  grid-template-rows: 51px 39px;
  gap: 4px;
  padding: 5px 8px 7px;
  border-bottom: 4px ridge #8e672e;
  background:
    linear-gradient(90deg, rgba(234, 189, 91, 0.05), transparent 16% 84%, rgba(234, 189, 91, 0.05)),
    repeating-linear-gradient(90deg, transparent 0 44px, rgba(0, 0, 0, 0.14) 45px 47px),
    linear-gradient(180deg, #34271b 0%, #181510 48%, #090b0a 100%);
}

.sp-map-hud__primary {
  grid-template-columns: 48px minmax(142px, 1fr) minmax(116px, 35%);
  gap: 6px;
}

.sp-map-back,
.sp-map-hud__title,
.sp-map-hud__journey,
.sp-map-hud__stats > span {
  border: 2px ridge #73542a;
  background:
    linear-gradient(180deg, rgba(255, 231, 159, 0.1), transparent 42%),
    linear-gradient(180deg, #33271c, #15130f);
  box-shadow: inset 0 0 0 1px #080907, 0 2px 4px rgba(0, 0, 0, 0.58);
}

.sp-map-back {
  position: relative;
  width: 48px;
  min-width: 48px;
  min-height: 48px;
  border-width: 3px;
  border-color: #87602a;
  border-radius: 4px;
}

.sp-map-back__arrow {
  position: absolute;
  left: 50%;
  top: 50%;
  margin: 0;
  transform: translate(-50%, -50%);
}

.sp-map-hud__title {
  position: relative;
  min-height: 48px;
  border: 3px ridge #a9782e;
  border-radius: 3px;
  padding: 5px 8px;
  color: #ffd56b;
  background:
    linear-gradient(180deg, rgba(255, 227, 145, 0.18), transparent 38%),
    linear-gradient(180deg, #4a341d, #24180f 62%, #120e0a);
  box-shadow:
    inset 0 0 0 1px #100c08,
    inset 0 0 0 3px rgba(208, 145, 48, 0.18),
    0 2px 4px rgba(0, 0, 0, 0.58);
  overflow: hidden;
  font-size: clamp(0.8rem, 3.65vw, 1.08rem);
  letter-spacing: 0.01em;
  text-overflow: clip;
  white-space: nowrap;
  text-shadow: 0 2px 0 #1c0e05, 0 0 8px rgba(255, 202, 83, 0.3);
}

.sp-map-hud__title::before,
.sp-map-hud__title::after {
  content: none;
}

.sp-map-hud__journey {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 5px 6px;
  color: #e9d6a8;
  font-size: clamp(0.61rem, 2.55vw, 0.72rem);
  text-shadow: 0 1px 1px #000;
}

.sp-map-hud__exam::after {
  content: none;
}

.sp-map-hud__journey strong {
  color: #fff0c7;
  font-size: inherit;
}

.sp-map-hud__stats {
  grid-template-columns: minmax(68px, 0.8fr) minmax(132px, 1.75fr) minmax(74px, 0.82fr);
  gap: 5px;
  margin-left: 54px;
  color: #fff0c7;
  font-size: clamp(0.64rem, 2.75vw, 0.76rem);
}

.sp-map-hud__stats > span {
  min-height: 37px;
  padding: 3px 6px;
  border-color: #725327;
  color: #fff0c7;
  text-shadow: 0 1px 1px #000;
}

.sp-map-hud__level {
  color: #ffe09a !important;
}

.sp-map-hud__level::before {
  width: 18px;
  height: 21px;
  outline: 1px solid #d6a846;
  outline-offset: -3px;
}

.sp-map-hud__xp-label {
  color: #ffd45d;
  font-weight: 900;
  text-shadow: 0 1px 0 #4b2705;
}

.sp-map-hud__xp-track {
  min-width: 34px;
  height: 10px;
  border-color: #000;
  box-shadow: inset 0 1px 3px #000, 0 0 0 1px #82714c;
}

.sp-map-hud__xp-value,
.sp-map-gold-value {
  color: #fff2cf;
  font-variant-numeric: tabular-nums;
}

.sp-map-location {
  top: 8px;
  left: 8px;
  width: max-content;
  max-width: calc(100% - 16px);
  min-height: 31px;
  display: flex;
  align-items: center;
  gap: 4px;
  border-color: #765429;
  padding: 5px 10px 5px 34px;
  font-size: clamp(0.66rem, 2.8vw, 0.78rem);
  line-height: 1;
  white-space: nowrap;
}

.sp-map-location strong {
  min-width: 0;
  overflow: hidden;
  color: #f5dfaa;
  font-size: inherit;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sp-map-location strong::after {
  content: ' ·';
  color: #b98a3a;
}

.sp-map-location span {
  flex: 0 0 auto;
  color: #f0c568;
  font-size: 0.9em;
}

.sp-map-location::before {
  top: 50%;
  transform: translateY(-50%) rotate(-7deg);
}

.sp-map-dock {
  grid-template-rows: 48px auto minmax(0, 1fr);
  margin-top: -12px;
  border-top-width: 5px;
  box-shadow: 0 -8px 20px rgba(0, 0, 0, 0.52), inset 0 0 0 2px #17130d;
}

.sp-map-tabs {
  gap: 6px;
  padding: 3px 5px 1px;
  background: linear-gradient(180deg, #312519, #17140f);
}

.sp-map-tabs [role='tab'] {
  position: relative;
  min-height: 44px;
  border-width: 3px;
  border-radius: 3px 3px 0 0;
  padding: 5px 4px;
  overflow: visible;
  font-size: clamp(0.67rem, 3.05vw, 0.86rem);
  line-height: 1;
  letter-spacing: 0.01em;
  text-overflow: clip;
  white-space: nowrap;
  text-shadow: 0 1px 1px #000;
}

.sp-map-tabs [role='tab'][data-tab='main'] {
  border-color: #9a6725;
  color: #4b2906;
  background:
    linear-gradient(180deg, rgba(255, 244, 177, 0.38), transparent 32%),
    linear-gradient(180deg, #f5bd4d, #c97816);
  text-shadow: 0 1px 0 #ffe4a0;
}

.sp-map-tabs [role='tab'][data-tab='daily'] {
  border-color: #596574;
  color: #e0e7ec;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent 35%),
    linear-gradient(180deg, #46596d, #223244);
}

.sp-map-tabs [role='tab'][aria-selected='true'] {
  filter: saturate(1.12) brightness(1.08);
  box-shadow: inset 0 1px 0 rgba(255, 246, 193, 0.75), inset 0 0 0 1px #1b130b, 0 0 8px rgba(238, 178, 63, 0.25);
}

.sp-map-tabs [role='tab'][aria-selected='false'] {
  filter: saturate(0.72) brightness(0.78);
}

.sp-map-topic {
  position: relative;
  z-index: 2;
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 2px;
  border: 3px ridge #8d6836;
  border-bottom-width: 2px;
  margin-top: 3px;
  padding: 5px 10px 6px;
  color: #2c1c0e;
  text-align: center;
  background:
    radial-gradient(circle at 50% -30%, rgba(255, 255, 255, 0.55), transparent 65%),
    linear-gradient(180deg, #f5e4bd, #ddbf83);
  box-shadow: inset 0 0 11px rgba(100, 59, 19, 0.16);
}

.sp-map-page[data-active-tab='daily'] .sp-map-topic {
  display: none;
}

.sp-map-topic strong {
  color: #7d4d15;
  font-size: clamp(0.58rem, 2.5vw, 0.69rem);
  line-height: 1;
  letter-spacing: 0.055em;
}

.sp-map-topic span {
  min-width: 0;
  color: #24170c;
  overflow-wrap: anywhere;
  font-size: clamp(0.68rem, 2.85vw, 0.8rem);
  font-weight: 800;
  line-height: 1.14;
}

.sp-map-panel {
  border-top: 0;
}

.sp-map-task-list {
  overflow-x: hidden;
}

.sp-map-task-row__action {
  position: relative;
  display: grid;
  place-items: center;
  padding: 0;
  overflow: visible;
}

.sp-map-task-row__action--open .sp-map-task-row__arrow {
  position: absolute;
  left: 50%;
  top: 50%;
  margin: 0;
  transform: translate(-50%, -50%) rotate(180deg);
  transform-origin: center;
}

.sp-map-task-row__action--claim img {
  position: absolute;
  left: 50%;
  top: 50%;
  margin: 0;
  transform: translate(-50%, -50%);
}

.sp-map-task-row.is-claiming .sp-map-task-row__action--claim img {
  transform: translate(-50%, -50%);
}

@media (max-width: 390px) {
  .sp-map-hud__primary {
    grid-template-columns: 46px minmax(137px, 1fr) minmax(108px, 34%);
    gap: 5px;
  }

  .sp-map-hud__title {
    padding-inline: 5px;
    font-size: clamp(0.72rem, 3.35vw, 0.81rem);
    letter-spacing: 0;
  }

  .sp-map-hud__journey {
    min-width: 0;
    gap: 3px;
    padding-inline: 3px;
    font-size: clamp(0.49rem, 2.18vw, 0.55rem);
  }

  .sp-map-hud__stats {
    grid-template-columns: 66px minmax(118px, 1fr) 70px;
    margin-left: 51px;
    gap: 4px;
  }

  .sp-map-hud__stats > span { padding-inline: 4px; }
  .sp-map-hud__xp-value { font-size: 0.56rem; }
  .sp-map-hud__gold img { width: 20px; height: 20px; }
  .sp-map-tabs [role='tab'] {
    padding-inline: 3px;
    font-size: clamp(0.64rem, 3vw, 0.74rem);
  }
}

@media (max-height: 700px) {
  .sp-map-page {
    --sp-hud-h: 96px;
    grid-template-rows: var(--sp-hud-h) minmax(176px, 1fr) minmax(258px, 41dvh);
  }

  .sp-map-hud { grid-template-rows: 46px 36px; }
  .sp-map-back,
  .sp-map-hud__title { min-height: 44px; }
  .sp-map-hud__stats > span { min-height: 34px; }
  .sp-map-topic { padding-block: 4px; }
}

@media (orientation: landscape) and (max-height: 500px) {
  .sp-map-page {
    --sp-hud-h: 84px;
    grid-template-rows: var(--sp-hud-h) minmax(122px, 1fr) minmax(150px, 43dvh);
  }

  .sp-map-hud { grid-template-rows: 39px 32px; }
  .sp-map-hud__stats > span { min-height: 30px; }
  .sp-map-dock { grid-template-rows: 42px auto minmax(0, 1fr); }
  .sp-map-tabs [role='tab'] { min-height: 42px; }
  .sp-map-topic { grid-template-columns: auto minmax(0, 1fr); align-items: center; justify-items: stretch; gap: 7px; padding-block: 3px; }
  .sp-map-topic strong { white-space: nowrap; text-align: right; }
  .sp-map-topic span { width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }
}

/* Readability and state fidelity: the active task tab owns the gold treatment. */
.sp-map-hud__title,
.sp-map-hud__journey,
.sp-map-hud__journey strong,
.sp-map-hud__exam,
.sp-map-hud__stage,
.sp-map-hud__stats > span,
.sp-map-hud__level,
.sp-map-hud__xp-label,
.sp-map-hud__xp-value,
.sp-map-hud__gold,
.sp-map-gold-value,
.sp-map-location strong,
.sp-map-location span {
  color: #f5dfaa !important;
}

.sp-map-tabs [role='tab'][aria-selected='true'] {
  border-color: #a66f24;
  color: #142a46 !important;
  background:
    linear-gradient(180deg, rgba(255, 249, 201, 0.52), transparent 34%),
    linear-gradient(180deg, #f7c85d, #d99122);
  filter: none;
  text-shadow: 0 1px 0 rgba(255, 239, 170, 0.92);
  box-shadow: inset 0 1px 0 #fff4be, inset 0 0 0 1px #3c260d, 0 0 8px rgba(238, 178, 63, 0.34);
}

.sp-map-tabs [role='tab'][aria-selected='false'] {
  border-color: #536779;
  color: #f5dfaa !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), transparent 35%),
    linear-gradient(180deg, #3d5167, #17283b);
  filter: none;
  text-shadow: 0 1px 1px #000;
}

.sp-map-daily-date {
  min-height: 28px;
  display: grid;
  place-items: center;
  border-bottom: 1px solid rgba(63, 91, 116, 0.34);
  padding: 3px 8px 6px;
  color: #173f61;
  font-size: clamp(0.72rem, 3vw, 0.82rem);
  font-weight: 800;
  letter-spacing: 0.025em;
  text-align: center;
}

.sp-map-page[data-active-tab='daily'] .sp-map-dock {
  grid-template-rows: 48px minmax(0, 1fr);
}

.sp-map-task-panel--daily {
  height: 100%;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0;
  padding: 0 8px 8px;
}

.sp-map-task-panel--daily .sp-map-task-list {
  min-height: 0;
  height: 100%;
  padding-top: 7px;
  background: var(--sp-daily-surface);
}

@media (max-height: 680px) {
  .sp-map-page[data-active-tab='daily'] .sp-map-dock {
    grid-template-rows: 42px minmax(0, 1fr);
  }
}

/* success-path transitions */
.sp-map-page--stage-transition {
  animation: sp-stage-clock 980ms linear both;
}

.sp-map-page--stage-transition .sp-map-board {
  will-change: transform;
  animation: sp-camera-follow 980ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.sp-map-page--stage-transition .sp-map-stage--active {
  will-change: transform, opacity;
  animation: sp-complete-cell 180ms ease-out both;
}

.sp-map-page--stage-transition [data-sp-knight] {
  will-change: transform, opacity;
  animation: sp-knight-step 760ms cubic-bezier(0.16, 1, 0.3, 1) 180ms both;
}

.sp-map-page--region-transition {
  animation: sp-region-clock 880ms linear both;
}

.sp-map-page--region-transition .sp-map-board {
  will-change: transform, opacity;
  animation: sp-region-map 880ms ease-in-out both;
}

.sp-map-page--region-transition [data-sp-knight] {
  will-change: transform, opacity;
  animation: sp-knight-gate 600ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.sp-map-page--region-transition .sp-map-stage--transition-target {
  will-change: transform, opacity;
  animation: sp-gate-arrival 180ms ease-out 420ms both;
}

.sp-map-page--region-enter {
  animation: sp-region-enter-clock 320ms linear both;
}

.sp-map-page--region-enter .sp-map-board {
  will-change: opacity;
  animation: sp-region-enter-map 320ms ease-out both;
}

.sp-map-page--region-enter [data-sp-knight] {
  will-change: transform, opacity;
  animation: sp-region-enter-knight 320ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.sp-map-page--update-transition {
  animation: sp-update-clock 220ms linear both;
}

.sp-map-page--update-transition .sp-map-hud__stats,
.sp-map-page--update-transition .sp-map-hud__stage,
.sp-map-page--update-transition .sp-map-panel {
  will-change: transform, opacity;
  animation: sp-data-update 220ms ease-out both;
}

.sp-map-page--update-transition .sp-map-stage--active {
  will-change: transform, opacity;
  animation: sp-activate-cell 180ms ease-out both;
}

.sp-map-page--reduced-transition {
  will-change: opacity;
  animation: sp-static-swap 120ms ease-out both;
}

.sp-map-page[aria-busy='true'] .sp-map-advance {
  cursor: progress;
}

.sp-map-page[aria-busy='true'] button:disabled:not(.sp-map-back) {
  opacity: 0.72;
}

@keyframes sp-stage-clock {
  from { opacity: 1; }
  to { opacity: 1; }
}

@keyframes sp-camera-follow {
  0%, 100% { transform: translate3d(0, 0, 0); }
  78% { transform: translate3d(var(--sp-camera-x, 0), var(--sp-camera-y, 0), 0); }
}

@keyframes sp-complete-cell {
  from { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  to { transform: translate(-50%, -50%) scale(0.94); opacity: 0.86; }
}

@keyframes sp-knight-step {
  0% { transform: translate3d(-50%, 0, 0) rotate(0); opacity: 1; }
  72% { transform: translate3d(calc(-50% + var(--sp-move-x, 0px)), calc(var(--sp-move-y, 0px) - 7px), 0) rotate(-3deg); opacity: 1; }
  88% { transform: translate3d(calc(-50% + var(--sp-move-x, 0px)), calc(var(--sp-move-y, 0px) + 2px), 0) rotate(2deg); opacity: 1; }
  100% { transform: translate3d(calc(-50% + var(--sp-move-x, 0px)), var(--sp-move-y, 0px), 0) rotate(0); opacity: 1; }
}

@keyframes sp-activate-cell {
  from { transform: translate(-50%, -50%) scale(0.92); opacity: 0.72; }
  70% { transform: translate(-50%, -50%) scale(1.08); opacity: 1; }
  to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

@keyframes sp-region-clock {
  from { opacity: 1; }
  to { opacity: 1; }
}

@keyframes sp-region-map {
  0%, 68% { transform: translate3d(0, 0, 0); opacity: 1; }
  96%, 100% { transform: translate3d(var(--sp-camera-x, 0), var(--sp-camera-y, 0), 0); opacity: 0; }
}

@keyframes sp-knight-gate {
  from { transform: translate3d(-50%, 0, 0); opacity: 1; }
  82% { transform: translate3d(calc(-50% + var(--sp-move-x, 0px)), calc(var(--sp-move-y, 0px) - 6px), 0); opacity: 1; }
  to { transform: translate3d(calc(-50% + var(--sp-move-x, 0px)), var(--sp-move-y, 0px), 0); opacity: 1; }
}

@keyframes sp-gate-arrival {
  from { transform: translate(-50%, -50%) scale(0.94); opacity: 0.76; }
  to { transform: translate(-50%, -50%) scale(1.06); opacity: 1; }
}

@keyframes sp-region-enter-clock {
  from { opacity: 1; }
  to { opacity: 1; }
}

@keyframes sp-region-enter-map {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes sp-region-enter-knight {
  from { transform: translate3d(-50%, -8px, 0); opacity: 0; }
  to { transform: translate3d(-50%, 0, 0); opacity: 1; }
}

@keyframes sp-update-clock {
  from { opacity: 1; }
  to { opacity: 1; }
}

@keyframes sp-data-update {
  from { transform: translate3d(0, 4px, 0); opacity: 0.72; }
  to { transform: translate3d(0, 0, 0); opacity: 1; }
}

@keyframes sp-static-swap {
  from { opacity: 1; }
  to { opacity: 0; }
}
