.setup-screen {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: .9cqw;
  overflow: hidden;
  padding: 2.1% 4.8% 1.9%;
  background:
    radial-gradient(ellipse at 54% 48%, rgba(28, 15, 8, 0.14), rgba(18, 9, 4, 0.72) 85%),
    linear-gradient(180deg, rgba(24, 12, 6, 0.56), transparent 22%, transparent 68%, rgba(18, 9, 4, 0.82)),
    url("assets/pixel/bg_guild_pixel.png") center / cover;
}

.draft-head {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: .85em;
  padding: .15em .2em .55em;
  background: none;
  border: 0;
  border-bottom: 1.5px solid transparent;
  border-image: linear-gradient(90deg, transparent, rgba(224, 166, 58, 0.55) 20%, rgba(224, 166, 58, 0.55) 80%, transparent) 1;
  box-shadow: none;
}
.draft-head h2 {
  font-family: var(--display);
  font-size: clamp(20px, 2.55cqw, 42px);
  font-weight: 950;
  white-space: nowrap;
  background: linear-gradient(180deg, #fff8e4 0%, #ffd46c 55%, #cc8120 100%);
  -webkit-background-clip: text;
  color: transparent;
  filter: drop-shadow(0 3px 0 #2b1305);
}
.draft-head .back-action { margin: 0; justify-self: start; }
.draft-head .choice-strip { justify-self: end; color: var(--brass-bright); font-weight: 850; }
.draft-daily { justify-self: end; white-space: nowrap; }
#stage-wrapper.pixel-ui .draft-daily[aria-pressed="true"] {
  border-color: #b69864;
  background: #53442e;
  color: #ffe3a5;
}
.draft-main {
  display: grid;
  min-height: 0;
  grid-template-columns: minmax(0, 3.75fr) minmax(0, 1.35fr);
  gap: 1.4cqw;
}

.draft-feature, .entrance-card {
  --cast-color: #ffca68;
  position: relative;
  isolation: isolate;
}
.draft-feature {
  display: flex;
  align-items: center;
  min-height: 0;
  overflow: visible;
  border: 0;
  background: none;
  box-shadow: none;
}
.cast-field {
  position: absolute;
  z-index: -1;
  inset: 0;
  overflow: hidden;
  background: radial-gradient(circle at 74% 56%, color-mix(in srgb, var(--cast-color) 42%, #ffd27d) 0%, rgba(255, 196, 95, 0.1) 38%, transparent 64%);
}
.cast-field::before, .cast-field::after { content: none; }

.draft-copy {
  position: relative;
  z-index: 2;
  width: 53%;
  height: auto;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: .65cqw 1.05cqw;
  border: 14px solid transparent;
  border-image: var(--svg-parchment-frame) 24 fill / 14px / 0 stretch;
  filter: drop-shadow(0 12px 24px rgba(12, 5, 2, 0.72));
  transform: rotate(-0.7deg);
}
.draft-copy h3 {
  margin-block: .12em .08em;
  color: #2a1508;
  font-family: var(--display);
  font-size: clamp(22px, 3.8cqw, 64px);
  font-weight: 950;
  letter-spacing: -.04em;
  line-height: 1.08;
  white-space: nowrap;
  text-shadow: none;
}
.draft-copy q {
  color: #5c3c24;
  font-size: .88em;
  font-weight: 700;
  line-height: 1.4;
  quotes: none;
  text-shadow: none;
}
.draft-skills {
  display: grid;
  gap: .45em;
  margin-top: .7em;
  font-size: .82em;
  line-height: 1.44;
}
.draft-skills p {
  padding: .46em .72em;
  border: 1px solid rgba(156, 108, 49, 0.45);
  border-radius: 5px;
  background: rgba(180, 134, 72, 0.14);
  color: var(--ink);
  font-weight: 650;
  box-shadow: inset 4px 0 0 color-mix(in srgb, var(--cast-color) 75%, #8c3810);
}
.draft-skills strong { color: #8c2d0c; font-weight: 950; }
.draft-portrait {
  position: absolute;
  width: 50%;
  height: 98%;
  bottom: -2%;
  right: 1%;
  object-fit: contain;
  object-position: 58% bottom;
  filter: drop-shadow(0 1cqw 1.3cqw rgba(16, 7, 3, 0.88));
  transform-origin: center 86%;
}

.cast-sweep { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.cast-sweep::before {
  content: "";
  position: absolute;
  inset: -30% -35%;
  background: linear-gradient(100deg, transparent 37%, color-mix(in srgb, var(--cast-color), transparent 24%) 50%, transparent 61%);
  transform: translateX(120%);
  animation: cast-sweep .64s cubic-bezier(.2,.7,.24,1) backwards;
}
.cast-sweep::after {
  content: "";
  position: absolute;
  width: 44%;
  aspect-ratio: 1;
  right: 4%;
  bottom: -23%;
  border: 2px solid var(--cast-color);
  border-radius: 50%;
  opacity: 0;
  animation: cast-ripple .75s ease-out .08s backwards;
}
.cast-motion { animation: var(--cast-motion, cast-impact) .67s cubic-bezier(.15,.73,.23,1) backwards; }
[data-effect="roll"] { --cast-motion: cast-roll; }
[data-effect="scan"] { --cast-motion: cast-scan; }
[data-effect="flank"] { --cast-motion: cast-flank; }
[data-effect="surge"] { --cast-motion: cast-surge; }
[data-effect="orbit"] { --cast-motion: cast-orbit; }
[data-effect="drop"] { --cast-motion: cast-drop; }

@keyframes cast-impact { from { opacity: 0; transform: translateY(17%) scale(1.28); } 53% { opacity: 1; transform: translateY(-3%) scale(.98); } to { transform: none; } }
@keyframes cast-roll { from { opacity: 0; transform: translateX(40%) rotate(25deg) scale(.8); } 67% { transform: translateX(-2%) rotate(-5deg); } to { transform: none; } }
@keyframes cast-scan { from { opacity: .35; clip-path: inset(95% 0 0); transform: translateY(4%); } 62% { opacity: 1; clip-path: inset(7% 0 0); } to { clip-path: inset(0); transform: none; } }
@keyframes cast-flank { from { opacity: 0; transform: translateX(-52%) skewX(-12deg) scale(.93); } 65% { transform: translateX(4%); } to { transform: none; } }
@keyframes cast-surge { from { opacity: 0; transform: translateY(36%) scale(.9); } 66% { opacity: 1; transform: translateY(-5%) scale(1.04); } to { transform: none; } }
@keyframes cast-orbit { from { opacity: 0; transform: rotate(-15deg) translateY(19%) scale(.82); } 70% { opacity: 1; transform: rotate(3deg) translateY(-4%); } to { transform: none; } }
@keyframes cast-drop { from { opacity: 0; transform: translateY(-43%) scale(.94); } 57% { opacity: 1; transform: translateY(2%) scale(1.06,.94); } to { transform: none; } }
@keyframes cast-sweep { from { transform: translateX(-105%); opacity: .9; } to { transform: translateX(120%); opacity: 0; } }
@keyframes cast-ripple { from { transform: scale(.32); opacity: .75; } to { transform: scale(1.45); opacity: 0; } }
@keyframes ticket-arrive { from { opacity: 0; transform: translateY(9%) scale(.95); } to { opacity: 1; transform: none; } }

.draft-side {
  display: flex;
  flex-direction: column;
  gap: .62em;
  min-width: 0;
  padding: .75em .85em;
  border: 0;
  border-left: 2px solid rgba(224, 166, 58, 0.48);
  border-radius: 0 10px 10px 0;
  background: linear-gradient(180deg, rgba(44, 24, 13, 0.84), rgba(26, 14, 7, 0.92));
  backdrop-filter: blur(4px);
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.42);
}
.draft-role-field { display: flex; align-items: center; justify-content: space-between; gap: .4em; font-size: .82em; color: var(--brass-bright); font-weight: 850; }
.draft-role-field select {
  max-width: 66%;
  padding: .34em .55em;
  border: 2px solid #9c6c31;
  border-radius: 6px;
  background: #faf0d8;
  color: var(--ink);
  font-weight: 800;
}
.draft-seats { display: grid; grid-auto-rows: minmax(0, 3.85em); flex: 1; gap: .5em; min-height: 0; }
#seat-count .mode-choice { min-width: 2.4em; padding: .34em .65em; }
.draft-seat {
  position: relative;
  display: grid;
  grid-template-columns: 2.75em 1fr;
  align-items: center;
  gap: .55em;
  text-align: left;
  min-height: 0;
  padding: .28em .58em;
  border: 2px solid #b57e36;
  border-radius: 8px;
  background: linear-gradient(180deg, #5d3922, #3c2314);
  color: var(--text-main);
  box-shadow: 0 0 0 1px #180b04, 0 3px 0 #150b05, inset 5px 0 0 var(--seat-color);
}
.draft-seat:hover { border-color: var(--brass-bright); background: linear-gradient(180deg, #6e4429, #492b19); }
.draft-seat[aria-pressed="true"] {
  border-color: #9c6c31;
  background: linear-gradient(180deg, #faf0d8 0%, #ecd6ad 100%);
  box-shadow: 0 0 0 1px #3a1a06, 0 4px 0 #4d2e14, 0 0 14px rgba(255, 212, 92, 0.32), inset 5px 0 0 var(--seat-color);
}
.draft-seat[aria-pressed="true"] strong { color: #2a170b; font-weight: 950; }
.draft-seat[aria-pressed="true"] small { color: #5c3c24; font-weight: 700; }
.draft-seat img { min-height: 0; width: 100%; height: 100%; object-fit: contain; }
.draft-seat div { min-width: 0; }
.draft-seat strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .88em; color: #fff4de; font-weight: 850; }
.draft-seat small { display: block; margin-top: .08em; color: #dfc7a3; font-size: .71em; white-space: nowrap; }

.roster-picker { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .65cqw; }
.roster-pick {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: end;
  justify-items: center;
  height: 6.1cqw;
  min-height: 54px;
  overflow: hidden;
  padding: .2em .3em .34em;
  border: 2px solid #b57e36;
  border-radius: 14px 14px 6px 6px;
  background: radial-gradient(circle at 50% 42%, rgba(212, 146, 52, 0.2), rgba(34, 19, 10, 0.94));
  color: #f4dfc0;
  font-size: .78em;
  font-weight: 850;
  box-shadow: 0 0 0 1.5px #180b04, 0 4px 0 #150b05;
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.roster-pick img { width: 100%; height: 100%; min-height: 0; object-fit: contain; object-position: center 13%; }
.roster-ink { display: none; }
.roster-pick span { white-space: nowrap; text-shadow: 0 1.5px 0 #180b04; }
.roster-pick:hover:not(:disabled) { transform: translateY(-3px); border-color: var(--brass-bright); }
.roster-pick[aria-pressed="true"] {
  border-color: #ffe28a;
  background: radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--cast-color) 46%, #8f5626), #382010 85%);
  color: #fff9e6;
  transform: translateY(-4px);
  box-shadow: 0 0 0 1.5px #180b04, 0 6px 0 #150b05, 0 0 18px color-mix(in srgb, var(--cast-color) 52%, transparent);
}
.roster-pick:disabled { opacity: .45; filter: grayscale(0.4); }
.draft-foot { padding-top: .5em; }

.entrance-screen {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 1.2cqw;
  padding: 3.1% 5.2% 2.7%;
  background: linear-gradient(180deg, rgba(28, 15, 8, 0.58), rgba(18, 9, 4, 0.78)), url("assets/bg_lobby_hero.jpg") center / cover;
}
.entrance-head { text-align: center; }
.entrance-head h2 {
  font-family: var(--display);
  font-size: clamp(22px, 4.45cqw, 75px);
  color: var(--brass-bright);
  line-height: 1.1;
  text-shadow: 0 4px 0 #2b1305;
}
.entrance-cards {
  display: grid;
  grid-template-columns: repeat(var(--cast-count, 4), minmax(0, 1fr));
  gap: 1.16cqw;
  width: 100%;
  max-width: 88cqw;
  min-height: 0;
  justify-self: center;
}
.entrance-cards[data-count="1"] { max-width: 34cqw; }
.entrance-cards[data-count="2"] { max-width: 52cqw; }
.entrance-cards[data-count="3"] { max-width: 72cqw; }
.entrance-card {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: .45em .55em;
  overflow: hidden;
  border: 12px solid transparent;
  border-image: var(--svg-brass-plaque) 22 fill / 12px / 0 stretch;
  filter: drop-shadow(0 12px 26px rgba(0, 0, 0, 0.65));
  animation: ticket-arrive .52s cubic-bezier(.2,.7,.24,1) backwards;
  animation-delay: var(--cast-delay);
}
.entrance-card .cast-motion, .entrance-card .cast-sweep::before, .entrance-card .cast-sweep::after { animation-delay: var(--cast-delay); }
.ticket-top { display: flex; align-items: center; gap: .46em; min-height: 1.65em; color: var(--text-main); font-size: .78em; font-weight: 800; }
.ticket-top b { color: var(--seat-color); font-weight: 950; }
.ticket-art { position: relative; flex: 1; min-height: 0; }
.ticket-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: center bottom; filter: drop-shadow(0 .45em .6em #120904); }
.ticket-name { font-family: var(--display); border-top: 1px dashed var(--line); padding-top: .42em; color: #fff4d8; font-size: 1.34em; line-height: 1.05; font-weight: 900; }
.ticket-quote { min-height: 3em; margin-top: .45em; font-size: .76em; color: #f0d7b1; line-height: 1.45; }
.entrance-foot { display: flex; justify-content: end; font-size: .87em; }

.record-note {
  padding: .48em .75em;
  color: #7c2d12;
  border: 1.5px solid #c27829;
  border-radius: 6px;
  background: #fdecc8;
  font-size: .86em;
  font-weight: 850;
  margin-bottom: .4em;
  box-shadow: inset 4px 0 0 #d97706;
}
#result-rounds { margin-top: .55em; color: var(--ink-sub); font-size: .8em; }
#result-rounds summary { cursor: pointer; padding: .4em .5em; font-weight: 800; color: #7c3810; }
#results-round-list { max-height: 7em; overflow: auto; list-style: none; padding: 0 .55em; }
#results-round-list li { border-top: 1px solid rgba(156, 108, 49, 0.32); padding: .35em 0; overflow-wrap: anywhere; }

.expedition-screen { gap: 1.05cqw; padding: 2.2% 4.8% 2%; overflow: hidden; }
.expedition-head {
  display: grid;
  align-items: center;
  grid-template-columns: 1fr auto 1fr;
  column-gap: .8em;
  padding: .15em .2em .55em;
  background: none;
  border: 0;
  border-bottom: 1.5px solid transparent;
  border-image: linear-gradient(90deg, transparent, rgba(224, 166, 58, 0.55) 20%, rgba(224, 166, 58, 0.55) 80%, transparent) 1;
  box-shadow: none;
}
.expedition-head .back-action { margin: 0; justify-self: start; }
#btn-modes-practice { justify-self: end; }
.expedition-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2.25fr); gap: 2cqw; min-height: 0; }
.expedition-menu { display: grid; align-content: start; min-width: 0; gap: .38em; }
.expedition-choice {
  padding: .75em 1em;
  border: 0;
  border-radius: 6px;
  text-align: left;
  background: transparent;
  color: #ebd6b2;
  box-shadow: none;
  transition: transform .13s ease, background .13s ease, color .13s ease;
}
.expedition-choice strong { font-family: var(--display); font-size: 1.32em; font-weight: 900; text-shadow: 0 2px 6px #120904; }
.expedition-choice:hover {
  background: linear-gradient(90deg, rgba(235, 168, 56, 0.18), transparent 82%);
  color: #fff8e2;
  transform: translateX(4px);
}
.expedition-choice[aria-pressed="true"] {
  background: linear-gradient(90deg, rgba(235, 168, 56, 0.34), rgba(235, 168, 56, 0.06) 85%, transparent);
  color: #fff9e6;
  box-shadow: inset 3.5px 0 0 #ffe28a;
}
.expedition-choice[aria-pressed="true"] strong { color: var(--brass-bright); }
.expedition-choice[aria-pressed="true"] span { color: #f6e7c8; font-weight: 700; }

.expedition-board {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: .55em;
  min-height: 0;
  min-width: 0;
  padding: .45em .65em;
  border: 14px solid transparent;
  border-image: var(--svg-journal-frame) 26 fill / 14px / 0 stretch;
  filter: drop-shadow(0 12px 26px rgba(0, 0, 0, 0.68));
}
.expedition-board-head { display: flex; min-height: 2.1em; align-items: center; justify-content: space-between; gap: .5em; }
#mode-length { color: var(--brass-bright); font-size: .88em; font-weight: 850; }
.expedition-preview {
  position: relative;
  display: grid;
  align-items: end;
  min-height: 0;
  overflow: hidden;
  border: 2px solid #8a5a26;
  border-radius: 7px;
  background: #24160d;
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.65);
}
#mode-mine-ink { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.expedition-preview > div {
  position: relative;
  width: 100%;
  padding: 1.6em 1.3em .95em;
  background: linear-gradient(0deg, rgba(22, 11, 5, 0.94) 38%, transparent);
}
.expedition-preview h3 { font: 950 clamp(18px, 2.7cqw, 42px)/1.15 var(--display); color: var(--brass-bright); text-shadow: 0 2px 0 #1d0c04; }
.expedition-preview p { margin-top: .35em; color: #fff0d1; font-size: .86em; line-height: 1.4; }
.expedition-stops {
  list-style: none;
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  gap: .45em;
  padding: 0;
}
.expedition-stops button {
  width: 100%;
  height: 2.5em;
  border: 2px solid #b57e36;
  border-radius: 6px;
  background: linear-gradient(180deg, #5d3922, #382013);
  color: #f4dfc0;
  font: 850 .88em/1 ui-monospace, monospace;
  box-shadow: 0 0 0 1px #180b04, 0 3px 0 #150b05;
}
.expedition-stops button[aria-pressed="true"] {
  background: linear-gradient(180deg, #ffe484, #f2a924 55%, #cf740e);
  color: #2b1304;
  border-color: #733407;
  font-weight: 950;
  box-shadow: 0 0 0 1px #2b1203, 0 3px 0 #733407, inset 0 1.5px 0 rgba(255, 252, 220, 0.85);
}
.expedition-foot { padding-top: .55em; }

.records-sheet {
  min-height: 0;
  overflow: auto;
  padding: .75cqw 1cqw;
  border: 14px solid transparent;
  border-image: var(--svg-parchment-frame) 24 fill / 14px / 0 stretch;
  color: var(--ink);
  filter: drop-shadow(0 14px 30px rgba(0, 0, 0, 0.72));
}
#records-empty { color: var(--ink-sub); font-weight: 700; }
#records-table td { font-size: .9em; }

.relic-screen {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 1em;
  overflow: hidden;
  padding: 2.2% 5% 2%;
  background:
    radial-gradient(ellipse at 50% 25%, rgba(212, 130, 38, 0.3), rgba(22, 12, 6, 0.62) 72%),
    linear-gradient(180deg, rgba(36, 18, 8, 0.36), rgba(18, 10, 5, 0.78)),
    var(--relic-scene, url("assets/pixel/bg_shrine_pixel.png")) center / cover;
}
.relic-head {
  text-align: center;
  padding: .15em 0;
  border: 0;
  background: none;
  box-shadow: none;
}
.relic-head h2 {
  font: 950 clamp(24px, 3.4cqw, 56px)/1.12 var(--display);
  background: linear-gradient(180deg, #fff8e4 0%, #ffd46c 55%, #cc8120 100%);
  -webkit-background-clip: text;
  color: transparent;
  margin-block: .04em .08em;
  filter: drop-shadow(0 3px 0 #2b1305);
}
.relic-head p { font-size: .86em; color: #f0d7b1; font-weight: 700; text-shadow: 0 2px 6px #120904; }

.relic-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.45em;
  min-height: 0;
  align-items: stretch;
}
.relic-options.upgrading {
  grid-template-columns: repeat(auto-fit, minmax(16em, 1fr));
  grid-auto-rows: minmax(14em, 1fr);
  overflow: auto;
  padding: .3em;
}
.relic-screen[data-reward-draft] {
  padding-inline: 3%;
}
.relic-screen[data-reward-draft] .relic-options {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(6px, 1.15cqw, 22px);
}
.relic-screen[data-expedition] .relic-pick {
  box-shadow: inset 0 3px 0 var(--rarity-ink), inset 0 0 32px color-mix(in srgb, var(--rarity-ink) 16%, transparent);
}
.relic-screen[data-reward-draft] .relic-copy {
  padding-inline: .25em;
}
.relic-screen[data-reward-draft] .relic-copy strong {
  font-size: 1.09em;
}
.relic-screen[data-reward-draft] .relic-emblem {
  width: min(7.8em, 11cqw);
  height: min(7.8em, 11cqw);
}
.relic-pick {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  gap: .45em;
  padding: .45em .6em .5em;
  text-align: center;
  border: 12px solid transparent;
  border-image: var(--svg-brass-plaque) 22 fill / 12px / 0 stretch;
  color: var(--text-main);
  box-shadow: inset 0 0 36px color-mix(in srgb, var(--rarity-ink, #e0a63a) 18%, transparent);
  filter: drop-shadow(0 14px 28px rgba(0, 0, 0, 0.72));
  transition: transform .16s ease, filter .16s ease;
  animation: relic-arrive .42s cubic-bezier(.16, 1, .3, 1) var(--relic-delay) both;
}
.relic-pick::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 35%, color-mix(in srgb, var(--rarity-ink, #ffd452), transparent 82%) 50%, transparent 65%);
  transform: translateX(-100%);
  transition: transform .5s ease;
  pointer-events: none;
}
.relic-pick:is(:hover, :focus-visible) {
  transform: translateY(-7px);
  filter: drop-shadow(0 20px 34px rgba(0, 0, 0, 0.85)) drop-shadow(0 0 18px color-mix(in srgb, var(--rarity-ink, #e0a63a) 45%, transparent));
}
.relic-pick:is(:hover, :focus-visible)::before { transform: translateX(100%); }
.relic-pick[data-fusion] {
  box-shadow: inset 0 0 46px rgba(255, 200, 68, 0.34);
}

.relic-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5em;
  font-size: .78em;
  font-weight: 900;
}
.relic-rarity {
  padding: .16em .6em;
  border-radius: 999px;
  border: 1.5px solid color-mix(in srgb, var(--rarity-ink) 75%, #2b160a);
  background: #24130a;
  color: var(--rarity-ink);
}
.relic-meta { color: var(--brass-bright); text-shadow: 0 1.5px 0 #1d0c04; }

.relic-emblem {
  display: grid;
  place-items: center;
  width: 7.8em;
  height: 7.8em;
  max-width: 100%;
  justify-self: center;
  align-self: center;
  border-radius: 50%;
  border: 3px solid color-mix(in srgb, var(--rarity-ink, #e0a63a) 78%, #2b160a);
  background: radial-gradient(circle, color-mix(in srgb, var(--rarity-ink, #e0a63a) 26%, #24130a), #180c06 74%);
  box-shadow: inset 0 3px 10px rgba(0, 0, 0, 0.7), 0 10px 24px rgba(0, 0, 0, 0.62);
}
.relic-emblem img {
  width: 88%;
  height: 88%;
  border-radius: 50%;
  object-fit: cover;
  filter: drop-shadow(0 .3em .5em rgba(0, 0, 0, 0.78));
  transition: transform .24s ease-out;
}
.relic-pick:is(:hover, :focus-visible) .relic-emblem img { transform: scale(1.08) rotate(-3deg); }

.relic-copy {
  display: grid;
  gap: .28em;
  text-align: center;
  padding: .25em .45em;
  border: 12px solid transparent;
  border-image: var(--svg-parchment-frame) 24 fill / 12px / 0 stretch;
}
.relic-copy strong { color: #2a160a; font: 950 1.25em/1.15 var(--display); }
.relic-copy > span { min-height: 2.8em; font-size: .84em; line-height: 1.42; color: #4f331e; font-weight: 650; }
.relic-formula {
  display: inline-block;
  margin-top: .22em;
  padding: .18em .62em;
  border: 1px solid #c27829;
  border-radius: 4px;
  background: #f3d9a4;
  color: #7c2d12;
  font-size: .76em;
  font-weight: 850;
}

.relic-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8em;
  padding: .52em .1em .1em;
  border: 0;
  border-top: 1.5px solid transparent;
  border-image: linear-gradient(90deg, transparent, rgba(224, 166, 58, 0.45) 20%, rgba(224, 166, 58, 0.45) 80%, transparent) 1;
  background: none;
  box-shadow: none;
}
#relic-owned, #result-build { list-style: none; padding: 0; display: flex; gap: .4em .55em; flex-wrap: wrap; align-items: center; }
.owned-relic-chip {
  display: inline-flex;
  align-items: center;
  gap: .35em;
  padding: .22em .55em;
  border: 1.5px solid color-mix(in srgb, var(--relic-ink, #e0a63a) 55%, #2b160a);
  border-radius: 999px;
  background: rgba(30, 17, 9, 0.85);
  color: #fff4de;
  font-size: .76em;
  font-weight: 750;
}
.owned-relic-chip img { width: 1.65em; height: 1.65em; object-fit: cover; border-radius: 50%; }
.owned-relic-chip strong { color: var(--brass-bright); font: 850 .95em/1 ui-monospace, monospace; }
:is(.owned-relic-chip, .hud-relic-chip):is(:hover, :focus-visible) { border-color: var(--relic-ink, #ffe28a); }

.owned-relic-tooltip {
  position: absolute;
  z-index: 12;
  inline-size: max-content;
  max-inline-size: min(25em, 92cqw);
  padding: .68em .85em;
  border: 1px solid #9b784e;
  border-inline-start: 3px solid var(--relic-ink, #e0a63a);
  border-radius: 5px;
  background: #281a12;
  color: #f5e7cb;
  box-shadow: 0 4px 0 #130c09, 0 9px 22px #0c0808aa;
  font-size: clamp(12px, 1.1cqw, 18px);
  line-height: 1.5;
}
.owned-relic-tooltip::after {
  content: "";
  position: absolute;
  inset: 100% 0 auto;
  height: 8px;
}
.owned-relic-tooltip[data-below]::after { inset-block: auto 100%; }
.owned-relic-tooltip > div { display: flex; align-items: baseline; flex-wrap: wrap; gap: .14em .85em; }
#owned-relic-name { font-family: var(--display); font-size: 1.12em; color: #ffe1a6; }
#owned-relic-rank { color: var(--relic-ink, #e0a63a); font-size: .86em; }
#owned-relic-description { margin-top: .3em; }

#btn-relic-reroll { flex: none; border-color: #c084fc; color: #f3e8ff; white-space: nowrap; }
#btn-relic-reroll span { margin-inline-start: .45em; font-size: .78em; color: #e7caff; }
#screen-relic[data-expedition] #relic-owned { max-height: 3.3em; overflow: auto; min-width: 0; }
#btn-relic-menu { flex: none; margin-left: auto; }
#result-build:not(:empty) { margin-block: .55em; }

@keyframes relic-arrive {
  from { opacity: 0; translate: 0 1em; }
  to { opacity: 1; translate: none; }
}
@media (prefers-reduced-motion: reduce) {
  .relic-pick, .relic-emblem img, .screen { animation: none; transition: none; }
}

#stage-wrapper.pixel-ui :is(.draft-copy, .draft-side, .expedition-board, .entrance-card) {
  border: 10px solid transparent;
  border-image: var(--px-iron) 12 fill / 10px / 0 stretch;
  border-radius: 0;
  background: none;
  box-shadow: none;
  filter: drop-shadow(0 8px 10px #080a09c7);
  color: var(--px-paper);
}
#stage-wrapper.pixel-ui .draft-copy { transform: none; }
#stage-wrapper.pixel-ui .draft-copy h3 { color: var(--px-gold); text-shadow: 0 2px var(--px-ink); }
#stage-wrapper.pixel-ui .draft-copy q { color: #e2cfb2; }
#stage-wrapper.pixel-ui .draft-skills p {
  border: 0;
  border-left: 2px solid var(--cast-color);
  border-radius: 0;
  background: #151b18;
  color: #efe8d5;
  box-shadow: none;
}
#stage-wrapper.pixel-ui .draft-skills strong { color: var(--px-gold); }
#stage-wrapper.pixel-ui #seat-count {
  min-width: 0;
  padding: .2em;
  gap: .22em;
  border: 1px solid #667263;
  background: var(--px-well);
  box-shadow: inset 0 2px #0a100d;
}
#stage-wrapper.pixel-ui .setup-screen[data-kind="expedition"] #seat-count {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
#stage-wrapper.pixel-ui #seat-count .pixel-button {
  min-width: 0;
  padding: .26em .32em;
}
#stage-wrapper.pixel-ui .draft-seat {
  border: 1px solid #778168;
  border-radius: 0;
  background: #252e2b;
  box-shadow: inset 3px 0 var(--seat-color), 0 2px #161713;
}
#stage-wrapper.pixel-ui .draft-seat[aria-pressed="true"] {
  border-color: #bad39a;
  background: #445a44;
  box-shadow: inset 3px 0 var(--seat-color), inset 0 2px #657955, 0 2px #161713;
}
#stage-wrapper.pixel-ui .draft-seat[aria-pressed="true"] strong { color: #fff1d5; }
#stage-wrapper.pixel-ui .draft-seat[aria-pressed="true"] small { color: #daeac9; }
#stage-wrapper.pixel-ui .roster-pick {
  border: 1px solid #6a7464;
  border-bottom: 3px solid #141a19;
  border-radius: 0;
  background: linear-gradient(0deg, #171b19 27%, #29312c 27%, #313933);
  box-shadow: inset 0 1px #556354, 0 2px #171914;
}
#stage-wrapper.pixel-ui .roster-pick[aria-pressed="true"] {
  border-color: var(--cast-color);
  background: linear-gradient(0deg, #292b20 27%, color-mix(in srgb, var(--cast-color) 28%, #252e26) 27%, #343d31);
  box-shadow: inset 0 2px var(--cast-color), 0 2px #171914;
}
#stage-wrapper.pixel-ui .roster-pick[aria-pressed="true"]::after {
  content: "";
  position: absolute;
  inset: 3px auto auto 3px;
  width: .66em;
  height: .66em;
  border-top: 2px solid var(--cast-color);
  border-left: 2px solid var(--cast-color);
}
#stage-wrapper.pixel-ui :is(.draft-seat, .roster-pick, .expedition-choice, .relic-pick, .owned-relic-chip):active:not(:disabled) {
  translate: 0 2px;
  transform: none;
}
#stage-wrapper.pixel-ui :is(.expedition-preview, .draft-role-field select, .record-note) {
  border-radius: 0;
  filter: none;
}
#stage-wrapper.pixel-ui .draft-role-field select {
  border: 1px solid #899379;
  background: #202622;
  color: var(--px-paper);
}
#stage-wrapper.pixel-ui .record-note {
  background: #29372b;
  border-color: #667755;
  color: var(--px-gold);
}
#stage-wrapper.pixel-ui #result-rounds { color: #e1d4bb; }
#stage-wrapper.pixel-ui #result-rounds summary { color: var(--px-jade); }
#stage-wrapper.pixel-ui .expedition-choice {
  border-radius: 0;
  text-shadow: 0 2px var(--px-ink);
}
#stage-wrapper.pixel-ui .expedition-choice[aria-pressed="true"] {
  background: linear-gradient(90deg, #435848, #24342c 83%, #24342c00);
  box-shadow: inset 4px 0 #b8dda3;
}

#stage-wrapper.pixel-ui :is(.setup-screen, .entrance-screen) {
  background: radial-gradient(ellipse at 60% 43%, #161e1514, #111815b6 80%),
    linear-gradient(180deg, #101712c4, transparent 32%, #11130fe0),
    url("assets/pixel/bg_guild_pixel.png") center / cover;
}
#stage-wrapper.pixel-ui .relic-screen {
  background: linear-gradient(180deg, #1417128c, #161b16aa 55%, #151411e8),
    var(--relic-scene, url("assets/pixel/bg_shrine_pixel.png")) center / cover;
  gap: max(5px, .65em);
}
#stage-wrapper.pixel-ui .relic-options {
  padding: .32em .25em .42em;
  align-content: start;
  overflow: auto;
  scrollbar-gutter: stable;
  grid-auto-rows: auto;
}
#stage-wrapper.pixel-ui .relic-options.upgrading {
  grid-template-columns: repeat(auto-fit, minmax(min(13em, 100%), 1fr));
}
#stage-wrapper.pixel-ui .relic-pick {
  grid-template-rows: auto auto 1fr;
  align-items: start;
  min-width: 0;
  min-height: 0;
  gap: .52em;
  padding: .35em .48em .52em;
  border: 7px solid transparent;
  border-image: var(--px-case) 10 fill / 7px / 0 stretch;
  border-radius: 0;
  background: none;
  color: var(--px-paper);
  filter: drop-shadow(0 5px 2px #14110ee8);
  box-shadow: none;
  transition: transform .14s steps(3, end), filter .14s ease;
}
#stage-wrapper.pixel-ui .relic-pick::before {
  inset: 0 0 auto;
  height: 3px;
  background: var(--rarity-ink);
  transform: none;
  transition: none;
}
#stage-wrapper.pixel-ui .relic-pick:is(:hover, :focus-visible) {
  transform: translateY(-2px);
  filter: drop-shadow(0 4px 0 #120e0b) drop-shadow(0 0 3px color-mix(in srgb, var(--rarity-ink) 42%, transparent));
}
#stage-wrapper.pixel-ui .relic-card-top {
  align-self: start;
  flex-wrap: wrap;
  gap: .24em .4em;
  min-height: 1.75em;
  font-size: max(11px, .82em);
}
#stage-wrapper.pixel-ui .relic-rarity {
  display: inline-flex;
  align-items: center;
  gap: .3em;
  padding: .12em .32em;
  border: 0;
  border-bottom: 1px solid var(--rarity-ink);
  border-radius: 0;
  background: color-mix(in srgb, var(--rarity-ink) 18%, #211a17);
  color: var(--rarity-ink);
}
#stage-wrapper.pixel-ui .relic-rivets {
  width: calc(var(--grade) * 5px - 2px);
  height: 3px;
  flex: none;
  background: repeating-linear-gradient(90deg, currentColor 0 3px, transparent 3px 5px);
}
#stage-wrapper.pixel-ui .relic-meta { color: #dfcaab; }
#stage-wrapper.pixel-ui .relic-emblem {
  width: clamp(49px, 8.6cqw, 116px);
  height: clamp(49px, 8.6cqw, 116px);
  max-width: 100%;
  border: 2px solid color-mix(in srgb, var(--rarity-ink) 48%, #705c48);
  border-radius: 0;
  background: radial-gradient(circle, color-mix(in srgb, var(--rarity-ink) 29%, #302219), #1d1c18 74%);
  box-shadow: inset 0 0 0 2px #10110f;
}
#stage-wrapper.pixel-ui .relic-emblem img {
  width: 85%;
  height: 85%;
  object-fit: contain;
  border-radius: 0;
  filter: none;
}
#stage-wrapper.pixel-ui .relic-pick:is(:hover, :focus-visible) .relic-emblem img { transform: translateY(-2px); }
#stage-wrapper.pixel-ui .relic-copy {
  display: grid;
  align-content: start;
  gap: .33em;
  padding: .4em .03em 0;
  border: 0;
  border-top: 1px solid #79664e;
  filter: none;
  color: var(--px-paper);
}
#stage-wrapper.pixel-ui .relic-copy strong {
  color: #ffdf9d;
  font-size: max(13px, 1.12em);
  overflow-wrap: anywhere;
  text-shadow: 0 1px var(--px-ink);
}
#stage-wrapper.pixel-ui .relic-copy > span {
  color: #f0e2c9;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: max(11px, .86em);
  min-height: 0;
}
#stage-wrapper.pixel-ui .relic-copy .relic-formula {
  border: 1px solid #92916d;
  border-radius: 0;
  background: #2f392b;
  color: #dbebaa;
}
#stage-wrapper.pixel-ui .relic-foot {
  position: relative;
  padding-top: .65em;
  border-top: 1px solid #8b6b4b;
  border-image: none;
}
#stage-wrapper.pixel-ui .owned-relic-chip {
  border-radius: 0;
  background: #212d25;
  box-shadow: inset 0 1px #485848, 0 2px #101813;
}
#stage-wrapper.pixel-ui .owned-relic-chip img { border-radius: 0; }
#stage-wrapper.pixel-ui .owned-relic-tooltip {
  border: 1px solid #ab9167;
  border-left: 3px solid var(--relic-ink, #cfac73);
  border-radius: 0;
  background: #1e2b23;
  box-shadow: inset 0 2px #53644e, inset 0 -2px #152018,
    0 3px 0 -1px #0c130e, 0 9px 20px #0a0f0dba;
}
#stage-wrapper.pixel-ui .owned-relic-tooltip::before {
  content: "";
  position: absolute;
  inset: 100% auto auto var(--tooltip-anchor, 50%);
  width: 16px;
  height: 8px;
  transform: translateX(-50%);
  background: #ab9167;
  clip-path: polygon(0 0, 16px 0, 16px 2px, 13px 2px, 13px 4px, 11px 4px,
    11px 6px, 9px 6px, 9px 8px, 7px 8px, 7px 6px, 5px 6px,
    5px 4px, 3px 4px, 3px 2px, 0 2px);
  pointer-events: none;
}
#stage-wrapper.pixel-ui .owned-relic-tooltip[data-below]::before {
  inset-block: auto 100%;
  transform: translateX(-50%) scaleY(-1);
}

@media (max-width: 700px) {
  #stage-wrapper.pixel-ui :is(.setup-screen, #screen-modes) {
    grid-template-rows: auto;
    align-content: start;
    gap: .8em;
    padding-block: 1em;
    overflow: auto;
  }
  .draft-head, .expedition-head { gap: .4em; }
  #stage-wrapper.pixel-ui .draft-daily { padding-inline: .4em; }
  .draft-main { grid-template-columns: minmax(0, 1fr); gap: .65em; }
  .draft-feature {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
    align-items: center;
    gap: .5em;
  }
  .draft-copy { grid-area: 1 / 1; max-height: none; width: auto; }
  .draft-copy h3 { white-space: normal; }
  .draft-portrait {
    grid-area: 1 / 2;
    position: static;
    width: 100%;
    height: auto;
    max-height: 15em;
    align-self: end;
  }
  #stage-wrapper.pixel-ui .draft-side {
    border-width: 5px;
    border-image-width: 5px;
    padding: .48em .56em;
  }
  .draft-seats { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 3.4em; }
  .draft-seat:only-child { grid-column: 1 / -1; }
  .roster-picker { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .45em; }
  .roster-pick { height: 5.5em; }
  .expedition-body { grid-template-columns: minmax(0, 1fr); }
  .expedition-menu { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .expedition-preview { min-height: 13em; }
  .draft-foot, .expedition-foot { flex-wrap: wrap; }
  .draft-foot .primary, .expedition-foot .primary { margin-left: auto; }

  #stage-wrapper.pixel-ui .title-footer .menu-keys { display: none; }
  #stage-wrapper.pixel-ui .relic-screen { padding-block: 1em; }
  #stage-wrapper.pixel-ui .relic-screen .relic-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #stage-wrapper.pixel-ui .relic-foot { flex-wrap: wrap; }
  #stage-wrapper.pixel-ui #relic-owned:not(:empty) { flex-basis: 100%; }
}

@media (prefers-reduced-motion: no-preference) {
  #stage-wrapper.pixel-ui .relic-pick {
    animation-timing-function: steps(6, end);
  }

  #stage-wrapper.pixel-ui .relic-pick[data-fusion] .relic-emblem {
    animation: pixel-fusion 1.15s steps(5, end) infinite alternate;
  }
}

@keyframes pixel-fusion {
  from { outline: 1px solid transparent; outline-offset: 1px; }
  to { outline: 1px solid #ffbc61; outline-offset: 4px; }
}
