:root {
  font-family: "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  font-size: 14px;
  color: #eef1f7;
  background: #171e2e;
  --panel: #253147;
  --border: #53617d;
  --gold: #efd095;
  --muted: #b3c0d4;
  --personal: #91a2bc;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select {
  touch-action: manipulation;
}
button {
  cursor: pointer;
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid #687894;
  border-radius: 8px;
  background: #35445f;
  color: #f5f4ef;
}
button:hover:not(:disabled) {
  background: #465a7b;
  border-color: var(--gold);
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}
button:disabled {
  opacity: 0.35;
  cursor: default;
}
button:disabled {
  pointer-events: none;
}
.primary {
  background: #e5bd7b;
  color: #29334b;
  border-color: #f7d9a7;
  font-weight: bold;
}
.primary:hover:not(:disabled) {
  background: #f4d59c;
  color: #252e43;
}
.danger {
  background: #704657;
}
a {
  color: #dec0e1;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h2 {
  font-size: 23px;
}
h3 {
  font-size: 16px;
}
p {
  line-height: 1.6;
}
.muted,
.eyebrow {
  color: var(--muted);
}
.eyebrow {
  font-size: 11px;
}
.loading {
  padding: 35px;
}
.home {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  padding: 30px;
  background: radial-gradient(
    ellipse at 50% 20%,
    #485167,
    #273349 42%,
    #161d2c 85%
  );
}
.title-logo {
  width: min(760px, 80vw);
  margin-bottom: 45px;
  filter: drop-shadow(0 8px 16px #1118);
}
.home-menu {
  display: grid;
  width: 270px;
  gap: 12px;
}
.home-menu button {
  height: 54px;
  font-size: 18px;
}
.home footer {
  display: flex;
  gap: 25px;
  margin-top: 35px;
  font-size: 12px;
}
.shell {
  height: 100dvh;
  max-width: 1920px;
  margin: auto;
  display: grid;
  grid-template:
    58px minmax(0, 1fr) 180px / clamp(270px, 23vw, 340px) minmax(0, 1fr)
    clamp(180px, 15vw, 230px);
  gap: 12px;
  padding: 12px;
}
.topbar {
  grid-area: 1/1/2/4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  padding: 0 8px;
}
.brand {
  font-size: 25px;
  font-weight: 900;
  letter-spacing: 1px;
  color: var(--gold);
}
.top-tools {
  display: flex;
  align-items: center;
  gap: 7px;
}
.party-panel {
  grid-area: 2/1/4/2;
  display: grid;
  grid-template-rows: repeat(3, minmax(0, 1fr));
  min-height: 0;
  gap: 10px;
}
.party-slot {
  border: 2px solid var(--personal);
  border-radius: 12px;
  background: #232e43;
  text-align: left;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: auto;
  padding: 10px;
  color: #edf0f6;
}
.party-slot.active {
  box-shadow: 0 0 0 2px var(--gold);
  border-color: var(--gold);
}
.party-slot.empty {
  align-items: center;
  justify-content: center;
  border-style: dashed;
  color: #bdc7d9;
}
.party-slot.empty:disabled {
  opacity: 1;
}
.party-top {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 10px;
  flex: 1;
  min-height: 0;
}
.party-portrait {
  position: relative;
  min-height: 80px;
  align-self: stretch;
  overflow: hidden;
  border-radius: 7px;
  background: #19253b;
}
.party-portrait img {
  width: 100%;
  height: 100%;
  max-height: 150px;
  object-fit: contain;
  object-position: center bottom;
}
.slot-tag {
  position: absolute;
  top: 4px;
  left: 6px;
  font-weight: bold;
  color: var(--gold);
  font-size: 12px;
  text-shadow: 0 1px 3px #000;
}
.party-copy {
  min-width: 0;
}
.party-title {
  margin-bottom: 6px;
}
.party-title h3 {
  font-size: 14px;
  line-height: 1.4;
}
.party-title .eyebrow {
  display: block;
  margin-top: 3px;
  font-size: 10px;
}
.passive p {
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-line;
}
.party-slot .passive p {
  font-size: 11px;
}
.six-faces {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 5px;
  margin: 9px 0 0;
}
.party-slot > .six-faces {
  flex: none;
  margin-top: 9px;
}
.face {
  --pip-size: 18px;
  position: relative;
  display: inline-block;
  aspect-ratio: 1;
  background: #f9f2e4;
  border: 2px solid #e1d3b9;
  border-radius: 7px;
  min-width: 0;
  color: #b3576a;
  vertical-align: middle;
}
.face > .icon {
  position: absolute;
  left: 9%;
  top: 9%;
  width: 46%;
  height: 46%;
  object-fit: contain;
}
.face > b {
  position: absolute;
  right: 10%;
  bottom: 7%;
  font-size: var(--pip-size);
  font-weight: 800;
  line-height: 1;
}
.effect-shield,
.effect-taunt {
  color: #4b7d9d;
}
.effect-heal,
.effect-selfHeal,
.effect-cleanse {
  color: #7f913b;
}
.effect-boost {
  color: #c18831;
}
.effect-poison {
  color: #8b65a1;
}
.effect-wait {
  color: #6d7a8e;
}
.icon {
  width: 20px;
  height: 20px;
  flex: none;
}
.uploaded-icon {
  image-rendering: pixelated;
}
.hp-label,
.hp-numbers {
  color: #d8e4bf;
  font-size: 12px;
}
.stage {
  grid-area: 2/2/3/3;
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #263448;
  border: 1px solid var(--border);
  border-radius: 13px;
}
.stage-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.16;
  pointer-events: none;
}
.stage > *:not(.stage-bg) {
  position: relative;
}
.selection {
  height: 100%;
  display: grid;
  grid-template-columns: minmax(220px, 0.85fr) minmax(0, 1.15fr);
}
.selection-detail {
  display: flex;
  flex-direction: column;
  padding: 18px;
  border-right: 1px solid var(--border);
  overflow: auto;
  min-width: 0;
}
.hero-info {
  min-width: 0;
}
.selection-detail .hero-info {
  flex: 1;
}
.full-art {
  display: block;
  width: 100%;
  height: 235px;
  object-fit: contain;
  image-rendering: pixelated;
}
.hero-info .eyebrow {
  display: block;
  margin: 8px 0;
}
.hero-info h3 {
  margin-bottom: 5px;
}
.hero-info .passive {
  margin-top: 10px;
}
.portrait {
  height: 100px;
  max-width: 100%;
  object-fit: contain;
}
.recruit-button {
  margin-top: 14px;
  width: 100%;
  min-height: 46px;
  flex: none;
}
.roster-area {
  padding: 18px;
  overflow: auto;
  min-width: 0;
}
.filter-row {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 14px;
  overflow-x: auto;
  padding: 2px 2px 5px;
}
.filter-row button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  flex: none;
  padding: 5px 8px;
  white-space: nowrap;
}
.filter-row img {
  width: 31px;
  height: 31px;
  object-fit: contain;
  image-rendering: pixelated;
}
.filter-row .all-button {
  min-width: 46px;
}
.filter-row .chosen,
.chosen {
  border-color: var(--gold);
  background: #65523d;
}
.character-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  min-height: 195px;
  padding: 6px 3px 16px;
  cursor: grab;
  touch-action: pan-y;
  scrollbar-color: #9c8199 #222b3e;
}
.character-strip.dragging {
  cursor: grabbing;
  user-select: none;
}
.character-card {
  flex: 0 0 105px;
  min-width: 105px;
  border: 2px solid var(--personal);
  border-radius: 10px;
  background: #303d53;
  padding: 8px;
  text-align: center;
  cursor: pointer;
}
.character-card img {
  width: 100%;
  height: 120px;
  object-fit: contain;
  image-rendering: pixelated;
  pointer-events: none;
}
.character-card b {
  display: block;
  font-size: 12px;
  line-height: 1.4;
  margin: 5px 0;
}
.character-card small {
  font-size: 10px;
  color: var(--muted);
}
.character-card.selected {
  box-shadow: 0 0 0 2px var(--gold);
  background: #665065;
}
.character-card[aria-disabled="true"] {
  opacity: 0.35;
  cursor: default;
}
.roster-hint {
  font-size: 11px;
  line-height: 1.8;
  color: var(--muted);
  margin: 13px 0;
}
.empty-message {
  padding: 20px;
  color: var(--muted);
}
.map-panel {
  grid-area: 2/3/4/4;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 13px 8px 8px;
  background: #222e43;
  border: 2px solid var(--border);
  border-radius: 13px;
  text-align: center;
}
.map-panel h3 {
  font-size: 15px;
}
.map-panel > .eyebrow {
  margin: 5px 0 7px;
}
.map-panel.needs-choice {
  border-color: #f4cc79;
  box-shadow:
    0 0 0 2px #f4cc7944,
    inset 0 0 24px #e7b35a11;
  animation: choice-pulse 1.8s ease-in-out infinite;
}
.map-scroll {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  scrollbar-width: thin;
}
.map-canvas {
  flex: none;
  margin-top: auto;
  position: relative;
  width: 100%;
}
.map-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.map-node {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 55px;
  height: 50px;
  min-height: 0;
  border-radius: 12px;
  padding: 2px;
  font-size: 10px;
  line-height: 1.3;
  background: #243146;
}
.map-node small {
  display: block;
  font-size: 9px;
  opacity: 0.7;
}
.map-node.current {
  background: #71604a;
  border-color: #e8c98b;
  opacity: 1;
}
.map-node.visited {
  opacity: 0.8;
}
.map-node.available {
  background: #7f603e;
  border-color: #f6d99e;
  box-shadow: 0 0 12px #edc17455;
}
.map-node:disabled {
  opacity: 0.22;
}
.map-node.visited:disabled {
  opacity: 0.65;
}
.map-node.current:disabled {
  opacity: 1;
}
.mobile-map {
  display: none;
}
@keyframes choice-pulse {
  50% {
    box-shadow:
      0 0 0 2px #f4cc7988,
      0 0 20px #f4cc7933;
  }
}
.dice-dock {
  grid-area: 3/2/4/3;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 13px;
  background: #222d41;
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 16px 12px;
}
.dice-row {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  min-width: 0;
}
.die-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.die-owner {
  font-size: 10px;
  color: #c9d3e3;
  max-width: 96px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.die {
  padding: 4px;
  border: 3px solid var(--personal);
  width: 88px;
  height: 88px;
  background: #2e3a50;
  box-shadow: 0 4px 0 #1116;
  border-radius: 12px;
  min-height: 0;
  flex: none;
}
.die .face {
  width: 100%;
  height: 100%;
  --pip-size: 31px;
}
.die.selected {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
  transform: translateY(-5px);
}
.die.target {
  outline: 3px solid #a8d8a5;
  outline-offset: 3px;
}
.die.used {
  opacity: 0.3;
}
.dock-button {
  padding: 9px 12px;
  min-width: 79px;
  min-height: 58px;
  flex: none;
}
.dock-button.primary {
  margin-top: 18px;
}
.scene {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
}
.actor {
  position: absolute !important;
  transform: translate(-50%, -50%);
  width: 154px;
  border: 0;
  background: transparent;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  border-radius: 9px;
  min-height: 0;
  overflow: visible;
  color: #edf0f6;
}
.actor:hover:not(:disabled) {
  background: #ffffff0b;
  border-color: transparent;
}
.actor.target {
  outline: none;
  background: transparent;
}
.sprite {
  display: block;
  width: 130px;
  height: clamp(110px, 18vh, 170px);
  object-fit: contain;
  object-position: center bottom;
  image-rendering: pixelated;
  pointer-events: none;
}
.actor-name {
  font-size: 11px;
  line-height: 1.5;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 3px 0;
}
.actor-vitals {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 32px;
  gap: 3px;
  align-items: center;
  width: 100%;
  height: 32px;
}
.action-slot {
  display: block;
  width: 30px;
  height: 30px;
}
.enemy-action {
  width: 30px;
  height: 30px;
  --pip-size: 14px;
  border-width: 1px;
  border-radius: 4px;
}
.hp-bar {
  position: relative;
  height: 17px;
  width: 100%;
  overflow: hidden;
  border: 1px solid #8793a5;
  border-radius: 3px;
  background: #161d2d;
}
.hp-bar > i {
  display: block;
  height: 100%;
  background: linear-gradient(#94b567, #659452);
  transition: width 0.15s;
}
.hp-bar > span {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  text-shadow:
    0 1px 2px #000,
    1px 0 2px #000;
  font-size: 9px;
  line-height: 1;
}
.enemy .hp-bar > i {
  background: linear-gradient(#cb8c90, #a55d70);
}
.shield-value {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  color: #a4d1e8;
  font-size: 13px;
}
.shield-value .icon {
  width: 15px;
  height: 17px;
}
.empty-shield {
  opacity: 0.35;
}
.status-row {
  display: flex;
  gap: 4px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  min-height: 23px;
  margin-top: 3px;
  width: 100%;
}
.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 1px solid #a593b4;
  background: #2e2542cc;
  border-radius: 5px;
  padding: 2px 4px;
  min-height: 23px;
  color: #d6b6ed;
  font-size: 11px;
}
.status .icon {
  width: 16px;
  height: 16px;
}
.status.debuff {
  color: #f1acb0;
  border-color: #ad727b;
  background: #432a37cc;
}
.status.buff {
  color: #bcd9a9;
  border-color: #9aae7d;
  background: #293b32cc;
}
.target-name {
  font-size: 9px;
  color: #d0bfa8;
  min-height: 13px;
  max-width: 100%;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}
.retired.idol .sprite {
  filter: grayscale(1);
  opacity: 0.3;
}
.retired .actor-name {
  color: #9da7b9;
}
.retired-label {
  font-size: 10px;
  color: #a4adbe;
  margin: 3px 0;
  min-height: 23px;
}
.grave-sprite {
  filter: brightness(0.8);
}
.phase-label {
  position: absolute;
  top: 13px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  background: #121c32b8;
  padding: 8px 14px;
  border-radius: 7px;
  color: #eee3c6;
  font-size: 12px;
  pointer-events: none;
}
.center-card {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 18px;
  padding: 25px;
  text-align: center;
}
.big-symbol {
  font-size: 55px;
  color: var(--gold);
}
.hero-mini-row {
  display: flex;
  gap: 16px;
}
.hero-mini-row img {
  width: 70px;
  height: 95px;
  object-fit: contain;
}
.growth,
.event-card {
  height: 100%;
  padding: 22px;
  overflow: auto;
}
.growth-header,
.stage-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  margin-bottom: 14px;
}
.growth-header > span {
  font-size: 12px;
  color: var(--muted);
}
.growth-heroes {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.growth-faces {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0 18px;
}
.growth-faces > button {
  padding: 6px;
  min-width: 0;
  background: #2a3850;
}
.growth-faces .face {
  width: 100%;
  max-width: 80px;
}
.growth-faces small {
  display: block;
  margin-top: 6px;
  font-size: 9px;
  color: #bbc5d5;
  white-space: nowrap;
}
.growth-actions {
  display: flex;
  gap: 14px;
  margin-top: 20px;
}
.candidate-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
  margin: 18px 0;
}
.candidate {
  padding: 18px;
  border: 1px solid #7990a9;
  border-radius: 10px;
  background: #26324a;
}
.candidate > .face {
  width: 70px;
  --pip-size: 26px;
  margin-bottom: 10px;
}
.candidate h3 {
  margin: 7px 0;
}
.candidate p {
  font-size: 12px;
  margin: 10px 0;
  min-height: 55px;
}
.candidate button {
  width: 100%;
}
.event-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 18px;
}
.event-card > p {
  white-space: pre-line;
}
.event-choices {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}
dialog {
  width: min(1120px, 94vw);
  max-height: 94dvh;
  padding: 24px;
  border: 2px solid #a294b6;
  border-radius: 16px;
  background: #273249;
  color: #eef0f6;
  box-shadow: 0 14px 70px #0007;
  overflow: auto;
}
dialog::backdrop {
  background: #0b1024d9;
}
dialog > h2 {
  text-align: center;
  color: var(--gold);
  margin-bottom: 18px;
}
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 18px 0;
}
.party-confirm {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 15px;
}
.party-confirm .hero-info {
  border: 2px solid var(--personal);
  border-radius: 12px;
  padding: 15px;
  background: #2d3a53;
}
.party-confirm .full-art {
  height: 260px;
}
.party-confirm .passive p {
  font-size: 12px;
}
.prose {
  max-width: 850px;
  margin: auto;
}
.prose p {
  margin: 14px 0;
}
.prose article {
  padding: 15px 0;
  border-bottom: 1px solid var(--border);
}
.patch-notes-scroll {
  max-height: 62dvh;
  overflow: auto;
  display: grid;
  gap: 12px;
}
.patch-notes-scroll details {
  border: 1px solid #65748d;
  border-radius: 9px;
  background: #222f45;
  overflow: hidden;
}
.patch-notes-scroll summary {
  cursor: pointer;
  padding: 15px 18px;
  font-weight: bold;
  font-size: 16px;
  color: #ebd3a5;
  list-style-position: inside;
}
.patch-notes-scroll summary small {
  float: right;
  color: var(--muted);
  font-size: 11px;
  font-weight: normal;
  line-height: 24px;
}
.patch-notes-scroll details[open] summary {
  border-bottom: 1px solid #54617b;
  background: #34405a;
}
.patch-note-content {
  padding: 20px;
  white-space: pre-wrap;
  line-height: 1.8;
  font-size: 14px;
}
.log-lines {
  white-space: pre-wrap;
  font: 12px/1.8 monospace;
  max-height: 60vh;
  overflow: auto;
}
dialog label {
  display: block;
  margin: 20px auto;
  max-width: 500px;
}
dialog input[type="range"] {
  display: block;
  width: 100%;
  margin-top: 12px;
  accent-color: #e5bd7b;
}
.result {
  padding: 35px;
  max-width: 1200px;
  margin: auto;
}
.result-logo {
  display: block;
  width: 150px;
  height: 48px;
  object-fit: contain;
  margin: 0 auto 8px;
}
.result-heading {
  text-align: center;
  margin-bottom: 22px;
}
.result-heading h1 {
  font-size: 35px;
  margin: 10px 0;
  color: var(--gold);
}
.result-meta {
  display: flex;
  justify-content: center;
  gap: 25px;
  flex-wrap: wrap;
  margin: 20px 0;
}
.result-actions {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 25px;
}
.result .full-art {
  height: 240px;
}
#effect-tooltip {
  position: fixed;
  z-index: 10000;
  max-width: min(360px, calc(100vw - 16px));
  padding: 12px 15px;
  border: 1px solid #a9b8ce;
  border-radius: 8px;
  background: #101c30f5;
  color: #f4f5f9;
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-line;
  pointer-events: none;
  box-shadow: 0 5px 24px #0007;
}
#effect-tooltip[hidden] {
  display: none;
}
#toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 11000;
  background: #17243a;
  color: #fff;
  border: 1px solid #a5b6cc;
  border-radius: 9px;
  padding: 12px 20px;
  box-shadow: 0 4px 15px #0006;
  display: none;
  white-space: pre-line;
  max-width: 90vw;
}
.admin-body {
  background: #fff;
  color: #243247;
  --border: #cbd5e1;
  --muted: #64748b;
  --gold: #426595;
  --personal: #91a2bc;
}
.admin-body button {
  background: #fff;
  color: #334155;
  border-color: #c5cfde;
}
.admin-body button:hover:not(:disabled) {
  background: #edf3fb;
  border-color: #6688b3;
}
.admin-body button.primary {
  background: #426c9e;
  border-color: #345c8a;
  color: #fff;
}
.admin-body button.primary:hover:not(:disabled) {
  background: #355d8c;
  color: #fff;
}
.admin-body button.danger {
  color: #a83c4c;
  background: #fff8f9;
  border-color: #e3bcc4;
}
.admin-body .chosen {
  background: #e5eefb;
  border-color: #7c9bc4;
  color: #20466f;
}
.admin-body a {
  color: #426c9e;
}
.admin-layout {
  height: 100dvh;
  display: grid;
  grid-template: 85px minmax(0, 1fr) / 155px 205px minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
}
.admin-header {
  grid-column: 1/-1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}
.admin-header h1 {
  font-size: 24px;
  color: #243f65;
}
.admin-header small {
  color: #64748b;
}
.admin-tools {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  align-items: center;
}
.admin-tools button {
  font-size: 12px;
  padding: 7px 11px;
  min-height: 36px;
}
.admin-nav,
.record-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  overflow: auto;
  min-height: 0;
  padding: 4px;
  background: #f8fafc;
  border-radius: 8px;
}
.admin-nav button,
.record-list button {
  text-align: left;
  flex: none;
}
.admin-form {
  background: #fff;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 22px;
  min-width: 0;
}
.admin-form h2 {
  font-size: 22px;
}
.admin-form h3 {
  margin-top: 8px;
}
.admin-form label,
.stage-select {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 12px 0;
  color: #334155;
  font-size: 13px;
}
.admin-form input,
.admin-form select,
.admin-form textarea,
.stage-select select {
  background: #fff;
  border: 1px solid #bdc9d9;
  border-radius: 6px;
  color: #243247;
  width: 100%;
  padding: 9px;
  min-height: 39px;
}
.admin-form textarea {
  min-height: 85px;
  resize: vertical;
  line-height: 1.6;
}
.admin-form .form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 20px;
}
.admin-form .face-editor {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.admin-form fieldset {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 13px;
  margin: 15px 0;
  min-width: 0;
}
.admin-form legend {
  font-size: 13px;
  font-weight: bold;
  color: #475569;
  padding: 0 5px;
}
.admin-form .media-preview {
  height: 100px;
  max-width: 180px;
  object-fit: contain;
  background: repeating-conic-gradient(#f1f5f9 0% 25%, #fff 0% 50%) 50%/16px
    16px;
  border: 1px solid #e0e7f0;
  border-radius: 7px;
  image-rendering: pixelated;
}
.admin-form .asset-row {
  display: flex;
  gap: 9px;
  align-items: center;
  flex-wrap: wrap;
  margin: 8px 0;
}
.asset-row select {
  flex: 1;
  min-width: 140px;
}
.admin-form .asset-row input[type="file"] {
  width: 235px;
  font-size: 12px;
}
.saved-status {
  font-size: 12px;
  color: #587449;
  margin-top: 4px;
}
.admin-form .error-list {
  color: #ad3c48;
  white-space: pre-wrap;
  font: 12px/1.8 monospace;
}
.admin-form .check-label {
  display: inline-flex;
  flex-direction: row;
  gap: 7px;
  align-items: center;
  margin: 7px 15px 7px 0;
}
.check-label input {
  width: auto;
  min-height: 0;
  accent-color: #426c9e;
}
.asset-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 15px;
}
.asset-tile {
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 12px;
  overflow-wrap: anywhere;
}
.asset-tile img {
  width: 100%;
  height: 110px;
  object-fit: contain;
}
.asset-tile small {
  display: block;
  color: #64748b;
  margin-top: 5px;
}
.admin-form .hero-info {
  max-width: 440px;
}
.admin-form .full-art {
  height: 200px;
}
.admin-form .hp-label {
  color: #53733c;
}
.admin-form .face-editor .face {
  width: 48px;
}
.admin-form .stage-subtabs {
  display: flex;
  gap: 8px;
  margin: 12px 0 22px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--border);
}
.stage-heading {
  margin-bottom: 5px;
}
.stage-select {
  margin: 5px;
  font-size: 12px;
}
.admin-form .reward-row {
  display: grid;
  grid-template-columns: minmax(130px, 1.6fr) 90px 100px 85px auto;
  align-items: center;
  gap: 12px;
}
.reward-row label {
  margin: 5px 0;
}
.reward-preview {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #64748b;
}
.reward-preview .face {
  width: 42px;
  flex: none;
}
.reward-row button {
  font-size: 12px;
  padding: 8px;
}
.admin-form #dice-preview > .face {
  width: 80px;
  --pip-size: 29px;
}
.admin-form .muted {
  font-size: 12px;
  line-height: 1.75;
}
@media (min-width: 1600px) {
  .party-top {
    grid-template-columns: 110px 1fr;
  }
  .party-slot .passive p {
    font-size: 12px;
  }
  .die {
    width: 100px;
    height: 100px;
  }
  .dice-dock {
    gap: 20px;
  }
  .dice-row {
    gap: 15px;
  }
  .sprite {
    width: 145px;
    height: 185px;
  }
  .actor {
    width: 180px;
  }
  .actor-vitals {
    grid-template-columns: 34px 1fr 36px;
  }
  .enemy-action,
  .action-slot {
    width: 34px;
    height: 34px;
  }
  .enemy-action {
    --pip-size: 16px;
  }
  .selection .full-art {
    height: 280px;
  }
}
@media (max-width: 1200px) {
  .shell {
    grid-template-columns: 245px minmax(0, 1fr) 165px;
    grid-template-rows: 54px minmax(0, 1fr) 165px;
    gap: 8px;
    padding: 8px;
  }
  .party-top {
    grid-template-columns: 75px minmax(0, 1fr);
    gap: 8px;
  }
  .party-slot {
    padding: 8px;
  }
  .party-slot .passive p {
    font-size: 10px;
  }
  .party-title h3 {
    font-size: 12px;
  }
  .party-title .eyebrow {
    font-size: 9px;
  }
  .die {
    width: 70px;
    height: 70px;
  }
  .die .face {
    --pip-size: 25px;
  }
  .dice-row {
    gap: 8px;
  }
  .dice-dock {
    gap: 9px;
    padding: 12px 8px;
  }
  .dock-button {
    min-width: 64px;
    padding: 7px;
    font-size: 12px;
  }
  .die-owner {
    max-width: 70px;
    font-size: 9px;
  }
  .selection {
    grid-template-columns: minmax(180px, 0.85fr) minmax(0, 1.15fr);
  }
  .selection-detail,
  .roster-area {
    padding: 12px;
  }
  .selection .full-art {
    height: 190px;
  }
  .filter-row {
    gap: 5px;
  }
  .filter-row img {
    width: 27px;
    height: 27px;
  }
  .filter-row button {
    padding: 4px 6px;
    font-size: 11px;
  }
  .filter-row .all-button {
    min-width: 40px;
  }
  .actor {
    width: 134px;
  }
  .sprite {
    width: 105px;
    height: 145px;
  }
  .actor-vitals {
    grid-template-columns: 27px minmax(0, 1fr) 27px;
  }
  .enemy-action,
  .action-slot {
    width: 27px;
    height: 27px;
  }
  .enemy-action {
    --pip-size: 13px;
  }
  .shield-value {
    font-size: 11px;
  }
  .shield-value .icon {
    width: 12px;
  }
  .admin-layout {
    grid-template-columns: 140px 175px minmax(0, 1fr);
  }
  .admin-form {
    padding: 16px;
  }
  .admin-form .reward-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .reward-row .reward-preview {
    justify-content: flex-start;
  }
  .admin-tools {
    gap: 4px;
  }
  .admin-tools button {
    padding: 6px 8px;
    font-size: 11px;
  }
}
@media (max-height: 760px) and (min-width: 801px) {
  .party-portrait img {
    max-height: 110px;
  }
  .party-top {
    grid-template-columns: 68px minmax(0, 1fr);
    gap: 7px;
  }
  .party-slot .passive p {
    font-size: 10px;
    line-height: 1.45;
  }
  .party-title {
    margin-bottom: 4px;
  }
  .party-title h3 {
    font-size: 12px;
  }
  .sprite {
    height: 115px;
    width: 105px;
  }
  .actor {
    width: 140px;
  }
  .full-art {
    height: 150px;
  }
  .selection .hero-info .passive p {
    font-size: 11px;
  }
  .phase-label {
    font-size: 10px;
    top: 7px;
  }
}
@media (max-width: 800px) {
  .shell {
    grid-template: 48px 150px minmax(270px, 1fr) 150px / minmax(0, 1fr);
    height: 100dvh;
    min-height: 720px;
    gap: 7px;
    padding: 7px;
  }
  .topbar {
    grid-area: 1/1/2/2;
  }
  .brand {
    font-size: 20px;
  }
  .topbar > .eyebrow {
    font-size: 9px;
  }
  .top-tools button {
    font-size: 11px;
    min-height: 32px;
    padding: 5px 8px;
  }
  .party-panel {
    grid-area: 2/1/3/2;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: minmax(0, 1fr);
    gap: 6px;
  }
  .party-slot {
    padding: 6px;
    border-radius: 8px;
  }
  .party-top {
    grid-template-columns: 45px minmax(0, 1fr);
    gap: 5px;
  }
  .party-portrait {
    min-height: 40px;
  }
  .party-portrait img {
    max-height: 75px;
  }
  .party-title h3 {
    font-size: 10px;
  }
  .party-title .eyebrow {
    font-size: 8px;
  }
  .party-slot .passive p {
    font-size: 8px;
    line-height: 1.35;
  }
  .party-title {
    margin-bottom: 3px;
  }
  .party-slot > .six-faces {
    gap: 2px;
    margin-top: 6px;
  }
  .party-slot .face {
    border-width: 1px;
    --pip-size: 12px;
    border-radius: 4px;
  }
  .stage {
    grid-area: 3/1/4/2;
  }
  .dice-dock {
    grid-area: 4/1/5/2;
    gap: 13px;
    padding: 10px;
  }
  .map-panel {
    display: none;
  }
  .mobile-map {
    display: inline-block;
  }
  .selection {
    grid-template-columns: minmax(145px, 0.8fr) minmax(0, 1.2fr);
  }
  .selection-detail,
  .roster-area {
    padding: 10px;
  }
  .selection .full-art {
    height: 120px;
  }
  .selection .hero-info h3 {
    font-size: 13px;
  }
  .selection .hero-info .eyebrow {
    font-size: 9px;
  }
  .selection .hero-info .passive p {
    font-size: 10px;
  }
  .selection .six-faces {
    gap: 3px;
  }
  .selection .face {
    --pip-size: 13px;
    border-width: 1px;
  }
  .recruit-button {
    min-height: 36px;
    margin-top: 9px;
    padding: 6px;
  }
  .filter-row {
    margin-bottom: 8px;
    gap: 4px;
  }
  .filter-row img {
    width: 24px;
    height: 24px;
  }
  .filter-row button {
    min-height: 32px;
    font-size: 10px;
  }
  .filter-row .all-button {
    min-width: 34px;
  }
  .character-card {
    flex-basis: 90px;
    min-width: 90px;
    padding: 5px;
  }
  .character-card img {
    height: 90px;
  }
  .character-strip {
    min-height: 155px;
    gap: 7px;
  }
  .roster-hint {
    font-size: 9px;
    margin: 7px 0;
  }
  .die {
    width: 65px;
    height: 65px;
  }
  .dice-row {
    gap: 10px;
  }
  .dock-button {
    min-width: 65px;
    font-size: 11px;
    min-height: 44px;
  }
  .actor {
    width: 120px;
  }
  .sprite {
    height: 110px;
    width: 95px;
  }
  .actor-name {
    font-size: 9px;
  }
  .actor-vitals {
    grid-template-columns: 24px 1fr 25px;
    gap: 2px;
  }
  .enemy-action,
  .action-slot {
    width: 24px;
    height: 24px;
  }
  .enemy-action {
    --pip-size: 11px;
  }
  .hp-bar {
    height: 15px;
  }
  .hp-bar > span {
    font-size: 8px;
  }
  .shield-value {
    font-size: 10px;
  }
  .shield-value .icon {
    width: 11px;
  }
  .status-row {
    min-height: 20px;
    gap: 2px;
  }
  .status {
    font-size: 9px;
    min-height: 19px;
    padding: 1px 3px;
  }
  .status .icon {
    width: 13px;
    height: 13px;
  }
  .phase-label {
    font-size: 10px;
    top: 7px;
    padding: 5px 8px;
  }
  .target-name {
    font-size: 8px;
  }
  .growth {
    padding: 14px;
  }
  .growth-header h2 {
    font-size: 19px;
  }
  .growth-heroes button {
    font-size: 11px;
    padding: 6px 8px;
  }
  .growth-faces {
    gap: 5px;
  }
  .growth-faces small {
    font-size: 8px;
  }
  .growth-faces > button {
    padding: 4px;
  }
  .candidate-row {
    gap: 9px;
  }
  .candidate {
    padding: 12px;
  }
  .candidate h3 {
    font-size: 14px;
  }
  .candidate p {
    font-size: 11px;
  }
  .party-confirm {
    gap: 7px;
  }
  .party-confirm .hero-info {
    padding: 8px;
  }
  .party-confirm .full-art {
    height: 150px;
  }
  .party-confirm h3 {
    font-size: 12px;
  }
  .party-confirm .eyebrow {
    font-size: 9px;
  }
  .party-confirm .six-faces {
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
  }
  .party-confirm .passive p {
    font-size: 10px;
  }
  .result {
    padding: 20px 10px;
  }
  .result-heading h1 {
    font-size: 27px;
  }
  .result .full-art {
    height: 150px;
  }
  .result-meta {
    gap: 10px;
    font-size: 11px;
  }
  dialog {
    padding: 14px;
  }
  .admin-layout {
    display: block;
    height: auto;
    padding: 10px;
  }
  .admin-header {
    display: block;
    padding-bottom: 12px;
  }
  .admin-tools {
    margin-top: 12px;
  }
  .admin-nav {
    flex-direction: row;
    overflow-x: auto;
    margin: 12px 0;
  }
  .admin-nav button {
    white-space: nowrap;
  }
  .record-list {
    flex-direction: row;
    overflow-x: auto;
    margin-bottom: 12px;
    max-height: 90px;
  }
  .record-list button {
    white-space: nowrap;
  }
  .record-list .stage-select {
    min-width: 150px;
    margin: 0;
  }
  .admin-form {
    max-height: none;
    overflow: visible;
  }
  .admin-form .face-editor {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .admin-form .form-grid {
    gap: 0 10px;
  }
}
@media (max-width: 500px) {
  .shell {
    grid-template-rows: 46px 165px minmax(260px, 1fr) 135px;
    min-height: 710px;
  }
  .party-top {
    grid-template-columns: 32px 1fr;
    gap: 3px;
  }
  .party-slot .passive p {
    font-size: 7.5px;
  }
  .party-title h3 {
    font-size: 9px;
  }
  .party-title .eyebrow {
    font-size: 7px;
  }
  .slot-tag {
    font-size: 9px;
    left: 3px;
  }
  .party-slot .six-faces {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .party-slot .face {
    max-height: 24px;
    aspect-ratio: auto;
    height: 24px;
    --pip-size: 10px;
  }
  .party-slot .face > .icon {
    width: 38%;
    height: 50%;
  }
  .dice-dock {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
    padding: 8px;
  }
  .dice-row {
    grid-column: 1/-1;
    grid-row: 1;
    gap: 9px;
  }
  .die {
    width: 52px;
    height: 52px;
    padding: 3px;
  }
  .die .face {
    --pip-size: 21px;
  }
  .die-wrap {
    gap: 4px;
  }
  .die-owner {
    font-size: 8px;
    max-width: 56px;
  }
  .dock-button {
    grid-row: 2;
    min-height: 30px;
    width: 100%;
    padding: 4px;
  }
  .dock-button.primary {
    margin-top: 0;
  }
  .selection {
    grid-template-columns: minmax(130px, 0.85fr) minmax(0, 1.15fr);
  }
  .actor {
    width: 96px;
  }
  .sprite {
    width: 75px;
    height: 88px;
  }
  .actor-vitals {
    grid-template-columns: 21px 1fr 21px;
    gap: 1px;
  }
  .enemy-action,
  .action-slot {
    width: 21px;
    height: 21px;
  }
  .enemy-action {
    --pip-size: 10px;
  }
  .shield-value .icon {
    width: 9px;
  }
  .shield-value {
    font-size: 9px;
  }
  .hp-bar > span {
    font-size: 7px;
  }
  .phase-label {
    font-size: 8px;
  }
  .actor-name {
    font-size: 8px;
  }
  .party-confirm .full-art {
    height: 115px;
  }
  .party-confirm .hero-info {
    padding: 6px;
  }
  .party-confirm .passive p {
    font-size: 9px;
  }
  .patch-notes-scroll summary {
    font-size: 13px;
    padding: 12px;
  }
  .patch-note-content {
    font-size: 12px;
    padding: 15px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
/* PRODICE presentation: portraits are smooth; battlefield sprites keep crisp pixels. */
.filter-row img,.character-card img,.party-portrait img,.uploaded-icon { image-rendering:auto; }
.filter-row img { width:40px; height:40px; }
.party-portrait img { max-height:none; object-fit:contain; }
.party-top { grid-template-columns: minmax(65px, 30%) minmax(0,1fr); }
.party-hp.hp-bar { height:24px; margin-top:8px; }
.party-hp.hp-bar > span { font-size:13px; font-weight:700; }
.character-strip { min-height:320px; }
.character-card { flex-basis:150px; min-width:150px; }
.character-card img { height:240px; }
.roster-prompt { margin:18px 0 8px; font-size:16px; text-align:center; }
.party-effects { display:flex; justify-content:center; gap:14px; margin-top:20px; }
.party-effects .icon { width:28px; height:28px; }
.blank-map { pointer-events:none; }
.face > .icon { width:50%;height:50%;left:8%;top:8%; }
.face > b { right:14%;bottom:13%; font-size:calc(var(--pip-size) * 1.12); }
.die .face { --pip-size:34px; }
.growth,.event-card { text-align:center; }
.growth-header { justify-content:center; flex-direction:column; gap:8px; }
.growth-heroes,.growth-actions,.growth-faces,.candidate-row { justify-content:center; }
.growth-heroes button { border:2px solid var(--personal); }
.growth-heroes button.chosen:disabled { opacity:1; box-shadow:0 0 0 2px var(--personal); }
.growth-result { display:flex;justify-content:center;align-items:center;gap:24px;margin:35px 0; }
.growth-result .face { width:100px;--pip-size:36px; }
#effect-tooltip strong { display:block; font-size:15px; margin-bottom:4px; }
.actor { width:188px; }
.actor-vitals { grid-template-columns:36px minmax(0,1fr) 45px;gap:5px;height:38px; }
.actor .hp-bar { height:24px; }
.actor .hp-bar > span { font-size:12px;font-weight:700; }
.enemy-action,.action-slot { width:36px;height:36px; }
.enemy-action { --pip-size:18px; }
.shield-value { font-size:20px;gap:3px;min-width:45px; }
.shield-value .icon { width:25px;height:28px; }
.empty-shield { opacity:.55; }
.sprite-body { position:relative;display:block;isolation:isolate; }
.ground-shadow { position:absolute;left:12%;right:12%;bottom:0;height:12px;background:#0008;clip-path:polygon(15% 0,85% 0,85% 15%,95% 15%,95% 32%,100% 32%,100% 68%,95% 68%,95% 85%,85% 85%,85% 100%,15% 100%,15% 85%,5% 85%,5% 68%,0 68%,0 32%,5% 32%,5% 15%,15% 15%);z-index:-1; }
.sprite-tint { position:absolute;inset:0;pointer-events:none;mask-size:contain;mask-position:center bottom;mask-repeat:no-repeat;-webkit-mask-size:contain;-webkit-mask-position:center bottom;-webkit-mask-repeat:no-repeat; }
.sprite-tint.red { background:#f52d35; }
.sprite-tint.green { background:#36d94a; }
.fx-ring { position:absolute;width:100px;height:100px;left:calc(50% - 50px);top:25%;background:#8bdcff90;clip-path:polygon(30% 0,70% 0,70% 7%,85% 7%,85% 15%,93% 15%,93% 30%,100% 30%,100% 70%,93% 70%,93% 85%,85% 85%,85% 93%,70% 93%,70% 100%,30% 100%,30% 93%,15% 93%,15% 85%,7% 85%,7% 70%,0 70%,0 30%,7% 30%,7% 15%,15% 15%,15% 7%,30% 7%);pointer-events:none; }
.fx-shield { clip-path:polygon(15% 0,85% 0,85% 60%,70% 60%,70% 78%,60% 78%,60% 92%,40% 92%,40% 78%,30% 78%,30% 60%,15% 60%);background:#8bdcffa0; }
.fx-particles { position:absolute;inset:0;pointer-events:none; }
.fx-particles i { position:absolute;left:var(--x);top:65%;width:4px;height:6px;background:#fff1a0;animation:pixel-rise .45s steps(12,end) var(--delay) both; }
.fx-debuff i { top:15%;background:#654389;animation-name:pixel-fall; }
.fx-heal i { background:transparent;color:#b9f58b;font:bold 20px monospace;width:16px;height:16px; }
.fx-poison i { width:9px;height:11px;background:#48dd64a8;top:50%;clip-path:polygon(25% 0,75% 0,75% 15%,100% 15%,100% 85%,75% 85%,75% 100%,25% 100%,25% 85%,0 85%,0 15%,25% 15%);animation:pixel-bubble .8s steps(16,end) var(--delay) both; }
.fx-shout { position:absolute;left:82%;top:18%;font:bold 30px monospace;letter-spacing:-7px;color:#fff1bd;text-shadow:2px 0 #ab713b;pointer-events:none; }
.fx-shout.to-left { left:auto;right:82%;rotate:180deg; }
.fx-number { position:absolute;top:12%;left:25%;z-index:8;font:bold 24px monospace;color:#ff8b8b;text-shadow:2px 2px #141922,-1px -1px #141922;white-space:nowrap;pointer-events:none; }
.fx-number.heal {color:#b9f58b}.fx-number.shield {color:#9cddff}.fx-number.poison {color:#55e96d}
@keyframes pixel-rise {to {translate:0 -45px;opacity:0}}
@keyframes pixel-fall {to {translate:0 45px;opacity:0}}
@keyframes pixel-bubble {to {translate:0 -60px;opacity:0}}
.audio-preview {display:block;width:min(100%,440px);margin-bottom:10px;}
@media (min-width:801px) and (max-height:800px) {
 .character-strip {min-height:245px}.character-card img {height:170px}
 .actor {width:170px}.actor-vitals {grid-template-columns:30px minmax(0,1fr) 40px}.enemy-action,.action-slot{width:30px;height:30px}
 .actor .hp-bar{height:22px}.actor .hp-bar > span{font-size:10px}
}
@media (max-width:800px) {
 .filter-row img{width:28px;height:28px}.character-card{flex-basis:115px;min-width:115px}.character-card img{height:155px}.character-strip{min-height:225px}
 .party-top{grid-template-columns:32% minmax(0,1fr)}.party-hp.hp-bar{height:18px}.party-hp.hp-bar > span{font-size:9px}
 .actor{width:125px}.actor-vitals{grid-template-columns:24px minmax(0,1fr) 30px;gap:2px}.actor .hp-bar{height:20px}.actor .hp-bar > span{font-size:9px}
 .enemy-action,.action-slot{width:24px;height:24px}.enemy-action{--pip-size:12px}.shield-value{font-size:14px;min-width:30px}.shield-value .icon{width:17px;height:20px}
 .roster-prompt{font-size:12px}.party-effects{margin-top:8px;gap:7px}.party-effects .icon{width:20px;height:20px}.die .face{--pip-size:24px}
}
.roster-area {display:flex;flex-direction:column;overflow:hidden;}
.filter-row {flex:none;flex-wrap:wrap;overflow:visible;}
.character-strip {flex:1;min-height:210px;}
.character-card {display:flex;flex-direction:column;}
.character-card img {flex:1;min-height:0;height:0;}
.character-card b,.character-card small {flex:none;}
.roster-prompt,.roster-hint,.party-effects {flex:none;}
@media (min-width:801px) and (max-width:1500px) {
 .filter-row img {width:34px;height:34px;}
 .filter-row {gap:5px;}
 .filter-row button {padding:4px;gap:4px;font-size:12px;}
 .filter-row .all-button {min-width:38px;}
}
@media (max-width:800px) {
 .roster-area {overflow:auto;}
 .character-strip {flex:none;height:225px;}
}
.shell[aria-busy="true"] .die:disabled:not(.used) {opacity:1;}
.growth {padding:16px;}
.growth > p {margin:8px 0;}
.growth-header {margin-bottom:8px;gap:5px;}
.growth-heroes {margin-bottom:8px;}
.growth-faces {margin:8px 0;}
.growth-faces .face {max-width:64px;}
.candidate-row {margin:10px 0;}
.candidate {padding:12px;}
.candidate > .face {width:54px;--pip-size:23px;margin-bottom:4px;}
.candidate h3 {margin:4px 0;font-size:16px;}
.candidate p {min-height:0;margin:7px 0;line-height:1.5;}
.candidate p:last-of-type {min-height:36px;}
/* Character panels and roster share a true 1:2 illustration frame. */
:root {--dice-size:clamp(80px,5.3vw,100px);}
.party-slot {overflow:hidden;gap:7px;}
.party-name {text-align:center;font-size:21px;line-height:1.25;flex:none;margin:0;width:100%;}
.party-top {grid-template-columns:minmax(0,.9fr) minmax(0,1.4fr);gap:10px;flex:1;min-height:0;max-height:160px;}
.illustration-frame {position:relative;aspect-ratio:1 / 2;overflow:hidden;background:#1b273b;border-radius:6px;}
.illustration-frame img {display:block;width:100%;height:100%;object-fit:contain;object-position:center;image-rendering:auto;}
.party-portrait {height:100%;width:auto;max-width:100%;max-height:160px;min-height:0;align-self:center;justify-self:center;}
.illustration-missing {display:flex;align-items:center;justify-content:center;text-align:center;flex-direction:column;width:100%;height:100%;font-size:12px;line-height:1.6;color:#a8b6cc;}
.party-copy {display:flex;flex-direction:column;justify-content:flex-start;min-width:0;}
.party-hp.hp-bar {height:28px;flex:none;margin:4px 0 7px;}
.party-hp.hp-bar > span {font-size:16px;font-weight:900;}
.party-copy .status-row {justify-content:center;flex-wrap:wrap;}
.party-slot .passive {flex:none;width:100%;padding:8px 10px;border:1px solid #66788f;border-radius:6px;background:#172337;margin:0;}
.trait-label {display:block;color:#f4d699;font-size:13px;line-height:1.4;margin-bottom:4px;}
.party-slot .passive p {font-size:12px;line-height:1.5;margin:0;}
.party-slot > .six-faces {margin:0;flex:none;}
.selection {grid-template-columns:clamp(280px,34%,380px) minmax(0,1fr);}
.selection-detail {padding:14px;}
.selection .full-art {height:clamp(130px,18vh,195px);flex:none;}
.selection .hero-info {display:flex;flex-direction:column;justify-content:flex-start;}
.selection .hero-info h3 {font-size:23px;text-align:center;margin:5px 0;}
.selection .hp-label {display:block;text-align:center;font-size:26px;font-weight:800;line-height:1.4;color:#d4f29f;margin:7px 0;}
.selection .hp-label b {font-size:32px;font-weight:950;}
.selection .passive {border:1px solid #73859e;background:#172337;padding:10px;border-radius:7px;margin:7px 0 12px;}
.selection .passive .trait-label {font-size:16px;}
.selection .passive p {font-size:15px;line-height:1.55;margin:0;}
.selection .six-faces {display:grid;grid-template-columns:repeat(3,var(--dice-size));justify-content:center;gap:8px;}
.selection .six-faces .face {width:var(--dice-size);height:var(--dice-size);}
.face {container-type:inline-size;}
.face > .icon {width:58%;height:58%;left:6%;top:6%;}
.face > b {font-size:clamp(10px,38cqi,40px);right:11%;bottom:10%;font-variant-numeric:tabular-nums;letter-spacing:-.025em;}
.die {width:var(--dice-size);height:var(--dice-size);}
.character-strip {align-items:stretch;min-height:240px;}
.character-card {position:relative;flex:0 0 210px;min-width:210px;padding:10px;justify-content:center;gap:9px;}
.character-card .roster-illustration {width:auto;max-width:100%;height:calc(100% - 51px);max-height:380px;flex:0 1 auto;align-self:center;}
.character-card .roster-name {width:100%;min-height:45px;margin:0;display:flex;align-items:center;justify-content:center;font-size:18px;line-height:1.25;word-break:keep-all;overflow-wrap:anywhere;flex:none;}
.recruited-badge {position:absolute;z-index:2;left:5px;right:5px;top:8px;padding:8px 3px;color:#fff1c4;background:#17283deb;border:1px solid #d7bc77;border-radius:5px;font-size:19px;text-align:center;}
.character-card[aria-disabled="true"] {opacity:1;}
.character-card[aria-disabled="true"] .illustration-frame {opacity:.45;}
.character-card[aria-disabled="true"] .roster-name {opacity:.6;}
.roster-hint {margin:16px 0 0;padding:10px 0 0;border-top:1px solid #65768e;color:#e3eaf4;font-size:14px;line-height:1.8;flex:none;}
.sprite {width:208px;height:clamp(176px,27vh,272px);position:relative;z-index:1;}
.ground-shadow {background:#0003;bottom:7px;height:14px;left:15%;right:15%;z-index:0;}
@media (min-width:1600px) {.sprite {width:232px;height:296px;}}
@media (min-width:801px) and (max-height:800px) {
 .party-slot {gap:4px;padding:7px;}.party-name {font-size:18px;}
 .party-slot .passive {padding:5px 7px;}.party-slot .passive p {font-size:10px;}.trait-label {font-size:11px;margin-bottom:2px;}
 .party-hp.hp-bar {height:24px;}.party-hp.hp-bar > span {font-size:13px;}
 .selection .full-art {height:110px;}.selection .passive p {font-size:13px;}.selection .hp-label {margin:4px 0;}.selection .hp-label b {font-size:27px;}
 .selection .six-faces {grid-template-columns:repeat(3,72px);}.selection .six-faces .face{width:72px;height:72px;}
 .sprite {width:176px;height:205px;}
}
@media (max-width:800px) {
 :root {--dice-size:clamp(44px,10.6vw,64px);}
 .party-slot {padding:5px;gap:3px;overflow:auto;}.party-name {font-size:12px;}
 .party-top {grid-template-columns:32% minmax(0,1fr);min-height:38px;gap:4px;}
 .party-hp.hp-bar {height:18px;margin:0 0 3px;}.party-hp.hp-bar > span{font-size:10px;}
 .party-slot .passive{padding:3px;}.party-slot .passive p{font-size:8px;line-height:1.35;}.party-slot .trait-label{font-size:9px;margin:0;}
 .party-copy .status-row {min-height:16px;}.party-copy .status {min-height:14px;font-size:9px;}.party-copy .status .icon {width:12px;height:12px;}
 .illustration-missing{font-size:9px;}.selection{grid-template-columns:minmax(145px,.85fr) minmax(0,1.15fr);}
 .selection .full-art{height:115px;}.selection .hero-info h3{font-size:16px;}.selection .hp-label{font-size:18px;}.selection .hp-label b{font-size:24px;}
 .selection .passive{padding:6px;}.selection .passive .trait-label{font-size:12px;}.selection .passive p{font-size:11px;}
 .selection .six-faces {grid-template-columns:repeat(3,minmax(0,1fr));gap:4px;}.selection .six-faces .face{width:100%;height:auto;}
 .character-card{flex-basis:170px;min-width:170px;}.character-card .roster-name{font-size:14px;min-height:36px;}.character-card .roster-illustration {height:calc(100% - 43px);}
 .recruited-badge{font-size:16px;padding:5px 2px;}.roster-hint{font-size:12px;}
 .sprite {width:145px;height:170px;}.ground-shadow{height:10px;bottom:5px;}
}
@media (min-width:801px) {
 .selection {grid-template-columns:clamp(300px,34%,380px) minmax(0,1fr);}
 .selection .full-art {height:clamp(115px,16vh,170px);}
 .die {width:calc(var(--dice-size) + 14px);height:calc(var(--dice-size) + 14px);padding:4px;border-width:3px;}
 .die .face {width:var(--dice-size);height:var(--dice-size);}
 .party-portrait .illustration-missing {font-size:9px;white-space:nowrap;}
}
@media (min-width:801px) and (max-width:1200px) {
 :root {--dice-size:clamp(52px,6vw,70px);}
 .dice-row {gap:8px;}.dice-dock {gap:8px;}.dock-button{min-width:60px;}
}


/* Enhancement markers share the same renderer in every face presentation. */
.enhancement-stars {position:absolute;left:5%;bottom:5%;height:16%;display:flex;align-items:center;justify-content:flex-start;gap:0;line-height:1;pointer-events:none;filter:drop-shadow(0 1px 0 #65462a66);}
.enhancement-stars i {font-style:normal;font-size:clamp(4px,13cqi,13px);}
.enhancement-stars.tier-1 {color:#b77743;}
.enhancement-stars.tier-2 {color:#9aa8ba;}
.enhancement-stars.tier-3 {color:#d49d24;}
.enhancement-stars.tier-4 i {color:transparent;background:linear-gradient(135deg,#eea9c5 0%,#edc99f 22%,#e0e9a3 42%,#a3dfd4 62%,#b6c6f0 80%,#d8b3e7 100%);background-clip:text;-webkit-background-clip:text;}
.face-slot {display:block;min-width:0;border-radius:7px;}
.face-slot > .face {width:100%;height:100%;}
.face-changed {animation:face-change-glow 1400ms ease-out both;animation-delay:var(--face-elapsed,0ms);}
@keyframes face-change-glow {0%,100% {filter:none;box-shadow:0 0 0 transparent;} 18%,38% {filter:brightness(1.45);box-shadow:0 0 5px 3px #fff7d8,0 0 17px 5px #f4cb78;} 70% {filter:brightness(1.12);box-shadow:0 0 4px #f4cb78;}}
@media (prefers-reduced-motion:reduce) {.face-changed {animation-timing-function:steps(1,end);}}


/* Target cues live beside the relevant HUD row, without framing the sprite. */
.actor .action-slot {position:relative;display:flex;align-items:center;justify-content:flex-end;}
.target-arrow {display:block;flex:none;color:#ffe496;font:bold 22px/1 sans-serif;text-shadow:-2px 0 #131a29,2px 0 #131a29,0 -2px #131a29,0 2px #131a29,0 0 5px #000;pointer-events:none;}
.enemy-target-arrow {position:absolute;right:calc(100% + 5px);top:50%;transform:translateY(-50%);}
.party-slot .passive.passive-active {animation:passive-glow .75s ease-in-out infinite;}
@keyframes passive-glow {0%,100% {border-color:#b8a371;box-shadow:0 0 2px #f9d57b;} 50% {border-color:#fff1b8;box-shadow:0 0 5px 2px #ffe29b,0 0 12px #ffd36d;}}
@media (max-width:700px) {.target-arrow {font-size:17px;}.enemy-target-arrow {right:calc(100% + 3px);}}
@media (prefers-reduced-motion:reduce) {.party-slot .passive.passive-active {animation:none;border-color:#fff1b8;box-shadow:0 0 5px #ffe29b;}}
.actor.retired .actor-vitals,.actor.retired .status-row,.actor.retired .target-name {visibility:hidden;}
.sprite.grave-sprite {object-fit:scale-down;}
.actor.retired:disabled {opacity:1;}

/* Party: illustration spans the full upper area; dice remain a separate row. */
.party-slot .party-top {width:100%;max-height:none;flex:1;min-height:0;grid-template-columns:minmax(0,.85fr) minmax(0,1.4fr);gap:9px;align-items:stretch;}
.party-slot .party-portrait {width:100%;height:100%;max-height:none;aspect-ratio:auto;align-self:stretch;}
.party-slot .party-portrait img {object-position:center bottom;}
.party-slot .party-copy {gap:4px;justify-content:center;}
.party-slot .party-name {font-size:19px;overflow-wrap:anywhere;}
.party-slot .party-copy > .passive {padding:7px;flex:1;min-height:0;overflow:auto;display:flex;flex-direction:column;justify-content:center;}
.party-slot .party-copy .status-row:empty {display:none;}
.party-slot .party-hp.hp-bar {margin:3px 0;height:27px;}
.party-slot > .six-faces {width:100%;flex:none;}
/* The portrait and its category badges share one lower-right anchor. */
.character-strip {container-type:size;}
.character-card {--roster-art-height:min(352px,calc(100cqh - 52px));height:calc(var(--roster-art-height) + 52px);flex:0 0 calc(var(--roster-art-height) / 2 + 14px);min-width:0;padding:5px;gap:4px;justify-content:flex-start;}
.roster-art {position:relative;flex:none;min-height:0;width:100%;height:var(--roster-art-height);}
.character-card .roster-art .roster-illustration {width:100%;height:100%;max-height:none;max-width:none;aspect-ratio:1 / 2;}
.character-card .roster-art img {height:100%;width:100%;object-position:center bottom;}
.character-card .roster-name {font-size:16px;min-height:34px;line-height:1.2;padding:2px;}
.category-icons {position:absolute;right:0;bottom:0;display:flex;gap:0;padding:0;background:transparent;border-radius:0;}
.character-card .category-icons img {flex:none;width:40px;height:40px;object-fit:contain;background:transparent;}
/* Center the map when it fits; scroll toward the current node otherwise. */
.map-panel h3 {font-size:19px;margin:6px 0;}
.map-panel > .eyebrow {font-size:13px;color:#e1e7f3;}
.map-canvas {margin-block:auto;}
.map-node {width:72px;height:60px;font-size:14px;font-weight:800;border-width:2px;color:#f0f3fa;background:#30425e;}
.map-node:disabled {opacity:.65;}
.map-node.visited:disabled {opacity:.8;}
.map-node.current:disabled {opacity:1;}
.actor.enemy:not(.retired) .sprite-body {scale:.9;transform-origin:center bottom;}
/* A used die never participates in the presentation-only brightness override. */
.shell[aria-busy] .die.used:disabled {opacity:.3;}
.stage > .growth,.stage > .rest-choice {display:flex;flex-direction:column;justify-content:center;align-items:center;text-align:center;gap:14px;height:100%;padding:24px;overflow:auto;}
.growth > *,.rest-choice > * {flex-shrink:0;max-width:100%;}
.growth-header {justify-content:center;margin:0;}
.growth-header h2,.rest-choice h2 {font-size:28px;margin:0;}
.growth-actions {justify-content:center;align-items:stretch;width:100%;gap:20px;margin:4px 0;}
.growth-actions > button {display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;width:min(42%,300px);min-height:190px;padding:22px 15px;line-height:1.5;}
.growth-actions strong {font-size:28px;font-weight:900;}
.growth-actions span {font-size:18px;}
.growth-actions small {font-size:16px;}
.growth-heroes,.growth-faces,.candidate-row {justify-content:center;margin:0;}
.growth-faces,.candidate-row {width:min(100%,660px);}
@media (max-height:700px) {
 .party-slot .party-name {font-size:16px;}.party-slot .party-copy > .passive {padding:4px;}.party-slot .passive p {font-size:10px;}
 .growth-actions > button {min-height:155px;padding:14px;}.growth-actions strong {font-size:25px;}.growth-actions span {font-size:16px;}
}
@media (max-width:800px) {
 .party-slot .party-top {gap:4px;}.party-slot .party-name {font-size:13px;}.party-slot .party-copy > .passive {padding:4px;}.party-slot .party-hp.hp-bar {height:20px;}.party-slot .party-hp.hp-bar > span {font-size:11px;}
 .character-card .category-icons img {width:32px;height:32px;}.character-card .roster-name {font-size:14px;}
 .map-node {width:60px;height:56px;font-size:12px;}
 .growth-actions {gap:10px;}.growth-actions > button {width:48%;padding:10px;min-height:150px;}.growth-actions strong {font-size:23px;}.growth-actions span {font-size:14px;}.growth-actions small {font-size:13px;}
}

/* Apply taps immediately on touch screens as well as mouse clicks. */
button, [role="button"] {touch-action:manipulation;}

/* Selection detail: compact portrait summary, fixed trait lines, dice above recruit. */
.selection .selection-hero {gap:12px;min-height:min-content;}
.selection-summary {display:grid;grid-template-columns:minmax(80px,.85fr) minmax(0,1.15fr);align-items:center;gap:10px;flex:none;height:clamp(110px,16vh,155px);}
.selection .selection-summary .full-art {width:100%;height:100%;min-height:0;object-fit:contain;}
.selection-summary-copy {min-width:0;}
.selection .selection-summary h3 {font-size:21px;margin:0 0 6px;text-align:center;overflow-wrap:anywhere;}
.selection .selection-summary .hp-label {font-size:20px;margin:4px 0;}
.selection .selection-summary .hp-label b {font-size:26px;}
.character-description {font-size:13px;line-height:1.5;height:3em;min-height:3em;margin:6px 0 0;white-space:pre-line;overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow-wrap:anywhere;}
.selection .selection-hero > .passive {flex:none;margin:0;}
.selection .selection-hero > .passive .trait-label {text-align:center;}
.selection .selection-hero > .passive p {line-height:1.55;height:3.1em;min-height:3.1em;overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow-wrap:anywhere;}
.selection .selection-hero > .six-faces {margin-top:auto;padding-top:8px;flex:none;}
#character-preview .selection-hero {display:flex;flex-direction:column;gap:12px;max-width:380px;}
#character-preview .selection-summary .full-art {width:100%;height:100%;}
#character-preview .selection-summary .hp-label {display:block;text-align:center;}
#character-preview .selection-hero > .passive .trait-label {text-align:center;}
#character-preview .selection-hero > .passive p {line-height:1.55;height:3.1em;overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;}
@media (max-width:800px) {
 .selection-summary {grid-template-columns:minmax(55px,.8fr) minmax(0,1.2fr);gap:6px;height:110px;}
 .selection .selection-summary h3 {font-size:16px;}
 .selection .selection-summary .hp-label {font-size:15px;}.selection .selection-summary .hp-label b {font-size:20px;}
 .selection .character-description {font-size:11px;}
}

/* Keep destructive record actions away from names and editing fields. */
.admin-form .admin-record-header {display:flex;flex-direction:row;align-items:flex-start;justify-content:space-between;gap:24px;width:100%;}
.admin-form .admin-record-header > h2 {flex:1;min-width:0;margin:0;overflow-wrap:anywhere;}
.admin-form .admin-record-header > [data-command="delete"] {flex:none;margin-inline-start:auto;align-self:flex-start;}

/* Shared trait panel: centered heading and a real divider across both screens. */
.passive .trait-label {
  align-self:stretch;text-align:center;margin:0;padding:5px 6px;
  border-bottom:1px solid #73859e;flex:none;
}
.party-slot .party-copy > .passive,
.selection .selection-hero > .passive,
#character-preview .selection-hero > .passive {
  display:flex;flex-direction:column;justify-content:flex-start;
  padding:0;border:1px solid #73859e;border-radius:7px;background:#172337;
  overflow:hidden;
}
.party-slot .party-copy > .passive {flex:1;min-height:64px;}
.party-slot .passive p {padding:6px 8px;overflow:auto;margin:0;}
.party-slot .party-copy .status-row,
.party-slot .party-copy .status-row:empty {display:flex;flex:none;min-height:19px;margin:0;}
.selection .selection-hero {min-height:0;gap:10px;}
.selection-summary {
  height:auto;min-height:150px;flex:1;
  grid-template-columns:minmax(0,1fr) minmax(0,1.12fr);align-items:stretch;
}
.selection .selection-summary .full-art {height:100%;max-height:none;object-position:center bottom;}
.selection-summary-copy {display:flex;flex-direction:column;justify-content:center;}
.selection .character-description {
  display:-webkit-box;height:calc(3em + 18px);min-height:calc(3em + 18px);
  box-sizing:border-box;padding:8px;border:1px solid #c5bca9;background:#172337;margin-top:8px;
}
.selection .selection-hero > .passive {flex:none;margin-top:0;margin-bottom:0;}
.selection .selection-hero > .passive p,
#character-preview .selection-hero > .passive p {
  height:calc(3.1em + 16px);min-height:calc(3.1em + 16px);box-sizing:border-box;
  padding:8px 10px;margin:0;line-height:1.55;
}
.selection .selection-hero > .six-faces {margin-top:0;padding-top:0;}
#character-preview .selection-summary {height:230px;flex:none;}
#character-preview .selection-hero > .passive {width:100%;}
@media(max-height:700px), (max-width:800px) {
 .selection-summary {min-height:120px;}
 .selection .selection-hero {gap:7px;}
 .passive .trait-label {padding:3px 5px;}
 .party-slot .party-copy > .passive {min-height:48px;}
 .party-slot .party-copy .status-row,.party-slot .party-copy .status-row:empty {min-height:14px;}
 .party-slot .passive p {padding:3px 5px;}
}
/* Let short desktop windows give spare height to the sprite without pushing dice into the recruit button. */
.selection .selection-summary {min-height:80px;}
.selection .selection-summary-copy {min-height:0;}
@media (max-height:800px) {
 .selection .selection-summary h3 {font-size:18px;margin-bottom:4px;}
 .selection .selection-summary .hp-label {font-size:17px;margin:2px 0;}
 .selection .selection-summary .hp-label b {font-size:23px;}
 .selection .character-description {font-size:12px;padding:6px;height:calc(3em + 14px);min-height:calc(3em + 14px);margin-top:5px;}
}
@media (max-height:700px), (max-width:800px) {
 .selection .selection-summary {min-height:60px;}
}
@media (max-height:700px), (max-width:800px) {
 .selection .selection-detail {overflow-y:auto;}
 .selection .selection-hero {flex:1 0 auto;min-height:420px;}
}
