:root {
  color-scheme: dark;
  --bg: #10151e;
  --surface: #181f2b;
  --panel: #222e3d;
  --text: #f0f4fa;
  --muted: #a4b1c3;
  --accent: #8bd9ed;
  --on-accent: #10232d;
  --gold: #f5cc86;
  --danger: #ffb3a7;
  --line: #344052;
  --scroll-thumb: #5b718d;
  --scroll-hover: #93a8c2;
  --scroll-active: #8bd9ed;
  --font-body: "Segoe UI", system-ui, sans-serif;
  --font-display: "Bahnschrift", "Arial Narrow", "Segoe UI", sans-serif;
  --font-mono: Consolas, ui-monospace, monospace;
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 40px;
  --page-max: 1120px;
  --safe-bottom: max(
    env(safe-area-inset-bottom, 0px),
    var(--tg-safe-bottom, 0px)
  );
}
* {
  box-sizing: border-box;
  scrollbar-color: var(--scroll-thumb) var(--bg);
  scrollbar-width: thin;
}
*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
*::-webkit-scrollbar-track {
  background: var(--bg);
}
*::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border: 2px solid var(--bg);
  border-radius: 8px;
}
*::-webkit-scrollbar-thumb:hover {
  background: var(--scroll-hover);
}
*::-webkit-scrollbar-thumb:active {
  background: var(--scroll-active);
}
html {
  scroll-padding-top: 24px;
  scrollbar-gutter: stable;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 var(--font-body);
}
button,
input,
select {
  font: inherit;
}
button,
a,
summary {
  -webkit-tap-highlight-color: transparent;
}
button {
  border: 0;
  color: inherit;
  cursor: pointer;
}
button:disabled {
  cursor: default;
  opacity: 0.55;
}
a {
  color: var(--accent);
  cursor: pointer;
  text-underline-offset: 4px;
}
a:hover {
  text-decoration-thickness: 2px;
}
button,
a,
summary,
input {
  transition:
    background 0.16s,
    border-color 0.16s,
    color 0.16s;
}
button:focus-visible,
a:focus-visible,
summary:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}
button:active:not(:disabled) {
  transform: translateY(1px);
}
[hidden] {
  display: none !important;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font: 400 clamp(34px, 5vw, 54px)/1.12 var(--font-display);
  letter-spacing: -1.2px;
}
h2 {
  font-size: 19px;
  line-height: 1.3;
  letter-spacing: -0.3px;
}
h3 {
  font-size: 16px;
  line-height: 1.4;
}
small,
.muted {
  color: var(--muted);
}
small {
  font-size: 12px;
}
code {
  font: 0.9em var(--font-mono);
  color: var(--accent);
  overflow-wrap: anywhere;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip-link {
  position: fixed;
  top: -100px;
  left: 16px;
  z-index: 30;
  background: var(--accent);
  color: var(--on-accent);
  padding: 12px;
  border-radius: var(--radius-sm);
}
.skip-link:focus {
  top: 12px;
}
.shell {
  max-width: var(--page-max);
  margin: auto;
  padding: max(0px, var(--tg-safe-top, 0px))
    max(32px, var(--tg-safe-right, 0px)) calc(32px + var(--safe-bottom))
    max(32px, var(--tg-safe-left, 0px));
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 98px;
  border-bottom: 1px solid var(--line);
  margin-bottom: var(--space-xl);
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  text-decoration: none;
  color: var(--text);
  font: 26px/1.1 var(--font-display);
}
.brand small {
  display: block;
  font: 600 9px/1.8 var(--font-body);
  letter-spacing: 3px;
  color: var(--muted);
}
.brand-mark {
  display: grid;
  place-items: center;
  color: var(--accent);
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  font: 34px var(--font-display);
}
.icon-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 25px;
  color: var(--muted);
}
.icon-button:hover:not(:disabled) {
  background: var(--panel);
  color: var(--accent);
}
.icon-button[aria-busy="true"] span {
  animation: spin 1.3s linear infinite;
}
.tabs {
  display: flex;
  gap: 4px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: var(--surface);
}
.tabs button {
  min-width: 108px;
  min-height: 42px;
  border-radius: 24px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.tabs button:hover {
  background: var(--panel);
  color: var(--text);
}
.tabs button.active {
  background: var(--accent);
  color: var(--on-accent);
}
.eyebrow {
  font: 600 10px/1.5 var(--font-body);
  letter-spacing: 2px;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 12px;
}
.intro {
  margin-bottom: 28px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
}
.intro p:not(.eyebrow) {
  color: var(--muted);
  margin-top: 12px;
  max-width: 48ch;
}
.intro-note {
  font: 11px var(--font-mono);
  color: var(--muted);
  white-space: nowrap;
  padding-bottom: 5px;
}
.avatar {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 72px;
  height: 86px;
  border-radius: 36px 36px 12px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--accent);
  font: 30px var(--font-display);
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 5px 10px;
}
.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
}
.section-head h2 {
  font-size: 16px;
  font-weight: 600;
}
.section-head small {
  font-size: 11px;
}
.wallet-icon {
  color: var(--gold);
  font-size: 18px;
  line-height: 1;
}
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 24px;
}
.rarity {
  color: var(--accent);
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.rarity.mythical {
  color: var(--gold);
}
.progress {
  height: 5px;
  background: var(--line);
  border-radius: 5px;
  overflow: hidden;
  margin: 16px 0 7px;
}
.progress span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
}
.xp-caption {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  font-size: 10px;
  color: var(--muted);
}
.primary,
.secondary,
.danger,
.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
}
.primary {
  background: var(--accent);
  color: var(--on-accent);
}
.primary:hover:not(:disabled) {
  background: var(--text);
}
.secondary {
  background: var(--surface);
  border-color: var(--line);
  color: var(--text);
}
.secondary:hover:not(:disabled) {
  background: var(--panel);
  border-color: var(--scroll-thumb);
}
.text-button {
  background: transparent;
  color: var(--accent);
  padding-inline: 10px;
}
.text-button:hover {
  background: var(--panel);
}
.danger {
  background: transparent;
  border-color: var(--danger);
  color: var(--danger);
}
.danger:hover:not(:disabled),
.danger.solid {
  background: var(--danger);
  color: var(--bg);
}
.notice {
  padding: 14px 18px;
  border: 1px solid var(--scroll-thumb);
  background: var(--surface);
  border-radius: var(--radius-sm);
  color: var(--muted);
  margin: 20px 0;
  font-size: 13px;
}
.notice strong {
  color: var(--gold);
}
.preview-notice {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: -16px 0 28px;
}
.empty {
  text-align: center;
  padding: 56px 24px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius-md);
  color: var(--muted);
}
.empty h2 {
  font: 28px var(--font-display);
  color: var(--text);
  margin-bottom: 12px;
}
.empty p {
  max-width: 50ch;
  margin: auto;
}
.empty .empty-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 24px;
}
.empty-emblem {
  display: block;
  font: 44px var(--font-display);
  color: var(--accent);
  margin-bottom: 16px;
}
.loading {
  min-height: 230px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 18px;
  color: var(--muted);
  text-align: center;
  padding: 32px;
}
.loader {
  display: block;
  width: 28px;
  height: 28px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 10px;
  color: var(--muted);
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.footer > span:first-child {
  letter-spacing: 2px;
}
.guide-body {
  padding: 24px;
  color: var(--muted);
  line-height: 1.85;
  overflow-wrap: anywhere;
}
.guide-body b {
  color: var(--text);
}
.guide-body code {
  background: var(--panel);
  padding: 3px 6px;
  border-radius: 4px;
}
.guide-body a {
  color: var(--accent);
}
dialog {
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--scroll-thumb);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: min(480px, calc(100% - 32px));
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
}
dialog::backdrop {
  background: rgb(3 12 18 / 0.8);
}
dialog h2 {
  font: 28px var(--font-display);
  margin-bottom: 16px;
}
dialog p:not(.eyebrow) {
  color: var(--muted);
}
.dialog-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 20px;
}
.field-error {
  min-height: 24px;
  color: var(--danger) !important;
  font-size: 13px;
  margin-top: 8px;
  overflow-wrap: anywhere;
}
.field-help {
  color: var(--muted);
  font-size: 12px;
  margin-top: 7px;
}
input:not([type="range"]) {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--scroll-thumb);
  background: var(--bg);
  color: var(--text);
  border-radius: var(--radius-sm);
  font-size: 16px;
}
input::placeholder {
  color: var(--muted);
}
input[aria-invalid="true"] {
  border-color: var(--danger);
}
label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}
.admin-shell {
  max-width: 840px;
}
.admin-tag {
  margin-left: auto;
  font: 10px var(--font-mono);
  letter-spacing: 1px;
  color: var(--gold);
}
.admin-layout {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 24px;
}
.search-field {
  position: relative;
}
.search-field input {
  padding-right: 48px;
}
.search-field .icon-button {
  position: absolute;
  right: 4px;
  top: 2px;
  border: 0;
  font-size: 20px;
}
.search-toggle {
  display: flex;
  gap: 8px;
  margin: 14px 0;
}
.search-toggle button {
  flex: 1;
}
.search-toggle [aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--panel);
}
.full {
  width: 100%;
}
.results {
  margin-top: 20px;
  min-height: 120px;
}
.result-row {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  padding: 14px;
  background: var(--surface);
}
.result-row:hover,
.result-row[aria-pressed="true"] {
  background: var(--panel);
  border-color: var(--accent);
}
.result-row strong,
.result-row small {
  display: block;
  overflow-wrap: anywhere;
}
.result-row .ban {
  color: var(--danger);
  font-size: 11px;
}
.dossier {
  align-self: start;
}
.dossier h2 {
  font: 28px var(--font-display);
  margin-bottom: 10px;
  overflow-wrap: anywhere;
}
.dossier dl {
  margin: 24px 0;
}
.dossier dl > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.dossier dt {
  color: var(--muted);
  font-size: 12px;
}
.dossier dd {
  margin: 0;
  font-size: 13px;
}
.dossier .acts {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.form-section {
  margin: 24px 0;
}
.form-section h2 {
  font-size: 16px;
  margin-bottom: 20px;
}
.reward-field {
  padding: 16px;
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: var(--radius-sm);
}
.reward-field label {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}
.reward-field output {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
  min-height: 30px;
}
.form-actions {
  margin-top: 24px;
  border-top: 1px solid var(--line);
  padding-top: 24px;
}
.created-code {
  font-size: 30px;
  display: block;
  margin: 24px 0;
  color: var(--accent);
  letter-spacing: 2px;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.topic-library {
  display: grid;
  gap: 10px;
}
.manual-group-head {
  margin-bottom: 16px;
  padding-left: 2px;
}
.manual-group-head .eyebrow {
  display: block;
  font-size: 8px;
  color: var(--muted);
  margin-bottom: 6px;
}
.manual-group-head h2 {
  font-size: 19px;
  margin: 0;
}
.library-topic {
  display: flex;
  align-items: center;
  gap: 16px;
  text-align: left;
  min-height: 92px;
  width: 100%;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.library-topic:hover {
  background: var(--panel);
  border-color: var(--scroll-thumb);
}
.library-topic:hover .library-arrow {
  color: var(--accent);
}
.library-icon {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 12px;
  color: var(--accent);
  font-size: 24px;
  display: grid;
  place-items: center;
}
.library-copy {
  flex: 1;
  min-width: 0;
}
.library-copy strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
}
.library-copy small {
  display: block;
  font-size: 11px;
  margin-top: 5px;
  line-height: 1.5;
}
.library-arrow {
  align-self: start;
  margin-top: 3px;
  font-size: 19px;
  color: var(--muted);
}
.reader-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}
.reader-toolbar > span {
  color: var(--muted);
  font-size: 11px;
}
.manual-reading-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 210px;
  gap: 24px;
  align-items: start;
}
.manual-article {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: var(--surface);
}
.article-heading {
  padding: 32px;
  border-bottom: 1px solid var(--line);
  position: relative;
  background: linear-gradient(120deg, var(--panel), var(--surface));
}
.article-heading .eyebrow {
  color: var(--muted);
  font-size: 9px;
  margin-bottom: 8px;
}
.article-heading h1 {
  font: 650 36px/1.15 var(--font-display);
  padding-right: 36px;
}
.article-heading > p:last-child {
  color: var(--muted);
  font-size: 12px;
  margin-top: 12px;
}
.article-icon {
  position: absolute;
  right: 28px;
  top: 26px;
  color: var(--accent);
  font-size: 34px;
}
.manual-article .guide-body {
  padding: 32px;
  font-size: 15px;
  line-height: 1.9;
}
.manual-article .guide-body br + br {
  line-height: 2;
}
.manual-article .guide-body p + p,
.manual-article .guide-body p + ul,
.manual-article .guide-body ul + p {
  margin-top: 22px;
}
.manual-article .guide-body ul {
  padding-left: 22px;
  margin-bottom: 0;
}
.manual-article .guide-body li + li {
  margin-top: 10px;
}
.next-topic {
  border-top: 1px solid var(--line);
  padding: 20px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.next-topic > span {
  font: 8px var(--font-mono);
  letter-spacing: 1px;
  color: var(--muted);
}
.reading-aside {
  border-left: 1px solid var(--line);
  padding-left: 20px;
}
.reading-aside .eyebrow {
  font-size: 8px;
  color: var(--muted);
}
.reading-aside nav {
  display: grid;
  gap: 4px;
}
.reading-link {
  text-align: left;
  min-height: 40px;
  color: var(--muted);
  font-size: 11px;
  background: transparent;
  padding: 9px 12px;
  border-radius: 6px;
}
.reading-link:hover,
.reading-link.selected {
  background: var(--panel);
  color: var(--accent);
}
@media (max-width: 800px) {
  .manual-reading-layout {
    grid-template-columns: 1fr;
  }
  .reading-aside {
    display: none;
  }
}
@media (max-width: 640px) {
  .manual-article .guide-body {
    padding: 24px;
    font-size: 14px;
  }
  .article-heading {
    padding: 24px;
  }
  .article-heading h1 {
    font-size: 30px;
  }
  .article-icon {
    right: 20px;
    top: 18px;
  }
  .reader-toolbar > span {
    font-size: 9px;
    max-width: 15ch;
    text-align: right;
  }
  .next-topic {
    padding: 16px 24px;
  }
}
.brand {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.brand-mark {
  border: 0;
  border-radius: 0;
  font-size: 38px;
  color: var(--accent);
}
h1 {
  font-weight: 750;
  letter-spacing: -1.4px;
}
.dashboard .app-layout {
  display: grid;
  grid-template-columns: 192px minmax(0, 1fr);
  max-width: 1480px;
  padding: 0;
  min-height: 100dvh;
}
.app-sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  padding: 36px 22px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 60px;
  background: var(--bg);
}
.app-sidebar .brand {
  gap: 9px;
  font-size: 27px;
}
.app-sidebar .brand small {
  font-size: 8px;
  letter-spacing: 2px;
}
.app-sidebar .tabs {
  display: flex;
  flex-direction: column;
  padding: 0;
  border: 0;
  gap: 10px;
  background: transparent;
  border-radius: 0;
}
.app-sidebar .tabs button {
  text-align: left;
  border-radius: 10px;
  min-height: 48px;
  padding: 12px 18px;
  font-size: 14px;
}
.app-sidebar .tabs button span {
  margin-right: 12px;
  font-size: 18px;
}
.app-sidebar .tabs button.active {
  background: var(--panel);
  color: var(--accent);
  border-left: 3px solid var(--accent);
}
.sidebar-note {
  margin-top: auto;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}
.sidebar-note > span {
  display: block;
  font-size: 28px;
  color: var(--accent);
  margin-bottom: 12px;
}
.sidebar-note small {
  display: block;
  font: 8px var(--font-mono);
  letter-spacing: 1.8px;
  margin-top: 18px;
}
.app-content {
  min-width: 0;
  padding: max(0px, var(--tg-safe-top, 0px)) 36px
    calc(28px + var(--safe-bottom));
}
.dashboard-topbar {
  min-height: 82px;
  margin-bottom: 28px;
}
.toolbar-label {
  font: 11px var(--font-mono);
  letter-spacing: 1px;
  color: var(--text);
}
.toolbar-label span {
  color: var(--muted);
  margin-left: 8px;
}
.mobile-brand {
  display: none;
}
.dashboard .preview-notice {
  margin: 0 0 22px;
  padding: 8px 12px;
  border: 0;
  border-left: 2px solid var(--gold);
  border-radius: 0;
  background: transparent;
  font-size: 11px;
}
.traveler-strip {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin: 0 0 24px;
}
.traveler-identity {
  display: flex;
  gap: 14px;
  align-items: center;
  min-width: 0;
}
.traveler-identity .avatar {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  font: 20px var(--font-display);
  background: var(--panel);
}
.traveler-identity .eyebrow {
  margin-bottom: 4px;
  font-size: 8px;
  color: var(--muted);
}
.traveler-identity h2 {
  font: 600 24px var(--font-display);
  overflow-wrap: anywhere;
}
.traveler-identity p:not(.eyebrow) {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
  overflow-wrap: anywhere;
}
.joined-date {
  font-size: 11px;
  color: var(--muted);
  flex-shrink: 0;
}
.resource-rail {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 24px;
}
.resource-rail .wallet-card {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}
.resource-rail .wallet-icon {
  font-size: 24px;
  width: 28px;
  text-align: center;
}
.resource-rail .number {
  font-size: 20px;
  margin: 0;
  line-height: 1.2;
  letter-spacing: -0.3px;
}
.resource-rail small {
  font-size: 10px;
}
.expedition-board {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(260px, 1fr);
  gap: 18px;
  align-items: stretch;
}
.expedition-scene {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  min-height: 400px;
  border: 1px solid var(--line);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 26px;
  background: var(--surface);
}
.world-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 60% center;
  z-index: -2;
}
.expedition-scene:after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgb(9 18 28 / 0.15) 15%,
    rgb(9 18 28 / 0.08) 40%,
    rgb(9 18 28 / 0.94) 100%
  );
  z-index: -1;
}
.scene-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.scene-label,
.scene-count {
  font: 9px var(--font-mono);
  letter-spacing: 1.3px;
  padding: 7px 10px;
  border: 1px solid rgb(139 217 237 / 0.4);
  border-radius: 5px;
  background: rgb(16 21 30 / 0.7);
  color: var(--text);
}
.scene-count {
  border-color: var(--line);
  color: var(--muted);
}
.scene-coordinate {
  display: block;
  font-size: 24px;
  color: var(--accent);
  margin-bottom: 8px;
}
.scene-copy h1 {
  max-width: 10ch;
  font-size: clamp(32px, 4vw, 48px);
  line-height: 1.05;
  letter-spacing: -1px;
  text-transform: uppercase;
  font-weight: 750;
  color: var(--text);
}
.scene-copy > p {
  font-size: 13px;
  color: var(--muted);
  margin-top: 12px;
}
.scene-footnote {
  display: block;
  margin-top: 20px;
  font-size: 10px;
  color: var(--muted);
  max-width: 40ch;
}
.champion-panel {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.champion-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.champion-top h2 {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}
.champion-symbol {
  color: var(--gold);
  font-size: 20px;
}
.champion-crest {
  display: grid;
  place-items: center;
  height: 116px;
  position: relative;
  margin: 10px 0;
  background: radial-gradient(
    ellipse,
    rgb(139 217 237 / 0.12),
    transparent 68%
  );
}
.crest-orbit {
  width: 84px;
  height: 84px;
  position: absolute;
  border: 1px solid var(--scroll-thumb);
  border-radius: 24px;
  transform: rotate(45deg);
}
.crest-orbit:before,
.crest-orbit:after {
  content: "";
  position: absolute;
  border: 1px solid var(--line);
  inset: -8px;
  border-radius: 28px;
}
.crest-orbit:after {
  inset: 12px;
  border-radius: 16px;
}
.crest-initials {
  font: 750 30px var(--font-display);
  color: var(--accent);
  letter-spacing: 2px;
}
.champion-level {
  position: absolute;
  bottom: 0;
  font: 9px var(--font-mono);
  letter-spacing: 1px;
  color: var(--on-accent);
  background: var(--accent);
  padding: 3px 8px;
  border-radius: 4px;
}
.champion-copy {
  text-align: center;
  margin: 6px 0 18px;
}
.champion-copy .rarity {
  font-size: 8px;
  letter-spacing: 2px;
}
.champion-copy h3 {
  font: 650 24px/1.2 var(--font-display);
  margin: 6px 0;
  overflow-wrap: anywhere;
}
.champion-copy p {
  font-size: 11px;
  color: var(--muted);
}
.champion-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
  margin-top: auto;
}
.champion-stats > div {
  display: grid;
  grid-template-columns: 22px auto;
  justify-content: center;
  column-gap: 7px;
}
.champion-stats > div + div {
  border-left: 1px solid var(--line);
}
.champion-stats span {
  grid-row: span 2;
  align-self: center;
  color: var(--accent);
  font-size: 20px;
}
.champion-stats strong {
  font-size: 21px;
  line-height: 1.2;
}
.champion-stats small {
  font-size: 9px;
}
.champion-xp {
  margin-top: 18px;
}
.champion-xp .progress {
  margin: 9px 0 0;
  height: 4px;
}
.champion-empty {
  margin: auto 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 20px 0;
}
.champion-empty h3 {
  color: var(--text);
  margin-bottom: 12px;
}
.formation-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(260px, 1fr);
  gap: 18px;
  margin-top: 32px;
}
.formation-section {
  min-width: 0;
}
.formation-section .section-head {
  margin-bottom: 16px;
}
.formation-section .eyebrow,
.world-route .eyebrow {
  font-size: 8px;
  color: var(--muted);
  margin-bottom: 4px;
}
.formation-section h2,
.world-route h2 {
  font-size: 18px;
}
.formation-section .team-list {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}
.formation-section .team-member,
.team-slot-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  min-height: 156px;
  padding: 12px 6px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.formation-section .team-member:first-child {
  border-color: var(--accent);
  background: var(--panel);
}
.formation-position {
  font: 7px var(--font-mono);
  color: var(--muted);
  letter-spacing: 1px;
}
.formation-section .member-glyph {
  display: grid;
  place-items: center;
  width: 40px;
  height: 46px;
  margin: 15px 0 12px;
  border-radius: 12px;
  color: var(--text);
  background: var(--panel);
  font: 600 17px var(--font-display);
}
.formation-section .team-member strong {
  font-size: 9px;
  line-height: 1.35;
}
.formation-section .team-member small {
  font-size: 8px;
  margin-top: 6px;
}
.team-slot-empty {
  background: transparent;
  border-style: dashed;
  justify-content: space-between;
  color: var(--muted);
}
.empty-slot-glyph {
  font-size: 32px;
  color: var(--line);
  margin: 10px 0;
}
.team-slot-empty small {
  font-size: 9px;
}
.formation-help {
  color: var(--muted);
  font-size: 10px;
  margin-top: 14px;
}
.collection-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
}
.collection-panel .eyebrow {
  font-size: 8px;
  color: var(--muted);
  margin-bottom: 6px;
}
.collection-panel h2 {
  font-size: 17px;
}
.collection-total {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 14px 0 20px;
}
.collection-total > strong {
  font: 650 62px/1 var(--font-display);
  letter-spacing: -3px;
  color: var(--text);
}
.collection-total > span {
  font-size: 18px;
  color: var(--muted);
}
.collection-total small {
  display: block;
  font-size: 10px;
}
.collection-segments {
  display: flex;
  gap: 3px;
}
.collection-segments span {
  height: 16px;
  flex: 1;
  background: var(--panel);
  border-radius: 2px;
}
.collection-segments .filled {
  background: var(--accent);
}
.collection-bottom {
  display: flex;
  gap: 24px;
  border-top: 1px solid var(--line);
  margin-top: 22px;
  padding-top: 18px;
}
.collection-bottom strong {
  display: block;
  font-size: 19px;
  line-height: 1.2;
}
.collection-bottom small {
  font-size: 9px;
}
.world-route {
  margin-top: 36px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}
.island-itinerary {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  position: relative;
  gap: 8px;
  padding-top: 10px;
}
.island-itinerary:before {
  content: "";
  position: absolute;
  top: 24px;
  left: 7%;
  right: 7%;
  border-top: 1px dashed var(--scroll-thumb);
}
.island-stop {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  position: relative;
  min-width: 0;
}
.island-node {
  width: 28px;
  height: 28px;
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 13px;
}
.island-stop.current .island-node {
  color: var(--gold);
  border-color: var(--gold);
}
.island-stop.visited .island-node {
  color: var(--accent);
  border-color: var(--accent);
}
.island-name {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.island-stop.current .island-name {
  color: var(--text);
}
.island-stop small {
  font-size: 8px;
}
.entry-panel {
  position: relative;
  min-height: 520px;
  overflow: hidden;
  border-radius: 20px;
  border: 1px solid var(--line);
  display: flex;
  align-items: end;
  padding: 40px;
  isolation: isolate;
}
.entry-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -1;
}
.entry-copy {
  max-width: 490px;
}
.entry-copy h1 {
  margin-bottom: 24px;
  font-size: clamp(36px, 5vw, 60px);
}
.entry-copy h2 {
  font-size: 19px;
  margin-bottom: 12px;
}
.entry-copy > p:not(.eyebrow) {
  color: var(--muted);
  font-size: 13px;
}
.entry-copy .empty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}
.manual-intro {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid var(--line);
  min-height: 240px;
  padding: 32px;
  margin-bottom: 24px;
  background: var(--surface);
}
.manual-intro img {
  position: absolute;
  right: 0;
  top: 0;
  width: 58%;
  height: 100%;
  object-fit: cover;
  z-index: -1;
  opacity: 0.6;
  mask-image: linear-gradient(90deg, transparent, black);
}
.manual-intro h1 {
  font: 700 clamp(30px, 5vw, 46px)/1.05 var(--font-display);
  max-width: 12ch;
  text-transform: uppercase;
}
.manual-intro > p:last-child {
  color: var(--muted);
  font-size: 13px;
  max-width: 38ch;
  margin-top: 18px;
}
.battle-primer {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 32px;
}
.battle-counter {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.counter-icon {
  width: 40px;
  height: 40px;
  background: var(--panel);
  color: var(--accent);
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 20px;
}
.battle-counter small {
  display: block;
  font: 8px var(--font-mono);
  letter-spacing: 1px;
}
.battle-counter strong {
  font-size: 14px;
  font-weight: 600;
}
.manual-groups {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px 24px;
  align-items: start;
}
.manual-group h2 {
  font-size: 15px;
  margin-bottom: 14px;
}
.manual-group h2 small {
  font: 9px var(--font-mono);
  margin-left: 8px;
}
.guide-body {
  font-size: 13px;
}
.admin-shell h1 {
  font-size: 42px;
  font-weight: 650;
}
.dossier h2,
.empty h2 {
  font-family: var(--font-display);
  font-weight: 600;
}
@media (max-width: 1150px) {
  .dashboard .app-layout {
    grid-template-columns: 152px minmax(0, 1fr);
  }
  .app-sidebar {
    padding: 30px 14px;
  }
  .app-sidebar .brand {
    font-size: 22px;
    gap: 4px;
  }
  .app-content {
    padding-inline: 24px;
  }
  .resource-rail .wallet-card {
    gap: 8px;
    padding: 12px 10px;
  }
  .resource-rail .wallet-icon {
    font-size: 19px;
    width: 18px;
  }
  .formation-section .team-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 900px) {
  .dashboard .app-layout {
    display: block;
    min-height: 0;
  }
  .app-sidebar {
    height: auto;
    position: static;
    padding: 0;
    border: 0;
  }
  .app-sidebar > .brand,
  .sidebar-note {
    display: none;
  }
  .app-content {
    padding-inline: 24px;
    padding-bottom: calc(110px + var(--safe-bottom));
  }
  .mobile-brand {
    display: flex;
    flex-direction: column;
    color: var(--text);
    font: 800 25px/0.9 var(--font-display);
    letter-spacing: 2px;
    text-decoration: none;
  }
  .mobile-brand span {
    font: 7px var(--font-body);
    letter-spacing: 2px;
    margin-top: 5px;
  }
  .toolbar-label {
    margin-left: auto;
    font-size: 9px;
  }
  .toolbar-label span {
    display: none;
  }
  .app-sidebar .tabs {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(14px + var(--safe-bottom));
    z-index: 10;
    width: min(320px, calc(100% - 36px));
    flex-direction: row;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: 0 10px 40px rgb(0 0 0 / 0.4);
  }
  .app-sidebar .tabs button {
    flex: 1;
    min-width: 0;
    text-align: center;
    padding: 9px;
    border: 0;
  }
  .app-sidebar .tabs button.active {
    border: 0;
    background: var(--panel);
  }
  .expedition-board {
    grid-template-columns: minmax(0, 1.4fr) minmax(240px, 1fr);
  }
  .formation-layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .formation-section .team-list {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
  .collection-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: 12px 24px;
  }
  .collection-panel .eyebrow {
    grid-column: 1;
    margin: 0;
  }
  .collection-total {
    grid-column: 1;
    grid-row: 2 / span 2;
    margin: 0;
  }
  .collection-panel h2 {
    grid-column: 2;
    grid-row: 1;
  }
  .collection-bottom {
    grid-column: 2;
    margin: 0;
  }
}
@media (max-width: 640px) {
  .app-content {
    padding-inline: max(16px, var(--tg-safe-left, 0px))
      max(16px, var(--tg-safe-right, 0px));
  }
  .dashboard-topbar {
    min-height: 68px;
    margin-bottom: 18px;
    gap: 12px;
  }
  .dashboard .preview-notice {
    flex-direction: row;
    gap: 10px;
    font-size: 9px;
    margin-bottom: 20px;
  }
  .preview-notice span {
    max-width: 28ch;
  }
  .traveler-strip {
    margin-bottom: 20px;
    align-items: start;
  }
  .traveler-identity h2 {
    font-size: 23px;
  }
  .traveler-identity .eyebrow {
    font-size: 7px;
  }
  .traveler-identity p:not(.eyebrow) span {
    display: block;
  }
  .joined-date {
    font-size: 8px;
    padding-top: 4px;
  }
  .resource-rail {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 18px;
  }
  .resource-rail .wallet-card {
    grid-column: span 2;
    padding: 10px 8px;
    gap: 8px;
    border: 1px solid var(--line);
  }
  .resource-rail .wallet-card:nth-of-type(-n + 3) {
    grid-column: span 2;
  }
  .resource-rail .wallet-card:nth-of-type(n + 4) {
    grid-column: span 3;
  }
  .resource-rail .wallet-card .number {
    font-size: 17px;
  }
  .resource-rail .wallet-icon {
    font-size: 18px;
  }
  .resource-rail small {
    font-size: 9px;
  }
  .expedition-board {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .expedition-scene {
    min-height: 330px;
    padding: 20px;
    border-radius: 16px;
  }
  .world-art {
    object-position: 65% center;
  }
  .scene-top {
    gap: 8px;
  }
  .scene-label,
  .scene-count {
    font-size: 7px;
    letter-spacing: 0.8px;
    padding: 6px 8px;
  }
  .scene-copy h1 {
    font-size: 36px;
  }
  .scene-copy > p {
    font-size: 12px;
  }
  .scene-footnote {
    font-size: 9px;
    margin-top: 14px;
  }
  .champion-panel {
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 8px 16px;
    padding: 20px;
    border-radius: 16px;
  }
  .champion-top {
    grid-column: 1 / -1;
  }
  .champion-crest {
    height: 96px;
    margin: 0;
    grid-row: 2 / span 2;
  }
  .crest-orbit {
    width: 60px;
    height: 60px;
    border-radius: 18px;
  }
  .crest-orbit:before {
    border-radius: 22px;
  }
  .crest-orbit:after {
    border-radius: 10px;
  }
  .crest-initials {
    font-size: 23px;
  }
  .champion-level {
    font-size: 7px;
    bottom: 6px;
  }
  .champion-copy {
    text-align: left;
    margin: 4px 0 8px;
  }
  .champion-copy h3 {
    font-size: 24px;
  }
  .champion-stats {
    padding: 10px 0;
    margin: 0;
  }
  .champion-stats > div {
    justify-content: start;
  }
  .champion-stats > div + div {
    padding-left: 12px;
  }
  .champion-stats strong {
    font-size: 19px;
  }
  .champion-xp {
    grid-column: 1 / -1;
    margin-top: 8px;
  }
  .champion-empty {
    grid-column: 1 / -1;
  }
  .formation-section .team-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
  .formation-section .team-member strong {
    font-size: 11px;
  }
  .formation-section .team-member small {
    font-size: 9px;
  }
  .formation-section .team-member,
  .team-slot-empty {
    min-height: 150px;
  }
  .formation-layout {
    margin-top: 28px;
  }
  .collection-panel {
    padding: 20px;
    gap: 10px;
  }
  .collection-total > strong {
    font-size: 54px;
  }
  .collection-total > span {
    font-size: 16px;
  }
  .collection-bottom {
    gap: 16px;
  }
  .collection-panel h2 {
    font-size: 15px;
  }
  .world-route {
    padding: 20px;
  }
  .world-route .section-head {
    display: block;
  }
  .world-route .section-head > small {
    display: block;
    margin-top: 8px;
  }
  .island-itinerary {
    grid-template-columns: 1fr;
    padding: 0;
    gap: 16px;
  }
  .island-itinerary:before {
    top: 10px;
    bottom: 20px;
    left: 14px;
    right: auto;
    border-top: 0;
    border-left: 1px dashed var(--scroll-thumb);
  }
  .island-stop {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    text-align: left;
    gap: 14px;
  }
  .island-name {
    font-size: 12px;
  }
  .island-stop small {
    font-size: 9px;
  }
  .entry-panel {
    padding: 24px;
    min-height: 510px;
  }
  .manual-intro {
    padding: 24px;
    min-height: 250px;
  }
  .manual-intro h1 {
    font-size: 36px;
  }
  .manual-intro img {
    width: 80%;
  }
  .battle-primer {
    gap: 6px;
    margin-bottom: 24px;
  }
  .battle-counter {
    padding: 12px 8px;
    display: block;
  }
  .counter-icon {
    width: 30px;
    height: 30px;
    font-size: 17px;
    margin-bottom: 12px;
  }
  .battle-counter strong {
    font-size: 12px;
  }
  .battle-counter small {
    font-size: 7px;
  }
  .manual-groups {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}
@media (max-width: 800px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 540px) {
  .shell {
    padding-inline: max(18px, var(--tg-safe-left, 0px))
      max(18px, var(--tg-safe-right, 0px));
    padding-bottom: calc(110px + var(--safe-bottom));
  }
  .topbar {
    min-height: 80px;
    margin-bottom: 28px;
  }
  .brand {
    font-size: 23px;
  }
  .brand-mark {
    width: 38px;
    height: 38px;
    font-size: 28px;
  }
  .tabs {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(16px + var(--safe-bottom));
    z-index: 10;
    width: min(280px, calc(100% - 36px));
    box-shadow: 0 8px 32px rgb(0 0 0 / 0.3);
  }
  .tabs button {
    flex: 1;
    min-width: 0;
    min-height: 44px;
  }
  .intro {
    display: block;
  }
  .intro-note {
    display: none;
  }
  .intro p:not(.eyebrow) {
    font-size: 13px;
  }
  .eyebrow {
    font-size: 9px;
  }
  .avatar {
    width: 60px;
    height: 76px;
    font-size: 25px;
  }
  .card {
    padding: 20px;
  }
  .footer {
    flex-direction: column;
    gap: 8px;
    margin-top: 32px;
  }
  .preview-notice {
    flex-direction: column;
    gap: 3px;
    margin-top: -8px;
    font-size: 11px;
  }
  .guide-body {
    padding: 20px;
    font-size: 14px;
  }
  .form-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .dialog-actions {
    flex-wrap: wrap;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
@media (forced-colors: active) {
  * {
    scrollbar-color: auto;
  }
  .progress span {
    forced-color-adjust: none;
    background: Highlight;
  }
  .tabs button.active,
  .primary {
    border: 1px solid Highlight;
  }
}
