:root {
  color-scheme: dark;
  --ink: #091014;
  --ink-2: #0e181c;
  --ink-3: #142126;
  --panel: rgba(13, 24, 28, 0.88);
  --paper: #e8e3d2;
  --muted: #8c9c98;
  --dim: #536863;
  --line: rgba(211, 226, 216, 0.12);
  --line-strong: rgba(211, 226, 216, 0.23);
  --jade: #77d8c9;
  --jade-deep: #2f928c;
  --red: #e16455;
  --gold: #e4b85d;
  --violet: #ba8ac9;
  --shadow: rgba(0, 0, 0, 0.42);
  --header-height: 70px;
  --rail-width: 78px;
  font-family: "Baskerville", "Noto Serif SC", "Songti SC", serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--ink);
}

body {
  color: var(--paper);
  background:
    radial-gradient(circle at 78% 12%, rgba(90, 150, 145, 0.13), transparent 30rem),
    radial-gradient(circle at 20% 90%, rgba(90, 69, 55, 0.18), transparent 34rem),
    linear-gradient(145deg, #111c20 0%, #080d10 62%, #11181b 100%);
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
}

button,
select,
input[type="checkbox"] {
  cursor: pointer;
}

button:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 1px solid var(--jade);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

p,
h1,
h2,
h3 {
  margin-top: 0;
}

.hidden {
  display: none !important;
}

.auth-gate {
  position: fixed;
  z-index: 300;
  display: grid;
  inset: 0;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(circle at 50% 35%, rgba(119, 216, 201, 0.1), transparent 28rem),
    rgba(5, 11, 14, 0.9);
  backdrop-filter: blur(16px);
}

.auth-card {
  width: min(420px, 100%);
  padding: 34px;
  border: 1px solid rgba(119, 216, 201, 0.25);
  background: linear-gradient(145deg, rgba(20, 36, 40, 0.98), rgba(10, 19, 23, 0.98));
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.62);
  text-align: center;
}

.auth-seal {
  display: grid;
  width: 58px;
  height: 58px;
  margin: 0 auto 18px;
  place-items: center;
  border: 1px solid rgba(225, 100, 85, 0.65);
  color: #eea096;
  font-size: 27px;
  transform: rotate(-3deg);
}

.auth-card h2 {
  margin-bottom: 10px;
  font-size: 24px;
  font-weight: 400;
  letter-spacing: 0.08em;
}

.auth-copy {
  margin: 0 auto 22px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.auth-tabs button {
  padding: 10px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--dim);
  font-size: 12px;
}

.auth-tabs button.is-active {
  border-bottom-color: var(--jade);
  color: var(--paper);
}

.auth-card form {
  display: grid;
  gap: 13px;
  text-align: left;
}

.auth-card label {
  display: grid;
  gap: 6px;
}

.auth-card label span {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.12em;
}

.auth-card input {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  background: rgba(0, 0, 0, 0.18);
}

.auth-submit {
  width: 100%;
  min-height: 43px;
  margin-top: 3px;
}

.auth-error {
  margin: 0;
  color: #eea096;
  font-size: 11px;
  line-height: 1.5;
}

.auth-card > small {
  display: block;
  margin-top: 14px;
  color: var(--dim);
  font-size: 9px;
}

.atmosphere {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.atmosphere i {
  position: absolute;
  width: 46vw;
  height: 13rem;
  border-radius: 50%;
  opacity: 0.055;
  background: #b8e3dc;
  filter: blur(52px);
  animation: mist-drift 22s ease-in-out infinite alternate;
}

.atmosphere i:nth-child(1) {
  top: 12%;
  left: -14%;
}

.atmosphere i:nth-child(2) {
  right: -10%;
  bottom: 8%;
  animation-delay: -8s;
}

.atmosphere i:nth-child(3) {
  top: 44%;
  left: 36%;
  width: 24vw;
  opacity: 0.025;
  animation-delay: -14s;
}

@keyframes mist-drift {
  to { transform: translate3d(12vw, 18px, 0) scaleX(1.18); }
}

.paper-grain {
  position: fixed;
  inset: 0;
  z-index: 100;
  opacity: 0.025;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.78' numOctaves='4' stitchTiles='stitchTiles'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.9'/%3E%3C/svg%3E");
}

.game-shell {
  position: relative;
  z-index: 1;
  display: grid;
  width: 100vw;
  height: 100dvh;
  grid-template-columns: var(--rail-width) minmax(0, 1fr);
  grid-template-rows: var(--header-height) minmax(0, 1fr);
}

.topbar {
  grid-column: 1 / -1;
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(220px, 0.85fr) minmax(220px, 1fr) auto auto;
  align-items: center;
  gap: clamp(12px, 2vw, 30px);
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 13, 16, 0.78);
  backdrop-filter: blur(20px);
}

.brand-lockup {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.brand-seal {
  display: grid;
  width: 41px;
  height: 41px;
  flex: 0 0 41px;
  place-items: center;
  border: 1px solid rgba(225, 100, 85, 0.7);
  color: #eea096;
  font-size: 22px;
  transform: rotate(-3deg);
  box-shadow: inset 0 0 18px rgba(225, 100, 85, 0.1);
}

.eyebrow,
.section-kicker {
  margin: 0 0 4px;
  color: #6c8f89;
  font-family: "Avenir Next Condensed", "DIN Condensed", sans-serif;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.22em;
}

h1 {
  margin-bottom: 0;
  overflow: hidden;
  font-size: 19px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mission {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  padding-left: 18px;
  border-left: 1px solid var(--line);
}

.live-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: var(--jade);
  box-shadow: 0 0 0 5px rgba(119, 216, 201, 0.08), 0 0 14px rgba(119, 216, 201, 0.5);
  animation: live-pulse 2.4s infinite;
}

@keyframes live-pulse {
  50% { opacity: 0.45; }
}

.mission > div {
  min-width: 0;
}

.mission-label,
.footer-label {
  display: block;
  color: var(--dim);
  font-family: "Avenir Next Condensed", sans-serif;
  font-size: 10px;
  letter-spacing: 0.15em;
}

.mission strong {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resource-strip,
.account-strip {
  display: flex;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.018);
}

.resource-strip > div,
.account-strip > div {
  display: grid;
  min-width: 64px;
  gap: 2px;
  padding: 7px 10px;
  border-left: 1px solid var(--line);
}

.resource-strip > div {
  min-width: 72px;
  grid-template-columns: 24px minmax(0, auto);
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 6px;
  padding: 6px 8px;
}

.resource-icon {
  width: 24px;
  height: 24px;
  grid-row: 1 / 3;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.36));
}

.resource-strip > div > span,
.resource-strip > div > strong {
  grid-column: 2;
}

.resource-strip > div:first-child,
.account-strip > div:first-child {
  border-left: 0;
}

.resource-strip span,
.account-strip span {
  color: var(--dim);
  font: 9px "Avenir Next Condensed", sans-serif;
  letter-spacing: 0.12em;
}

.resource-strip strong,
.account-strip strong {
  color: #ccd9d2;
  font: 500 13px "Avenir Next", sans-serif;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.account-presence {
  position: relative;
  display: grid;
  width: 16px;
  height: 46px;
  flex: 0 0 16px;
  place-items: center;
}

.account-presence i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--jade);
  box-shadow: 0 0 0 4px rgba(119, 216, 201, 0.08), 0 0 12px rgba(119, 216, 201, 0.5);
}

.account-button {
  display: grid;
  min-width: 152px;
  max-width: 190px;
  height: 46px;
  grid-template-columns: 34px minmax(0, 1fr) 10px;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 4px 5px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.018);
  color: inherit;
  text-align: left;
  transition: 160ms ease;
}

.account-button:hover {
  border-color: rgba(119, 216, 201, 0.35);
  background: rgba(119, 216, 201, 0.045);
}

.account-avatar {
  position: relative;
  width: 34px;
  height: 34px;
  overflow: hidden;
  border: 1px solid rgba(225, 100, 85, 0.35);
  background: radial-gradient(circle at 50% 35%, rgba(225, 100, 85, 0.18), rgba(6, 13, 16, 0.8));
}

.account-avatar img {
  position: absolute;
  top: -4px;
  left: 50%;
  width: 58px;
  height: 78px;
  object-fit: contain;
  image-rendering: pixelated;
  transform: translateX(-50%);
}

.account-identity {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.account-identity small {
  color: var(--dim);
  font: 8px "Avenir Next Condensed", sans-serif;
  letter-spacing: 0.14em;
}

.account-identity strong {
  overflow: hidden;
  color: #d2ddd7;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-caret {
  color: var(--dim);
  font-size: 12px;
}

.version-lockup {
  display: grid;
  width: 54px;
  height: 46px;
  align-content: center;
  justify-items: center;
  gap: 2px;
  padding: 4px 5px;
  border: 1px solid rgba(119, 216, 201, 0.2);
  background: rgba(119, 216, 201, 0.025);
  white-space: nowrap;
}

.version-lockup small {
  color: #4e706a;
  font: 7px "Avenir Next Condensed", sans-serif;
  letter-spacing: 0.2em;
}

#version-badge {
  color: #7fa8a0;
  font: 500 10px "Avenir Next", sans-serif;
  letter-spacing: 0.04em;
}

.restart-button,
.primary-button,
.ghost-button {
  min-height: 34px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.025);
  font-size: 11px;
  letter-spacing: 0.1em;
  transition: 160ms ease;
}

.restart-button,
.primary-button {
  padding: 0 15px;
}

.restart-button {
  border-color: rgba(225, 100, 85, 0.44);
  background: rgba(225, 100, 85, 0.08);
}

.primary-button {
  border-color: rgba(119, 216, 201, 0.34);
  background: rgba(119, 216, 201, 0.08);
}

.restart-button:hover,
.primary-button:hover {
  border-color: rgba(232, 227, 210, 0.52);
  background: rgba(255, 255, 255, 0.06);
  transform: translateY(-1px);
}

.nav-rail {
  display: flex;
  min-height: 0;
  flex-direction: column;
  align-items: stretch;
  gap: 3px;
  padding: 12px 8px;
  border-right: 1px solid var(--line);
  background: rgba(7, 13, 16, 0.68);
}

.nav-button {
  position: relative;
  display: grid;
  height: 61px;
  place-items: center;
  align-content: center;
  gap: 4px;
  border: 1px solid transparent;
  background: transparent;
  color: #657a76;
  transition: 170ms ease;
}

.nav-button::before {
  position: absolute;
  top: 16%;
  bottom: 16%;
  left: -9px;
  width: 2px;
  background: transparent;
  content: "";
}

.nav-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.35;
}

.nav-button span {
  font-size: 10px;
  letter-spacing: 0.14em;
}

.nav-button:hover {
  color: #a8beb8;
  background: rgba(255, 255, 255, 0.022);
}

.nav-button.is-active {
  border-color: rgba(119, 216, 201, 0.16);
  color: var(--jade);
  background: rgba(119, 216, 201, 0.055);
}

.nav-button.is-active::before {
  background: var(--jade);
  box-shadow: 0 0 10px rgba(119, 216, 201, 0.5);
}

.nav-button .nav-notification {
  position: absolute;
  top: 8px;
  right: 9px;
  width: 9px;
  height: 9px;
  border: 2px solid #111713;
  border-radius: 50%;
  background: #df5148;
  box-shadow: 0 0 0 1px rgba(255, 197, 177, 0.3), 0 0 10px rgba(223, 81, 72, 0.6);
}

.nav-button .nav-notification::after {
  position: absolute;
  inset: -4px;
  border: 1px solid rgba(223, 81, 72, 0.52);
  border-radius: inherit;
  animation: notification-ring 1.8s ease-out infinite;
  content: "";
}

@keyframes notification-ring {
  0%, 35% { opacity: 0.8; transform: scale(0.55); }
  80%, 100% { opacity: 0; transform: scale(1.35); }
}

.feedback-button {
  display: grid;
  margin-top: auto;
  place-items: center;
  align-content: center;
  gap: 4px;
  min-height: 48px;
  padding: 5px 0;
  border: 1px solid transparent;
  background: transparent;
  color: var(--dim);
  font: 9px "Avenir Next Condensed", sans-serif;
  letter-spacing: 0.14em;
  transition: 160ms ease;
}

.feedback-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.35;
}

.feedback-button:hover {
  color: var(--jade);
  background: rgba(119, 216, 201, 0.04);
}

.view-stack {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.app-view {
  position: absolute;
  inset: 0;
  min-width: 0;
  min-height: 0;
  visibility: hidden;
  overflow: hidden;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 180ms ease, transform 180ms ease, visibility 180ms;
}

.app-view.is-active {
  z-index: 1;
  visibility: visible;
  opacity: 1;
  transform: none;
}

.view-scroll {
  overflow-x: hidden;
  overflow-y: auto;
  padding: 22px clamp(18px, 2.5vw, 38px) 38px;
  scrollbar-color: rgba(119, 216, 201, 0.25) transparent;
  scrollbar-width: thin;
}

.view-heading {
  display: flex;
  max-width: 1540px;
  min-height: 56px;
  align-items: flex-end;
  justify-content: space-between;
  margin: 0 auto 15px;
  gap: 24px;
}

.view-heading h2,
.stage-heading h2 {
  margin: 0;
  font-size: clamp(19px, 2vw, 26px);
  font-weight: 400;
  letter-spacing: 0.12em;
}

.view-heading > p {
  max-width: 460px;
  margin: 0 0 4px;
  color: var(--dim);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-align: right;
}

.panel,
.stage-card,
.intel-panel {
  border: 1px solid var(--line);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.022), transparent 44%),
    var(--panel);
  box-shadow: 0 20px 46px rgba(0, 0, 0, 0.19);
}

.panel-heading {
  display: flex;
  min-height: 43px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 15px;
  border-bottom: 1px solid var(--line);
}

.panel-heading span {
  font-size: 12px;
  letter-spacing: 0.12em;
}

.panel-heading small {
  color: var(--dim);
  font-size: 9px;
  letter-spacing: 0.05em;
}

/* Battle */
.battle-layout {
  display: grid;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr) clamp(270px, 22vw, 340px);
  gap: 14px;
  padding: 14px;
}

.stage-card {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: 56px minmax(180px, 1fr) 50px clamp(160px, 23vh, 205px);
  overflow: hidden;
}

.stage-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 17px;
  border-bottom: 1px solid var(--line);
}

.stage-heading h2 {
  font-size: 18px;
}

.battle-meta {
  display: flex;
  height: 100%;
}

.battle-meta > div {
  display: grid;
  min-width: 92px;
  align-content: center;
  gap: 3px;
  padding-left: 15px;
  border-left: 1px solid var(--line);
}

.battle-meta span {
  color: var(--dim);
  font: 9px "Avenir Next Condensed", sans-serif;
  letter-spacing: 0.14em;
}

.battle-meta strong {
  color: #c8d6cf;
  font: 500 13px "Avenir Next", sans-serif;
}

.battlefield {
  position: relative;
  isolation: isolate;
  contain: layout paint;
  min-height: 0;
  overflow: hidden;
  background:
    linear-gradient(to bottom, rgba(5, 12, 16, 0.2), rgba(6, 14, 17, 0.74)),
    radial-gradient(ellipse at 66% 32%, rgba(111, 180, 177, 0.12), transparent 20%),
    linear-gradient(170deg, #14252a, #0a1418 68%);
}

.battlefield::before {
  position: absolute;
  right: -5%;
  bottom: 14%;
  left: -5%;
  height: 38%;
  opacity: 0.11;
  background: #a5beb2;
  clip-path: polygon(0 100%, 0 76%, 8% 67%, 15% 71%, 22% 38%, 31% 72%, 38% 54%, 47% 80%, 58% 61%, 66% 74%, 75% 42%, 83% 68%, 91% 54%, 100% 74%, 100% 100%);
  content: "";
}

.battlefield::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 34%;
  opacity: 0.15;
  background: repeating-linear-gradient(174deg, rgba(119, 216, 201, 0.22) 0 1px, transparent 1px 13px);
  content: "";
  mask-image: linear-gradient(to bottom, transparent, black);
}

.moon {
  position: absolute;
  top: 12%;
  right: 14%;
  width: clamp(62px, 7vw, 106px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(219, 224, 203, 0.1);
  box-shadow: 0 0 55px rgba(189, 218, 207, 0.08);
}

.torii {
  position: absolute;
  right: 6%;
  bottom: 25%;
  width: 150px;
  height: 100px;
  opacity: 0.15;
}

.torii i {
  position: absolute;
  display: block;
  background: #d8d8c5;
}

.torii i:nth-child(1) { top: 12px; left: 0; width: 100%; height: 6px; transform: skewX(-15deg); }
.torii i:nth-child(2) { top: 25px; left: 10%; width: 80%; height: 5px; }
.torii i:nth-child(3) { top: 10px; bottom: 0; left: 26%; width: 6px; }
.torii i:nth-child(4) { top: 10px; right: 26%; bottom: 0; width: 6px; }

.lake-line {
  position: absolute;
  right: 0;
  bottom: 20%;
  left: 0;
  border-top: 1px solid rgba(119, 216, 201, 0.12);
}

.formation-axis {
  position: absolute;
  z-index: 1;
  right: 6%;
  bottom: 7%;
  left: 6%;
  display: grid;
  grid-template-columns: auto 1fr auto 1fr auto;
  align-items: center;
  gap: 9px;
  color: rgba(194, 213, 204, 0.34);
  font: 8px "Avenir Next Condensed", sans-serif;
  letter-spacing: 0.18em;
}

.formation-axis i {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(119, 216, 201, 0.22), transparent);
}

.formation-axis strong {
  color: rgba(228, 184, 93, 0.48);
  font-size: 8px;
  font-weight: 400;
}

.wave-intermission {
  position: absolute;
  z-index: 12;
  inset: 0;
  display: grid;
  place-items: center end;
  padding-right: clamp(20px, 7vw, 92px);
  pointer-events: none;
}

.wave-continue-button {
  position: relative;
  width: 76px;
  height: 58px;
  padding: 0;
  border: 0;
  color: #f1cf73;
  background: transparent;
  filter: drop-shadow(0 3px 2px rgba(0, 0, 0, 0.72)) drop-shadow(0 0 10px rgba(221, 168, 75, 0.26));
  pointer-events: auto;
  animation: wave-arrow-arrive 260ms ease-out both;
}

.wave-continue-button::before {
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  opacity: 0.34;
  background: radial-gradient(circle, rgba(236, 192, 96, 0.24), transparent 68%);
  content: "";
  animation: wave-arrow-aura 1.4s ease-in-out infinite;
}

.wave-continue-button svg {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.wave-continue-button path {
  stroke-width: 3;
}

.wave-continue-button .arrow-head {
  stroke-width: 4;
  animation: wave-arrow-drift 1.2s ease-in-out infinite;
}

.wave-continue-button:hover,
.wave-continue-button:focus-visible {
  color: #ffe29a;
  transform: translateX(5px) scale(1.04);
}

.wave-continue-button:focus-visible {
  outline: 1px solid rgba(245, 211, 129, 0.76);
  outline-offset: 4px;
  border-radius: 50%;
}

.wave-intermission.is-transitioning .wave-continue-button {
  opacity: 0;
  transform: translateX(22px);
  pointer-events: none;
  transition: opacity 140ms ease, transform 180ms ease;
}

.battlefield.is-wave-advancing::after {
  opacity: 0.34;
  animation: battlefield-ground-retreat 260ms linear infinite;
}

.battlefield.is-wave-advancing .lake-line {
  animation: battlefield-lake-retreat 520ms linear infinite;
}

.battlefield.is-wave-advancing .formation-axis {
  opacity: 0;
  transition: opacity 140ms ease;
}

@keyframes wave-arrow-arrive {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes wave-arrow-aura {
  50% { opacity: 0.78; transform: scale(1.14); }
}

@keyframes wave-arrow-drift {
  0%, 100% { transform: translateX(-3px); }
  50% { transform: translateX(3px); }
}

@keyframes battlefield-ground-retreat {
  to { background-position: -180px 34px; }
}

@keyframes battlefield-lake-retreat {
  to { transform: translateX(-8%); }
}

.phaser-battlefield {
  position: absolute;
  z-index: 2;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

@media (max-width: 720px) {
  .wave-intermission {
    padding-right: 16px;
  }

  .wave-continue-button {
    width: 64px;
    height: 50px;
  }
}

.phaser-battlefield canvas {
  display: block;
  contain: strict;
  width: 100% !important;
  height: 100% !important;
  image-rendering: auto;
  opacity: 0;
  transition: opacity 280ms ease;
}

body[data-active-view="battle"] .view-stack {
  backdrop-filter: none;
}

body[data-active-view="battle"] .paper-grain {
  display: none;
}

.phaser-battlefield.is-ready canvas {
  opacity: 1;
}

.phaser-battlefield-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  width: min(320px, 74%);
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  color: rgba(202, 220, 211, 0.52);
  font: 9px "Avenir Next Condensed", sans-serif;
  letter-spacing: 0.18em;
  transform: translate(-50%, -50%);
}

.phaser-battlefield-loading i {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(119, 216, 201, 0.32));
}

.phaser-battlefield-loading i:last-child {
  transform: scaleX(-1);
}

.phaser-battlefield-loading span::before {
  display: inline-block;
  margin-right: 8px;
  color: var(--gold);
  content: "◇";
  animation: phaser-binding-pulse 1.2s ease-in-out infinite alternate;
}

.phaser-battlefield.is-unavailable .phaser-battlefield-loading {
  color: #ef9f94;
}

@keyframes phaser-binding-pulse {
  from { opacity: 0.35; transform: rotate(0deg) scale(0.8); }
  to { opacity: 1; transform: rotate(90deg) scale(1.08); }
}

.sketch-icon {
  display: block;
  width: 100%;
  height: 100%;
  color: var(--sketch-accent, var(--jade));
}

.pixel-character {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  image-rendering: pixelated;
  user-select: none;
}

.pixel-equipment {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 5px 2px rgba(19, 16, 12, 0.34));
  user-select: none;
}

.sketch-icon path,
.sketch-icon circle,
.sketch-icon ellipse,
.sketch-icon polyline,
.sketch-icon line {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.combat-art {
  display: block;
  height: 100%;
  width: auto;
  overflow: hidden;
  aspect-ratio: var(--frame-aspect);
}

.combat-art > image {
  pointer-events: none;
  user-select: none;
}

.combat-art.is-compact {
  height: 100%;
  width: auto;
}

.signal-ribbon {
  position: absolute;
  z-index: 6;
  top: 12px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 12px;
  border: 1px solid rgba(225, 100, 85, 0.42);
  background: rgba(50, 13, 11, 0.74);
  color: #ef9f94;
  font-size: 10px;
  letter-spacing: 0.12em;
  transform: translateX(-50%);
  backdrop-filter: none;
}

.signal-pulse {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--red);
  animation: none;
}

.stage-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 0 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(5, 11, 14, 0.35);
}

.team-battle-hud {
  position: absolute;
  z-index: 9;
  top: 12px;
  left: 12px;
  display: grid;
  width: min(210px, 42%);
  gap: 2px;
  pointer-events: none;
}

.team-resource {
  display: grid;
  gap: 7px;
  padding: 8px 10px 9px;
  border-radius: 4px 10px 4px 8px;
  background:
    linear-gradient(145deg, rgba(255, 232, 175, 0.08), transparent 42%),
    rgba(25, 29, 24, 0.88);
  box-shadow:
    inset 0 0 0 1px rgba(190, 139, 66, 0.26),
    inset 0 -3px rgba(8, 9, 8, 0.34),
    0 6px 15px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(8px);
}

.team-resource-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.team-resource-heading strong {
  color: #f0d17e;
  font: 600 12px "Avenir Next", sans-serif;
  letter-spacing: 0.05em;
}

.team-resource-heading small {
  margin-left: 2px;
  color: #8d856f;
  font-size: 8px;
  font-weight: 500;
}

.team-status-strip {
  display: flex;
  min-height: 20px;
  align-items: center;
  gap: 4px;
  padding: 2px 4px;
}

.team-status-strip:empty {
  visibility: hidden;
}

.segmented-bar {
  display: grid;
  width: 100%;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
}

.segmented-bar i {
  --fill: 0;
  position: relative;
  height: 8px;
  overflow: hidden;
  border: 1px solid rgba(204, 176, 108, 0.16);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.08);
  transform: skewX(-8deg);
}

.segmented-bar i::after {
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(var(--fill) * 100%);
  background: linear-gradient(90deg, #4d9f87, #8ee0bd);
  box-shadow: 0 0 6px rgba(119, 216, 201, 0.4);
  content: "";
}

.playback-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.speed-button {
  min-width: 38px;
  height: 27px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--dim);
  font: 10px "Avenir Next", sans-serif;
}

.speed-button:hover,
.speed-button.is-active {
  border-color: var(--line-strong);
  color: var(--paper);
  background: rgba(255, 255, 255, 0.035);
}

.auto-switch {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 6px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.auto-switch input {
  position: absolute;
  opacity: 0;
}

.auto-switch > span {
  position: relative;
  width: 28px;
  height: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
}

.auto-switch > span::after {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dim);
  content: "";
  transition: 150ms ease;
}

.auto-switch input:checked + span::after {
  left: 16px;
  background: var(--jade);
}

.command-dock {
  display: grid;
  min-height: 0;
  grid-template-rows: 31px minmax(0, 1fr);
  background: rgba(7, 13, 16, 0.45);
}

.dock-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
}

.dock-label span {
  font-size: 11px;
  letter-spacing: 0.12em;
}

.dock-label small {
  color: var(--dim);
  font-size: 9px;
}

.hero-cards {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-columns: repeat(5, minmax(145px, 1fr));
  gap: 6px;
  padding: 0 8px 8px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.hero-card {
  position: relative;
  min-width: 145px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.022);
}

.hero-card::before {
  position: absolute;
  top: 0;
  left: 0;
  width: 2px;
  height: 100%;
  background: var(--accent);
  opacity: 0.7;
  content: "";
}

.hero-card.is-defeated {
  opacity: 0.42;
}

.hero-identity {
  display: grid;
  height: 53px;
  grid-template-columns: 39px minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  padding: 4px 7px;
  border-bottom: 1px solid var(--line);
}

.hero-mini-glyph {
  display: grid;
  width: 36px;
  height: 43px;
  place-items: end center;
  color: var(--accent);
  overflow: hidden;
  filter: drop-shadow(0 4px 5px rgba(0, 0, 0, 0.42));
}

.hero-identity h3 {
  margin: 0 0 2px;
  overflow: hidden;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hero-identity p {
  margin: 0;
  overflow: hidden;
  color: var(--dim);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resource-readout {
  color: var(--muted);
  font: 9px "Avenir Next", sans-serif;
  text-align: right;
}

.resource-readout small {
  display: block;
  margin-bottom: 2px;
  color: var(--dim);
  font-size: 8px;
}

.command-buttons {
  display: grid;
  gap: 4px;
  padding: 5px;
}

.skill-button {
  position: relative;
  display: flex;
  min-height: 29px;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
  padding: 0 7px;
  border: 1px solid var(--line);
  background: rgba(119, 216, 201, 0.035);
  font-size: 9px;
}

.skill-button.ultimate {
  border-color: rgba(228, 184, 93, 0.2);
  background: rgba(228, 184, 93, 0.035);
}

.skill-button small {
  position: relative;
  z-index: 1;
  color: var(--dim);
  font: 8px "Avenir Next", sans-serif;
}

.skill-button span {
  position: relative;
  z-index: 1;
}

.cooldown-mask {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--cooldown);
  background: rgba(0, 0, 0, 0.48);
}

.intel-panel {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: 45px minmax(0, 1fr);
  overflow: hidden;
}

.intel-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--line);
}

.intel-tab {
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--dim);
  font-size: 11px;
  letter-spacing: 0.1em;
}

.intel-tab.is-active {
  color: var(--paper);
  box-shadow: inset 0 -2px var(--jade);
}

.report-pane,
.status-pane {
  display: grid;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
}

.phase-track {
  display: flex;
  align-items: center;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.phase-track i {
  height: 1px;
  flex: 1;
  background: var(--line-strong);
}

.phase-node {
  color: var(--dim);
  font-size: 9px;
}

.phase-node.is-active {
  color: var(--jade);
}

.event-feed {
  min-height: 0;
  overflow-y: auto;
  padding: 8px 14px 16px;
  scrollbar-width: thin;
}

.event {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 7px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(211, 226, 216, 0.07);
}

.event-time {
  color: var(--dim);
  font: 9px "Avenir Next", sans-serif;
}

.event p {
  margin: 0;
  color: #9eaaa5;
  font-size: 10px;
  line-height: 1.6;
}

.event.critical p,
.event.danger p {
  color: #e29488;
}

.event.reward p,
.event.heal p {
  color: #92c7b9;
}

.status-pane {
  display: block;
  overflow-y: auto;
  padding: 14px;
}

.status-intro {
  color: var(--dim);
  font-size: 10px;
  line-height: 1.7;
}

.status-row {
  display: grid;
  gap: 4px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.status-row span {
  font-size: 11px;
}

.status-row strong {
  color: var(--muted);
  font: 9px "Avenir Next", sans-serif;
}

/* World */
.world-grid {
  display: grid;
  width: 100%;
  max-width: none;
  min-height: min(690px, calc(100dvh - 175px));
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  margin: 0 auto;
}

.map-panel {
  display: grid;
  min-height: 560px;
  grid-template-rows: 43px minmax(0, 1fr);
}

.gensokyo-map {
  position: relative;
  min-height: 520px;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 70% 28%, rgba(87, 147, 145, 0.14), transparent 26%),
    radial-gradient(ellipse at 25% 78%, rgba(84, 111, 82, 0.17), transparent 29%),
    linear-gradient(153deg, rgba(255, 255, 255, 0.02), transparent 48%),
    #0a1417;
}

.gensokyo-map::before {
  position: absolute;
  inset: 0;
  opacity: 0.12;
  background-image:
    linear-gradient(rgba(150, 184, 178, 0.22) 1px, transparent 1px),
    linear-gradient(90deg, rgba(150, 184, 178, 0.22) 1px, transparent 1px);
  background-size: 48px 48px;
  content: "";
  mask-image: radial-gradient(circle, black, transparent 84%);
}

.map-river {
  position: absolute;
  top: -12%;
  left: 46%;
  width: 14%;
  height: 130%;
  border-left: 1px solid rgba(119, 216, 201, 0.21);
  border-radius: 48%;
  transform: rotate(17deg);
  box-shadow: -10px 0 rgba(119, 216, 201, 0.025);
}

.map-mountain {
  position: absolute;
  right: -4%;
  bottom: -8%;
  width: 46%;
  height: 66%;
  opacity: 0.16;
  background: #7f9791;
  clip-path: polygon(0 100%, 20% 52%, 36% 77%, 54% 21%, 72% 67%, 85% 42%, 100% 100%);
}

.map-compass {
  position: absolute;
  top: 19px;
  right: 21px;
  width: 48px;
  height: 48px;
  color: var(--dim);
  font-size: 11px;
  text-align: center;
  transform: rotate(4deg);
}

.map-compass::before {
  position: absolute;
  inset: -5px;
  border: 1px solid rgba(112, 143, 137, 0.26);
  border-radius: 50%;
  content: "";
}

.map-compass i {
  color: #93685e;
  font-style: normal;
}

.region-node {
  position: absolute;
  display: flex;
  min-width: 190px;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: rgba(8, 16, 19, 0.78);
  color: var(--muted);
  text-align: left;
  transform: translate(-50%, -50%);
  backdrop-filter: blur(9px);
}

button.region-node:hover,
.region-node.active {
  border-color: rgba(119, 216, 201, 0.47);
  color: var(--paper);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.3);
  transform: translate(-50%, -50%) translateY(-2px);
}

.region-node.locked {
  opacity: 0.43;
}

.region-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  color: var(--jade);
}

.region-copy {
  display: grid;
  gap: 3px;
}

.region-copy strong {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
}

.region-copy small {
  max-width: 180px;
  color: var(--dim);
  font-size: 9px;
  line-height: 1.45;
}

.world-side {
  display: grid;
  min-height: 0;
  grid-template-rows: minmax(220px, 0.75fr) minmax(320px, 1.25fr);
  gap: 14px;
}

.rumor-list {
  max-height: 290px;
  overflow-y: auto;
  padding: 4px 14px;
}

.rumor-entry {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.rumor-entry span {
  color: #c7d4cd;
  font-size: 11px;
}

.rumor-entry p {
  margin: 5px 0 0;
  color: var(--dim);
  font-size: 9px;
  line-height: 1.6;
}

.hidden-rumor {
  opacity: 0.45;
}

.facility-grid {
  display: grid;
  gap: 7px;
  padding: 10px;
}

.facility-card {
  display: grid;
  grid-template-columns: minmax(110px, 0.7fr) 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 9px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.018);
}

.facility-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.facility-title strong {
  font-size: 10px;
  font-weight: 500;
}

.facility-title span {
  color: var(--jade);
  font: 9px "Avenir Next", sans-serif;
}

.facility-card p {
  margin: 0;
  color: var(--dim);
  font-size: 8px;
  line-height: 1.45;
}

.facility-levels {
  display: none;
}

.facility-upgrade {
  min-height: 27px;
  padding: 0 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 8px;
}

/* Recruitment */
.recruitment-layout {
  display: grid;
  max-width: 1540px;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.8fr);
  gap: 14px;
  margin: 0 auto;
}

.recruitment-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(210px, 1fr));
  gap: 10px;
  padding: 12px;
}

.recruitment-grid.compact {
  grid-template-columns: 1fr;
}

.recruitment-card {
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--hero-accent) 42%, var(--line));
  background: linear-gradient(145deg, color-mix(in srgb, var(--hero-accent) 8%, transparent), rgba(255,255,255,.015));
}

.recruitment-card-heading {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
}

.recruitment-glyph {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--hero-accent) 55%, var(--line));
  color: var(--hero-accent);
}

.recruitment-card-heading strong,
.recruitment-card-heading small {
  display: block;
}

.recruitment-card-heading strong { font-size: 11px; }
.recruitment-card-heading small { margin-top: 3px; color: var(--dim); font-size: 8px; }
.recruitment-card-heading > span { color: var(--jade); font-size: 9px; }

.recruitment-skills {
  display: grid;
  gap: 5px;
  margin: 12px 0;
}

.recruitment-skills div {
  display: flex;
  justify-content: space-between;
  padding: 6px 7px;
  background: rgba(0,0,0,.18);
  color: var(--muted);
  font-size: 9px;
}

.recruitment-skills b { color: #d7c89c; font-weight: 500; }
.recruitment-actions { display: flex; justify-content: flex-end; gap: 6px; align-items: center; }
.recruitment-actions button { min-height: 28px; padding: 0 9px; border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 9px; }
.selected-recruitment { color: var(--jade); font-size: 9px; }

@media (max-width: 1100px) {
  .recruitment-layout { grid-template-columns: 1fr; }
  .recruitment-grid { grid-template-columns: repeat(2, minmax(210px, 1fr)); }
}

/* Roster */
.roster-layout {
  display: grid;
  max-width: 1540px;
  grid-template-columns: minmax(620px, 1fr) minmax(300px, 380px);
  gap: 14px;
  margin: 0 auto;
}

.character-roster {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 9px;
  padding: 12px;
}

.character-card {
  position: relative;
  display: grid;
  min-height: 225px;
  grid-template-rows: 1fr auto;
  overflow: hidden;
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--hero-accent) 11%, transparent), transparent 42%),
    rgba(255, 255, 255, 0.018);
  color: inherit;
  padding: 0;
  text-align: left;
}

.character-card::before {
  position: absolute;
  top: 8px;
  right: 8px;
  color: rgba(232, 227, 210, 0.07);
  font: 29px "Baskerville", serif;
  content: attr(data-index);
}

.character-portrait {
  width: 94px;
  height: 125px;
  align-self: end;
  justify-self: center;
  color: var(--hero-accent);
  filter: drop-shadow(0 12px 14px rgba(0, 0, 0, 0.3));
}

.character-card:hover .character-portrait {
  transform: translateY(-3px) rotate(-1deg);
}

.character-portrait .sketch-icon,
.character-portrait .pixel-character {
  transition: transform 180ms ease;
}

.character-copy {
  padding: 10px;
  border-top: 1px solid var(--line);
  background: rgba(5, 10, 13, 0.5);
}

.character-copy h3 {
  margin: 0 0 3px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
}

.character-copy p {
  margin: 0;
  overflow: hidden;
  color: var(--dim);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.character-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 9px;
  color: var(--muted);
  font: 9px "Avenir Next", sans-serif;
}

.character-card.not-joined {
  opacity: 0.5;
}

.party-panel {
  align-self: start;
}

.party-editor {
  display: grid;
  gap: 7px;
  padding: 12px;
}

.party-slot-editor {
  display: grid;
  min-height: 52px;
  grid-template-columns: 26px minmax(0, 1fr) 48px;
  align-items: center;
  gap: 7px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.018);
}

.party-slot-editor > span:first-child {
  color: var(--jade);
  font: 10px "Avenir Next", sans-serif;
}

.party-slot-editor > span:first-child small {
  display: block;
  margin-top: 3px;
  color: var(--dim);
  font-size: 7px;
  letter-spacing: 0.08em;
}

select,
input[type="number"] {
  min-width: 0;
  min-height: 29px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #0c171b;
  color: #b7c5be;
  font-size: 9px;
}

select {
  padding: 0 24px 0 7px;
}

input[type="number"] {
  padding: 0 7px;
}

.relation-mini {
  display: grid;
  gap: 4px;
  color: var(--dim);
  font-size: 8px;
}

.relation-mini i {
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--red) var(--relation), rgba(255, 255, 255, 0.07) var(--relation));
}

.save-party-button {
  width: calc(100% - 24px);
  margin: 0 12px 12px;
}

.party-note {
  padding: 14px;
  border-top: 1px solid var(--line);
}

.party-note span {
  color: var(--muted);
  font-size: 10px;
}

.party-note p {
  margin: 5px 0 0;
  color: var(--dim);
  font-size: 9px;
  line-height: 1.6;
}

/* Team archive */
.teams-layout {
  display: grid;
  max-width: 1540px;
  grid-template-columns: minmax(280px, 0.34fr) minmax(560px, 0.66fr);
  gap: 14px;
  margin: 0 auto;
}

.teams-view-heading {
  align-items: center;
}

.new-party-button {
  min-width: 116px;
}

.team-index-panel,
.team-editor-panel {
  min-height: 520px;
}

.team-index-panel {
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.team-list {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 12px;
}

.team-list-card {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 66px;
  padding: 9px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.016);
  color: inherit;
  text-align: left;
}

.team-list-card:hover,
.team-list-card.is-selected {
  border-color: rgba(119, 216, 201, 0.35);
  background: rgba(119, 216, 201, 0.05);
}

.team-list-card.is-active .team-number {
  border-color: rgba(119, 216, 201, 0.45);
  color: var(--jade);
}

.team-number {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  color: var(--dim);
  font: 16px "Baskerville", serif;
}

.team-list-copy {
  min-width: 0;
}

.team-list-copy strong,
.team-list-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-list-copy strong {
  margin-bottom: 5px;
  font-size: 12px;
  font-weight: 500;
}

.team-list-copy small {
  color: var(--dim);
  font-size: 9px;
}

.team-active-dot {
  color: var(--jade);
  font: 8px "Avenir Next Condensed", sans-serif;
  letter-spacing: 0.13em;
}

.team-editor-panel {
  padding-bottom: 12px;
}

.team-editor-heading {
  display: flex;
  min-height: 88px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(119, 216, 201, 0.05), transparent 55%),
    rgba(255, 255, 255, 0.012);
}

.team-editor-heading input {
  width: min(420px, 56vw);
  padding: 5px 0;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  background: transparent;
  color: var(--paper);
  font: 400 21px "Baskerville", "Noto Serif SC", serif;
  letter-spacing: 0.1em;
}

.team-editor-heading small {
  display: block;
  margin-top: 6px;
  color: var(--dim);
  font-size: 9px;
}

.active-team-stamp {
  padding: 7px 10px;
  border: 1px solid rgba(119, 216, 201, 0.32);
  color: var(--jade);
  font-size: 9px;
  letter-spacing: 0.14em;
}

.team-editor-panel .party-editor {
  grid-template-columns: repeat(5, minmax(110px, 1fr));
  gap: 9px;
  padding: 18px;
}

.team-editor-panel .party-slot-editor {
  min-height: 270px;
  grid-template-columns: 1fr;
  grid-template-rows: auto 1fr auto;
  align-items: stretch;
  padding: 12px;
}

.team-editor-panel .party-slot-editor > span:first-child {
  font-size: 16px;
}

.team-editor-panel .party-slot-editor select {
  align-self: end;
  min-height: 42px;
}

.team-editor-panel .relation-mini {
  align-self: end;
}

.team-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding: 0 18px;
}

.team-editor-actions .save-party-button {
  width: auto;
  margin: 0;
}

.danger-button {
  margin-right: auto;
  color: #dc877b;
}

/* Inventory */
.inventory-view-heading {
  align-items: center;
}

.offline-banner {
  display: grid;
  max-width: 1540px;
  min-height: 72px;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 13px;
  margin: 0 auto 14px;
  padding: 10px 14px;
  border: 1px solid rgba(119, 216, 201, 0.18);
  background: rgba(119, 216, 201, 0.035);
}

.offline-mark,
.dream-seal {
  display: grid;
  width: 39px;
  height: 39px;
  place-items: center;
  border: 1px solid rgba(119, 216, 201, 0.28);
  color: var(--jade);
  transform: rotate(-2deg);
}

.offline-banner span {
  display: block;
  color: var(--dim);
  font-size: 9px;
  letter-spacing: 0.1em;
}

.offline-banner strong {
  display: block;
  margin: 3px 0;
  font-size: 11px;
  font-weight: 500;
}

.offline-banner p {
  margin: 0;
  color: var(--dim);
  font-size: 9px;
}

.inventory-section,
.craft-grid,
.loot-policy-panel {
  max-width: 1540px;
  margin-right: auto;
  margin-left: auto;
}

.inventory-grid,
.module-grid,
.stone-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(225px, 1fr));
  gap: 9px;
  padding: 10px;
}

#inventory-grid {
  grid-template-columns: repeat(auto-fill, minmax(128px, 140px));
  justify-content: start;
  gap: 12px;
  padding: 16px;
}

.inventory-item {
  --item-base: #e7e2d4;
  --item-accent: #fffdf2;
  --item-ink: #282722;
  position: relative;
  isolation: isolate;
  aspect-ratio: 1;
  min-width: 0;
  overflow: hidden;
  border: 3px solid #171713;
  border-radius: 3px 9px 3px 7px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.34), transparent 34%),
    repeating-linear-gradient(0deg, transparent 0 11px, rgba(23, 23, 19, 0.075) 11px 12px),
    repeating-linear-gradient(90deg, transparent 0 11px, rgba(23, 23, 19, 0.075) 11px 12px),
    var(--item-base);
  box-shadow:
    inset 0 0 0 2px color-mix(in srgb, var(--item-accent) 64%, transparent),
    inset 0 -9px rgba(29, 23, 16, 0.12),
    4px 5px 0 rgba(11, 11, 9, 0.48);
  color: var(--item-ink);
  cursor: help;
  outline: none;
  transition: transform 120ms steps(2, end), box-shadow 120ms steps(2, end);
}

.inventory-item.rarity-common {
  --item-base: #e7e2d4;
  --item-accent: #fffdf2;
}

.inventory-item.rarity-fine {
  --item-base: #3266ad;
  --item-accent: #8fc7ff;
}

.inventory-item.rarity-rare {
  --item-base: #dbad32;
  --item-accent: #ffe884;
}

.inventory-item.rarity-extreme {
  --item-base: #bd3535;
  --item-accent: #ff8a72;
}

.inventory-item::before,
.inventory-item::after {
  position: absolute;
  z-index: 3;
  width: 12px;
  height: 12px;
  border-color: color-mix(in srgb, var(--item-accent) 74%, #312416);
  content: "";
  pointer-events: none;
}

.inventory-item::before {
  top: 6px;
  left: 6px;
  border-top: 2px solid;
  border-left: 2px solid;
}

.inventory-item::after {
  right: 6px;
  bottom: 6px;
  border-right: 2px solid;
  border-bottom: 2px solid;
}

.inventory-item-art {
  position: absolute;
  display: grid;
  inset: 9px;
  place-items: center;
  transition: opacity 100ms steps(2, end), transform 150ms steps(3, end);
}

.inventory-item-art .pixel-equipment {
  width: 94%;
  height: 94%;
}

.inventory-item-tooltip {
  --item-base: #e7e2d4;
  --item-accent: #fffdf2;
  position: fixed;
  z-index: 1000;
  display: grid;
  width: min(360px, calc(100vw - 24px));
  min-height: 270px;
  grid-template-rows: auto auto 1fr auto;
  overflow: hidden;
  border: 2px solid #171713;
  border-radius: 3px 10px 4px 8px;
  opacity: 0;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--item-base) 24%, transparent), transparent 42%),
    repeating-linear-gradient(0deg, transparent 0 17px, rgba(255, 255, 255, 0.018) 17px 18px),
    rgba(24, 23, 19, 0.98);
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--item-accent) 44%, transparent),
    inset 0 0 32px rgba(0, 0, 0, 0.48),
    10px 14px 0 rgba(10, 10, 8, 0.32),
    0 20px 50px rgba(0, 0, 0, 0.58);
  color: #f5e8c7;
  pointer-events: none;
  transform: translateY(8px) scale(0.98);
  transform-origin: center;
  transition: opacity 110ms steps(2, end), transform 140ms steps(3, end);
}

.inventory-item-tooltip.rarity-common {
  --item-base: #e7e2d4;
  --item-accent: #fffdf2;
}

.inventory-item-tooltip.rarity-fine {
  --item-base: #3266ad;
  --item-accent: #8fc7ff;
}

.inventory-item-tooltip.rarity-rare {
  --item-base: #dbad32;
  --item-accent: #ffe884;
}

.inventory-item-tooltip.rarity-extreme {
  --item-base: #bd3535;
  --item-accent: #ff8a72;
}

.inventory-item-tooltip[hidden] {
  display: none;
}

.inventory-item-tooltip.is-visible {
  opacity: 1;
  transform: none;
}

.inventory-item:hover,
.inventory-item:focus-visible {
  z-index: 4;
  box-shadow:
    inset 0 0 0 2px var(--item-accent),
    6px 8px 0 rgba(11, 11, 9, 0.56),
    0 0 20px color-mix(in srgb, var(--item-base) 38%, transparent);
  transform: translate(-2px, -3px);
}

.inventory-item:hover .inventory-item-art,
.inventory-item:focus-visible .inventory-item-art {
  transform: scale(1.06);
}

.inventory-tooltip-heading {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid color-mix(in srgb, var(--item-accent) 28%, transparent);
}

.inventory-tooltip-art {
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--item-accent) 34%, transparent);
  border-radius: 2px 7px 2px 6px;
  background: color-mix(in srgb, var(--item-base) 18%, rgba(9, 9, 8, 0.7));
  box-shadow: inset 0 0 16px rgba(0, 0, 0, 0.35);
}

.inventory-tooltip-art .pixel-equipment {
  width: 66px;
  height: 66px;
}

.inventory-tooltip-title {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.inventory-tooltip-title small {
  overflow: hidden;
  color: color-mix(in srgb, var(--item-accent) 72%, #f5e8c7);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inventory-tooltip-title strong {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.12em;
}

.inventory-tooltip-title span {
  color: #8f897a;
  font-size: 9px;
  letter-spacing: 0.18em;
}

.inventory-item-tooltip .power-score small {
  font-size: 8px;
}

.inventory-item-tooltip .power-score strong {
  color: var(--item-accent);
  font-size: 19px;
}

.inventory-tooltip-affix-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px 5px;
}

.inventory-tooltip-affix-heading span {
  color: #e8d8b5;
  font-size: 11px;
  letter-spacing: 0.14em;
}

.inventory-tooltip-affix-heading small {
  color: #777266;
  font-size: 8px;
  letter-spacing: 0.12em;
}

.inventory-item-tooltip .affix-preview {
  align-content: start;
  grid-template-columns: 1fr;
  gap: 2px;
  padding: 3px 16px 12px;
}

.inventory-item-tooltip .affix-line {
  min-height: 25px;
  align-items: center;
  padding: 3px 0;
  font-size: 12px;
}

.inventory-item-tooltip .affix-line b {
  font-size: 10px;
}

.inventory-item-status {
  overflow: hidden;
  padding: 8px 16px 10px;
  border-top: 1px solid color-mix(in srgb, var(--item-accent) 20%, transparent);
  color: color-mix(in srgb, var(--item-accent) 70%, #f5e8c7);
  font-size: 9px;
  letter-spacing: 0.09em;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-state,
.empty-inventory,
.empty-modules,
.empty-stones {
  grid-column: 1 / -1;
  min-height: 100px;
  align-content: center;
  padding: 20px;
  border: 1px dashed var(--line);
  color: var(--dim);
  font-size: 10px;
  text-align: center;
}

.item-card,
.module-card,
.stone-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.018);
}

.item-card::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 2px;
  background: #82928d;
  content: "";
}

.item-card.rare::before { background: #72a8c3; }
.item-card.extreme::before { background: var(--gold); }

.item-top {
  display: grid;
  min-height: 74px;
  grid-template-columns: 55px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
}

.item-glyph,
.module-glyph,
.stone-glyph {
  width: 52px;
  height: 52px;
  color: #aabbb5;
}

.item-top h3 {
  margin: 0 0 2px;
  font-size: 12px;
  font-weight: 500;
}

.item-top p {
  margin: 0;
  color: var(--dim);
  font-size: 9px;
}

.power-score {
  display: grid;
  gap: 2px;
  text-align: right;
}

.power-score small {
  color: var(--dim);
  font-size: 8px;
}

.power-score strong {
  color: var(--gold);
  font: 15px "Avenir Next", sans-serif;
}

.affix-preview,
.module-effects,
.stone-affixes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px 10px;
  padding: 8px;
}

.affix-line,
.module-effects span,
.stone-affixes span {
  display: flex;
  min-width: 0;
  justify-content: space-between;
  gap: 5px;
  padding: 3px 0;
  color: var(--muted);
  font-size: 8px;
}

.affix-line .affix-name {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.affix-line .affix-value {
  flex: 0 0 auto;
  margin-left: auto;
  color: var(--affix-color);
  font: 700 8px "Avenir Next", sans-serif;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.affix-line {
  --affix-color: #f1eee5;
  justify-content: flex-start;
  color: var(--affix-color);
}

.affix-line.affix-grade-common { --affix-color: #f1eee5; }
.affix-line.affix-grade-fine { --affix-color: #79b8ff; }
.affix-line.affix-grade-rare { --affix-color: #f1c65d; }
.affix-line.affix-grade-extreme { --affix-color: #ff6257; }

.affix-line b {
  min-width: 27px;
  padding: 2px 3px;
  border: 1px solid color-mix(in srgb, var(--affix-color) 54%, transparent);
  border-radius: 2px 4px 2px 3px;
  color: var(--affix-color);
  background: color-mix(in srgb, var(--affix-color) 9%, transparent);
  font: 700 8px "Avenir Next", sans-serif;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
}

.inventory-item-tooltip .affix-line .affix-value {
  font-size: 11px;
}

.module-effects b,
.stone-affixes b {
  color: var(--jade);
  font: 8px "Avenir Next", sans-serif;
  white-space: nowrap;
}

.item-equip,
.extract-controls,
.module-equip,
.forge-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 55px;
  gap: 5px;
  padding: 5px 8px;
  border-top: 1px solid rgba(211, 226, 216, 0.07);
}

.item-equip button,
.extract-controls button,
.module-equip button,
.forge-controls button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  font-size: 9px;
}

.equipped-mark {
  padding: 5px 8px;
  color: var(--jade);
  font-size: 8px;
  text-align: right;
}

.stored-mark {
  padding: 5px 8px;
  color: var(--dim);
  font-size: 8px;
  text-align: right;
}

.warehouse-filters {
  display: grid;
  max-width: 1540px;
  min-height: 76px;
  grid-template-columns: minmax(260px, 1fr) minmax(150px, 220px) minmax(150px, 220px) auto;
  align-items: end;
  gap: 12px;
  margin: 0 auto 14px;
  padding: 12px 14px;
}

.warehouse-filters > div {
  display: grid;
  gap: 3px;
}

.warehouse-filters strong {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
}

.warehouse-filters small {
  color: var(--dim);
  font-size: 9px;
}

.warehouse-filters label {
  display: grid;
  gap: 5px;
  color: var(--dim);
  font-size: 9px;
}

.warehouse-filters .ghost-button {
  padding: 0 14px;
}

.craft-grid {
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  gap: 14px;
  margin-top: 14px;
}

.module-grid {
  grid-template-columns: repeat(2, minmax(210px, 1fr));
}

.module-title,
.stone-title {
  display: flex;
  min-height: 67px;
  align-items: center;
  gap: 8px;
  padding: 7px;
  border-bottom: 1px solid var(--line);
}

.module-title > div {
  display: grid;
  gap: 3px;
}

.module-title strong,
.stone-title span {
  font-size: 11px;
  font-weight: 500;
}

.module-title small {
  color: var(--dim);
  font-size: 8px;
}

.module-card > p {
  min-height: 42px;
  margin: 0;
  padding: 8px;
  color: var(--dim);
  font-size: 8px;
  line-height: 1.5;
}

.stone-grid {
  grid-template-columns: 1fr;
}

.loot-policy-panel {
  margin-top: 14px;
}

.workshop-extraction {
  max-width: 1540px;
  margin-top: 14px;
}

.policy-fields {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr)) auto;
  align-items: end;
  gap: 10px;
  padding: 12px;
}

.policy-fields label {
  display: grid;
  gap: 5px;
  color: var(--dim);
  font-size: 9px;
}

.policy-toggle {
  grid-template-columns: auto 1fr;
  align-items: center;
  align-self: center;
}

.rarity-legend {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--dim);
  font-size: 8px;
}

.rarity-legend i {
  width: 7px;
  height: 7px;
  margin-left: 5px;
  background: #82928d;
}

.rarity-legend .common { background: #e7e2d4; }
.rarity-legend .fine { background: #3266ad; }
.rarity-legend .rare { background: #dbad32; }
.rarity-legend .extreme { background: #bd3535; }

/* Tactics */
.tactic-savebar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tactic-savebar > small {
  color: var(--dim);
  font-size: 9px;
}

.tactic-savebar label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--dim);
  font-size: 9px;
}

.tactics-grid {
  display: grid;
  max-width: 1540px;
  gap: 10px;
  margin: 0 auto;
}

.tactic-row {
  display: grid;
  grid-template-columns: 155px minmax(280px, 1fr) minmax(280px, 1fr) 82px;
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.tactic-hero {
  display: flex;
  align-items: center;
  gap: 9px;
  padding-right: 8px;
  border-right: 1px solid var(--line);
}

.tactic-hero i {
  display: grid;
  width: 45px;
  height: 52px;
  flex: 0 0 45px;
  place-items: center;
  overflow: hidden;
  color: var(--tactic-accent);
  font-style: normal;
}

.tactic-hero .combat-art {
  max-width: 100%;
}

.tactic-hero div {
  display: grid;
  gap: 3px;
}

.tactic-hero strong {
  font-size: 11px;
  font-weight: 500;
}

.tactic-hero small {
  color: var(--dim);
  font-size: 9px;
}

.tactic-row label,
.tactic-ability-rule > label {
  display: grid;
  gap: 4px;
  color: var(--dim);
  font-size: 8px;
}

.tactic-ability-rule {
  min-width: 0;
}

.tactic-rule-list {
  display: grid;
  gap: 4px;
  margin-top: 5px;
}

.tactic-rule-line {
  display: grid;
  grid-template-columns: 22px minmax(120px, 1.5fr) minmax(65px, 0.6fr) minmax(85px, 0.8fr) auto;
  gap: 4px;
  align-items: center;
}

.rule-order {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border: 1px solid var(--line);
  color: var(--jade);
  font: 8px "Avenir Next", sans-serif;
}

.rule-actions {
  display: flex;
  gap: 2px;
}

.rule-actions button,
.add-rule-button {
  height: 27px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--dim);
  font-size: 9px;
}

.rule-actions button {
  width: 24px;
}

.add-rule-button {
  width: 100%;
  margin-top: 5px;
}

/* Chronicle */
.chapter-status {
  padding: 8px 11px;
  border: 1px solid rgba(228, 184, 93, 0.25);
  color: var(--gold);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.chapter-status.resolved {
  border-color: rgba(119, 216, 201, 0.3);
  color: var(--jade);
}

.chronicle-summary {
  max-width: 1540px;
  margin: 0 auto 14px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}

.anomaly-track {
  display: grid;
  max-width: 1540px;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin: 0 auto 14px;
}

.anomaly-stage {
  min-height: 150px;
  padding: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.018);
}

.anomaly-stage.locked {
  opacity: 0.4;
}

.anomaly-stage.current {
  border-color: rgba(228, 184, 93, 0.38);
  background: rgba(228, 184, 93, 0.035);
}

.anomaly-stage.resolved {
  border-color: rgba(119, 216, 201, 0.22);
}

.stage-index {
  display: block;
  margin-bottom: 15px;
  color: var(--jade);
  font: 11px "Avenir Next", sans-serif;
}

.anomaly-stage small {
  color: var(--dim);
  font-size: 8px;
}

.anomaly-stage strong {
  display: block;
  margin: 5px 0;
  font-size: 11px;
  font-weight: 500;
}

.anomaly-stage p {
  margin: 0;
  color: var(--dim);
  font-size: 8px;
  line-height: 1.55;
}

.living-world-grid {
  display: grid;
  max-width: 1540px;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 14px;
  margin: 0 auto;
}

.daily-event-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 10px;
}

.daily-event {
  padding: 10px;
  border: 1px solid var(--line);
}

.daily-event.resolved {
  opacity: 0.48;
}

.daily-event small {
  color: var(--dim);
  font-size: 8px;
}

.daily-event strong {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  font-weight: 500;
}

.daily-event p {
  min-height: 48px;
  margin: 8px 0;
  color: var(--dim);
  font-size: 9px;
  line-height: 1.55;
}

.daily-event footer {
  display: grid;
  gap: 6px;
}

.daily-event footer span {
  color: var(--jade);
  font-size: 8px;
}

.daily-event button {
  min-height: 28px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  font-size: 9px;
}

.dream-board {
  position: relative;
  padding: 18px;
  overflow: hidden;
}

.dream-seal {
  position: absolute;
  top: 16px;
  right: 16px;
  border-color: rgba(186, 138, 201, 0.32);
  color: var(--violet);
}

.dream-board h3 {
  margin-bottom: 7px;
  font-size: 19px;
  font-weight: 400;
}

.dream-board > p:not(.section-kicker) {
  max-width: 75%;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.65;
}

.dream-modifiers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin: 12px 0;
}

.dream-modifiers span {
  display: grid;
  gap: 3px;
  padding: 8px;
  border: 1px solid var(--line);
}

.dream-modifiers b {
  font-size: 10px;
  font-weight: 500;
}

.dream-modifiers small,
.dream-record,
.dream-lock {
  color: var(--dim);
  font-size: 8px;
}

.dream-controls {
  display: flex;
  align-items: end;
  gap: 8px;
  margin: 12px 0 8px;
}

.dream-controls label {
  display: grid;
  gap: 4px;
  color: var(--dim);
  font-size: 9px;
}

/* Investigation result */
.battle-result {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  overflow-y: auto;
  padding: clamp(18px, 4vw, 56px);
  background:
    radial-gradient(circle at 72% 24%, rgba(226, 181, 91, 0.15), transparent 25rem),
    linear-gradient(150deg, rgba(58, 44, 28, 0.52), rgba(7, 18, 18, 0.68));
  backdrop-filter: blur(3px) saturate(0.82);
}

.result-card {
  position: relative;
  width: min(840px, 100%);
  padding: clamp(24px, 4vw, 44px);
  border: 1px solid var(--line-strong);
  background: #101c20;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55);
}

.result-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.result-seal {
  display: grid;
  width: 62px;
  height: 62px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(225, 100, 85, 0.62);
  color: #eb9489;
  font-size: 27px;
  transform: rotate(-3deg);
}

.result-card h2 {
  margin: 5px 0 0;
  font-size: 20px;
  font-weight: 400;
}

.result-summary {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 28px;
  padding: 24px 0;
}

.result-copy-block,
.result-loot-block {
  min-width: 0;
}

.result-copy-block > span,
.result-loot-block > span {
  display: block;
  margin-bottom: 10px;
  color: var(--dim);
  font-size: 9px;
  letter-spacing: 0.14em;
}

.result-copy-block p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.65;
}

.result-loot {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.result-loot-entry {
  display: flex;
  min-width: 0;
  min-height: 38px;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  padding: 7px 9px;
  border-left: 2px solid color-mix(in srgb, var(--gold) 62%, transparent);
  background: rgba(231, 187, 98, 0.07);
  color: #ddc98f;
  font-size: 10px;
}

.result-loot-entry > span,
.result-loot-entry > div > span {
  color: var(--muted);
}

.result-loot-entry > strong,
.result-loot-entry > div > strong {
  color: #f0d88e;
  font-weight: 600;
}

.result-resource-label {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.result-resource-icon {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 4px 2px rgba(19, 16, 12, 0.34));
}

.result-loot-text {
  grid-column: 1 / -1;
}

.result-loot-equipment {
  position: relative;
  min-height: 58px;
  justify-content: flex-start;
  overflow: hidden;
  border-left-color: var(--item-accent, #d7bd79);
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--item-base, #ba9c57) 18%, transparent), transparent 58%),
    rgba(22, 23, 19, 0.5);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--item-accent, #d7bd79) 24%, transparent);
}

.result-loot-equipment.rarity-common {
  --item-base: #e7e2d4;
  --item-accent: #fffdf2;
}

.result-loot-equipment.rarity-fine {
  --item-base: #3266ad;
  --item-accent: #8fc7ff;
}

.result-loot-equipment.rarity-rare {
  --item-base: #dbad32;
  --item-accent: #ffe884;
}

.result-loot-equipment.rarity-extreme {
  --item-base: #bd3535;
  --item-accent: #ff8a72;
}

.result-loot-equipment > div:last-child {
  display: grid;
  gap: 4px;
}

.result-loot-icon {
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  place-items: center;
  padding: 4px;
  background: rgba(8, 10, 9, 0.34);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--item-accent, #d7bd79) 30%, transparent);
}

.result-loot-icon .pixel-equipment {
  width: 94%;
  height: 94%;
}

.result-close {
  z-index: 3;
}

.result-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.result-actions p {
  margin: 0;
  color: var(--dim);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.toast {
  position: fixed;
  z-index: 150;
  right: 22px;
  bottom: 22px;
  max-width: min(430px, calc(100vw - 44px));
  padding: 11px 14px;
  border: 1px solid rgba(119, 216, 201, 0.34);
  background: rgba(12, 24, 28, 0.96);
  color: #c8d7d0;
  box-shadow: 0 15px 44px rgba(0, 0, 0, 0.4);
  font-size: 10px;
  line-height: 1.6;
}

dialog {
  width: min(520px, calc(100vw - 30px));
  padding: 28px;
  border: 1px solid var(--line-strong);
  background: #101b1f;
  color: var(--paper);
  box-shadow: 0 28px 100px rgba(0, 0, 0, 0.6);
}

dialog::backdrop {
  background: rgba(3, 8, 10, 0.74);
  backdrop-filter: blur(9px);
}

dialog h2 {
  font-size: 20px;
  font-weight: 400;
}

dialog li {
  margin: 8px 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

/* Field feedback note */
.feedback-dialog {
  width: min(560px, calc(100vw - 30px));
  max-width: none;
  padding: 0;
  overflow: hidden;
  border-color: rgba(228, 184, 93, 0.26);
}

.feedback-heading {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  padding: 22px 54px 18px 22px;
  border-bottom: 1px solid var(--line);
}

.feedback-heading h2 {
  margin: 0 0 7px;
  font-size: 23px;
  letter-spacing: 0.08em;
}

.feedback-heading > div:last-child > p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.65;
}

.feedback-mark {
  display: grid;
  width: 54px;
  height: 58px;
  place-items: center;
  border: 1px solid rgba(225, 100, 85, 0.5);
  color: #e6a099;
  font-size: 25px;
  transform: rotate(-2deg);
}

.feedback-form {
  display: grid;
  gap: 9px;
  padding: 18px 22px 22px;
}

.feedback-form > label {
  color: #b9c8c2;
  font: 9px "Avenir Next Condensed", sans-serif;
  letter-spacing: 0.16em;
}

.feedback-form textarea {
  width: 100%;
  min-height: 150px;
  resize: vertical;
  padding: 13px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  background: rgba(5, 12, 14, 0.48);
  color: #d8ded5;
  caret-color: var(--jade);
  font-size: 12px;
  line-height: 1.7;
}

.feedback-form textarea::placeholder {
  color: #53625e;
}

.feedback-meta,
.feedback-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.feedback-meta {
  justify-content: flex-end;
  color: var(--dim);
  font: 8px "Avenir Next", sans-serif;
}

#feedback-count {
  font-variant-numeric: tabular-nums;
}

.feedback-actions {
  margin-top: 7px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}

.feedback-actions button {
  min-width: 104px;
}

/* Personal field record */
.profile-dialog {
  width: min(680px, calc(100vw - 30px));
  max-width: none;
  padding: 0;
  overflow: hidden;
  border-color: rgba(119, 216, 201, 0.25);
  background:
    linear-gradient(90deg, rgba(119, 216, 201, 0.035) 1px, transparent 1px),
    linear-gradient(rgba(119, 216, 201, 0.025) 1px, transparent 1px),
    radial-gradient(circle at 7% 4%, rgba(225, 100, 85, 0.1), transparent 18rem),
    #0c171b;
  background-size: 24px 24px, 24px 24px, auto, auto;
}

.profile-heading {
  display: grid;
  min-height: 142px;
  grid-template-columns: 96px minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 16px 54px 14px 18px;
  border-bottom: 1px solid var(--line);
}

.profile-portrait {
  position: relative;
  width: 92px;
  height: 112px;
  overflow: hidden;
  border-bottom: 1px solid rgba(225, 100, 85, 0.32);
  background: radial-gradient(circle at 50% 34%, rgba(225, 100, 85, 0.12), transparent 65%);
}

.profile-portrait img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  image-rendering: pixelated;
}

.profile-heading-copy h2 {
  margin: 0 0 6px;
  font-size: 25px;
  letter-spacing: 0.12em;
}

.profile-heading-copy > p:last-child {
  margin: 0;
  color: var(--dim);
  font-size: 10px;
  letter-spacing: 0.06em;
}

.profile-rank {
  display: grid;
  min-width: 88px;
  justify-items: center;
  gap: 2px;
  padding: 9px 10px;
  border-left: 1px solid var(--line);
}

.profile-rank img {
  width: 38px;
  height: 38px;
  object-fit: contain;
  image-rendering: pixelated;
}

.profile-rank span,
.profile-level-card span,
.profile-stat-grid span,
.profile-assignment span,
.profile-footer span {
  color: var(--dim);
  font: 8px "Avenir Next Condensed", sans-serif;
  letter-spacing: 0.13em;
}

.profile-rank strong {
  color: #b7d7cf;
  font: 500 16px "Avenir Next", sans-serif;
}

.profile-body {
  display: grid;
  gap: 10px;
  padding: 16px 18px 18px;
}

.profile-level-card,
.profile-assignment,
.profile-footer {
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.12);
}

.profile-level-card {
  display: grid;
  gap: 7px;
  padding: 11px 12px;
}

.profile-level-card > div:first-child,
.profile-footer,
.profile-assignment > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.profile-level-card strong {
  color: #b9cac3;
  font: 500 11px "Avenir Next", sans-serif;
}

.profile-progress {
  height: 4px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
}

.profile-progress i {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--jade-deep), var(--jade));
  box-shadow: 0 0 12px rgba(119, 216, 201, 0.35);
  transition: width 240ms ease;
}

.profile-level-card > small {
  color: #55736d;
  font-size: 8px;
}

.profile-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}

.profile-stat-grid > div {
  display: grid;
  min-height: 82px;
  grid-template-columns: 34px minmax(0, 1fr);
  grid-template-rows: 1fr 1fr;
  align-items: center;
  column-gap: 7px;
  padding: 9px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.014);
}

.profile-stat-grid img {
  width: 34px;
  height: 34px;
  grid-row: 1 / 3;
  object-fit: contain;
  image-rendering: pixelated;
}

.profile-stat-grid strong {
  align-self: start;
  color: #cad8d2;
  font: 500 15px "Avenir Next", sans-serif;
}

.profile-assignment {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.profile-assignment > div {
  min-width: 0;
  padding: 11px 12px;
  border-right: 1px solid var(--line);
}

.profile-assignment > div strong {
  overflow: hidden;
  color: #bdcbc5;
  font-size: 10px;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-assignment > p {
  grid-column: 1 / -1;
  margin: 0;
  padding: 8px 12px;
  border-top: 1px solid var(--line);
  color: #5f7d77;
  font-size: 9px;
}

.profile-footer {
  min-height: 48px;
  padding: 7px 8px 7px 12px;
}

.profile-footer > div {
  display: grid;
  gap: 3px;
}

.profile-footer strong {
  color: #78928c;
  font: 9px "Avenir Next", sans-serif;
}

.profile-logout {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid rgba(225, 100, 85, 0.3);
  background: rgba(225, 100, 85, 0.055);
  color: #ca877e;
  font-size: 9px;
}

.profile-logout:hover {
  border-color: rgba(225, 100, 85, 0.55);
  background: rgba(225, 100, 85, 0.1);
}

.dialog-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  background: transparent;
}

/* Investigation launch sheet */
.investigation-dialog {
  width: min(820px, calc(100vw - 34px));
  max-width: none;
  padding: 0;
  overflow: hidden;
  border-color: rgba(228, 184, 93, 0.28);
  background:
    radial-gradient(circle at 4% 0%, rgba(228, 184, 93, 0.1), transparent 20rem),
    #0d181c;
}

.investigation-dialog-heading {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: center;
  gap: 15px;
  min-height: 112px;
  padding: 20px 54px 18px 22px;
  border-bottom: 1px solid var(--line);
}

.investigation-dialog-heading h2 {
  margin: 0 0 6px;
  font-size: 24px;
  letter-spacing: 0.09em;
}

.investigation-dialog-heading p:last-child {
  margin: 0;
  color: var(--dim);
  font-size: 10px;
}

.launch-region-mark {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  border: 1px solid rgba(228, 184, 93, 0.42);
  color: var(--gold);
  font-size: 23px;
  transform: rotate(-2deg);
}

.launch-config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 20px 22px;
}

.launch-config-grid label {
  display: grid;
  grid-template-rows: auto 40px minmax(30px, auto);
  gap: 7px;
  padding: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.015);
}

.launch-config-grid label > span {
  color: #aebdb6;
  font-size: 10px;
  letter-spacing: 0.1em;
}

.launch-config-grid select {
  min-height: 40px;
}

.launch-config-grid small {
  color: var(--dim);
  font-size: 9px;
  line-height: 1.55;
}

.launch-summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  background: rgba(228, 184, 93, 0.035);
}

.launch-summary > span {
  padding: 5px 7px;
  border: 1px solid rgba(228, 184, 93, 0.28);
  color: var(--gold);
  font-size: 9px;
}

.launch-summary strong {
  overflow: hidden;
  color: #c6d1cb;
  font-size: 10px;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Character development overlay */
.character-dialog {
  width: min(1180px, calc(100vw - 34px));
  height: min(790px, calc(100dvh - 34px));
  max-width: none;
  max-height: none;
  padding: 0;
  overflow: hidden;
  border-color: rgba(119, 216, 201, 0.22);
  background:
    radial-gradient(circle at 12% 14%, rgba(119, 216, 201, 0.08), transparent 24rem),
    #0d181c;
}

.character-dialog[open] {
  display: grid;
  grid-template-rows: 112px 44px minmax(0, 1fr);
}

.character-dialog-heading {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 12px 62px 12px 20px;
  border-bottom: 1px solid var(--line);
}

.character-dialog-portrait {
  width: 76px;
  height: 94px;
  color: var(--character-accent, var(--jade));
  filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.36));
}

.character-dialog-heading h2 {
  margin: 0 0 5px;
  font-size: 25px;
  font-weight: 400;
  letter-spacing: 0.12em;
}

.character-dialog-heading > div:nth-child(2) > p:last-child {
  margin: 0;
  color: var(--dim);
  font-size: 10px;
  letter-spacing: 0.06em;
}

.character-level-stamp {
  display: grid;
  min-width: 92px;
  gap: 3px;
  padding: 10px 13px;
  border-left: 1px solid var(--line);
}

.character-level-stamp span {
  color: var(--dim);
  font-size: 9px;
  letter-spacing: 0.12em;
}

.character-level-stamp strong {
  color: var(--jade);
  font: 19px "Avenir Next", sans-serif;
}

.character-dialog-tabs {
  display: flex;
  padding-left: 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 11, 14, 0.35);
}

.character-tab {
  min-width: 130px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--dim);
  font-size: 11px;
  letter-spacing: 0.1em;
}

.character-tab:first-child {
  border-left: 1px solid var(--line);
}

.character-tab.is-active {
  color: var(--paper);
  box-shadow: inset 0 -2px var(--jade);
  background: rgba(119, 216, 201, 0.035);
}

.character-dialog-body {
  min-height: 0;
  overflow: hidden;
}

.character-pane {
  display: none;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: auto;
  padding: 20px;
}

.character-pane.is-active {
  display: block;
}

.growth-overview {
  display: grid;
  max-width: 860px;
  grid-template-columns: 130px 1fr;
  align-items: center;
  gap: 24px;
  margin: 18px auto 26px;
}

.growth-ring {
  position: relative;
  display: grid;
  width: 118px;
  height: 118px;
  place-items: center;
  align-content: center;
  gap: 3px;
  border: 1px solid rgba(119, 216, 201, 0.34);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(119, 216, 201, 0.08), transparent 67%);
  box-shadow: 0 0 0 9px rgba(119, 216, 201, 0.025), inset 0 0 28px rgba(119, 216, 201, 0.055);
}

.growth-ring::before,
.growth-ring::after {
  position: absolute;
  width: 7px;
  height: 7px;
  border: 1px solid var(--jade);
  content: "";
  transform: rotate(45deg);
}

.growth-ring::before {
  top: 4px;
}

.growth-ring::after {
  bottom: 4px;
}

.growth-ring span {
  color: var(--jade);
  font: 31px "Avenir Next", sans-serif;
}

.growth-ring small {
  color: var(--dim);
  font-size: 9px;
  letter-spacing: 0.1em;
}

.growth-overview h3 {
  margin: 0 0 8px;
  font-size: 19px;
  font-weight: 400;
}

.growth-overview > div:last-child > p:last-child {
  max-width: 560px;
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.7;
}

.character-stat-grid {
  display: grid;
  max-width: 860px;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
  margin: 0 auto 16px;
}

.character-stat-grid > div {
  display: grid;
  min-height: 86px;
  align-content: center;
  gap: 5px;
  padding: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.018);
}

.character-stat-grid span,
.character-stat-grid small {
  color: var(--dim);
  font-size: 8px;
}

.character-stat-grid strong {
  font: 16px "Avenir Next", sans-serif;
  font-weight: 500;
}

.growth-action {
  display: grid;
  max-width: 860px;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
  margin: 0 auto;
  padding: 15px;
  border: 1px solid rgba(228, 184, 93, 0.22);
  background: rgba(228, 184, 93, 0.025);
}

.growth-action > div {
  display: grid;
  gap: 4px;
}

.growth-action span,
.growth-action small {
  color: var(--dim);
  font-size: 9px;
}

.growth-action strong {
  font-size: 12px;
  font-weight: 500;
}

.growth-action .primary-button {
  min-width: 128px;
  min-height: 40px;
}

.character-attributes-pane {
  background:
    linear-gradient(rgba(228, 184, 93, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(228, 184, 93, 0.018) 1px, transparent 1px);
  background-size: 32px 32px;
}

.attribute-panel-heading {
  display: flex;
  max-width: 1080px;
  align-items: end;
  justify-content: space-between;
  gap: 30px;
  margin: 0 auto 14px;
  padding: 4px 2px 13px;
  border-bottom: 1px solid rgba(228, 184, 93, 0.2);
}

.attribute-panel-heading h3 {
  margin: 2px 0 0;
  font-size: 19px;
  font-weight: 400;
  letter-spacing: 0.08em;
}

.attribute-panel-heading > p:last-child {
  max-width: 490px;
  margin: 0;
  color: var(--dim);
  font-size: 9px;
  line-height: 1.6;
  text-align: right;
}

.attribute-panel-heading > p:last-child i {
  display: inline-block;
  width: 5px;
  height: 5px;
  margin: 0 6px 1px 0;
  border-radius: 50%;
  background: var(--jade);
  box-shadow: 0 0 8px rgba(119, 216, 201, 0.5);
}

.attribute-groups {
  display: grid;
  max-width: 1080px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 10px;
  margin: 0 auto;
}

.attribute-group {
  overflow: hidden;
  border: 1px solid rgba(228, 184, 93, 0.16);
  border-radius: 3px 8px 3px 7px;
  background: rgba(15, 23, 22, 0.88);
  box-shadow: 0 7px 18px rgba(0, 0, 0, 0.16);
}

.attribute-group-heading {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  padding: 7px 11px;
  border-bottom: 1px solid rgba(228, 184, 93, 0.15);
  background: linear-gradient(90deg, rgba(164, 106, 44, 0.14), transparent 60%);
}

.attribute-group-heading > div {
  display: grid;
  gap: 2px;
}

.attribute-group-heading span {
  color: #e7d5a2;
  font-size: 11px;
  letter-spacing: 0.12em;
}

.attribute-group-heading small {
  color: rgba(215, 200, 156, 0.38);
  font: 7px "Avenir Next", sans-serif;
  letter-spacing: 0.22em;
}

.attribute-group-heading b {
  color: rgba(228, 184, 93, 0.28);
  font: 18px "Baskerville", serif;
  font-weight: 400;
}

.attribute-list {
  display: grid;
}

.attribute-row {
  position: relative;
  display: grid;
  min-height: 53px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 8px 11px 8px 14px;
  border-bottom: 1px solid rgba(224, 213, 179, 0.065);
}

.attribute-row:last-child {
  border-bottom: 0;
}

.attribute-row::before {
  position: absolute;
  left: 5px;
  width: 2px;
  height: 15px;
  background: rgba(228, 184, 93, 0.2);
  content: "";
}

.attribute-row.is-modified::before {
  background: var(--jade);
  box-shadow: 0 0 7px rgba(119, 216, 201, 0.45);
}

.attribute-name,
.attribute-reading {
  display: grid;
  gap: 3px;
}

.attribute-name span {
  color: #d9d3bc;
  font-size: 10px;
  letter-spacing: 0.05em;
}

.attribute-name small,
.attribute-reading small {
  color: var(--dim);
  font-size: 8px;
}

.attribute-reading {
  min-width: 128px;
  justify-items: end;
}

.attribute-reading strong {
  color: #f1e9ce;
  font: 15px "Avenir Next", sans-serif;
  font-weight: 500;
  letter-spacing: 0.03em;
}

.attribute-reading em {
  margin-left: 4px;
  color: var(--jade);
  font-style: normal;
}

.character-pane[data-character-pane="loadout"].is-active {
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(430px, 1.1fr);
  gap: 14px;
}

.loadout-column {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.012);
}

.character-section-heading {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
}

.character-section-heading span {
  font-size: 11px;
  letter-spacing: 0.1em;
}

.character-section-heading small {
  color: var(--dim);
  font-size: 8px;
}

.character-loadout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  padding: 10px;
}

.loadout-slot,
.loadout-module,
.available-equipment {
  display: grid;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.018);
}

.loadout-slot {
  min-height: 75px;
  grid-template-columns: 45px minmax(0, 1fr) auto;
  padding: 7px;
}

.loadout-slot-icon,
.available-icon {
  width: 42px;
  height: 52px;
  color: var(--muted);
}

.loadout-slot.is-equipped .loadout-slot-icon {
  color: var(--jade);
}

.loadout-slot.is-empty {
  border-style: dashed;
  background: rgba(9, 12, 11, 0.28);
  box-shadow: inset 0 0 0 1px rgba(164, 177, 169, 0.04);
}

.loadout-slot.is-empty .loadout-slot-icon {
  opacity: 0.2;
  filter: grayscale(1);
}

.loadout-slot.is-empty strong {
  color: #6f7c77;
}

.loadout-slot > div:nth-child(2),
.loadout-module > div:nth-child(2),
.available-equipment > div:nth-child(2) {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.loadout-slot small,
.loadout-module small,
.available-equipment small {
  color: var(--dim);
  font-size: 8px;
}

.loadout-slot strong,
.loadout-module strong,
.available-equipment strong {
  overflow: hidden;
  font-size: 10px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.loadout-slot > span {
  color: var(--dim);
  font-size: 9px;
}

.loadout-slot .loadout-empty-state {
  padding: 3px 5px;
  border: 1px solid rgba(146, 160, 153, 0.16);
  color: #66736e;
  letter-spacing: 0.06em;
}

.loadout-slot button,
.loadout-module button,
.available-equipment button {
  min-height: 28px;
  padding: 0 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 9px;
}

.loadout-slot button:hover,
.loadout-module button:hover,
.available-equipment button:hover {
  border-color: rgba(119, 216, 201, 0.4);
  color: var(--jade);
}

.character-module-slot {
  padding: 10px;
}

.loadout-module {
  min-height: 82px;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  padding: 8px;
}

.loadout-module span,
.available-equipment span {
  overflow: hidden;
  color: var(--dim);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.character-equipment-list,
.character-module-list {
  display: grid;
  gap: 6px;
  padding: 10px;
}

.available-equipment {
  min-height: 68px;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  padding: 7px;
}

.character-empty {
  min-height: 70px;
  align-content: center;
  padding: 16px;
  border: 1px dashed var(--line);
  color: var(--dim);
  font-size: 9px;
  text-align: center;
}

@media (max-width: 1180px) {
  :root {
    --rail-width: 68px;
  }

  .topbar {
    grid-template-columns: minmax(190px, 0.8fr) minmax(210px, 1fr) auto;
  }

  .resource-strip {
    display: none;
  }

  .character-roster {
    grid-template-columns: repeat(3, minmax(140px, 1fr));
  }

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

  .inventory-grid {
    grid-template-columns: repeat(3, minmax(220px, 1fr));
  }

  .policy-fields {
    grid-template-columns: repeat(3, 1fr);
  }

  .tactic-row {
    grid-template-columns: 125px 1fr 1fr;
  }

  .tactic-row > label:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 900px) {
  :root {
    --header-height: 58px;
    --rail-width: 0px;
  }

  .game-shell {
    grid-template-columns: 1fr;
    grid-template-rows: var(--header-height) minmax(0, 1fr) 62px;
  }

  .topbar {
    grid-column: 1;
    grid-template-columns: minmax(170px, 0.9fr) minmax(160px, 1fr) auto;
    gap: 10px;
    padding: 0 10px;
  }

  .brand-seal {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
    font-size: 18px;
  }

  .eyebrow {
    display: none;
  }

  h1 {
    font-size: 15px;
  }

  .mission {
    padding-left: 10px;
  }

  .account-button {
    min-width: 128px;
    max-width: 152px;
  }

  .nav-rail {
    grid-row: 3;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    padding: 4px 7px;
    border-top: 1px solid var(--line);
    border-right: 0;
  }

  .nav-button {
    height: 52px;
  }

  .nav-button::before {
    top: auto;
    right: 20%;
    bottom: -5px;
    left: 20%;
    width: auto;
    height: 2px;
  }

  .feedback-button {
    display: none;
  }

  .view-stack {
    grid-row: 2;
  }

  .battle-layout {
    grid-template-columns: minmax(0, 1fr);
    padding: 8px;
  }

  .intel-panel {
    display: none;
  }

  .world-grid,
  .roster-layout,
  .teams-layout {
    grid-template-columns: 1fr;
  }

  .team-index-panel,
  .team-editor-panel {
    min-height: auto;
  }

  .team-list {
    grid-template-columns: repeat(2, 1fr);
  }

  .world-side {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto;
  }

  .character-roster {
    grid-template-columns: repeat(3, 1fr);
  }

  .inventory-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .craft-grid,
  .living-world-grid {
    grid-template-columns: 1fr;
  }

  .tactic-row {
    grid-template-columns: 110px 1fr;
  }

  .tactic-ability-rule.ultimate-rule {
    grid-column: 2;
  }

  .tactic-row > label:last-child {
    grid-column: 2;
  }

  .anomaly-track {
    grid-template-columns: repeat(4, 1fr);
  }

  .character-pane[data-character-pane="loadout"].is-active {
    grid-template-columns: 1fr 1fr;
  }

  .attribute-groups {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .mission {
    display: none;
  }

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

  .version-lockup {
    width: 48px;
  }

  .profile-dialog {
    width: calc(100vw - 16px);
  }

  .profile-heading {
    grid-template-columns: 70px minmax(0, 1fr);
    gap: 10px;
    padding: 10px 42px 10px 10px;
  }

  .profile-portrait {
    width: 68px;
    height: 90px;
  }

  .profile-rank {
    grid-column: 1 / -1;
    grid-template-columns: 34px auto 1fr;
    justify-items: start;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .profile-rank img {
    width: 32px;
    height: 32px;
    grid-row: 1 / 3;
  }

  .profile-rank strong {
    grid-column: 2;
  }

  .profile-stat-grid {
    grid-template-columns: 1fr 1fr;
  }

  .profile-assignment {
    grid-template-columns: 1fr;
  }

  .profile-assignment > div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav-button svg {
    width: 19px;
    height: 19px;
  }

  .nav-button span {
    font-size: 9px;
  }

  .view-scroll {
    padding: 13px 10px 24px;
  }

  .view-heading {
    min-height: 48px;
    align-items: center;
  }

  .view-heading > p,
  .tactic-savebar > small {
    display: none;
  }

  .view-heading h2 {
    font-size: 18px;
  }

  .stage-card {
    grid-template-rows: 49px minmax(150px, 1fr) 44px 178px;
  }

  .battle-meta > div {
    min-width: 68px;
    padding-left: 8px;
  }

  .battle-meta > div:last-child {
    display: none;
  }

  .hero-cards {
    grid-template-columns: repeat(5, 142px);
  }

  .playback-controls .speed-button:first-child,
  .auto-switch {
    display: none;
  }

  .segmented-bar {
    gap: 3px;
  }

  .team-battle-hud {
    top: 8px;
    left: 8px;
    width: min(184px, 48%);
  }

  .team-resource {
    gap: 5px;
    padding: 6px 8px 7px;
  }

  .team-status-strip {
    min-height: 16px;
  }

  .gensokyo-map {
    min-height: 440px;
  }

  .region-node {
    min-width: 140px;
  }

  .region-icon {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
  }

  .world-side,
  .character-roster,
  .inventory-grid,
  .module-grid,
  .policy-fields,
  .daily-event-list,
  .dream-modifiers {
    grid-template-columns: 1fr;
  }

  .team-list,
  .team-editor-panel .party-editor {
    grid-template-columns: 1fr;
  }

  .team-editor-panel .party-slot-editor {
    min-height: 94px;
    grid-template-columns: 28px minmax(0, 1fr) 54px;
    grid-template-rows: 1fr;
    align-items: center;
  }

  .team-editor-actions {
    flex-wrap: wrap;
  }

  .team-editor-actions .danger-button {
    margin-right: 0;
  }

  .investigation-dialog {
    width: calc(100vw - 16px);
  }

  .launch-config-grid {
    grid-template-columns: 1fr;
    max-height: calc(100dvh - 230px);
    overflow-y: auto;
  }

  .launch-summary {
    grid-template-columns: 1fr auto;
  }

  .launch-summary > span {
    display: none;
  }

  .character-roster {
    grid-template-columns: repeat(2, 1fr);
  }

  .character-card {
    min-height: 205px;
  }

  .craft-grid {
    display: block;
  }

  .craft-grid > .panel + .panel {
    margin-top: 14px;
  }

  .tactic-savebar label {
    display: none;
  }

  .tactic-row {
    grid-template-columns: 1fr;
  }

  .tactic-hero,
  .tactic-ability-rule.ultimate-rule,
  .tactic-row > label:last-child {
    grid-column: 1;
  }

  .tactic-rule-line {
    grid-template-columns: 20px 1fr;
  }

  .tactic-rule-line select:nth-of-type(2),
  .tactic-rule-line select:nth-of-type(3),
  .rule-actions {
    grid-column: 2;
  }

  .anomaly-track {
    grid-template-columns: repeat(2, 1fr);
  }

  .account-strip {
    display: none;
  }

  .warehouse-filters {
    grid-template-columns: 1fr 1fr;
  }

  .warehouse-filters > div {
    grid-column: 1 / -1;
  }

  .character-dialog {
    width: calc(100vw - 16px);
    height: calc(100dvh - 16px);
  }

  .character-dialog-heading {
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 10px;
    padding: 8px 42px 8px 10px;
  }

  .character-dialog-portrait {
    width: 55px;
    height: 73px;
  }

  .character-dialog-heading h2 {
    font-size: 19px;
  }

  .character-dialog-tabs {
    padding-left: 0;
  }

  .character-tab {
    min-width: 0;
    flex: 1;
    padding: 0 4px;
    font-size: 9px;
  }

  .character-level-stamp {
    display: none;
  }

  .character-pane {
    padding: 10px;
  }

  .growth-overview {
    grid-template-columns: 90px 1fr;
    gap: 14px;
    margin-top: 4px;
  }

  .growth-ring {
    width: 82px;
    height: 82px;
  }

  .growth-ring span {
    font-size: 23px;
  }

  .character-stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .growth-action {
    grid-template-columns: 1fr;
  }

  .attribute-panel-heading {
    display: grid;
    gap: 8px;
  }

  .attribute-panel-heading > p:last-child {
    text-align: left;
  }

  .attribute-row {
    grid-template-columns: minmax(0, 1fr) minmax(105px, auto);
    gap: 6px;
    padding-right: 8px;
  }

  .attribute-reading {
    min-width: 0;
  }

  .character-pane[data-character-pane="loadout"].is-active {
    display: block;
    overflow-y: auto;
  }

  .loadout-column {
    overflow: visible;
  }

  .loadout-column + .loadout-column {
    margin-top: 10px;
  }

  .character-loadout {
    grid-template-columns: 1fr;
  }
}

/* Keep the diorama's authored layers in charge after the legacy field-skin
 * declarations above. These pseudo layers only appear while walking forward. */
.battlefield::before,
.battlefield::after {
  z-index: 1;
  right: -8%;
  bottom: -7%;
  left: -8%;
  height: 35%;
  opacity: 0;
  background: repeating-linear-gradient(174deg, color-mix(in srgb, var(--scene-accent) 34%, transparent) 0 1px, transparent 1px 12px);
  clip-path: none;
  filter: none;
  content: "";
  pointer-events: none;
}

.battlefield.is-wave-advancing::after {
  opacity: 0.3;
  animation: battlefield-ground-retreat 260ms linear infinite;
}

/* Switchable battle dioramas -------------------------------------------------
 * The Phaser canvas only owns characters and combat effects. Everything below
 * it is a scene module selected through data-battle-scene, so new regions can
 * be added without touching formation or movement code. */
.battlefield {
  --scene-accent: #91d4cf;
  --scene-dark: #101b1c;
  --scene-mid: #32494b;
  --scene-horizon: #8aa3a0;
  --scene-ground: #172321;
  --scene-ground-light: #344a42;
  --scene-water: rgba(109, 177, 184, 0.38);
  --scene-mist: rgba(202, 225, 216, 0.18);
  --scene-landmark: #6f322c;
  background:
    radial-gradient(ellipse at 68% 28%, var(--ambient), transparent 27%),
    linear-gradient(170deg, var(--sky-top), var(--sky-mid) 57%, var(--sky-bottom));
}

.battlefield[data-battle-scene="misty-lake"] {
  --scene-accent: #91d4cf;
}

.battlefield[data-battle-scene="magic-forest"] {
  --scene-accent: #c7df78;
  --scene-dark: #0a1814;
  --scene-mid: #223b2d;
  --scene-horizon: #6c8066;
  --scene-ground: #101c17;
  --scene-ground-light: #304533;
  --scene-water: rgba(93, 143, 107, 0.2);
  --scene-mist: rgba(177, 207, 151, 0.14);
  --scene-landmark: #d7b96f;
}

.battlefield[data-battle-scene="youkai-mountain"] {
  --scene-accent: #efb469;
  --scene-dark: #17191a;
  --scene-mid: #4b4944;
  --scene-horizon: #a79676;
  --scene-ground: #252722;
  --scene-ground-light: #57533f;
  --scene-water: rgba(198, 179, 135, 0.13);
  --scene-mist: rgba(236, 225, 198, 0.17);
  --scene-landmark: #943f2c;
}

.battle-map,
.battle-map > * {
  position: absolute;
  pointer-events: none;
}

.battle-celestial i,
.battle-water > i,
.battle-ground > i,
.battle-path > i,
.battle-landmark-torii > i,
.battle-landmark-mushrooms > i,
.battle-reeds > i {
  position: absolute;
}

.battle-map {
  z-index: 0;
  inset: 0;
  overflow: hidden;
  opacity: 1;
  transform: scale(1.001);
  transition: opacity 420ms ease, filter 420ms ease;
}

.battlefield.is-scene-changing .battle-map {
  opacity: 0.26;
  filter: blur(5px);
}

.battle-sky {
  inset: 0 0 42%;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 72% 32%, color-mix(in srgb, var(--celestial) 18%, transparent), transparent 19%),
    linear-gradient(180deg, color-mix(in srgb, var(--scene-dark) 54%, transparent), transparent 74%);
}

.battle-cloud {
  width: 31%;
  height: 9%;
  border-radius: 50%;
  opacity: 0.2;
  background: linear-gradient(90deg, transparent, var(--scene-horizon), transparent);
  filter: blur(7px);
  animation: battle-cloud-drift 30s linear infinite;
}

.battle-cloud.cloud-one { top: 20%; left: 6%; }
.battle-cloud.cloud-two { top: 34%; left: 46%; width: 42%; animation-duration: 38s; animation-direction: reverse; }
.battle-cloud.cloud-three { top: 9%; left: 72%; width: 21%; animation-duration: 24s; }

.battle-celestial {
  top: 10%;
  right: 14%;
  width: clamp(58px, 6.2vw, 92px);
  aspect-ratio: 1;
  border-radius: 50%;
  opacity: 0.72;
  background: var(--celestial);
  box-shadow: 0 0 18px var(--celestial-glow), 0 0 68px var(--celestial-glow);
}

.battle-celestial::after {
  position: absolute;
  inset: 12% 15% auto auto;
  width: 22%;
  aspect-ratio: 1.8;
  border-radius: 50%;
  background: color-mix(in srgb, var(--sky-mid) 32%, transparent);
  content: "";
  transform: rotate(-18deg);
}

.battle-celestial i {
  right: 50%;
  bottom: -124%;
  width: 1px;
  height: 112%;
  opacity: 0.3;
  background: linear-gradient(var(--celestial), transparent);
  box-shadow: 9px 0 var(--celestial-glow), -11px 0 var(--celestial-glow);
}

.battle-mountains {
  right: -4%;
  bottom: 36%;
  left: -4%;
  height: 49%;
  transform-origin: bottom;
}

.mountain-far {
  opacity: 0.34;
  background: color-mix(in srgb, var(--scene-mid) 74%, var(--sky-mid));
  clip-path: polygon(0 100%, 0 77%, 8% 63%, 15% 70%, 23% 34%, 29% 51%, 35% 42%, 42% 70%, 53% 50%, 61% 61%, 70% 25%, 78% 54%, 84% 43%, 93% 65%, 100% 51%, 100% 100%);
  filter: blur(1px);
}

.mountain-near {
  bottom: 31%;
  height: 37%;
  opacity: 0.86;
  background: linear-gradient(180deg, var(--scene-mid), var(--scene-dark));
  clip-path: polygon(0 100%, 0 48%, 7% 36%, 15% 53%, 23% 22%, 31% 54%, 42% 35%, 53% 68%, 63% 46%, 70% 62%, 81% 31%, 89% 56%, 100% 40%, 100% 100%);
  filter: drop-shadow(0 -8px 18px rgba(3, 8, 8, 0.24));
}

.battle-water {
  right: -4%;
  bottom: 10%;
  left: -4%;
  height: 38%;
  opacity: 0.9;
  background:
    linear-gradient(180deg, rgba(206, 229, 221, 0.08), transparent 18%),
    linear-gradient(180deg, var(--scene-water), color-mix(in srgb, var(--scene-dark) 66%, transparent));
  clip-path: polygon(0 13%, 100% 0, 100% 100%, 0 100%);
}

.battle-water > i {
  right: 0;
  left: 0;
  height: 1px;
  opacity: 0.44;
  background: repeating-linear-gradient(90deg, transparent 0 7%, var(--scene-accent) 10% 18%, transparent 21% 31%);
  animation: battle-water-shimmer 7s ease-in-out infinite alternate;
}

.battle-water > i:nth-child(1) { top: 24%; }
.battle-water > i:nth-child(2) { top: 43%; transform: scaleX(0.76); animation-delay: -3s; }
.battle-water > i:nth-child(3) { top: 68%; transform: scaleX(1.18); animation-delay: -5s; }

.battle-ground {
  z-index: 1;
  right: -8%;
  bottom: -4%;
  left: -8%;
  height: 39%;
  background:
    radial-gradient(ellipse at 52% 0, color-mix(in srgb, var(--scene-ground-light) 62%, transparent), transparent 58%),
    repeating-linear-gradient(172deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 13px),
    var(--scene-ground);
  clip-path: polygon(0 19%, 18% 9%, 40% 14%, 63% 4%, 82% 11%, 100% 0, 100% 100%, 0 100%);
}

.battle-ground > i {
  bottom: 7%;
  left: 12%;
  width: 12%;
  height: 24%;
  border-radius: 50%;
  opacity: 0.15;
  border-top: 1px solid var(--scene-accent);
  transform: rotate(-8deg);
}

.battle-ground > i:nth-child(2) { bottom: 21%; left: 72%; width: 18%; transform: rotate(7deg); }
.battle-ground > i:nth-child(3) { bottom: 1%; left: 48%; width: 22%; }

.battle-path {
  z-index: 2;
  right: 2%;
  bottom: -4%;
  left: 2%;
  height: 34%;
  opacity: 0.74;
  background:
    repeating-linear-gradient(92deg, transparent 0 8%, rgba(225, 224, 193, 0.08) 8.5% 9%, transparent 9.5% 17%),
    linear-gradient(180deg, transparent, color-mix(in srgb, var(--scene-ground-light) 76%, transparent));
  clip-path: polygon(45% 0, 58% 0, 84% 100%, 7% 100%);
}

.battle-path > i {
  right: 12%;
  bottom: 23%;
  left: 10%;
  height: 1px;
  opacity: 0.24;
  background: linear-gradient(90deg, transparent, var(--scene-accent), transparent);
}

.battle-path > i:nth-child(2) { right: 4%; bottom: 54%; left: 27%; }

.battle-treeline {
  z-index: 1;
  bottom: 27%;
  left: -2%;
  width: 41%;
  height: 46%;
  background: var(--scene-dark);
  clip-path: polygon(0 100%, 0 34%, 5% 42%, 8% 10%, 11% 44%, 15% 20%, 18% 49%, 23% 3%, 26% 47%, 31% 15%, 35% 51%, 42% 28%, 46% 57%, 53% 8%, 57% 51%, 63% 24%, 69% 61%, 78% 13%, 82% 58%, 91% 29%, 100% 64%, 100% 100%);
  filter: drop-shadow(9px 5px 12px rgba(0, 0, 0, 0.24));
}

.treeline-back { left: auto; right: -4%; transform: scaleX(-1); opacity: 0.82; }
.treeline-front { bottom: 18%; opacity: 0.94; }

.battle-landmark-torii {
  z-index: 1;
  right: 8%;
  bottom: 35%;
  width: clamp(100px, 11vw, 158px);
  height: clamp(76px, 9vw, 118px);
  opacity: 0.76;
  filter: drop-shadow(5px 8px 5px rgba(0, 0, 0, 0.45));
}

.battle-landmark-torii i { display: block; background: var(--scene-landmark); }
.battle-landmark-torii i:nth-child(1) { top: 10%; left: 0; width: 100%; height: 7%; clip-path: polygon(4% 0, 96% 0, 100% 60%, 89% 100%, 11% 100%, 0 60%); }
.battle-landmark-torii i:nth-child(2) { top: 24%; left: 9%; width: 82%; height: 5%; }
.battle-landmark-torii i:nth-child(3) { top: 8%; bottom: 0; left: 24%; width: 7%; transform: skewX(-2deg); }
.battle-landmark-torii i:nth-child(4) { top: 8%; right: 24%; bottom: 0; width: 7%; transform: skewX(2deg); }

.battle-landmark-mushrooms {
  z-index: 3;
  right: 5%;
  bottom: 17%;
  display: none;
  width: 25%;
  height: 29%;
}

.battle-landmark-mushrooms i {
  bottom: 0;
  width: 5%;
  height: 54%;
  border-radius: 40% 40% 0 0;
  background: color-mix(in srgb, var(--scene-landmark) 74%, white);
  box-shadow: 0 0 16px color-mix(in srgb, var(--scene-accent) 38%, transparent);
}

.battle-landmark-mushrooms i::before {
  position: absolute;
  bottom: 72%;
  left: 50%;
  width: 430%;
  aspect-ratio: 2;
  border-radius: 90% 90% 28% 28%;
  background: radial-gradient(circle at 50% 35%, #fff7c0, var(--scene-landmark) 35%, #71504a 78%);
  content: "";
  transform: translateX(-50%);
}

.battle-landmark-mushrooms i:nth-child(1) { left: 8%; height: 38%; }
.battle-landmark-mushrooms i:nth-child(2) { left: 29%; height: 64%; transform: scale(1.25); }
.battle-landmark-mushrooms i:nth-child(3) { left: 52%; height: 33%; transform: scale(0.75); }
.battle-landmark-mushrooms i:nth-child(4) { left: 70%; height: 48%; }
.battle-landmark-mushrooms i:nth-child(5) { left: 89%; height: 27%; transform: scale(0.7); }

.battle-reeds {
  z-index: 4;
  bottom: 0;
  left: 0;
  width: 14%;
  height: 36%;
}

.reeds-right { right: 0; left: auto; transform: scaleX(-1); }

.battle-reeds i {
  bottom: -5%;
  left: 12%;
  width: 2px;
  height: 74%;
  border-radius: 100% 0 0;
  background: linear-gradient(transparent, color-mix(in srgb, var(--scene-accent) 55%, #1f352e));
  transform: rotate(-16deg);
  transform-origin: bottom;
}

.battle-reeds i::after {
  position: absolute;
  top: 5%;
  left: -2px;
  width: 6px;
  height: 18%;
  border-radius: 60%;
  background: #49382c;
  content: "";
}

.battle-reeds i:nth-child(2) { left: 31%; height: 94%; transform: rotate(-7deg); }
.battle-reeds i:nth-child(3) { left: 50%; height: 68%; transform: rotate(5deg); }
.battle-reeds i:nth-child(4) { left: 69%; height: 86%; transform: rotate(11deg); }
.battle-reeds i:nth-child(5) { left: 87%; height: 57%; transform: rotate(16deg); }

.battle-mist {
  z-index: 3;
  left: -16%;
  width: 58%;
  height: 16%;
  border-radius: 50%;
  background: radial-gradient(ellipse, var(--scene-mist), transparent 70%);
  filter: blur(8px);
  animation: battle-mist-drift 12s ease-in-out infinite alternate;
}

.mist-one { bottom: 27%; }
.mist-two { right: -10%; bottom: 12%; left: auto; width: 72%; animation-delay: -6s; animation-direction: alternate-reverse; }

.battle-foreground {
  z-index: 4;
  bottom: -3%;
  left: -4%;
  width: 23%;
  height: 34%;
  opacity: 0.9;
  background: var(--scene-dark);
  clip-path: polygon(0 100%, 0 28%, 18% 43%, 29% 10%, 38% 46%, 52% 22%, 58% 51%, 75% 14%, 82% 55%, 100% 38%, 100% 100%);
}

.foreground-right { right: -4%; left: auto; transform: scaleX(-1); }

.battle-scene-vignette {
  z-index: 5;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(4, 9, 8, 0.48), transparent 12%, transparent 86%, rgba(4, 9, 8, 0.42)),
    linear-gradient(180deg, rgba(5, 8, 8, 0.18), transparent 34%, rgba(4, 7, 6, 0.42));
  box-shadow: inset 0 0 42px rgba(2, 5, 4, 0.28);
}

.battle-scene-caption {
  position: absolute;
  z-index: 8;
  right: 14px;
  bottom: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 9px 5px 7px;
  border-right: 2px solid color-mix(in srgb, var(--scene-accent) 58%, transparent);
  color: rgba(222, 231, 221, 0.64);
  background: linear-gradient(90deg, transparent, rgba(8, 13, 12, 0.58));
  font: 9px "Noto Serif SC", "Songti SC", serif;
  letter-spacing: 0.09em;
  transition: opacity 220ms ease, transform 280ms ease;
}

.battle-scene-caption span {
  color: color-mix(in srgb, var(--scene-accent) 76%, white);
  font: 8px "Avenir Next Condensed", sans-serif;
  letter-spacing: 0.18em;
}

.battle-scene-caption strong { font-weight: 500; }

.battlefield.is-scene-changing .battle-scene-caption {
  opacity: 0;
  transform: translateX(8px);
}

.battlefield[data-battle-scene="magic-forest"] .battle-water { opacity: 0.23; }
.battlefield[data-battle-scene="magic-forest"] .battle-landmark-torii,
.battlefield[data-battle-scene="magic-forest"] .battle-reeds { display: none; }
.battlefield[data-battle-scene="magic-forest"] .battle-landmark-mushrooms { display: block; }
.battlefield[data-battle-scene="magic-forest"] .battle-treeline { width: 55%; height: 62%; bottom: 18%; }
.battlefield[data-battle-scene="magic-forest"] .battle-celestial { opacity: 0.28; filter: hue-rotate(55deg); }

.battlefield[data-battle-scene="youkai-mountain"] .battle-water { opacity: 0.14; }
.battlefield[data-battle-scene="youkai-mountain"] .battle-reeds { display: none; }
.battlefield[data-battle-scene="youkai-mountain"] .battle-landmark-torii { right: 10%; bottom: 31%; opacity: 0.9; transform: scale(1.12); }
.battlefield[data-battle-scene="youkai-mountain"] .mountain-far { transform: scaleY(1.28); opacity: 0.52; }
.battlefield[data-battle-scene="youkai-mountain"] .mountain-near { transform: scaleY(1.15); }
.battlefield[data-battle-scene="youkai-mountain"] .battle-path { opacity: 0.96; }

.battlefield::before {
  z-index: 1;
  right: -8%;
  bottom: -7%;
  left: -8%;
  height: 35%;
  opacity: 0;
  background: repeating-linear-gradient(174deg, color-mix(in srgb, var(--scene-accent) 26%, transparent) 0 1px, transparent 1px 12px);
  clip-path: none;
  filter: none;
  content: "";
  pointer-events: none;
}

.battlefield::after {
  z-index: 1;
  right: -8%;
  bottom: -7%;
  left: -8%;
  height: 35%;
  opacity: 0;
  background: repeating-linear-gradient(174deg, color-mix(in srgb, var(--scene-accent) 34%, transparent) 0 1px, transparent 1px 12px);
  content: "";
  pointer-events: none;
}

.battlefield.is-wave-advancing .battle-map {
  animation: battle-map-advance 520ms linear infinite;
}

.battlefield.is-wave-advancing .battle-mist,
.battlefield.is-wave-advancing .battle-cloud {
  animation-duration: 1.3s;
}

.battlefield.is-wave-advancing::after {
  opacity: 0.3;
  animation: battlefield-ground-retreat 260ms linear infinite;
}

.formation-axis {
  z-index: 6;
  bottom: 5%;
  opacity: 0.48;
}

@keyframes battle-cloud-drift {
  50% { transform: translateX(14%); }
}

@keyframes battle-water-shimmer {
  50% { opacity: 0.8; transform: translateX(3%); }
}

@keyframes battle-mist-drift {
  to { opacity: 0.62; transform: translateX(24%) scaleX(1.1); }
}

@keyframes battle-map-advance {
  50% { transform: translateX(-0.7%) scale(1.012); }
}

@media (prefers-reduced-motion: reduce) {
  .battle-cloud,
  .battle-water > i,
  .battle-mist,
  .battlefield.is-wave-advancing .battle-map {
    animation: none;
  }
}

@media (max-width: 720px) {
  .battle-scene-caption {
    right: 8px;
    bottom: 8px;
  }

  .battle-scene-caption span { display: none; }
  .battle-landmark-torii { right: 4%; transform: scale(0.8); transform-origin: right bottom; }
  .battle-reeds { width: 18%; }
}

@media (max-height: 720px) and (min-width: 901px) {
  .stage-card {
    grid-template-rows: 50px minmax(150px, 1fr) 44px 154px;
  }

  .command-dock {
    grid-template-rows: 25px minmax(0, 1fr);
  }

  .hero-identity {
    height: 45px;
  }

  .hero-mini-glyph {
    width: 31px;
    height: 36px;
  }

  .skill-button {
    min-height: 26px;
  }
}

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

/* ========================================================================== */
/* Five-phase Gensokyo field skin                                              */
/* ========================================================================== */

:root {
  --theme-color: #171b19;
  --ink: #161714;
  --ink-2: #22231e;
  --ink-3: #2c2b23;
  --panel: rgba(36, 35, 29, 0.94);
  --paper: #f2e5c5;
  --muted: #b7aa8b;
  --dim: #817861;
  --line: rgba(255, 237, 188, 0.1);
  --line-strong: rgba(255, 226, 155, 0.2);
  --jade: #8eb7a1;
  --jade-deep: #527c69;
  --gold: #dfb75f;
  --red: #bd5947;
  --violet: #9a79a6;
  --bronze: #9c6e35;
  --bronze-bright: #e5bd68;
  --lacquer: #4a211b;
  --surface-top: #3b392f;
  --surface-bottom: #201f1b;
  --surface-inset: #171814;
  --sky-top: #1b2728;
  --sky-mid: #4b5b50;
  --sky-bottom: #9b8158;
  --ambient: rgba(219, 181, 102, 0.16);
  --ambient-soft: rgba(134, 169, 143, 0.1);
  --celestial: #f0d994;
  --celestial-glow: rgba(238, 194, 105, 0.32);
  --phase-progress: 0;
  --day-progress: 0;
  --header-height: 76px;
  --rail-width: 88px;
  font-family: "STKaiti", "KaiTi", "FZKai-Z03", "Noto Serif SC", serif;
}

body[data-time-of-day="dawn"] {
  --theme-color: #594f45;
  --sky-top: #313c48;
  --sky-mid: #8d786c;
  --sky-bottom: #ddb981;
  --ambient: rgba(255, 195, 119, 0.23);
  --ambient-soft: rgba(157, 194, 178, 0.15);
  --celestial: #ffe0a2;
  --celestial-glow: rgba(255, 190, 100, 0.38);
  --jade: #9ec5a8;
  --gold: #e0ad5c;
}

body[data-time-of-day="noon"] {
  --theme-color: #4c5b51;
  --sky-top: #65868a;
  --sky-mid: #9aab8c;
  --sky-bottom: #ddd2a5;
  --ambient: rgba(255, 225, 158, 0.24);
  --ambient-soft: rgba(157, 206, 184, 0.2);
  --celestial: #fff1bb;
  --celestial-glow: rgba(255, 239, 179, 0.45);
  --jade: #a8cdaa;
  --gold: #e4bd63;
}

body[data-time-of-day="sunset"] {
  --theme-color: #5c362b;
  --sky-top: #4a4558;
  --sky-mid: #a75d49;
  --sky-bottom: #e2a35d;
  --ambient: rgba(234, 116, 67, 0.24);
  --ambient-soft: rgba(198, 127, 98, 0.15);
  --celestial: #ffc06e;
  --celestial-glow: rgba(255, 120, 61, 0.48);
  --jade: #aab493;
  --gold: #e8a853;
}

body[data-time-of-day="evening"] {
  --theme-color: #292836;
  --sky-top: #23273b;
  --sky-mid: #4b4052;
  --sky-bottom: #9b6258;
  --ambient: rgba(176, 94, 83, 0.17);
  --ambient-soft: rgba(112, 114, 158, 0.14);
  --celestial: #e7b48b;
  --celestial-glow: rgba(213, 110, 80, 0.25);
  --jade: #86aaa3;
  --gold: #d1a259;
}

body[data-time-of-day="moonlit"] {
  --theme-color: #171b25;
  --sky-top: #101725;
  --sky-mid: #253348;
  --sky-bottom: #48545c;
  --ambient: rgba(105, 131, 184, 0.15);
  --ambient-soft: rgba(114, 161, 166, 0.12);
  --celestial: #e6e1c4;
  --celestial-glow: rgba(179, 208, 220, 0.32);
  --jade: #8dbdb1;
  --gold: #cbb574;
}

html,
body {
  background: #171713;
}

body {
  color: var(--paper);
  background:
    linear-gradient(180deg, transparent 0 64%, rgba(12, 13, 11, 0.76) 100%),
    radial-gradient(circle at 74% 16%, var(--ambient), transparent 32rem),
    linear-gradient(155deg, var(--sky-top), var(--sky-mid) 54%, var(--sky-bottom));
  transition: background 1800ms ease, color 800ms ease;
}

body::before {
  position: fixed;
  z-index: 0;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(20, 20, 15, 0.86), transparent 16%, transparent 84%, rgba(20, 20, 15, 0.76)),
    linear-gradient(180deg, transparent 52%, rgba(17, 19, 16, 0.78));
  content: "";
}

.atmosphere {
  z-index: 0;
}

.atmosphere::before {
  position: absolute;
  inset: 0;
  opacity: 0;
  background-image:
    radial-gradient(circle at 12% 18%, #fff 0 1px, transparent 1.5px),
    radial-gradient(circle at 28% 8%, #fff 0 1px, transparent 1.5px),
    radial-gradient(circle at 44% 24%, #fff 0 0.8px, transparent 1.3px),
    radial-gradient(circle at 62% 11%, #fff 0 0.8px, transparent 1.4px),
    radial-gradient(circle at 78% 29%, #fff 0 1px, transparent 1.6px),
    radial-gradient(circle at 91% 12%, #fff 0 0.8px, transparent 1.4px);
  background-size: 310px 190px;
  content: "";
  transition: opacity 1800ms ease;
}

body[data-time-of-day="evening"] .atmosphere::before { opacity: 0.24; }
body[data-time-of-day="moonlit"] .atmosphere::before { opacity: 0.55; }

.celestial-orb {
  position: absolute;
  top: calc(9% + var(--phase-shift, 0%));
  left: calc(12% + var(--day-shift, 0%));
  width: clamp(90px, 10vw, 156px);
  aspect-ratio: 1;
  border-radius: 50%;
  opacity: 0.78;
  background: var(--celestial);
  box-shadow: 0 0 45px var(--celestial-glow), 0 0 120px var(--celestial-glow);
  filter: blur(0.3px);
  transition: inset 1800ms ease, background 1800ms ease, box-shadow 1800ms ease, opacity 1800ms ease;
}

body[data-time-of-day="moonlit"] .celestial-orb {
  top: calc(8% + var(--phase-shift, 0%));
  left: calc(68% - var(--moon-shift, 0%));
  width: clamp(70px, 7vw, 110px);
  opacity: 0.62;
}

.horizon-glow {
  position: absolute;
  right: -10%;
  bottom: 14%;
  left: -10%;
  height: 18%;
  opacity: 0.65;
  background: radial-gradient(ellipse, var(--ambient), transparent 70%);
  filter: blur(24px);
  transition: background 1800ms ease;
}

.atmosphere i {
  opacity: 0.13;
  background: color-mix(in srgb, var(--sky-bottom) 60%, white);
  filter: blur(58px);
  animation: none;
}

.paper-grain {
  z-index: 200;
  opacity: 0.018;
  mix-blend-mode: normal;
}

.game-shell {
  z-index: 2;
  padding: 8px;
  gap: 8px;
}

.topbar {
  position: relative;
  grid-template-columns: minmax(220px, 0.82fr) minmax(180px, 1fr) auto auto auto;
  gap: clamp(10px, 1.5vw, 24px);
  padding: 0 16px;
  border: 0;
  border-radius: 5px 5px 12px 12px;
  background:
    linear-gradient(180deg, rgba(255, 241, 193, 0.075), transparent 12%),
    repeating-linear-gradient(90deg, transparent 0 92px, rgba(255, 255, 255, 0.018) 93px, transparent 95px),
    linear-gradient(180deg, rgba(66, 49, 36, 0.98), rgba(28, 26, 22, 0.98));
  box-shadow:
    0 7px 22px rgba(0, 0, 0, 0.38),
    inset 0 -3px 0 #151512,
    inset 0 -5px 0 rgba(185, 128, 57, 0.32),
    inset 0 1px 0 rgba(255, 235, 178, 0.14);
  backdrop-filter: blur(18px) saturate(0.8);
}

.topbar::before,
.topbar::after {
  position: absolute;
  top: 7px;
  bottom: 9px;
  width: 6px;
  border-radius: 5px;
  background: linear-gradient(90deg, #6e4724, #d4a956 48%, #68401f);
  box-shadow: 0 0 0 2px #201810;
  content: "";
}

.topbar::before { left: 5px; }
.topbar::after { right: 5px; }

.brand-seal,
.auth-seal,
.result-seal,
.launch-region-mark,
.dream-seal,
.offline-mark {
  border: 0;
  border-radius: 8px 3px 8px 3px;
  color: #f3d17e;
  background:
    linear-gradient(145deg, rgba(255, 214, 124, 0.18), transparent 45%),
    #702e24;
  box-shadow:
    0 4px 8px rgba(0, 0, 0, 0.4),
    inset 0 0 0 2px #321713,
    inset 0 0 0 4px rgba(225, 177, 93, 0.3);
  text-shadow: 0 2px 1px #2f1310;
}

.brand-seal { transform: rotate(-2deg); }

.eyebrow,
.section-kicker,
.mission-label,
.footer-label {
  color: color-mix(in srgb, var(--gold) 64%, #786f5f);
  font-family: "Avenir Next Condensed", "DIN Condensed", sans-serif;
}

h1,
h2,
h3 {
  text-shadow: 0 2px 2px rgba(0, 0, 0, 0.54);
}

.mission {
  padding: 7px 12px;
  border: 0;
  border-radius: 5px;
  background: rgba(12, 14, 12, 0.28);
  box-shadow: inset 0 1px 5px rgba(0, 0, 0, 0.52), 0 1px rgba(255, 240, 188, 0.06);
}

.live-dot {
  background: var(--gold);
  box-shadow: 0 0 0 4px rgba(224, 183, 95, 0.1), 0 0 14px rgba(224, 183, 95, 0.48);
}

.day-cycle {
  display: flex;
  height: 48px;
  min-width: 92px;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 7px;
  border-radius: 24px 6px 6px 24px;
  background: rgba(10, 13, 12, 0.34);
  box-shadow: inset 0 1px 6px rgba(0, 0, 0, 0.54), 0 1px rgba(255, 238, 184, 0.08);
}

.day-cycle-orb {
  position: relative;
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, var(--celestial), color-mix(in srgb, var(--celestial) 55%, #5a452c));
  box-shadow: 0 0 11px var(--celestial-glow), inset -5px -5px 7px rgba(66, 38, 23, 0.28);
  transition: 1500ms ease;
}

.day-cycle-orb i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  opacity: 0;
  background: rgba(55, 62, 67, 0.18);
  box-shadow: 8px -5px rgba(55, 62, 67, 0.13), -7px 7px rgba(55, 62, 67, 0.1);
}

body[data-time-of-day="moonlit"] .day-cycle-orb i { opacity: 1; }

.day-cycle-copy {
  display: grid;
  gap: 1px;
  white-space: nowrap;
}

.day-cycle-copy small {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.16em;
}

.day-cycle-copy strong {
  color: #f0d79d;
  font: 600 12px "Avenir Next", sans-serif;
  letter-spacing: 0.06em;
}

.resource-strip,
.account-strip {
  overflow: hidden;
  border: 0;
  border-radius: 7px;
  background: rgba(12, 14, 12, 0.3);
  box-shadow: inset 0 1px 6px rgba(0, 0, 0, 0.56), 0 1px rgba(255, 236, 181, 0.07);
}

.resource-strip > div,
.account-strip > div {
  border-color: rgba(227, 187, 103, 0.09);
}

.resource-icon {
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.6)) saturate(0.9);
}

.account-button,
.version-lockup {
  border: 0;
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(255, 226, 153, 0.08), rgba(13, 14, 12, 0.28));
  box-shadow: inset 0 0 0 1px rgba(229, 183, 97, 0.16), 0 3px 7px rgba(0, 0, 0, 0.28);
}

.account-button:hover {
  background: linear-gradient(180deg, rgba(255, 226, 153, 0.14), rgba(13, 14, 12, 0.32));
  box-shadow: inset 0 0 0 1px rgba(240, 194, 102, 0.3), 0 4px 9px rgba(0, 0, 0, 0.34);
  transform: translateY(-1px);
}

.account-avatar {
  border: 0;
  border-radius: 50% 50% 42% 42%;
  box-shadow: 0 0 0 2px #2a1d13, 0 0 0 3px #a67438, inset 0 -5px 8px rgba(0, 0, 0, 0.45);
}

.nav-rail {
  overflow: hidden;
  gap: 5px;
  padding: 14px 9px;
  border: 0;
  border-radius: 6px 13px 13px 6px;
  background:
    linear-gradient(90deg, rgba(255, 225, 151, 0.05), transparent 15%, transparent 82%, rgba(0, 0, 0, 0.28)),
    linear-gradient(180deg, rgba(56, 43, 31, 0.97), rgba(24, 24, 20, 0.98));
  box-shadow:
    7px 4px 20px rgba(0, 0, 0, 0.32),
    inset -3px 0 #171713,
    inset -5px 0 rgba(174, 119, 50, 0.3),
    inset 1px 0 rgba(255, 234, 174, 0.1);
}

.nav-button {
  height: 61px;
  border: 0;
  border-radius: 5px 11px 11px 5px;
  color: #a09479;
}

.nav-button::before {
  top: 7px;
  bottom: 7px;
  left: -9px;
  width: 5px;
  border-radius: 0 4px 4px 0;
  background: transparent;
}

.nav-button svg {
  filter: drop-shadow(0 2px 1px rgba(0, 0, 0, 0.65));
  stroke-width: 1.75;
}

.nav-button:hover {
  color: #ead8af;
  background: linear-gradient(90deg, rgba(207, 159, 79, 0.04), rgba(207, 159, 79, 0.11));
}

.nav-button.is-active {
  color: #f1d382;
  background:
    radial-gradient(circle at 82% 50%, rgba(230, 182, 89, 0.14), transparent 52%),
    linear-gradient(90deg, #5d2c22, #39251e);
  box-shadow:
    0 5px 10px rgba(0, 0, 0, 0.32),
    inset 0 1px rgba(255, 221, 143, 0.16),
    inset 0 -2px rgba(0, 0, 0, 0.34),
    inset -2px 0 rgba(206, 151, 70, 0.24);
}

.nav-button.is-active::before {
  background: linear-gradient(#e8c66d, #895426);
  box-shadow: 0 0 8px rgba(229, 181, 81, 0.35);
}

.view-stack {
  border-radius: 12px 5px 5px 12px;
  background: rgba(16, 18, 15, 0.38);
  box-shadow: inset 0 0 38px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(6px);
}

.view-scroll {
  scrollbar-color: rgba(201, 155, 76, 0.38) transparent;
}

.view-heading {
  min-height: 64px;
  margin-bottom: 18px;
  padding: 0 6px 10px;
  background: linear-gradient(90deg, rgba(231, 187, 98, 0.09), transparent 38%);
  box-shadow: inset 0 -2px rgba(171, 113, 47, 0.28);
}

.view-heading h2,
.stage-heading h2 {
  color: #f3e4bf;
  font-weight: 600;
}

.panel,
.stage-card,
.intel-panel,
.auth-card,
.result-card,
dialog {
  border: 0;
  border-radius: 4px 12px 5px 10px;
  background:
    radial-gradient(circle at 4% 0%, var(--ambient-soft), transparent 16rem),
    linear-gradient(145deg, rgba(255, 235, 180, 0.055), transparent 34%),
    linear-gradient(180deg, rgba(47, 46, 38, 0.97), rgba(28, 29, 24, 0.98));
  box-shadow:
    0 15px 32px rgba(0, 0, 0, 0.34),
    inset 0 0 0 2px #171713,
    inset 0 0 0 3px rgba(189, 136, 59, 0.28),
    inset 0 1px 0 4px rgba(255, 232, 172, 0.05);
}

.panel-heading,
.stage-heading,
.intel-tabs,
.phase-track,
.character-dialog-heading,
.investigation-dialog-heading,
.character-dialog-tabs,
.character-section-heading {
  border-color: transparent;
  background: linear-gradient(90deg, rgba(101, 52, 36, 0.33), rgba(28, 27, 23, 0.08));
  box-shadow: inset 0 -2px rgba(151, 100, 43, 0.22), inset 0 1px rgba(255, 230, 170, 0.05);
}

.panel-heading span,
.character-section-heading span {
  color: #ead7aa;
  font-weight: 600;
}

.restart-button,
.primary-button,
.ghost-button,
.speed-button,
.skill-button,
.profile-logout,
.loadout-slot button,
.loadout-module button,
.available-equipment button {
  border: 0;
  border-radius: 4px 8px 4px 8px;
  color: #ead9b1;
  background:
    linear-gradient(180deg, rgba(255, 231, 169, 0.13), transparent 42%),
    linear-gradient(180deg, #59442b, #33281e);
  box-shadow:
    inset 0 0 0 1px rgba(219, 170, 87, 0.32),
    inset 0 -3px rgba(13, 13, 11, 0.34),
    0 3px 6px rgba(0, 0, 0, 0.3);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.6);
}

.primary-button {
  color: #fff0c5;
  background:
    linear-gradient(180deg, rgba(255, 224, 145, 0.18), transparent 42%),
    linear-gradient(180deg, #7b4829, #4c2b20);
}

.restart-button,
.danger-button,
.profile-logout {
  background:
    linear-gradient(180deg, rgba(255, 204, 157, 0.12), transparent 42%),
    linear-gradient(180deg, #683329, #3f211d);
}

.restart-button:hover,
.primary-button:hover,
.ghost-button:hover,
.speed-button:hover,
.skill-button:hover {
  color: #fff4d3;
  background:
    linear-gradient(180deg, rgba(255, 235, 177, 0.2), transparent 44%),
    linear-gradient(180deg, #895631, #4d3022);
  box-shadow: inset 0 0 0 1px rgba(242, 196, 107, 0.48), inset 0 -2px rgba(0, 0, 0, 0.32), 0 5px 9px rgba(0, 0, 0, 0.35);
}

button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 2px #1b1711, 0 0 0 4px var(--gold);
}

select,
input:not([type="checkbox"]) {
  border: 0;
  border-radius: 4px;
  background: rgba(12, 14, 12, 0.48);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.56), 0 1px rgba(255, 232, 174, 0.08);
}

.battle-layout { gap: 10px; padding: 10px; }

.stage-card {
  grid-template-rows: 60px minmax(180px, 1fr) 54px clamp(160px, 23vh, 205px);
}

.battlefield {
  margin: 0 4px;
  border-radius: 3px 3px 11px 11px;
  background:
    linear-gradient(to bottom, transparent, rgba(10, 15, 14, 0.52) 68%, rgba(8, 12, 11, 0.82)),
    radial-gradient(ellipse at 70% 30%, var(--ambient), transparent 28%),
    linear-gradient(165deg, var(--sky-top), var(--sky-mid) 58%, var(--sky-bottom));
  box-shadow: inset 0 0 0 2px #151510, inset 0 0 34px rgba(5, 8, 7, 0.44);
  transition: background 1800ms ease;
}

.battlefield::before {
  height: 45%;
  opacity: 0.3;
  background: #19221c;
  filter: drop-shadow(0 -6px 14px rgba(0, 0, 0, 0.28));
}

.battlefield::after {
  height: 31%;
  opacity: 0.23;
  background: repeating-linear-gradient(174deg, color-mix(in srgb, var(--jade) 34%, transparent) 0 1px, transparent 1px 12px);
}

.moon {
  top: 10%;
  right: calc(9% + var(--battle-shift, 0%));
  opacity: 0.64;
  background: var(--celestial);
  box-shadow: 0 0 26px var(--celestial-glow), 0 0 72px var(--celestial-glow);
  transition: 1800ms ease;
}

body[data-time-of-day="noon"] .battlefield .moon { opacity: 0.86; }
body[data-time-of-day="sunset"] .battlefield .moon { top: 35%; opacity: 0.7; }
body[data-time-of-day="evening"] .battlefield .moon { top: 18%; opacity: 0.28; }
body[data-time-of-day="moonlit"] .battlefield .moon { opacity: 0.64; }

.torii { opacity: 0.32; filter: drop-shadow(0 6px 7px rgba(0, 0, 0, 0.56)); }
.torii i { background: #3d201b; }
.lake-line { border-color: color-mix(in srgb, var(--jade) 24%, transparent); }

.stage-footer,
.command-dock {
  border: 0;
  background:
    linear-gradient(180deg, rgba(255, 225, 156, 0.045), transparent),
    #1e201b;
  box-shadow: inset 0 2px #12130f, inset 0 4px rgba(169, 112, 48, 0.21);
}

.growth-ring {
  border: 0;
  color: #f0d17e;
  background: radial-gradient(circle at 36% 30%, #49604f, #1b2924 70%);
  box-shadow: 0 0 0 2px #171713, 0 0 0 3px #9e7138, inset 0 0 16px rgba(158, 208, 172, 0.14);
}

.speed-button.is-active,
.intel-tab.is-active,
.character-tab.is-active {
  color: #f5dc95;
  background: linear-gradient(180deg, rgba(139, 75, 40, 0.46), rgba(62, 40, 29, 0.62));
  box-shadow: inset 0 -3px #b27c36, inset 0 1px rgba(255, 225, 158, 0.1);
}

.hero-card,
.character-card,
.inventory-card,
.recruitment-card,
.team-list-item,
.party-slot-editor,
.region-node,
.facility-card,
.rumor-item,
.module-card,
.stone-card,
.tactic-row,
.daily-event,
.anomaly-node,
.profile-level-card,
.profile-assignment,
.profile-footer,
.profile-stat-grid > div,
.loadout-column,
.loadout-slot,
.loadout-module,
.available-equipment,
.character-stat-grid > div,
.growth-action,
.launch-config-grid label {
  border-color: transparent;
  border-radius: 4px 9px 4px 8px;
  background:
    linear-gradient(145deg, rgba(255, 232, 175, 0.055), transparent 36%),
    linear-gradient(180deg, rgba(52, 51, 42, 0.94), rgba(28, 29, 24, 0.96));
  box-shadow:
    inset 0 0 0 1px rgba(190, 139, 66, 0.18),
    inset 0 -3px rgba(8, 9, 8, 0.3),
    0 4px 9px rgba(0, 0, 0, 0.2);
}

.hero-card::before,
.character-card::before {
  width: 5px;
  background: linear-gradient(var(--accent, var(--jade)), color-mix(in srgb, var(--accent, var(--jade)) 34%, #241d16));
  opacity: 0.78;
  box-shadow: 2px 0 7px color-mix(in srgb, var(--accent, var(--jade)) 24%, transparent);
}

.hero-identity,
.inventory-card-heading,
.team-editor-heading {
  border-color: transparent;
  box-shadow: inset 0 -2px rgba(153, 100, 45, 0.16);
}

.skill-button {
  background:
    linear-gradient(180deg, rgba(158, 199, 170, 0.08), transparent 48%),
    linear-gradient(180deg, #34483d, #253329);
}

.skill-button.ultimate {
  color: #f0d794;
  background:
    linear-gradient(180deg, rgba(255, 220, 133, 0.13), transparent 48%),
    linear-gradient(180deg, #594529, #33291e);
}

.gensokyo-map {
  overflow: hidden;
  border-radius: 3px 4px 12px 12px;
  background:
    linear-gradient(rgba(39, 42, 32, 0.15), rgba(13, 17, 14, 0.28)),
    radial-gradient(ellipse at 48% 42%, color-mix(in srgb, var(--sky-bottom) 36%, transparent), transparent 55%),
    #273128;
  box-shadow: inset 0 0 36px rgba(0, 0, 0, 0.48), inset 0 0 0 2px #171713;
}

.region-node:hover,
.character-card:hover,
.inventory-card:hover,
.team-list-item:hover {
  transform: translateY(-2px);
  box-shadow: inset 0 0 0 1px rgba(226, 178, 90, 0.34), 0 8px 16px rgba(0, 0, 0, 0.28);
}

.auth-gate {
  background:
    radial-gradient(circle at 50% 32%, var(--ambient), transparent 30rem),
    rgba(13, 14, 12, 0.84);
  backdrop-filter: blur(18px) saturate(0.8);
}

.auth-card {
  position: relative;
  padding: 38px;
  background:
    radial-gradient(circle at 50% -10%, rgba(229, 182, 91, 0.11), transparent 18rem),
    linear-gradient(180deg, #3d382d, #201f1a);
}

.auth-card::before,
.result-card::before {
  position: absolute;
  inset: 9px;
  border: 1px solid rgba(206, 155, 73, 0.2);
  border-radius: 2px 7px;
  pointer-events: none;
  content: "";
}

.battle-result .result-card {
  background:
    radial-gradient(circle at 10% 0%, rgba(231, 187, 98, 0.14), transparent 20rem),
    linear-gradient(155deg, rgba(64, 58, 45, 0.98), rgba(31, 33, 27, 0.98));
  box-shadow:
    0 24px 70px rgba(4, 7, 6, 0.46),
    inset 0 0 0 2px #171713,
    inset 0 0 0 3px rgba(211, 160, 73, 0.34),
    inset 0 1px 0 4px rgba(255, 237, 188, 0.07);
}

dialog {
  background:
    radial-gradient(circle at 8% 0%, var(--ambient-soft), transparent 22rem),
    linear-gradient(180deg, #39382f, #1d1f1a);
}

dialog::backdrop {
  background: rgba(10, 10, 9, 0.76);
  backdrop-filter: blur(8px) saturate(0.7);
}

.dialog-close {
  z-index: 2;
  border: 0;
  border-radius: 50%;
  background: #4d2921;
  box-shadow: inset 0 0 0 1px rgba(222, 172, 91, 0.3), 0 3px 7px rgba(0, 0, 0, 0.35);
}

.signal-ribbon,
.toast,
.chapter-status,
.active-team-stamp {
  border: 0;
  border-radius: 4px 9px 4px 9px;
  background: linear-gradient(180deg, #71372d, #421f1c);
  box-shadow: inset 0 0 0 1px rgba(231, 174, 96, 0.28), 0 5px 12px rgba(0, 0, 0, 0.4);
}

.profile-progress {
  border-radius: 5px;
  background: rgba(8, 10, 9, 0.48);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.52);
}

.profile-progress i {
  border-radius: inherit;
  box-shadow: 0 0 8px color-mix(in srgb, var(--jade) 40%, transparent);
}

@media (max-width: 1360px) {
  .topbar {
    grid-template-columns: minmax(205px, 0.8fr) minmax(170px, 1fr) auto auto;
  }

  .resource-strip { display: none; }
}

@media (max-width: 900px) {
  :root { --header-height: 64px; }

  .game-shell {
    padding: 5px;
    gap: 5px;
    grid-template-rows: var(--header-height) minmax(0, 1fr) 66px;
  }

  .topbar {
    grid-template-columns: minmax(170px, 0.9fr) minmax(150px, 1fr) auto;
  }

  .day-cycle { display: none; }

  .nav-rail {
    grid-template-columns: repeat(9, 1fr);
    gap: 3px;
    padding: 5px 7px;
    border-radius: 10px 10px 5px 5px;
    box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.28), inset 0 3px rgba(171, 117, 51, 0.27);
  }

  .nav-button {
    height: 54px;
    border-radius: 8px;
  }

  .nav-button::before {
    right: 20%;
    bottom: -5px;
    left: 20%;
    width: auto;
    height: 4px;
  }
}

@media (max-width: 600px) {
  .game-shell { padding: 3px; gap: 3px; }
  .topbar { grid-template-columns: minmax(150px, 1fr) auto; padding: 0 10px; }
  .view-stack { border-radius: 8px; }
  .battle-layout { padding: 5px; }
  .battle-result { align-items: start; padding: 10px; }
  .result-card { padding: 20px; }
  .result-heading { gap: 16px; }
  .result-summary { grid-template-columns: 1fr; gap: 18px; padding: 18px 0; }
  .result-loot { grid-template-columns: 1fr; }
  .result-actions { align-items: stretch; flex-direction: column; }
  .result-actions .restart-button { width: 100%; }
  .panel, .stage-card, .intel-panel { border-radius: 4px 8px; }
}

/* Shared spell-card atlas: the same emblems identify abilities in battle and files. */
.skill-icon {
  position: relative;
  z-index: 1;
  display: block;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border-radius: 5px 8px 5px 8px;
  background-color: color-mix(in srgb, var(--accent, var(--skill-accent, var(--jade))) 22%, #171a16);
  background-image: url("/assets/skills/skill-atlas.svg");
  background-position: var(--skill-x, 0%) var(--skill-y, 0%);
  background-repeat: no-repeat;
  background-size: 500% 400%;
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--accent, var(--skill-accent, var(--jade))) 52%, transparent),
    0 2px 6px rgba(0, 0, 0, 0.34);
}

.skill-button {
  justify-content: flex-start;
  gap: 6px;
  padding: 3px 7px 3px 4px;
}

.skill-button-copy {
  display: grid;
  min-width: 0;
  flex: 1;
  gap: 1px;
  text-align: left;
}

.skill-button-copy b {
  overflow: hidden;
  color: inherit;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.skill-button-copy em {
  color: var(--dim);
  font: normal 7px "Avenir Next", sans-serif;
  letter-spacing: 0.12em;
}

.skill-button > small {
  flex: 0 0 auto;
  white-space: nowrap;
}

.character-skills-pane {
  background:
    radial-gradient(circle at 12% 20%, rgba(119, 216, 201, 0.07), transparent 24rem),
    linear-gradient(rgba(228, 184, 93, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(228, 184, 93, 0.018) 1px, transparent 1px);
  background-size: auto, 32px 32px, 32px 32px;
}

.character-skills-heading {
  display: flex;
  max-width: 1020px;
  align-items: end;
  justify-content: space-between;
  gap: 30px;
  margin: 0 auto 18px;
  padding: 4px 2px 14px;
  border-bottom: 1px solid rgba(228, 184, 93, 0.2);
}

.character-skills-heading h3 {
  margin: 2px 0 0;
  color: #eee2bf;
  font-size: 21px;
  font-weight: 400;
  letter-spacing: 0.1em;
}

.character-skills-heading > p:last-child {
  max-width: 450px;
  margin: 0;
  color: var(--dim);
  font-size: 9px;
  line-height: 1.6;
  text-align: right;
}

.character-skills-heading > p:last-child i {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin: 0 7px 1px 0;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 9px rgba(228, 184, 93, 0.55);
}

.character-skill-list {
  display: grid;
  max-width: 1020px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 0 auto;
}

.character-skill-card {
  position: relative;
  display: grid;
  min-height: 310px;
  grid-template-columns: 132px minmax(0, 1fr);
  align-items: center;
  gap: 20px;
  overflow: hidden;
  padding: 28px 25px 24px 20px;
  border-radius: 5px 18px 5px 15px;
  background:
    radial-gradient(circle at 15% 45%, color-mix(in srgb, var(--skill-accent) 20%, transparent), transparent 12rem),
    linear-gradient(145deg, rgba(255, 238, 194, 0.07), transparent 40%),
    linear-gradient(180deg, rgba(54, 53, 44, 0.98), rgba(26, 29, 24, 0.98));
  box-shadow:
    inset 0 0 0 1px rgba(213, 166, 87, 0.25),
    inset 0 -5px rgba(8, 9, 8, 0.3),
    0 12px 25px rgba(0, 0, 0, 0.25);
}

.character-skill-card::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 5px;
  background: linear-gradient(var(--skill-accent), color-mix(in srgb, var(--skill-accent) 25%, #211a14));
  box-shadow: 3px 0 12px color-mix(in srgb, var(--skill-accent) 30%, transparent);
  content: "";
}

.character-skill-card.ultimate {
  background:
    radial-gradient(circle at 15% 45%, color-mix(in srgb, var(--skill-accent) 22%, transparent), transparent 12rem),
    linear-gradient(145deg, rgba(255, 222, 141, 0.1), transparent 42%),
    linear-gradient(180deg, rgba(69, 57, 38, 0.98), rgba(31, 28, 22, 0.98));
}

.character-skill-index {
  position: absolute;
  top: -22px;
  right: 10px;
  color: rgba(235, 207, 147, 0.06);
  font: 105px "Baskerville", serif;
  line-height: 1;
  pointer-events: none;
}

.character-skill-emblem {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 14px;
}

.character-skill-emblem::before,
.character-skill-emblem::after {
  position: absolute;
  top: 42px;
  width: 118px;
  height: 118px;
  border: 1px solid color-mix(in srgb, var(--skill-accent) 24%, transparent);
  border-radius: 50%;
  content: "";
  transform: translateY(-50%);
}

.character-skill-emblem::after {
  width: 104px;
  height: 104px;
  border-style: dashed;
  opacity: 0.5;
  transform: translateY(-50%) rotate(18deg);
}

.skill-icon.is-large {
  z-index: 1;
  width: 84px;
  height: 84px;
  flex-basis: 84px;
  border-radius: 10px 20px 10px 18px;
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--skill-accent) 60%, transparent),
    0 10px 24px rgba(0, 0, 0, 0.42),
    0 0 24px color-mix(in srgb, var(--skill-accent) 13%, transparent);
}

.character-skill-emblem > span:last-child {
  padding: 5px 10px;
  border: 1px solid rgba(228, 184, 93, 0.22);
  border-radius: 2px 7px;
  color: #dfc98f;
  background: rgba(17, 18, 15, 0.58);
  font-size: 9px;
  letter-spacing: 0.16em;
}

.character-skill-copy {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.character-skill-copy > p {
  margin: 0 0 6px;
  color: color-mix(in srgb, var(--skill-accent) 68%, #e8d9ae);
  font-size: 9px;
  letter-spacing: 0.14em;
}

.character-skill-copy h3 {
  margin: 0 0 17px;
  color: #f5e9ca;
  font-size: 21px;
  font-weight: 400;
  letter-spacing: 0.09em;
}

.character-skill-description {
  min-height: 84px;
  color: #bcbba9;
  font-size: 10px;
  line-height: 1.85;
}

.character-skill-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(228, 184, 93, 0.15);
}

.character-skill-meta > span {
  display: grid;
  gap: 4px;
}

.character-skill-meta small {
  color: var(--dim);
  font-size: 8px;
}

.character-skill-meta strong {
  color: #e2d6b5;
  font: 11px "Avenir Next", sans-serif;
  font-weight: 500;
}

@media (max-width: 900px) {
  .character-skills-heading {
    display: grid;
    gap: 8px;
  }

  .character-skills-heading > p:last-child {
    text-align: left;
  }

  .character-skill-list {
    grid-template-columns: 1fr;
  }

  .character-skill-card {
    min-height: 240px;
  }
}

@media (max-width: 600px) {
  .character-skill-card {
    min-height: 0;
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 12px;
    padding: 20px 14px 18px 12px;
  }

  .skill-icon.is-large {
    width: 64px;
    height: 64px;
    flex-basis: 64px;
  }

  .character-skill-emblem::before {
    width: 82px;
    height: 82px;
    top: 32px;
  }

  .character-skill-emblem::after {
    width: 72px;
    height: 72px;
    top: 32px;
  }

  .character-skill-copy h3 {
    margin-bottom: 10px;
    font-size: 17px;
  }

  .character-skill-description {
    min-height: 0;
    font-size: 9px;
  }
}

/* Draggable world hub */
.world-view {
  padding: 12px clamp(12px, 1.6vw, 24px) 20px;
}

.map-panel {
  min-height: clamp(720px, calc(100dvh - var(--header-height) - 46px), 940px);
  grid-template-rows: 43px minmax(560px, 1fr) auto;
}

.map-panel-heading small {
  letter-spacing: 0.05em;
}

.gensokyo-map {
  isolation: isolate;
  min-height: 430px;
  cursor: grab;
  outline: 0;
  touch-action: none;
  user-select: none;
}

.gensokyo-map:focus-visible {
  box-shadow:
    inset 0 0 0 2px #171713,
    inset 0 0 0 4px rgba(226, 184, 93, 0.66),
    inset 0 0 38px rgba(0, 0, 0, 0.48);
}

.gensokyo-map.is-dragging {
  cursor: grabbing;
}

.gensokyo-map::before {
  display: none;
}

.map-canvas {
  --map-pan-x: 0px;
  --map-pan-y: 0px;
  position: absolute;
  top: 0;
  left: 0;
  width: max(138%, 920px);
  height: max(132%, 680px);
  overflow: hidden;
  background:
    linear-gradient(rgba(39, 42, 32, 0.11), rgba(13, 17, 14, 0.31)),
    radial-gradient(ellipse at 48% 42%, color-mix(in srgb, var(--sky-bottom) 40%, transparent), transparent 55%),
    radial-gradient(ellipse at 73% 22%, rgba(97, 154, 147, 0.13), transparent 25%),
    radial-gradient(ellipse at 24% 77%, rgba(69, 93, 64, 0.2), transparent 29%),
    #273128;
  transform: translate3d(var(--map-pan-x), var(--map-pan-y), 0);
}

.map-canvas::before {
  position: absolute;
  inset: 0;
  opacity: 0.17;
  background-image:
    linear-gradient(rgba(213, 198, 145, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(213, 198, 145, 0.18) 1px, transparent 1px);
  background-size: 58px 58px;
  content: "";
  mask-image: radial-gradient(ellipse, black 20%, transparent 82%);
  pointer-events: none;
}

.map-canvas.is-recentering {
  transition: transform 260ms cubic-bezier(0.22, 0.8, 0.24, 1);
}

.map-pan-guide,
.map-recenter {
  position: absolute;
  z-index: 6;
  color: #d8c38f;
  background: rgba(23, 24, 20, 0.78);
  box-shadow:
    inset 0 0 0 1px rgba(220, 172, 89, 0.23),
    0 4px 12px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(8px);
}

.map-pan-guide {
  bottom: 13px;
  left: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border-radius: 3px 8px 3px 7px;
  font-size: 9px;
  letter-spacing: 0.1em;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.map-pan-guide span {
  color: var(--gold);
  font-size: 14px;
}

.gensokyo-map.is-dragging .map-pan-guide {
  opacity: 0.34;
}

.map-recenter {
  top: 13px;
  left: 14px;
  padding: 7px 10px;
  border: 0;
  border-radius: 7px 3px 7px 3px;
  font-size: 9px;
  letter-spacing: 0.12em;
}

.map-recenter:hover,
.map-recenter:focus-visible {
  color: #ffe3a0;
  background: rgba(91, 48, 33, 0.9);
}

.map-rumor-panel {
  position: absolute;
  z-index: 8;
  top: 14px;
  right: 14px;
  width: min(288px, calc(100% - 92px));
  max-height: 244px;
  overflow: hidden;
  border: 1px solid rgba(98, 70, 42, 0.72);
  border-radius: 3px 10px 4px 9px;
  color: #302820;
  background:
    linear-gradient(112deg, rgba(255, 250, 224, 0.6), transparent 58%),
    rgba(237, 218, 173, 0.93);
  box-shadow:
    0 9px 22px rgba(44, 31, 20, 0.34),
    inset 3px 0 #a83f30,
    inset 0 0 0 1px rgba(255, 250, 224, 0.34);
  cursor: auto;
  touch-action: pan-y;
  user-select: text;
  backdrop-filter: blur(8px) saturate(0.9);
}

.map-rumor-heading {
  display: flex;
  min-height: 38px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px 0 15px;
  border-bottom: 1px solid rgba(117, 78, 43, 0.3);
  background: rgba(126, 54, 39, 0.06);
}

.map-rumor-heading span {
  color: #382d24;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.15em;
}

.map-rumor-heading small {
  color: #9f382c;
  font-size: 7px;
  letter-spacing: 0.12em;
}

.map-rumor-panel .rumor-list {
  max-height: 204px;
  overscroll-behavior: contain;
  padding: 2px 13px 7px 16px;
  scrollbar-color: rgba(159, 56, 44, 0.38) transparent;
}

.map-rumor-panel .rumor-entry {
  padding: 9px 0;
  border-color: rgba(105, 74, 43, 0.22);
}

.map-rumor-panel .rumor-entry span {
  color: #3d342a;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: 10px;
}

.map-rumor-panel .rumor-entry p {
  margin-top: 3px;
  color: #685a49;
  font-size: 8px;
  line-height: 1.5;
}

.map-rumor-panel .hidden-rumor {
  opacity: 0.58;
}

.map-canvas .region-node:hover,
.map-canvas .region-node.active {
  transform: translate(-50%, -50%) translateY(-2px);
}

/* Shrine facility hub */
.shrine-heading,
.shrine-facilities-panel {
  max-width: 1540px;
  margin-right: auto;
  margin-left: auto;
}

.shrine-facilities-panel {
  position: relative;
  min-height: 480px;
  overflow: hidden;
  padding: 0 14px 18px;
}

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

.shrine-gate-mark {
  position: absolute;
  z-index: 0;
  top: 36px;
  right: 4%;
  width: 230px;
  height: 190px;
  opacity: 0.08;
  border-top: 18px solid #d0a54f;
  filter: drop-shadow(0 12px 8px rgba(0, 0, 0, 0.45));
  pointer-events: none;
}

.shrine-gate-mark::before,
.shrine-gate-mark::after,
.shrine-gate-mark i {
  position: absolute;
  background: #d0a54f;
  content: "";
}

.shrine-gate-mark::before {
  top: 15px;
  left: 12px;
  width: 206px;
  height: 10px;
}

.shrine-gate-mark::after {
  top: 25px;
  left: 37px;
  width: 156px;
  height: 9px;
}

.shrine-gate-mark i:nth-child(1),
.shrine-gate-mark i:nth-child(2) {
  top: 24px;
  width: 13px;
  height: 160px;
}

.shrine-gate-mark i:nth-child(1) { left: 47px; }
.shrine-gate-mark i:nth-child(2) { right: 47px; }

.shrine-gate-mark i:nth-child(3) {
  right: 26px;
  bottom: 0;
  left: 26px;
  height: 9px;
}

.shrine-facilities-panel .panel-heading {
  margin-bottom: 4px;
}

.shrine-facilities-panel .facility-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 14px 2px 2px;
}

.shrine-facilities-panel .facility-card {
  min-height: 86px;
  grid-template-columns: minmax(110px, 0.58fr) minmax(150px, 1fr) auto;
  gap: 14px;
  padding: 13px 14px;
}

/* Illustrated Gensokyo sightseeing map */
.gensokyo-map {
  background: #171b17;
}

.map-canvas {
  background: #e7d8b7;
  box-shadow:
    inset 0 0 0 1px rgba(229, 196, 125, 0.3),
    0 12px 36px rgba(4, 6, 5, 0.42);
}

.map-art {
  position: absolute;
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  filter: saturate(1.12) contrast(1.07);
  pointer-events: none;
  transition: filter 1200ms ease;
  user-select: none;
}

.map-canvas::before {
  z-index: 1;
  opacity: 1;
  background:
    linear-gradient(110deg, rgba(92, 54, 31, 0.08), transparent 18% 78%, rgba(45, 54, 49, 0.09)),
    radial-gradient(ellipse at 50% 48%, transparent 54%, rgba(45, 34, 22, 0.2) 100%);
  mask-image: none;
}

.map-canvas::after {
  position: absolute;
  z-index: 2;
  inset: 0;
  background:
    radial-gradient(circle at 26% 30%, rgba(37, 111, 151, 0.17), transparent 20%),
    radial-gradient(circle at 27% 76%, rgba(79, 54, 125, 0.15), transparent 19%),
    radial-gradient(circle at 84% 47%, rgba(178, 55, 39, 0.15), transparent 14%),
    radial-gradient(circle at 56% 68%, rgba(173, 139, 45, 0.1), transparent 23%);
  box-shadow: inset 0 0 42px rgba(46, 33, 19, 0.28);
  content: "";
  mix-blend-mode: soft-light;
  pointer-events: none;
}

.map-paper-grain {
  position: absolute;
  z-index: 2;
  inset: 0;
  opacity: 0.13;
  background-image:
    repeating-radial-gradient(circle at 20% 30%, rgba(54, 44, 30, 0.2) 0 0.55px, transparent 0.8px 3px),
    repeating-linear-gradient(7deg, rgba(255, 248, 217, 0.09) 0 1px, transparent 1px 7px);
  mix-blend-mode: multiply;
  pointer-events: none;
}

.map-barrier {
  position: absolute;
  z-index: 3;
  inset: 4.5% 4%;
  border: 1px solid rgba(177, 52, 39, 0.3);
  border-radius: 49% 46% 52% 48%;
  box-shadow:
    0 0 14px rgba(180, 57, 42, 0.12),
    inset 0 0 18px rgba(242, 218, 166, 0.12);
  pointer-events: none;
  transform: rotate(-1.5deg);
  animation: map-barrier-breathe 7s ease-in-out infinite;
}

.map-barrier::before,
.map-barrier::after {
  position: absolute;
  border: 1px dashed rgba(145, 59, 42, 0.2);
  border-radius: inherit;
  content: "";
}

.map-barrier::before {
  inset: 9px 13px 12px;
}

.map-barrier::after {
  inset: -12px 8px 7px -8px;
}

@keyframes map-barrier-breathe {
  0%, 100% { opacity: 0.58; }
  50% { opacity: 1; }
}

.map-route-layer {
  position: absolute;
  z-index: 4;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.map-route {
  fill: none;
  transition: opacity 420ms ease;
}

.map-route path {
  vector-effect: non-scaling-stroke;
}

.map-route .route-shadow {
  stroke: rgba(245, 225, 177, 0.7);
  stroke-linecap: round;
  stroke-width: 4.5;
}

.map-route .route-line {
  stroke: #a83f30;
  stroke-dasharray: 2 8;
  stroke-linecap: round;
  stroke-width: 1.55;
}

.map-route circle {
  fill: #f4e3b7;
  stroke: rgba(142, 48, 36, 0.86);
  stroke-width: 0.3;
  transform-box: fill-box;
  transform-origin: center;
}

.map-route.is-known {
  opacity: 0.74;
}

.map-route.is-active {
  opacity: 1;
  filter: drop-shadow(0 0 5px rgba(180, 55, 40, 0.56));
}

.map-route.is-active .route-line {
  stroke: #cf4935;
  stroke-dasharray: 3 7;
  animation: map-route-flow 4s linear infinite;
}

.map-route.is-active circle {
  animation: map-route-pulse 1.8s ease-in-out infinite;
}

.map-route.is-hidden {
  opacity: 0;
}

@keyframes map-route-flow {
  to { stroke-dashoffset: -20; }
}

@keyframes map-route-pulse {
  50% { opacity: 0.4; transform: scale(1.7); }
}

.map-canvas .region-node {
  z-index: 5;
  display: block;
  width: 58px;
  min-width: 0;
  height: 58px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #f4dfaa;
  text-align: left;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  isolation: isolate;
}

.map-canvas button.region-node {
  cursor: pointer;
}

.region-pin {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: grid;
  place-items: center;
  border: 2px solid rgba(241, 221, 170, 0.94);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, rgba(66, 105, 116, 0.98), rgba(27, 52, 64, 0.99) 66%),
    #1f3c49;
  box-shadow:
    0 0 0 3px rgba(52, 36, 26, 0.72),
    0 7px 14px rgba(29, 21, 15, 0.42),
    inset 0 0 0 1px rgba(255, 240, 194, 0.16);
  transition: 180ms ease;
}

.region-icon {
  width: 43px;
  height: 43px;
  color: #f5e5b8;
  filter: drop-shadow(0 2px 2px rgba(15, 12, 9, 0.55));
}

.map-landmark-icon {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.map-canvas .region-copy {
  position: absolute;
  z-index: 1;
  top: 2px;
  left: 68px;
  display: grid;
  width: max-content;
  min-width: 142px;
  max-width: 190px;
  min-height: 53px;
  align-content: center;
  gap: 1px;
  padding: 7px 11px 7px 15px;
  border: 1px solid rgba(98, 70, 42, 0.72);
  border-radius: 2px 9px 3px 8px;
  color: #302820;
  background:
    linear-gradient(100deg, rgba(255, 250, 224, 0.58), transparent 58%),
    rgba(237, 218, 173, 0.94);
  box-shadow:
    0 7px 14px rgba(48, 34, 22, 0.26),
    inset 3px 0 #a83f30,
    inset 0 0 0 1px rgba(255, 250, 224, 0.36);
  pointer-events: none;
  backdrop-filter: blur(7px) saturate(0.92);
}

.map-canvas .region-copy::before {
  position: absolute;
  top: 24px;
  left: -10px;
  width: 10px;
  height: 1px;
  background: rgba(104, 64, 38, 0.82);
  content: "";
}

.region-kicker {
  color: #9f382c;
  font-size: 7px;
  letter-spacing: 0.2em;
}

.map-canvas .region-copy strong {
  color: #2c2822;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.map-canvas .region-copy small {
  max-width: 175px;
  color: #64594b;
  font-size: 8px;
  line-height: 1.4;
}

.map-canvas .region-node[data-region-id="region.hakurei-shrine"] .region-copy {
  right: 68px;
  left: auto;
  padding-right: 15px;
  padding-left: 11px;
  text-align: right;
  box-shadow:
    0 7px 14px rgba(48, 34, 22, 0.26),
    inset -3px 0 #a83f30,
    inset 0 0 0 1px rgba(255, 250, 224, 0.36);
}

.map-canvas .region-node[data-region-id="region.hakurei-shrine"] .region-copy::before {
  right: -10px;
  left: auto;
}

.map-canvas .region-node[data-region-id="region.human-village"] .region-copy {
  top: 65px;
  left: 50%;
  min-width: 156px;
  padding: 8px 12px;
  text-align: center;
  transform: translateX(-50%);
  box-shadow:
    0 7px 14px rgba(48, 34, 22, 0.26),
    inset 0 3px #a83f30,
    inset 0 0 0 1px rgba(255, 250, 224, 0.36);
}

.map-canvas .region-node[data-region-id="region.human-village"] .region-copy::before {
  top: -9px;
  left: calc(50% - 0.5px);
  width: 1px;
  height: 9px;
}

.map-canvas .region-node[data-region-id="region.youkaimountain"] .region-copy {
  top: 62px;
  left: 50%;
  text-align: center;
  transform: translateX(-50%);
  box-shadow:
    0 7px 14px rgba(48, 34, 22, 0.26),
    inset 0 3px #a83f30,
    inset 0 0 0 1px rgba(255, 250, 224, 0.36);
}

.map-canvas .region-node[data-region-id="region.youkaimountain"] .region-copy::before {
  top: -9px;
  left: calc(50% - 0.5px);
  width: 1px;
  height: 9px;
}

.map-canvas .region-node.active .region-pin {
  border-color: #f7e5ae;
  background:
    radial-gradient(circle at 35% 28%, #c46648, #8f3026 68%),
    #8f3026;
  box-shadow:
    0 0 0 3px rgba(81, 36, 29, 0.78),
    0 0 22px rgba(190, 63, 45, 0.5),
    0 8px 16px rgba(31, 21, 15, 0.46),
    inset 0 0 0 1px rgba(255, 245, 201, 0.25);
  animation: map-node-active 2.6s ease-in-out infinite;
}

.map-canvas .region-node.active .region-kicker {
  color: #b33d2f;
}

.map-canvas .region-node.locked {
  opacity: 1;
}

.map-canvas .region-node.locked .region-pin {
  border-color: rgba(214, 220, 202, 0.43);
  color: #c9c8b3;
  background: rgba(50, 54, 47, 0.86);
  filter: grayscale(0.82);
  opacity: 0.72;
}

.map-canvas .region-node.locked .region-copy {
  opacity: 0.82;
  filter: saturate(0.55);
}

.map-canvas .region-node.locked .region-pin::after {
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(221, 226, 211, 0.18), rgba(214, 221, 210, 0.04) 45%, transparent 70%);
  content: "";
  pointer-events: none;
}

.map-canvas button.region-node:hover,
.map-canvas button.region-node:focus-visible,
.map-canvas .region-node.active {
  color: #fff0b4;
  background: transparent;
  box-shadow: none;
  transform: translate(-50%, -50%) translateY(-3px);
}

.map-canvas button.region-node:hover .region-pin,
.map-canvas button.region-node:focus-visible .region-pin {
  border-color: #fff2b6;
  box-shadow:
    0 0 0 4px rgba(91, 47, 32, 0.75),
    0 0 20px rgba(255, 221, 138, 0.42),
    0 9px 17px rgba(29, 20, 13, 0.42);
  transform: scale(1.06) rotate(-2deg);
}

.map-canvas .region-node:focus-visible {
  outline: 2px solid #fff0a8;
  outline-offset: 7px;
}

@keyframes map-node-active {
  50% { opacity: 0.86; transform: translateY(-2px); }
}

.map-legend {
  position: absolute;
  z-index: 7;
  right: 15px;
  bottom: 14px;
  display: flex;
  gap: 10px;
  padding: 6px 9px;
  border: 1px solid rgba(96, 67, 40, 0.56);
  border-radius: 8px 3px 8px 3px;
  color: #4d4439;
  background: rgba(238, 221, 181, 0.91);
  box-shadow: 0 4px 12px rgba(15, 12, 9, 0.26);
  font-size: 7px;
  letter-spacing: 0.08em;
  backdrop-filter: blur(8px);
}

.map-legend span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.map-legend i {
  width: 7px;
  height: 7px;
  border: 1px solid #ede0b9;
  border-radius: 50%;
  background: #244b5a;
  box-shadow: 0 0 0 1px rgba(24, 20, 15, 0.7);
}

.map-legend i.is-active {
  background: #b13e30;
  box-shadow: 0 0 7px rgba(178, 59, 44, 0.5);
}

.map-legend i.is-locked {
  border-color: #8e9285;
  background: #575b53;
  opacity: 0.6;
}

body[data-time-of-day="dawn"] .map-art {
  filter: saturate(1.04) contrast(1.06) sepia(0.04);
}

body[data-time-of-day="sunset"] .map-art {
  filter: saturate(1.12) contrast(1.08) sepia(0.08) hue-rotate(-6deg);
}

body[data-time-of-day="evening"] .map-art,
body[data-time-of-day="moonlit"] .map-art {
  opacity: 0.84;
  filter: saturate(0.92) contrast(1.12) hue-rotate(8deg);
}

body[data-time-of-day="sunset"] .map-canvas::after {
  background-color: rgba(91, 42, 25, 0.17);
}

body[data-time-of-day="evening"] .map-canvas::after,
body[data-time-of-day="moonlit"] .map-canvas::after {
  background-color: rgba(12, 26, 37, 0.34);
}

@media (prefers-reduced-motion: reduce) {
  .map-barrier,
  .map-route.is-active .route-line,
  .map-route.is-active circle,
  .map-canvas .region-node.active .region-pin {
    animation: none;
  }
}

.map-scene-nav {
  position: relative;
  z-index: 2;
  min-width: 0;
  padding: 10px 12px 12px;
  background:
    linear-gradient(180deg, rgba(235, 196, 111, 0.055), transparent 34%),
    #20211c;
  box-shadow:
    inset 0 2px #151610,
    inset 0 4px rgba(175, 119, 49, 0.22);
}

.scene-route-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 1px 2px 8px;
}

.scene-route-heading span {
  color: #e5d2a1;
  font-size: 10px;
  letter-spacing: 0.16em;
}

.scene-route-heading small {
  color: var(--dim);
  font-size: 8px;
}

.scene-route {
  position: relative;
  display: grid;
  grid-template-columns: repeat(7, minmax(76px, 1fr));
  gap: 7px;
}

.scene-route::before {
  position: absolute;
  top: 27px;
  right: 3%;
  left: 3%;
  height: 1px;
  opacity: 0.32;
  background: repeating-linear-gradient(90deg, #d2a656 0 8px, transparent 8px 15px);
  content: "";
  pointer-events: none;
}

.scene-link {
  --scene-accent: #9ec7a7;
  position: relative;
  z-index: 1;
  display: grid;
  min-width: 0;
  min-height: 70px;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  padding: 7px;
  border: 0;
  border-radius: 4px 10px 4px 8px;
  color: #c5bea9;
  text-align: left;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--scene-accent) 10%, transparent), transparent 44%),
    linear-gradient(180deg, #36352d, #272821);
  box-shadow:
    inset 0 0 0 1px rgba(201, 154, 77, 0.18),
    inset 0 -3px rgba(8, 9, 8, 0.28),
    0 4px 8px rgba(0, 0, 0, 0.2);
}

.scene-link[data-scene="recruitment"],
.scene-link[data-scene="chronicle"] { --scene-accent: #d4b36b; }
.scene-link[data-scene="inventory"] { --scene-accent: #82b3b8; }
.scene-link[data-scene="workshop"] { --scene-accent: #c78858; }
.scene-link[data-scene="tactics"] { --scene-accent: #b98d73; }

.scene-link svg {
  width: 32px;
  height: 32px;
  fill: none;
  stroke: var(--scene-accent);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.55;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.5));
}

.scene-link > span {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.scene-link strong,
.scene-link small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scene-link strong {
  color: #e4d8b9;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.06em;
}

.scene-link small {
  color: #817d70;
  font-size: 7px;
}

.scene-link:hover,
.scene-link:focus-visible {
  color: #f4dfaa;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--scene-accent) 17%, transparent), transparent 48%),
    linear-gradient(180deg, #494336, #2d2d25);
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--scene-accent) 44%, transparent),
    inset 0 -3px rgba(8, 9, 8, 0.25),
    0 7px 13px rgba(0, 0, 0, 0.28);
  transform: translateY(-2px);
}

@media (max-width: 1180px) {
  .scene-link {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 2px;
    text-align: center;
  }
}

@media (max-width: 900px) {
  .nav-rail {
    grid-template-columns: repeat(10, 1fr);
  }

  .map-panel {
    min-height: 690px;
  }

  .shrine-facilities-panel .facility-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .scene-link {
    grid-template-columns: 34px minmax(0, 1fr);
    justify-items: stretch;
    text-align: left;
  }
}

@media (max-width: 600px) {
  .map-panel {
    min-height: 600px;
    grid-template-rows: 43px 440px auto;
  }

  .map-panel-heading small,
  .scene-route-heading small {
    display: none;
  }

  .map-canvas {
    width: 920px;
    height: 680px;
  }

  .map-legend {
    right: 12px;
    bottom: 12px;
    gap: 7px;
  }

  .map-rumor-panel {
    top: 10px;
    right: 10px;
    width: min(232px, calc(100% - 78px));
    max-height: 184px;
  }

  .map-rumor-heading {
    min-height: 34px;
    padding-right: 9px;
    padding-left: 12px;
  }

  .map-rumor-panel .rumor-list {
    max-height: 148px;
    padding-right: 10px;
    padding-left: 12px;
  }

  .map-rumor-panel .rumor-entry p {
    display: none;
  }

  .shrine-facilities-panel {
    padding-right: 10px;
    padding-left: 10px;
  }

  .shrine-facilities-panel .facility-card {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .map-scene-nav {
    overflow: hidden;
    padding-right: 0;
  }

  .scene-route {
    display: flex;
    overflow-x: auto;
    padding: 0 12px 5px 0;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
  }

  .scene-route::before {
    right: 25px;
  }

  .scene-link {
    min-width: 126px;
    flex: 0 0 126px;
    scroll-snap-align: start;
  }
}

@media (min-width: 901px) and (max-height: 820px) {
  .nav-rail {
    gap: 2px;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .nav-button {
    height: 50px;
  }

  .feedback-button {
    min-height: 42px;
  }
}

/* In-game feedback refinements: compact field dossier controls */
.account-avatar .account-presence {
  position: absolute;
  z-index: 2;
  top: 2px;
  right: 2px;
  display: grid;
  width: 9px;
  height: 9px;
  place-items: center;
  border: 1px solid #1b1711;
  border-radius: 50%;
  background: rgba(23, 31, 27, 0.92);
}

.account-avatar .account-presence i {
  width: 5px;
  height: 5px;
  box-shadow: 0 0 7px rgba(119, 216, 201, 0.82);
}

.version-lockup {
  align-content: center;
  justify-items: center;
  gap: 0;
}

#version-badge {
  color: #98bdb4;
  font-size: 11px;
}

.map-rumor-heading button {
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid rgba(126, 54, 39, 0.22);
  border-radius: 6px 2px 6px 2px;
  background: rgba(126, 54, 39, 0.06);
  color: #913529;
  font: 700 9px "Yu Mincho", "Hiragino Mincho ProN", serif;
  letter-spacing: 0.08em;
}

.map-rumor-heading button:hover,
.map-rumor-heading button:focus-visible {
  border-color: rgba(126, 54, 39, 0.48);
  background: rgba(126, 54, 39, 0.13);
  color: #66231d;
}

.map-rumor-panel,
.map-rumor-panel .rumor-list {
  transition: max-height 180ms ease, width 180ms ease;
}

.map-rumor-panel.is-expanded {
  width: min(340px, calc(100% - 92px));
  max-height: min(520px, calc(100% - 28px));
}

.map-rumor-panel.is-expanded .rumor-list {
  max-height: min(474px, calc(100dvh - 190px));
}

.map-rumor-panel .rumor-entry span {
  font-size: 11px;
}

.map-rumor-panel .rumor-entry p {
  margin-top: 5px;
  font-size: 10px;
  line-height: 1.65;
}

.character-dialog {
  width: min(1500px, calc(100vw - 34px));
}

.character-dialog-heading h2 {
  margin: 0;
}

.attribute-panel-heading,
.attribute-groups {
  max-width: 1420px;
}

.attribute-groups {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.attribute-group-heading {
  min-height: 38px;
  padding: 6px 9px;
}

.attribute-group-heading small {
  display: none;
}

.attribute-row {
  min-height: 39px;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 6px;
  padding: 6px 9px 6px 13px;
}

.attribute-name {
  overflow: hidden;
  color: #d9d3bc;
  font-size: 10px;
  letter-spacing: 0.03em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attribute-reading {
  min-width: 0;
  color: #f1e9ce;
  font: 500 13px "Avenir Next", sans-serif;
  letter-spacing: 0.02em;
}

.attribute-delta {
  color: var(--jade);
  font: 8px "Avenir Next", sans-serif;
  font-style: normal;
}

.recruitment-card {
  position: relative;
  min-height: 150px;
  outline: 0;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.recruitment-card:hover,
.recruitment-card:focus-visible,
.recruitment-card:focus-within {
  border-color: color-mix(in srgb, var(--hero-accent) 78%, #efe1bb);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.28), inset 0 0 0 1px color-mix(in srgb, var(--hero-accent) 22%, transparent);
  transform: translateY(-2px);
}

.recruitment-card-heading {
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 10px;
}

.recruitment-portrait {
  position: relative;
  width: 56px;
  height: 66px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--hero-accent) 58%, var(--line));
  border-radius: 3px 9px 3px 8px;
  background: radial-gradient(circle at 50% 28%, color-mix(in srgb, var(--hero-accent) 22%, transparent), rgba(8, 12, 11, 0.68));
  box-shadow: inset 0 -8px 16px rgba(0, 0, 0, 0.34);
}

.recruitment-portrait .pixel-character,
.recruitment-portrait .sketch-icon {
  position: absolute;
  top: -3px;
  left: 50%;
  width: 72px;
  height: 96px;
  transform: translateX(-50%);
}

.recruitment-tooltip {
  position: fixed;
  z-index: 1100;
  display: grid;
  width: min(360px, calc(100vw - 24px));
  overflow: hidden;
  border: 2px solid #171713;
  border-radius: 3px 11px 4px 9px;
  opacity: 0;
  color: #f1e7ca;
  background:
    radial-gradient(circle at 16% 0%, color-mix(in srgb, var(--hero-accent) 24%, transparent), transparent 12rem),
    repeating-linear-gradient(0deg, transparent 0 18px, rgba(255, 255, 255, 0.018) 18px 19px),
    rgba(24, 23, 19, 0.985);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--hero-accent) 42%, transparent), 10px 14px 0 rgba(10, 10, 8, 0.32), 0 20px 50px rgba(0, 0, 0, 0.58);
  pointer-events: none;
  transform: translateY(8px) scale(0.98);
  transition: opacity 110ms steps(2, end), transform 140ms steps(3, end);
}

.recruitment-tooltip[hidden] {
  display: none;
}

.recruitment-tooltip.is-visible {
  opacity: 1;
  transform: none;
}

.recruitment-tooltip-heading {
  display: grid;
  min-height: 112px;
  grid-template-columns: 84px minmax(0, 1fr);
  align-items: center;
  gap: 13px;
  padding: 12px 15px;
  border-bottom: 1px solid color-mix(in srgb, var(--hero-accent) 28%, transparent);
}

.recruitment-tooltip-portrait {
  position: relative;
  width: 82px;
  height: 92px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--hero-accent) 42%, transparent);
  border-radius: 3px 9px 3px 8px;
  background: color-mix(in srgb, var(--hero-accent) 10%, rgba(9, 9, 8, 0.72));
}

.recruitment-tooltip-portrait .pixel-character,
.recruitment-tooltip-portrait .sketch-icon {
  position: absolute;
  top: -5px;
  left: 50%;
  width: 104px;
  height: 138px;
  transform: translateX(-50%);
}

.recruitment-tooltip-heading > div:last-child {
  display: grid;
  gap: 4px;
}

.recruitment-tooltip-heading small {
  color: color-mix(in srgb, var(--hero-accent) 72%, #e8d7ae);
  font-size: 9px;
  letter-spacing: 0.12em;
}

.recruitment-tooltip-heading strong {
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 0.1em;
}

.recruitment-tooltip-heading span {
  color: #928a76;
  font-size: 10px;
}

.recruitment-tooltip-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.18);
}

.recruitment-tooltip-stats div {
  display: grid;
  gap: 2px;
  padding: 7px 8px;
  border: 1px solid rgba(229, 216, 178, 0.08);
}

.recruitment-tooltip-stats span,
.recruitment-tooltip > p {
  color: #827b6c;
  font-size: 8px;
}

.recruitment-tooltip-stats strong {
  color: #eee2c4;
  font: 12px "Avenir Next", sans-serif;
}

.recruitment-tooltip-skills {
  display: grid;
  gap: 3px;
  padding: 4px 14px 10px;
}

.recruitment-tooltip-skills div {
  display: flex;
  justify-content: space-between;
  padding: 6px 8px;
  background: rgba(0, 0, 0, 0.18);
  color: #aaa18d;
  font-size: 9px;
}

.recruitment-tooltip-skills b {
  color: color-mix(in srgb, var(--hero-accent) 68%, #f0dfb6);
  font-weight: 500;
}

.recruitment-tooltip > p {
  margin: 0;
  padding: 8px 14px 10px;
  border-top: 1px solid rgba(229, 216, 178, 0.08);
  line-height: 1.5;
}

/* Semantic native selects remain the data source; this layer owns presentation. */
.themed-select {
  position: relative;
  display: block;
  min-width: 0;
  align-self: stretch;
}

.themed-select-source {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.themed-select-button {
  display: grid;
  width: 100%;
  min-height: 30px;
  grid-template-columns: minmax(0, 1fr) 18px;
  align-items: center;
  gap: 6px;
  padding: 0 7px 0 9px;
  border: 0;
  border-radius: 4px;
  color: #c8c0a7;
  background:
    linear-gradient(180deg, rgba(255, 226, 153, 0.065), transparent 45%),
    rgba(12, 14, 12, 0.62);
  box-shadow: inset 0 0 0 1px rgba(229, 183, 97, 0.17), inset 0 2px 5px rgba(0, 0, 0, 0.42), 0 1px rgba(255, 232, 174, 0.06);
  font: 10px "Noto Serif SC", "Songti SC", serif;
  letter-spacing: 0.04em;
  text-align: left;
}

.themed-select-button:hover,
.themed-select.is-open .themed-select-button {
  color: #fff0c8;
  background:
    linear-gradient(180deg, rgba(255, 226, 153, 0.12), transparent 48%),
    rgba(22, 20, 16, 0.82);
  box-shadow: inset 0 0 0 1px rgba(229, 183, 97, 0.38), 0 4px 10px rgba(0, 0, 0, 0.24);
}

.themed-select-button:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 2px #1b1711, 0 0 0 4px var(--gold);
}

.themed-select-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.themed-select-button > i {
  display: grid;
  height: 18px;
  place-items: center;
  border-left: 1px solid rgba(229, 183, 97, 0.14);
  color: #a97a3d;
  font: 14px "Baskerville", serif;
  font-style: normal;
  transition: transform 140ms ease;
}

.themed-select.is-open .themed-select-button > i {
  transform: rotate(180deg);
}

.themed-select.is-disabled {
  opacity: 0.48;
}

.themed-select-menu {
  position: fixed;
  z-index: 2200;
  display: grid;
  width: max-content;
  max-height: min(320px, calc(100dvh - 24px));
  overflow-x: hidden;
  overflow-y: auto;
  padding: 5px;
  border: 1px solid rgba(211, 166, 86, 0.44);
  border-radius: 3px 9px 3px 8px;
  background:
    linear-gradient(145deg, rgba(126, 74, 35, 0.16), transparent 42%),
    repeating-linear-gradient(0deg, transparent 0 22px, rgba(255, 255, 255, 0.016) 22px 23px),
    rgba(24, 22, 17, 0.99);
  box-shadow: inset 0 0 0 1px rgba(255, 232, 174, 0.07), 7px 10px 0 rgba(7, 7, 5, 0.28), 0 18px 42px rgba(0, 0, 0, 0.52);
}

.themed-select-menu[hidden] {
  display: none;
}

.themed-select-menu [role="option"] {
  display: flex;
  min-height: 32px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 5px 9px;
  border: 0;
  border-bottom: 1px solid rgba(229, 216, 178, 0.065);
  background: transparent;
  color: #aaa38f;
  font: 10px "Noto Serif SC", "Songti SC", serif;
  letter-spacing: 0.04em;
  text-align: left;
  white-space: nowrap;
}

.themed-select-menu [role="option"]:last-child {
  border-bottom: 0;
}

.themed-select-menu [role="option"]:hover,
.themed-select-menu [role="option"]:focus-visible,
.themed-select-menu [role="option"][aria-selected="true"] {
  outline: 0;
  color: #ffedbd;
  background: linear-gradient(90deg, rgba(169, 93, 43, 0.3), rgba(169, 93, 43, 0.08));
}

.themed-select-menu [role="option"] i {
  color: #b88242;
  font-size: 8px;
  font-style: normal;
  letter-spacing: 0.1em;
}

.launch-config-grid .themed-select-button,
.team-editor-panel .party-slot-editor .themed-select-button {
  min-height: 42px;
}

@media (max-width: 1180px) {
  .attribute-groups {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .attribute-groups {
    grid-template-columns: 1fr;
  }

  .tactic-rule-line .themed-select-rule-urgency,
  .tactic-rule-line .themed-select-rule-fire {
    grid-column: 2;
  }

  .map-rumor-panel.is-expanded {
    width: min(290px, calc(100% - 78px));
    max-height: min(420px, calc(100% - 20px));
  }

  .map-rumor-panel.is-expanded .rumor-list {
    max-height: min(374px, calc(100dvh - 180px));
  }

  .map-rumor-panel.is-expanded .rumor-entry p {
    display: block;
    font-size: 10px;
  }
}

/* Final cascade guard for the battle diorama. */
.battlefield::before,
.battlefield::after {
  z-index: 1;
  right: -8%;
  bottom: -7%;
  left: -8%;
  height: 35%;
  opacity: 0;
  background: repeating-linear-gradient(174deg, color-mix(in srgb, var(--scene-accent) 34%, transparent) 0 1px, transparent 1px 12px);
  clip-path: none;
  filter: none;
  content: "";
  pointer-events: none;
}

.battlefield.is-wave-advancing::after {
  opacity: 0.3;
  animation: battlefield-ground-retreat 260ms linear infinite;
}
