:root {
  color-scheme: dark;
  --panel: #0e1013;
  --control: #171a1e;
  --ink: #e3e0d9;
  --muted: #a6a7a8;
  --line: #474a4e;
  --focus: #aac3cf;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
}

body {
  color: var(--ink);
  font: 0.875rem / 1.45 'Segoe UI', system-ui, sans-serif;
}

.viewer {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: #101a26;
}

.cemetery {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  visibility: hidden;
}

.cemetery[data-ready='true'] { visibility: visible; }

.stage {
  position: relative;
  container-type: inline-size;
  width: min(100vw, calc(100vh * 1280 / 850));
  width: min(100dvw, calc(100dvh * 1280 / 850));
  aspect-ratio: 1280 / 850;
}

.stage ruffle-player {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  filter: saturate(0.84) brightness(0.93);
}

.wordmark {
  --moon-glow: 0.88;
  position: absolute;
  top: 0;
  left: 50%;
  width: 28.90625%;
  aspect-ratio: 370 / 78;
  transform: translateX(-50%);
  pointer-events: none;
  user-select: none;
}

.wordmark::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: var(--moon-glow);
  background: radial-gradient(ellipse 31% 117% at 50% 44%,
    rgb(146 191 255 / 88%), rgb(83 144 218 / 72%) 36%, rgb(43 82 146 / 32%) 65%, transparent 100%);
}

.masthead-frame {
  position: absolute;
  top: 0;
  left: 18.75%;
  width: 62.5%;
  height: auto;
  filter: saturate(0.84) brightness(0.93);
  pointer-events: none;
  user-select: none;
}

.wordmark-moon, .wordmark-type {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.wordmark-moon {
  top: 3%;
  width: 17%;
  height: auto;
  opacity: 0.94;
  filter: saturate(0.79);
}

.wordmark-title {
  --lettering: url('/runtime-media/brand/revival-title.png');
  --shade-edge: rgb(3 8 16 / 20%);
  --shade-inner: rgb(3 8 16 / 62%);
  --shade-center: rgb(2 4 11 / 95%);
  top: 16.6%;
  width: 66.5%;
}

.wordmark-subtitle {
  --lettering: url('/runtime-media/brand/revival-subtitle.png');
  --lettering-tone: contrast(0.86) brightness(1.34);
  --shade-edge: rgb(3 8 16 / 17%);
  --shade-inner: rgb(3 8 16 / 68%);
  --shade-center: rgb(2 4 11 / 95%);
  bottom: 6%;
  width: 20%;
}

.wordmark-type img {
  display: block;
  width: 100%;
  height: auto;
  filter: var(--lettering-tone, none);
}

.wordmark-type::before, .wordmark-type::after {
  content: '';
  position: absolute;
  inset: 0;
}

.wordmark-type::before {
  z-index: 1;
  background: linear-gradient(90deg, transparent 6%, var(--shade-edge) 21%,
    var(--shade-inner) 36%, var(--shade-center) 46%, var(--shade-center) 54%, var(--shade-inner) 64%,
    var(--shade-edge) 79%, transparent 94%);
  mask: var(--lettering) center / 100% 100% no-repeat;
}

.wordmark-type::after {
  z-index: 2;
  background: var(--lettering) center / 100% 100% no-repeat;
  opacity: 0;
  filter: var(--lettering-tone, brightness(1)) brightness(1.16);
  mask-image: linear-gradient(102deg, transparent 39%, #000 48%, #000 52%, transparent 61%);
  mask-size: 250% 100%;
  mask-repeat: no-repeat;
  animation: moonlight 10s linear infinite;
}

@keyframes moonlight {
  0%, 30% { opacity: 0; mask-position: 100% 0; }
  35% { opacity: 1; mask-position: 83% 0; }
  51% { opacity: 1; mask-position: 17% 0; }
  56%, 100% { opacity: 0; mask-position: 0% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .wordmark-type::after { animation: none; }
}

.game-links {
  position: absolute;
  top: 9.35%;
  left: 50%;
  height: 2.7%;
  display: flex;
  transform: translateX(-50%);
  color: #b0c9e4;
}

.game-links > :not([hidden]) {
  display: grid;
  place-items: center;
  width: 8.75cqw;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: clamp(7px, 1cqw, 16px) 'Century Gothic', 'Segoe UI', sans-serif;
  text-decoration: none;
  text-shadow: 1px 1px #000;
  cursor: pointer;
}

.game-links > :hover { color: #f6fbff; }

#scene-cue {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.36;
  mask-size: 100% 100%;
  mask-composite: subtract;
  pointer-events: none;
  user-select: none;
}

#scene-cue[data-target^='faction-'] { opacity: 0.58; }

@media (prefers-reduced-motion: no-preference) {
  #scene-cue[data-target]:not([data-target^='faction-']) { animation: scene-cue-pulse 3.2s infinite; }
}

@keyframes scene-cue-pulse {
  from {
    opacity: 0;
    animation-timing-function: ease-out;
  }
  50% {
    opacity: 0.44;
    animation-timing-function: ease-in;
  }
  to { opacity: 0; }
}

#playable-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  color: #c4d4f0;
  font: clamp(8px, 1.05cqw, 17px) 'Century Gothic', 'Segoe UI', sans-serif;
}

[data-clan-dialog] #playable-layer { display: none; }

#navigation-lock-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.profile-activity {
  position: absolute;
  left: 55.5%;
  top: 81%;
  width: 29%;
  display: grid;
  gap: 0.25cqw;
  padding: 0.7cqw 0;
  text-shadow: 1px 1px #000;
  text-align: center;
  font-size: 1.4cqw;
}

.profile-activity strong { color: #f2f5fb; font-weight: 600; }

.cemetery-option, .highlight-option {
  position: absolute;
  left: 25%;
  top: 77.18%;
  display: flex;
  align-items: center;
  min-height: 3.125cqw;
  gap: 1.65cqw;
  color: #e4e0d6;
  font-size: 1.05cqw;
  pointer-events: auto;
  text-shadow: 1px 1px #000;
}

.cemetery-option-title { color: #b9cce0; }

.highlight-option { left: 67.2%; }

.cemetery-option label, .highlight-option {
  display: flex;
  align-items: center;
  gap: .55cqw;
  cursor: pointer;
}

.cemetery-option input, .highlight-option input {
  appearance: none;
  width: 2.45cqw;
  height: 2.45cqw;
  margin: 0;
  background: url('/runtime-media/gfx/interface/background-off.png') center / 100% 100%;
  cursor: pointer;
}

.cemetery-option input:checked, .highlight-option input:checked {
  background-image: url('/runtime-media/gfx/interface/background-on.png');
}

.profile-challenge-sword {
  position: absolute;
  /* The public portrait starts at stage (797, 180) and ends at x998. */
  left: 74.53125%;
  top: 21.65%;
  width: 3.125%;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
}

.profile-challenge-sword img { display: block; width: 100%; }
.profile-challenge-sword:hover img { content: url('/runtime-media/gfx/interface/hunt-challenge2.png'); }
.profile-challenge-sword:active img { content: url('/runtime-media/gfx/interface/hunt-challenge3.png'); }

.combat-gold, .combat-honor, .combat-travel-reward {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 0.15cqw;
  color: #b9d3ef;
  font-size: 1cqw;
  text-shadow: 1px 1px #000;
}

.combat-gold, .combat-honor { left: 45.7%; }
.combat-gold { top: 72.5%; gap: 0.35cqw; }
.combat-gold img { width: 1.2cqw; height: 1.2cqw; object-fit: contain; }
.combat-honor { top: 78%; }
.combat-travel-reward { right: 38.6%; bottom: 19%; }

.combat-travel-reward img {
  width: 2cqw;
  height: 2cqw;
  object-fit: contain;
}

.message-tabs, .message-scroll, .message-extension, .navigation-lock, .activity-action, .options-tutorial {
  position: absolute;
  pointer-events: auto;
}

.message-tabs, .message-scroll {
  top: 28%;
  height: 4.8%;
}

.message-tabs {
  left: 37%;
  width: 35.3%;
  display: grid;
  grid-template-columns: 1fr 1.15fr 1fr;
  align-items: stretch;
  background: transparent;
}

.message-tabs button {
  position: relative;
  border: 0;
  color: #aebbd1;
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.message-tabs button[aria-selected="true"] { color: #fff; }
.message-tabs button:hover { color: #e1f3ff; }

.message-scroll {
  width: 3.7%;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.message-scroll.previous { left: 32.7%; }
.message-scroll.next { left: 72.6%; }

.message-tab-badge {
  position: absolute;
  display: grid;
  place-items: center;
  top: 50%;
  transform: translateY(-132%);
  right: 0.12em;
  min-width: 1.55em;
  height: 1.55em;
  padding-inline: 0.26em;
  border: 1px solid #925c63;
  border-radius: 2em;
  background: radial-gradient(ellipse at 36% 19%, #c2333e, #871019 55%, #410911 100%);
  box-shadow: 0 1px 3px #000, inset 0 0 2px #3f040a;
  color: #fff5ef;
  font-size: 0.72em;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px #4b0910;
}

.message-extension {
  top: 33.35%;
  left: 31.6%;
  width: 45.6%;
  height: 47%;
  display: flex;
  flex-direction: column;
  padding: 0.7%;
  border: 1px solid #303b48;
  background: #070c14;
}

.message-extension-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  scrollbar-gutter: stable;
}

.message-extension-list::-webkit-scrollbar {
  width: clamp(8px, 1.05cqw, 15px);
}

.message-extension-list::-webkit-scrollbar-track {
  border: 1px solid #293541;
  border-radius: 5px;
  background: linear-gradient(90deg, #04070b, #151d28 55%, #080d15);
  box-shadow: inset 0 1px 4px #000;
}

.message-extension-list::-webkit-scrollbar-thumb {
  min-height: 18px;
  border: 1px solid #111822;
  border-radius: 5px;
  background: linear-gradient(90deg, #2d3c50, #586b81 42%, #354459);
  box-shadow: inset 0 0 0 1px #7c8d9f;
}

.message-extension-list::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(90deg, #394b60, #6d859f 42%, #42566c);
}

@supports not selector(::-webkit-scrollbar) {
  .message-extension-list { scrollbar-color: #586b81 #151d28; }
}

.message-extension-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(4em, 19%) minmax(4.3em, 18%);
  align-items: center;
  gap: 2%;
  min-height: 9%;
  padding: 1% 2% 1% 3.4%;
  border-bottom: 1px solid #26313c;
}

.message-extension-row > :first-child {
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.message-extension-row.is-unread { background: rgb(89 107 133 / 15%); }

.inbox-row, .inbox-columns {
  display: grid;
  grid-template-columns: minmax(0, 28%) minmax(0, 1fr) minmax(9.25em, 23%);
  gap: 2%;
  padding: 1% 2% 1% 3.4%;
}

.inbox-columns {
  border-bottom: 1px solid #303b48;
  color: #aebbd1;
}

.inbox-row {
  width: 100%;
  border: 0;
  border-bottom: 1px solid #26313c;
  background: transparent;
  color: inherit;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.inbox-row > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-row.is-unopened { background: rgb(100 127 159 / 26%); }
.inbox-row[aria-pressed="true"] { box-shadow: inset 0 0 0 1px #576d88; }
.inbox-actions { display: flex; justify-content: space-between; gap: 2%; padding: 1% 2% 0; }
.inbox-actions .game-button { min-width: 23%; }
.mail-write { display: inline-flex; align-items: center; justify-content: center; gap: 0.4em; }
.mail-write img { display: block; width: 1.55em; height: auto; }

.message-extension h3 {
  margin: 0.4em 0 0.2em 0.55em;
  color: #d8e5f8;
  font-size: 1em;
  font-weight: 500;
}

.message-extension[data-view="Battle Reports"] .message-extension-row {
  grid-template-columns: minmax(0, 1fr) max-content minmax(4.3em, 18%);
}

.message-extension-row time { font-variant-numeric: tabular-nums; }

.message-extension[data-view="Friends"] .message-extension-row {
  grid-template-columns: minmax(0, 1fr) minmax(3.4em, 17%) minmax(8.3em, 29%);
}

.message-row-actions { display: flex; justify-content: flex-end; gap: 0.35em; }
.message-row-actions button { min-width: 4.1em; padding-inline: 0.35em; }
.message-report-summary { margin: 0.5em; white-space: pre-wrap; }
.message-report-back { align-self: flex-end; min-width: 7em; }

.message-extension .victory { color: #9bc7b5; }
.message-extension .defeat { color: #e5a0a0; }

.friend-name {
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.message-extension form { display: flex; gap: 2%; padding: 1%; }

.message-extension input, .account-form input {
  min-width: 0;
  flex: 1;
  border: 1px solid #475765;
  padding: 0.4em 0.6em;
  color: #f0f5ff;
  background: #0c141e;
  font: inherit;
}

.game-button {
  border: 0;
  min-height: 2.35em;
  padding: 0.3em 0.7em;
  color: #e4edf5;
  background: #152333 url('/runtime-media/gfx/interface/revival_action.png') center / 100% 100% no-repeat;
  font: inherit;
  text-shadow: 1px 1px #000;
  cursor: pointer;
}

.game-button:hover { filter: brightness(1.2); }
.game-button:disabled { cursor: wait; opacity: 0.65; }

.city-marker {
  position: absolute;
  width: 15.625%;
  height: 18%;
}

.city-marker::before {
  content: '';
  position: absolute;
  top: 6.55%;
  left: 16.5%;
  width: 67%;
  aspect-ratio: 1;
  border-radius: 50%;
  box-shadow: 0 0 0.65cqw rgb(143 191 230 / 72%), inset 0 0 0.34cqw rgb(143 191 230 / 38%);
  clip-path: inset(-14% -14% 17%);
  opacity: 0;
  pointer-events: none;
}

.stage[data-interaction-highlights] .city-marker:has(button.city-ribbon:hover, .city-ribbon:focus-visible, .city-story-hover)::before {
  opacity: 1;
}

@media (prefers-reduced-motion: no-preference) {
  .city-marker::before { transition: opacity 140ms ease-out; }
}

.city-ribbon {
  position: absolute;
  inset: 1% 13% 3%;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
}
.city-story-pin { pointer-events: none; }
.city-owner {
  position: absolute;
  top: 4%;
  left: 7%;
  width: 23%;
  pointer-events: none;
}

.honor-hall {
  position: absolute;
  left: 22.5%;
  top: 17.176%;
  width: 62.5%;
  height: 72.471%;
  isolation: isolate;
  pointer-events: auto;
  color: #dce3ee;
  text-shadow: 1px 1px #000;
  font-size: 1.05cqw;
}
.honor-hall::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 0;
  background: #070b11 var(--hall-art) center / 100% 100% no-repeat;
}
.honor-hall::after {
  content: '';
  position: absolute;
  z-index: -2;
  inset: auto 0 100%;
  height: 4.708%;
  background: url('/runtime-media/gfx/background/hall-top-rail.png') center / 100% 100% no-repeat;
}
.honor-hall h2 {
  position: absolute;
  inset: 10.4% 0 auto;
  margin: 0;
  text-align: center;
  font-size: 1.5em;
  font-weight: normal;
}
.honor-hall-back, .honor-hall-right, .honor-hall-center {
  position: absolute;
  top: 16.7%;
  height: 6.1%;
  width: 17.6%;
}
.honor-hall-back { left: 18.6%; }
.honor-hall-right { right: 18.6%; }
span.honor-hall-right { display: grid; place-items: center; cursor: default; }
.honor-hall-center { left: 41.2%; display: grid; place-items: center; text-align: center; }
select.honor-hall-center {
  font: inherit;
  padding: 0 0.5em;
  color: inherit;
  background: #070c13 url('/runtime-media/gfx/interface/inputfield_off.png') center / 100% 100% no-repeat;
  border: 0;
}
.honor-hall-table { position: absolute; inset: 23.7% 18.125% auto 18.5%; }
.honor-hall-row {
  height: 1.875cqw;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--honor-columns);
  align-items: center;
  text-align: left;
}
.honor-hall-row:first-child { height: 2.421875cqw; color: #f3ede8; }
.honor-hall-row > span { min-width: 0; padding-left: 0.39cqw; }
.honor-hall-row > :nth-child(4) { padding-left: 0; text-align: center; }
.honor-hall-row img { display: block; height: 1.72cqw; width: auto; margin: auto; }
.honor-hall-row button {
  display: block;
  max-width: 100%;
  padding: 0;
  font: inherit;
  color: #a5c9e3;
  text-shadow: inherit;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: none;
  border: 0;
  cursor: pointer;
}
.honor-hall-row button:hover { color: #f4fbff; }
.honor-hall-empty { position: absolute; top: 43%; inset-inline: 18%; text-align: center; }
.honor-hall-search {
  position: absolute;
  left: 27.625%;
  top: 68.34%;
  height: 6%;
  width: 43.1%;
  display: grid;
  grid-template-columns: 57% 1fr;
  gap: 0.55em;
}
.honor-hall-search input {
  padding: 0.2em 0.65em;
  background: transparent;
  color: inherit;
  border: 0;
  min-width: 0;
  font: inherit;
}
.honor-hall-note { position: absolute; bottom: 19.5%; inset-inline: 18%; text-align: center; color: #ffb5a7; }
.honor-hall-arrow {
  position: absolute;
  top: 68.34%;
  width: 6%;
  height: 6.1%;
  padding: 0;
  background: transparent;
  border: 0;
  cursor: pointer;
}
.honor-hall-arrow img { width: 100%; height: 100%; object-fit: contain; }
.honor-hall-arrow.prev img { transform: translateX(-8%) scale(1.6); }
.honor-hall-arrow.next img { transform: translateX(8%) scale(1.6); }
.honor-hall-arrow:disabled { opacity: 0.64; cursor: default; }
.honor-hall-arrow.prev { left: 18%; }
.honor-hall-arrow.next { right: 18%; }

.clan-headquarters, .clan-territory {
  position: absolute;
  left: 42.83%;
  width: 22%;
  height: 2.85%;
  display: grid;
  place-items: center;
  padding: 0;
  color: #e1eaf5;
  text-shadow: 1px 1px #000;
  background: url('/runtime-media/gfx/interface/exp_barblack.jpg') center / 100% 100% no-repeat;
}
.clan-headquarters { top: 26.15%; border: 0; font: inherit; pointer-events: auto; cursor: pointer; }
.clan-city-rank { position: absolute; left: 26.4%; top: 23.4%; text-shadow: 1px 1px #000; }
.clan-territory { top: 57.55%; isolation: isolate; }
.clan-territory::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 13% auto 13% 1%;
  width: var(--control-fill);
  background: url('/runtime-media/gfx/interface/exp_bar.jpg') center / 100% 100% no-repeat;
}

.bloodstone-calendar {
  position: absolute;
  top: 21.4%;
  left: 47.03%;
  width: 32.5%;
  height: 68%;
  pointer-events: auto;
  color: #e4ebf5;
  text-shadow: 1px 1px #000;
  font-size: 1.05cqw;
  text-align: center;
}
.bloodstone-crest {
  position: absolute;
  width: 47.2%;
  left: 50%;
  bottom: 93%;
  transform: translateX(-50%);
  pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
  .bloodstone-crest-enter { animation: bloodstone-arrival 520ms cubic-bezier(.22, .64, .32, 1) both; }
}

@keyframes bloodstone-arrival {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.7); }
  to { opacity: 1; transform: translateX(-50%); }
}
.bloodstone-calendar h2 {
  margin: 0.7em 0 0;
  font-size: 1.55em;
  font-weight: normal;
}
.bloodstone-wheel {
  position: absolute;
  top: 12.15%;
  left: 0;
  width: 100%;
  aspect-ratio: 416 / 414;
  list-style: none;
  margin: 0;
  padding: 0;
  background: url('/runtime-media/gfx/interface/bloodstone-wheel-hd.png') center / 100% 100% no-repeat;
}
.bloodstone-wheel li {
  position: absolute;
  width: 18%;
  height: 14.1%;
  transform: translate(-50%, -50%);
  display: grid;
  align-content: center;
  gap: 0.04em;
  font-size: 0.91em;
  background: url('/runtime-media/gfx/interface/calendar-slot.png') center / 100% 100% no-repeat,
    url('/runtime-media/gfx/interface/calendar-well.png') center / 97% 95% no-repeat;
  color: #bfcbd8;
}
.bloodstone-wheel strong { color: #e1e9f1; font-size: 1.15em; font-weight: normal; }
.bloodstone-wheel li:last-child strong { color: #ffd1c7; }
.bloodstone-wheel .bloodstone-date { color: #e1e9f1; }
.bloodstone-wheel li[aria-current] {
  color: #fff;
  box-shadow: inset 0 0 0.5em #4a819c;
}
.bloodstone-wheel li:not([aria-current]) { opacity: 0.9; }
.bloodstone-calendar .bloodstone-reset {
  position: absolute;
  inset: auto 0 4.2%;
  margin: 0;
  font-size: 0.94em;
}
.bloodstone-claim {
  position: absolute;
  width: 53%;
  left: 23.5%;
  top: 86%;
}
.bloodstone-claim:disabled { cursor: default; }
.bloodstone-spree {
  position: absolute;
  left: 24%;
  bottom: 11.3%;
  width: 12.5%;
  min-height: 4.3%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35em;
  pointer-events: auto;
}
.bloodstone-spree img { width: 1.35em; height: 1.35em; object-fit: contain; }
.bloodstone-spree strong { color: #ffd1c7; font-weight: normal; }

.activity-action {
  left: 71%;
  bottom: 10.9%;
  width: 16%;
  min-height: 4%;
}

.activity-cost {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 0.35em;
  left: 36.1%;
  bottom: 9.8%;
  width: 11.4%;
}
.activity-cost img { width: 1.15em; height: 1.15em; object-fit: contain; }

.activity-status {
  position: absolute;
  left: 26%;
  right: 14%;
  bottom: 15.5%;
  text-align: center;
  color: #fab7a9;
  text-shadow: 1px 1px #000;
}

.action-status { margin: 0.35em 0; color: #fab7a9; }
.friend-notice { margin: 0.35em 0; color: #a9cfb7; }

.navigation-lock {
  left: 7.8125%;
  width: 12.5%;
  height: 4.15%;
  background: transparent;
  border: 0;
  border-radius: 45%;
  cursor: help;
}

.story-progress {
  position: absolute;
  left: 24%;
  right: 14%;
  top: 86%;
  margin: 0;
  color: #d5c1aa;
  font-size: 1.22cqw;
  text-align: center;
  text-shadow: 0 1px 2px #000, 0 0 5px #000;
}

.options-tutorial { left: 48%; top: 84.4%; width: 11.2%; }
.tutorial-action { position: absolute; pointer-events: auto; left: 46%; top: 83%; width: 16%; }

.tutorial-target {
  position: absolute;
  border: 1px solid #d0b68c;
  border-radius: 0.25em;
  box-shadow: 0 0 0.45em #ba9362;
}

.control-panel .tutorial-ready { color: #f5d2a0; }

@media (prefers-reduced-motion: no-preference) {
  .tutorial-target, .tutorial-ready { animation: tutorial-pulse 2s ease-in-out infinite alternate; }
  @keyframes tutorial-pulse { from { opacity: 0.48; } to { opacity: 1; } }
}

.game-dialog, .account-panel {
  max-width: min(33rem, 89vw);
  border: 1px solid #5d6978;
  padding: 2rem;
  color: var(--ink);
  background: #0a111a;
  box-shadow: 0 0 1.5rem #000;
}

.game-dialog::backdrop { background: rgb(0 0 0 / 58%); }
.game-dialog form { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.game-dialog form button { padding: 0.5rem; }

.challenge-dialog {
  width: min(22rem, calc(100% - 1.5rem));
  max-width: none;
  padding: 1.55rem 0 0;
  border: 0;
  color: #e4edf5;
  background: transparent;
  font: 0.85rem / 1.4 'Century Gothic', 'Segoe UI', sans-serif;
  text-align: center;
}

.challenge-dialog::backdrop { background: rgb(2 5 9 / 56%); }

.challenge-panel {
  position: relative;
  isolation: isolate;
  display: grid;
  gap: 0.38rem;
  padding: 1.9rem 1.5rem 1rem;
  text-shadow: 1px 1px #000;
}

.challenge-panel::before,
.challenge-panel::after {
  content: '';
  position: absolute;
  pointer-events: none;
}

.challenge-panel::before {
  inset: 3px 4px;
  z-index: -2;
  border-radius: 0.65rem;
  background: linear-gradient(#101a28, #080d15 70%);
  box-shadow: 0 0.5rem 1.5rem #000b;
}

.challenge-panel::after {
  inset: 0;
  z-index: -1;
  border: 1.1rem solid transparent;
  border-image: url('/runtime-media/gfx/interface/hunt-confirmation-rim.png') 36 stretch;
}

.challenge-crest {
  position: absolute;
  left: 50%;
  top: 0;
  width: min(83%, 18rem);
  height: auto;
  transform: translateX(-50%);
  pointer-events: none;
  user-select: none;
}

.challenge-panel h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.challenge-panel p { margin: 0; color: #c3d2e4; }
.challenge-panel form { display: flex; justify-content: center; gap: 0.5rem; margin-top: 0.35rem; }
.challenge-panel .game-button { min-width: 5.25rem; }

#forum-link-code-field:not([hidden]) { display: grid; gap: 0.3rem; margin-top: 0.45rem; }
#forum-link-code {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #4c6077;
  border-radius: 0.25rem;
  background: #0a101b;
  color: #e4edf5;
  font: 0.78rem ui-monospace, monospace;
  text-align: center;
}

.account-view { display: grid; place-items: center; min-height: 100dvh; overflow: auto; }
.account-panel { width: min(33rem, 89vw); }
.account-form { display: grid; gap: 0.9rem; }
.account-form label { display: grid; gap: 0.35rem; }
.account-panel a { color: #bdd8ef; }

.player-controls {
  position: absolute;
  z-index: 1;
  top: max(0.5rem, env(safe-area-inset-top));
  right: max(0.5rem, env(safe-area-inset-right));
}

.player-controls summary {
  display: grid;
  place-items: center;
  width: 2.75rem;
  min-height: 2.75rem;
  margin-left: auto;
  border: 1px solid transparent;
  border-radius: 0.375rem;
  background: rgb(0 0 0 / 66%);
  opacity: 0.65;
  cursor: pointer;
  list-style: none;
  font-size: 1.25rem;
}

.player-controls summary::-webkit-details-marker { display: none; }

.player-controls summary:hover,
.player-controls summary:focus-visible,
.player-controls[open] summary {
  border-color: var(--line);
  opacity: 1;
}

.control-panel {
  display: grid;
  gap: 0.5rem;
  width: min(17rem, calc(100vw - 1rem));
  margin-top: 0.375rem;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.375rem;
  background: var(--panel);
}

.control-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.control-panel button, .control-panel a,
#reference button, #reference select {
  min-height: 2.5rem;
  border: 1px solid var(--line);
  border-radius: 0.25rem;
  background: var(--control);
  color: var(--ink);
  font: inherit;
  padding: 0.375rem 0.625rem;
}

.control-panel button, #reference button { cursor: pointer; }
.control-panel a { display: inline-flex; align-items: center; text-decoration: none; }
.control-panel :disabled { cursor: wait; opacity: 0.55; }
.control-panel button:hover:enabled { border-color: var(--focus); }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.preview-note {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.8125rem;
}

#reference {
  width: min(52rem, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--panel);
  color: var(--ink);
  padding: 1rem;
}

#reference::backdrop { background: rgb(0 0 0 / 72%); }

.reference-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.reference-header h1 { margin: 0; font-size: 1.125rem; }
.reference-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
#reference figure { margin: 0.75rem 0 0; }
#reference img {
  display: block;
  width: 100%;
  height: auto;
  max-height: calc(100dvh - 11rem);
  object-fit: contain;
}
#reference figcaption { margin-top: 0.5rem; color: var(--muted); }

.status {
  position: absolute;
  inset: auto 1rem max(1rem, env(safe-area-inset-bottom));
  width: fit-content;
  margin: 0 auto;
  padding: 0.5rem 0.75rem;
  border-radius: 0.25rem;
  background: var(--panel);
  text-align: center;
  pointer-events: none;
}

.visually-hidden, .status[data-state='ready'] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}
