@import url("assets/fonts/fonts.css");
:root {
  --ink: #f1eedb;
  --muted: #a4afa6;
  --gold: #f2cd7a;
  --panel: #202a2b;
  --line: #ffffff17;
  --mint: #97c8af;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #172222;
  color: var(--ink);
  font-family: "DM Sans", sans-serif;
}
button {
  font: inherit;
  cursor: pointer;
  color: inherit;
  border: none;
  touch-action: manipulation;
}
button:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 4px;
}
button:disabled {
  cursor: default;
}
button:hover {
  filter: brightness(1.12);
}
#game {
  height: 100dvh;
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
#arena {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  image-rendering: pixelated;
}
.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 160px #07171380;
}
.hidden {
  display: none !important;
}
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #111d20d9;
  backdrop-filter: blur(3px);
  z-index: 10;
  padding: 24px;
}
.selection-content {
  width: min(100%, 1020px);
}
.brand {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 23px;
  font-weight: 700;
  letter-spacing: -1.3px;
}
.brand > span > span {
  font-weight: 400;
  color: var(--mint);
}
.brand-die {
  font-size: 32px;
  color: var(--gold);
}
.tag {
  font-family: "DM Sans", sans-serif;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 1.3px;
  border: 1px solid #b8c8b52e;
  padding: 5px 7px;
  border-radius: 4px;
  color: var(--muted);
  margin-left: 8px;
}
.selection-heading {
  text-align: center;
  margin: 27px 0;
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 2px;
  font-weight: 700;
  color: var(--mint);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.eyebrow > span {
  height: 1px;
  background: #76908266;
  width: 25px;
}
h1,
h2 {
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: -2.5px;
  line-height: 1.03;
  margin: 13px 0 12px;
  font-size: 54px;
  font-weight: 600;
}
h1 br {
  display: none;
}
h1 em {
  font-style: normal;
  color: var(--gold);
}
p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
  margin: 0;
}
#character-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.character-card {
  position: relative;
  border: 1px solid #c1d8c021;
  border-radius: 15px;
  background: linear-gradient(155deg, #2b3736, #20292b);
  overflow: hidden;
  transition:
    transform 0.18s,
    border-color 0.18s;
  box-shadow: 0 8px 30px #0002;
  --accent: var(--gold);
}
.character-card:hover {
  transform: translateY(-5px);
  border-color: var(--accent);
}
.card-top {
  position: absolute;
  top: 17px;
  left: 18px;
  right: 18px;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.class-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 700;
  color: var(--accent);
}
.card-number {
  font-family: monospace;
  font-size: 11px;
  color: #ffffff4a;
}
.portrait-stage {
  height: 215px;
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: radial-gradient(
    ellipse at 50% 80%,
    color-mix(in srgb, var(--accent) 12%, transparent),
    transparent 67%
  );
}
.portrait-stage:before {
  content: "";
  position: absolute;
  width: 158px;
  height: 158px;
  border: 1px solid color-mix(in srgb, var(--accent) 14%, transparent);
  border-radius: 50%;
  bottom: 3px;
}
.portrait {
  position: relative;
  width: 178px;
  height: 207px;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 8px 1px #0003);
  z-index: 1;
}
.card-info {
  padding: 17px 21px 19px;
}
.character-meta {
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 4px;
}
.card-info h3 {
  font-family: "Space Grotesk";
  font-size: 23px;
  letter-spacing: -0.6px;
  margin: 0 0 14px;
}
.trait {
  border-top: 1px solid var(--line);
  padding-top: 11px;
  margin-top: 10px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
}
.trait > span {
  font-size: 16px;
  color: var(--accent);
  width: 19px;
  flex-shrink: 0;
}
.trait strong {
  display: block;
  font-size: 11px;
  color: var(--ink);
  font-weight: 500;
  margin-bottom: 2px;
}
.choose {
  width: 100%;
  background: #ffffff08;
  border: 1px solid #ffffff17;
  border-radius: 7px;
  padding: 11px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 17px;
  font-size: 12px;
  font-weight: 700;
}
.choose span {
  font-size: 17px;
  color: var(--accent);
}
.choose:hover {
  background: #97c8af20;
  border-color: var(--mint);
}
.choose span {
  color: var(--mint);
}
.hero-rarity {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 3px 0 6px;
}
.hero-rarity > small {
  color: var(--muted);
  font-size: 10px;
}
.roll-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 7px;
  border: 1px solid color-mix(in srgb, var(--rarity) 40%, transparent);
  border-radius: 5px;
  color: var(--rarity);
  background: color-mix(in srgb, var(--rarity) 8%, transparent);
  font-size: 10px;
  line-height: 1.4;
  font-weight: 700;
  text-decoration: none;
}
.roll-badge span {
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  opacity: 0.85;
}
.roll-badge:hover {
  text-decoration: underline;
}
.roll-badge:focus-visible {
  outline: 2px solid var(--rarity);
  outline-offset: 3px;
}
.selection-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
  gap: 15px;
  color: var(--muted);
  font-size: 10px;
}
.text-button {
  background: none;
  padding: 9px 0;
  color: var(--muted);
  font-size: 12px;
}
.text-button span {
  border-bottom: 1px solid #ffffff25;
  padding-bottom: 3px;
}
.bottom-note {
  position: absolute;
  bottom: 22px;
  left: 35px;
  right: 35px;
  display: flex;
  justify-content: space-between;
  color: #8b9d916e;
  font-size: 9px;
  letter-spacing: 1.3px;
}
.bottom-note b {
  margin: 0 8px;
  color: var(--gold);
}
#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 22px 28px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(#13201ef0, #14231dbb);
  pointer-events: none;
  z-index: 3;
}
.hero-status {
  display: flex;
  gap: 11px;
  align-items: center;
  width: 240px;
}
.portrait-mini {
  width: 44px;
  height: 48px;
  background: #ffffff08;
  border: 1px solid #ffffff20;
  border-radius: 7px;
  overflow: hidden;
}
.portrait-mini img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  image-rendering: pixelated;
}
.hero-status > div:last-child {
  flex: 1;
}
.status-title {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 7px;
  font-size: 12px;
}
.status-title span {
  color: var(--gold);
  font-size: 10px;
}
.health {
  height: 14px;
  background: #090f0d;
  border: 1px solid #ffffff18;
  border-radius: 3px;
  position: relative;
  overflow: hidden;
}
.health i {
  display: block;
  background: #d76d70;
  height: 100%;
  width: 100%;
  transition: width 0.1s;
}
.health span {
  position: absolute;
  inset: 0;
  text-align: center;
  font-size: 9px;
  line-height: 12px;
  color: #fff;
  letter-spacing: 1px;
}
.run-clock {
  text-align: center;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}
.run-clock small {
  display: block;
  font-size: 8px;
  letter-spacing: 2px;
  color: var(--muted);
  margin-bottom: 5px;
}
.run-clock strong {
  font-size: 25px;
  font-family: "Space Grotesk";
  font-weight: 500;
  letter-spacing: 1px;
}
.run-clock > span {
  font-size: 10px;
  color: var(--muted);
  margin-left: 6px;
}
.hud-right {
  display: flex;
  align-items: center;
  gap: 14px;
}
.hud-right > span {
  font-size: 11px;
  color: var(--gold);
}
.icon-button {
  pointer-events: auto;
  background: #ffffff08;
  border: 1px solid #ffffff12;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  font-size: 17px;
}
.xp-track {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: #071411;
}
.xp-track i {
  display: block;
  background: #8cd5b9;
  height: 100%;
  width: 0;
  box-shadow: 0 0 12px #8cd5b9;
}
#game-bottom {
  position: absolute;
  bottom: max(24px, env(safe-area-inset-bottom));
  left: 27px;
  right: 27px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
  z-index: 3;
}
#loadout {
  display: flex;
  gap: 8px;
}
.weapon-slot {
  width: 47px;
  height: 50px;
  border-radius: 8px;
  border: 1px solid #baccb42e;
  background: #14231ee0;
  position: relative;
  display: grid;
  place-items: center;
}
.weapon-slot img {
  width: 35px;
  height: 35px;
  object-fit: contain;
  image-rendering: pixelated;
}
.weapon-slot small {
  position: absolute;
  right: 3px;
  bottom: 2px;
  color: var(--gold);
  font-size: 9px;
}
.weapon-slot.empty {
  opacity: 0.35;
  border-style: dashed;
}
.weapon-slot.empty:after {
  content: "+";
  color: #aec4ab;
  font-size: 18px;
}
#move-hint {
  font-size: 10px;
  color: #b9c8ac9c;
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
}
#move-hint span {
  padding: 0 8px;
}
#skill-button {
  pointer-events: auto;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 19px;
  border: 1px solid #f2cd7a60;
  background: #20332a;
  border-radius: 10px;
  text-align: left;
  min-width: 156px;
}
#skill-button strong {
  display: block;
  font-size: 12px;
  color: var(--gold);
  position: relative;
  z-index: 1;
}
#skill-button small {
  display: block;
  font-size: 8px;
  letter-spacing: 1.4px;
  color: var(--muted);
  margin-top: 4px;
  position: relative;
  z-index: 1;
}
#skill-icon {
  color: var(--gold);
  font-size: 25px;
  position: relative;
  z-index: 1;
}
#skill-fill {
  position: absolute;
  inset: 0;
  background: #f2cd7a13;
  transform-origin: left;
  pointer-events: none;
}
#joystick {
  position: absolute;
  width: 100px;
  height: 100px;
  border: 1px solid #f3e5b240;
  border-radius: 50%;
  background: #d8e3bb0c;
  pointer-events: none;
  z-index: 5;
}
#joystick i {
  display: block;
  width: 36px;
  height: 36px;
  border: 1px solid #f2cd7a66;
  background: #f2cd7a25;
  border-radius: 50%;
  position: absolute;
  left: 31px;
  top: 31px;
}
#toast {
  position: absolute;
  top: 120px;
  left: 50%;
  transform: translate(-50%, 0);
  display: none;
  background: #172a24e8;
  border: 1px solid #d8c28640;
  padding: 12px 20px;
  border-radius: 30px;
  font-size: 12px;
  color: var(--gold);
  pointer-events: none;
  z-index: 6;
  white-space: nowrap;
}
#toast.show {
  display: block;
}
.modal {
  text-align: center;
  width: min(100%, 850px);
}
h2 {
  font-size: 48px;
  margin: 15px 0;
}
h2 span {
  color: var(--gold);
}
#upgrade-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 30px 0 22px;
}
.upgrade-card {
  text-align: left;
  border: 1px solid #c1d8c035;
  border-radius: 12px;
  background: linear-gradient(135deg, #2e3e35, #212d2b);
  padding: 25px 22px;
  min-height: 237px;
  transition: 0.2s;
}
.upgrade-card:hover {
  transform: translateY(-4px);
  border-color: var(--gold);
}
.upgrade-card img {
  width: 58px;
  height: 58px;
  object-fit: contain;
  image-rendering: pixelated;
  display: block;
  margin-bottom: 18px;
}
.upgrade-card h3 {
  font-size: 18px;
  margin: 8px 0;
  font-family: "Space Grotesk";
}
.upgrade-card p {
  font-size: 12px;
  line-height: 1.7;
}
.upgrade-card .upgrade-type {
  font-size: 8px;
  letter-spacing: 1.3px;
  color: var(--gold);
}
.modal-note {
  font-size: 10px;
  color: var(--muted);
}
.compact {
  width: min(100%, 420px);
  border: 1px solid #ffffff18;
  background: #202e2af5;
  padding: 34px;
  border-radius: 16px;
}
.compact h2 {
  font-size: 34px;
  letter-spacing: -1.4px;
}
.compact p {
  font-size: 12px;
}
.primary {
  display: block;
  width: 100%;
  padding: 14px;
  background: var(--gold);
  color: #2c3026;
  border-radius: 7px;
  margin-top: 27px;
  font-size: 13px;
  font-weight: 700;
}
.compact .text-button {
  margin-top: 15px;
}
.compact .eyebrow {
  font-size: 8px;
  letter-spacing: 1.5px;
}
#end-portrait {
  height: 125px;
}
#end-portrait img {
  height: 100%;
  image-rendering: pixelated;
}
#end-stats {
  display: flex;
  justify-content: space-around;
  border-top: 1px solid var(--line);
  padding-top: 20px;
  margin-top: 20px;
}
#end-stats strong {
  display: block;
  font-family: "Space Grotesk";
  font-size: 25px;
  color: var(--gold);
}
#end-stats small {
  font-size: 9px;
  color: var(--muted);
}
#boss-hud {
  position: absolute;
  top: 110px;
  left: 50%;
  transform: translateX(-50%);
  width: min(50%, 380px);
  text-align: center;
  z-index: 2;
}
#boss-hud span {
  font-size: 9px;
  letter-spacing: 2px;
  color: #e6a2bd;
}
#boss-hud > div {
  height: 6px;
  background: #16131a;
  margin-top: 7px;
  border-radius: 4px;
  overflow: hidden;
}
#boss-health {
  display: block;
  height: 100%;
  background: #bb74a4;
}
@media (min-width: 1100px) and (min-height: 850px) {
  .selection-heading {
    margin: 36px 0;
  }
  .portrait-stage {
    height: 260px;
  }
  .portrait {
    height: 245px;
    width: 215px;
  }
  .card-info {
    padding: 21px 24px;
  }
  .card-info h3 {
    font-size: 26px;
  }
}
@media (max-width: 700px) {
  .screen {
    padding: 16px;
  }
  .selection-content {
    max-width: 440px;
  }
  .brand {
    font-size: 20px;
  }
  .brand-die {
    font-size: 26px;
  }
  .tag {
    font-size: 7px;
    padding: 4px;
  }
  .selection-heading {
    margin: 18px 0;
  }
  h1 {
    font-size: 36px;
    letter-spacing: -1.6px;
  }
  h1 br {
    display: block;
  }
  .selection-heading p {
    font-size: 12px;
  }
  .eyebrow {
    font-size: 8px;
    letter-spacing: 1.5px;
  }
  #character-cards {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .character-card {
    display: grid;
    grid-template-columns: 102px 1fr;
    border-radius: 11px;
    min-height: 139px;
  }
  .card-top {
    left: 13px;
    top: 10px;
    right: 12px;
  }
  .class-label {
    font-size: 8px;
  }
  .card-number {
    font-size: 9px;
  }
  .portrait-stage {
    height: 100%;
    min-height: 138px;
    align-items: center;
    padding-top: 17px;
  }
  .portrait-stage:before {
    width: 85px;
    height: 85px;
    bottom: 13px;
  }
  .portrait {
    width: 100px;
    height: 120px;
  }
  .card-info {
    padding: 12px 13px 11px 7px;
    display: grid;
    grid-template-columns: 1fr auto;
    align-content: center;
  }
  .character-meta {
    font-size: 9px;
    grid-column: 1;
  }
  .card-info h3 {
    font-size: 18px;
    margin: 0 0 5px;
    grid-column: 1;
  }
  .trait {
    border: 0;
    padding: 0;
    margin-top: 4px;
    gap: 6px;
    font-size: 9px;
    grid-column: 1/3;
    line-height: 1.4;
  }
  .trait > span {
    font-size: 12px;
    width: 12px;
  }
  .trait strong {
    font-size: 9px;
    display: inline;
    margin-right: 4px;
  }
  .choose {
    grid-column: 2;
    grid-row: 1/3;
    font-size: 0;
    width: 35px;
    padding: 6px;
    justify-content: center;
    margin: 2px 0 0 7px;
    align-self: center;
    height: 34px;
  }
  .choose span {
    font-size: 18px;
  }
  .selection-footer {
    margin-top: 9px;
    font-size: 9px;
    flex-wrap: wrap;
    gap: 2px 10px;
  }
  .selection-tip {
    display: none;
  }
  .text-button {
    font-size: 11px;
  }
  .bottom-note {
    bottom: 11px;
    left: 17px;
    right: 17px;
    font-size: 7px;
    letter-spacing: 1px;
  }
  .bottom-note > span:last-child {
    display: none;
  }
  #hud {
    padding: 15px 13px 13px;
    align-items: flex-start;
  }
  .hero-status {
    width: 155px;
    gap: 7px;
  }
  .portrait-mini {
    width: 31px;
    height: 38px;
    flex-shrink: 0;
  }
  .status-title {
    font-size: 9px;
    gap: 6px;
    margin-bottom: 6px;
  }
  .status-title span {
    font-size: 8px;
    white-space: nowrap;
  }
  .health {
    height: 11px;
  }
  .health span {
    font-size: 7px;
    line-height: 9px;
  }
  .run-clock {
    left: 58%;
    top: 16px;
  }
  .run-clock small {
    font-size: 6px;
    letter-spacing: 1px;
  }
  .run-clock strong {
    font-size: 21px;
  }
  .run-clock > span {
    display: none;
  }
  .hud-right {
    gap: 5px;
    flex-wrap: wrap;
    width: 70px;
    justify-content: flex-end;
  }
  .hud-right > span {
    font-size: 8px;
    position: absolute;
    top: 57px;
    right: 14px;
  }
  .icon-button {
    width: 29px;
    height: 29px;
    font-size: 15px;
  }
  #game-bottom {
    left: 13px;
    right: 13px;
    bottom: max(18px, env(safe-area-inset-bottom));
  }
  #loadout {
    gap: 4px;
    max-width: 190px;
    flex-wrap: wrap;
  }
  .weapon-slot {
    width: 34px;
    height: 38px;
    border-radius: 6px;
  }
  .weapon-slot img {
    width: 28px;
    height: 28px;
  }
  #move-hint {
    bottom: 62px;
    font-size: 8px;
    left: 0;
    transform: none;
    width: 130px;
    white-space: normal;
    line-height: 1.6;
  }
  #skill-button {
    min-width: 115px;
    padding: 11px;
    gap: 7px;
  }
  #skill-button strong {
    font-size: 10px;
  }
  #skill-button small {
    font-size: 7px;
  }
  #skill-icon {
    font-size: 19px;
  }
  #toast {
    top: 90px;
    font-size: 10px;
    padding: 9px 14px;
  }
  #upgrade-cards {
    grid-template-columns: 1fr;
    gap: 10px;
    margin: 22px 0 16px;
  }
  .upgrade-card {
    min-height: 108px;
    padding: 15px 15px 15px 85px;
    position: relative;
  }
  .upgrade-card img {
    position: absolute;
    left: 17px;
    top: 25px;
    width: 48px;
    height: 48px;
  }
  .upgrade-card h3 {
    font-size: 16px;
    margin: 5px 0;
  }
  .upgrade-card p {
    font-size: 11px;
  }
  .upgrade-modal {
    max-width: 420px;
  }
  .modal h2 {
    font-size: 37px;
    letter-spacing: -1.5px;
  }
  .modal > p {
    font-size: 12px;
  }
  #boss-hud {
    top: 85px;
    width: 50%;
  }
}
@media (max-height: 720px) and (min-width: 701px) {
  .selection-heading {
    margin: 14px 0;
  }
  h1 {
    font-size: 43px;
  }
  .portrait-stage {
    height: 158px;
  }
  .portrait {
    height: 155px;
    width: 140px;
  }
  .card-info {
    padding-top: 10px;
    padding-bottom: 12px;
  }
  .card-info h3 {
    margin-bottom: 7px;
  }
  .trait {
    padding-top: 7px;
    margin-top: 7px;
  }
  .choose {
    margin-top: 10px;
  }
  .bottom-note {
    bottom: 10px;
  }
  .brand {
    font-size: 20px;
  }
}
@media (max-height: 730px) and (max-width: 700px) {
  .selection-heading {
    margin: 10px 0;
  }
  h1 {
    font-size: 30px;
    margin: 8px 0;
  }
  .selection-heading p {
    font-size: 11px;
  }
  .character-card {
    min-height: 125px;
  }
  .portrait-stage {
    min-height: 125px;
  }
  .portrait {
    height: 109px;
  }
  .card-info {
    padding-top: 9px;
    padding-bottom: 9px;
  }
  .selection-footer {
    margin-top: 5px;
  }
  .bottom-note {
    display: none;
  }
  .brand {
    font-size: 18px;
  }
  .tag {
    font-size: 6px;
  }
  .trait {
    font-size: 8px;
  }
  .trait strong {
    font-size: 8px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
@media (max-height: 500px) and (min-width: 701px) {
  .screen {
    padding: 10px 22px;
  }
  .selection-content {
    max-width: 900px;
  }
  .brand {
    font-size: 16px;
  }
  .brand-die {
    font-size: 22px;
  }
  .tag {
    font-size: 6px;
    padding: 3px;
  }
  .selection-heading {
    margin: 5px 0 9px;
  }
  .selection-heading .eyebrow,
  .selection-heading p {
    display: none;
  }
  h1 {
    font-size: 27px;
    margin: 3px 0;
    letter-spacing: -1px;
  }
  .portrait-stage {
    height: 83px;
  }
  .portrait {
    height: 80px;
    width: 85px;
  }
  .portrait-stage:before {
    width: 65px;
    height: 65px;
  }
  .card-top {
    top: 9px;
    left: 12px;
    right: 12px;
  }
  .class-label {
    font-size: 8px;
  }
  .card-info {
    padding: 8px 12px;
  }
  .card-info h3 {
    font-size: 17px;
    margin-bottom: 5px;
  }
  .character-meta {
    font-size: 9px;
  }
  .trait {
    font-size: 8px;
    line-height: 1.3;
    padding-top: 5px;
    margin-top: 5px;
    gap: 5px;
  }
  .trait strong {
    font-size: 8px;
  }
  .trait > span {
    font-size: 12px;
    width: 13px;
  }
  .choose {
    padding: 5px 8px;
    font-size: 10px;
    margin-top: 8px;
  }
  .selection-footer {
    margin-top: 4px;
  }
  .selection-footer .text-button {
    padding: 4px;
  }
  .bottom-note {
    display: none;
  }
  .compact {
    padding: 20px;
  }
  .compact h2 {
    font-size: 27px;
  }
  .compact .primary {
    margin-top: 15px;
  }
  #end-portrait {
    display: none;
  }
  #upgrade-cards {
    margin: 14px 0 10px;
  }
  .upgrade-card {
    padding: 15px;
    min-height: 180px;
  }
  .upgrade-card img {
    width: 38px;
    height: 38px;
    margin-bottom: 10px;
  }
  .upgrade-modal h2 {
    font-size: 34px;
    margin: 8px;
  }
  .upgrade-card p {
    font-size: 11px;
  }
  .upgrade-card h3 {
    font-size: 16px;
  }
}
@media (max-width: 700px) {
  .trait,
  .trait strong {
    font-size: 10px;
    line-height: 1.35;
  }
  .choose {
    min-width: 40px;
    min-height: 40px;
  }
  .character-card {
    grid-template-columns: 98px 1fr;
  }
  .card-info {
    padding-left: 5px;
  }
  .portrait {
    width: 95px;
  }
  #toast {
    max-width: calc(100% - 28px);
    white-space: normal;
    text-align: center;
  }
  .icon-button {
    min-width: 32px;
    min-height: 32px;
  }
}
@media (max-height: 730px) and (max-width: 700px) {
  .selection-heading .eyebrow {
    font-size: 7px;
  }
  .selection-heading {
    margin: 6px 0;
  }
  .selection-heading h1 {
    font-size: 28px;
  }
  .trait,
  .trait strong {
    font-size: 9px;
  }
  .portrait-stage {
    min-height: 130px;
  }
  .brand {
    line-height: 1.3;
  }
}
@media (max-width: 700px) {
  #hud {
    min-height: 78px;
  }
  .hud-right > span {
    top: 58px;
    line-height: 12px;
  }
  #boss-hud {
    top: 95px;
  }
  #toast {
    top: 130px;
  }
}

/* Fate reveals share the same squeeze, burst, and staggered arrival. */
[hidden] {
  display: none !important;
}
#character-cards {
  position: relative;
}
.awaiting-reveal {
  opacity: 0;
  pointer-events: none;
}
.reward-pop {
  animation: gift-arrive 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.opening-stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 5;
}
.opening-stage small {
  position: absolute;
  bottom: 16%;
  color: var(--gold);
  font-size: 10px;
  letter-spacing: 2px;
  text-align: center;
}
.opening-core {
  width: 116px;
  height: 116px;
  display: grid;
  place-items: center;
  color: #fff1bb;
  font-size: 105px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffe7a93b, transparent 65%);
  filter: drop-shadow(0 0 15px #f2cd7a);
  animation: fate-squeeze 0.95s cubic-bezier(0.6, 0, 0.8, 0.5) both;
}
.opening-core img {
  width: 110px;
  image-rendering: pixelated;
}
.burst-rings {
  position: absolute;
  width: 125px;
  height: 125px;
  border: 1px solid #edcc8580;
  border-radius: 50%;
  box-shadow:
    0 0 0 15px #efce8310,
    0 0 0 35px #efce8308;
}
.burst-sparks {
  position: absolute;
  width: 0;
  height: 0;
}
.burst-sparks i {
  position: absolute;
  width: 5px;
  height: 5px;
  background: #ffe7a5;
  opacity: 0;
  box-shadow: 0 0 12px #efc579;
}
.explode .opening-core {
  animation: fate-explode 0.45s ease-out both;
}
.explode .burst-rings {
  animation: fate-ring 0.65s ease-out both;
}
.explode .burst-sparks i {
  animation: fate-spark 0.8s ease-out both;
}
.explode small {
  opacity: 0;
}
.skip-party {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 12px;
  z-index: 6;
}
.treasure-modal {
  width: min(640px, 100%);
  max-height: 100%;
  overflow: auto;
  padding: 28px 30px;
}
.treasure-modal h2 {
  margin: 8px 0;
}
.treasure-modal > p {
  margin: 5px 0 12px;
}
.treasure-opening {
  height: 300px;
  position: relative;
}
.wheel-wrap {
  width: 224px;
  height: 224px;
  margin: 22px auto 16px;
  position: relative;
}
.reward-wheel {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 7px solid #c4a05f;
  box-shadow:
    0 0 0 4px #3b3c32,
    0 0 30px #e9c16d24;
  background: conic-gradient(
    #465c4c 0deg 45deg,
    #3b4754 45deg 90deg,
    #465c4c 90deg 135deg,
    #705c41 135deg 180deg,
    #465c4c 180deg 225deg,
    #9d7446 225deg 270deg,
    #705c41 270deg 315deg,
    #3b4754 315deg 360deg
  );
}
.reward-wheel > span {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 44px;
  height: 42px;
  margin: -21px -22px;
  transform: rotate(var(--angle)) translateY(-72px);
  color: #fff0cd;
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
}
.reward-wheel small {
  display: block;
  font-size: 7px;
  letter-spacing: 1px;
  margin-top: 4px;
}
.wheel-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 57px;
  height: 57px;
  background: #1b2929;
  border: 3px solid #d0ac69;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--gold);
  font-size: 36px;
}
.wheel-pointer {
  position: absolute;
  left: 50%;
  top: -13px;
  transform: translateX(-50%);
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 27px solid #ffe5a8;
  z-index: 2;
  filter: drop-shadow(0 2px 3px #000);
}
#treasure-rewards {
  display: grid;
  gap: 7px;
  text-align: left;
  margin: 10px 0 16px;
}
.treasure-reward {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 9px 12px;
  background: #ffffff06;
  border: 1px solid #d7bb7333;
  border-radius: 8px;
}
.treasure-reward img,
.heal-icon {
  width: 44px;
  height: 44px;
  object-fit: contain;
  image-rendering: pixelated;
  flex-shrink: 0;
}
.heal-icon {
  color: #e899a2;
  font-size: 28px;
  text-align: center;
}
.treasure-reward small {
  display: block;
  font-size: 8px;
  letter-spacing: 1px;
  color: var(--gold);
}
.treasure-reward strong {
  display: block;
  font-size: 13px;
  margin: 2px 0;
}
.treasure-reward p {
  margin: 0;
  font-size: 11px;
  line-height: 1.4;
  color: var(--muted);
}
#claim-treasure {
  width: 100%;
}
#skip-treasure {
  display: block;
  margin: 8px auto;
}
#treasure .modal-note {
  display: block;
  margin-top: 12px;
}
#boss-pattern {
  display: block;
  color: #e8d5b2;
  font-size: 9px;
  letter-spacing: 1.2px;
  margin: 4px 0 7px;
}
@keyframes fate-squeeze {
  0% {
    transform: scale(1.15) rotate(-8deg);
  }
  60% {
    transform: scale(0.6) rotate(7deg);
    filter: drop-shadow(0 0 25px #ffda8a) brightness(1.6);
  }
  100% {
    transform: scale(0.24) rotate(-8deg);
    filter: drop-shadow(0 0 50px #ffdd8c) brightness(5);
  }
}
@keyframes fate-explode {
  0% {
    transform: scale(0.25);
    opacity: 1;
    filter: brightness(6);
  }
  30% {
    transform: scale(2.2);
    opacity: 0.9;
    filter: brightness(4);
  }
  100% {
    transform: scale(3);
    opacity: 0;
  }
}
@keyframes fate-ring {
  from {
    transform: scale(0.2);
    opacity: 1;
    box-shadow: 0 0 60px #ffde95;
  }
  to {
    transform: scale(3.4);
    opacity: 0;
  }
}
@keyframes fate-spark {
  0% {
    opacity: 1;
    transform: rotate(var(--angle)) translateX(0) scale(1.8);
  }
  100% {
    opacity: 0;
    transform: rotate(var(--angle)) translateX(var(--reach)) scale(0.2);
  }
}
@keyframes gift-arrive {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.91);
    filter: brightness(2);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: brightness(1);
  }
}
@media (max-width: 700px) {
  .treasure-modal {
    padding: 20px 16px;
  }
  .wheel-wrap {
    width: 190px;
    height: 190px;
    margin: 17px auto 10px;
  }
  .reward-wheel > span {
    transform: rotate(var(--angle)) translateY(-58px);
    font-size: 23px;
  }
  .treasure-opening {
    height: 245px;
  }
  .treasure-modal h2 {
    font-size: 30px;
  }
  .opening-stage small {
    font-size: 8px;
  }
}
@media (max-height: 700px) {
  .treasure-modal {
    padding: 15px 20px;
  }
  .treasure-modal .eyebrow {
    font-size: 8px;
  }
  .treasure-modal h2 {
    font-size: 28px;
  }
  .treasure-modal > p {
    font-size: 12px;
  }
  .wheel-wrap {
    width: 160px;
    height: 160px;
    margin: 15px auto 8px;
  }
  .reward-wheel > span {
    transform: rotate(var(--angle)) translateY(-47px);
    font-size: 20px;
  }
  .reward-wheel small {
    font-size: 6px;
  }
  .wheel-center {
    width: 45px;
    height: 45px;
  }
  .treasure-reward {
    padding: 6px 10px;
  }
  .treasure-reward img {
    width: 32px;
    height: 32px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .reward-pop,
  .opening-core,
  .explode * {
    animation: none !important;
  }
  .reward-wheel {
    transition: none !important;
  }
}
#active-boosts {
  position: absolute;
  left: 20px;
  top: 105px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 3;
  pointer-events: none;
}
.boost-chip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 5px;
  border: 1px solid color-mix(in srgb, var(--boost-color) 40%, transparent);
  background: #152426e8;
  border-radius: 6px;
  padding: 4px 8px 6px 4px;
  overflow: hidden;
  min-width: 130px;
}
.boost-chip img {
  width: 28px;
  height: 28px;
  image-rendering: pixelated;
}
.boost-chip span {
  font-size: 10px;
  color: var(--boost-color);
}
.boost-chip b {
  display: block;
  font-size: 11px;
  color: #eee7d3;
}
.boost-chip i {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  background: var(--boost-color);
}
@media (max-width: 700px) {
  #active-boosts {
    left: 10px;
    top: 160px;
    gap: 4px;
  }
  .boost-chip {
    min-width: 95px;
    padding: 2px 5px 4px 2px;
  }
  .boost-chip img {
    width: 22px;
    height: 22px;
  }
  .boost-chip span {
    font-size: 8px;
  }
  .boost-chip b {
    font-size: 9px;
  }
}
@media (max-height: 500px) {
  #active-boosts {
    top: 80px;
    flex-direction: row;
  }
  .boost-chip {
    min-width: 90px;
  }
}
.stat-strip {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  margin: 6px 0;
  grid-column: 1/-1;
}
.stat-strip > span {
  text-align: center;
  background: #101e2266;
  border: 1px solid #aecdb81a;
  border-radius: 4px;
  padding: 4px 1px;
}
.stat-strip small {
  display: block;
  color: #a7b7ae;
  font-size: 7px;
  letter-spacing: 0.6px;
}
.stat-strip b {
  font-size: 13px;
  display: inline-block;
  margin-right: 3px;
  color: #ede4ca;
}
.stat-strip em {
  font-size: 9px;
  color: var(--gold);
  font-style: normal;
}
.scaling-note {
  display: block;
  font-size: 10px;
  color: var(--gold);
  line-height: 1.5;
  margin-top: 8px;
}
.decision-timer {
  margin: 16px auto 0;
  width: min(100%, 440px);
}
.decision-caption {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  color: #c3cabb;
  font-size: 10px;
  margin-bottom: 7px;
}
.decision-caption button {
  padding: 5px 10px;
  font-size: 10px;
  background: #ffffff09;
  border: 1px solid #ffffff22;
  border-radius: 5px;
}
.decision-track {
  height: 4px;
  background: #ffffff15;
  border-radius: 4px;
  overflow: hidden;
}
.decision-track i {
  display: block;
  height: 100%;
  background: var(--gold);
  transform-origin: left;
}
.boost-choice {
  width: 100%;
  text-align: left;
  cursor: pointer;
}
.boost-choice:hover,
.boost-choice:focus-visible {
  border-color: var(--gold);
  background: #f2cd7a12;
}
.ability-modal,
.sheet-modal {
  width: min(690px, 100%);
  max-height: 100%;
  overflow: auto;
  padding: 24px;
  border: 1px solid #ffffff22;
  border-radius: 14px;
  background: #1d2d2bee;
}
.ability-modal h2,
.sheet-modal h2 {
  font-size: 30px;
  margin: 10px 0;
}
.ability-modal > p,
.sheet-modal > p {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}
#ability-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}
.ability-choice {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  text-align: left;
  border: 1px solid #b9c8a82c;
  border-radius: 8px;
  padding: 13px;
  background: #293b32;
}
.ability-choice strong {
  display: block;
  font-size: 12px;
}
.ability-choice small {
  display: block;
  font-size: 10px;
  color: #b9c9bd;
  line-height: 1.4;
  margin-top: 6px;
}
.ability-choice > span {
  font-size: 17px;
  color: var(--gold);
  min-width: 75px;
}
.ability-choice em {
  display: block;
  font-size: 9px;
  font-style: normal;
  color: #b7c8b6;
  margin-top: 8px;
}
.ability-choice:disabled {
  opacity: 0.4;
}
.ability-choice:hover:not(:disabled) {
  border-color: var(--gold);
}
#spell-tools {
  position: absolute;
  right: 0;
  bottom: 68px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  pointer-events: auto;
}
#sheet-button {
  font-size: 10px;
  padding: 8px 12px;
  border: 1px solid #f2cd7a44;
  border-radius: 6px;
  background: #1b2b29ed;
  color: #e0ceab;
}
#spell-slots {
  display: flex;
  gap: 4px;
}
#spell-slots span {
  font-size: 8px;
  padding: 4px 5px;
  background: #1b2632e8;
  color: #b5b3d0;
  border-radius: 3px;
}
#spell-slots b {
  color: #e5c6ff;
}
#sheet-abilities {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  text-align: left;
  font-size: 10px;
  color: #afc2b4;
  line-height: 1.5;
}
#sheet-abilities b {
  color: #e0d6ba;
}
#sheet-slots {
  display: flex;
  gap: 5px;
  justify-content: center;
}
.slot-group {
  background: #ffffff06;
  border: 1px solid #e0b7fc30;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 10px;
  flex: 1;
}
.slot-group b,
.slot-group small {
  display: block;
  margin-top: 3px;
}
.slot-group b {
  font-size: 17px;
  color: #d5b1f5;
}
.slot-group small {
  font-size: 8px;
  color: var(--muted);
}
.slot-group.locked {
  opacity: 0.4;
}
#recovery-note {
  font-size: 11px;
  line-height: 1.6;
  color: #bac8ba;
}
#spell-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin: 12px 0;
}
.spell-choice {
  display: flex;
  align-items: center;
  gap: 7px;
  text-align: left;
  background: #293734;
  border: 1px solid #ffffff1f;
  border-radius: 8px;
  padding: 10px;
}
.spell-choice.selected {
  border-color: #cba2e5;
}
.spell-choice img {
  width: 35px;
  height: 35px;
  image-rendering: pixelated;
}
.spell-choice strong {
  font-size: 12px;
}
.spell-choice small {
  font-size: 9px;
  display: block;
  color: #c4a6d9;
  margin: 3px 0;
}
.spell-choice p {
  font-size: 10px;
  margin: 0;
  color: #bcc8be;
  line-height: 1.4;
}
.spell-choice > b {
  font-size: 10px;
  color: var(--gold);
}
#sheet-casting > small {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.5;
  display: block;
}
#close-sheet {
  margin-top: 16px;
  width: 100%;
}
@media (max-width: 700px) {
  .stat-strip {
    gap: 2px;
    margin: 4px 0;
  }
  .stat-strip > span {
    padding: 2px 0;
  }
  .stat-strip small {
    font-size: 6px;
  }
  .stat-strip b {
    font-size: 11px;
    margin-right: 2px;
  }
  .stat-strip em {
    font-size: 7px;
  }
  .character-card {
    min-height: 165px;
  }
  .selection-content {
    margin: auto;
  }
  #selection {
    overflow-y: auto;
    align-items: flex-start;
  }
  #selection .bottom-note {
    display: none;
  }
  .ability-modal,
  .sheet-modal {
    padding: 16px;
  }
  .ability-modal h2,
  .sheet-modal h2 {
    font-size: 25px;
  }
  #ability-choices {
    grid-template-columns: 1fr;
  }
  .ability-choice {
    padding: 9px;
  }
  .ability-choice small {
    font-size: 9px;
    margin-top: 3px;
  }
  .ability-choice em {
    margin-top: 4px;
  }
  .ability-choice > span {
    font-size: 15px;
    min-width: 85px;
  }
  #spell-list {
    grid-template-columns: 1fr;
  }
  #sheet-abilities {
    font-size: 9px;
  }
  #spell-tools {
    bottom: 62px;
  }
  #sheet-button {
    font-size: 9px;
    padding: 7px 10px;
  }
  .scaling-note {
    font-size: 9px;
    margin-top: 5px;
  }
  .decision-timer {
    margin-top: 10px;
  }
  .slot-group {
    padding: 7px 3px;
  }
  .slot-group b {
    font-size: 14px;
  }
  .upgrade-modal {
    max-height: 100%;
    overflow: auto;
  }
  .upgrade-card {
    min-height: 0;
  }
}
@media (max-height: 750px) and (min-width: 701px) {
  #selection .portrait-stage {
    height: 118px;
  }
  #selection .portrait {
    height: 125px;
  }
  .selection-heading {
    margin: 10px 0;
  }
  .selection-heading h1 {
    font-size: 36px;
  }
  .trait {
    margin-top: 5px;
    padding-top: 5px;
  }
  .stat-strip {
    margin: 3px 0;
  }
}
.stat-help {
  text-align: left;
  margin: 12px 0;
  color: #b7c8b9;
  font-size: 11px;
}
.stat-help summary {
  cursor: pointer;
  color: var(--gold);
  margin-bottom: 8px;
}
#close-sheet {
  position: sticky;
  bottom: 0;
  box-shadow: 0 -6px 16px #1d2d2b;
}
@media (max-height: 730px) and (max-width: 700px) {
  .character-card {
    min-height: 148px;
  }
  .selection-heading h1 {
    font-size: 25px;
  }
  .selection-heading p {
    margin: 6px 0 10px;
  }
  .selection-heading {
    margin: 4px 0;
  }
  .selection-footer {
    margin-top: 9px;
  }
}

.handbook-link {
  color: var(--mint);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
}
.handbook-link:hover {
  text-decoration: underline;
}
.handbook-link:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 4px;
}
.handbook-block {
  display: block;
  padding: 12px;
  text-align: center;
}
.selection-heading .eyebrow > span {
  display: none;
}

@media (max-width: 700px) {
  .selection-heading h1 {
    font-size: clamp(23px, 6vw, 30px);
  }
}

/* The complete card frame communicates rarity, independent of class color. */
.character-card[data-rarity] {
  border: 2px solid var(--rarity);
  box-shadow:
    inset 0 0 0 1px #0004,
    0 3px 14px #0002;
}
.character-card[data-rarity]:hover {
  border-color: var(--rarity);
  box-shadow: 0 0 16px color-mix(in srgb, var(--rarity) 25%, transparent);
}
.character-card[data-rarity="common"] {
  border-color: #7e9187;
}
.character-card[data-rarity="epic"] {
  box-shadow:
    0 0 15px #d1a6f024,
    inset 0 0 18px #d1a6f00a;
}
.character-card[data-rarity="legendary"] {
  box-shadow:
    0 0 21px #f2cd7a40,
    inset 0 0 22px #f2cd7a10;
}

#spell-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  width: 340px;
  pointer-events: auto;
}
.spell-hotkey {
  position: relative;
  min-height: 76px;
  padding: 5px 3px;
  border: 1px solid #bca3e777;
  border-radius: 8px;
  background: #19282bf2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  touch-action: manipulation;
}
.spell-hotkey img {
  width: 25px;
  height: 25px;
  image-rendering: pixelated;
}
.spell-hotkey kbd {
  position: absolute;
  top: 4px;
  left: 5px;
  color: #f2cd7a;
  font-size: 10px;
}
.spell-hotkey strong {
  font-size: 10px;
  line-height: 1.1;
  text-align: center;
}
.spell-hotkey small {
  font-size: 8px;
  color: #bdadd6;
}
.spell-hotkey.selected {
  border-color: #e1c6ff;
}
.spell-hotkey:disabled {
  opacity: 0.55;
}
.empty-spell {
  height: 25px;
  font-size: 22px;
  color: #91a99b;
}
#game-bottom.spellcaster #spell-tools {
  bottom: 86px;
}
#game-bottom.spellcaster #move-hint {
  display: none;
}
.spell-assign {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}
.spell-assign button {
  padding: 9px 8px;
  min-height: 36px;
  border-radius: 5px;
  background: #4d4264;
  font-size: 10px;
}
.spell-assign button:disabled {
  opacity: 0.45;
}
#spell-manage-note {
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}
@media (max-width: 700px) {
  #game-bottom.spellcaster {
    flex-direction: column;
    align-items: stretch;
    gap: 7px;
  }
  #game-bottom.spellcaster #loadout {
    max-width: 100%;
    padding-right: 150px;
    min-height: 38px;
  }
  #game-bottom.spellcaster #spell-tools {
    bottom: 90px;
    gap: 3px;
  }
  #game-bottom.spellcaster #sheet-button {
    padding: 8px;
    min-height: 32px;
  }
  #spell-bar {
    width: 100%;
    gap: 4px;
  }
  .spell-hotkey {
    min-height: 78px;
  }
  .spell-hotkey strong {
    font-size: 9px;
  }
  #game-bottom.spellcaster #spell-slots {
    max-width: 155px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}

/* The tavern table: class identity inside, rolled rarity on the outer frame. */
#selection {
  overflow-y: auto;
  align-items: flex-start;
  padding: 28px 32px 36px;
  background:
    radial-gradient(ellipse at 50% 5%, #40304955, transparent 48%),
    linear-gradient(160deg, #171e24f5, #101b1df5);
}
#selection .selection-content {
  width: min(100%, 1050px);
  max-width: 1050px;
  margin: auto;
}
#selection .selection-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 24px;
  border-bottom: 1px solid #ffffff12;
}
#selection .brand {
  justify-content: flex-start;
  color: var(--ink);
  text-decoration: none;
  font-size: 23px;
  letter-spacing: -1px;
}
#selection .brand img {
  width: 30px;
  height: 30px;
}
#selection .brand > span > span {
  color: #9ba9a5;
}
#selection .selection-heading {
  text-align: center;
  margin: 32px auto 30px;
  max-width: 720px;
}
#selection .eyebrow {
  color: #b7a5c9;
  font-size: 9px;
  letter-spacing: 2px;
}
#selection h1 {
  font-size: clamp(40px, 4.8vw, 65px);
  letter-spacing: -3px;
  line-height: 1.03;
  margin: 15px 0;
}
#selection h1 br {
  display: block;
}
#selection h1 em {
  color: #f0d397;
}
#selection .selection-heading p {
  display: block;
  max-width: 520px;
  margin: 0 auto;
  font-size: 14px;
  line-height: 1.6;
  color: #b1b9b9;
}
#selection .run-facts {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin-top: 16px;
  font-size: 11px;
  color: #a4b1ae;
}
#selection .run-facts b {
  color: #ead9b4;
}
#selection .party-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
}
#selection .party-heading .eyebrow {
  justify-content: flex-start;
  font-size: 8px;
  color: #93aaa1;
}
#selection .party-heading h2 {
  font-size: 24px;
  letter-spacing: -0.8px;
  margin: 7px 0 0;
}
#selection .party-heading p {
  font-size: 11px;
}
#selection #character-cards {
  gap: 18px;
  margin-top: 16px;
}
#selection .character-card {
  display: block;
  min-height: 0;
  border-radius: 18px;
  background: #20272b;
}
#selection .character-card[data-class="fighter"] {
  --accent: #f2c275 !important;
  --class-bg: #493727;
}
#selection .character-card[data-class="wizard"] {
  --accent: #c7adff !important;
  --class-bg: #36304f;
}
#selection .character-card[data-class="rogue"] {
  --accent: #83d8bb !important;
  --class-bg: #1e4039;
}
#selection .portrait-stage {
  height: 216px;
  min-height: 0;
  padding: 40px 0 0;
  overflow: hidden;
  background:
    radial-gradient(
      ellipse at 50% 100%,
      color-mix(in srgb, var(--accent) 25%, transparent),
      transparent 75%
    ),
    var(--class-bg);
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  align-items: flex-end;
}
#selection .portrait-stage::before {
  width: 184px;
  height: 184px;
  bottom: -26px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 90px 90px 0 0;
  background: #00000016;
}
#selection [data-class="wizard"] .portrait-stage::before {
  border-radius: 50%;
  bottom: -17px;
  outline: 1px dashed #c7adff30;
  outline-offset: 9px;
}
#selection [data-class="rogue"] .portrait-stage::before {
  border-radius: 12px;
  transform: rotate(45deg);
  bottom: -62px;
}
#selection .portrait {
  width: 180px;
  height: 193px;
  flex-shrink: 0;
  object-position: bottom;
  filter: drop-shadow(0 8px 8px #0005);
}
#selection .class-sigil {
  position: absolute;
  color: var(--accent);
  opacity: 0.11;
  right: 12px;
  bottom: 16px;
  transform: rotate(-12deg);
}
#selection .class-sigil svg {
  width: 130px;
  height: 130px;
}
.hero-emblem {
  width: 23px;
  height: 23px;
  flex-shrink: 0;
  vertical-align: middle;
}
#selection .card-top {
  top: 14px;
  left: 15px;
  right: 15px;
}
#selection .class-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  letter-spacing: 1px;
}
#selection .class-label svg {
  width: 24px;
  height: 24px;
}
#selection .race-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #ede9dc;
  border: 1px solid #ffffff25;
  background: #10181b60;
  padding: 4px 8px;
  border-radius: 20px;
  font-size: 10px;
}
#selection .race-badge svg {
  width: 16px;
  height: 16px;
}
#selection .portrait-caption {
  position: absolute;
  bottom: 9px;
  left: 14px;
  z-index: 2;
  font-size: 7px;
  letter-spacing: 1.8px;
  color: var(--accent);
  background: #172024d9;
  padding: 5px 7px;
  border-radius: 3px;
}
#selection .card-info {
  display: block;
  padding: 18px;
}
#selection .hero-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
#selection .character-meta {
  font-size: 10px;
  margin-bottom: 2px;
}
#selection .card-info h3 {
  font-size: 26px;
  margin: 0;
}
#selection .roll-badge {
  flex-direction: column;
  gap: 0;
  padding: 4px 8px;
  line-height: 1.5;
  font-size: 10px;
  border-radius: 6px;
}
#selection .class-hook {
  font-size: 11px;
  line-height: 1.5;
  margin: 10px 0 13px;
  color: var(--accent);
}
#selection .hero-stat-label {
  display: flex;
  justify-content: space-between;
  gap: 7px;
  font-size: 7px;
  color: #9eaaa8;
  letter-spacing: 0.6px;
}
#selection .hero-stat-label span {
  text-transform: none;
  letter-spacing: 0;
  font-size: 8px;
}
#selection .stat-strip {
  margin: 5px 0 13px;
  gap: 4px;
}
#selection .stat-strip > span {
  padding: 5px 0;
  background: #111a1c66;
  border: 1px solid #ffffff0b;
  border-radius: 5px;
}
#selection .stat-strip small {
  font-size: 7px;
}
#selection .stat-strip b {
  font-size: 14px;
}
#selection .stat-strip em {
  font-size: 8px;
}
#selection [data-class="fighter"] .stat-strip > span:first-child,
#selection [data-class="wizard"] .stat-strip > span:nth-child(4),
#selection [data-class="rogue"] .stat-strip > span:nth-child(2) {
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
  color: var(--accent);
}
#selection .trait {
  display: flex;
  font-size: 10px;
  line-height: 1.5;
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #ffffff0d;
  min-height: 51px;
}
#selection .trait > span {
  width: 23px;
}
#selection .trait strong {
  display: block;
  font-size: 11px;
  margin-bottom: 2px;
  font-weight: 600;
}
#selection .race-trait > span {
  color: #cad0c3;
}
#selection .choose {
  width: 100%;
  height: auto;
  min-height: 44px;
  padding: 10px 13px;
  margin: 16px 0 0;
  font-size: 12px;
  justify-content: space-between;
  background: color-mix(in srgb, var(--accent) 13%, #1b2427);
  border: 1px solid color-mix(in srgb, var(--accent) 48%, transparent);
  color: var(--accent);
  border-radius: 8px;
}
#selection .choose span {
  color: inherit;
}
#selection .choose:hover {
  background: color-mix(in srgb, var(--accent) 25%, #1b2427);
}
#selection .selection-footer {
  gap: 16px;
  margin-top: 16px;
  flex-wrap: wrap;
}
#selection .selection-footer .handbook-link {
  display: none;
}
#selection #reroll {
  color: #e2d4b9;
  min-height: 44px;
  font-size: 12px;
}
#selection .selection-tip {
  display: inline;
  font-size: 11px;
}
#selection #best-run {
  font-size: 9px;
}
#selection .bottom-note {
  display: none;
}
@media (max-width: 700px) {
  #selection {
    padding: 18px 14px 28px;
  }
  #selection .selection-content {
    max-width: 470px;
    margin: 0 auto;
  }
  #selection .selection-nav {
    padding-bottom: 16px;
  }
  #selection .brand {
    font-size: 20px;
    gap: 7px;
  }
  #selection .brand img {
    width: 25px;
    height: 25px;
  }
  #selection .selection-nav .handbook-link {
    font-size: 10px;
  }
  #selection .selection-heading {
    margin: 26px 0;
  }
  #selection h1 {
    font-size: clamp(38px, 10vw, 48px);
    letter-spacing: -2px;
  }
  #selection .selection-heading .eyebrow {
    display: flex;
    font-size: 8px;
  }
  #selection .selection-heading p {
    font-size: 12px;
    margin: 12px auto;
    max-width: 340px;
  }
  #selection .run-facts {
    gap: 6px 15px;
    font-size: 10px;
    margin-top: 12px;
  }
  #selection .party-heading {
    display: block;
  }
  #selection .party-heading h2 {
    font-size: 23px;
  }
  #selection .party-heading p {
    margin-top: 6px;
    font-size: 11px;
  }
  #selection #character-cards {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  #selection .character-card {
    display: grid;
    grid-template-columns: 106px minmax(0, 1fr);
    border-radius: 14px;
  }
  #selection .portrait-stage {
    height: 100%;
    min-height: 280px;
    padding: 65px 0 35px;
    border-bottom: 0;
    border-right: 1px solid #ffffff12;
    align-items: center;
  }
  #selection .portrait {
    width: 116px;
    height: 165px;
    max-width: none;
  }
  #selection .portrait-stage::before {
    width: 100px;
    height: 150px;
    bottom: 35%;
    transform: translateY(50%);
  }
  #selection [data-class="wizard"] .portrait-stage::before {
    bottom: 37%;
    height: 100px;
  }
  #selection [data-class="rogue"] .portrait-stage::before {
    bottom: 35%;
    height: 100px;
    transform: translateY(50%) rotate(45deg);
  }
  #selection .card-top {
    top: 13px;
    left: 8px;
    right: 8px;
    flex-direction: column;
    gap: 8px;
  }
  #selection .class-label {
    gap: 5px;
    font-size: 10px;
  }
  #selection .class-label svg {
    width: 21px;
    height: 21px;
  }
  #selection .race-badge {
    font-size: 9px;
    padding: 3px 6px;
  }
  #selection .portrait-caption {
    left: 0;
    right: 0;
    text-align: center;
    bottom: 12px;
    font-size: 6px;
    padding: 6px 0;
    letter-spacing: 0.8px;
  }
  #selection .class-sigil {
    bottom: 18px;
    right: -8px;
  }
  #selection .class-sigil svg {
    width: 85px;
    height: 85px;
  }
  #selection .card-info {
    padding: 13px 12px;
  }
  #selection .card-info h3 {
    font-size: 23px;
  }
  #selection .character-meta {
    font-size: 9px;
  }
  #selection .roll-badge {
    font-size: 8px;
    padding: 3px 5px;
  }
  #selection .roll-badge span {
    font-size: 8px;
  }
  #selection .class-hook {
    font-size: 10px;
    margin: 8px 0 10px;
  }
  #selection .hero-stat-label {
    font-size: 6px;
  }
  #selection .hero-stat-label span {
    display: none;
  }
  #selection .stat-strip {
    gap: 2px;
    margin: 4px 0 8px;
  }
  #selection .stat-strip > span {
    padding: 3px 0;
  }
  #selection .stat-strip small {
    font-size: 6px;
  }
  #selection .stat-strip b {
    font-size: 12px;
    margin-right: 1px;
  }
  #selection .stat-strip em {
    font-size: 7px;
  }
  #selection .trait {
    gap: 6px;
    min-height: 0;
    font-size: 9px;
    margin-top: 7px;
    padding-top: 7px;
  }
  #selection .trait strong {
    font-size: 10px;
  }
  #selection .trait > span,
  #selection .trait svg {
    width: 17px;
    height: 17px;
  }
  #selection .choose {
    font-size: 11px;
    margin-top: 11px;
    padding: 9px 10px;
  }
  #selection .selection-footer {
    gap: 4px 12px;
  }
  #selection .selection-tip {
    font-size: 10px;
  }
}
.spell-assign button {
  min-height: 44px;
}
@media (max-width: 700px) {
  #selection .selection-nav {
    padding-bottom: 12px;
  }
  #selection .selection-heading {
    margin: 18px 0;
  }
  #selection h1 {
    font-size: 34px;
    margin: 10px 0;
  }
  #selection .selection-heading p {
    font-size: 11px;
    line-height: 1.5;
    margin: 10px auto;
  }
  #selection .run-facts {
    display: none;
  }
}
@media (min-width: 701px) and (max-height: 950px) {
  #selection {
    padding: 18px 28px;
  }
  #selection .selection-nav {
    padding-bottom: 12px;
  }
  #selection .selection-heading {
    max-width: 850px;
    margin: 15px auto 18px;
  }
  #selection h1 {
    font-size: 38px;
    letter-spacing: -1.5px;
    margin: 10px 0;
  }
  #selection h1 br {
    display: none;
  }
  #selection .selection-heading p {
    max-width: 670px;
    font-size: 12px;
    line-height: 1.45;
  }
  #selection .run-facts {
    display: none;
  }
  #selection .party-heading h2 {
    font-size: 21px;
  }
  #selection .party-heading .eyebrow {
    display: none;
  }
  #selection #character-cards {
    margin-top: 12px;
  }
  #selection .portrait-stage {
    height: 130px;
    padding-top: 25px;
  }
  #selection .portrait {
    height: 132px;
    width: 140px;
  }
  #selection .portrait-stage::before {
    width: 130px;
    height: 130px;
  }
  #selection .portrait-caption {
    font-size: 6px;
    padding: 4px;
    bottom: 6px;
  }
  #selection .card-top {
    top: 10px;
    left: 12px;
    right: 12px;
  }
  #selection .class-label {
    font-size: 10px;
  }
  #selection .card-info {
    padding: 13px 15px;
  }
  #selection .card-info h3 {
    font-size: 24px;
  }
  #selection .class-hook {
    font-size: 10px;
    margin: 7px 0 10px;
  }
  #selection .stat-strip {
    margin-bottom: 8px;
  }
  #selection .trait {
    min-height: 41px;
    font-size: 9px;
    margin-top: 7px;
    padding-top: 7px;
  }
  #selection .trait strong {
    font-size: 10px;
  }
  #selection .choose {
    margin-top: 10px;
    min-height: 40px;
    padding: 8px 12px;
  }
  #selection .selection-footer {
    margin-top: 8px;
  }
}
@media (min-width: 701px) and (max-height: 950px) {
  #selection .selection-heading {
    margin: 12px auto;
  }
  #selection .selection-nav {
    padding-bottom: 8px;
  }
  #selection .portrait-stage {
    height: 120px;
  }
  #selection .portrait {
    height: 124px;
  }
}

/* Detailed portrait art is reduced from 280–360px sources. Nearest-neighbor
   reduction loses features; render once at its natural aspect ratio instead.
   Race sizing belongs in layout, avoiding a second composited scale pass. */
#selection .portrait {
  width: auto;
  height: calc(192px * var(--portrait-scale, 1));
  max-width: calc(100% - 16px);
  image-rendering: auto;
  transform: none;
  filter: none;
}
#selection .character-card {
  cursor: pointer;
  touch-action: manipulation;
}
#selection .character-card:has(.choose:focus-visible) {
  outline: 3px solid #fff1bb;
  outline-offset: 4px;
}
#selection .character-card:hover {
  transform: none;
}
#selection .party-heading {
  align-items: center;
}
#selection #reroll {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 8px 0 8px 10px;
  flex-shrink: 0;
  touch-action: manipulation;
}
#reroll .reroll-die {
  display: inline-flex;
  flex-shrink: 0;
  border: 0;
}
.dice-icon {
  display: block;
  width: 26px;
  height: 26px;
}
.opening-core > .dice-icon {
  width: 104px;
  height: 104px;
}
#reroll.rolling .dice-icon {
  animation: dice-roll 0.7s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}
@keyframes dice-roll {
  0% {
    transform: rotate(0deg);
  }
  35% {
    transform: rotate(140deg) scale(0.85);
  }
  100% {
    transform: rotate(360deg);
  }
}
@media (min-width: 701px) and (max-height: 950px) {
  #selection .portrait {
    height: calc(116px * var(--portrait-scale, 1));
  }
}
@media (max-width: 700px) {
  #selection .portrait {
    width: calc(96px * var(--portrait-scale, 1));
    height: auto;
    max-width: calc(100% - 8px);
  }
  #selection .party-heading {
    display: flex;
    gap: 8px;
  }
  #selection .party-heading h2 {
    font-size: clamp(17px, 4.5vw, 23px);
  }
  #selection #reroll {
    gap: 6px;
    padding-left: 0;
    font-size: 10px;
  }
  #selection #reroll .dice-icon {
    width: 23px;
    height: 23px;
  }
}
@media (prefers-reduced-motion: reduce) {
  #reroll.rolling .dice-icon {
    animation: none;
  }
}

@media (max-width: 700px) {
  /* Center the reveal in the first card, not the full three-card scroll area. */
  #character-cards > .opening-stage {
    bottom: auto;
    height: 300px;
  }
}
