/* Readable names, tier progress and shared hover / click effect comparisons. */
.rail > .panel:first-child > header {
  display: flex;
}
.rail .synergy-label {
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
  clip-path: none;
  white-space: normal;
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
}
.rail .synergy-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  min-height: 62px;
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--type);
  border-radius: 9px;
  text-align: left;
}
.rail .synergy-row[data-active="true"] {
  background: color-mix(in srgb, var(--type) 14%, var(--surface-2));
}
.rail .synergy-row[data-active="false"] {
  opacity: 0.86;
}
.rail .synergy-row:hover,
.rail .synergy-row:focus-visible {
  outline: 2px solid #f2d36c;
  outline-offset: 1px;
  z-index: 20;
}
.rail .synergy-name {
  gap: 9px;
  min-width: 0;
}
.rail .synergy-name .type-icon {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  padding: 4px;
}
.synergy-identity {
  display: grid;
  gap: 3px;
}
.synergy-tier-caption {
  color: var(--ink-muted);
  font-size: 10px;
  white-space: nowrap;
}
.synergy-row[data-active="true"] .synergy-tier-caption {
  color: #f2d36c;
}
.synergy-progress {
  display: grid;
  justify-items: end;
  gap: 5px;
}
.rail .synergy-count {
  background: transparent;
  padding: 0;
  border: 0;
  margin: 0;
  color: var(--ink);
  font-size: 12px;
  white-space: nowrap;
}
.rail .synergy-row[data-active="true"] .synergy-count {
  background: transparent;
  color: #f2d36c;
  text-shadow: none;
}
.rail .synergy-steps {
  display: flex;
  gap: 3px;
}
.rail .synergy-steps > span {
  display: inline-grid;
  place-items: center;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  border-radius: 3px;
  border: 1px solid var(--line-soft);
  color: var(--ink-faint);
  font-size: 9px;
}
.rail .synergy-steps > span[data-reached="true"] {
  color: var(--ink);
  border-color: var(--type);
}
.rail .synergy-steps > span[data-current="true"] {
  background: #f2d36c;
  color: #222114;
  border-color: #f2d36c;
}
.synergy-hover-card {
  display: block;
  box-sizing: border-box;
  position: fixed;
  z-index: 500;
  max-width: calc(100vw - 20px);
  max-height: calc(100vh - 20px);
  overflow-y: auto;
  padding: 18px;
  background: #151d29;
  color: #f2f4f6;
  border: 1px solid #717061;
  border-radius: 12px;
  box-shadow: 0 14px 50px #000b;
  text-align: left;
  cursor: default;
  font-family: var(--font-ui);
  font-weight: 400;
  pointer-events: auto;
  overscroll-behavior: contain;
}

.synergy-tooltip-name {
  display: block;
  font-size: 19px;
  margin-bottom: 12px;
}
.synergy-effects {
  display: grid;
  gap: 11px;
}
.synergy-effect-note {
  font-size: 12px;
  line-height: 1.55;
  color: #bbc5d0;
}
.synergy-tier-line {
  display: flex;
  gap: 12px;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid #ffffff21;
  font-size: 12px;
  color: #a7b0bd;
}
.synergy-tier-line > span {
  margin-right: auto;
}
.synergy-effect-line {
  display: grid;
  gap: 5px;
  font-size: 12px;
  line-height: 1.4;
}
.synergy-effect-line > span:first-child {
  color: #c5ceda;
}
.synergy-effect-values {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: baseline;
  color: #a7b0bd;
  font-variant-numeric: tabular-nums;
}
.synergy-effect-values b {
  font-weight: 500;
}
.synergy-effects [data-current="true"] {
  color: #ffe16e;
  font-weight: 800;
}
.synergy-value-divider {
  color: #5e6977;
}
.synergy-screen .synergy-effects {
  margin-top: 20px;
}
@media (max-width: 650px) {
  .rail .synergy-row {
    min-height: 56px;
  }
  .synergy-hover-card {
    padding: 14px;
  }
}

/* Scroll the synergy list, keeping the boss and round panels in the rail. */
.main > .rail,
.main[data-pane] > .rail {
  overflow: hidden !important;
}
.rail > .panel {
  flex: 0 0 auto;
  min-height: 0;
}
.rail > .panel:first-child {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  max-height: 526px;
  overflow: hidden;
}
.rail > .panel:first-child > header {
  flex: 0 0 auto;
}
.rail > .panel:first-child > .panel-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.rail > .panel:first-child > .panel-body > div {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.rail .synergy-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  max-height: 470px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 3px;
  scrollbar-width: thin;
  overscroll-behavior: contain;
}
.rail .synergy-row {
  box-sizing: border-box;
  flex: 0 0 62px;
  height: 62px;
  min-height: 62px;
}
.rail > .panel:nth-child(2) {
  display: flex;
  flex-direction: column;
  flex: 0 1 auto;
  max-height: 42%;
  min-height: 100px;
  overflow: hidden;
}
.rail > .panel:nth-child(2) > header {
  flex: 0 0 auto;
}
.rail > .panel:nth-child(2) > .panel-body {
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
}

.rail .synergy-row[aria-pressed="true"] {
  outline: 2px solid var(--type);
  outline-offset: -2px;
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--type) 45%, transparent);
}
.rail .synergy-row[aria-pressed="true"] .synergy-label {
  color: var(--type);
}

/* Stacked encounter cards, ordered from the left of the GNB. */
.spawn-bonuses {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  flex: 0 1 auto;
  min-width: 0;
  padding: 3px 5px;
}
.spawn-bonuses[hidden] {
  display: none;
}
.spawn-bonus {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  flex: 0 0 31px;
  width: 31px;
  height: 31px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: help;
}
.spawn-bonus::before {
  content: "";
  pointer-events: none;
  position: absolute;
  z-index: -1;
  inset: calc(-1 * var(--spawn-glow, 6px));
  border-radius: 50%;
  background: radial-gradient(circle, var(--spawn-color) 0%, transparent 72%);
  opacity: 0.45;
  animation: spawn-bonus-glow 2.6s ease-in-out infinite alternate;
}
.spawn-bonus-ball {
  position: relative;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  border: 2px solid #182334;
  background: linear-gradient(
    to bottom,
    var(--spawn-color) 0 44%,
    #182334 44% 56%,
    #f5f8fc 56%
  );
  box-shadow:
    inset -3px -2px 0 #0002,
    0 1px 3px #0008;
}
.spawn-bonus-ball::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 7px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border: 2px solid #182334;
  border-radius: 50%;
  background: #f7fbff;
}
.spawn-bonus .type-icon {
  position: absolute;
  width: 15px;
  height: 15px;
  right: -3px;
  bottom: -2px;
  z-index: 1;
  padding: 1px;
  border-radius: 50%;
  background: #152131;
  box-shadow: 0 0 0 1px #ffffff50;
}
.spawn-bonus:focus-visible {
  outline: 2px solid #ffe69c;
  outline-offset: 5px;
}
@keyframes spawn-bonus-glow {
  from {
    transform: scale(0.85);
    opacity: 0.35;
  }
  to {
    transform: scale(1.15);
    opacity: 0.7;
  }
}
@media (prefers-reduced-motion: reduce) {
  .spawn-bonus::before {
    animation: none;
    transform: none;
    opacity: 0.5;
  }
}
.spawn-bonuses[data-reduced-motion="true"] .spawn-bonus::before {
  animation: none;
  transform: none;
  opacity: 0.5;
}
@media (max-width: 900px) {
  .spawn-bonuses {
    gap: 5px;
  }
  .spawn-bonus {
    flex-basis: 26px;
    width: 26px;
    height: 26px;
  }
  .spawn-bonus-ball {
    width: 24px;
    height: 24px;
  }
}

.spawn-bonuses {
  max-width: min(29vw, 330px);
  max-height: 58px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 12px 8px;
  scrollbar-width: none;
}
.spawn-bonuses::-webkit-scrollbar {
  display: none;
}
@media (max-width: 900px) {
  .spawn-bonuses {
    max-width: 23vw;
    padding-inline: 5px;
  }
}

/* GNB only: full-color artwork; other screens keep their established icons. */
#top-actions .ico,
#readouts > .readout > .ico {
  background: var(--gnb-art) center / contain no-repeat;
  -webkit-mask: none;
  mask: none;
  border: 0;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  width: 27px;
  height: 27px;
  flex: none;
  filter: drop-shadow(0 1px 1px #0007);
}
#top-actions .ico::before,
#top-actions .ico::after,
#readouts > .readout > .ico::before,
#readouts > .readout > .ico::after {
  content: none;
  display: none;
}
#top-actions .ico[data-icon="book"],
#readouts .ico[data-icon="book"] {
  --gnb-art: url("../assets/ui/icons/gnb/book.svg");
}
#top-actions .ico[data-icon="bag"],
#readouts .ico[data-icon="bag"] {
  --gnb-art: url("../assets/ui/icons/gnb/bag.svg");
}
#top-actions .ico[data-icon="target"],
#readouts .ico[data-icon="target"] {
  --gnb-art: url("../assets/ui/icons/gnb/target.svg");
}
#top-actions .ico[data-icon="save"],
#readouts .ico[data-icon="save"] {
  --gnb-art: url("../assets/ui/icons/gnb/save.svg");
}
#top-actions .ico[data-icon="flask"],
#readouts .ico[data-icon="flask"] {
  --gnb-art: url("../assets/ui/icons/gnb/flask.svg");
}
#top-actions .ico[data-icon="gear"],
#readouts .ico[data-icon="gear"] {
  --gnb-art: url("../assets/ui/icons/gnb/gear.svg");
}
#top-actions .ico[data-icon="crown"],
#readouts .ico[data-icon="crown"] {
  --gnb-art: url("../assets/ui/icons/gnb/crown.svg");
}
#top-actions .ico[data-icon="sun"],
#readouts .ico[data-icon="sun"] {
  --gnb-art: url("../assets/ui/icons/gnb/sun.svg");
}
#top-actions .ico[data-icon="spark"],
#readouts .ico[data-icon="spark"] {
  --gnb-art: url("../assets/ui/icons/gnb/spark.svg");
}
#top-actions .ico[data-icon="users"],
#readouts .ico[data-icon="users"] {
  --gnb-art: url("../assets/ui/icons/gnb/users.svg");
}
#top-actions .ico[data-icon="back"],
#readouts .ico[data-icon="back"] {
  --gnb-art: url("../assets/ui/icons/gnb/back.svg");
}
#top-actions .ico[data-icon="swords"],
#readouts .ico[data-icon="swords"] {
  --gnb-art: url("../assets/ui/icons/gnb/swords.svg");
}
#top-actions .ico[data-icon="user"],
#readouts .ico[data-icon="user"] {
  --gnb-art: url("../assets/ui/icons/gnb/user.svg");
}
#top-actions .ico[data-icon="flag"],
#readouts .ico[data-icon="flag"] {
  --gnb-art: url("../assets/ui/icons/gnb/flag.svg");
}
#top-actions .ico[data-icon="heart"],
#readouts .ico[data-icon="heart"] {
  --gnb-art: url("../assets/ui/icons/gnb/heart.svg");
}
#top-actions .ico[data-icon="skull"],
#readouts .ico[data-icon="skull"] {
  --gnb-art: url("../assets/ui/icons/gnb/skull.svg");
}
#top-actions .ico[data-icon="grid"],
#readouts .ico[data-icon="grid"] {
  --gnb-art: url("../assets/ui/icons/gnb/grid.svg");
}
#readouts .ico[data-icon="grid"] {
  --gnb-art: url("../assets/ui/pokeball.png");
  image-rendering: pixelated;
}
/* Every readout reserves the same space. Digits never resize adjacent readouts. */
#readouts {
  display: flex;
  flex: 0 1 auto;
  min-width: 118px;
  gap: 6px;
  width: max-content;
  max-width: 590px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
#readouts::-webkit-scrollbar,
#top-actions::-webkit-scrollbar {
  display: none;
}
#readouts > .readout {
  box-sizing: border-box;
  flex: 0 0 112px;
  width: 112px;
  min-width: 112px;
  max-width: 112px;
  gap: 6px;
  padding: 3px 7px;
  justify-content: flex-start;
}
#readouts > .readout > .value {
  display: flex;
  align-items: baseline;
  gap: 2px;
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}
#readouts > .readout > .value small {
  flex: none;
  font-size: 9px;
}
#readouts > .readout > .label {
  display: none;
}
#readouts .hud-count-label {
  flex: none;
  font-size: 9px;
  font-weight: 700;
  color: var(--ink-muted, #bdc9d9);
}
#readouts > .readout > .hud-gold-coin {
  flex: none;
  width: 27px;
  height: 27px;
}
#readouts > .readout[data-tone="board"] > .value {
  font-size: 16px;
}
#top-actions {
  flex: 0 1 auto;
  min-width: 76px;
  max-width: 44vw;
  margin-left: auto;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  gap: 5px;
}
#top-actions > .btn,
#top-actions .pane-toggles {
  flex: none;
}
@media (max-width: 900px) {
  #readouts {
    min-width: 112px;
    max-width: 48vw;
    gap: 6px;
  }
  #top-actions {
    min-width: 70px;
    max-width: 38vw;
    gap: 4px;
  }
  #top-actions .ico {
    width: 24px;
    height: 24px;
  }
}
/* Keep the placement label readable in both languages within its fixed slot. */
#readouts > .readout[data-tone="board"] > .value {
  display: block;
  line-height: 1.1;
}
#readouts > .readout[data-tone="board"] .hud-count-label {
  display: block;
  line-height: 1.2;
  margin-bottom: 1px;
}
#readouts > .readout > .value small {
  display: inline;
}

.totem-sprite-icon {
  display: inline-block;
  flex: none;
  background-repeat: no-repeat;
  image-rendering: pixelated;
  pointer-events: none;
}
.totem-management-name {
  display: flex;
  align-items: center;
  gap: 8px;
}
.totem-management .synergy21-row {
  flex-wrap: wrap;
}

/* Compact rail: content determines height, with bare synergy and boss icons. */
#rail {
  gap: 6px;
}
#rail > .panel:first-child {
  flex: 0 1 auto;
  min-height: 0;
  height: auto;
}
#rail > .panel > .panel-body {
  padding: 6px;
}
#rail > .panel:first-child > .panel-body {
  flex: 0 1 auto;
}
#rail .synergy-list {
  gap: 2px;
  padding: 2px;
  max-height: min(470px, 48dvh);
}
#rail .synergy-row {
  flex: 0 0 34px;
  height: 34px;
  min-height: 34px;
  padding: 2px 4px;
  gap: 6px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
#rail .synergy-row .type-icon {
  flex: 0 0 26px;
  width: 26px !important;
  height: 26px !important;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
#rail .synergy-progress {
  gap: 2px;
}
#rail .synergy-count {
  font-size: 11px;
}
#rail .synergy-row[aria-pressed="true"] {
  outline: 1px solid var(--ink-muted);
  outline-offset: -1px;
}
#rail > .panel:nth-child(2) {
  flex: none;
  min-height: 0;
  max-height: none;
}
#rail .boss-preview {
  display: flex;
  flex-flow: row wrap;
  align-items: center;
  gap: 5px;
}
#rail .boss-preview-round {
  align-self: center;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-size: 10px !important;
}
#rail .boss-preview-selected {
  display: flex;
  gap: 3px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}
#rail .boss-preview-selected > div,
#rail .boss-preview > p,
#rail .boss-preview > .chip,
#rail .boss-candidates {
  display: none;
}
#rail .boss-preview-selected .portrait {
  width: 36px !important;
  height: 36px !important;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
#rail .boss-preview-selected .portrait > img,
#rail .boss-preview-selected .portrait > .sprite-thumb {
  width: 100%;
  height: 100%;
}
#rail .synergy-list > .empty-detail {
  min-height: 0;
  padding: 6px;
  font-size: 11px;
}
#rail .synergy-count {
  line-height: 1;
}
#rail .synergy-steps > span {
  height: 12px;
  min-width: 12px;
  font-size: 8px;
  line-height: 1;
}

/* Independent top/bottom anchors share a narrow, click-through left rail. */
.main > #rail.rail,
.main[data-pane] > #rail.rail {
  display: flex !important;
  width: 128px !important;
  left: 12px !important;
  top: 12px !important;
  bottom: 12px !important;
  gap: 5px;
  align-items: flex-start;
  pointer-events: none;
}
#rail > .panel {
  flex: none;
  width: max-content;
  max-width: 100%;
  border-radius: 9px;
  pointer-events: auto;
}
#rail > .panel:first-child {
  flex: 0 1 auto;
  width: 100%;
  min-height: 0;
  max-height: calc(100% - 136px);
}
#rail > .panel:first-child > .panel-body,
#rail > .panel:first-child > .panel-body > div {
  flex: 0 1 auto;
  min-height: 0;
}
#rail .synergy-list {
  max-height: none;
  padding: 0;
  gap: 1px;
}
#rail .synergy-row {
  flex-basis: 30px;
  height: 30px;
  min-height: 30px;
  padding: 1px 2px;
  gap: 8px;
  justify-content: flex-start;
}
#rail .synergy-row .type-icon {
  flex-basis: 22px;
  width: 22px !important;
  height: 22px !important;
}
#rail .synergy-progress {
  margin-left: auto;
}
#rail .synergy-steps {
  gap: 2px;
}
#rail .synergy-steps > span {
  min-width: 10px;
  width: 10px;
  height: 10px;
  padding: 0;
  font-size: 7px;
}
#rail > .panel:nth-child(2) {
  margin-top: auto;
}
#rail .boss-preview {
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
#rail .boss-preview-round {
  align-self: flex-start;
  font-size: 9px !important;
}
#rail .wave-summary {
  gap: 5px;
  padding: 0;
}
#rail .wave-summary > span:last-child {
  min-width: 0;
}
#rail .wave-summary b {
  display: block;
  max-width: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}
#rail .wave-summary small {
  font-size: 9px;
  white-space: nowrap;
}
@media (max-width: 600px) {
  .main > #rail.rail,
  .main[data-pane] > #rail.rail {
    width: 112px !important;
    left: 10px !important;
    top: 10px !important;
    bottom: 10px !important;
  }
  #rail > .panel > .panel-body {
    padding: 4px;
  }
  #rail .synergy-row {
    gap: 4px;
  }
  #rail .synergy-count {
    font-size: 10px;
  }
  #rail .wave-summary b {
    max-width: 60px;
    font-size: 10px;
  }
}
@media (max-height: 420px) {
  .main > #rail.rail,
  .main[data-pane] > #rail.rail {
    overflow-y: auto !important;
  }
  #rail > .panel:first-child {
    flex: none;
    max-height: 120px;
  }
}
