@font-face {
  font-family: "Manrope";
  src: url("/static/miniapp/assets/fonts/manrope-cyrillic-latin-variable.woff2") format("woff2-variations");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Kelly Slab";
  src: url("/static/miniapp/assets/fonts/kelly-slab-cyrillic-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Onest";
  src: url("/static/miniapp/assets/fonts/onest.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Yeseva One";
  src: url("/static/miniapp/assets/fonts/yeseva-one-cyrillic.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Noto Serif SC";
  src: url("/static/miniapp/assets/fonts/noto-serif-sc-project-subset.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+4EE4, U+52DD, U+5370, U+6210, U+6C23, U+7981, U+9053, U+9F8D, U+7384, U+5E7B, U+571F, U+6A5F;
}

:root {
  color-scheme: dark;
  --china-ink-950: #11110f;
  --china-ink-900: #191814;
  --china-paper-50: #f8f3e7;
  --china-vermilion-500: #c83b2d;
  --china-jade-500: #337e68;
  --china-gold-300: #e2bd6d;
  --china-gold-400: #c89c4a;
  --china-night-950: #0a0c12;
  --font-ui: "Onest", "Manrope", "Segoe UI", sans-serif;
  --font-display: "Yeseva One", "Kelly Slab", "Onest", sans-serif;
  --font-brush: "Yeseva One", "Kelly Slab", "Onest", sans-serif;
  --font-han: "Noto Serif SC", serif;
  --ink: #090a0d;
  --ink-soft: #0e1014;
  --surface: #141519;
  --surface-raised: #1a1c21;
  --surface-bright: #22252c;
  --line: rgba(233, 216, 172, 0.22);
  --line-strong: rgba(241, 199, 91, 0.56);
  --ivory: #f7f2e8;
  --muted: #abb0bc;
  --muted-dark: #737986;
  --gold: #f1c75b;
  --gold-light: #ffe5a0;
  --gold-deep: #9f6d1c;
  --red: #ff615f;
  --blue: #55b9ff;
  --green: #6bd49b;
  --purple: #c57cff;
  --safe-top: max(env(safe-area-inset-top, 0px), var(--tg-content-safe-area-inset-top, 0px));
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-content-safe-area-inset-bottom, 0px));
  font-family: var(--font-ui);
  font-synthesis: none;
  letter-spacing: 0;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  min-height: 100%;
  background: #000;
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  background:
    linear-gradient(180deg, rgba(241, 199, 91, 0.06), transparent 220px),
    #050608;
  color: var(--ivory);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.45;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

button,
input,
dialog {
  font: inherit;
  letter-spacing: 0;
}

button {
  border: 0;
  margin: 0;
  padding: 0;
  color: inherit;
  background: none;
  cursor: pointer;
}

button:disabled {
  cursor: default;
}

img {
  display: block;
  max-width: 100%;
}

h1,
h2,
h3,
p,
dl,
dd,
ol {
  margin: 0;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
}

.hidden {
  display: none !important;
}

.app-shell {
  position: relative;
  width: 100%;
  max-width: 580px;
  min-height: 100vh;
  margin: 0 auto;
  overflow: clip;
  background: var(--ink);
  border-inline: 1px solid rgba(255, 255, 255, 0.04);
  isolation: isolate;
}

.app-header {
  position: sticky;
  z-index: 60;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: calc(72px + var(--safe-top));
  padding: calc(10px + var(--safe-top)) 16px 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 10, 13, 0.94);
  backdrop-filter: blur(22px) saturate(150%);
}

.brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  text-align: left;
}

.brand > img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  filter: drop-shadow(0 0 12px rgba(241, 199, 91, 0.35));
}

.brand span,
.record-button span {
  display: grid;
  min-width: 0;
}

.brand b {
  overflow: hidden;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand small,
.record-button small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.header-actions {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
}

.record-button {
  display: flex;
  height: 46px;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.035);
  text-align: left;
}

.record-button > img,
.icon-button > img {
  width: 22px;
  height: 22px;
  filter: invert(88%) sepia(54%) saturate(714%) hue-rotate(346deg) brightness(104%);
}

.record-button b {
  color: var(--gold);
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
}

.icon-button {
  display: grid;
  width: 46px;
  height: 46px;
  flex: none;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.icon-button:active {
  transform: scale(0.96);
  background: rgba(255, 255, 255, 0.09);
}

.screen {
  display: none;
  min-height: calc(100vh - 72px);
  padding-bottom: calc(104px + var(--safe-bottom));
  animation: screen-in 280ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.screen.active {
  display: block;
}

.app-shell[data-current-screen="setup"] .bottom-nav,
.app-shell[data-current-screen="game"] .bottom-nav,
.app-shell[data-current-screen="result"] .bottom-nav {
  display: none;
}

.app-shell[data-current-screen="setup"] .screen,
.app-shell[data-current-screen="game"] .screen,
.app-shell[data-current-screen="result"] .screen {
  padding-bottom: calc(24px + var(--safe-bottom));
}

.eyebrow {
  display: block;
  color: var(--gold);
  font-family: var(--font-brush);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.05;
  text-transform: none;
}

.home-hero {
  position: relative;
  height: 408px;
  overflow: hidden;
  border-bottom: 1px solid var(--line-strong);
  background: #0b0c10;
}

.home-hero > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 34%;
  animation: hero-breathe 16s ease-in-out infinite alternate;
}

.home-hero::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(180deg, transparent 22%, rgba(9, 10, 13, 0.14) 48%, rgba(9, 10, 13, 0.97) 100%);
}

.home-hero-copy {
  position: absolute;
  z-index: 1;
  right: 20px;
  bottom: 24px;
  left: 20px;
  text-shadow: 0 2px 24px #000;
}

.home-hero-copy h1,
.ladder-hero h1,
.achievements-hero h1,
.result-copy h1 {
  max-width: 500px;
  margin-top: 5px;
  font-size: 43px;
  font-weight: 820;
  line-height: 0.98;
  letter-spacing: 0;
}

.home-hero-copy p {
  max-width: 390px;
  margin-top: 12px;
  color: rgba(247, 242, 232, 0.82);
  font-size: 15px;
}

.celestial-arrival {
  padding: 14px 16px 16px;
  border-bottom: 1px solid var(--line);
  background: #111318;
}

.celestial-arrival-heading,
.home-master-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.celestial-arrival-heading h2,
.home-master-heading h2 {
  margin-top: 2px;
  color: var(--ivory);
  font-size: 19px;
  line-height: 1.15;
}

.celestial-arrival-heading > i {
  display: grid;
  width: 38px;
  height: 38px;
  flex: none;
  place-items: center;
  border: 1px solid #b43c2f;
  color: #d85a49;
  font-family: var(--font-han);
  font-size: 25px;
  font-style: normal;
  transform: rotate(-3deg);
}

.home-special-spheres {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.home-special-card {
  display: grid;
  min-width: 0;
  justify-items: center;
  gap: 7px;
  padding: 4px 2px 7px;
  text-align: center;
}

.home-special-card > img {
  width: 70px;
  max-width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  filter: drop-shadow(0 7px 12px rgba(0, 0, 0, 0.42));
  animation: sphere-float 4.6s ease-in-out infinite;
}

.home-special-card:nth-child(2) > img { animation-delay: -1.1s; }
.home-special-card:nth-child(3) > img { animation-delay: -2.2s; }
.home-special-card:nth-child(4) > img { animation-delay: -3.3s; }

.home-special-card > span {
  display: grid;
  min-width: 0;
}

.home-special-card b,
.home-special-card small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-special-card b {
  color: var(--china-paper-50, var(--ivory));
  font-size: 11px;
  font-weight: 760;
  line-height: 1.15;
}

.home-special-card small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 9px;
}

.home-master-hall {
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: var(--ink-soft);
}

.home-master-heading {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.home-master-heading > img {
  width: 20px;
  height: 20px;
  opacity: 0.58;
  transform: rotate(180deg);
}

.home-master-roster {
  display: grid;
  grid-auto-columns: minmax(108px, 30%);
  grid-auto-flow: column;
  gap: 8px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  padding-bottom: 2px;
  scroll-snap-type: inline mandatory;
  scrollbar-width: none;
}

.home-master-roster::-webkit-scrollbar { display: none; }

.home-master-token {
  position: relative;
  min-width: 0;
  aspect-ratio: 0.78;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #0b0d11;
  scroll-snap-align: start;
  text-align: left;
}

.home-master-token > img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center top;
}

.home-master-token::after {
  position: absolute;
  inset: 38% 0 0;
  content: "";
  background: linear-gradient(180deg, transparent, rgba(4, 5, 8, 0.96));
}

.home-master-token > span {
  position: absolute;
  z-index: 1;
  right: 8px;
  bottom: 8px;
  left: 8px;
  display: grid;
  min-width: 0;
  color: var(--ivory);
}

.home-master-token small {
  color: var(--gold-light);
  font-size: 9px;
  text-transform: uppercase;
}

.home-master-token b {
  margin-top: 2px;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.05;
}

.home-master-token.locked > img {
  filter: grayscale(1) brightness(0.38);
}

.home-master-token > i {
  position: absolute;
  z-index: 2;
  top: 8px;
  right: 8px;
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 50%;
  background: rgba(5, 6, 8, 0.76);
}

.home-master-token > i img {
  width: 14px;
  height: 14px;
  filter: invert(1);
}

.home-master-token:active:not(.locked) {
  transform: scale(0.98);
}

.command-band,
.result-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: var(--ink-soft);
}

.command {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 70px;
  align-items: center;
  gap: 13px;
  overflow: hidden;
  padding: 13px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  text-align: left;
  transition: transform 150ms ease, filter 150ms ease, border-color 150ms ease;
}

.command::after {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 1px;
  content: "";
  background: rgba(255, 255, 255, 0.48);
  opacity: 0.45;
}

.command:active:not(:disabled) {
  transform: translateY(2px) scale(0.992);
  filter: brightness(0.94);
}

.command:disabled {
  border-color: rgba(255, 255, 255, 0.08);
  background: #24262d;
  color: #767b86;
}

.command > img {
  width: 28px;
  height: 28px;
  flex: none;
}

.command > span {
  display: grid;
  min-width: 0;
}

.command b {
  overflow-wrap: anywhere;
  font-size: 16px;
  font-weight: 780;
  line-height: 1.2;
}

.command small {
  margin-top: 3px;
  color: inherit;
  font-size: 11px;
  line-height: 1.25;
  opacity: 0.7;
}

.command.primary {
  border-color: #f8d57e;
  background: linear-gradient(135deg, var(--gold-light), #d99d30);
  color: #171108;
  box-shadow: 0 10px 28px rgba(168, 112, 23, 0.2), inset 0 -2px 0 rgba(103, 62, 8, 0.25);
}

.command.primary:disabled {
  border-color: rgba(255, 255, 255, 0.1);
  background: #252830;
  color: #747a86;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.24);
}

.command.secondary {
  background: linear-gradient(145deg, #1d2027, #111318);
  color: var(--ivory);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.34);
}

.command.secondary > img,
.command.tutorial > img,
.command.resume > img {
  filter: invert(89%) sepia(36%) saturate(997%) hue-rotate(346deg) brightness(104%);
}

.command.tutorial,
.command.resume {
  grid-column: 1 / -1;
  min-height: 64px;
  border-color: rgba(85, 185, 255, 0.38);
  background: linear-gradient(135deg, rgba(85, 185, 255, 0.14), rgba(197, 124, 255, 0.08));
}

.command.resume {
  border-color: rgba(107, 212, 155, 0.48);
  background: rgba(107, 212, 155, 0.09);
}

.stat-ribbon,
.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  border-bottom: 1px solid var(--line);
  background: #0b0c0f;
}

.stat-ribbon > div,
.profile-stats > div {
  padding: 18px 8px;
  text-align: center;
}

.stat-ribbon > div + div,
.profile-stats > div + div {
  border-left: 1px solid var(--line);
}

.stat-ribbon dt,
.profile-stats dt {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.stat-ribbon dd,
.profile-stats dd {
  margin-top: 4px;
  color: var(--ivory);
  font-size: 25px;
  font-weight: 680;
}

.latest-result {
  display: grid;
  width: calc(100% - 32px);
  min-height: 72px;
  grid-template-columns: 1fr auto 22px;
  align-items: center;
  gap: 12px;
  margin: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  text-align: left;
}

.latest-result span {
  display: grid;
  min-width: 0;
}

.latest-result small {
  color: var(--muted);
  font-size: 11px;
}

.latest-result b {
  overflow: hidden;
  margin-top: 3px;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.latest-result strong {
  color: var(--gold);
  font-size: 24px;
}

.latest-result > img {
  width: 20px;
  transform: rotate(180deg);
  filter: invert(1);
}

.screen-heading {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: center;
  gap: 13px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--ink-soft);
}

.screen-heading h1 {
  margin-top: 3px;
  font-size: 24px;
  font-weight: 790;
  line-height: 1.08;
}

.mode-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin: 14px 16px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0d0f13;
}

.mode-tabs button {
  display: flex;
  min-width: 0;
  height: 48px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 680;
}

.mode-tabs button img {
  width: 18px;
  height: 18px;
  filter: invert(70%);
}

.mode-tabs button.active {
  background: var(--gold);
  color: #141007;
  box-shadow: inset 0 -2px 0 rgba(105, 66, 10, 0.28);
}

.mode-tabs button.active img {
  filter: none;
}

.opponent-brief {
  position: relative;
  display: grid;
  min-height: 138px;
  grid-template-columns: 120px minmax(0, 1fr);
  overflow: hidden;
  margin: 0 16px 16px;
  border: 1px solid rgba(255, 97, 95, 0.5);
  border-radius: 7px;
  background: #200e13;
}

.opponent-brief > img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  background: #090b0f;
}

.opponent-brief > div {
  align-self: center;
  padding: 14px;
}

.opponent-brief span {
  color: var(--red);
  font-size: 10px;
  font-weight: 730;
  text-transform: uppercase;
}

.opponent-brief h2 {
  margin-top: 3px;
  font-size: 17px;
  line-height: 1.18;
}

.opponent-brief p {
  margin-top: 7px;
  color: #ffc3bc;
  font-size: 12px;
}

.selection-intro,
.ladder-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 16px 14px;
}

.selection-intro h2,
.ladder-heading h2 {
  margin-top: 4px;
  font-size: 18px;
  font-weight: 720;
  line-height: 1.25;
}

.selection-intro > img {
  width: 24px;
  margin-top: 7px;
  filter: invert(89%) sepia(34%) saturate(1153%) hue-rotate(344deg);
}

.master-list {
  display: grid;
  gap: 10px;
  padding: 0 16px 18px;
}

.master-card {
  position: relative;
  display: grid;
  min-height: 210px;
  grid-template-columns: minmax(142px, 44%) minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  text-align: left;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.master-card:active:not(.locked) {
  transform: scale(0.99);
}

.master-card.selected {
  border-color: var(--gold);
  background: linear-gradient(110deg, rgba(241, 199, 91, 0.12), var(--surface) 52%);
  box-shadow: 0 0 0 1px rgba(241, 199, 91, 0.18), 0 14px 36px rgba(0, 0, 0, 0.24);
}

.master-card.locked {
  border-color: rgba(255, 255, 255, 0.08);
  background: #101115;
  color: #858a94;
}

.master-portrait {
  position: relative;
  min-height: 210px;
  overflow: hidden;
  background: #0c0d10;
}

.master-portrait::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(90deg, transparent 66%, var(--surface));
}

.master-portrait > img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center top;
}

.master-card.locked .master-portrait > img {
  filter: grayscale(1) brightness(0.48);
}

.master-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  padding: 16px 16px 16px 10px;
}

.master-copy > small {
  color: var(--gold);
  font-size: 10px;
  font-weight: 760;
  text-transform: uppercase;
}

.master-copy > b {
  margin-top: 2px;
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 400;
  line-height: 1.1;
}

.master-copy > em {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.ability-line {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.ability-line > img {
  width: 38px;
  height: 38px;
  object-fit: cover;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
}

.ability-line > span {
  color: var(--muted);
  color: #d6d1c6;
  font-size: 11px;
  line-height: 1.3;
}

.ability-line strong {
  display: block;
  color: var(--ivory);
  font-size: 10px;
}

.unlock-line {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 9px;
  color: #8e939e;
  font-size: 10px;
}

.unlock-line img {
  width: 14px;
  filter: invert(60%);
}

.selected-mark {
  position: absolute;
  top: 9px;
  right: 9px;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  background: var(--gold);
}

.selected-mark img {
  width: 15px;
}

.setup-actionbar,
.game-actionbar,
.ladder-actionbar {
  position: sticky;
  z-index: 45;
  bottom: 0;
  padding: 10px 16px calc(10px + var(--safe-bottom));
  border-top: 1px solid var(--line-strong);
  background: rgba(9, 10, 13, 0.96);
  backdrop-filter: blur(20px);
}

.selected-summary {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 3px 10px;
}

.selected-summary > img {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 50%;
}

.selected-summary span {
  display: grid;
}

.selected-summary small {
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
}

.selected-summary b {
  font-size: 13px;
}

.setup-actionbar .command,
.game-actionbar .command,
.ladder-actionbar .command {
  width: 100%;
}

.game-screen {
  position: relative;
  overflow: visible;
}

.game-atmosphere {
  position: absolute;
  z-index: -1;
  top: 0;
  right: 0;
  left: 0;
  height: 440px;
  background-position: center top;
  background-size: cover;
  opacity: 0.82;
}

.game-toolbar {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 18px 16px 14px;
}

.game-toolbar > div:nth-child(2) {
  display: grid;
  text-shadow: 0 1px 10px #000;
}

.game-toolbar > div:nth-child(2) span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.game-toolbar > div:nth-child(2) b {
  font-size: 19px;
}

.score-box {
  display: grid;
  min-width: 67px;
  height: 52px;
  place-content: center;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: rgba(9, 10, 13, 0.8);
  text-align: center;
}

.score-box small {
  color: var(--muted);
  font-size: 9px;
}

.score-box b {
  color: var(--gold);
  font-size: 20px;
  line-height: 1.05;
}

.duel-hud,
.master-hud {
  display: grid;
  align-items: center;
  gap: 10px;
  margin: 0 16px 10px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(13, 14, 18, 0.9);
  backdrop-filter: blur(12px);
}

.duel-hud {
  grid-template-columns: 54px minmax(0, 1fr) auto;
  border-color: rgba(255, 97, 95, 0.48);
}

.master-hud {
  grid-template-columns: 45px minmax(0, 1fr) 38px;
}

.duel-hud > img,
.master-hud > img:first-child {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 4px;
}

.master-hud > img:last-child {
  width: 38px;
  height: 38px;
  object-fit: cover;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
}

.duel-hud > div,
.master-hud > div {
  display: grid;
  min-width: 0;
}

.duel-hud span,
.master-hud span {
  overflow: hidden;
  font-size: 12px;
  font-weight: 720;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.master-hud small {
  overflow: hidden;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.duel-hud > strong {
  color: var(--red);
  font-size: 12px;
}

.target-track {
  height: 6px;
  overflow: hidden;
  margin-top: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.09);
}

.target-track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--red));
  transition: width 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

.round-progress {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding: 8px 16px 18px;
  list-style: none;
}

.round-progress li {
  position: relative;
  height: 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
}

.round-progress li span {
  position: absolute;
  top: -9px;
  left: 50%;
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  transform: translateX(-50%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  background: #16181d;
  color: var(--muted);
  font-size: 9px;
}

.round-progress li.done,
.round-progress li.current {
  background: var(--gold);
}

.round-progress li.done span,
.round-progress li.current span {
  border-color: var(--gold);
  background: var(--gold);
  color: #151007;
}

.round-progress li.current span {
  box-shadow: 0 0 0 5px rgba(241, 199, 91, 0.14);
}

.round-progress img {
  width: 13px;
}

.tutorial-guide {
  overflow: hidden;
  margin: 0 16px 16px;
  border: 1px solid rgba(85, 185, 255, 0.55);
  border-radius: 7px;
  background: rgba(12, 18, 26, 0.94);
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.25);
}

.tutorial-toggle {
  display: grid;
  width: 100%;
  min-height: 62px;
  grid-template-columns: 28px minmax(0, 1fr) 20px;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  text-align: left;
}

.tutorial-toggle > img:first-child {
  width: 26px;
  filter: invert(70%) sepia(100%) saturate(810%) hue-rotate(172deg);
}

.tutorial-toggle span {
  display: grid;
}

.tutorial-toggle small {
  color: var(--blue);
  font-size: 9px;
  font-weight: 730;
  text-transform: uppercase;
}

.tutorial-toggle b {
  margin-top: 2px;
  font-size: 14px;
}

.tutorial-chevron {
  width: 18px;
  transform: rotate(90deg);
  filter: invert(1);
  transition: transform 180ms ease;
}

.tutorial-guide.collapsed .tutorial-chevron {
  transform: rotate(-90deg);
}

.tutorial-body {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  border-top: 1px solid rgba(85, 185, 255, 0.25);
}

.tutorial-guide.collapsed .tutorial-body {
  display: none;
}

.tutorial-body > img {
  width: 100%;
  height: 100%;
  min-height: 118px;
  object-fit: cover;
}

.tutorial-body > div {
  align-self: center;
  padding: 12px;
}

.tutorial-body b {
  color: var(--ivory);
  font-size: 13px;
}

.tutorial-body p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
}

.deal-zone,
.collection-zone,
.records-section {
  padding: 20px 16px;
  border-top: 1px solid var(--line);
  background: rgba(9, 10, 13, 0.96);
}

.section-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 15px;
}

.section-title.compact {
  align-items: center;
}

.section-title h2 {
  margin-top: 4px;
  font-size: 23px;
  font-weight: 760;
  line-height: 1.1;
}

.section-title.compact h2 {
  font-size: 18px;
}

.section-title.compact > img {
  width: 21px;
  filter: invert(89%) sepia(36%) saturate(926%) hue-rotate(346deg);
}

.choice-counter,
.collection-count {
  flex: none;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.offer-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.offer-card {
  position: relative;
  display: grid;
  min-width: 0;
  aspect-ratio: 0.76;
  align-content: end;
  justify-items: center;
  overflow: hidden;
  padding: 9px 5px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
  background: linear-gradient(180deg, #171920, #111216);
  animation: offer-in 430ms var(--offer-delay) cubic-bezier(0.22, 1, 0.36, 1) both;
  transition: transform 150ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.offer-card::before {
  position: absolute;
  top: 10px;
  width: 80%;
  aspect-ratio: 1;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  content: "";
}

.offer-card:active {
  transform: scale(0.97);
}

.offer-card.selected {
  border-color: var(--tone, var(--gold));
  background: linear-gradient(180deg, color-mix(in srgb, var(--tone, var(--gold)) 15%, #15171d), #101115);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--tone, var(--gold)) 54%, transparent), inset 0 0 24px color-mix(in srgb, var(--tone, var(--gold)) 10%, transparent);
}

.offer-card.recommended:not(.selected) {
  border-color: rgba(85, 185, 255, 0.62);
  box-shadow: 0 0 0 2px rgba(85, 185, 255, 0.11);
}

.offer-card.forbidden {
  cursor: not-allowed;
  border-color: rgba(191, 108, 255, 0.46);
  background: linear-gradient(180deg, rgba(55, 28, 72, 0.72), #111216 78%);
  box-shadow: inset 0 0 28px rgba(138, 67, 184, 0.16);
  opacity: 1;
}

.offer-card.forbidden:active {
  transform: none;
}

.offer-card.forbidden::after {
  position: absolute;
  z-index: 2;
  top: 17%;
  width: 61%;
  aspect-ratio: 1;
  border: 2px solid rgba(221, 168, 255, 0.72);
  border-radius: 50%;
  box-shadow: 0 0 14px rgba(168, 84, 223, 0.42), inset 0 0 14px rgba(168, 84, 223, 0.24);
  content: "";
}

.offer-card.forbidden .sphere-stage::after {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 8%;
  width: 84%;
  height: 2px;
  border-radius: 2px;
  background: rgba(230, 185, 255, 0.86);
  box-shadow: 0 0 10px rgba(190, 92, 255, 0.8);
  content: "";
  transform: rotate(-38deg);
}

.offer-card.forbidden .sphere-stage img {
  opacity: 0.26;
  filter: grayscale(0.72) saturate(0.35) drop-shadow(0 10px 14px rgba(0, 0, 0, 0.45));
}

.offer-card.forbidden b {
  color: #b8afc1;
}

.sphere-stage {
  position: absolute;
  top: 13%;
  left: 12%;
  width: 76%;
  aspect-ratio: 1;
}

.sphere-stage img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.45));
  animation: sphere-float 3.8s ease-in-out infinite;
}

.offer-card:nth-child(2n) .sphere-stage img {
  animation-delay: -1.4s;
}

.offer-card b {
  position: relative;
  z-index: 1;
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: 10px;
  line-height: 1.15;
  text-align: center;
}

.offer-card > small {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 2px 5px;
  border-radius: 3px;
  background: var(--blue);
  color: #04121d;
  font-size: 8px;
  font-weight: 800;
  text-transform: uppercase;
}

.offer-card > small.seal-label {
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 3px;
  background: #7f3ca3;
  color: #fff;
}

.offer-card > small.seal-label img {
  width: 10px;
  height: 10px;
  filter: brightness(0) invert(1);
}

.sphere-glyph {
  position: absolute;
  z-index: 3;
  right: 6px;
  bottom: 31px;
  display: grid;
  width: 23px;
  height: 23px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--tone) 72%, transparent);
  border-radius: 2px;
  background: rgba(8, 9, 12, 0.76);
  color: var(--tone);
  box-shadow: 0 0 12px color-mix(in srgb, var(--tone) 26%, transparent);
  font-family: var(--font-han);
  font-size: 15px;
  line-height: 1;
}

.selection-order {
  position: absolute;
  z-index: 2;
  top: 6px;
  left: 6px;
  display: none;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  background: var(--tone, var(--gold));
  color: #08090b;
  font-size: 11px;
  font-weight: 850;
}

.offer-card.selected .selection-order {
  display: grid;
  animation: badge-pop 220ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.tone-blue { --tone: var(--blue); }
.tone-red { --tone: var(--red); }
.tone-green { --tone: var(--green); }
.tone-gold { --tone: var(--gold); }
.tone-purple { --tone: var(--purple); }
.tone-darkness { --tone: #c9c2d6; }
.tone-chameleon { --tone: #78e3d0; }
.tone-earth { --tone: #bc8a51; }
.tone-mechanism { --tone: #f1c75b; }

.collection-ledger {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.collection-cell {
  display: grid;
  min-width: 0;
  min-height: 102px;
  place-items: center;
  align-content: center;
  padding: 7px 3px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 6px;
  background: #111318;
}

.collection-cell img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.collection-cell strong {
  margin-top: 1px;
  color: var(--tone);
  font-size: 19px;
}

.collection-cell small {
  color: var(--muted-dark);
  font-size: 9px;
}

.round-history {
  margin-top: 17px;
}

.round-history:empty {
  display: none;
}

.round-history h3 {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 680;
  text-transform: uppercase;
}

.round-row {
  display: grid;
  min-height: 72px;
  grid-template:
    "label score" auto
    "spheres spheres" 34px /
    minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--line);
}

.round-row > span,
.round-row > strong {
  color: var(--muted);
  font-size: 10px;
}

.round-row > span {
  grid-area: label;
  display: grid;
  min-width: 0;
}

.round-row > span b {
  color: var(--ivory);
  font-size: 10px;
}

.round-row > span small {
  margin-top: 2px;
  overflow-wrap: anywhere;
  color: var(--muted-dark);
  font-size: 7px;
  line-height: 1.15;
}

.round-row > strong {
  grid-area: score;
  color: var(--gold);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.round-row > div {
  grid-area: spheres;
  display: flex;
  min-width: 0;
  align-items: center;
}

.round-row img {
  width: 31px;
  height: 31px;
  object-fit: contain;
  margin-left: -5px;
}

.round-row img:first-child {
  margin-left: 0;
}

.game-actionbar {
  bottom: 0;
}

.game-actionbar .command {
  min-height: 72px;
}

.game-actionbar .command:disabled > img {
  filter: invert(42%);
}

.result-hero {
  position: relative;
  height: 462px;
  overflow: hidden;
  border-bottom: 1px solid var(--line-strong);
  background: #0b0c10;
}

.result-backdrop {
  position: absolute;
  inset: -18px;
  width: calc(100% + 36px);
  height: calc(100% + 36px);
  object-fit: cover;
  filter: blur(14px) brightness(0.42) saturate(0.82);
  transform: scale(1.06);
}

.result-art {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  filter: drop-shadow(0 12px 26px rgba(0, 0, 0, 0.48));
}

.result-hero::after {
  position: absolute;
  z-index: 2;
  inset: 0;
  content: "";
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.04) 22%, rgba(9, 10, 13, 0.3) 55%, rgba(9, 10, 13, 0.98));
}

.result-hero.victory {
  border-color: rgba(107, 212, 155, 0.72);
}

.result-hero.defeat {
  border-color: rgba(255, 97, 95, 0.72);
}

.result-hero.victory .result-copy .eyebrow {
  color: var(--green);
}

.result-hero.defeat .result-copy .eyebrow {
  color: var(--red);
}

.result-copy {
  position: absolute;
  z-index: 3;
  right: 18px;
  bottom: 22px;
  left: 18px;
  text-shadow: 0 2px 18px #000;
}

.result-copy h1 {
  margin-top: 5px;
  font-size: 38px;
}

.result-score {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin-top: 12px;
}

.result-score strong {
  color: var(--gold);
  font-size: 56px;
  font-weight: 820;
  line-height: 0.92;
}

.result-score span {
  color: var(--muted);
  font-size: 14px;
}

.result-copy p {
  max-width: 460px;
  margin-top: 12px;
  color: rgba(247, 242, 232, 0.8);
  font-size: 13px;
}

.result-spectrum {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}

.result-spectrum > div {
  position: relative;
  display: grid;
  min-width: 0;
  place-items: center;
}

.result-spectrum img {
  width: 48px;
  aspect-ratio: 1;
  object-fit: contain;
}

.result-spectrum span {
  position: absolute;
  right: 2px;
  bottom: 1px;
  display: grid;
  min-width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 50%;
  background: var(--tone);
  color: #090a0d;
  font-size: 10px;
  font-weight: 850;
}

.result-breakdown {
  padding: 20px 16px 8px;
}

.result-breakdown h2 {
  margin-bottom: 8px;
  font-size: 20px;
}

.score-row,
.bonus-row {
  display: grid;
  min-height: 66px;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--line);
}

.score-row > img {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.score-row > span {
  display: grid;
  min-width: 0;
}

.score-row b {
  font-size: 14px;
}

.score-row small {
  overflow: hidden;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-row > strong,
.bonus-row > strong {
  color: var(--gold);
  font-size: 22px;
}

.bonus-row {
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 0 2px;
  color: var(--gold-light);
  font-weight: 700;
}

.result-actions {
  grid-template-columns: 1fr;
  padding-bottom: calc(20px + var(--safe-bottom));
  border-bottom: 0;
}

.result-actions .command {
  width: 100%;
}

.text-command {
  display: grid;
  min-height: 48px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.ladder-hero,
.achievements-hero {
  position: relative;
  height: 330px;
  overflow: hidden;
  border-bottom: 1px solid var(--line-strong);
}

.ladder-hero > img,
.achievements-hero > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ladder-hero::after,
.achievements-hero::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(180deg, rgba(9, 10, 13, 0.04), rgba(9, 10, 13, 0.94));
}

.ladder-hero > div,
.achievements-hero > div {
  position: absolute;
  z-index: 1;
  right: 18px;
  bottom: 20px;
  left: 18px;
}

.ladder-hero h1,
.achievements-hero h1 {
  margin-top: 4px;
  font-size: 36px;
}

.ladder-hero p {
  margin-top: 8px;
  color: var(--muted);
}

.ladder-heading {
  display: block;
  padding: 20px 16px 14px;
}

.ladder-heading p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.ladder-path {
  display: grid;
  gap: 11px;
  padding: 0 16px 16px;
}

.opponent-card {
  position: relative;
  display: grid;
  min-height: 332px;
  grid-template-columns: 1fr;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #080a0d;
  text-align: left;
  transition: transform 150ms ease, border-color 180ms ease;
}

.opponent-card:active:not(:disabled) {
  transform: scale(0.99);
}

.opponent-card.selected {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px rgba(241, 199, 91, 0.18);
}

.opponent-card.current {
  background: #080a0d;
}

.opponent-card.won {
  background: #080a0d;
}

.opponent-card.locked {
  opacity: 0.64;
}

.opponent-art {
  position: absolute;
  inset: 0;
  min-height: 332px;
  overflow: hidden;
}

.opponent-card::before {
  position: absolute;
  z-index: 1;
  inset: 0;
  content: "";
  background: linear-gradient(180deg, rgba(3, 5, 8, 0.02) 22%, rgba(3, 5, 8, 0.54) 56%, rgba(3, 5, 8, 0.98) 100%);
  pointer-events: none;
}

.opponent-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.opponent-card.locked .opponent-art img {
  filter: grayscale(1) brightness(0.36);
}

.opponent-copy {
  position: relative;
  z-index: 2;
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: flex-end;
  align-self: stretch;
  padding: 132px 18px 18px;
}

.opponent-copy > small {
  color: var(--gold);
  font-size: 10px;
  font-weight: 740;
  text-transform: uppercase;
}

.opponent-copy > b {
  margin-top: 4px;
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: 400;
  line-height: 1.1;
}

.opponent-copy > em {
  margin-top: 3px;
  color: #ddd5c5;
  font-size: 12px;
  font-style: normal;
}

.opponent-copy > span {
  margin-top: 10px;
  display: -webkit-box;
  overflow: hidden;
  color: #c9c3b6;
  font-size: 12px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.opponent-copy > strong {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 12px;
  color: var(--gold);
  font-size: 10px;
  text-transform: uppercase;
}

.opponent-copy > strong img {
  width: 14px;
  filter: invert(87%) sepia(52%) saturate(739%) hue-rotate(347deg);
}

.opponent-card.won .opponent-copy > strong {
  color: var(--green);
}

.opponent-card.won .opponent-copy > strong img {
  filter: invert(78%) sepia(26%) saturate(873%) hue-rotate(96deg);
}

.ladder-actionbar {
  bottom: calc(78px + var(--safe-bottom));
}

.profile-heading {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  align-items: center;
  gap: 13px;
  padding: 24px 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(115deg, rgba(241, 199, 91, 0.1), rgba(85, 185, 255, 0.08));
}

.profile-avatar {
  display: grid;
  width: 68px;
  height: 68px;
  place-items: center;
  border: 1px solid var(--gold);
  border-radius: 50%;
  background: #161312;
  color: var(--gold);
  font-size: 20px;
  font-weight: 820;
}

.profile-heading h1 {
  margin-top: 3px;
  font-size: 25px;
}

.profile-heading p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.profile-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.profile-stats dd {
  font-size: 21px;
}

.records-section {
  border-top: 0;
  border-bottom: 1px solid var(--line);
}

.history-list,
.leaderboard-list {
  display: grid;
}

.history-row,
.leader-row {
  display: grid;
  min-height: 68px;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--line);
}

.history-row {
  grid-template-columns: 48px minmax(0, 1fr) auto;
}

.history-row > img {
  width: 46px;
  height: 46px;
  object-fit: cover;
  border-radius: 5px;
}

.history-row > span,
.leader-row > div {
  display: grid;
  min-width: 0;
}

.history-row b,
.leader-row b {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-row small,
.leader-row small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.history-row > strong,
.leader-row > strong {
  color: var(--gold);
  font-size: 20px;
}

.leader-row {
  grid-template-columns: 32px minmax(0, 1fr) auto;
}

.leader-row > span {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-bright);
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.leader-row:nth-child(-n+3) > span {
  background: var(--gold);
  color: #151007;
}

.empty-state {
  display: flex;
  min-height: 90px;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.empty-state > img {
  width: 30px;
  filter: invert(68%);
}

.empty-state span {
  display: grid;
}

.empty-state b {
  color: var(--ivory);
  font-size: 13px;
}

.empty-state small {
  margin-top: 3px;
  font-size: 10px;
}

.achievements-hero > img {
  object-position: center;
}

.achievements-hero strong {
  display: inline-block;
  margin-top: 10px;
  padding: 6px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: var(--gold);
  background: rgba(9, 10, 13, 0.64);
}

.achievement-list {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.achievement-item {
  position: relative;
  display: grid;
  min-height: 118px;
  grid-template-columns: 102px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}

.achievement-item > img {
  width: 102px;
  height: 100%;
  min-height: 118px;
  object-fit: cover;
}

.achievement-item > div {
  min-width: 0;
  padding: 11px 0;
}

.achievement-item small {
  color: var(--gold);
  font-size: 9px;
  font-weight: 760;
  text-transform: uppercase;
}

.achievement-item h2 {
  margin-top: 3px;
  font-size: 16px;
  line-height: 1.15;
}

.achievement-item p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
}

.achievement-item > span {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  margin-right: 9px;
  border-radius: 50%;
  background: var(--gold);
}

.achievement-item > span img {
  width: 14px;
}

.achievement-item.locked {
  opacity: 0.48;
}

.achievement-item.locked > img {
  filter: grayscale(1) brightness(0.55);
}

.achievement-item.locked > span {
  background: #626773;
}

.bottom-nav {
  position: fixed;
  z-index: 70;
  right: max(0px, calc((100vw - 580px) / 2));
  bottom: 0;
  left: max(0px, calc((100vw - 580px) / 2));
  display: grid;
  height: calc(78px + var(--safe-bottom));
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 7px 8px var(--safe-bottom);
  border-top: 1px solid var(--line);
  background: rgba(9, 10, 13, 0.96);
  backdrop-filter: blur(22px) saturate(150%);
}

.bottom-nav button {
  display: grid;
  min-width: 0;
  place-items: center;
  align-content: center;
  gap: 3px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 680;
}

.bottom-nav button.active {
  background: rgba(241, 199, 91, 0.09);
  color: var(--gold);
}

.bottom-nav img {
  width: 24px;
  height: 24px;
  filter: invert(70%);
}

.bottom-nav button.active img {
  filter: invert(88%) sepia(52%) saturate(866%) hue-rotate(345deg) brightness(104%);
}

.rules-dialog {
  width: min(580px, 100%);
  max-width: none;
  max-height: 92vh;
  margin: auto auto 0;
  padding: 0 0 calc(16px + var(--safe-bottom));
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: var(--ink-soft);
  color: var(--ivory);
  box-shadow: 0 -28px 80px rgba(0, 0, 0, 0.58);
}

.rules-dialog::backdrop {
  background: rgba(0, 0, 0, 0.74);
  backdrop-filter: blur(5px);
}

.dialog-heading {
  position: sticky;
  z-index: 2;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(14, 16, 20, 0.96);
  backdrop-filter: blur(18px);
}

.dialog-heading h2 {
  margin-top: 3px;
  font-size: 25px;
}

.rules-content {
  padding: 16px;
}

.rules-steps {
  display: grid;
}

.rules-steps article {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 11px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.rules-steps article > span {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--gold);
  border-radius: 50%;
  color: var(--gold);
  font-weight: 800;
}

.rules-steps b {
  font-size: 14px;
}

.rules-steps p,
.rules-section p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.rules-section {
  padding-top: 24px;
}

.rules-section h3 {
  margin-top: 4px;
  font-size: 20px;
}

.sphere-rules,
.master-rules {
  display: grid;
  gap: 8px;
  margin-top: 13px;
}

.sphere-rules article,
.master-rules article {
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 82px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.sphere-rules img,
.master-rules img {
  width: 62px;
  height: 62px;
  object-fit: contain;
}

.master-rules img {
  object-fit: cover;
  border-radius: 50%;
}

.sphere-rules b,
.master-rules b {
  display: block;
  font-size: 13px;
}

.sphere-rules strong {
  display: block;
  margin-top: 2px;
  color: var(--tone);
  font-size: 10px;
}

.rules-tutorial {
  position: sticky;
  bottom: 0;
  width: calc(100% - 32px);
  margin: 0 16px;
}

.toast {
  position: fixed;
  z-index: 120;
  bottom: calc(92px + var(--safe-bottom));
  left: 50%;
  width: min(420px, calc(100% - 32px));
  padding: 12px 15px;
  transform: translate(-50%, 24px);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: rgba(22, 24, 29, 0.96);
  color: var(--ivory);
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.5);
  font-size: 12px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
}

.accept-flash {
  position: fixed;
  z-index: 130;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(4, 7, 9, 0.9);
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
}

.accept-flash img {
  width: 190px;
  opacity: 0;
  transform: scale(0.42);
}

.accept-flash.show {
  opacity: 1;
}

.accept-flash.show img {
  animation: dragon-arrive 460ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.locale-switch {
  display: grid;
  width: 42px;
  height: 46px;
  place-content: center;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  line-height: 1;
}

.locale-switch span {
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
}

.locale-switch small {
  margin-top: 3px;
  color: var(--muted-dark);
  font-size: 8px;
}

.special-state {
  margin: 12px 16px 0;
  padding: 12px;
}

.special-state-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.special-state-heading strong {
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.special-state-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 9px;
}

.special-meter {
  position: relative;
  display: grid;
  min-width: 0;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  min-height: 48px;
  padding: 7px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--tone) 42%, var(--line));
  border-radius: 5px;
  background: color-mix(in srgb, var(--tone) 7%, var(--surface));
}

.special-meter > img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.special-meter span {
  display: grid;
  min-width: 0;
}

.special-meter b,
.special-meter small {
  overflow-wrap: anywhere;
}

.special-meter b {
  color: var(--ivory);
  font-size: 10px;
}

.special-meter small {
  margin-top: 2px;
  color: var(--tone);
  font-size: 9px;
}

.special-meter i {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  transform: scaleX(var(--progress, 0));
  transform-origin: left;
  background: var(--tone);
  box-shadow: 0 0 10px var(--tone);
  transition: transform 320ms ease;
}

.eclipse-ritual {
  position: relative;
  display: grid;
  min-height: 245px;
  grid-column: 1 / -1;
  place-items: center;
  align-content: center;
  gap: 7px;
  overflow: hidden;
  padding: 22px;
  border: 1px solid rgba(209, 197, 226, 0.52);
  border-radius: 7px;
  background: #09080d;
  box-shadow: inset 0 0 70px rgba(103, 72, 130, 0.18), 0 18px 50px rgba(0, 0, 0, 0.36);
}

.eclipse-ritual img {
  width: 142px;
  height: 142px;
  object-fit: contain;
  filter: drop-shadow(0 0 28px rgba(191, 170, 224, 0.34));
}

.eclipse-ritual b {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 400;
}

.eclipse-ritual strong {
  color: #d7c8ed;
  font-size: 25px;
  font-variant-numeric: tabular-nums;
}

.eclipse-dialog {
  width: min(500px, calc(100% - 24px));
  max-height: calc(100vh - 32px);
  margin: auto;
  padding: 22px;
  overflow: auto;
  border: 1px solid rgba(210, 190, 233, 0.54);
  border-radius: 8px;
  background: #0b0910;
  color: var(--ivory);
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.76), inset 0 0 80px rgba(86, 48, 112, 0.15);
  text-align: center;
}

.eclipse-dialog::backdrop {
  background: rgba(2, 2, 4, 0.86);
  backdrop-filter: blur(9px);
}

.eclipse-orbit {
  position: relative;
  width: 144px;
  height: 144px;
  margin: 0 auto 10px;
}

.eclipse-orbit img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.eclipse-orbit .han-seal {
  position: absolute;
  right: 1px;
  bottom: 3px;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid #d7c8ed;
  border-radius: 2px;
  color: #d7c8ed;
  font-size: 22px;
}

.eclipse-dialog h2 {
  margin-top: 5px;
  font-size: 27px;
  font-weight: 400;
}

.eclipse-dialog > p {
  margin: 10px auto 0;
  max-width: 390px;
  color: var(--muted);
  font-size: 12px;
}

.eclipse-preview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 18px;
  border-block: 1px solid rgba(210, 190, 233, 0.24);
}

.eclipse-preview div {
  min-width: 0;
  padding: 12px 5px;
}

.eclipse-preview div + div {
  border-left: 1px solid rgba(210, 190, 233, 0.18);
}

.eclipse-preview dt {
  min-height: 28px;
  color: var(--muted);
  font-size: 9px;
}

.eclipse-preview dd {
  margin-top: 3px;
  color: #d7c8ed;
  font-size: 20px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.eclipse-actions {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 8px;
  margin-top: 18px;
}

.eclipse-actions .command {
  min-width: 0;
  min-height: 62px;
}

.action-impact {
  position: fixed;
  z-index: 155;
  display: grid;
  inset: 0;
  grid-template-columns: 1fr;
  place-content: center;
  justify-items: center;
  gap: 8px;
  padding: 28px;
  transform: scale(0.98);
  background: rgba(4, 7, 9, 0.94);
  opacity: 0;
  pointer-events: none;
  text-align: center;
  transition: opacity 160ms ease, transform 280ms cubic-bezier(0.22, 1, 0.36, 1);
}

.action-impact.show {
  transform: scale(1);
  opacity: 1;
}

.impact-art {
  position: relative;
}

.impact-art > img {
  width: 178px;
  height: 178px;
  object-fit: contain;
  filter: drop-shadow(0 0 22px color-mix(in srgb, var(--tone, var(--gold)) 45%, transparent));
  animation: dragon-orbit 2.2s ease-in-out infinite;
}

.impact-art .han-seal {
  position: absolute;
  right: 7px;
  bottom: 8px;
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  border: 1px solid var(--tone, var(--gold));
  border-radius: 2px;
  color: var(--tone, var(--gold));
  font-size: 19px;
}

.impact-copy {
  display: grid;
  min-width: 0;
  max-width: 340px;
  justify-items: center;
}

.impact-copy small {
  color: var(--tone, var(--gold));
  font-size: 11px;
  text-transform: uppercase;
}

.impact-copy b {
  margin-top: 3px;
  overflow-wrap: anywhere;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 400;
  line-height: 1.05;
}

.impact-copy p {
  max-width: 300px;
  margin-top: 6px;
  color: #c8c3b8;
  font-size: 12px;
}

:root[data-performance="low"] .sphere-stage img,
:root[data-performance="low"] .boot-panel > img,
:root[data-performance="low"] .special-meter i {
  animation: none !important;
  transition: none !important;
}

.boot-panel {
  position: fixed;
  z-index: 200;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  padding: 28px;
  background: #08090b;
  text-align: center;
}

.boot-panel > img {
  width: 176px;
  animation: dragon-orbit 2.4s ease-in-out infinite;
}

.boot-panel b {
  margin-top: 10px;
  font-size: 20px;
}

.boot-panel span {
  max-width: 320px;
  color: var(--muted);
  font-size: 12px;
}

.boot-panel .text-command {
  min-width: 180px;
  margin-top: 13px;
}

.busy .offer-card,
.busy .command,
.busy .master-card,
.busy .opponent-card {
  pointer-events: none;
}

@keyframes screen-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes hero-breathe {
  from { transform: scale(1); }
  to { transform: scale(1.035); }
}

@keyframes offer-in {
  from { opacity: 0; transform: translateY(18px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes sphere-float {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-5px) rotate(1deg); }
}

@keyframes badge-pop {
  from { transform: scale(0.4); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes dragon-arrive {
  0% { opacity: 0; transform: scale(0.42) rotate(-18deg); }
  55% { opacity: 1; transform: scale(1.08) rotate(3deg); }
  100% { opacity: 0; transform: scale(1.34) rotate(0); }
}

@keyframes dragon-orbit {
  0%, 100% { transform: translateY(0) rotate(-1deg) scale(1); filter: drop-shadow(0 0 12px rgba(84, 164, 135, 0.3)); }
  50% { transform: translateY(-7px) rotate(1deg) scale(1.025); filter: drop-shadow(0 0 28px rgba(84, 164, 135, 0.62)); }
}

@media (max-width: 500px) {
  .app-header {
    padding-right: 12px;
    padding-left: 12px;
  }

  .brand { gap: 6px; }
  .brand > img { width: 36px; height: 36px; }
  .brand b { font-size: 12px; }
  .brand small { display: none; }
  .header-actions { gap: 5px; }
  .locale-switch { width: 38px; height: 42px; }
  .record-button { height: 42px; gap: 5px; padding: 0 8px; }
  .record-button small { display: none; }
  .record-button > img { width: 18px; height: 18px; }
  .record-button b { font-size: 16px; }
  .icon-button { width: 42px; height: 42px; }
  .home-hero { height: 330px; }
  .home-hero-copy h1 { font-size: 38px; }
}

@media (max-width: 370px) {
  .app-header { padding-right: 10px; padding-left: 10px; }
  .brand small { display: none; }
  .record-button { padding: 0 9px; }
  .record-button small { display: none; }
  .home-hero { height: 310px; }
  .home-hero-copy h1 { font-size: 35px; }
  .home-special-card > img { width: 58px; }
  .home-master-roster { grid-auto-columns: minmax(102px, 31%); }
  .command-band { grid-template-columns: 1fr; }
  .command.tutorial,
  .command.resume { grid-column: auto; }
  .master-card { grid-template-columns: 102px minmax(0, 1fr); }
  .opponent-card { grid-template-columns: 1fr; }
  .offer-grid { gap: 6px; }
  .offer-card { aspect-ratio: 0.72; }
  .tutorial-body { grid-template-columns: 96px minmax(0, 1fr); }
}

@media (min-width: 700px) {
  body { padding: 24px 0; }
  .app-shell {
    min-height: calc(100vh - 48px);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 32px 90px rgba(0, 0, 0, 0.58);
  }
  .app-header { top: 24px; }
  .bottom-nav {
    right: calc((100vw - 580px) / 2);
    bottom: 24px;
    left: calc((100vw - 580px) / 2);
    border-radius: 0 0 8px 8px;
  }
  .setup-actionbar,
  .game-actionbar { bottom: 0; }
  .ladder-actionbar { bottom: calc(78px + var(--safe-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}
