:root {
  color-scheme: light;
  --ink: #15201b;
  --muted: #66736d;
  --line: #d8ded7;
  --panel: #fbfcf8;
  --paper: #f3f5ed;
  --green: #2f7d5a;
  --teal: #25717c;
  --gold: #c88921;
  --red: #a94335;
  --shadow: 0 18px 55px rgba(21, 32, 27, 0.12);
  --forest-shadow: 0 20px 48px rgba(16, 48, 35, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  /* Living World forest backdrop */
  background:
    linear-gradient(180deg, rgba(243, 245, 237, 0.5), rgba(243, 245, 237, 0.78)),
    linear-gradient(90deg, rgba(14, 42, 30, 0.24), rgba(255, 255, 255, 0.08) 48%, rgba(14, 42, 30, 0.2)),
    url("assets/backgrounds/whispering-forest.jpg") center top / cover no-repeat fixed,
    radial-gradient(circle at 15% 10%, rgba(111, 156, 93, 0.28), transparent 24%),
    radial-gradient(circle at 82% 12%, rgba(37, 113, 124, 0.2), transparent 26%),
    radial-gradient(circle at 72% 88%, rgba(200, 137, 33, 0.18), transparent 24%),
    linear-gradient(145deg, rgba(23, 82, 57, 0.16), transparent 42%),
    linear-gradient(315deg, rgba(200, 137, 33, 0.14), transparent 38%),
    var(--paper);
  background-attachment: fixed;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  min-height: 44px;
  padding: 0 18px;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(21, 32, 27, 0.1);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
  box-shadow: none;
}

.primary {
  color: #fff;
  background: var(--green);
  border-color: var(--green);
}

.small {
  min-height: 36px;
  padding: 0 12px;
}

.danger {
  color: var(--red);
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: end;
  margin-bottom: 22px;
}

.topbar h1,
h2,
h3,
p {
  margin: 0;
}

.topbar h1 {
  max-width: 760px;
  font-size: clamp(2rem, 5vw, 4.4rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--teal);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(5, 86px);
  gap: 8px;
}

.hero-stats div {
  display: grid;
  place-items: center;
  min-height: 86px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.hero-stats span {
  font-size: 1.6rem;
  font-weight: 900;
}

.hero-stats small {
  color: var(--muted);
}

.layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: start;
}

.panel {
  border: 1px solid rgba(47, 125, 90, 0.18);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(246, 249, 241, 0.84)),
    rgba(251, 252, 248, 0.9);
  box-shadow: var(--shadow);
  padding: 18px;
}

.profile-panel {
  display: grid;
  gap: 16px;
}

.profile-panel h2 {
  font-size: 1.4rem;
}

.profile-panel p {
  color: var(--muted);
}

.hero-card {
  display: grid;
  grid-template-columns: 60px 54px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(216, 163, 64, 0.4);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 249, 233, 0.92), rgba(246, 239, 217, 0.78)),
    rgba(255, 255, 255, 0.76);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    0 12px 24px rgba(16, 48, 35, 0.12);
}

.hero-card__portrait-frame {
  display: grid;
  place-items: center;
  width: 60px;
  aspect-ratio: 1;
  overflow: hidden;
  border: 2px solid rgba(216, 163, 64, 0.72);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 226, 140, 0.28), transparent 62%),
    var(--green);
  box-shadow: 0 0 18px rgba(216, 163, 64, 0.28);
}

.hero-card__portrait {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 28%;
}

.hero-card__body {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.hero-card__companion-portrait {
  display: grid;
  place-items: center;
}

.companion-portrait {
  position: relative;
  width: 54px;
  height: 54px;
  border: 2px solid rgba(216, 163, 64, 0.56);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 62%, rgba(255, 226, 140, 0.28), transparent 44%),
    linear-gradient(180deg, rgba(48, 123, 88, 0.92), rgba(21, 61, 44, 0.94));
  box-shadow:
    0 0 18px rgba(47, 125, 90, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.24);
  animation: companionIdle 2600ms ease-in-out infinite;
}

.companion-portrait__body,
.companion-portrait__head,
.companion-portrait__tail,
.companion-portrait__eye,
.companion-portrait__spark {
  position: absolute;
  display: block;
}

.companion-portrait__body {
  left: 16px;
  top: 24px;
  width: 24px;
  height: 18px;
  border-radius: 50% 50% 44% 44%;
  background: linear-gradient(180deg, #9ccf64, #3f9b67);
}

.companion-portrait__head {
  left: 20px;
  top: 14px;
  width: 21px;
  height: 19px;
  border-radius: 50%;
  background: linear-gradient(180deg, #b8df78, #4fa56f);
}

.companion-portrait__head::before,
.companion-portrait__head::after {
  content: "";
  position: absolute;
  top: -5px;
  width: 8px;
  height: 10px;
  border-radius: 80% 0 80% 0;
  background: #9ccf64;
}

.companion-portrait__head::before {
  left: 1px;
  transform: rotate(-25deg);
}

.companion-portrait__head::after {
  right: 1px;
  transform: rotate(25deg) scaleX(-1);
}

.companion-portrait__tail {
  left: 7px;
  top: 24px;
  width: 22px;
  height: 12px;
  border-radius: 100% 0 100% 0;
  background: linear-gradient(135deg, #c8e88a, #4fa56f);
  transform-origin: right center;
  animation: companionTailSway 1800ms ease-in-out infinite;
}

.companion-portrait__eye {
  left: 32px;
  top: 21px;
  width: 3px;
  height: 5px;
  border-radius: 999px;
  background: #15201b;
  animation: companionBlink 4200ms ease-in-out infinite;
}

.companion-portrait__spark {
  right: 9px;
  bottom: 10px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow:
    0 0 10px rgba(255, 226, 140, 0.72),
    -22px -24px 0 -2px rgba(255, 226, 140, 0.54);
  animation: companionSpark 2400ms ease-in-out infinite;
}

.companion-portrait--happy {
  animation: companionHappy 900ms ease-in-out 2;
  box-shadow:
    0 0 24px rgba(255, 226, 140, 0.38),
    0 0 18px rgba(47, 125, 90, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.hero-card__eyebrow,
.hero-card__meta,
.hero-card__companion {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.hero-card__name {
  overflow-wrap: anywhere;
  font-size: 1rem;
}

.hero-card__xp {
  height: 8px;
  overflow: hidden;
  border: 1px solid rgba(21, 32, 27, 0.18);
  border-radius: 999px;
  background: rgba(21, 32, 27, 0.1);
}

.hero-card__xp span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background:
    linear-gradient(90deg, var(--teal), var(--gold));
}

.avatar {
  position: relative;
  width: 150px;
  height: 170px;
  margin: 4px auto 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111;
  box-shadow: 0 14px 28px rgba(21, 32, 27, 0.16);
}

.avatar-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 28%;
}

/* Premium Hero Hall character screen */
.dashboard-nav {
  position: relative;
  padding: 14px 10px;
  border: 2px solid rgba(255, 205, 104, 0.48);
  border-radius: 18px;
  background:
    linear-gradient(90deg, rgba(255, 220, 138, 0.16), transparent 24%, transparent 76%, rgba(255, 220, 138, 0.12)),
    repeating-linear-gradient(0deg, rgba(94, 50, 22, 0.88) 0 12px, rgba(124, 72, 32, 0.9) 12px 24px);
  box-shadow:
    inset 0 0 0 1px rgba(38, 18, 9, 0.72),
    inset 0 0 28px rgba(34, 14, 6, 0.82),
    0 18px 36px rgba(25, 13, 7, 0.26);
}

.dashboard-nav::before,
.dashboard-nav::after {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(255, 220, 138, 0.72), transparent);
}

.dashboard-nav::before {
  top: 6px;
}

.dashboard-nav::after {
  bottom: 6px;
}

.dashboard-nav button {
  position: relative;
  min-height: 42px;
  border: 1px solid rgba(255, 216, 128, 0.38);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(255, 234, 169, 0.14), transparent 42%),
    linear-gradient(180deg, rgba(63, 35, 17, 0.94), rgba(28, 16, 10, 0.92));
  color: #ffe9ad;
  font-weight: 900;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
  box-shadow: inset 0 1px 0 rgba(255, 239, 183, 0.22), 0 8px 14px rgba(18, 9, 4, 0.22);
}

.dashboard-nav button::before {
  content: "";
  width: 9px;
  height: 9px;
  margin-right: 8px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffed9d 0 28%, #c78225 32% 62%, #4a2410 68%);
  box-shadow: 0 0 12px rgba(255, 211, 95, 0.55);
}

.dashboard-nav button:hover,
.dashboard-nav button:focus-visible,
.dashboard-nav button.is-active {
  border-color: rgba(133, 229, 255, 0.68);
  background:
    linear-gradient(135deg, rgba(127, 223, 255, 0.2), transparent 44%),
    linear-gradient(180deg, rgba(82, 49, 21, 0.98), rgba(28, 19, 12, 0.96));
  color: #fff8db;
  box-shadow:
    inset 0 1px 0 rgba(255, 246, 198, 0.32),
    0 0 20px rgba(91, 216, 255, 0.2),
    0 10px 18px rgba(18, 9, 4, 0.24);
}

.profile-panel {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.hero-hall {
  position: relative;
  min-height: clamp(760px, 94vh, 1040px);
  gap: 18px;
  padding: clamp(14px, 2vw, 26px);
  border: 2px solid rgba(255, 207, 111, 0.42);
  border-radius: 28px;
  isolation: isolate;
  background:
    radial-gradient(circle at 50% 28%, rgba(111, 224, 255, 0.34), transparent 18%),
    radial-gradient(circle at 50% 40%, rgba(255, 204, 82, 0.28), transparent 27%),
    linear-gradient(180deg, rgba(17, 56, 72, 0.88), rgba(24, 33, 48, 0.94) 34%, rgba(35, 27, 29, 0.98)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0 2px, transparent 2px 78px);
  box-shadow:
    inset 0 0 0 1px rgba(255, 236, 173, 0.16),
    inset 0 -120px 120px rgba(22, 13, 12, 0.58),
    0 28px 56px rgba(16, 27, 30, 0.28);
}

.hero-hall::before,
.hero-hall::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: -1;
}

.hero-hall::before {
  background:
    linear-gradient(110deg, transparent 7%, rgba(255, 237, 167, 0.16) 8%, transparent 18%),
    linear-gradient(250deg, transparent 8%, rgba(110, 222, 255, 0.14) 10%, transparent 24%),
    radial-gradient(ellipse at 18% 18%, rgba(255, 224, 135, 0.2), transparent 20%),
    radial-gradient(ellipse at 82% 18%, rgba(255, 224, 135, 0.18), transparent 22%);
  clip-path: inset(0 round 26px);
}

.hero-hall::after {
  inset: auto 7% 0;
  height: 34%;
  border-radius: 50% 50% 0 0;
  background:
    repeating-linear-gradient(90deg, rgba(206, 185, 145, 0.12) 0 48px, rgba(96, 82, 72, 0.12) 48px 96px),
    radial-gradient(ellipse at 50% 0, rgba(108, 221, 255, 0.14), transparent 62%);
  opacity: 0.9;
}

.hero-hall__banner {
  grid-template-columns: minmax(220px, 1.3fr) 76px minmax(260px, 1fr);
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border: 2px solid rgba(255, 214, 123, 0.44);
  border-radius: 20px;
  background:
    linear-gradient(90deg, rgba(26, 17, 13, 0.95), rgba(70, 41, 20, 0.92) 52%, rgba(24, 17, 17, 0.95)),
    repeating-linear-gradient(90deg, rgba(255, 228, 158, 0.08) 0 2px, transparent 2px 44px);
  box-shadow:
    inset 0 0 30px rgba(0, 0, 0, 0.42),
    0 16px 30px rgba(12, 8, 6, 0.3);
}

.hero-hall__identity {
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 14px;
}

.hero-hall__identity .avatar-image {
  width: 72px;
  height: 72px;
  border: 3px solid rgba(255, 224, 132, 0.88);
  box-shadow: 0 0 0 4px rgba(60, 31, 14, 0.78), 0 0 28px rgba(87, 211, 255, 0.28);
}

.hero-hall__identity h2 {
  color: #fff6cf;
  font-size: clamp(1.25rem, 2vw, 1.8rem);
}

.hero-hall__identity .eyebrow,
.hero-hall__identity p,
.hero-hall__xp span {
  color: rgba(255, 236, 173, 0.84);
}

.hero-hall__level {
  width: 76px;
  height: 80px;
  border-color: rgba(255, 229, 143, 0.72);
  border-radius: 18px;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 241, 169, 0.38), transparent 32%),
    linear-gradient(180deg, #8a5a22, #3e210f);
  color: #fff6ca;
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.28), 0 0 22px rgba(255, 199, 80, 0.18);
}

.hero-hall__xp {
  grid-column: auto;
}

.hero-hall__xp .progress-wrap {
  margin-top: 8px;
}

.hero-hall__xp .progress-bar {
  height: 14px;
  border: 1px solid rgba(255, 225, 141, 0.36);
  border-radius: 999px;
  background: rgba(21, 14, 12, 0.76);
  box-shadow: inset 0 0 9px rgba(0, 0, 0, 0.42);
}

.hero-hall__xp .progress-bar span {
  border-radius: inherit;
  background: linear-gradient(90deg, #45d7ff, #8b61ff 48%, #ffc857);
  box-shadow: 0 0 18px rgba(93, 220, 255, 0.42);
}

.hero-hall__resources {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(96px, 1fr));
  gap: 10px;
}

.hero-hall__resources div {
  display: grid;
  gap: 2px;
  min-height: 54px;
  padding: 9px 12px;
  border: 1px solid rgba(255, 218, 132, 0.34);
  border-radius: 14px;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 238, 168, 0.18), transparent 38%),
    linear-gradient(180deg, rgba(28, 22, 20, 0.92), rgba(18, 14, 13, 0.86));
}

.hero-hall__resources span,
.hero-hall__stats span,
.equipment-slot span {
  color: rgba(255, 238, 190, 0.72);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero-hall__resources strong {
  color: #fff2b8;
  font-size: 1.15rem;
}

.hero-hall__summary {
  display: none;
}

.hero-hall__stage {
  min-height: clamp(500px, 62vh, 720px);
  grid-template-columns: minmax(160px, 0.7fr) minmax(320px, 1.65fr) minmax(220px, 0.95fr);
  align-items: stretch;
  gap: clamp(14px, 2vw, 24px);
  padding: clamp(14px, 2vw, 24px);
  border: 1px solid rgba(255, 224, 145, 0.22);
  border-radius: 24px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 243, 193, 0.08), transparent 16%),
    radial-gradient(ellipse at 50% 100%, rgba(101, 219, 255, 0.16), transparent 46%),
    linear-gradient(90deg, rgba(35, 23, 24, 0.84), rgba(24, 36, 48, 0.58) 50%, rgba(35, 23, 24, 0.84));
  box-shadow: inset 0 0 48px rgba(0, 0, 0, 0.3);
}

.hero-hall__stage::before {
  inset: 8% 19% 20%;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(112, 224, 255, 0.2), transparent 34%),
    conic-gradient(from 0deg, transparent, rgba(255, 226, 130, 0.18), transparent, rgba(116, 225, 255, 0.16), transparent);
  filter: blur(2px);
  animation: heroHallGlow 5s ease-in-out infinite;
}

.hero-hall__light-rays {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(105deg, transparent 24%, rgba(255, 239, 174, 0.16) 28%, transparent 39%),
    linear-gradient(78deg, transparent 48%, rgba(116, 224, 255, 0.12) 53%, transparent 66%);
  mix-blend-mode: screen;
}

.hero-hall__particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hero-hall__particles span {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff2a8;
  box-shadow: 0 0 14px #66ddff, 0 0 24px rgba(255, 222, 117, 0.55);
  animation: heroHallParticle 6s ease-in-out infinite;
}

.hero-hall__particles span:nth-child(1) { left: 20%; top: 22%; animation-delay: -0.8s; }
.hero-hall__particles span:nth-child(2) { left: 36%; top: 14%; animation-delay: -2.1s; }
.hero-hall__particles span:nth-child(3) { left: 61%; top: 19%; animation-delay: -3.4s; }
.hero-hall__particles span:nth-child(4) { left: 76%; top: 35%; animation-delay: -1.6s; }
.hero-hall__particles span:nth-child(5) { left: 44%; top: 72%; animation-delay: -4.2s; }
.hero-hall__particles span:nth-child(6) { left: 58%; top: 62%; animation-delay: -5s; }

.hero-hall__stats,
.hero-hall__equipment {
  align-self: center;
  border: 2px solid rgba(255, 213, 122, 0.34);
  border-radius: 20px;
  background:
    linear-gradient(135deg, rgba(255, 226, 148, 0.1), transparent 38%),
    linear-gradient(180deg, rgba(52, 31, 17, 0.93), rgba(24, 17, 15, 0.92));
  box-shadow: inset 0 0 26px rgba(0, 0, 0, 0.32), 0 16px 28px rgba(10, 7, 5, 0.22);
}

.hero-hall__stats {
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 12px;
}

.hero-hall__stats div {
  min-height: 72px;
  border-color: rgba(255, 223, 145, 0.28);
  border-radius: 14px;
  background:
    radial-gradient(circle at 12% 18%, rgba(117, 221, 255, 0.18), transparent 38%),
    linear-gradient(180deg, rgba(21, 17, 16, 0.86), rgba(13, 12, 13, 0.74));
}

.hero-hall__stats strong {
  color: #ffeab0;
  font-size: clamp(1.1rem, 2vw, 1.45rem);
}

.hero-hall__pedestal {
  min-height: 100%;
  align-content: end;
  padding: clamp(18px, 3vw, 34px) 8px 36px;
}

.hero-hall__pedestal .profile-avatar-viewer {
  width: min(96%, 520px);
  min-height: clamp(420px, 60vh, 660px);
  border: 0;
  background: transparent;
  box-shadow: none;
}

.hero-hall__equipment {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.hero-hall__panel-heading h3 {
  margin: 0;
  color: #fff1be;
  font-size: 1.05rem;
}

.equipment-slots {
  display: grid;
  gap: 10px;
}

.equipment-slot {
  position: relative;
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 64px;
  padding: 10px 12px 10px 58px;
  border: 1px solid rgba(255, 225, 147, 0.3);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(255, 236, 172, 0.12), transparent 36%),
    linear-gradient(180deg, rgba(24, 19, 18, 0.92), rgba(12, 11, 12, 0.84));
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.equipment-slot::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  width: 34px;
  height: 34px;
  transform: translateY(-50%);
  border: 1px solid rgba(255, 223, 143, 0.4);
  border-radius: 10px;
  background-image:
    var(--equipment-thumbnail, none),
    radial-gradient(circle at 50% 28%, rgba(117, 224, 255, 0.28), transparent 38%),
    linear-gradient(180deg, rgba(80, 54, 31, 0.95), rgba(27, 18, 13, 0.92));
  background-position: center;
  background-repeat: no-repeat;
  background-size: 88% 88%, auto, auto;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.36), 0 0 14px rgba(93, 219, 255, 0.16);
}

.equipment-slot.has-equipment-thumbnail::before {
  background-size: cover, auto, auto;
}

.equipment-slot strong {
  overflow: hidden;
  color: #fff4c9;
  font-size: 0.94rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.equipment-slot__meta {
  color: rgba(255, 238, 190, 0.66);
  font-size: 0.68rem;
  font-weight: 800;
}

.equipment-slot:hover,
.equipment-slot:focus-visible {
  border-color: rgba(103, 222, 255, 0.72);
  box-shadow: 0 0 20px rgba(77, 209, 255, 0.18);
  transform: translateY(-1px);
}

.equipment-slot.is-equipped::before {
  border-color: rgba(103, 222, 255, 0.68);
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.36), 0 0 18px rgba(93, 219, 255, 0.32);
}

.equipment-slot.is-equipped .equipment-slot__meta {
  color: #9ee777;
}

.equipment-picker {
  width: min(780px, calc(100% - 28px));
  max-width: 780px;
  max-height: min(86vh, 780px);
  padding: 0;
  overflow: hidden;
  border: 2px solid rgba(255, 218, 132, 0.62);
  border-radius: 24px;
  background: #101b18;
  color: #fff8e6;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.62), inset 0 0 38px rgba(255, 226, 140, 0.08);
}

.equipment-picker::backdrop {
  background: rgba(4, 10, 9, 0.76);
  backdrop-filter: blur(5px);
}

.equipment-picker__shell {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  max-height: min(86vh, 780px);
  background:
    radial-gradient(circle at 12% 5%, rgba(77, 209, 255, 0.16), transparent 30%),
    radial-gradient(circle at 88% 0, rgba(255, 212, 104, 0.16), transparent 28%),
    linear-gradient(180deg, rgba(35, 48, 39, 0.98), rgba(13, 24, 21, 0.99));
}

.equipment-picker__header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
  padding: 22px 24px 14px;
  border-bottom: 1px solid rgba(255, 226, 140, 0.2);
}

.equipment-picker__header h2,
.equipment-picker__header p {
  margin: 0;
}

.equipment-picker__header h2 {
  margin-top: 3px;
  color: #fff2bd;
}

.equipment-picker__header > div > p:last-child {
  margin-top: 5px;
  color: rgba(255, 248, 230, 0.72);
}

.equipment-picker__close {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid rgba(255, 226, 140, 0.32);
  border-radius: 50%;
  background: rgba(12, 17, 15, 0.72);
  color: #fff2bd;
  cursor: pointer;
  font-size: 1.6rem;
}

.equipment-picker__status {
  min-height: 1.4rem;
  margin: 0;
  padding: 10px 24px 0;
  color: #9ee777;
  font-weight: 900;
}

.equipment-picker__items {
  display: grid;
  gap: 12px;
  padding: 14px 24px 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.equipment-picker__current {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 14px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid rgba(158, 231, 119, 0.38);
  border-radius: 14px;
  background: rgba(35, 72, 48, 0.38);
}

.equipment-picker__current span {
  color: rgba(255, 248, 230, 0.66);
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
}

.equipment-picker__current strong {
  overflow: hidden;
  color: #e6ffc9;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.equipment-picker__current button {
  grid-column: 2;
  grid-row: 1 / 3;
}

.equipment-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(118px, auto);
  gap: 14px;
  align-items: center;
  padding: 13px;
  border: 1px solid rgba(255, 226, 140, 0.24);
  border-radius: 16px;
  background:
    radial-gradient(circle at 7% 30%, rgba(77, 209, 255, 0.14), transparent 24%),
    rgba(8, 19, 16, 0.66);
}

.equipment-option.is-equipped {
  border-color: rgba(158, 231, 119, 0.56);
  background:
    radial-gradient(circle at 7% 30%, rgba(158, 231, 119, 0.16), transparent 24%),
    rgba(18, 44, 28, 0.72);
}

.equipment-option .gear-art {
  width: 64px;
  height: 64px;
}

.equipment-option__copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.equipment-option__copy > span {
  color: #90e6ff;
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.equipment-option__copy strong {
  overflow: hidden;
  color: #fff2bd;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.equipment-option__copy small {
  overflow: hidden;
  color: rgba(255, 248, 230, 0.68);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.equipment-option__action {
  display: grid;
  gap: 7px;
  justify-items: stretch;
  text-align: center;
}

.equipment-option__action > span {
  color: rgba(255, 248, 230, 0.66);
  font-size: 0.7rem;
  font-weight: 900;
}

.equipment-option__action > span.is-upgrade {
  color: #9ee777;
}

.equipment-option__action button:disabled {
  cursor: default;
  opacity: 0.62;
}

.hero-hall__companions {
  min-width: 0;
  padding: 14px;
  border: 2px solid rgba(255, 213, 122, 0.36);
  border-radius: 22px;
  background:
    linear-gradient(90deg, rgba(49, 29, 15, 0.95), rgba(31, 22, 18, 0.9) 48%, rgba(49, 29, 15, 0.95)),
    repeating-linear-gradient(90deg, rgba(255, 224, 151, 0.08) 0 2px, transparent 2px 58px);
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.3), 0 14px 26px rgba(10, 7, 5, 0.18);
}

.hero-hall__companions .section-heading {
  margin-bottom: 10px;
}

.companion-collection {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(150px, 1fr);
  gap: 12px;
  overflow-x: auto;
  padding: 2px 2px 10px;
  scrollbar-color: rgba(255, 213, 122, 0.72) rgba(19, 12, 9, 0.56);
}

.companion-card {
  min-height: 150px;
  padding: 14px 10px;
  border: 2px solid rgba(255, 218, 132, 0.3);
  border-radius: 18px;
  background:
    radial-gradient(circle at 50% 22%, rgba(103, 222, 255, 0.18), transparent 35%),
    linear-gradient(180deg, rgba(41, 31, 27, 0.94), rgba(17, 14, 15, 0.9));
}

.companion-card__sigil {
  width: 62px;
  height: 62px;
  border: 2px solid rgba(255, 225, 143, 0.55);
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.34), 0 0 20px rgba(96, 221, 255, 0.18);
}

.companion-card strong {
  color: #fff1bf;
}

.companion-card small {
  color: #90e6ff;
}

.companion-card:hover,
.companion-card:focus-visible,
.companion-card.is-active {
  border-color: rgba(134, 231, 255, 0.82);
  background:
    radial-gradient(circle at 50% 22%, rgba(255, 228, 126, 0.24), transparent 36%),
    linear-gradient(180deg, rgba(61, 42, 26, 0.96), rgba(18, 15, 16, 0.92));
  transform: translateY(-3px);
}

.hero-hall__controls {
  border: 1px solid rgba(255, 213, 122, 0.24);
  border-radius: 18px;
  background: rgba(18, 14, 13, 0.5);
}

@keyframes heroHallParticle {
  0%, 100% {
    opacity: 0.25;
    transform: translate3d(0, 10px, 0) scale(0.8);
  }
  45% {
    opacity: 1;
    transform: translate3d(12px, -18px, 0) scale(1.15);
  }
}

@media (max-width: 1060px) {
  .hero-hall__banner {
    grid-template-columns: minmax(0, 1fr) 72px;
  }

  .hero-hall__xp,
  .hero-hall__resources {
    grid-column: 1 / -1;
  }

  .hero-hall__stage {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .hero-hall__stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .equipment-slots {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-hall__pedestal {
    min-height: 560px;
  }
}

@media (max-width: 680px) {
  .hero-hall {
    min-height: 0;
    padding: 12px;
    border-radius: 20px;
  }

  .hero-hall__banner,
  .hero-hall__resources,
  .hero-hall__stats,
  .equipment-slots {
    grid-template-columns: 1fr;
  }

  .hero-hall__identity {
    grid-template-columns: 56px minmax(0, 1fr);
  }

  .hero-hall__identity .avatar-image {
    width: 56px;
    height: 56px;
  }

  .hero-hall__level {
    width: 100%;
    height: 58px;
  }

  .hero-hall__pedestal {
    min-height: 430px;
  }

  .hero-hall__pedestal .profile-avatar-viewer {
    min-height: 400px;
  }

  .equipment-picker__header {
    padding: 18px 16px 12px;
  }

  .equipment-picker__status {
    padding-inline: 16px;
  }

  .equipment-picker__items {
    padding: 12px 16px 18px;
  }

  .equipment-option {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .equipment-option__action {
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1fr) 120px;
    align-items: center;
  }

  .companion-collection {
    grid-auto-columns: minmax(136px, 72%);
  }
}

/* Phone layout: use the bottom nav as the primary control surface. */
@media (max-width: 768px) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  body {
    background-attachment: scroll;
  }

  .app-shell,
  .fantasy-dashboard {
    width: 100%;
    max-width: 100%;
    padding: 10px 10px calc(92px + env(safe-area-inset-bottom, 0px));
    overflow-x: hidden;
  }

  .fantasy-dashboard .topbar {
    position: relative;
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    width: 100%;
    margin-bottom: 12px;
    padding: 10px;
    border-radius: 12px;
  }

  .fantasy-dashboard .topbar h1 {
    font-size: clamp(1.5rem, 11vw, 2.35rem);
    line-height: 1;
    overflow-wrap: anywhere;
  }

  .resource-bar,
  .fantasy-dashboard .hero-stats {
    grid-auto-flow: row;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
    min-width: 0;
  }

  .resource-bar div,
  .fantasy-dashboard .hero-stats div {
    min-width: 0;
    min-height: 52px;
    padding: 6px 8px;
  }

  .resource-bar span,
  .fantasy-dashboard .hero-stats span {
    max-width: 100%;
    overflow: hidden;
    font-size: 1rem;
    text-overflow: ellipsis;
  }

  .auth-session {
    top: 8px;
    right: 8px;
    left: 8px;
    z-index: 30;
    justify-content: space-between;
    max-width: calc(100vw - 16px);
    padding: 7px 8px;
    overflow: hidden;
    border-radius: 999px;
  }

  .auth-session span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .auth-session button {
    min-width: 82px;
    min-height: 40px;
    padding: 0 10px;
  }

  .alpha-login-helper dl {
    grid-template-columns: 1fr;
  }

  .fantasy-dashboard .layout,
  .layout {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .dashboard-nav {
    display: none;
  }

  .layout > .panel,
  .fantasy-dashboard .panel,
  .fantasy-dashboard .profile-panel,
  .dashboard-scene,
  .fantasy-dashboard .timer-panel,
  .fantasy-dashboard .story-panel,
  .fantasy-dashboard .quest-panel,
  .fantasy-dashboard .reward-panel,
  .fantasy-dashboard .map-panel,
  .fantasy-dashboard .battle-panel {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    grid-column: auto;
  }

  .layout > .panel.is-active {
    display: block;
  }

  .panel,
  .fantasy-dashboard .panel {
    padding: 12px;
    border-radius: 12px;
    overflow-x: hidden;
  }

  .bottom-action-bar {
    right: 8px;
    bottom: max(8px, env(safe-area-inset-bottom, 0px));
    left: 8px;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
    max-height: none;
    padding: 7px;
    overflow: visible;
    border-radius: 14px;
  }

  .bottom-action-bar button {
    min-width: 0;
    min-height: 52px;
    padding: 0 4px;
    border-radius: 10px;
    font-size: clamp(0.62rem, 2.7vw, 0.78rem);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .dashboard-scene,
  .village-hub {
    min-height: auto;
  }

  .village-hud,
  .village-hud__resources,
  .village-buildings,
  .village-quest-list,
  .book-grid,
  .book-result,
  .controls,
  .map-footer,
  .battle-companion-card {
    grid-template-columns: 1fr;
  }

  .village-heart-tree {
    min-height: min(72vh, 560px);
    margin-top: 0;
  }

  .village-building {
    min-height: 96px;
  }

  .opponent,
  .item,
  .reward-card,
  .village-quest {
    grid-template-columns: minmax(0, 1fr);
  }

  .opponent button,
  .gear-toggle,
  .village-quest__reward {
    width: 100%;
    justify-self: stretch;
  }

  .world-map {
    grid-template-columns: repeat(4, minmax(64px, 1fr));
    max-width: 100%;
    overflow-x: auto;
  }

  .hero-hall,
  .fantasy-dashboard .profile-panel .hero-hall {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    width: 100%;
    min-height: 0;
    padding: 12px;
    overflow: hidden;
  }

  .hero-hall__banner,
  .fantasy-dashboard .profile-panel .hero-hall__banner {
    grid-template-columns: 1fr;
    gap: 10px;
    order: 1;
  }

  .hero-hall__identity {
    grid-template-columns: 58px minmax(0, 1fr);
    width: 100%;
    min-width: 0;
  }

  .hero-hall__identity h2,
  .hero-hall__identity p,
  .hero-hall__xp span,
  .hero-hall__xp strong {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .hero-hall__level {
    width: 100%;
    height: auto;
    min-height: 58px;
  }

  .hero-hall__xp,
  .hero-hall__resources,
  .fantasy-dashboard .profile-panel .hero-hall__xp,
  .fantasy-dashboard .profile-panel .hero-hall__resources {
    grid-column: auto;
    width: 100%;
    min-width: 0;
  }

  .hero-hall__resources,
  .fantasy-dashboard .profile-panel .hero-hall__resources {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-hall__summary {
    order: 2;
    width: 100%;
    min-width: 0;
  }

  .hero-hall__stage,
  .fantasy-dashboard .profile-panel .hero-hall__stage {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    order: 3;
    min-height: 0;
    overflow: visible;
  }

  .hero-hall__pedestal {
    order: 1;
    min-height: 360px;
  }

  .hero-hall__pedestal .profile-avatar-viewer,
  .fantasy-dashboard .profile-panel .hero-hall__pedestal .profile-avatar-viewer {
    min-height: 340px;
    height: 48vh;
    max-height: 460px;
  }

  .hero-hall__stats,
  .fantasy-dashboard .profile-panel .hero-hall__stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-hall__stats--left {
    order: 2;
  }

  .hero-hall__equipment {
    order: 3;
    width: 100%;
    min-width: 0;
  }

  .equipment-slots,
  .fantasy-dashboard .profile-panel .equipment-slots {
    grid-template-columns: 1fr;
  }

  .hero-hall__stats--right {
    order: 4;
  }

  .hero-hall__companions {
    order: 4;
    width: 100%;
    min-width: 0;
  }

  .companion-collection,
  .fantasy-dashboard .profile-panel .companion-collection {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(150px, 72vw);
    grid-template-columns: none;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 8px;
    scroll-snap-type: x proximity;
  }

  .companion-collection__message {
    grid-column: auto;
    width: min(72vw, 260px);
  }

  .companion-card {
    min-width: 0;
    scroll-snap-align: start;
  }

  .hero-hall__controls {
    order: 5;
    width: 100%;
  }

  .hero-card {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  .hero-card__companion-portrait {
    display: none;
  }

  .battle-companion-card__bonuses {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  input,
  select,
  button {
    min-height: 44px;
  }
}

@media (max-width: 480px) {
  .app-shell,
  .fantasy-dashboard {
    padding-inline: 8px;
  }

  .fantasy-dashboard .topbar,
  .panel,
  .fantasy-dashboard .panel,
  .hero-hall {
    border-radius: 10px;
  }

  .resource-bar,
  .fantasy-dashboard .hero-stats,
  .hero-hall__resources,
  .hero-hall__stats,
  .fantasy-dashboard .profile-panel .hero-hall__resources,
  .fantasy-dashboard .profile-panel .hero-hall__stats,
  .battle-companion-card__bonuses {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-hall__identity {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .hero-hall__identity .avatar-image {
    width: 48px;
    height: 48px;
  }

  .hero-hall__pedestal {
    min-height: 320px;
  }

  .hero-hall__pedestal .profile-avatar-viewer,
  .fantasy-dashboard .profile-panel .hero-hall__pedestal .profile-avatar-viewer {
    min-height: 300px;
    height: 44vh;
  }

  .companion-collection,
  .fantasy-dashboard .profile-panel .companion-collection {
    grid-auto-columns: minmax(142px, 78vw);
  }

  .bottom-action-bar {
    right: 6px;
    left: 6px;
    gap: 3px;
    padding: 6px;
  }

  .bottom-action-bar button {
    min-height: 50px;
    font-size: 0.62rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-hall__particles span,
  .hero-hall__stage::before {
    animation: none;
  }

  .companion-card,
  .dashboard-nav button {
    transition: none;
  }
}

.profile-avatar-viewer {
  position: relative;
  width: min(100%, 260px);
  min-height: 260px;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid rgba(216, 163, 64, 0.46);
  border-radius: 16px;
  background:
    radial-gradient(circle at 50% 34%, rgba(255, 226, 140, 0.2), transparent 32%),
    radial-gradient(circle at 50% 88%, rgba(47, 125, 90, 0.22), transparent 28%),
    linear-gradient(180deg, rgba(12, 31, 26, 0.96), rgba(38, 24, 14, 0.96));
  box-shadow:
    0 16px 30px rgba(5, 18, 15, 0.26),
    inset 0 0 26px rgba(255, 226, 140, 0.08);
}

.profile-avatar-viewer canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.profile-avatar-viewer__loading,
.profile-avatar-viewer__fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  gap: 0.55rem;
  padding: 1rem;
  color: #f8e7b1;
  text-align: center;
  font-weight: 800;
}

.profile-avatar-viewer__fallback img {
  width: min(130px, 50%);
  aspect-ratio: 1;
  object-fit: cover;
  object-position: center 28%;
  border: 2px solid rgba(216, 163, 64, 0.62);
  border-radius: 50%;
  box-shadow: 0 0 24px rgba(216, 163, 64, 0.24);
}

.hero-hall {
  display: grid;
  gap: 14px;
  padding: 12px;
  overflow: hidden;
  border: 1px solid rgba(216, 163, 64, 0.34);
  border-radius: 18px;
  background:
    radial-gradient(circle at 50% 24%, rgba(77, 209, 255, 0.18), transparent 28%),
    radial-gradient(circle at 50% 54%, rgba(255, 226, 140, 0.14), transparent 34%),
    linear-gradient(180deg, rgba(38, 24, 14, 0.94), rgba(15, 34, 28, 0.94));
  box-shadow:
    inset 0 0 32px rgba(255, 226, 140, 0.08),
    0 18px 34px rgba(5, 18, 15, 0.28);
}

.hero-hall__banner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 54px;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(255, 226, 140, 0.36);
  border-radius: 16px;
  background:
    linear-gradient(90deg, rgba(255, 226, 140, 0.12), transparent 34% 66%, rgba(77, 209, 255, 0.12)),
    linear-gradient(180deg, rgba(80, 50, 25, 0.92), rgba(24, 53, 36, 0.9));
}

.hero-hall__banner::before,
.hero-hall__banner::after {
  content: "";
  position: absolute;
  top: 12px;
  width: 28px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 226, 140, 0.58);
  box-shadow: 0 0 12px rgba(255, 226, 140, 0.32);
  animation: heroHallAccent 3600ms ease-in-out infinite;
}

.hero-hall__banner::before {
  left: 12px;
}

.hero-hall__banner::after {
  right: 12px;
  animation-delay: -1600ms;
}

.hero-hall__identity {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.hero-hall__identity .avatar-image {
  width: 56px;
  height: 56px;
  border: 2px solid rgba(255, 226, 140, 0.72);
  border-radius: 50%;
  box-shadow: 0 0 18px rgba(255, 226, 140, 0.24);
}

.hero-hall__identity h2,
.hero-hall__identity p,
.hero-hall__xp span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hero-hall__identity h2 {
  color: #fff2c6;
  font-size: 1.1rem;
}

.hero-hall__identity p,
.hero-hall__xp span {
  color: rgba(255, 248, 230, 0.76);
}

.hero-hall__level {
  display: grid;
  place-items: center;
  width: 54px;
  height: 60px;
  color: #2d1d10;
  background:
    radial-gradient(circle at 50% 20%, #fff2c6, transparent 24%),
    linear-gradient(180deg, #ffe28c, #d8a340);
  clip-path: polygon(50% 0, 92% 18%, 82% 84%, 50% 100%, 18% 84%, 8% 18%);
}

.hero-hall__level span {
  font-size: 0.58rem;
  font-weight: 900;
  text-transform: uppercase;
}

.hero-hall__level strong {
  font-size: 1.4rem;
  line-height: 1;
}

.hero-hall__xp {
  grid-column: 1 / -1;
}

.hero-hall__summary {
  background:
    linear-gradient(180deg, rgba(255, 249, 233, 0.92), rgba(245, 231, 195, 0.82));
}

.hero-hall__stage {
  position: relative;
  display: grid;
  gap: 12px;
}

.hero-hall__stage::before {
  content: "";
  position: absolute;
  inset: 4% 6% 18%;
  pointer-events: none;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(77, 209, 255, 0.24), transparent 58%);
  filter: blur(2px);
  animation: heroHallGlow 5200ms ease-in-out infinite;
}

.hero-hall__pedestal {
  position: relative;
  display: grid;
  justify-items: center;
  padding: 18px 8px 28px;
  isolation: isolate;
}

.hero-hall__pedestal .profile-avatar-viewer {
  z-index: 1;
  width: min(100%, 280px);
  min-height: 300px;
  border-radius: 50% 50% 18px 18px;
  background: transparent;
  box-shadow: none;
}

.hero-hall__stats {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 8px;
}

.hero-hall__stats div {
  display: grid;
  gap: 2px;
  min-height: 64px;
  padding: 9px;
  border: 1px solid rgba(255, 226, 140, 0.24);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 226, 140, 0.1), rgba(5, 18, 15, 0.22)),
    rgba(15, 34, 28, 0.74);
}

.hero-hall__stats span {
  color: rgba(255, 248, 230, 0.7);
  font-size: 0.72rem;
  font-weight: 900;
}

.hero-hall__stats strong {
  color: #ffe28c;
  font-size: 1.15rem;
}

.hero-hall__companions,
.hero-hall__controls {
  position: relative;
  z-index: 1;
  padding: 10px;
  border: 1px solid rgba(255, 226, 140, 0.22);
  border-radius: 14px;
  background: rgba(5, 18, 15, 0.22);
}

.hero-hall__companions h3 {
  margin: 0;
  color: #fff2c6;
}

.companion-collection {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(116px, 1fr));
  gap: 8px;
}

.companion-collection__message {
  grid-column: 1 / -1;
  min-height: 1.25rem;
  margin: 0;
  color: #ffe28c;
  font-size: 0.84rem;
  font-weight: 800;
  text-align: center;
}

.companion-card {
  display: grid;
  justify-items: center;
  gap: 5px;
  min-height: 112px;
  padding: 10px;
  border: 1px solid rgba(255, 226, 140, 0.24);
  border-radius: 14px;
  background:
    radial-gradient(circle at 50% 22%, rgba(77, 209, 255, 0.18), transparent 28%),
    linear-gradient(180deg, rgba(80, 50, 25, 0.9), rgba(24, 53, 36, 0.86));
  color: #fff8e6;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.companion-card__select {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 5px;
  width: 100%;
  min-height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.companion-card__select[aria-disabled="true"] {
  cursor: not-allowed;
}

.companion-card:hover,
.companion-card:focus-visible,
.companion-card.is-active {
  border-color: rgba(77, 209, 255, 0.72);
  box-shadow: 0 0 22px rgba(77, 209, 255, 0.22);
  transform: translateY(-1px);
}

.companion-card.is-locked {
  filter: saturate(0.62);
  opacity: 0.62;
}

.companion-card.is-locked.can-unlock {
  border-color: rgba(255, 226, 140, 0.44);
  opacity: 0.82;
}

.companion-card__lock {
  position: absolute;
  right: 4px;
  top: 0;
  font-size: 1rem;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.55);
}

.companion-card__sigil {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background:
    radial-gradient(circle, #fff2c6 0 18%, #4dd1ff 20% 34%, transparent 36%),
    conic-gradient(from 45deg, #ffe28c, #2f7d5a, #4dd1ff, #ffe28c);
  box-shadow: 0 0 18px rgba(77, 209, 255, 0.32);
}

.companion-card strong,
.companion-card small {
  max-width: 100%;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.companion-card small {
  color: #ffe28c;
  font-weight: 900;
}

.companion-card__description,
.companion-card__requirement {
  max-width: 100%;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.companion-card__description {
  color: rgba(255, 248, 230, 0.78);
  font-size: 0.68rem;
}

.companion-card__requirement {
  color: #9ee777;
  font-size: 0.72rem;
  font-weight: 900;
}

.companion-card__unlock {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid rgba(255, 226, 140, 0.45);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(122, 82, 24, 0.96), rgba(62, 36, 15, 0.96));
  color: #fff2c6;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 900;
}

.hero-hall__controls {
  display: grid;
  gap: 12px;
}

/* Profile layout guard: keep the Hero Hall contained in one active panel. */
.fantasy-dashboard .profile-panel.is-active {
  display: block;
  overflow: visible;
}

.fantasy-dashboard .profile-panel .hero-hall {
  width: 100%;
  max-width: 100%;
  min-height: auto;
  overflow: hidden;
}

.fantasy-dashboard .profile-panel .hero-hall__banner {
  grid-template-columns: minmax(220px, 1.3fr) 76px minmax(260px, 1fr);
}

.fantasy-dashboard .profile-panel .hero-hall__xp {
  grid-column: auto;
}

.fantasy-dashboard .profile-panel .hero-hall__resources {
  grid-column: 1 / -1;
  display: grid;
}

.fantasy-dashboard .profile-panel .hero-hall__summary {
  display: none;
}

.fantasy-dashboard .profile-panel .hero-hall__stage {
  display: grid;
  grid-template-columns: minmax(160px, 0.7fr) minmax(320px, 1.65fr) minmax(220px, 0.95fr);
  align-items: stretch;
  min-height: clamp(500px, 62vh, 720px);
  overflow: hidden;
}

.fantasy-dashboard .profile-panel .hero-hall__pedestal .profile-avatar-viewer {
  width: min(96%, 520px);
  min-height: clamp(420px, 60vh, 660px);
}

.fantasy-dashboard .profile-panel .hero-hall__stats {
  grid-template-columns: 1fr;
}

.fantasy-dashboard .profile-panel .companion-collection {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
  grid-auto-flow: row;
  grid-auto-columns: auto;
  width: 100%;
  min-width: 0;
  overflow: visible;
  align-items: stretch;
}

.fantasy-dashboard .profile-panel .companion-card {
  min-width: 0;
  height: 100%;
}

.fantasy-dashboard .profile-panel .companion-card strong {
  min-height: 2.5em;
  line-height: 1.25;
  white-space: normal;
}

.fantasy-dashboard .profile-panel .companion-card__description {
  display: -webkit-box;
  min-height: 2.7em;
  overflow: hidden;
  line-height: 1.35;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

@media (max-width: 1060px) {
  .fantasy-dashboard .profile-panel .hero-hall__banner,
  .fantasy-dashboard .profile-panel .hero-hall__stage {
    grid-template-columns: 1fr;
  }

  .fantasy-dashboard .profile-panel .hero-hall__xp,
  .fantasy-dashboard .profile-panel .hero-hall__resources {
    grid-column: 1 / -1;
  }

  .fantasy-dashboard .profile-panel .hero-hall__stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .fantasy-dashboard .profile-panel .hero-hall__resources,
  .fantasy-dashboard .profile-panel .hero-hall__stats,
  .fantasy-dashboard .profile-panel .equipment-slots {
    grid-template-columns: 1fr;
  }

  .fantasy-dashboard .profile-panel .hero-hall__pedestal .profile-avatar-viewer {
    min-height: 400px;
  }

  .fantasy-dashboard .profile-panel .companion-collection {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@keyframes heroHallGlow {
  0%,
  100% {
    opacity: 0.54;
    transform: scale(0.96);
  }
  50% {
    opacity: 1;
    transform: scale(1.02);
  }
}

@keyframes heroHallAccent {
  0%,
  100% {
    opacity: 0.46;
    transform: translateX(0);
  }
  50% {
    opacity: 1;
    transform: translateX(6px);
  }
}

.field {
  display: grid;
  gap: 7px;
}

.field span,
.progress-label,
.hint,
.empty-state,
.battle-log {
  color: var(--muted);
  font-size: 0.92rem;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 3px solid rgba(37, 113, 124, 0.22);
  border-color: var(--teal);
}

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px;
  background: rgba(21, 32, 27, 0.48);
}

.auth-dialog {
  width: min(420px, 100%);
  max-height: calc(100dvh - 40px);
  margin-block: auto;
  display: grid;
  gap: 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 22px;
}

.auth-heading h2 {
  font-size: 1.55rem;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.auth-tabs button.active {
  color: #fff;
  background: var(--teal);
  border-color: var(--teal);
}

.alpha-login-helper {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(200, 137, 33, 0.32);
  border-radius: 12px;
  background:
    radial-gradient(circle at 8% 16%, rgba(255, 226, 140, 0.22), transparent 32%),
    linear-gradient(180deg, rgba(255, 249, 233, 0.96), rgba(243, 245, 237, 0.9));
}

.alpha-login-helper strong {
  color: var(--green);
}

.alpha-login-helper p {
  color: var(--muted);
  font-size: 0.9rem;
}

.alpha-login-helper dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.alpha-login-helper div {
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(47, 125, 90, 0.14);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.62);
}

.alpha-login-helper dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.alpha-login-helper dd {
  margin: 2px 0 0;
  color: var(--ink);
  font-weight: 900;
}

.auth-form {
  display: grid;
  gap: 14px;
}

#authSubmit {
  position: sticky;
  bottom: 0;
  z-index: 1;
  box-shadow: 0 -8px 18px rgba(251, 252, 248, 0.92);
}

@media (max-height: 700px) {
  .auth-modal { padding-block: 10px; }
  .auth-dialog {
    max-height: calc(100dvh - 20px);
    gap: 12px;
    padding: 16px;
  }
  .auth-form { gap: 10px; }
}

.auth-recovery-actions {
  display: flex;
  justify-content: flex-end;
  min-height: 24px;
}

.auth-link {
  min-height: auto;
  padding: 2px 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--teal);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.auth-link:hover {
  color: var(--green);
  background: transparent;
}

.auth-status {
  min-height: 20px;
  color: var(--muted);
  font-size: 0.9rem;
}

.auth-session {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100vw - 24px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(251, 252, 248, 0.95);
  box-shadow: 0 10px 24px rgba(21, 32, 27, 0.1);
  padding: 8px;
}

.auth-session span {
  min-width: 0;
  max-width: 180px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.86rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-wrap {
  display: grid;
  gap: 8px;
}

.profile-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.profile-actions button {
  padding: 0 10px;
}

.profile-status {
  color: var(--muted);
  font-size: 0.86rem;
}

.progress-label {
  display: flex;
  justify-content: space-between;
}

.progress-bar {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e9df;
}

.progress-bar span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--gold));
}

.timer-panel {
  min-height: 434px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
  margin-bottom: 18px;
}

.section-heading h2 {
  font-size: 1.45rem;
}

.status-pill {
  display: inline-grid;
  place-items: center;
  min-width: 82px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  color: #fff;
  background: var(--teal);
  font-size: 0.86rem;
  font-weight: 800;
}

.book-grid {
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: 12px;
  align-items: start;
}

.book-lookup-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.book-lookup-row button {
  min-width: 82px;
}

.lookup-status {
  min-height: 20px;
  color: var(--muted);
  font-size: 0.84rem;
}

.lookup-status a {
  color: var(--teal);
  font-weight: 800;
  text-decoration-thickness: 2px;
}

.book-results {
  display: grid;
  gap: 8px;
}

.book-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.book-result.selected {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(37, 113, 124, 0.14);
}

.book-result div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.book-result strong {
  overflow-wrap: anywhere;
  font-size: 0.92rem;
}

.book-result span {
  color: var(--muted);
  font-size: 0.82rem;
}

.timer-face {
  display: grid;
  place-items: center;
  margin: 24px 0;
  min-height: 150px;
  border: 1px solid #dfe4dd;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(47, 125, 90, 0.08), transparent),
    #fff;
}

.timer-face span {
  font-variant-numeric: tabular-nums;
  font-size: clamp(3rem, 9vw, 6.6rem);
  font-weight: 900;
  letter-spacing: 0;
}

.controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.reading-log-dropdown {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.reading-log-dropdown summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  min-height: 52px;
  padding: 0 14px;
  cursor: pointer;
  list-style: none;
}

.reading-log-dropdown summary::-webkit-details-marker {
  display: none;
}

.reading-log-dropdown summary span {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
}

.reading-log-dropdown summary strong {
  color: var(--teal);
  font-size: 0.92rem;
}

.reading-log {
  display: grid;
  gap: 8px;
  padding: 0 14px 14px;
}

.reading-log-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.reading-log-item div {
  display: grid;
  gap: 3px;
}

.reading-log-item div:last-child {
  justify-items: end;
}

.reading-log-item strong {
  overflow-wrap: anywhere;
  font-size: 0.95rem;
}

.reading-log-item span {
  color: var(--muted);
  font-size: 0.84rem;
}

.story-panel,
.quest-panel,
.reward-panel,
.map-panel,
.battle-panel {
  display: grid;
  gap: 14px;
}

.story-panel,
.quest-panel,
.reward-panel {
  grid-column: 3;
}

.map-panel,
.battle-panel {
  grid-column: 2 / 4;
}

/* Living World story panel */
.story-panel {
  position: relative;
  overflow: hidden;
  border-color: rgba(97, 68, 30, 0.24);
  background:
    linear-gradient(180deg, rgba(255, 252, 238, 0.9), rgba(241, 248, 229, 0.82)),
    rgba(251, 252, 248, 0.9);
  box-shadow: var(--forest-shadow);
  animation: panelFadeIn 360ms ease both;
}

.story-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 20% 0%, rgba(47, 125, 90, 0.16), transparent 38%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.24), transparent 45%);
}

.story-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(115deg, transparent 0 34%, rgba(255, 226, 140, 0.1) 36%, transparent 48%),
    radial-gradient(circle at 18% 78%, rgba(255, 226, 140, 0.8) 0 2px, transparent 4px),
    radial-gradient(circle at 70% 18%, rgba(255, 226, 140, 0.65) 0 2px, transparent 4px),
    radial-gradient(circle at 88% 62%, rgba(255, 255, 255, 0.7) 0 1px, transparent 3px);
  opacity: 0.55;
  animation: forestFireflies 4600ms ease-in-out infinite;
}

.story-panel > * {
  position: relative;
  z-index: 1;
}

.story-card {
  position: relative;
  display: grid;
  gap: 8px;
  overflow: hidden;
  min-height: 244px;
  padding: 14px 122px 14px 14px;
  border: 1px solid rgba(97, 68, 30, 0.24);
  border-radius: 12px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.74) 58%, rgba(255, 255, 255, 0.22)),
    radial-gradient(circle at 84% 18%, rgba(200, 137, 33, 0.14), transparent 28%),
    linear-gradient(180deg, rgba(47, 125, 90, 0.12), transparent 72%),
    rgba(255, 255, 255, 0.82);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.86),
    0 12px 28px rgba(16, 48, 35, 0.12);
}

.story-card::before {
  content: "";
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 0;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(16, 48, 35, 0.1)),
    url("assets/characters/village-elder.jpg") center 30% / cover no-repeat,
    radial-gradient(circle, rgba(255, 226, 140, 0.38) 0 12%, rgba(47, 125, 90, 0.24) 13% 34%, transparent 64%);
  border: 2px solid rgba(255, 226, 140, 0.44);
  box-shadow:
    0 0 0 4px rgba(255, 255, 255, 0.34),
    0 12px 24px rgba(16, 48, 35, 0.18);
  opacity: 0.96;
  pointer-events: none;
}

.story-card::after {
  content: "";
  position: absolute;
  right: -12px;
  bottom: -8px;
  z-index: 0;
  width: 162px;
  height: 180px;
  background:
    radial-gradient(circle at center, rgba(255, 226, 140, 0.24), transparent 58%),
    url("assets/objects/heart-tree-mythic.jpg") center bottom / contain no-repeat;
  opacity: 0.34;
  pointer-events: none;
  animation: heartTreeIdleGlow 3400ms ease-in-out infinite;
}

.story-card > * {
  position: relative;
  z-index: 1;
}

.story-card.is-complete {
  border-color: rgba(47, 125, 90, 0.56);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.76) 58%, rgba(255, 255, 255, 0.26)),
    radial-gradient(circle at 84% 18%, rgba(255, 213, 109, 0.26), transparent 30%),
    linear-gradient(180deg, rgba(47, 125, 90, 0.2), transparent 72%),
    rgba(255, 255, 255, 0.9);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 16px 34px rgba(16, 48, 35, 0.16),
    0 0 0 1px rgba(255, 226, 140, 0.24);
}

.story-card.is-complete::before {
  opacity: 1;
}

.story-card.is-complete::after {
  opacity: 0.82;
  animation: heartTreeGlow 2600ms ease-in-out infinite;
}

.story-card[data-forest-life="restored"] {
  background:
    radial-gradient(circle at 22% 102%, rgba(255, 195, 112, 0.4) 0 4px, transparent 5px),
    radial-gradient(circle at 30% 100%, rgba(154, 205, 80, 0.45) 0 5px, transparent 6px),
    radial-gradient(circle at 42% 102%, rgba(255, 226, 140, 0.38) 0 4px, transparent 5px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.76) 58%, rgba(255, 255, 255, 0.26)),
    radial-gradient(circle at 84% 18%, rgba(255, 213, 109, 0.3), transparent 30%),
    linear-gradient(180deg, rgba(47, 125, 90, 0.22), transparent 72%),
    rgba(255, 255, 255, 0.92);
}

.story-card[data-forest-life="restored"] .story-badge::before {
  content: "";
  position: absolute;
  left: -16px;
  top: -8px;
  width: 12px;
  height: 7px;
  border-radius: 100% 0 100% 0;
  background: linear-gradient(135deg, #a9c957, var(--green));
  box-shadow:
    58px 10px 0 rgba(169, 201, 87, 0.82),
    116px -2px 0 rgba(47, 125, 90, 0.72);
  animation: forestLeafDrift 5200ms ease-in-out infinite;
}

.story-badge {
  justify-self: start;
  position: relative;
  padding: 6px 10px;
  border: 1px solid rgba(97, 68, 30, 0.2);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 253, 239, 0.98), rgba(238, 228, 193, 0.88));
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  box-shadow: 0 6px 14px rgba(21, 32, 27, 0.08);
}

.story-card.is-complete .story-badge {
  color: #fff;
  border-color: rgba(255, 226, 140, 0.42);
  background:
    linear-gradient(180deg, rgba(69, 151, 104, 0.96), var(--green));
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.32),
    0 0 24px rgba(47, 125, 90, 0.32);
  animation: completedBadgePulse 1800ms ease-in-out infinite;
}

.story-card strong {
  font-size: 1.05rem;
}

.story-card span {
  color: var(--teal);
  font-size: 0.9rem;
  font-weight: 800;
}

.story-card p,
.story-card small {
  color: var(--muted);
  line-height: 1.45;
}

.story-card small {
  display: block;
  padding-top: 10px;
  border-top: 1px solid rgba(47, 125, 90, 0.16);
  font-weight: 800;
}

.story-path-marker {
  justify-self: start;
  position: relative;
  display: inline-grid;
  min-height: 30px;
  padding: 6px 12px 6px 30px;
  border: 1px solid rgba(255, 226, 140, 0.46);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 249, 233, 0.94), rgba(216, 163, 64, 0.72));
  box-shadow:
    0 8px 16px rgba(16, 48, 35, 0.16),
    0 0 22px rgba(255, 226, 140, 0.26);
  color: #2d1d10;
  font-size: 0.78rem;
  font-weight: 900;
  animation: pathMarkerReveal 440ms ease both;
}

.story-path-marker::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 50%;
  width: 10px;
  height: 10px;
  border-top: 3px solid var(--green);
  border-right: 3px solid var(--green);
  transform: translateY(-50%) rotate(45deg);
}

.story-path-marker::after {
  content: "";
  position: absolute;
  right: -28px;
  top: -14px;
  width: 9px;
  height: 5px;
  border-top: 2px solid rgba(21, 32, 27, 0.72);
  border-radius: 50%;
  box-shadow:
    9px 2px 0 -1px rgba(21, 32, 27, 0.62),
    18px -1px 0 -1px rgba(21, 32, 27, 0.5);
  animation: forestBirds 4800ms ease-in-out infinite;
}

.quest-list {
  display: grid;
  gap: 10px;
}

.quest-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid rgba(47, 125, 90, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(246, 249, 241, 0.72));
}

.quest-item div {
  display: grid;
  gap: 3px;
}

.quest-item strong {
  font-size: 0.95rem;
}

.quest-item span {
  color: var(--muted);
  font-size: 0.84rem;
}

.quest-item.is-complete {
  border-color: rgba(47, 125, 90, 0.32);
  background: rgba(47, 125, 90, 0.09);
}

.quest-check {
  flex: 0 0 auto;
  min-width: 54px;
  text-align: center;
  padding: 5px 8px;
  border: 1px solid rgba(97, 68, 30, 0.16);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 253, 239, 0.98), rgba(238, 228, 193, 0.9));
  font-weight: 800;
  box-shadow: 0 6px 12px rgba(21, 32, 27, 0.08);
}

.quest-item.is-complete .quest-check {
  color: #fff;
  border-color: rgba(255, 226, 140, 0.36);
  background:
    linear-gradient(180deg, rgba(69, 151, 104, 0.96), var(--green));
}

.world-toast,
.quest-toast {
  position: fixed;
  right: 18px;
  z-index: 30;
  max-width: min(320px, calc(100vw - 36px));
  padding: 12px 14px;
  border: 1px solid rgba(47, 125, 90, 0.34);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(246, 249, 241, 0.92)),
    var(--panel);
  box-shadow: var(--forest-shadow);
  color: var(--ink);
  font-weight: 800;
  animation: panelFadeIn 220ms ease both;
}

.world-toast {
  bottom: 78px;
}

.quest-toast {
  bottom: 18px;
}

/* Opening Adventure intro sequence */
.intro-is-open {
  overflow: hidden;
}

.intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(5, 18, 15, 0.1), rgba(5, 18, 15, 0.74)),
    url("assets/backgrounds/whispering-forest.jpg") center / cover no-repeat,
    radial-gradient(circle at 50% 35%, rgba(47, 125, 90, 0.36), rgba(5, 18, 15, 0.92));
  opacity: 1;
  transition: opacity 220ms ease;
}

.intro-overlay.hidden {
  display: none;
}

.intro-overlay.is-transitioning .intro-scene {
  opacity: 0;
  transform: translateX(-24px) scale(0.97);
}

.intro-scene {
  display: grid;
  grid-template-columns: minmax(220px, 0.75fr) minmax(260px, 1fr);
  gap: 22px;
  width: min(820px, 100%);
  min-height: 360px;
  border-color: rgba(255, 226, 140, 0.52);
  transition: opacity 180ms ease, transform 180ms ease;
  animation: introCameraIn 520ms ease both;
}

.intro-scene--splash {
  min-height: 420px;
}

.intro-scene--hero,
.intro-scene--companion,
.intro-scene--quest,
.intro-scene--celebration {
  box-shadow:
    var(--rr-shadow-panel),
    0 0 42px rgba(255, 226, 140, 0.24);
}

.intro-visual {
  position: relative;
  min-height: 280px;
  overflow: hidden;
  border: 1px solid rgba(255, 226, 140, 0.28);
  border-radius: 12px;
  background:
    radial-gradient(circle at 52% 40%, rgba(255, 226, 140, 0.28), transparent 26%),
    linear-gradient(180deg, rgba(5, 18, 15, 0.06), rgba(5, 18, 15, 0.46)),
    url("assets/objects/heart-tree-mythic.jpg") center / cover no-repeat,
    var(--rr-forest-deep);
  box-shadow: inset 0 0 42px rgba(5, 18, 15, 0.5);
}

.intro-visual::before,
.intro-visual::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.intro-visual::before {
  inset: 0;
  background:
    linear-gradient(115deg, transparent 0 34%, rgba(255, 226, 140, 0.14) 36%, transparent 48%),
    radial-gradient(circle at 20% 78%, rgba(255, 226, 140, 0.78) 0 2px, transparent 4px),
    radial-gradient(circle at 78% 24%, rgba(255, 255, 255, 0.72) 0 1px, transparent 3px);
  opacity: 0.62;
  animation: forestFireflies 4600ms ease-in-out infinite;
}

.intro-scene--splash .intro-visual {
  background:
    linear-gradient(180deg, rgba(5, 18, 15, 0.04), rgba(5, 18, 15, 0.36)),
    url("assets/backgrounds/whispering-forest.jpg") center / cover no-repeat,
    var(--rr-forest-deep);
}

.intro-visual--dialogue {
  background:
    linear-gradient(180deg, rgba(5, 18, 15, 0.06), rgba(5, 18, 15, 0.5)),
    url("assets/characters/village-elder.jpg") center 24% / cover no-repeat,
    var(--rr-forest-deep);
}

.intro-visual--hero {
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 226, 140, 0.28), transparent 28%),
    linear-gradient(180deg, rgba(5, 18, 15, 0.08), rgba(5, 18, 15, 0.48)),
    url("avatars/avatar-1.png") center 20% / cover no-repeat,
    var(--rr-forest-deep);
}

.intro-visual--hero::after {
  right: 28px;
  bottom: 22px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 226, 140, 0.34), transparent 58%),
    linear-gradient(180deg, rgba(47, 125, 90, 0.92), rgba(21, 61, 44, 0.94));
  box-shadow: 0 0 26px rgba(255, 226, 140, 0.28);
}

.intro-visual--companion {
  background:
    radial-gradient(circle at 52% 44%, rgba(255, 226, 140, 0.34), transparent 30%),
    linear-gradient(180deg, rgba(5, 18, 15, 0.05), rgba(5, 18, 15, 0.42)),
    url("assets/backgrounds/whispering-forest.jpg") center / cover no-repeat,
    var(--rr-forest-deep);
}

.intro-visual--companion::after {
  left: 50%;
  top: 50%;
  width: 116px;
  height: 82px;
  border-radius: 52% 52% 44% 44%;
  background:
    radial-gradient(circle at 72% 28%, #15201b 0 4px, transparent 5px),
    radial-gradient(circle at 68% 12%, #c8e88a 0 15px, transparent 16px),
    radial-gradient(circle at 34% 54%, #c8e88a 0 18px, transparent 19px),
    linear-gradient(180deg, #b8df78, #4fa56f);
  box-shadow:
    -42px 10px 0 -18px #c8e88a,
    0 0 34px rgba(255, 226, 140, 0.4);
  transform: translate(-50%, -42%);
  animation: companionHappy 1300ms ease-in-out infinite;
}

.intro-visual--quest {
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 226, 140, 0.34), transparent 28%),
    linear-gradient(180deg, rgba(5, 18, 15, 0.06), rgba(5, 18, 15, 0.46)),
    url("assets/objects/heart-tree-mythic.jpg") center / cover no-repeat,
    var(--rr-forest-deep);
}

.intro-visual--bright {
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 226, 140, 0.62), transparent 28%),
    linear-gradient(180deg, rgba(255, 249, 233, 0.08), rgba(5, 18, 15, 0.26)),
    url("assets/objects/heart-tree-mythic.jpg") center / cover no-repeat,
    var(--rr-forest-deep);
  animation: heartTreeBrighten 1800ms ease-in-out infinite;
}

.intro-visual--bright::after {
  right: 20px;
  bottom: 18px;
  min-width: 132px;
  min-height: 32px;
  border: 1px solid rgba(255, 226, 140, 0.52);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 249, 233, 0.94), rgba(216, 163, 64, 0.74));
  box-shadow: 0 0 24px rgba(255, 226, 140, 0.36);
}

.intro-content {
  display: grid;
  align-content: center;
  gap: 16px;
  min-width: 0;
}

.intro-eyebrow {
  color: var(--rr-gold-bright);
}

.intro-body {
  max-width: 42ch;
  color: var(--rr-text-inverse);
}

.intro-step-progress {
  color: rgba(255, 248, 230, 0.72);
  font-size: 0.84rem;
  font-weight: 800;
}

.intro-action {
  justify-self: start;
}

.map-dropdown {
  display: grid;
  gap: 14px;
}

.map-dropdown summary {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
  margin-bottom: 18px;
  cursor: pointer;
  list-style: none;
}

.map-dropdown summary::-webkit-details-marker {
  display: none;
}

.map-dropdown summary::after {
  content: "Open";
  display: inline-grid;
  place-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.map-dropdown[open] summary::after {
  content: "Close";
}

.map-dropdown summary strong {
  display: block;
  font-size: 1.45rem;
}

.world-map {
  position: relative;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 4px;
  min-height: 468px;
  overflow: hidden;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #223228;
  box-shadow: inset 0 0 0 8px rgba(255, 255, 255, 0.07);
}

.world-map::before {
  content: "";
  position: absolute;
  inset: 10px;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px) 0 0 / calc(12.5% - 0.5px) calc(16.666% - 0.5px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.1) 1px, transparent 1px) 0 0 / calc(12.5% - 0.5px) calc(16.666% - 0.5px);
  z-index: 2;
}

.world-map::after {
  content: "";
  position: absolute;
  inset: 10px;
  pointer-events: none;
  background:
    radial-gradient(circle at 16% 28%, rgba(23, 32, 27, 0.35) 0 3px, transparent 4px),
    radial-gradient(circle at 66% 62%, rgba(23, 32, 27, 0.32) 0 4px, transparent 5px),
    radial-gradient(circle at 82% 16%, rgba(23, 32, 27, 0.24) 0 3px, transparent 4px);
  z-index: 3;
}

.map-tile {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: 1fr auto auto;
  align-items: end;
  min-width: 0;
  min-height: 72px;
  overflow: hidden;
  padding: 8px 6px 7px;
  border: 0;
  border-radius: 2px;
  color: #eef6e8;
  text-align: left;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
  box-shadow: none;
  isolation: isolate;
}

.map-tile:hover {
  transform: none;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.42);
}

.map-tile:disabled {
  opacity: 0.58;
}

.map-tile.current {
  box-shadow: inset 0 0 0 3px #f5c451, 0 0 0 2px rgba(245, 196, 81, 0.28);
}

.map-tile.explored {
  filter: saturate(1.08);
}

.tile-ground {
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(circle at 26% 24%, rgba(255, 255, 255, 0.2) 0 2px, transparent 3px),
    radial-gradient(circle at 76% 78%, rgba(0, 0, 0, 0.18) 0 3px, transparent 4px),
    var(--tile-base);
}

.tile-ground::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--tile-detail);
  opacity: 0.9;
}

.terrain-grass {
  --tile-base: #527c42;
  --tile-detail: repeating-linear-gradient(45deg, transparent 0 10px, rgba(255, 255, 255, 0.1) 10px 12px);
}

.terrain-rice {
  --tile-base: #6f9345;
  --tile-detail: repeating-linear-gradient(90deg, rgba(237, 220, 122, 0.55) 0 4px, transparent 4px 13px);
}

.terrain-water {
  --tile-base: #356f82;
  --tile-detail: repeating-linear-gradient(-18deg, rgba(226, 245, 255, 0.28) 0 3px, transparent 3px 12px);
}

.terrain-marsh {
  --tile-base: #566d49;
  --tile-detail: radial-gradient(ellipse at 40% 58%, rgba(32, 55, 40, 0.75) 0 18%, transparent 19%);
}

.terrain-granite {
  --tile-base: #777b70;
  --tile-detail: linear-gradient(135deg, rgba(255, 255, 255, 0.18) 0 22%, transparent 23% 68%, rgba(0, 0, 0, 0.18) 69%);
}

.terrain-slate {
  --tile-base: #596068;
  --tile-detail: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.13) 0 8px, rgba(0, 0, 0, 0.12) 8px 16px);
}

.terrain-scrub {
  --tile-base: #95724b;
  --tile-detail: radial-gradient(circle at 30% 60%, rgba(61, 88, 42, 0.72) 0 7px, transparent 8px);
}

.terrain-steam {
  --tile-base: #6a7164;
  --tile-detail: radial-gradient(circle at 48% 40%, rgba(239, 244, 229, 0.58) 0 18%, transparent 19%);
}

.terrain-ruin {
  --tile-base: #56524b;
  --tile-detail: linear-gradient(90deg, rgba(190, 198, 184, 0.48) 0 14%, transparent 14% 40%, rgba(35, 39, 38, 0.4) 40% 52%, transparent 52%);
}

.map-tile strong,
.map-tile small {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-tile strong {
  font-size: 0.78rem;
  line-height: 1.08;
}

.map-tile small {
  color: rgba(247, 251, 240, 0.86);
  font-size: 0.68rem;
  font-weight: 800;
}

.tile-beast {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  border-radius: 50% 50% 45% 45%;
  background:
    radial-gradient(circle at 35% 36%, #fff 0 2px, transparent 3px),
    radial-gradient(circle at 65% 36%, #fff 0 2px, transparent 3px),
    #65332d;
  box-shadow: 0 0 0 3px rgba(255, 238, 207, 0.28);
}

.player-marker {
  position: absolute;
  top: 6px;
  left: 6px;
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 3px 5px;
  border: 2px solid #f5c451;
  border-radius: 999px;
  background: #fbfcf8;
  color: #1f3a2d;
  font-size: 0.62rem;
  font-weight: 900;
  text-shadow: none;
  box-shadow: 0 8px 18px rgba(21, 32, 27, 0.26);
}

.player-marker img {
  width: 28px;
  height: 28px;
  object-fit: cover;
  object-position: center 28%;
  border-radius: 50%;
}

.map-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.map-footer div,
.map-log {
  display: grid;
  gap: 4px;
}

.map-footer span,
.map-log {
  color: var(--muted);
  font-size: 0.9rem;
}

.map-log {
  min-height: 54px;
  padding: 12px;
  border-left: 4px solid var(--green);
  border-radius: 8px;
  background: #fff;
}

.reward-card {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 16px;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, #7d8580, #26332d);
}

.reward-card[data-rarity="Epic"] {
  color: #2b1c05;
  background: linear-gradient(135deg, #f5c451, #fff0c2);
}

.reward-card[data-rarity="Legendary"] {
  color: #fff;
  background: linear-gradient(135deg, #6d4ac7, #26332d);
}

.reward-card span {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
}

.reward-card strong {
  display: block;
  font-size: 1.35rem;
}

.reward-card p {
  margin-top: 4px;
}

.hidden {
  display: none;
}

.inventory,
.opponents {
  display: grid;
  gap: 10px;
}

.item,
.opponent {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.item {
  grid-template-columns: 58px minmax(0, 1fr) auto;
  align-items: center;
  border-left: 5px solid #8a918d;
}

.item[data-rarity="Epic"] {
  border-left-color: var(--gold);
  background: #fff8df;
}

.item[data-rarity="Legendary"] {
  border-left-color: #6d4ac7;
  background: #f4efff;
}

.item.is-active {
  border-color: var(--green);
  border-left-color: var(--green);
  box-shadow: inset 0 0 0 1px rgba(47, 125, 90, 0.2);
}

.item-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.item strong,
.opponent strong {
  color: #69716c;
  font-size: 0.98rem;
  overflow-wrap: anywhere;
}

.item[data-rarity="Epic"] strong {
  color: var(--gold);
}

.item[data-rarity="Legendary"] strong {
  color: #6d4ac7;
}

.item span,
.opponent span {
  color: var(--muted);
  font-size: 0.88rem;
}

.gear-toggle {
  min-width: 72px;
}

.item.is-active .gear-toggle {
  color: #fff;
  background: var(--green);
  border-color: var(--green);
}

.gear-art {
  position: relative;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  overflow: hidden;
  border: 2px solid rgba(21, 32, 27, 0.18);
  border-radius: 8px;
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.86), transparent 22%),
    linear-gradient(135deg, var(--gear-a), var(--gear-b));
  box-shadow: inset 0 -10px 18px rgba(21, 32, 27, 0.14);
}

.reward-card .gear-art {
  width: 64px;
  height: 64px;
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.9), transparent 22%),
    linear-gradient(135deg, var(--gear-a), var(--gear-b));
}

.gear-art span,
.gear-art::before,
.gear-art::after {
  content: "";
  position: absolute;
  display: block;
}

.gear-art.weapon span {
  width: 9px;
  height: 38px;
  border-radius: 999px;
  background: #f8f0d8;
  transform: rotate(38deg);
  box-shadow: 0 0 0 2px rgba(21, 32, 27, 0.22);
}

.gear-art.weapon::before {
  width: 30px;
  height: 8px;
  border-radius: 999px;
  background: #26332d;
  transform: translateY(10px) rotate(38deg);
}

.gear-art.weapon::after {
  width: 14px;
  height: 14px;
  border-radius: 50% 50% 50% 0;
  background: #fff;
  transform: translate(12px, -16px) rotate(38deg);
}

.gear-art.armor span {
  width: 32px;
  height: 36px;
  border-radius: 12px 12px 8px 8px;
  background:
    linear-gradient(90deg, transparent 0 39%, rgba(21, 32, 27, 0.28) 39% 45%, transparent 45% 55%, rgba(21, 32, 27, 0.28) 55% 61%, transparent 61%),
    #fff;
  box-shadow: 0 0 0 2px rgba(21, 32, 27, 0.22);
}

.gear-art.armor::before,
.gear-art.armor::after {
  top: 20px;
  width: 10px;
  height: 22px;
  border-radius: 999px;
  background: #26332d;
}

.gear-art.armor::before {
  left: 8px;
  transform: rotate(22deg);
}

.gear-art.armor::after {
  right: 8px;
  transform: rotate(-22deg);
}

.opponent {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.opponent button {
  min-width: 82px;
}

.battle-companion {
  margin-bottom: 12px;
}

.battle-companion-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid rgba(255, 226, 140, 0.32);
  border-radius: 14px;
  background:
    radial-gradient(circle at 12% 22%, rgba(77, 209, 255, 0.22), transparent 26%),
    linear-gradient(135deg, rgba(68, 38, 18, 0.92), rgba(18, 51, 37, 0.9));
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.18), inset 0 0 24px rgba(255, 226, 140, 0.08);
  color: #fff8e6;
}

.battle-companion-card__sigil {
  width: 62px;
  height: 62px;
  border: 2px solid rgba(255, 226, 140, 0.58);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 248, 230, 0.96) 0 14%, rgba(77, 209, 255, 0.8) 16% 32%, transparent 34%),
    conic-gradient(from 25deg, #ffe28c, #2f7d5a, #4dd1ff, #6d4de6, #ffe28c);
  box-shadow: 0 0 22px rgba(77, 209, 255, 0.28);
}

.battle-companion-card__body {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.battle-companion-card h3 {
  margin: 0;
  color: #fff2c6;
}

.battle-companion-card__bonuses {
  display: grid;
  grid-template-columns: repeat(4, minmax(56px, 1fr));
  gap: 8px;
  margin: 0;
}

.battle-companion-card__bonuses div {
  padding: 7px;
  border: 1px solid rgba(255, 226, 140, 0.2);
  border-radius: 10px;
  background: rgba(8, 22, 18, 0.34);
  text-align: center;
}

.battle-companion-card__bonuses dt,
.battle-companion-card__ability span {
  color: rgba(255, 248, 230, 0.74);
  font-size: 0.72rem;
}

.battle-companion-card__bonuses dd {
  margin: 0;
  color: #9ee777;
  font-weight: 900;
}

.battle-companion-card__ability {
  display: grid;
  gap: 2px;
}

.battle-companion-card__ability strong {
  color: #ffe28c;
}

.battle-companion__empty {
  padding: 12px;
  border: 1px dashed rgba(255, 226, 140, 0.35);
  border-radius: 14px;
  color: #fff8e6;
}

.battle-stage {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  min-height: 164px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(37, 113, 124, 0.08), transparent 58%),
    #fff;
}

.fighter {
  position: relative;
  width: 86px;
  height: 112px;
  justify-self: center;
  transition: transform 260ms ease;
}

.fighter-head,
.fighter-body,
.fighter-weapon {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.fighter-head {
  top: 0;
  width: 44px;
  height: 44px;
  border: 4px solid #26332d;
  border-radius: 50%;
  background: #e9be83;
}

.fighter-body {
  bottom: 0;
  width: 64px;
  height: 70px;
  border-radius: 24px 24px 8px 8px;
  background: var(--green);
}

.enemy-fighter .fighter-body {
  background: var(--red);
}

.fighter-weapon {
  top: 46px;
  width: 9px;
  height: 58px;
  border-radius: 999px;
  background: var(--gold);
  transform-origin: bottom center;
}

.player-fighter .fighter-weapon {
  left: 75%;
  transform: rotate(34deg);
}

.enemy-fighter .fighter-weapon {
  left: 25%;
  transform: rotate(-34deg);
}

.impact {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  color: #fff;
  background: var(--teal);
  font-size: 0.95rem;
  font-weight: 900;
  transform: scale(0.9);
  transition: transform 220ms ease, background 220ms ease;
}

.battle-stage.is-fighting .player-fighter {
  animation: playerStrike 900ms ease-in-out;
}

.battle-stage.is-fighting .enemy-fighter {
  animation: enemyStrike 900ms ease-in-out;
}

.battle-stage.is-fighting .impact {
  animation: clashPulse 900ms ease-in-out;
}

.battle-stage.player-win .enemy-fighter {
  transform: translateY(18px) rotate(7deg);
}

.battle-stage.enemy-win .player-fighter {
  transform: translateY(18px) rotate(-7deg);
}

.battle-stage.player-win .impact {
  background: var(--green);
}

.battle-stage.enemy-win .impact {
  background: var(--red);
}

.battle-log {
  min-height: 72px;
  padding: 14px;
  border-left: 4px solid var(--gold);
  border-radius: 8px;
  background: #fff;
}

/* Fantasy RPG dashboard shell */
.fantasy-dashboard {
  width: min(1480px, calc(100% - 28px));
  min-height: 100vh;
  padding: 18px 0 98px;
}

.fantasy-dashboard .topbar {
  position: sticky;
  top: 0;
  z-index: 12;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid rgba(216, 163, 64, 0.28);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(16, 30, 24, 0.9), rgba(11, 20, 16, 0.82)),
    rgba(16, 30, 24, 0.86);
  box-shadow: 0 18px 38px rgba(5, 18, 15, 0.28);
  backdrop-filter: blur(8px);
}

.fantasy-dashboard .topbar h1 {
  color: var(--rr-text-title);
  font-size: clamp(1.75rem, 3.6vw, 3.4rem);
  text-shadow: 0 0 22px rgba(216, 163, 64, 0.34);
}

.fantasy-dashboard .eyebrow {
  color: var(--rr-gold-bright);
}

.resource-bar,
.fantasy-dashboard .hero-stats {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(72px, auto);
  gap: 8px;
}

.resource-bar div,
.fantasy-dashboard .hero-stats div {
  display: grid;
  place-items: center;
  min-height: 58px;
  padding: 7px 10px;
  border: 1px solid rgba(216, 163, 64, 0.3);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 249, 233, 0.12), rgba(16, 30, 24, 0.34)),
    rgba(11, 20, 16, 0.72);
  color: var(--rr-text-inverse);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.resource-bar span,
.fantasy-dashboard .hero-stats span {
  color: var(--rr-gold-bright);
  font-size: 1.1rem;
  font-weight: 900;
}

.resource-bar small,
.fantasy-dashboard .hero-stats small {
  color: rgba(255, 248, 230, 0.72);
  font-size: 0.72rem;
  font-weight: 800;
}

.fantasy-dashboard .layout {
  grid-template-columns: 124px 280px minmax(420px, 1fr) 330px;
  gap: 14px;
}

.layout > .panel {
  display: none;
}

.layout > .panel.is-active {
  display: block;
}

.layout > .panel[hidden] {
  display: none !important;
}

.dashboard-nav {
  position: sticky;
  top: 104px;
  z-index: 10;
  display: grid;
  gap: 8px;
  align-self: start;
  padding: 10px;
  border: 1px solid rgba(216, 163, 64, 0.3);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(36, 23, 15, 0.94), rgba(13, 23, 18, 0.92));
  box-shadow: var(--forest-shadow);
}

.dashboard-nav button,
.bottom-action-bar button {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 0 10px;
  border-color: rgba(216, 163, 64, 0.28);
  background:
    linear-gradient(180deg, rgba(82, 54, 34, 0.96), rgba(36, 23, 15, 0.94));
  color: var(--rr-text-inverse);
  font-size: 0.78rem;
  font-weight: 900;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.topbar-session-slot {
  display: grid;
  place-items: center;
  min-width: 104px;
}

.topbar-session-slot:empty {
  display: none;
}

.topbar-session-slot .auth-session {
  position: static;
  z-index: auto;
  max-width: 100%;
  border-color: rgba(216, 163, 64, 0.36);
  background: rgba(251, 252, 248, 0.96);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.topbar-session-slot .auth-session span {
  max-width: 110px;
}

.dashboard-nav button.is-active,
.bottom-action-bar button.is-active,
.dashboard-nav button:hover,
.bottom-action-bar button:hover {
  border-color: rgba(255, 226, 140, 0.72);
  box-shadow:
    0 0 18px rgba(216, 163, 64, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.bottom-action-bar [data-dashboard-action="continue-reading"] {
  border-color: rgba(255, 226, 140, 0.82);
  background:
    linear-gradient(180deg, var(--rr-gold-bright), var(--rr-gold));
  color: #2d1d10;
  box-shadow:
    0 0 24px rgba(216, 163, 64, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.34);
}

.fantasy-dashboard .panel {
  border-color: rgba(216, 163, 64, 0.28);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 249, 233, 0.88), rgba(246, 239, 217, 0.78)),
    rgba(251, 252, 248, 0.86);
  box-shadow: var(--forest-shadow);
}

.fantasy-dashboard .profile-panel {
  grid-column: 2 / -1;
  align-self: stretch;
}

.dashboard-scene,
.fantasy-dashboard .timer-panel {
  grid-column: 2 / -1;
}

.fantasy-dashboard .story-panel,
.fantasy-dashboard .quest-panel,
.fantasy-dashboard .reward-panel {
  grid-column: 2 / -1;
}

.fantasy-dashboard .map-panel,
.fantasy-dashboard .battle-panel {
  grid-column: 2 / -1;
}

.dashboard-scene {
  position: relative;
  overflow: hidden;
  min-height: 780px;
  color: var(--rr-text-inverse);
  background:
    radial-gradient(circle at 50% 19%, rgba(255, 226, 140, 0.28), transparent 17%),
    radial-gradient(circle at 11% 36%, rgba(77, 181, 255, 0.24), transparent 16%),
    radial-gradient(circle at 88% 30%, rgba(144, 104, 255, 0.2), transparent 18%),
    linear-gradient(180deg, #77c9ff 0 16%, #4fb97b 17% 34%, #226a3d 35% 64%, #2d1c12 100%);
}

.dashboard-scene .section-heading,
.dashboard-scene .eyebrow {
  color: var(--rr-text-inverse);
}

.village-hub {
  display: grid;
  grid-template-rows: auto minmax(340px, 1fr) auto auto;
  gap: 18px;
  isolation: isolate;
}

.village-hub::before,
.village-hub::after {
  content: "";
  position: absolute;
  pointer-events: none;
  z-index: 0;
}

.village-hub::before {
  inset: 0;
  background:
    radial-gradient(ellipse at 10% 22%, rgba(255, 255, 255, 0.68) 0 7%, transparent 8%),
    linear-gradient(160deg, transparent 0 58%, rgba(255, 255, 255, 0.42) 59% 60%, transparent 61%),
    linear-gradient(18deg, transparent 0 70%, rgba(255, 255, 255, 0.36) 71% 72%, transparent 73%),
    linear-gradient(112deg, transparent 0 18%, rgba(255, 232, 156, 0.2) 24%, transparent 36%),
    linear-gradient(72deg, transparent 0 52%, rgba(126, 231, 135, 0.1) 58%, transparent 72%),
    radial-gradient(ellipse at 50% 74%, rgba(241, 201, 109, 0.24), transparent 22%),
    radial-gradient(circle at 50% 100%, rgba(14, 8, 4, 0.34), transparent 42%);
  animation: villageLightRays 9s ease-in-out infinite;
}

.village-hub::after {
  right: -80px;
  bottom: -120px;
  left: -80px;
  height: 280px;
  background:
    radial-gradient(ellipse at 18% 80%, rgba(15, 45, 24, 0.92), transparent 38%),
    radial-gradient(ellipse at 52% 74%, rgba(22, 70, 35, 0.96), transparent 44%),
    radial-gradient(ellipse at 86% 82%, rgba(16, 47, 30, 0.92), transparent 40%);
}

.village-heading,
.village-hud,
.village-heart-tree,
.village-buildings,
.village-quest-board {
  position: relative;
  z-index: 1;
}

.village-hud {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto 48px;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(255, 226, 140, 0.42);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(62, 40, 24, 0.94), rgba(16, 30, 24, 0.9));
  box-shadow:
    0 18px 36px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.village-hud__player {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 46px;
  gap: 10px;
  align-items: center;
}

.village-hud__player img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border: 3px solid rgba(255, 226, 140, 0.74);
  border-radius: 50%;
  box-shadow: 0 0 22px rgba(255, 226, 140, 0.28);
}

.village-hud__player strong,
.village-hud__player span,
.village-hud__player small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.village-hud__player strong {
  color: #fff2c6;
  font-size: 1.15rem;
}

.village-hud__player span,
.village-hud__player small {
  color: rgba(255, 248, 230, 0.76);
}

.village-hud__player b {
  display: grid;
  place-items: center;
  width: 46px;
  height: 52px;
  color: #2d1d10;
  background:
    radial-gradient(circle at 50% 20%, #fff2c6, transparent 24%),
    linear-gradient(180deg, #ffe28c, #d8a340);
  clip-path: polygon(50% 0, 92% 18%, 82% 84%, 50% 100%, 18% 84%, 8% 18%);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.28);
}

.village-hud__xp {
  height: 8px;
  overflow: hidden;
  margin: 5px 0 3px;
  border: 1px solid rgba(255, 226, 140, 0.32);
  border-radius: 999px;
  background: rgba(5, 18, 15, 0.62);
}

.village-hud__xp span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #4fd1ff, #9c5cff, #ffe28c);
  box-shadow: 0 0 14px rgba(156, 92, 255, 0.4);
}

.village-hud__resources {
  display: grid;
  grid-auto-flow: column;
  gap: 8px;
}

.village-hud__resources div,
.village-hud__settings {
  min-width: 70px;
  min-height: 50px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 226, 140, 0.34);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 226, 140, 0.12), rgba(5, 18, 15, 0.22)),
    rgba(16, 30, 24, 0.78);
  color: #fff2c6;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.village-hud__resources div {
  display: grid;
  place-items: center;
}

.village-hud__resources span {
  color: rgba(255, 248, 230, 0.7);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.village-hud__resources strong {
  color: #ffe28c;
  font-size: 1.05rem;
}

.village-hud__settings {
  display: grid;
  place-items: center;
  min-width: 48px;
  font-size: 1.35rem;
  cursor: pointer;
}

.village-sky span {
  position: absolute;
  z-index: 1;
  pointer-events: none;
}

.village-leaf {
  width: 14px;
  height: 8px;
  border-radius: 100% 0 100% 0;
  background: #8bd35d;
  box-shadow: 0 0 12px rgba(139, 211, 93, 0.32);
  animation: villageLeafDrift 8s ease-in-out infinite;
}

.village-leaf--one {
  top: 18%;
  left: 14%;
}

.village-leaf--two {
  top: 30%;
  right: 18%;
  animation-delay: -3s;
}

.village-page {
  width: 20px;
  height: 26px;
  border: 1px solid rgba(80, 55, 29, 0.36);
  border-radius: 3px;
  background: linear-gradient(135deg, #fff2c6, #d8a340);
  box-shadow: 0 0 18px rgba(255, 226, 140, 0.28);
  animation: villagePageFloat 7s ease-in-out infinite;
}

.village-page--one {
  top: 14%;
  right: 32%;
  transform: rotate(-8deg);
}

.village-page--two {
  top: 38%;
  left: 28%;
  animation-delay: -2.8s;
}

.village-particle {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ffe28c;
  box-shadow: 0 0 18px 4px rgba(255, 226, 140, 0.42);
  animation: villageParticleGlow 4.8s ease-in-out infinite;
}

.village-particle--one {
  top: 22%;
  left: 42%;
}

.village-particle--two {
  top: 48%;
  right: 26%;
  animation-delay: -1.4s;
}

.village-particle--three {
  top: 64%;
  left: 18%;
  animation-delay: -2.6s;
}

.village-heart-tree {
  justify-self: center;
  align-self: center;
  display: grid;
  justify-items: center;
  margin-top: -8px;
  filter: drop-shadow(0 0 34px rgba(255, 226, 140, 0.4));
}

.village-heart-tree__label {
  display: grid;
  justify-items: center;
  max-width: 360px;
  margin-bottom: -10px;
  padding: 10px 18px 12px;
  border: 1px solid rgba(255, 226, 140, 0.42);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(43, 27, 17, 0.94), rgba(10, 30, 24, 0.88));
  box-shadow: 0 16px 26px rgba(0, 0, 0, 0.24), 0 0 24px rgba(255, 226, 140, 0.12);
}

.village-heart-tree__label strong {
  color: #ffe28c;
  font-size: clamp(1.35rem, 3.4vw, 2.35rem);
  line-height: 1;
  text-transform: uppercase;
}

.village-heart-tree__label span {
  color: #fff8e6;
  font-size: 0.95rem;
  text-align: center;
}

.heart-tree-crown {
  position: relative;
  width: clamp(190px, 30vw, 310px);
  aspect-ratio: 1.18;
  border-radius: 48% 52% 45% 55%;
  background:
    radial-gradient(circle at 50% 48%, rgba(255, 239, 170, 0.96) 0 9%, transparent 15%),
    radial-gradient(circle at 38% 42%, #8bd35d 0 19%, transparent 28%),
    radial-gradient(circle at 62% 34%, #66b858 0 18%, transparent 30%),
    radial-gradient(circle at 56% 62%, #2f7d5a 0 24%, transparent 36%),
    radial-gradient(circle at 32% 64%, #1e5d3f 0 22%, transparent 34%);
  box-shadow:
    inset 0 -22px 42px rgba(5, 18, 15, 0.38),
    0 0 40px rgba(126, 231, 135, 0.28),
    0 0 72px rgba(255, 226, 140, 0.22);
  animation: heartTreeGlow 4.8s ease-in-out infinite;
}

.heart-tree-heart {
  position: absolute;
  top: 45%;
  left: 50%;
  width: 44px;
  height: 44px;
  background: #ffe28c;
  box-shadow: 0 0 28px 9px rgba(255, 226, 140, 0.58);
  transform: translate(-50%, -50%) rotate(45deg);
}

.heart-tree-heart::before,
.heart-tree-heart::after {
  content: "";
  position: absolute;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: inherit;
}

.heart-tree-heart::before {
  left: -22px;
}

.heart-tree-heart::after {
  top: -22px;
}

.heart-tree-trunk {
  width: clamp(52px, 8vw, 76px);
  height: clamp(112px, 16vw, 156px);
  margin-top: -26px;
  border-radius: 28px 28px 14px 14px;
  background:
    linear-gradient(90deg, rgba(255, 226, 140, 0.12), transparent 18% 78%, rgba(5, 18, 15, 0.32)),
    linear-gradient(180deg, #7a4c27, #3c2416);
  box-shadow: inset 10px 0 20px rgba(255, 226, 140, 0.1);
}

.heart-tree-roots {
  width: clamp(170px, 28vw, 280px);
  height: 34px;
  margin-top: -8px;
  border-radius: 50%;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(255, 226, 140, 0.26), transparent 44%),
    linear-gradient(90deg, transparent, rgba(89, 55, 27, 0.82) 16% 84%, transparent);
}

.village-buildings {
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  gap: 14px;
  align-items: stretch;
  margin-top: -18px;
}

.village-building {
  position: relative;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 108px;
  padding: 14px;
  border: 1px solid rgba(216, 163, 64, 0.44);
  border-radius: 16px;
  color: #fff4d2;
  text-align: left;
  background:
    radial-gradient(circle at 50% -12%, rgba(255, 226, 140, 0.26), transparent 36%),
    linear-gradient(180deg, rgba(255, 226, 140, 0.08), rgba(5, 18, 15, 0.18)),
    linear-gradient(135deg, rgba(80, 50, 25, 0.9), rgba(24, 53, 36, 0.92));
  box-shadow: 0 16px 28px rgba(0, 0, 0, 0.24), inset 0 0 18px rgba(255, 226, 140, 0.08);
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.village-building::before {
  content: "";
  position: absolute;
  top: -16px;
  right: 18px;
  left: 18px;
  height: 26px;
  border-radius: 12px 12px 3px 3px;
  background: linear-gradient(135deg, #743018, #d8a340);
  box-shadow: 0 8px 14px rgba(0, 0, 0, 0.18);
}

.village-building:hover,
.village-building:focus-visible {
  border-color: rgba(255, 226, 140, 0.82);
  box-shadow: 0 0 24px rgba(255, 226, 140, 0.22), 0 18px 32px rgba(0, 0, 0, 0.28);
  transform: translateY(-2px);
}

.village-building strong,
.village-building small {
  display: block;
  min-width: 0;
}

.village-building strong {
  color: #ffe28c;
  font-size: 1.05rem;
}

.village-building small {
  color: rgba(255, 248, 230, 0.72);
}

.village-building__icon {
  position: relative;
  width: 58px;
  height: 58px;
  border-radius: 10px;
  background:
    linear-gradient(45deg, transparent 0 44%, rgba(255, 226, 140, 0.6) 45% 55%, transparent 56%),
    linear-gradient(180deg, #d8a340, #5b351b);
  box-shadow: inset 0 -12px 18px rgba(5, 18, 15, 0.28), 0 0 18px rgba(255, 226, 140, 0.16);
}

.village-building__icon::before,
.village-building__icon::after {
  content: "";
  position: absolute;
  background: rgba(5, 18, 15, 0.72);
}

.village-building__icon::before {
  inset: 13px 12px auto;
  height: 15px;
  border-radius: 8px 8px 2px 2px;
}

.village-building__icon::after {
  right: 19px;
  bottom: 8px;
  width: 18px;
  height: 22px;
  border-radius: 9px 9px 2px 2px;
}

.village-building--library .village-building__icon {
  background:
    linear-gradient(90deg, rgba(255, 242, 198, 0.92) 0 46%, rgba(94, 57, 27, 0.88) 47% 53%, rgba(255, 242, 198, 0.86) 54%),
    linear-gradient(180deg, #d8a340, #5b351b);
}

.village-building--library::before {
  background: linear-gradient(135deg, #214f80, #70b9ff);
}

.village-building--quests .village-building__icon {
  background:
    repeating-linear-gradient(180deg, rgba(92, 55, 26, 0.72) 0 7px, rgba(255, 226, 140, 0.28) 8px 10px),
    linear-gradient(180deg, #8b5a2b, #4a2d18);
}

.village-building--quests::before {
  background: linear-gradient(135deg, #5b2682, #c58cff);
}

.village-building--arena .village-building__icon {
  border-radius: 50%;
  background:
    radial-gradient(circle, transparent 0 36%, rgba(255, 226, 140, 0.76) 37% 43%, transparent 44%),
    linear-gradient(135deg, #7f1d1d, #d8a340);
}

.village-building--arena::before {
  background: linear-gradient(135deg, #7f1d1d, #ff9355);
}

.village-building--profile .village-building__icon {
  border-radius: 50% 50% 14px 14px;
  background:
    radial-gradient(circle at 50% 28%, #ffe28c 0 18%, transparent 19%),
    radial-gradient(ellipse at 50% 72%, #2f7d5a 0 34%, transparent 35%),
    linear-gradient(180deg, #d8a340, #4a2d18);
}

.village-building--profile::before {
  background: linear-gradient(135deg, #2f7d5a, #9ce37d);
}

.village-building--academy .village-building__icon {
  background:
    linear-gradient(90deg, transparent 0 18%, rgba(255, 238, 170, 0.92) 19% 27%, transparent 28% 72%, rgba(255, 238, 170, 0.92) 73% 81%, transparent 82%),
    linear-gradient(180deg, transparent 0 18%, #d8a340 19% 28%, #315c55 29% 78%, #4a2d18 79%);
}

.village-building--academy::before {
  background: linear-gradient(135deg, #1f6f78, #e1b953);
}

.village-quest-board {
  align-self: end;
  padding: 16px;
  border: 2px solid rgba(90, 55, 27, 0.92);
  border-radius: 16px;
  background:
    linear-gradient(90deg, rgba(255, 226, 140, 0.08), transparent 28% 72%, rgba(5, 18, 15, 0.14)),
    repeating-linear-gradient(90deg, #7b4b27 0 18px, #684021 19px 36px);
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.3), inset 0 0 24px rgba(255, 226, 140, 0.1);
}

.village-quest-board__header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.village-quest-board__header > span {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background:
    radial-gradient(circle, #ffe28c 0 34%, #8b5a2b 36% 58%, transparent 60%),
    linear-gradient(180deg, #d8a340, #5b351b);
  box-shadow: 0 0 20px rgba(255, 226, 140, 0.28);
}

.village-quest-board h3 {
  margin: 0;
  color: #fff2c6;
}

.village-quest-list {
  grid-template-columns: 1fr;
  gap: 8px;
}

.village-quest-list .quest-item {
  border-color: rgba(255, 226, 140, 0.28);
  background: rgba(255, 242, 198, 0.12);
}

.village-quest {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) minmax(92px, auto);
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid rgba(255, 226, 140, 0.22);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 242, 198, 0.2), rgba(90, 55, 27, 0.24));
  color: #fff8e6;
}

.village-quest.is-complete {
  border-color: rgba(139, 211, 93, 0.58);
  background:
    linear-gradient(180deg, rgba(139, 211, 93, 0.18), rgba(90, 55, 27, 0.24));
}

.village-quest__icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(5, 18, 15, 0.48);
  color: #8bd35d;
  font-weight: 900;
}

.village-quest__body {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.village-quest__body strong,
.village-quest__body small,
.village-quest__reward {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.village-quest__body strong {
  color: #fff2c6;
}

.village-quest__body small {
  color: rgba(255, 248, 230, 0.74);
}

.village-quest__progress {
  height: 8px;
  overflow: hidden;
  border: 1px solid rgba(43, 27, 17, 0.34);
  border-radius: 999px;
  background: rgba(43, 27, 17, 0.48);
}

.village-quest__progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #7ddf5b, #ffe28c);
}

.village-quest__reward {
  justify-self: end;
  padding: 5px 8px;
  border: 1px solid rgba(255, 226, 140, 0.28);
  border-radius: 999px;
  color: #ffe28c;
  background: rgba(43, 27, 17, 0.42);
  font-size: 0.78rem;
  font-weight: 900;
}

.village-quest-board__action {
  display: block;
  width: min(220px, 100%);
  margin: 12px auto 0;
  border-color: rgba(255, 226, 140, 0.62);
  background:
    linear-gradient(180deg, #ffe28c, #b97825);
  color: #2d1d10;
  font-weight: 900;
  box-shadow: 0 0 18px rgba(255, 226, 140, 0.2);
}

@keyframes villageLightRays {
  0%,
  100% {
    opacity: 0.64;
  }
  50% {
    opacity: 1;
  }
}

@keyframes villageLeafDrift {
  0%,
  100% {
    transform: translate3d(0, 0, 0) rotate(-12deg);
  }
  50% {
    transform: translate3d(18px, 12px, 0) rotate(16deg);
  }
}

@keyframes villagePageFloat {
  0%,
  100% {
    transform: translate3d(0, 0, 0) rotate(-8deg);
  }
  50% {
    transform: translate3d(-10px, 18px, 0) rotate(10deg);
  }
}

@keyframes villageParticleGlow {
  0%,
  100% {
    opacity: 0.45;
    transform: scale(0.82);
  }
  50% {
    opacity: 1;
    transform: scale(1.18);
  }
}

@keyframes heartTreeGlow {
  0%,
  100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.18);
  }
}

/* Heart Tree sanctuary dashboard */
.dashboard-scene.village-hub {
  min-height: clamp(860px, 98vh, 1180px);
  padding: clamp(14px, 2vw, 24px);
  border-color: rgba(255, 232, 158, 0.36);
  border-radius: 24px;
  background:
    radial-gradient(ellipse at 50% 22%, rgba(255, 244, 188, 0.7), transparent 12%),
    linear-gradient(115deg, transparent 0 18%, rgba(255, 246, 196, 0.18) 22%, transparent 38%),
    linear-gradient(72deg, transparent 0 56%, rgba(255, 246, 196, 0.15) 62%, transparent 78%),
    radial-gradient(ellipse at 50% 76%, rgba(93, 193, 124, 0.46), transparent 38%),
    radial-gradient(ellipse at 20% 42%, rgba(33, 92, 61, 0.84), transparent 32%),
    radial-gradient(ellipse at 82% 38%, rgba(28, 85, 65, 0.84), transparent 34%),
    linear-gradient(180deg, #8fdcff 0 12%, #76c98c 13% 30%, #32764c 31% 62%, #1f4b35 63% 78%, #2c1d14 100%);
}

.dashboard-scene.village-hub::before {
  inset: 0;
  background:
    repeating-linear-gradient(92deg, transparent 0 34px, rgba(17, 74, 48, 0.32) 35px 42px, transparent 43px 100px),
    radial-gradient(ellipse at 50% 96%, rgba(241, 230, 183, 0.38), transparent 30%),
    radial-gradient(ellipse at 50% 100%, rgba(255, 255, 255, 0.2), transparent 20%);
  opacity: 0.72;
  animation: sanctuaryLightBreathe 9s ease-in-out infinite;
}

.dashboard-scene.village-hub::after {
  right: -12%;
  bottom: -76px;
  left: -12%;
  height: 280px;
  background:
    radial-gradient(ellipse at 8% 54%, rgba(250, 211, 100, 0.8) 0 1.5%, transparent 2%),
    radial-gradient(ellipse at 15% 60%, rgba(255, 133, 171, 0.82) 0 1.4%, transparent 2%),
    radial-gradient(ellipse at 86% 58%, rgba(159, 231, 108, 0.85) 0 1.5%, transparent 2.2%),
    radial-gradient(ellipse at 91% 66%, rgba(255, 218, 126, 0.75) 0 1.3%, transparent 2%),
    linear-gradient(90deg, transparent 0 9%, rgba(136, 91, 43, 0.55) 11% 18%, transparent 20% 78%, rgba(136, 91, 43, 0.48) 81% 89%, transparent 91%),
    radial-gradient(ellipse at 48% 82%, rgba(31, 98, 49, 0.9), transparent 46%),
    radial-gradient(ellipse at 18% 84%, rgba(21, 74, 43, 0.95), transparent 38%),
    radial-gradient(ellipse at 84% 86%, rgba(16, 61, 42, 0.95), transparent 40%);
}

.village-hub {
  grid-template-rows: auto auto minmax(560px, 1fr) auto auto;
  gap: clamp(14px, 2vw, 22px);
}

.village-heading {
  max-width: 980px;
  margin: 0 auto;
  padding: 12px 18px;
  border: 1px solid rgba(255, 232, 158, 0.34);
  border-radius: 18px;
  background:
    linear-gradient(90deg, transparent, rgba(42, 28, 17, 0.82) 18% 82%, transparent),
    linear-gradient(180deg, rgba(255, 246, 196, 0.16), rgba(15, 50, 34, 0.26));
}

.village-sanctuary {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 300px);
  gap: clamp(18px, 3vw, 34px);
  align-items: end;
  min-height: clamp(520px, 68vh, 760px);
}

.village-heart-tree {
  position: relative;
  display: grid;
  justify-items: center;
  align-self: stretch;
  width: 100%;
  min-height: clamp(520px, 68vh, 760px);
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  filter: drop-shadow(0 24px 40px rgba(16, 57, 30, 0.38));
}

.village-heart-tree:focus-visible {
  outline: 3px solid rgba(255, 232, 158, 0.82);
  outline-offset: 8px;
  border-radius: 30px;
}

.heart-tree-rays,
.heart-tree-mist,
.heart-tree-stream {
  position: absolute;
  pointer-events: none;
}

.heart-tree-art {
  position: absolute;
  z-index: 1;
  inset: 0 1% 2%;
  pointer-events: none;
  background:
    url("assets/objects/heart-tree-mythic.jpg") center bottom / contain no-repeat,
    url("assets/objects/heart-tree-mythic.jpg") center 54% / cover no-repeat;
  filter:
    drop-shadow(0 18px 28px rgba(4, 20, 13, 0.72))
    drop-shadow(0 0 30px rgba(255, 211, 108, 0.2));
  -webkit-mask-image: radial-gradient(ellipse 66% 62% at 50% 54%, #000 68%, transparent 100%);
  mask-image: radial-gradient(ellipse 66% 62% at 50% 54%, #000 68%, transparent 100%);
  transition: filter 280ms ease, transform 280ms ease, opacity 280ms ease;
}

.heart-tree-rays {
  inset: 0 8% 28%;
  background:
    linear-gradient(105deg, transparent 22%, rgba(255, 249, 205, 0.26) 27%, transparent 42%),
    linear-gradient(74deg, transparent 46%, rgba(255, 249, 205, 0.18) 52%, transparent 67%);
  mix-blend-mode: screen;
  animation: sanctuaryLightBreathe 8s ease-in-out infinite;
}

.heart-tree-mist {
  right: 7%;
  bottom: 7%;
  left: 7%;
  height: 90px;
  border-radius: 50%;
  background:
    radial-gradient(ellipse at 28% 50%, rgba(255, 255, 255, 0.28), transparent 46%),
    radial-gradient(ellipse at 68% 54%, rgba(202, 243, 221, 0.22), transparent 44%);
  filter: blur(6px);
  animation: sanctuaryMist 10s ease-in-out infinite;
}

.heart-tree-canopy {
  position: absolute;
  top: 2%;
  left: 50%;
  width: min(86%, 780px);
  height: 55%;
  transform: translateX(-50%);
  animation: sanctuaryBranchSway 7s ease-in-out infinite;
}

.heart-tree-canopy,
.heart-tree-trunk,
.heart-tree-roots {
  display: none;
}

.heart-tree-canopy::before,
.heart-tree-canopy::after,
.heart-tree-leaves {
  content: "";
  position: absolute;
  border-radius: 48% 52% 45% 55%;
  background:
    radial-gradient(circle at 50% 56%, rgba(255, 236, 152, 0.2), transparent 22%),
    radial-gradient(circle at 34% 42%, #b9ef82 0 18%, transparent 28%),
    radial-gradient(circle at 66% 34%, #91d76b 0 20%, transparent 32%),
    radial-gradient(circle at 58% 62%, #3f9c5f 0 25%, transparent 39%),
    radial-gradient(circle at 30% 68%, #256b49 0 24%, transparent 36%);
  box-shadow:
    inset 0 -34px 54px rgba(12, 57, 31, 0.34),
    0 0 54px rgba(137, 235, 113, 0.26);
}

.heart-tree-canopy::before {
  inset: 8% 16% 8% 16%;
}

.heart-tree-canopy::after {
  inset: 19% 2% 0 2%;
  opacity: 0.76;
}

.heart-tree-leaves--one {
  inset: 0 42% 18% 0;
}

.heart-tree-leaves--two {
  inset: 0 0 20% 42%;
}

.heart-tree-leaves--three {
  inset: 20% 25% 0;
  opacity: 0.9;
}

.heart-tree-branch {
  position: absolute;
  top: 58%;
  width: 34%;
  height: 22px;
  border-radius: 999px;
  background: linear-gradient(90deg, #5b341d, #8d5c2f, #3a2318);
  box-shadow: inset 0 4px 10px rgba(255, 225, 137, 0.14);
}

.heart-tree-branch--left {
  left: 18%;
  transform: rotate(-23deg);
}

.heart-tree-branch--right {
  right: 18%;
  transform: rotate(23deg);
}

.heart-tree-blossom {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff4cc 0 22%, #ffd47a 24% 42%, #f7a8c8 44% 70%, transparent 72%);
  box-shadow: 0 0 18px rgba(255, 222, 126, 0.5);
  opacity: 0;
}

.heart-tree-blossom--one {
  top: 32%;
  left: 25%;
}

.heart-tree-blossom--two {
  top: 42%;
  right: 28%;
}

.heart-tree-trunk {
  position: absolute;
  bottom: 13%;
  left: 50%;
  width: clamp(116px, 16vw, 180px);
  height: clamp(290px, 41vh, 430px);
  transform: translateX(-50%);
  border-radius: 46% 44% 24px 24px;
  background:
    radial-gradient(ellipse at 50% 44%, rgba(255, 229, 126, 0.2) 0 13%, transparent 19%),
    linear-gradient(90deg, rgba(38, 22, 13, 0.6), transparent 18% 72%, rgba(21, 13, 10, 0.58)),
    repeating-linear-gradient(94deg, rgba(255, 214, 118, 0.08) 0 7px, transparent 8px 18px),
    linear-gradient(180deg, #8c5a2d, #5b351c 44%, #342012);
  box-shadow:
    inset 15px 0 28px rgba(255, 231, 148, 0.13),
    inset -20px 0 32px rgba(20, 12, 8, 0.38),
    0 0 34px rgba(255, 213, 87, 0.16);
}

.heart-tree-sap {
  position: absolute;
  inset: 15% 47% 24%;
  border-radius: 999px;
  background: linear-gradient(180deg, transparent, rgba(255, 223, 105, 0.88), transparent);
  box-shadow: 0 0 16px rgba(255, 223, 105, 0.56);
  animation: sanctuarySapFlow 3.6s ease-in-out infinite;
}

.heart-tree-heart {
  top: 39%;
  width: clamp(42px, 5.6vw, 70px);
  height: clamp(42px, 5.6vw, 70px);
  background: #ffdf72;
  box-shadow:
    0 0 24px 8px rgba(255, 223, 105, 0.72),
    0 0 68px 20px rgba(255, 180, 68, 0.28);
  animation: sanctuaryHeartBreathe 4.5s ease-in-out infinite;
}

.heart-tree-heart::before,
.heart-tree-heart::after {
  width: inherit;
  height: inherit;
}

.heart-tree-heart::before {
  left: -50%;
}

.heart-tree-heart::after {
  top: -50%;
}

.heart-tree-roots {
  position: absolute;
  right: 17%;
  bottom: 7%;
  left: 17%;
  height: 120px;
  background:
    radial-gradient(ellipse at 50% 22%, rgba(255, 220, 110, 0.25), transparent 28%),
    linear-gradient(12deg, transparent 0 12%, rgba(99, 61, 31, 0.92) 13% 21%, transparent 22%),
    linear-gradient(-10deg, transparent 0 18%, rgba(87, 54, 29, 0.9) 19% 27%, transparent 28%),
    linear-gradient(0deg, transparent 0 42%, rgba(78, 49, 27, 0.92) 43% 56%, transparent 57%);
  border-radius: 50%;
}

.heart-tree-stream {
  right: 2%;
  bottom: 4%;
  width: 36%;
  height: 34px;
  border-radius: 50%;
  background:
    linear-gradient(90deg, transparent, rgba(112, 219, 255, 0.55), rgba(255, 255, 255, 0.65), transparent);
  filter: blur(1px);
  opacity: 0;
}

.village-heart-tree__label {
  position: absolute;
  top: 5%;
  z-index: 3;
  margin: 0;
}

.village-heart-tree:hover .heart-tree-art,
.village-heart-tree:focus-visible .heart-tree-art {
  filter:
    brightness(1.08)
    saturate(1.08)
    drop-shadow(0 20px 30px rgba(4, 20, 13, 0.76))
    drop-shadow(0 0 42px rgba(255, 211, 108, 0.32));
  transform: scale(1.012);
}

.village-heart-tree:hover .heart-tree-heart,
.village-heart-tree:focus-visible .heart-tree-heart {
  box-shadow:
    0 0 30px 12px rgba(255, 234, 132, 0.88),
    0 0 88px 28px rgba(255, 184, 71, 0.38);
}

.village-heart-tree:hover .heart-tree-canopy,
.village-heart-tree:focus-visible .heart-tree-canopy {
  filter: brightness(1.12) saturate(1.08);
}

.village-heart-tree:active .heart-tree-heart {
  animation: sanctuaryHeartPulse 520ms ease-out;
}

.village-elder-card {
  position: relative;
  align-self: center;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  border: 2px solid rgba(255, 224, 143, 0.36);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255, 232, 158, 0.14), transparent 42%),
    linear-gradient(180deg, rgba(66, 42, 25, 0.94), rgba(21, 43, 31, 0.94));
  box-shadow: 0 18px 32px rgba(7, 28, 17, 0.3), inset 0 0 18px rgba(255, 232, 158, 0.08);
}

.village-elder-card__portrait {
  width: 72px;
  height: 72px;
  border: 2px solid rgba(255, 224, 143, 0.65);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 30%, #ffe8b1 0 18%, transparent 20%),
    radial-gradient(ellipse at 50% 70%, #2d6b49 0 34%, transparent 36%),
    linear-gradient(180deg, #d4d4c8, #765539);
  box-shadow: 0 0 22px rgba(255, 224, 143, 0.24);
}

.village-elder-card strong {
  display: block;
  color: #fff0bd;
}

.village-elder-card p:last-child {
  margin: 6px 0 0;
  color: rgba(255, 248, 230, 0.82);
}

.village-world-panels {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.village-world-card {
  min-height: 136px;
  padding: 14px;
  border: 2px solid rgba(255, 218, 132, 0.34);
  border-radius: 16px;
  background:
    linear-gradient(90deg, rgba(255, 232, 158, 0.1), transparent 30% 70%, rgba(255, 232, 158, 0.08)),
    repeating-linear-gradient(90deg, rgba(117, 73, 35, 0.92) 0 16px, rgba(91, 56, 29, 0.94) 17px 33px);
  box-shadow: 0 14px 26px rgba(6, 29, 17, 0.24), inset 0 0 20px rgba(255, 232, 158, 0.08);
}

.village-world-card h3 {
  margin: 0 0 6px;
  color: #fff0bd;
  font-size: 1.05rem;
}

.village-world-card span {
  color: rgba(255, 248, 230, 0.78);
}

.village-world-progress {
  height: 10px;
  overflow: hidden;
  margin: 9px 0 6px;
  border: 1px solid rgba(255, 232, 158, 0.26);
  border-radius: 999px;
  background: rgba(34, 22, 14, 0.62);
}

.village-world-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #92e86f, #ffdf72);
  box-shadow: 0 0 16px rgba(255, 223, 114, 0.35);
}

.village-actions-and-board {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(320px, 1.1fr);
  gap: 16px;
  align-items: stretch;
}

.tree-state-weak .heart-tree-canopy,
.tree-state-weak .heart-tree-art {
  opacity: 0.78;
  filter: saturate(0.75) brightness(0.88);
}

.tree-state-weak .heart-tree-heart {
  opacity: 0.72;
}

.tree-state-weak .village-particle--three,
.tree-state-weak .village-particle--four,
.tree-state-weak .heart-tree-blossom,
.tree-state-weak .heart-tree-stream,
.tree-state-weak .village-bird {
  opacity: 0;
}

.tree-state-healthy .heart-tree-heart {
  opacity: 0.94;
}

.tree-state-healthy .heart-tree-stream {
  opacity: 0.42;
}

.tree-state-thriving .heart-tree-canopy,
.tree-state-thriving .heart-tree-art {
  filter: saturate(1.16) brightness(1.08);
}

.tree-state-thriving .heart-tree-heart {
  box-shadow:
    0 0 36px 14px rgba(255, 234, 132, 0.92),
    0 0 96px 34px rgba(255, 184, 71, 0.42);
}

.tree-state-thriving .heart-tree-blossom,
.tree-state-thriving .heart-tree-stream {
  opacity: 1;
}

.tree-state-thriving .village-bird {
  opacity: 0.95;
}

.village-leaf--three {
  top: 42%;
  left: 8%;
  animation-delay: -5.3s;
}

.village-leaf--four {
  top: 20%;
  right: 9%;
  animation-delay: -6.5s;
}

.village-particle--four {
  top: 36%;
  left: 56%;
  animation-delay: -3.7s;
}

.village-bird {
  width: 34px;
  height: 14px;
  opacity: 0;
  animation: sanctuaryBirdFlight 18s linear infinite;
}

.village-bird::before,
.village-bird::after {
  content: "";
  position: absolute;
  top: 4px;
  width: 18px;
  height: 8px;
  border-top: 3px solid rgba(42, 58, 54, 0.72);
  border-radius: 50%;
}

.village-bird::before {
  left: 0;
  transform: rotate(18deg);
}

.village-bird::after {
  right: 0;
  transform: rotate(-18deg);
}

.village-bird--one {
  top: 17%;
  left: -40px;
}

.village-bird--two {
  top: 27%;
  left: -80px;
  animation-delay: -8s;
}

@keyframes sanctuaryLightBreathe {
  0%, 100% { opacity: 0.52; }
  50% { opacity: 0.94; }
}

@keyframes sanctuaryMist {
  0%, 100% { transform: translateX(-12px); opacity: 0.42; }
  50% { transform: translateX(12px); opacity: 0.7; }
}

@keyframes sanctuaryBranchSway {
  0%, 100% { transform: translateX(-50%) rotate(-0.7deg); }
  50% { transform: translateX(-50%) rotate(0.7deg); }
}

@keyframes sanctuarySapFlow {
  0%, 100% { opacity: 0.38; transform: translateY(16px) scaleY(0.72); }
  50% { opacity: 1; transform: translateY(-16px) scaleY(1); }
}

@keyframes sanctuaryHeartBreathe {
  0%, 100% { transform: translate(-50%, -50%) rotate(45deg) scale(0.96); }
  50% { transform: translate(-50%, -50%) rotate(45deg) scale(1.08); }
}

@keyframes sanctuaryHeartPulse {
  0% { transform: translate(-50%, -50%) rotate(45deg) scale(1); }
  50% { transform: translate(-50%, -50%) rotate(45deg) scale(1.22); }
  100% { transform: translate(-50%, -50%) rotate(45deg) scale(1); }
}

@keyframes sanctuaryBirdFlight {
  0% { transform: translateX(0) translateY(0); }
  100% { transform: translateX(calc(100vw + 180px)) translateY(-24px); }
}

.bottom-action-bar {
  position: fixed;
  right: max(14px, calc((100vw - 1480px) / 2 + 14px));
  bottom: 14px;
  left: max(14px, calc((100vw - 1480px) / 2 + 14px));
  z-index: 18;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(216, 163, 64, 0.32);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(36, 23, 15, 0.92), rgba(11, 20, 16, 0.9));
  box-shadow: 0 18px 44px rgba(5, 18, 15, 0.36);
  backdrop-filter: blur(8px);
}

@media (max-width: 980px) {
  .fantasy-dashboard {
    width: min(100% - 20px, 1180px);
    padding-bottom: 120px;
  }

  .topbar,
  .layout {
    grid-template-columns: 1fr;
  }

  .fantasy-dashboard .topbar {
    position: relative;
    grid-template-columns: 1fr;
  }

  .topbar-session-slot {
    justify-items: stretch;
    width: 100%;
  }

  .topbar-session-slot .auth-session {
    position: static;
    justify-content: space-between;
    width: 100%;
    max-width: none;
  }

  .resource-bar,
  .fantasy-dashboard .hero-stats {
    grid-auto-flow: row;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .dashboard-nav {
    position: relative;
    top: auto;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .fantasy-dashboard .profile-panel,
  .dashboard-scene,
  .fantasy-dashboard .timer-panel,
  .fantasy-dashboard .story-panel,
  .fantasy-dashboard .quest-panel,
  .fantasy-dashboard .reward-panel,
  .fantasy-dashboard .map-panel,
  .fantasy-dashboard .battle-panel {
    grid-column: auto;
  }

  .hero-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .story-panel,
  .quest-panel,
  .reward-panel,
  .map-panel,
  .battle-panel {
    grid-column: auto;
  }

  .village-buildings,
  .village-quest-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .village-hud {
    grid-template-columns: 1fr;
  }

  .village-hud__resources {
    grid-auto-flow: row;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .village-hud__settings {
    justify-self: end;
  }
}

@media (max-width: 620px) {
  body {
    background-attachment: scroll;
  }

  .app-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 18px;
  }

  .book-grid,
  .book-result,
  .controls,
  .map-footer {
    grid-template-columns: 1fr;
  }

  .resource-bar,
  .fantasy-dashboard .hero-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-scene {
    min-height: auto;
  }

  .village-hub {
    gap: 14px;
  }

  .village-heart-tree {
    margin-top: 0;
  }

  .village-buildings,
  .village-quest-list {
    grid-template-columns: 1fr;
  }

  .village-hud__player {
    grid-template-columns: 54px minmax(0, 1fr) 40px;
  }

  .village-hud__player img {
    width: 54px;
    height: 54px;
  }

  .village-hud__resources {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .village-building {
    min-height: 92px;
  }

  .village-quest {
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .village-quest__reward {
    grid-column: 2;
    justify-self: start;
  }

  .village-quest-board {
    padding: 12px;
  }

  .bottom-action-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: 42vh;
    overflow: auto;
  }

  .item {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  .gear-toggle {
    grid-column: 1 / -1;
  }

  .reward-card {
    grid-template-columns: 58px minmax(0, 1fr);
  }

  .timer-face {
    min-height: 112px;
  }

  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .hero-stats div {
    min-height: 74px;
  }

  .world-map {
    grid-template-columns: repeat(8, minmax(0, 1fr));
    min-height: 420px;
    padding: 8px;
  }

  .map-tile {
    min-width: 0;
    min-height: 66px;
    padding: 7px 5px 6px;
  }

  .map-tile strong {
    font-size: 0.7rem;
  }

  .map-tile small {
    font-size: 0.62rem;
  }

  .player-marker {
    padding: 2px 4px;
    font-size: 0.58rem;
  }

  .player-marker img {
    width: 23px;
    height: 23px;
  }

  .story-card {
    min-height: 220px;
    padding: 12px 96px 12px 12px;
  }

  .story-card::before {
    width: 72px;
    height: 72px;
    right: 12px;
  }

  .story-card::after {
    width: 126px;
    height: 146px;
  }

  .world-toast,
  .quest-toast {
    right: 10px;
    left: 10px;
    max-width: none;
  }

  .world-toast {
    bottom: 76px;
  }

  .intro-overlay {
    padding: 14px;
  }

  .intro-scene {
    grid-template-columns: 1fr;
    gap: 14px;
    min-height: auto;
    max-height: calc(100vh - 28px);
    overflow: auto;
  }

  .intro-visual {
    min-height: 190px;
  }

  .intro-visual--companion::after {
    width: 88px;
    height: 64px;
  }

  .intro-visual--bright::after {
    right: 12px;
    bottom: 12px;
    min-width: 104px;
  }

  .intro-action {
    justify-self: stretch;
  }
}

@media (max-width: 460px) {
  .hero-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .story-card {
    padding-right: 72px;
  }

  .story-card::before {
    width: 54px;
    height: 54px;
  }

  .story-card::after {
    width: 98px;
    height: 116px;
    opacity: 0.22;
  }

  .intro-scene {
    padding: 14px;
  }
}

@media (max-width: 980px) {
  .village-sanctuary,
  .village-actions-and-board {
    grid-template-columns: 1fr;
  }

  .village-world-panels {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .village-heart-tree {
    min-height: clamp(500px, 62vh, 680px);
  }

  .village-elder-card {
    align-self: stretch;
    max-width: 560px;
    margin: 0 auto;
  }
}

@media (max-width: 620px) {
  .dashboard-scene.village-hub {
    min-height: auto;
    padding: 12px;
  }

  .village-world-panels,
  .village-buildings,
  .village-quest-list {
    grid-template-columns: 1fr;
  }

  .village-heart-tree {
    min-height: 470px;
  }

  .heart-tree-canopy {
    width: min(104%, 540px);
    height: 48%;
  }

  .heart-tree-trunk {
    bottom: 14%;
    width: 104px;
    height: 270px;
  }

  .heart-tree-roots {
    right: 5%;
    left: 5%;
  }

  .village-heart-tree__label {
    top: 0;
    max-width: min(100%, 310px);
  }

  .village-elder-card {
    grid-template-columns: 58px minmax(0, 1fr);
  }

  .village-elder-card__portrait {
    width: 58px;
    height: 58px;
  }
}

/* Dashboard concept-art alignment: Heart Tree as the connected scene focal point. */
.dashboard-scene.village-hub {
  background:
    radial-gradient(ellipse at 50% 19%, rgba(255, 249, 210, 0.82), transparent 10%),
    linear-gradient(112deg, transparent 0 17%, rgba(255, 250, 208, 0.22) 22%, transparent 38%),
    linear-gradient(72deg, transparent 0 58%, rgba(255, 250, 208, 0.18) 64%, transparent 78%),
    radial-gradient(ellipse at 18% 36%, rgba(69, 155, 93, 0.45), transparent 22%),
    radial-gradient(ellipse at 82% 34%, rgba(60, 143, 103, 0.4), transparent 24%),
    linear-gradient(180deg, #8bd8ff 0 11%, #78c78a 12% 27%, #4c9c5c 28% 43%, #2c744a 44% 68%, #2b1d13 100%);
}

.dashboard-scene.village-hub::before {
  background:
    linear-gradient(90deg, transparent 0 5%, rgba(35, 93, 58, 0.55) 6% 8%, transparent 9% 16%, rgba(23, 77, 51, 0.48) 17% 19%, transparent 20% 81%, rgba(22, 70, 55, 0.5) 82% 84%, transparent 85%),
    radial-gradient(ellipse at 18% 96%, rgba(101, 65, 30, 0.44), transparent 22%),
    radial-gradient(ellipse at 82% 96%, rgba(101, 65, 30, 0.4), transparent 24%),
    radial-gradient(ellipse at 50% 102%, rgba(255, 239, 180, 0.42), transparent 34%);
  opacity: 0.88;
}

.village-hud {
  border-width: 2px;
  border-color: rgba(255, 219, 116, 0.56);
  border-radius: 20px;
  background:
    linear-gradient(90deg, rgba(255, 229, 151, 0.13), transparent 28% 72%, rgba(255, 229, 151, 0.1)),
    linear-gradient(180deg, rgba(39, 27, 22, 0.96), rgba(19, 24, 23, 0.94));
}

.village-heading {
  position: absolute;
  top: 96px;
  left: 50%;
  z-index: 4;
  width: min(360px, 58%);
  transform: translateX(-50%);
  border-width: 2px;
  border-color: rgba(255, 224, 132, 0.62);
  border-radius: 20px;
  text-align: center;
  background:
    radial-gradient(ellipse at 50% 0, rgba(255, 224, 132, 0.2), transparent 48%),
    linear-gradient(180deg, rgba(46, 31, 21, 0.96), rgba(14, 31, 25, 0.94));
  box-shadow: 0 18px 30px rgba(8, 30, 18, 0.28), inset 0 0 20px rgba(255, 224, 132, 0.1);
}

.village-heading h2 {
  margin: 0;
  color: #fff3be;
  font-size: clamp(1.6rem, 3.4vw, 2.7rem);
  line-height: 0.98;
  text-transform: uppercase;
  text-shadow: 0 2px 0 rgba(43, 27, 17, 0.7), 0 0 18px rgba(255, 216, 95, 0.3);
}

.village-heading .status-pill {
  justify-self: center;
  margin-top: 8px;
}

.village-sanctuary {
  grid-template-columns: minmax(0, 1fr);
  min-height: clamp(650px, 76vh, 870px);
  margin-top: -12px;
}

.village-heart-tree {
  min-height: clamp(650px, 76vh, 870px);
  transform: perspective(1000px) rotateX(1deg);
}

.heart-tree-canopy {
  top: 0;
  width: min(94%, 940px);
  height: 58%;
}

.heart-tree-canopy::before {
  inset: 0 12% 4%;
}

.heart-tree-canopy::after {
  inset: 14% 0 0;
}

.heart-tree-leaves--one {
  inset: 1% 46% 15% -2%;
}

.heart-tree-leaves--two {
  inset: 1% -2% 17% 46%;
}

.heart-tree-leaves--three {
  inset: 16% 21% 0;
}

.heart-tree-branch {
  top: 57%;
  height: 30px;
}

.heart-tree-trunk {
  bottom: 12%;
  width: clamp(150px, 17vw, 230px);
  height: clamp(360px, 47vh, 520px);
  border-radius: 48% 46% 26px 26px;
  background:
    radial-gradient(ellipse at 50% 42%, rgba(255, 231, 132, 0.28) 0 13%, transparent 20%),
    linear-gradient(90deg, rgba(32, 19, 12, 0.65), transparent 18% 72%, rgba(20, 12, 8, 0.62)),
    repeating-linear-gradient(102deg, rgba(255, 215, 118, 0.09) 0 9px, transparent 10px 22px),
    radial-gradient(ellipse at 50% 100%, #3a2314, transparent 58%),
    linear-gradient(180deg, #9a6431, #673d20 46%, #352013);
  box-shadow:
    inset 22px 0 34px rgba(255, 229, 138, 0.16),
    inset -28px 0 42px rgba(20, 12, 8, 0.44),
    0 0 44px rgba(255, 212, 87, 0.18);
}

.heart-tree-heart {
  width: clamp(58px, 6vw, 88px);
  height: clamp(58px, 6vw, 88px);
}

.heart-tree-roots {
  right: 7%;
  bottom: 5%;
  left: 7%;
  height: 168px;
  background:
    radial-gradient(ellipse at 50% 18%, rgba(255, 225, 119, 0.32), transparent 27%),
    linear-gradient(10deg, transparent 0 8%, rgba(102, 63, 31, 0.95) 9% 18%, transparent 19%),
    linear-gradient(-11deg, transparent 0 13%, rgba(88, 54, 29, 0.94) 14% 24%, transparent 25%),
    linear-gradient(24deg, transparent 0 25%, rgba(91, 56, 30, 0.92) 26% 34%, transparent 35%),
    linear-gradient(-24deg, transparent 0 66%, rgba(91, 56, 30, 0.92) 67% 75%, transparent 76%),
    linear-gradient(0deg, transparent 0 39%, rgba(74, 45, 25, 0.96) 40% 56%, transparent 57%);
}

.heart-tree-stream {
  right: 4%;
  bottom: 8%;
  width: 28%;
  height: 42px;
  opacity: 0.32;
}

.village-heart-tree__label {
  top: 8%;
  border-color: rgba(255, 224, 132, 0.64);
  background:
    radial-gradient(ellipse at 50% 0, rgba(255, 224, 132, 0.2), transparent 48%),
    linear-gradient(180deg, rgba(46, 31, 21, 0.96), rgba(14, 31, 25, 0.94));
}

.village-elder-card {
  position: absolute;
  right: clamp(16px, 3vw, 52px);
  top: 34%;
  z-index: 4;
  width: min(300px, 28%);
  align-self: auto;
  transform: translateY(-50%);
}

.village-world-panels {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: -86px;
}

.village-world-card {
  min-height: 120px;
  border-color: rgba(255, 213, 108, 0.48);
  border-radius: 14px;
  background:
    radial-gradient(ellipse at 50% -20%, rgba(255, 224, 132, 0.2), transparent 55%),
    linear-gradient(90deg, rgba(255, 224, 132, 0.08), transparent 30% 70%, rgba(255, 224, 132, 0.08)),
    repeating-linear-gradient(90deg, #7a4d29 0 14px, #5d391f 15px 29px);
}

.village-actions-and-board {
  grid-template-columns: 1fr;
  margin-top: -8px;
}

.village-buildings {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  align-items: end;
  margin-top: 0;
}

.village-building {
  min-height: 132px;
  align-content: end;
  padding: 54px 14px 14px;
  border-width: 2px;
  border-color: rgba(255, 219, 116, 0.42);
  background:
    radial-gradient(ellipse at 50% 24%, rgba(255, 217, 101, 0.22), transparent 36%),
    linear-gradient(180deg, rgba(70, 46, 28, 0.95), rgba(24, 33, 25, 0.94));
}

.village-building::before {
  top: 10px;
  right: 24px;
  left: 24px;
  height: 40px;
  border-radius: 20px 20px 4px 4px;
}

.village-quest-board {
  justify-self: center;
  width: min(680px, 100%);
  margin-top: -2px;
  border-color: rgba(255, 211, 101, 0.42);
  border-radius: 18px;
  background:
    linear-gradient(90deg, rgba(255, 224, 132, 0.14), transparent 20% 80%, rgba(255, 224, 132, 0.1)),
    repeating-linear-gradient(90deg, #8a5a31 0 20px, #6e4527 21px 40px);
}

@media (max-width: 980px) {
  .village-heading {
    position: relative;
    top: auto;
    left: auto;
    width: 100%;
    transform: none;
  }

  .village-elder-card {
    position: relative;
    top: auto;
    right: auto;
    width: min(560px, 100%);
    transform: none;
  }

  .village-world-panels {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 0;
  }

  .village-buildings {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .village-heart-tree,
  .village-sanctuary {
    min-height: 540px;
  }

  .heart-tree-canopy {
    width: min(118%, 560px);
    height: 48%;
  }

  .heart-tree-trunk {
    width: 120px;
    height: 300px;
  }

  .village-world-panels,
  .village-buildings {
    grid-template-columns: 1fr;
  }

  .village-building {
    min-height: 112px;
  }
}

/* Living World feedback animations */
@keyframes introCameraIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes heartTreeBrighten {
  0%,
  100% {
    filter: brightness(1);
    box-shadow: inset 0 0 42px rgba(5, 18, 15, 0.42), 0 0 22px rgba(255, 226, 140, 0.28);
  }
  50% {
    filter: brightness(1.12);
    box-shadow: inset 0 0 34px rgba(5, 18, 15, 0.28), 0 0 38px rgba(255, 226, 140, 0.46);
  }
}

@keyframes panelFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes completedBadgePulse {
  0%,
  100% {
    box-shadow:
      0 0 0 1px rgba(255, 255, 255, 0.32),
      0 0 18px rgba(47, 125, 90, 0.28);
  }
  50% {
    box-shadow:
      0 0 0 1px rgba(255, 226, 140, 0.42),
      0 0 28px rgba(47, 125, 90, 0.42);
  }
}

@keyframes heartTreeGlow {
  0%,
  100% {
    transform: scale(0.96);
    filter: blur(0);
  }
  50% {
    transform: scale(1.08);
    filter: blur(1px);
  }
}

@keyframes heartTreeIdleGlow {
  0%,
  100% {
    opacity: 0.34;
    transform: scale(1);
    filter: brightness(1);
  }
  50% {
    opacity: 0.44;
    transform: scale(1.02);
    filter: brightness(1.06);
  }
}

@keyframes forestFireflies {
  0%,
  100% {
    opacity: 0.42;
    transform: translate3d(0, 0, 0);
  }
  45% {
    opacity: 0.78;
    transform: translate3d(4px, -6px, 0);
  }
  72% {
    opacity: 0.56;
    transform: translate3d(-3px, 5px, 0);
  }
}

@keyframes forestLeafDrift {
  0%,
  100% {
    opacity: 0.58;
    transform: translate3d(0, 0, 0) rotate(-8deg);
  }
  50% {
    opacity: 0.95;
    transform: translate3d(12px, 8px, 0) rotate(10deg);
  }
}

@keyframes forestBirds {
  0%,
  100% {
    opacity: 0.22;
    transform: translate3d(0, 0, 0);
  }
  45% {
    opacity: 0.72;
    transform: translate3d(-18px, -4px, 0);
  }
  80% {
    opacity: 0.4;
    transform: translate3d(-8px, 2px, 0);
  }
}

@keyframes pathMarkerReveal {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes companionIdle {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-2px);
  }
}

@keyframes companionTailSway {
  0%,
  100% {
    transform: rotate(-8deg);
  }
  50% {
    transform: rotate(12deg);
  }
}

@keyframes companionBlink {
  0%,
  92%,
  100% {
    transform: scaleY(1);
  }
  95% {
    transform: scaleY(0.15);
  }
}

@keyframes companionSpark {
  0%,
  100% {
    opacity: 0.48;
    transform: scale(0.92);
  }
  50% {
    opacity: 1;
    transform: scale(1.08);
  }
}

@keyframes companionHappy {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  42% {
    transform: translateY(-5px) scale(1.04);
  }
}

@media (prefers-reduced-motion: reduce) {
  .story-panel,
  .story-panel::after,
  .story-card::after,
  .story-card.is-complete::after,
  .story-card.is-complete .story-badge,
  .story-card[data-forest-life="restored"] .story-badge::before,
  .story-path-marker,
  .story-path-marker::after,
  .world-toast,
  .quest-toast,
  .intro-scene,
  .intro-visual--bright,
  .intro-visual::before,
  .intro-visual--companion::after,
  .intro-visual--bright::after,
  .companion-portrait,
  .companion-portrait__tail,
  .companion-portrait__eye,
  .companion-portrait__spark,
  .forest-focal::before,
  .forest-focal__companion,
  .village-hub::before,
  .village-leaf,
  .village-page,
  .village-particle,
  .village-bird,
  .heart-tree-rays,
  .heart-tree-mist,
  .heart-tree-canopy,
  .heart-tree-sap,
  .heart-tree-heart,
  .hero-hall__stage::before,
  .hero-hall__banner::before,
  .hero-hall__banner::after {
    animation: none;
  }

  .intro-overlay,
  .intro-scene,
  .village-building,
  .companion-card {
    transition: none;
  }
}

@keyframes playerStrike {
  0%,
  100% {
    transform: translateX(0);
  }
  40%,
  56% {
    transform: translateX(42px);
  }
}

@keyframes enemyStrike {
  0%,
  100% {
    transform: translateX(0);
  }
  40%,
  56% {
    transform: translateX(-42px);
  }
}

@keyframes clashPulse {
  0%,
  100% {
    transform: scale(0.9);
  }
  44%,
  58% {
    transform: scale(1.22) rotate(8deg);
  }
}

/* Arena combat presentation */
.battle-stage {
  position: relative;
  display: block;
  min-height: 370px;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid rgba(255, 210, 112, 0.48);
  border-radius: 22px;
  background:
    radial-gradient(circle at 50% 24%, rgba(255, 221, 139, 0.3), transparent 30%),
    linear-gradient(180deg, rgba(5, 16, 20, 0.16) 0 57%, rgba(7, 19, 17, 0.82) 58%),
    linear-gradient(135deg, #22383a, #101b1d 58%, #291b17);
  box-shadow:
    inset 0 0 70px rgba(0, 0, 0, 0.62),
    0 14px 34px rgba(4, 12, 10, 0.34);
}

.battle-stage::before {
  content: "";
  position: absolute;
  z-index: -2;
  inset: 38% 0 auto;
  height: 80px;
  opacity: 0.54;
  background:
    radial-gradient(ellipse at 8% 80%, #0a1211 0 30px, transparent 32px),
    radial-gradient(ellipse at 20% 76%, #0a1211 0 38px, transparent 40px),
    radial-gradient(ellipse at 34% 84%, #0a1211 0 34px, transparent 36px),
    radial-gradient(ellipse at 66% 80%, #0a1211 0 37px, transparent 39px),
    radial-gradient(ellipse at 81% 75%, #0a1211 0 42px, transparent 44px),
    radial-gradient(ellipse at 94% 82%, #0a1211 0 32px, transparent 34px);
}

.battle-stage::after {
  content: "";
  position: absolute;
  z-index: -1;
  right: -8%;
  bottom: -36px;
  left: -8%;
  height: 180px;
  border-radius: 50% 50% 0 0;
  background:
    repeating-radial-gradient(ellipse at center, transparent 0 22px, rgba(255, 213, 118, 0.06) 23px 25px),
    radial-gradient(ellipse at center, #5c4831 0, #2b2920 48%, #101a17 78%);
  box-shadow: inset 0 24px 30px rgba(0, 0, 0, 0.36);
}

.battle-stage__glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 7% 44%, rgba(255, 174, 75, 0.72) 0 3px, transparent 5px),
    radial-gradient(circle at 93% 44%, rgba(255, 174, 75, 0.72) 0 3px, transparent 5px);
  filter: drop-shadow(0 0 12px #ff9d3c);
}

.arena-model-viewer {
  position: absolute;
  z-index: 3;
  inset: 62px 0 0;
  display: grid;
  min-width: 0;
  min-height: 0;
  place-items: center;
  color: rgba(255, 232, 169, 0.72);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  pointer-events: none;
  text-shadow: 0 2px 6px #000;
}

.arena-model-viewer canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.arena-model-viewer.is-unavailable {
  display: none;
}

.battle-stage.arena-3d-ready .battle-field .fighter {
  visibility: hidden;
  opacity: 0;
}

.battle-stage.arena-3d-ready .impact {
  z-index: 6;
}

.battle-hud {
  position: relative;
  z-index: 8;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  padding: 16px 18px;
  background: linear-gradient(180deg, rgba(6, 15, 15, 0.9), rgba(6, 15, 15, 0.28));
}

.combatant-status {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: #fff4d0;
  text-shadow: 0 2px 3px #000;
}

.combatant-status--enemy {
  text-align: right;
}

.combatant-status strong {
  overflow: hidden;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(0.78rem, 2vw, 1rem);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.battle-health {
  height: 13px;
  overflow: hidden;
  border: 2px solid rgba(255, 229, 159, 0.54);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.62);
  box-shadow: inset 0 1px 4px #000;
}

.battle-health span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #4b9d40, #9de258 72%, #dcf895);
  box-shadow: 0 0 10px rgba(151, 236, 91, 0.7);
  transition: width 420ms ease;
}

.combatant-status--enemy .battle-health span {
  margin-left: auto;
  background: linear-gradient(90deg, #f19a4a, #c84535 70%, #7b1b26);
  box-shadow: 0 0 10px rgba(238, 87, 55, 0.6);
}

.battle-announcement {
  align-self: center;
  min-width: 108px;
  padding: 6px 12px;
  border: 1px solid rgba(255, 218, 128, 0.5);
  border-radius: 999px;
  color: #ffe59a;
  background: rgba(50, 29, 18, 0.82);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-align: center;
  text-transform: uppercase;
  box-shadow: 0 0 18px rgba(255, 186, 71, 0.14);
}

.battle-field {
  position: absolute;
  z-index: 4;
  right: 4%;
  bottom: 30px;
  left: 4%;
  display: grid;
  grid-template-columns: 1fr 76px 1fr;
  align-items: end;
}

.fighter {
  position: relative;
  width: 150px;
  height: 220px;
  justify-self: center;
  filter: drop-shadow(0 10px 10px rgba(0, 0, 0, 0.48));
  transform-origin: 50% 92%;
  transition: transform 360ms cubic-bezier(0.2, 0.8, 0.2, 1), filter 240ms ease;
}

.fighter span,
.fighter i {
  position: absolute;
  display: block;
}

.fighter-shadow {
  right: 8px;
  bottom: 0;
  left: 8px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.54);
  filter: blur(4px);
}

.hero-cape {
  top: 66px;
  left: 30px;
  width: 73px;
  height: 119px;
  clip-path: polygon(27% 0, 88% 7%, 100% 100%, 8% 88%);
  background: linear-gradient(100deg, #37164c, #792e83 56%, #bc6bc2);
  box-shadow: inset -12px 0 18px rgba(255, 255, 255, 0.12);
}

.hero-body {
  top: 68px;
  left: 43px;
  width: 68px;
  height: 94px;
  clip-path: polygon(20% 0, 82% 0, 100% 28%, 82% 100%, 18% 100%, 0 28%);
  border: 2px solid #edd28b;
  background:
    linear-gradient(90deg, transparent 45%, rgba(255, 231, 164, 0.6) 47% 52%, transparent 54%),
    linear-gradient(135deg, #315c6b, #193441 48%, #0d1d25);
  box-shadow: inset 0 0 16px rgba(107, 221, 255, 0.26);
}

.hero-shoulder {
  top: 66px;
  left: 31px;
  width: 92px;
  height: 27px;
  border: 2px solid #f1cf77;
  border-radius: 50% 50% 32% 32%;
  background: linear-gradient(#d8b75f, #6f542b);
}

.hero-head {
  top: 18px;
  left: 53px;
  width: 55px;
  height: 61px;
  border: 3px solid #f2d382;
  border-radius: 50% 50% 42% 42%;
  background: linear-gradient(110deg, #d2b567, #7b6635 52%, #3b3020);
  box-shadow: inset 7px 0 8px rgba(255, 255, 255, 0.15);
}

.hero-head::before {
  content: "";
  position: absolute;
  top: -17px;
  left: 20px;
  width: 14px;
  height: 31px;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  background: #a65dc3;
}

.hero-visor {
  top: 25px;
  right: 4px;
  left: 4px;
  height: 14px;
  border: 1px solid #e6d391;
  background:
    repeating-linear-gradient(90deg, #171b1c 0 5px, #b49b54 6px 7px);
  box-shadow: 0 0 8px rgba(112, 230, 255, 0.4);
}

.hero-leg {
  top: 151px;
  width: 25px;
  height: 56px;
  border: 2px solid #d6b662;
  border-radius: 8px 8px 14px 14px;
  background: linear-gradient(90deg, #273f49, #101e25);
}

.hero-leg--back { left: 48px; transform: rotate(7deg); }
.hero-leg--front { left: 83px; transform: rotate(-8deg); }

.hero-shield {
  top: 88px;
  left: 13px;
  z-index: 3;
  width: 54px;
  height: 68px;
  border: 4px solid #cda94e;
  border-radius: 50% 50% 46% 46%;
  background:
    radial-gradient(circle, #f6db79 0 7px, transparent 8px),
    linear-gradient(135deg, #18484d 0 50%, #112a31 51%);
  box-shadow: inset 0 0 15px rgba(77, 227, 230, 0.26);
}

.hero-sword {
  top: 65px;
  right: 8px;
  z-index: 4;
  width: 12px;
  height: 91px;
  border-radius: 50% 50% 3px 3px;
  background: linear-gradient(90deg, #7f8e91, #f4ffff 48%, #879799 55%, #354347);
  box-shadow: 0 0 12px rgba(151, 238, 255, 0.55);
  transform: rotate(31deg);
  transform-origin: 50% 86%;
}

.hero-sword::before {
  content: "";
  position: absolute;
  right: -13px;
  bottom: 12px;
  width: 38px;
  height: 9px;
  border-radius: 4px;
  background: #d7ad45;
}

.hero-sword i {
  right: 2px;
  bottom: -19px;
  width: 8px;
  height: 25px;
  border-radius: 4px;
  background: #5c3324;
}

.enemy-tail {
  top: 108px;
  right: 3px;
  width: 78px;
  height: 24px;
  border: 8px solid #6a2533;
  border-bottom-color: transparent;
  border-left-color: transparent;
  border-radius: 50%;
  transform: rotate(24deg);
}

.enemy-body {
  top: 72px;
  left: 30px;
  width: 94px;
  height: 108px;
  clip-path: polygon(16% 6%, 50% 0, 89% 12%, 100% 66%, 80% 100%, 18% 96%, 0 58%);
  background:
    radial-gradient(circle at 64% 28%, rgba(255, 122, 67, 0.42) 0 5px, transparent 6px),
    linear-gradient(115deg, #8f3b3f, #421d2a 56%, #1c1520);
  box-shadow: inset -12px 2px 18px rgba(0, 0, 0, 0.45);
}

.enemy-body::after {
  content: "";
  position: absolute;
  inset: 23px 20px;
  border: 2px solid rgba(250, 152, 72, 0.45);
  border-radius: 50%;
  box-shadow: 0 0 12px rgba(255, 91, 39, 0.4);
}

.enemy-head {
  top: 23px;
  left: 42px;
  z-index: 3;
  width: 72px;
  height: 70px;
  clip-path: polygon(12% 18%, 50% 0, 90% 18%, 100% 65%, 70% 100%, 28% 94%, 0 62%);
  background: linear-gradient(135deg, #71313c, #291824 62%, #110f15);
  box-shadow: inset 7px 3px 10px rgba(255, 126, 75, 0.2);
}

.enemy-head::after {
  content: "";
  position: absolute;
  right: 16px;
  bottom: 10px;
  width: 35px;
  height: 12px;
  clip-path: polygon(0 0, 100% 0, 83% 100%, 67% 32%, 48% 100%, 29% 30%, 12% 100%);
  background: #e9d9bd;
}

.enemy-horn {
  top: -22px;
  width: 25px;
  height: 36px;
  clip-path: polygon(0 100%, 100% 100%, 48% 0);
  background: linear-gradient(90deg, #523f34, #d0b98a);
}

.enemy-horn--left { left: 0; transform: rotate(-24deg); }
.enemy-horn--right { right: 0; transform: rotate(24deg); }

.enemy-eye {
  top: 27px;
  width: 9px;
  height: 6px;
  border-radius: 50%;
  background: #ffe74f;
  box-shadow: 0 0 9px #ff4b25;
}

.enemy-eye--left { left: 17px; }
.enemy-eye--right { right: 17px; }

.enemy-arm {
  top: 93px;
  z-index: 4;
  width: 29px;
  height: 83px;
  border-radius: 45% 45% 12px 12px;
  background: linear-gradient(90deg, #2a1721, #7c2f3a);
  transform-origin: top center;
}

.enemy-arm::after {
  content: "";
  position: absolute;
  right: -5px;
  bottom: -12px;
  width: 34px;
  height: 25px;
  clip-path: polygon(0 0, 100% 20%, 68% 43%, 100% 68%, 60% 70%, 80% 100%, 0 74%);
  background: #bdc4b1;
}

.enemy-arm--back { right: 10px; transform: rotate(-27deg); }
.enemy-arm--front { left: 17px; transform: rotate(29deg); }

.enemy-leg {
  top: 164px;
  width: 31px;
  height: 48px;
  border-radius: 10px 10px 16px 16px;
  background: linear-gradient(90deg, #261620, #692934);
}

.enemy-leg--back { left: 42px; transform: rotate(5deg); }
.enemy-leg--front { left: 84px; transform: rotate(-6deg); }

.impact {
  position: relative;
  align-self: center;
  display: grid;
  width: 76px;
  height: 76px;
  place-items: center;
  border: 0;
  color: #fff3c4;
  background: transparent;
  font-family: Georgia, "Times New Roman", serif;
  text-shadow: 0 2px 8px #000;
  transform: none;
}

.impact strong {
  z-index: 2;
  font-size: 1rem;
}

.impact-ring {
  inset: 9px;
  border: 1px solid rgba(255, 226, 140, 0.52);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(173, 69, 42, 0.65), rgba(17, 31, 29, 0.84) 70%);
  box-shadow: 0 0 18px rgba(255, 168, 59, 0.25);
}

.impact-slash {
  z-index: 3;
  top: 35px;
  left: -10px;
  width: 96px;
  height: 5px;
  opacity: 0;
  border-radius: 50%;
  background: #fff7ce;
  box-shadow: 0 0 8px #ffb73f, 0 0 18px #ff552f;
}

.impact-slash--one { transform: rotate(35deg); }
.impact-slash--two { transform: rotate(-35deg); }

.battle-stage.battle-ready .player-fighter,
.battle-stage.battle-ready .enemy-fighter {
  animation: arenaReady 700ms ease-in-out infinite alternate;
}

.battle-stage.player-attacks .player-fighter {
  z-index: 5;
  animation: heroAttack 620ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.battle-stage.player-attacks .hero-sword {
  animation: heroSwordSwing 620ms ease-out both;
}

.battle-stage.player-attacks .enemy-fighter {
  animation: enemyRecoil 620ms ease-out both;
}

.battle-stage.enemy-attacks .enemy-fighter {
  z-index: 5;
  animation: monsterAttack 620ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.battle-stage.enemy-attacks .enemy-arm--front {
  animation: monsterClaw 620ms ease-out both;
}

.battle-stage.enemy-attacks .player-fighter {
  animation: heroRecoil 620ms ease-out both;
}

.battle-stage.final-clash .player-fighter {
  z-index: 5;
  animation: heroFinalClash 820ms ease-in-out both;
}

.battle-stage.final-clash .enemy-fighter {
  z-index: 5;
  animation: monsterFinalClash 820ms ease-in-out both;
}

.battle-stage.player-attacks .impact-slash--one,
.battle-stage.enemy-attacks .impact-slash--two,
.battle-stage.final-clash .impact-slash {
  animation: arenaSlash 520ms ease-out both;
}

.battle-stage.final-clash .impact-ring {
  animation: arenaImpact 820ms ease-out both;
}

.battle-stage.player-win .enemy-fighter {
  animation: monsterDefeated 700ms ease-out both;
}

.battle-stage.player-win .player-fighter {
  animation: heroVictory 850ms ease-in-out infinite alternate;
}

.battle-stage.enemy-win .player-fighter {
  animation: heroDefeated 700ms ease-out both;
}

.battle-stage.enemy-win .enemy-fighter {
  animation: monsterVictory 850ms ease-in-out infinite alternate;
}

.battle-stage.is-boss .enemy-fighter {
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 15px rgba(255, 67, 37, 0.42));
  scale: 1.12;
}

.battle-stage.player-win .battle-announcement {
  color: #e9ffbd;
  border-color: #8dd55a;
  background: rgba(31, 80, 43, 0.86);
}

.battle-stage.enemy-win .battle-announcement {
  color: #ffe1d7;
  border-color: #d55b47;
  background: rgba(95, 30, 29, 0.88);
}

@keyframes arenaReady {
  from { transform: translateY(0); }
  to { transform: translateY(-4px); }
}

@keyframes heroAttack {
  0% { transform: translateX(0) rotate(0); }
  28% { transform: translateX(-18px) rotate(-4deg); }
  62% { transform: translateX(78px) rotate(5deg); }
  78% { transform: translateX(66px) rotate(1deg); }
  100% { transform: translateX(0) rotate(0); }
}

@keyframes heroSwordSwing {
  0%, 28% { transform: rotate(31deg); }
  65% { transform: rotate(118deg); }
  100% { transform: rotate(31deg); }
}

@keyframes enemyRecoil {
  0%, 55% { transform: translateX(0) rotate(0); filter: brightness(1); }
  66% { transform: translateX(13px) rotate(7deg); filter: brightness(2); }
  100% { transform: translateX(0) rotate(0); filter: brightness(1); }
}

@keyframes monsterAttack {
  0% { transform: translateX(0) rotate(0); }
  28% { transform: translateX(18px) rotate(4deg); }
  62% { transform: translateX(-78px) rotate(-5deg); }
  78% { transform: translateX(-66px) rotate(-1deg); }
  100% { transform: translateX(0) rotate(0); }
}

@keyframes monsterClaw {
  0%, 30% { transform: rotate(29deg); }
  62% { transform: rotate(-65deg); }
  100% { transform: rotate(29deg); }
}

@keyframes heroRecoil {
  0%, 55% { transform: translateX(0) rotate(0); filter: brightness(1); }
  66% { transform: translateX(-13px) rotate(-7deg); filter: brightness(2); }
  100% { transform: translateX(0) rotate(0); filter: brightness(1); }
}

@keyframes heroFinalClash {
  0%, 100% { transform: translateX(0); }
  42%, 68% { transform: translateX(70px) rotate(4deg); }
}

@keyframes monsterFinalClash {
  0%, 100% { transform: translateX(0); }
  42%, 68% { transform: translateX(-70px) rotate(-4deg); }
}

@keyframes arenaSlash {
  0% { opacity: 0; scale: 0.3; }
  35% { opacity: 1; scale: 1; }
  100% { opacity: 0; scale: 1.35; }
}

@keyframes arenaImpact {
  0%, 28% { transform: scale(0.6); opacity: 0.4; }
  48% { transform: scale(1.6); opacity: 1; box-shadow: 0 0 42px #ff9b35; }
  100% { transform: scale(1); opacity: 0.75; }
}

@keyframes monsterDefeated {
  0% { transform: translate(0, 0) rotate(0); opacity: 1; }
  55% { transform: translate(18px, 10px) rotate(15deg); opacity: 1; }
  100% { transform: translate(28px, 45px) rotate(74deg); opacity: 0.48; }
}

@keyframes heroDefeated {
  0% { transform: translate(0, 0) rotate(0); opacity: 1; }
  55% { transform: translate(-18px, 10px) rotate(-15deg); opacity: 1; }
  100% { transform: translate(-28px, 45px) rotate(-70deg); opacity: 0.48; }
}

@keyframes heroVictory {
  from { transform: translateY(0); filter: brightness(1); }
  to { transform: translateY(-7px); filter: brightness(1.3) drop-shadow(0 0 15px rgba(255, 225, 116, 0.65)); }
}

@keyframes monsterVictory {
  from { transform: translateY(0) scale(1); }
  to { transform: translateY(-7px) scale(1.04); filter: drop-shadow(0 0 16px rgba(255, 68, 43, 0.7)); }
}

@media (max-width: 600px) {
  .battle-stage {
    min-height: 320px;
  }

  .battle-hud {
    gap: 6px;
    padding: 12px 10px;
  }

  .battle-announcement {
    min-width: 76px;
    padding-inline: 7px;
    font-size: 0.58rem;
  }

  .battle-field {
    right: -2%;
    bottom: 18px;
    left: -2%;
    grid-template-columns: 1fr 50px 1fr;
  }

  .fighter {
    scale: 0.76;
  }

  .impact {
    width: 50px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .battle-stage .fighter,
  .battle-stage .hero-sword,
  .battle-stage .enemy-arm,
  .battle-stage .impact-ring,
  .battle-stage .impact-slash {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* Final phone cascade guard for the legacy responsive blocks above. */
@media (max-width: 768px) {
  html,
  body,
  .app-shell,
  .fantasy-dashboard,
  .layout,
  .layout > .panel {
    max-width: 100%;
    overflow-x: hidden;
  }

  .app-shell,
  .fantasy-dashboard {
    width: 100%;
    padding: 10px 10px calc(92px + env(safe-area-inset-bottom, 0px));
  }

  .fantasy-dashboard .topbar,
  .fantasy-dashboard .layout,
  .layout {
    grid-template-columns: 1fr;
  }

  .dashboard-nav {
    display: none;
  }

  .bottom-action-bar {
    right: 8px;
    bottom: max(8px, env(safe-area-inset-bottom, 0px));
    left: 8px;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    max-height: none;
    overflow: visible;
  }

  .bottom-action-bar button {
    min-width: 0;
    min-height: 52px;
    padding: 0 4px;
    font-size: clamp(0.62rem, 2.7vw, 0.78rem);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .layout > .panel,
  .fantasy-dashboard .profile-panel,
  .dashboard-scene,
  .fantasy-dashboard .timer-panel,
  .fantasy-dashboard .story-panel,
  .fantasy-dashboard .quest-panel,
  .fantasy-dashboard .reward-panel,
  .fantasy-dashboard .map-panel,
  .fantasy-dashboard .battle-panel {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    grid-column: auto;
  }

  .hero-hall,
  .hero-hall__banner,
  .hero-hall__stage,
  .fantasy-dashboard .profile-panel .hero-hall,
  .fantasy-dashboard .profile-panel .hero-hall__banner,
  .fantasy-dashboard .profile-panel .hero-hall__stage {
    grid-template-columns: 1fr;
    max-width: 100%;
    min-width: 0;
  }

  .hero-hall__banner { order: 1; }
  .hero-hall__summary { order: 2; }
  .hero-hall__stage { order: 3; }
  .hero-hall__companions { order: 4; }
  .hero-hall__controls { order: 5; }
  .hero-hall__pedestal { order: 1; }
  .hero-hall__stats--left { order: 2; }
  .hero-hall__equipment { order: 3; }
  .hero-hall__stats--right { order: 4; }

  .hero-hall__resources,
  .hero-hall__stats,
  .equipment-slots,
  .fantasy-dashboard .profile-panel .hero-hall__resources,
  .fantasy-dashboard .profile-panel .hero-hall__stats,
  .fantasy-dashboard .profile-panel .equipment-slots {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .companion-collection,
  .fantasy-dashboard .profile-panel .companion-collection {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-flow: row;
    grid-auto-columns: auto;
    overflow: visible;
    scroll-snap-type: none;
  }

  .auth-session {
    right: 8px;
    left: 8px;
    max-width: calc(100vw - 16px);
  }
}

@media (max-width: 480px) {
  .app-shell,
  .fantasy-dashboard {
    padding-inline: 8px;
  }

  .hero-hall__resources,
  .hero-hall__stats,
  .equipment-slots,
  .fantasy-dashboard .profile-panel .hero-hall__resources,
  .fantasy-dashboard .profile-panel .hero-hall__stats,
  .fantasy-dashboard .profile-panel .equipment-slots {
    grid-template-columns: 1fr;
  }

  .companion-collection,
  .fantasy-dashboard .profile-panel .companion-collection {
    grid-template-columns: 1fr;
  }

  .bottom-action-bar {
    right: 6px;
    left: 6px;
    gap: 3px;
    padding: 6px;
  }

  .bottom-action-bar button {
    min-height: 50px;
    font-size: 0.62rem;
  }
}

/* Hall of Heroes leaderboard */
.bottom-action-bar {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.fantasy-dashboard .leaderboard-panel {
  grid-column: 2 / -1;
  min-height: 720px;
  padding: clamp(18px, 3vw, 34px);
  overflow: hidden;
  color: #fff4cf;
  background:
    radial-gradient(circle at 50% -8%, rgba(255, 218, 112, 0.25), transparent 34%),
    radial-gradient(circle at 8% 35%, rgba(61, 199, 218, 0.15), transparent 24%),
    linear-gradient(150deg, rgba(25, 50, 45, 0.98), rgba(16, 29, 26, 0.99) 48%, rgba(42, 25, 19, 0.98));
}

.leaderboard-banner {
  display: flex;
  gap: 24px;
  align-items: center;
  justify-content: space-between;
  padding: clamp(18px, 3vw, 30px);
  border: 1px solid rgba(255, 220, 126, 0.42);
  border-radius: 22px;
  background:
    linear-gradient(120deg, rgba(255, 221, 126, 0.14), transparent 42%),
    rgba(9, 28, 23, 0.82);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 18px 40px rgba(0, 0, 0, 0.22);
}

.leaderboard-banner .eyebrow,
.leaderboard-banner h2 {
  color: #ffe69b;
}

.leaderboard-banner h2 {
  margin: 4px 0 6px;
  font-size: clamp(1.7rem, 4vw, 3rem);
}

.leaderboard-banner p:last-child {
  margin: 0;
  color: rgba(255, 248, 222, 0.76);
}

.leaderboard-summary {
  display: flex;
  gap: 8px;
  flex-direction: column;
  margin: 18px 0 12px;
  padding: 14px 18px;
  border-left: 4px solid #e1b953;
  background: rgba(10, 27, 23, 0.72);
}

.leaderboard-summary strong { color: #ffe69b; }
.leaderboard-summary span { color: rgba(255, 248, 222, 0.68); font-size: 0.8rem; }

.leaderboard-list {
  display: grid;
  gap: 10px;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 86px minmax(150px, 1fr) minmax(440px, 1.8fr);
  gap: 14px;
  align-items: center;
  padding: 13px 16px;
  border: 1px solid rgba(213, 174, 80, 0.28);
  border-radius: 16px;
  background: linear-gradient(90deg, rgba(55, 40, 25, 0.88), rgba(16, 37, 31, 0.9));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

.leaderboard-row:nth-child(-n + 3) {
  border-color: rgba(255, 220, 119, 0.55);
  background: linear-gradient(90deg, rgba(92, 62, 27, 0.92), rgba(18, 48, 39, 0.92));
}

.leaderboard-row.is-current-player {
  outline: 2px solid rgba(93, 221, 239, 0.82);
  outline-offset: -2px;
  box-shadow: 0 0 26px rgba(67, 201, 222, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.leaderboard-rank {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 58px;
  border-right: 1px solid rgba(255, 226, 142, 0.2);
}

.leaderboard-rank span {
  color: #d7bd77;
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.leaderboard-rank strong {
  color: #fff0b5;
  font-size: 1.35rem;
}

.leaderboard-player { min-width: 0; }
.leaderboard-player strong { display: block; overflow-wrap: anywhere; color: #fff7db; font-size: 1rem; }
.leaderboard-player span { color: rgba(196, 235, 226, 0.7); font-size: 0.74rem; }

.leaderboard-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(64px, 1fr));
  gap: 8px;
  margin: 0;
}

.leaderboard-stats div {
  padding: 8px;
  border: 1px solid rgba(255, 226, 142, 0.16);
  border-radius: 10px;
  text-align: center;
  background: rgba(5, 21, 18, 0.5);
}

.leaderboard-stats dt { color: rgba(255, 243, 205, 0.62); font-size: 0.6rem; font-weight: 900; text-transform: uppercase; }
.leaderboard-stats dd { margin: 2px 0 0; color: #ffe58f; font-size: 0.94rem; font-weight: 900; }

.leaderboard-loading,
.leaderboard-empty {
  padding: 36px 20px;
  border: 1px dashed rgba(255, 222, 133, 0.35);
  border-radius: 16px;
  color: rgba(255, 246, 216, 0.78);
  text-align: center;
  background: rgba(8, 24, 20, 0.52);
}

@media (max-width: 900px) {
  .leaderboard-row {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .leaderboard-stats {
    grid-column: 1 / -1;
  }
}

@media (max-width: 768px) {
  .bottom-action-bar { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .fantasy-dashboard .leaderboard-panel { grid-column: auto; padding: 14px; }
  .leaderboard-banner { align-items: stretch; flex-direction: column; }
}

@media (max-width: 520px) {
  .leaderboard-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .leaderboard-row { padding-inline: 10px; }
  .leaderboard-rank { min-height: 48px; }
}

/* ReadRift Academy */
.fantasy-dashboard .academy-panel {
  grid-column: 2 / -1;
  min-height: 720px;
  padding: clamp(18px, 3vw, 34px);
  color: #fff4cf;
  background:
    radial-gradient(circle at 88% 5%, rgba(119, 226, 235, 0.2), transparent 30%),
    radial-gradient(circle at 12% 12%, rgba(255, 220, 116, 0.18), transparent 28%),
    linear-gradient(145deg, #173d38, #102823 48%, #33231a);
}

.academy-banner {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  padding: clamp(20px, 3vw, 34px);
  border: 1px solid rgba(255, 222, 133, 0.42);
  border-radius: 24px;
  background: linear-gradient(120deg, rgba(255, 226, 140, 0.13), rgba(8, 34, 29, 0.78));
  box-shadow: 0 20px 42px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.academy-banner h2 { margin: 4px 0 8px; color: #ffe69b; font-size: clamp(1.7rem, 4vw, 3rem); }
.academy-banner p:last-child { max-width: 760px; margin: 0; color: rgba(255, 248, 222, 0.74); }

.academy-banner__crest {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 88px;
  height: 102px;
  border: 3px double rgba(255, 232, 154, 0.75);
  border-radius: 44px 44px 22px 22px;
  color: #fff0ad;
  background: radial-gradient(circle, #32796e, #173c38 60%, #5b3c1f 61%);
  font-family: Georgia, serif;
  font-size: 2.4rem;
  font-weight: 900;
  box-shadow: 0 0 28px rgba(90, 218, 226, 0.2);
}

.academy-status {
  margin: 16px 0;
  padding: 12px 16px;
  border-left: 4px solid #61cbd1;
  color: #dffbfa;
  background: rgba(5, 25, 21, 0.64);
}

.academy-content { display: grid; gap: 14px; }

.academy-onboarding,
.academy-card {
  padding: clamp(18px, 3vw, 30px);
  border: 1px solid rgba(255, 222, 133, 0.34);
  border-radius: 20px;
  background: rgba(8, 29, 25, 0.78);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.academy-onboarding { max-width: 760px; margin: 20px auto; }
.academy-onboarding h3, .academy-card h3 { margin: 4px 0 8px; color: #ffe69b; font-size: 1.5rem; }
.academy-onboarding > p:not(.eyebrow), .academy-card__header p { color: rgba(255, 248, 222, 0.72); }
.academy-onboarding form, .academy-switch form { display: grid; gap: 12px; margin-top: 18px; }
.academy-onboarding .field span, .academy-switch .field span { color: #ffe9a8; }

.academy-card__header {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  justify-content: space-between;
}

.academy-invite {
  display: grid;
  gap: 5px;
  min-width: 220px;
  padding: 13px;
  border: 1px solid rgba(98, 213, 220, 0.42);
  border-radius: 14px;
  text-align: center;
  background: rgba(11, 48, 43, 0.72);
}

.academy-invite span { color: rgba(222, 255, 250, 0.66); font-size: 0.68rem; font-weight: 900; text-transform: uppercase; }
.academy-invite strong { color: #fff0a9; font-family: ui-monospace, monospace; font-size: 1.3rem; letter-spacing: 0.1em; }

.academy-mission {
  display: flex;
  gap: 6px;
  flex-direction: column;
  margin: 18px 0 12px;
  padding: 12px 15px;
  border-left: 3px solid #e1b953;
  background: rgba(52, 38, 22, 0.58);
}

.academy-mission strong { color: #ffe69b; }
.academy-mission span { color: rgba(255, 248, 222, 0.7); font-size: 0.78rem; }

.academy-roster { display: grid; gap: 9px; }

.academy-scholar {
  display: grid;
  grid-template-columns: 70px minmax(150px, 1fr) minmax(340px, 1.6fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(255, 226, 142, 0.22);
  border-radius: 14px;
  background: linear-gradient(90deg, rgba(64, 44, 24, 0.72), rgba(12, 43, 37, 0.74));
}

.academy-scholar__rank { text-align: center; }
.academy-scholar__rank span { display: block; color: #cbb675; font-size: 0.58rem; font-weight: 900; text-transform: uppercase; }
.academy-scholar__rank strong, .academy-scholar__name strong { color: #fff0ae; }
.academy-scholar__name span { display: block; color: rgba(213, 246, 239, 0.65); font-size: 0.72rem; }
.academy-scholar dl { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin: 0; }
.academy-scholar dl div { padding: 7px; border-radius: 9px; text-align: center; background: rgba(4, 23, 19, 0.58); }
.academy-scholar dt { color: rgba(255, 244, 210, 0.58); font-size: 0.56rem; font-weight: 900; text-transform: uppercase; }
.academy-scholar dd { margin: 2px 0 0; color: #ffe58f; font-weight: 900; }

.academy-empty {
  padding: 30px 18px;
  border: 1px dashed rgba(255, 224, 135, 0.34);
  border-radius: 14px;
  color: rgba(255, 248, 222, 0.72);
  text-align: center;
  background: rgba(5, 25, 21, 0.5);
}

.academy-switch { margin-top: 18px; color: #ffe6a1; }

@media (max-width: 820px) {
  .fantasy-dashboard .academy-panel { grid-column: auto; padding: 14px; }
  .academy-card__header, .academy-banner { align-items: stretch; flex-direction: column; }
  .academy-banner__crest { width: 62px; height: 72px; font-size: 1.8rem; }
  .academy-scholar { grid-template-columns: 62px 1fr; }
  .academy-scholar dl { grid-column: 1 / -1; }
}

@media (max-width: 480px) {
  .academy-scholar dl { grid-template-columns: repeat(2, 1fr); }
  .academy-invite { min-width: 0; }
}

/* Clickable ReadRift overworld */
.overworld-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 226, 140, 0.3);
  border-radius: 14px;
  background: linear-gradient(90deg, rgba(72, 48, 24, 0.9), rgba(10, 43, 36, 0.9));
  color: rgba(255, 248, 222, 0.76);
}

.overworld-hud > div {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #ffecaa;
}

.overworld-hud__icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255, 237, 163, 0.62);
  border-radius: 50%;
  background: radial-gradient(circle, #fff4a8 0 14%, #c88b29 18% 52%, #4b2712 56%);
  box-shadow: 0 0 18px rgba(255, 214, 91, 0.34);
}

.overworld-hud p { margin: 0; font-size: 0.78rem; }

.overworld-hud__progress {
  display: grid;
  gap: 3px;
  text-align: right;
}

.overworld-hud__progress p:last-child {
  color: #ffe69a;
  font-weight: 800;
}

.book-completion-check {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin: -8px 0 14px;
  padding: 12px 14px;
  border: 1px solid rgba(216, 163, 64, 0.34);
  border-radius: 14px;
  background: linear-gradient(90deg, rgba(82, 54, 34, 0.9), rgba(13, 48, 41, 0.9));
  color: #ffedaf;
  cursor: pointer;
}

.book-completion-check input {
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: #d9ad45;
}

.book-completion-check span { display: grid; gap: 3px; }
.book-completion-check strong { color: #fff0ae; }
.book-completion-check small { color: rgba(222, 247, 239, 0.7); line-height: 1.35; }

.overworld-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(270px, 0.72fr);
  gap: 14px;
  align-items: stretch;
}

.world-map.overworld-map {
  position: relative;
  display: block;
  min-height: 610px;
  overflow: hidden;
  padding: 0;
  border: 2px solid rgba(114, 74, 35, 0.92);
  border-radius: 18px;
  background:
    radial-gradient(ellipse at 73% 75%, rgba(70, 153, 174, 0.8) 0 13%, transparent 14%),
    radial-gradient(ellipse at 30% 28%, rgba(110, 156, 84, 0.72) 0 24%, transparent 25%),
    radial-gradient(ellipse at 55% 57%, rgba(120, 158, 91, 0.66) 0 33%, transparent 34%),
    linear-gradient(145deg, #b49358, #d1b875 48%, #927240);
  box-shadow:
    inset 0 0 0 7px rgba(255, 233, 167, 0.18),
    inset 0 0 52px rgba(49, 27, 12, 0.55),
    0 18px 40px rgba(3, 16, 13, 0.34);
  isolation: isolate;
}

.world-map.overworld-map::before {
  inset: 0;
  z-index: -1;
  background:
    repeating-radial-gradient(ellipse at 35% 40%, transparent 0 18px, rgba(69, 43, 19, 0.055) 19px 20px),
    linear-gradient(112deg, transparent 0 47%, rgba(255, 245, 190, 0.13) 48% 49%, transparent 50%);
  opacity: 1;
}

.world-map.overworld-map::after {
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(circle at 50% 50%, transparent 0 48%, rgba(42, 24, 11, 0.24) 100%),
    repeating-linear-gradient(3deg, transparent 0 29px, rgba(74, 45, 20, 0.035) 30px 31px);
}

.overworld-routes {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.overworld-route {
  fill: none;
  stroke: rgba(61, 41, 22, 0.28);
  stroke-width: 1.1;
  stroke-dasharray: 2.2 2.2;
  vector-effect: non-scaling-stroke;
}

.overworld-route.is-revealed {
  stroke: rgba(82, 46, 17, 0.78);
  stroke-width: 2.4;
  stroke-dasharray: 5 3;
  filter: drop-shadow(0 1px 0 rgba(255, 237, 176, 0.6));
}

.overworld-landmarks {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  color: rgba(51, 70, 39, 0.48);
  font-family: Georgia, serif;
}

.map-mountains { position: absolute; top: 8%; left: 17%; color: rgba(80, 64, 48, 0.52); font-size: 1.35rem; transform: rotate(-8deg); }
.map-woods { position: absolute; bottom: 11%; left: 25%; letter-spacing: 0.18em; font-size: 1.2rem; }
.map-waves { position: absolute; right: 7%; bottom: 8%; color: rgba(38, 104, 120, 0.48); font-size: 1.8rem; transform: rotate(-5deg); }
.map-compass { position: absolute; right: 4%; top: 5%; display: grid; place-items: center; width: 54px; height: 54px; border: 1px solid rgba(71, 43, 19, 0.5); border-radius: 50%; color: rgba(77, 42, 16, 0.72); font-size: 1.7rem; }
.map-compass small { position: absolute; top: -14px; font-size: 0.58rem; font-weight: 900; }

.overworld-node {
  position: absolute;
  left: var(--node-x);
  top: var(--node-y);
  z-index: 4;
  display: grid;
  justify-items: center;
  gap: 2px;
  width: 116px;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #432815;
  text-align: center;
  text-shadow: 0 1px rgba(255, 239, 183, 0.75);
  box-shadow: none;
  transform: translate(-50%, -50%);
}

.overworld-node:hover,
.overworld-node:focus-visible { transform: translate(-50%, -50%) scale(1.06); box-shadow: none; }

.overworld-node__sigil {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 3px double #6e3d18;
  border-radius: 50% 50% 44% 44%;
  background: radial-gradient(circle at 40% 30%, #fff0ad, #c49441 60%, #60401f);
  color: #3c2413;
  font-family: Georgia, serif;
  font-size: 1.45rem;
  box-shadow: 0 5px 10px rgba(55, 29, 11, 0.32);
}

.overworld-node strong {
  max-width: 100%;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(238, 214, 150, 0.82);
  font-family: Georgia, serif;
  font-size: 0.76rem;
  line-height: 1.1;
}

.overworld-node small { max-width: 110px; color: rgba(55, 35, 19, 0.78); font-size: 0.58rem; line-height: 1.1; }
.overworld-node.is-locked { filter: grayscale(0.85); opacity: 0.62; }
.overworld-node.is-locked .overworld-node__sigil { background: radial-gradient(circle, #9b927b, #554e42); color: #e7dcc1; }
.overworld-node.is-selected .overworld-node__sigil { outline: 3px solid rgba(255, 245, 172, 0.9); outline-offset: 3px; box-shadow: 0 0 24px rgba(255, 229, 122, 0.76), 0 7px 14px rgba(55, 29, 11, 0.36); }
.overworld-node.is-current strong::before { content: "Current · "; color: #176b58; }

.overworld-player {
  position: absolute;
  left: var(--map-x);
  top: var(--map-y);
  z-index: 8;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 3px solid #fff0a6;
  border-radius: 50%;
  background: #123d35;
  box-shadow: 0 0 0 3px rgba(71, 39, 15, 0.72), 0 0 22px rgba(255, 230, 128, 0.82);
  transform: translate(-50%, -125%);
  pointer-events: none;
}

.overworld-player::after {
  content: "";
  position: absolute;
  bottom: -11px;
  width: 0;
  height: 0;
  border-right: 8px solid transparent;
  border-left: 8px solid transparent;
  border-top: 11px solid #fff0a6;
}

.overworld-player img { width: 36px; height: 36px; object-fit: cover; object-position: center 25%; border-radius: 50%; }
.overworld-player.is-traveling { animation: overworldTravel 850ms cubic-bezier(0.2, 0.7, 0.2, 1) both; }

@keyframes overworldTravel {
  0% { left: var(--from-x); top: var(--from-y); transform: translate(-50%, -125%) scale(0.82); }
  45% { transform: translate(-50%, -155%) scale(1.08); }
  100% { left: var(--map-x); top: var(--map-y); transform: translate(-50%, -125%) scale(1); }
}

.destination-card {
  display: flex;
  gap: 14px;
  flex-direction: column;
  min-width: 0;
  padding: 18px;
  border: 1px solid rgba(255, 224, 133, 0.34);
  border-radius: 18px;
  background:
    linear-gradient(145deg, rgba(77, 47, 24, 0.92), rgba(9, 34, 29, 0.96));
  color: rgba(255, 248, 222, 0.76);
  box-shadow: inset 0 1px rgba(255, 247, 211, 0.12), 0 18px 36px rgba(3, 15, 13, 0.28);
}

.destination-card__heading { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: center; }
.destination-card__heading h3 { margin: 2px 0 0; color: #fff0ad; font-family: Georgia, serif; font-size: 1.28rem; }
.destination-card__sigil { display: grid; place-items: center; width: 52px; height: 58px; border: 2px solid rgba(255, 224, 128, 0.6); border-radius: 50% 50% 12px 12px; background: rgba(17, 70, 59, 0.72); color: #ffe58f; font-size: 1.55rem; }
.destination-card > p { min-height: 4.2em; line-height: 1.48; }

.destination-activities { display: flex; flex-wrap: wrap; gap: 6px; }
.destination-activities span { padding: 5px 8px; border: 1px solid rgba(119, 211, 203, 0.24); border-radius: 999px; background: rgba(8, 50, 43, 0.72); color: #bdebe2; font-size: 0.65rem; font-weight: 800; }

.region-quest { display: grid; gap: 7px; padding: 12px; border-left: 3px solid #d8a640; border-radius: 10px; background: rgba(8, 25, 21, 0.56); }
.region-quest > div:first-child { display: grid; }
.region-quest span { color: rgba(255, 244, 205, 0.66); font-size: 0.66rem; font-weight: 900; text-transform: uppercase; }
.region-quest strong { color: #ffeaa6; }
.region-quest small { color: rgba(215, 243, 235, 0.7); }
.region-quest__bar { height: 7px; overflow: hidden; border-radius: 999px; background: rgba(2, 14, 12, 0.75); }
.region-quest__bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #55c9b5, #ffe072); }
.region-quest.is-complete { border-left-color: #67d39c; }

.destination-travel { width: 100%; min-height: 46px; }
.destination-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.destination-actions button { min-width: 0; min-height: 38px; padding: 5px; border-color: rgba(255, 226, 140, 0.3); background: rgba(91, 59, 30, 0.7); color: #ffedb1; font-size: 0.65rem; }

.map-panel .map-footer,
.map-panel .map-log { border-color: rgba(255, 214, 103, 0.4); background: rgba(9, 35, 30, 0.86); color: rgba(231, 249, 241, 0.76); }
.map-panel .map-footer { padding: 12px 14px; border: 1px solid rgba(255, 214, 103, 0.24); border-radius: 14px; }
.map-panel .map-footer strong { color: #ffe9a0; }
.map-panel .map-log { border-left-color: #67cdb7; }

@media (max-width: 1080px) {
  .overworld-layout { grid-template-columns: 1fr; }
  .world-map.overworld-map { min-height: 560px; }
  .destination-card > p { min-height: 0; }
}

@media (max-width: 768px) {
  .bottom-action-bar { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .overworld-hud { align-items: flex-start; flex-direction: column; }
  .overworld-hud__progress { text-align: left; }
  .world-map.overworld-map { min-height: 520px; }
  .overworld-node { width: 92px; }
  .overworld-node__sigil { width: 40px; height: 40px; font-size: 1.12rem; }
  .overworld-node strong { font-size: 0.65rem; }
  .overworld-node small { display: none; }
  .overworld-player { width: 36px; height: 36px; }
  .overworld-player img { width: 29px; height: 29px; }
}

@media (max-width: 480px) {
  .world-map.overworld-map { min-height: 460px; }
  .overworld-node { width: 76px; }
  .overworld-node__sigil { width: 34px; height: 34px; border-width: 2px; }
  .overworld-node strong { max-width: 74px; padding-inline: 4px; font-size: 0.58rem; }
  .destination-actions { grid-template-columns: 1fr; }
  .map-compass { width: 40px; height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  .overworld-player.is-traveling { animation-duration: 1ms; }
}
