:root {
  color-scheme: light;
  --color-page: #f6f8fb;
  --color-surface: #ffffff;
  --color-surface-muted: #eef3f8;
  --color-border: #d8e0ea;
  --color-text: #172033;
  --color-muted: #657287;
  --color-accent: #0668d9;
  --color-accent-strong: #044da2;
  --color-accent-soft: #e8f2ff;
  --color-accent-focus: rgba(6, 104, 217, 0.3);
  --color-success: #16875d;
  --color-success-strong: #0f6f4a;
  --color-success-soft: #e7f5ee;
  --color-success-focus: rgba(22, 135, 93, 0.34);
  --color-warning: #b26b00;
  --color-warning-soft: #fff4dc;
  --color-danger: #b43b3b;
  --color-danger-soft: #fdecec;
  --shadow-action: 0 8px 18px rgba(22, 135, 93, 0.2);
  --shadow-control: 0 4px 12px rgba(23, 32, 51, 0.1);
  --shadow-panel: 0 12px 32px rgba(23, 32, 51, 0.08);
  --radius-panel: 8px;
  --radius-control: 6px;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --font-ui: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(246, 248, 251, 0)),
    var(--color-page);
  color: var(--color-text);
  font-family: var(--font-ui);
  line-height: 1.5;
}

body:has(.game-app-shell:not([hidden])) {
  overflow: hidden;
}

button {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  background: var(--color-surface);
  color: inherit;
  cursor: pointer;
  font: inherit;
  transition:
    background-color 140ms ease,
    border-color 140ms ease,
    box-shadow 140ms ease,
    color 140ms ease;
}

button:hover:not(:disabled):not([aria-disabled="true"]) {
  border-color: var(--color-accent);
  box-shadow: var(--shadow-control);
}

button:focus-visible:not(:disabled):not([aria-disabled="true"]) {
  border-color: var(--color-accent);
  outline: 3px solid var(--color-accent-focus);
  outline-offset: 2px;
}

button:disabled,
button[aria-disabled="true"] {
  border-color: var(--color-border);
  background: var(--color-surface-muted);
  color: var(--color-muted);
  cursor: not-allowed;
  opacity: 0.58;
  box-shadow: none;
}

.app-shell {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: var(--space-6) 0;
}

.app-shell:has(.game-app-shell:not([hidden])) {
  width: 100%;
  height: 100dvh;
  padding: 0;
  overflow: hidden;
}

.eyebrow {
  margin: 0 0 var(--space-2);
  color: var(--color-accent-strong);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.language-gate {
  display: grid;
  min-height: calc(100vh - 4rem);
  place-items: center;
}

.language-gate__content {
  width: min(760px, 100%);
  padding: var(--space-6);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-panel);
  background: var(--color-surface);
  box-shadow: var(--shadow-panel);
}

.language-gate h1 {
  margin: 0;
  line-height: 1.1;
}

.language-gate h1 {
  max-width: 12ch;
  font-size: clamp(2rem, 8vw, 4rem);
}

.language-gate__summary {
  max-width: 42rem;
  margin: var(--space-4) 0 var(--space-5);
  color: var(--color-muted);
  font-size: 1.05rem;
}

.language-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
}

.language-option {
  display: grid;
  min-height: 7rem;
  align-content: space-between;
  border-color: rgba(6, 104, 217, 0.3);
  background: var(--color-accent-soft);
  padding: var(--space-4);
  text-align: left;
  box-shadow: var(--shadow-control);
}

.language-option:hover,
.language-option:focus-visible {
  border-color: var(--color-accent-strong);
  background: #f3f8ff;
}

.language-option__name {
  font-size: 1.25rem;
  font-weight: 800;
}

.language-option__hint {
  color: var(--color-muted);
  font-size: 0.9rem;
}

.dashboard,
.game-app-shell {
  min-height: 0;
}

.dashboard[hidden] {
  display: none;
}

.game-app-shell {
  position: relative;
  display: grid;
  grid-template-columns: minmax(10rem, 12rem) minmax(0, 1fr);
  width: 100%;
  height: 100dvh;
  overflow: hidden;
}

.toast-stack {
  position: fixed;
  z-index: 40;
  right: var(--space-4);
  bottom: var(--space-4);
  display: grid;
  gap: var(--space-2);
  width: min(24rem, calc(100vw - 2rem));
  pointer-events: none;
}

.toast-stack[hidden] {
  display: none;
}

.toast-notice {
  display: grid;
  gap: 0.1rem;
  border: 1px solid rgba(22, 135, 93, 0.38);
  border-radius: var(--radius-control);
  background: rgba(255, 255, 255, 0.96);
  padding: var(--space-3);
  box-shadow: var(--shadow-panel);
}

.toast-notice strong {
  color: var(--color-success-strong);
}

.toast-notice span {
  color: var(--color-muted);
  font-size: 0.86rem;
}

.tutorial-overlay {
  position: fixed;
  z-index: 35;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(23, 32, 51, 0.42);
  padding: var(--space-4);
}

.tutorial-dialog {
  display: grid;
  gap: var(--space-3);
  width: min(36rem, 100%);
  border: 1px solid rgba(6, 104, 217, 0.22);
  border-radius: var(--radius-panel);
  background: var(--color-surface);
  padding: var(--space-5);
  box-shadow: var(--shadow-panel);
}

.tutorial-dialog h2,
.tutorial-dialog p {
  margin: 0;
}

.tutorial-dialog__lead {
  color: var(--color-muted);
  font-weight: 650;
}

.tutorial-dialog__steps {
  display: grid;
  gap: var(--space-2);
  margin: 0;
  padding-left: 1.35rem;
}

.tutorial-dialog__steps li {
  border-left: 4px solid var(--color-accent);
  border-radius: var(--radius-control);
  background: var(--color-accent-soft);
  padding: var(--space-2) var(--space-3);
  font-weight: 750;
}

.tutorial-dialog .primary-button {
  justify-self: start;
  min-height: 2.45rem;
  padding: 0 var(--space-4);
}

.game-nav {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: var(--space-5);
  min-height: 0;
  padding: var(--space-4);
  border-right: 1px solid var(--color-border);
  background: #f9fbfd;
}

.game-nav__brand h2 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.2;
}

.game-nav__links {
  display: grid;
  align-content: start;
  gap: var(--space-2);
  min-height: 0;
}

.game-nav__links button {
  display: block;
  width: 100%;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--color-text);
  font-size: 0.92rem;
  font-weight: 750;
  padding: 0.6rem 0.7rem;
  text-align: left;
  text-decoration: none;
}

.game-nav__links button:hover,
.game-nav__links button:focus-visible {
  border-color: var(--color-accent);
  background: var(--color-accent-soft);
}

.game-nav__links button:focus-visible {
  outline: 3px solid var(--color-accent-focus);
  outline-offset: 2px;
}

.game-nav__links button.is-active {
  border-color: var(--color-accent);
  background: var(--color-surface);
  color: var(--color-accent-strong);
  box-shadow: inset 0.25rem 0 0 var(--color-accent), var(--shadow-control);
}

.game-main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  padding: var(--space-3);
}

.resource-strip,
.progress-strip,
.panel,
.feed-pane {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-panel);
  background: var(--color-surface);
}

.resource-strip {
  display: grid;
  grid-template-columns: minmax(28rem, 1fr) minmax(15rem, 0.45fr) auto;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
  padding: var(--space-3);
  box-shadow: var(--shadow-panel);
}

.resource-strip__resources {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: var(--space-2) var(--space-3);
  min-width: 0;
}

.resource-strip__resources h3 {
  margin: 0;
  font-size: 0.85rem;
}

.resource-strip__resources .panel__status {
  justify-self: start;
}

.dashboard-header__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-2);
}

.ghost-button {
  border-color: rgba(6, 104, 217, 0.42);
  background: var(--color-accent-soft);
  color: var(--color-accent-strong);
  font-weight: 800;
  min-height: 2.25rem;
  padding: 0 var(--space-2);
  white-space: nowrap;
}

.ghost-button:hover:not(:disabled) {
  border-color: var(--color-accent-strong);
  background: #f3f8ff;
}

.ghost-button[data-save]:not(:disabled) {
  border-color: var(--color-success);
  background: var(--color-success-soft);
  color: var(--color-success-strong);
}

.ghost-button[data-save]:hover:not(:disabled) {
  background: #f2fbf6;
  box-shadow: 0 4px 12px rgba(22, 135, 93, 0.16);
}

.ghost-button[data-reset]:not(:disabled) {
  border-color: rgba(180, 59, 59, 0.55);
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.ghost-button[data-reset]:hover:not(:disabled) {
  border-color: var(--color-danger);
  background: #fff5f5;
}

.progress-strip {
  display: grid;
  grid-template-columns: max-content minmax(6rem, 1fr) max-content;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  padding: var(--space-2) var(--space-3);
  font-size: 0.86rem;
}

.progress-strip > span,
.progress-strip > strong {
  min-width: 0;
  white-space: nowrap;
}

.progress-meter {
  height: 0.65rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--color-surface-muted);
}

.progress-meter span {
  display: block;
  width: var(--progress, 0%);
  height: 100%;
  border-radius: inherit;
  background: var(--color-success);
  transition: width 160ms ease;
}

.game-workspace,
.dashboard-grid {
  display: grid;
  min-height: 0;
}

.game-workspace {
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-3);
  overflow: hidden;
  padding-top: var(--space-3);
}

.workspace-pane {
  min-width: 0;
  min-height: 0;
}

.workspace-pane[hidden],
[data-pane-section][hidden] {
  display: none;
}

.pane-scroll {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  scrollbar-gutter: stable;
}

.explore-pane,
.side-pane {
  display: grid;
  align-content: start;
  gap: var(--space-3);
}

.explore-pane.is-active,
.side-pane.is-active,
.feed-pane.is-active {
  height: 100%;
}

.feed-pane {
  padding: var(--space-4);
}

.panel {
  min-width: 0;
  padding: var(--space-3);
}

.panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.panel h3,
.panel h4,
.panel p {
  margin-top: 0;
}

.panel h3 {
  margin-bottom: 0;
  font-size: 1rem;
}

.panel h4 {
  margin-bottom: var(--space-1);
}

.panel p,
.panel small,
.activity-log {
  color: var(--color-muted);
}

.panel__status {
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--color-surface-muted);
  color: var(--color-muted);
  padding: 0.15rem var(--space-2);
  font-size: 0.78rem;
  font-weight: 700;
}

.resources-panel,
.log-panel {
  grid-column: span 1;
}

.research-panel {
  grid-column: span 1;
  grid-row: span 2;
}

.resource-list,
.research-list,
.research-track__items,
.command-grid {
  display: grid;
  gap: var(--space-3);
}

.resource-list {
  grid-column: 1 / -1;
  grid-template-columns: repeat(4, minmax(6.8rem, 1fr));
  gap: var(--space-2);
}

.resource-tile,
.research-card,
.event-card,
.location-card,
.encounter-card {
  min-width: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  background: var(--color-surface-muted);
  padding: var(--space-3);
}

.resource-tile {
  display: grid;
  gap: 0.1rem;
  padding: var(--space-2);
}

.resource-tile strong {
  font-size: 1.12rem;
  line-height: 1;
}

.resource-tile span,
.resource-tile small {
  overflow-wrap: anywhere;
}

.exploration-panel {
  display: grid;
  grid-template-rows: auto max-content auto;
  align-content: start;
  gap: var(--space-3);
  min-height: 100%;
}

.exploration-body {
  display: grid;
  grid-template-rows: auto max-content;
  gap: var(--space-4);
  min-height: 0;
}

.location-card,
.encounter-card {
  display: grid;
  gap: var(--space-3);
  background: var(--color-surface);
}

.location-card {
  grid-template-columns: minmax(0, 1fr) minmax(9rem, 0.45fr);
  align-items: center;
}

.location-card__controls,
.location-selector {
  display: grid;
  gap: var(--space-2);
  min-width: 0;
}

.location-selector__label {
  color: var(--color-muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.location-selector__buttons {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.location-button {
  min-height: 2rem;
  border-color: rgba(22, 135, 93, 0.34);
  background: var(--color-success-soft);
  color: var(--color-success-strong);
  padding: 0 var(--space-2);
  font-size: 0.82rem;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(22, 135, 93, 0.12);
}

.location-button:hover,
.location-button:focus-visible {
  border-color: var(--color-success);
  background: #f2fbf6;
}

.location-button.is-current {
  border-color: var(--color-accent);
  background: var(--color-accent);
  color: #ffffff;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.28), var(--shadow-control);
}

.location-card h4,
.encounter-card h4 {
  margin-bottom: var(--space-1);
  font-size: 1.18rem;
}

.location-card p,
.encounter-card p {
  margin-bottom: 0;
}

.encounter-card {
  align-content: start;
  min-height: 0;
  overflow: visible;
}

.encounter-card.is-quiet {
  place-content: center;
  min-height: 12rem;
  border-style: dashed;
  text-align: center;
}

.encounter-card.is-active {
  border-color: rgba(6, 104, 217, 0.35);
  background: #f8fbff;
}

.completion-card {
  align-content: center;
  min-height: 0;
  overflow: visible;
  border-color: rgba(22, 135, 93, 0.42);
  background:
    linear-gradient(135deg, rgba(231, 245, 238, 0.92), rgba(232, 242, 255, 0.74)),
    var(--color-surface);
}

.completion-card__copy {
  display: grid;
  gap: var(--space-1);
}

.completion-card__hint {
  color: var(--color-muted);
  font-weight: 700;
}

.completion-card__reset {
  justify-self: start;
  min-height: 2.35rem;
  padding: 0 var(--space-3);
}

.encounter-card__context,
.rival-battle-card__context {
  border-left: 4px solid var(--color-warning);
  border-radius: var(--radius-control);
  background: linear-gradient(90deg, rgba(255, 244, 220, 0.98), rgba(255, 255, 255, 0.76));
  color: #594019;
  padding: var(--space-2) var(--space-3);
  font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(178, 107, 0, 0.16);
}

.encounter-card--rival-battle {
  grid-template-columns: minmax(12rem, 15rem) minmax(0, 1fr) minmax(14rem, 19rem);
  align-items: stretch;
  gap: 0;
  overflow: visible;
  padding: 0;
  background: #f7fbff;
}

.rival-battle-card {
  display: contents;
}

.rival-battle-card__enemy {
  grid-column: 1;
}

.rival-battle-card__scene {
  grid-column: 2;
}

.rival-battle-card__enemy {
  display: grid;
  align-content: start;
  justify-items: center;
  gap: var(--space-2);
  min-width: 0;
  padding: var(--space-3);
  border-right: 1px solid rgba(216, 224, 234, 0.9);
  background:
    linear-gradient(180deg, rgba(232, 242, 255, 0.76), rgba(231, 245, 238, 0.52)),
    var(--color-surface);
  text-align: center;
}

.rival-battle-card__enemy-copy,
.rival-battle-card__intro,
.rival-battle-card__scene {
  min-width: 0;
}

.rival-battle-card__enemy-copy {
  display: grid;
  gap: 0.12rem;
  justify-items: center;
}

.rival-battle-card__category {
  border-radius: 999px;
  background: rgba(6, 104, 217, 0.1);
  color: var(--color-accent-strong);
  padding: 0.12rem var(--space-2);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.rival-battle-card__name {
  overflow-wrap: anywhere;
  font-size: 1rem;
  line-height: 1.18;
}

.rival-battle-card__title {
  color: var(--color-muted);
  font-size: 0.82rem;
  line-height: 1.25;
}

.rival-battle-card__scene {
  display: grid;
  align-content: start;
  gap: var(--space-2);
  padding: var(--space-3);
}

.rival-battle-card__intro {
  display: grid;
  gap: var(--space-1);
}

.rival-battle-card__intro h4 {
  margin-bottom: 0;
}

.rival-battle-card__intro p {
  margin-bottom: 0;
}

.rival-battle-card__hints {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-2);
  color: var(--color-muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.rival-battle-card__hints span {
  min-width: 0;
  border-radius: 999px;
  background: var(--color-surface);
  padding: 0.12rem var(--space-2);
  overflow-wrap: anywhere;
}

.rival-battle-card__context {
  margin-bottom: 0;
  font-size: 0.9rem;
}

.rival-battle-card__choices {
  align-content: start;
  align-self: stretch;
  gap: var(--space-2);
  grid-column: 3;
  grid-template-columns: 1fr;
  margin-top: 0;
  padding: var(--space-3);
  border-left: 1px solid rgba(216, 224, 234, 0.9);
  background:
    linear-gradient(180deg, rgba(231, 245, 238, 0.72), rgba(248, 251, 255, 0.88)),
    var(--color-surface);
}

.rival-battle-card__choices button {
  align-content: center;
  min-height: 3.65rem;
  padding: var(--space-2);
}

.rival-encounter {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid rgba(216, 224, 234, 0.82);
}

.rival-avatar {
  width: 88px;
  height: 88px;
  flex: 0 0 88px;
}

.rival-avatar__frame {
  position: relative;
  display: block;
  width: 88px;
  height: 88px;
  overflow: hidden;
  border: 1px solid rgba(23, 32, 51, 0.12);
  border-radius: var(--radius-panel);
  background: #ffffff;
  box-shadow: inset 0 0 0 6px rgba(255, 255, 255, 0.38);
  transform-origin: top left;
}

.rival-avatar__layer {
  position: absolute;
  display: block;
}

.rival-avatar--video-meeting .rival-avatar__frame {
  background:
    linear-gradient(135deg, #eef7fa 0%, #fff7e8 100%);
}

.rival-avatar__layer--lens-halo {
  inset: 15px;
  border: 7px solid rgba(27, 136, 161, 0.26);
  border-radius: 50%;
}

.rival-avatar__layer--lens-core {
  inset: 29px;
  border: 9px solid rgba(242, 151, 87, 0.34);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.72);
}

.rival-avatar__layer--window-top,
.rival-avatar__layer--window-left,
.rival-avatar__layer--window-right {
  border: 1px solid rgba(27, 136, 161, 0.32);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.78);
}

.rival-avatar__layer--window-top {
  top: 13px;
  left: 26px;
  width: 34px;
  height: 14px;
}

.rival-avatar__layer--window-left {
  bottom: 16px;
  left: 15px;
  width: 21px;
  height: 24px;
}

.rival-avatar__layer--window-right {
  right: 14px;
  bottom: 20px;
  width: 25px;
  height: 18px;
}

.rival-avatar__layer--status-one,
.rival-avatar__layer--status-two {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #6bbf8d;
}

.rival-avatar__layer--status-one {
  top: 17px;
  right: 16px;
}

.rival-avatar__layer--status-two {
  left: 19px;
  bottom: 18px;
  background: #f2b35d;
}

.rival-avatar--team-chat .rival-avatar__frame {
  background:
    linear-gradient(145deg, #f1f3fb 0%, #edf8f1 100%);
}

.rival-avatar__layer--thread-ribbon {
  top: 13px;
  right: 13px;
  width: 16px;
  height: 58px;
  border-radius: 999px;
  background: rgba(96, 120, 196, 0.18);
}

.rival-avatar__layer--message-back,
.rival-avatar__layer--message-mid,
.rival-avatar__layer--message-front {
  border: 1px solid rgba(55, 76, 142, 0.18);
  border-radius: 8px;
  box-shadow: 0 6px 12px rgba(23, 32, 51, 0.08);
}

.rival-avatar__layer--message-back {
  top: 18px;
  left: 16px;
  width: 47px;
  height: 23px;
  background: #fffaf0;
}

.rival-avatar__layer--message-mid {
  top: 32px;
  left: 25px;
  width: 48px;
  height: 22px;
  background: #eef9f1;
}

.rival-avatar__layer--message-front {
  top: 48px;
  left: 14px;
  width: 53px;
  height: 24px;
  background: #f3f1ff;
}

.rival-avatar__layer--channel-dot-one,
.rival-avatar__layer--channel-dot-two,
.rival-avatar__layer--channel-dot-three {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6e8cc9;
}

.rival-avatar__layer--channel-dot-one {
  top: 25px;
  left: 24px;
}

.rival-avatar__layer--channel-dot-two {
  top: 39px;
  left: 33px;
  background: #7bbf90;
}

.rival-avatar__layer--channel-dot-three {
  left: 23px;
  bottom: 25px;
  background: #c89562;
}

.rival-avatar--dialer-contact .rival-avatar__frame {
  background:
    linear-gradient(145deg, #f7f4ed 0%, #eef6fb 100%);
}

.rival-avatar__layer--contact-card {
  top: 14px;
  left: 13px;
  width: 45px;
  height: 31px;
  border: 1px solid rgba(34, 112, 137, 0.2);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.82);
}

.rival-avatar__layer--contact-head {
  top: 21px;
  left: 21px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #75a8b6;
}

.rival-avatar__layer--contact-line {
  top: 27px;
  left: 38px;
  width: 14px;
  height: 4px;
  border-radius: 999px;
  background: #d0a25d;
}

.rival-avatar__layer--keypad-one,
.rival-avatar__layer--keypad-two,
.rival-avatar__layer--keypad-three {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #5f8f9e;
}

.rival-avatar__layer--keypad-one {
  left: 26px;
  bottom: 25px;
}

.rival-avatar__layer--keypad-two {
  left: 41px;
  bottom: 25px;
  background: #d0a25d;
}

.rival-avatar__layer--keypad-three {
  left: 34px;
  bottom: 12px;
  background: #8ab582;
}

.rival-avatar__layer--sound-arc-one,
.rival-avatar__layer--sound-arc-two {
  border: 3px solid rgba(95, 143, 158, 0.45);
  border-bottom-color: transparent;
  border-left-color: transparent;
  border-radius: 50%;
  transform: rotate(-20deg);
}

.rival-avatar__layer--sound-arc-one {
  top: 31px;
  right: 16px;
  width: 20px;
  height: 20px;
}

.rival-avatar__layer--sound-arc-two {
  top: 24px;
  right: 8px;
  width: 35px;
  height: 35px;
  border-color: rgba(208, 162, 93, 0.36);
  border-bottom-color: transparent;
  border-left-color: transparent;
}

.rival-avatar--contact-center .rival-avatar__frame {
  background:
    linear-gradient(145deg, #eef9f5 0%, #f8f1ff 100%);
}

.rival-avatar__layer--queue-orbit {
  inset: 15px;
  border: 4px solid rgba(22, 135, 93, 0.28);
  border-left-color: rgba(116, 88, 168, 0.22);
  border-radius: 50%;
  transform: rotate(-18deg);
}

.rival-avatar__layer--queue-core {
  top: 33px;
  left: 33px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: inset 0 0 0 7px rgba(22, 135, 93, 0.24);
}

.rival-avatar__layer--agent-dot-one,
.rival-avatar__layer--agent-dot-two,
.rival-avatar__layer--agent-dot-three {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #74a98f;
}

.rival-avatar__layer--agent-dot-one {
  top: 19px;
  left: 36px;
}

.rival-avatar__layer--agent-dot-two {
  right: 17px;
  top: 44px;
  background: #8a75ba;
}

.rival-avatar__layer--agent-dot-three {
  left: 20px;
  bottom: 18px;
  background: #d5a15f;
}

.rival-avatar__layer--routing-lane {
  right: 15px;
  bottom: 17px;
  width: 32px;
  height: 9px;
  border-radius: 999px;
  background: rgba(116, 88, 168, 0.18);
}

.rival-avatar__layer--service-badge {
  top: 17px;
  right: 18px;
  width: 16px;
  height: 13px;
  border: 1px solid rgba(22, 135, 93, 0.24);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.8);
}

.rival-avatar--outsourced-office .rival-avatar__frame {
  background:
    linear-gradient(145deg, #f7f8ee 0%, #eef4fb 100%);
}

.rival-avatar__layer--desk-grid {
  top: 14px;
  left: 14px;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(79, 103, 125, 0.18);
  border-radius: 7px;
  background:
    linear-gradient(90deg, transparent 48%, rgba(79, 103, 125, 0.18) 50%, transparent 52%),
    linear-gradient(0deg, transparent 48%, rgba(79, 103, 125, 0.18) 50%, transparent 52%),
    rgba(255, 255, 255, 0.78);
}

.rival-avatar__layer--ticket-conveyor {
  left: 18px;
  bottom: 18px;
  width: 52px;
  height: 10px;
  border-radius: 999px;
  background: rgba(84, 116, 146, 0.2);
}

.rival-avatar__layer--ticket-one,
.rival-avatar__layer--ticket-two {
  width: 20px;
  height: 14px;
  border: 1px solid rgba(84, 116, 146, 0.2);
  border-radius: 4px;
  background: #fff8ea;
}

.rival-avatar__layer--ticket-one {
  left: 24px;
  bottom: 29px;
  transform: rotate(-7deg);
}

.rival-avatar__layer--ticket-two {
  right: 16px;
  bottom: 31px;
  background: #edf8f4;
  transform: rotate(8deg);
}

.rival-avatar__layer--timezone-tile {
  top: 17px;
  right: 16px;
  width: 19px;
  height: 19px;
  border-radius: 6px;
  background: rgba(210, 151, 82, 0.28);
}

.rival-avatar__layer--handoff-arrow {
  top: 50px;
  left: 48px;
  width: 20px;
  height: 7px;
  border-radius: 999px;
  background: #6b879f;
}

.rival-avatar__layer--handoff-arrow::after {
  position: absolute;
  top: -4px;
  right: -2px;
  width: 0;
  height: 0;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 9px solid #6b879f;
  content: "";
}

.rival-avatar--ai-automation .rival-avatar__frame {
  background:
    linear-gradient(145deg, #f3f6ff 0%, #fff4ed 100%);
}

.rival-avatar__layer--prompt-card {
  top: 18px;
  left: 14px;
  width: 48px;
  height: 35px;
  border: 1px solid rgba(74, 103, 166, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
}

.rival-avatar__layer--spark-chip {
  top: 25px;
  left: 24px;
  width: 25px;
  height: 20px;
  border-radius: 6px;
  background: rgba(77, 112, 180, 0.18);
  box-shadow: inset 0 0 0 5px rgba(255, 255, 255, 0.38);
}

.rival-avatar__layer--spark-one,
.rival-avatar__layer--spark-two {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #e7ad5c;
  box-shadow: 0 0 0 4px rgba(231, 173, 92, 0.16);
}

.rival-avatar__layer--spark-one {
  top: 14px;
  right: 18px;
}

.rival-avatar__layer--spark-two {
  right: 23px;
  bottom: 20px;
  background: #7aa6c9;
  box-shadow: 0 0 0 4px rgba(122, 166, 201, 0.16);
}

.rival-avatar__layer--caution-stripe {
  left: 16px;
  bottom: 17px;
  width: 46px;
  height: 8px;
  border-radius: 999px;
  background:
    repeating-linear-gradient(
      135deg,
      rgba(180, 112, 60, 0.55) 0 6px,
      rgba(255, 255, 255, 0.78) 6px 12px
    );
}

.rival-avatar__layer--tiny-disclaimer {
  right: 15px;
  bottom: 34px;
  width: 18px;
  height: 5px;
  border-radius: 999px;
  background: rgba(23, 32, 51, 0.18);
}

.rival-avatar--dev-workflow .rival-avatar__frame {
  background:
    linear-gradient(145deg, #eef8f2 0%, #f8f2ff 100%);
}

.rival-avatar__layer--pipeline-rail {
  top: 18px;
  left: 15px;
  width: 50px;
  height: 34px;
  border: 3px solid rgba(42, 128, 94, 0.28);
  border-radius: 12px;
}

.rival-avatar__layer--build-block {
  top: 25px;
  left: 23px;
  width: 20px;
  height: 18px;
  border-radius: 5px;
  background: rgba(86, 118, 185, 0.32);
  box-shadow: 22px 0 0 rgba(86, 118, 185, 0.2);
}

.rival-avatar__layer--check-light {
  top: 15px;
  right: 18px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #4fb37a;
  box-shadow: 0 0 0 5px rgba(79, 179, 122, 0.16);
}

.rival-avatar__layer--deploy-arrow {
  right: 18px;
  bottom: 23px;
  width: 26px;
  height: 7px;
  border-radius: 999px;
  background: #6b879f;
}

.rival-avatar__layer--deploy-arrow::after {
  position: absolute;
  top: -4px;
  right: -2px;
  width: 0;
  height: 0;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 9px solid #6b879f;
  content: "";
}

.rival-avatar__layer--log-strip {
  left: 17px;
  bottom: 17px;
  width: 30px;
  height: 7px;
  border-radius: 999px;
  background: repeating-linear-gradient(90deg, rgba(23, 32, 51, 0.18) 0 5px, transparent 5px 9px);
}

.rival-avatar__layer--warning-node {
  right: 25px;
  bottom: 37px;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: #d99a45;
  transform: rotate(45deg);
}

.rival-avatar--quality-automation .rival-avatar__frame {
  background:
    linear-gradient(145deg, #f4f8ff 0%, #fff7ef 100%);
}

.rival-avatar__layer--test-grid {
  top: 17px;
  left: 17px;
  width: 44px;
  height: 38px;
  border-radius: 9px;
  background:
    linear-gradient(rgba(83, 122, 176, 0.15) 1px, transparent 1px),
    linear-gradient(90deg, rgba(83, 122, 176, 0.15) 1px, transparent 1px),
    rgba(255, 255, 255, 0.72);
  background-size: 14px 13px;
}

.rival-avatar__layer--retry-loop {
  top: 25px;
  left: 25px;
  width: 28px;
  height: 28px;
  border: 4px solid rgba(22, 135, 93, 0.34);
  border-left-color: transparent;
  border-radius: 50%;
}

.rival-avatar__layer--assertion-line {
  left: 19px;
  bottom: 18px;
  width: 42px;
  height: 7px;
  border-radius: 999px;
  background: rgba(77, 112, 180, 0.34);
}

.rival-avatar__layer--flake-spark-one,
.rival-avatar__layer--flake-spark-two {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #d99a45;
  box-shadow: 0 0 0 4px rgba(217, 154, 69, 0.14);
}

.rival-avatar__layer--flake-spark-one {
  top: 13px;
  right: 18px;
}

.rival-avatar__layer--flake-spark-two {
  right: 19px;
  bottom: 24px;
  background: #70a6bd;
}

.rival-avatar__layer--result-dot {
  top: 33px;
  left: 33px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #4fb37a;
}

.rival-avatar--backlog-planning .rival-avatar__frame {
  background:
    linear-gradient(145deg, #fff7ec 0%, #eef6fb 100%);
}

.rival-avatar__layer--ticket-stack {
  top: 17px;
  left: 18px;
  width: 43px;
  height: 35px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow:
    5px 5px 0 rgba(107, 135, 159, 0.2),
    10px 10px 0 rgba(210, 151, 82, 0.2);
}

.rival-avatar__layer--priority-flag {
  top: 14px;
  right: 20px;
  width: 16px;
  height: 22px;
  border-radius: 3px 3px 8px 3px;
  background: #d99a45;
}

.rival-avatar__layer--scope-ribbon {
  left: 17px;
  bottom: 19px;
  width: 44px;
  height: 8px;
  border-radius: 999px;
  background: rgba(22, 135, 93, 0.28);
}

.rival-avatar__layer--swimlane {
  top: 28px;
  left: 23px;
  width: 30px;
  height: 4px;
  border-radius: 999px;
  background: rgba(23, 32, 51, 0.18);
  box-shadow: 0 9px 0 rgba(23, 32, 51, 0.12);
}

.rival-avatar__layer--estimate-dot {
  right: 24px;
  bottom: 24px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #6b879f;
}

.rival-avatar__layer--dependency-chain {
  right: 17px;
  bottom: 38px;
  width: 26px;
  height: 8px;
  border: 2px solid rgba(77, 112, 180, 0.35);
  border-radius: 999px;
}

.rival-encounter__copy {
  display: grid;
  gap: 0.1rem;
  min-width: 0;
}

.rival-encounter__category {
  color: var(--color-accent-strong);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.rival-encounter__name {
  overflow-wrap: anywhere;
  font-size: 1rem;
  line-height: 1.2;
}

.rival-encounter__companion {
  color: var(--color-muted);
  font-size: 0.84rem;
}

.inline-meter {
  display: grid;
  gap: var(--space-2);
}

.inline-meter__label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  color: var(--color-muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.inline-meter__label strong {
  color: var(--color-text);
}

.command-panel {
  display: grid;
  gap: var(--space-2);
  margin-top: var(--space-2);
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-3);
}

.command-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.command-panel__header h4 {
  margin: 0;
  font-size: 0.9rem;
}

.command-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-2);
}

.command-button {
  display: grid;
  width: 100%;
  min-height: 5rem;
  gap: 0.1rem;
  border-color: var(--color-success);
  background: var(--color-success);
  color: #ffffff;
  padding: var(--space-2);
  text-align: left;
  box-shadow: var(--shadow-action);
}

.command-button:hover:not(:disabled),
.command-button:focus-visible:not(:disabled) {
  border-color: var(--color-success-strong);
  background: var(--color-success-strong);
}

.command-button:focus-visible:not(:disabled) {
  outline-color: var(--color-success-focus);
}

.command-button__label {
  font-weight: 800;
}

.command-button__description {
  display: -webkit-box;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.78rem;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.command-button__meta {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.78rem;
  font-weight: 700;
}

.command-button:disabled .command-button__description,
.command-button:disabled .command-button__meta {
  color: var(--color-muted);
}

.action-card,
.event-choice-list button {
  display: grid;
  width: 100%;
  gap: var(--space-1);
  min-height: 3.2rem;
  padding: var(--space-2) var(--space-3);
}

.action-card__label {
  font-weight: 800;
}

.action-card__description,
.action-card__meta,
.cost-line,
.empty-note {
  color: var(--color-muted);
  font-size: 0.9rem;
}

.event-choice-list button:not(:disabled) .action-card__meta {
  color: rgba(255, 255, 255, 0.9);
}

.checklist-panel {
  display: grid;
  align-content: start;
  gap: var(--space-5);
  padding: var(--space-4) var(--space-5);
}

.goal-section {
  display: grid;
  gap: var(--space-3);
}

.checklist__header,
.research-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.checklist__header {
  margin-bottom: var(--space-3);
}

.checklist__header h3 {
  margin: 0;
  font-size: 1rem;
}

.checklist-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.side-pane .checklist-list {
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
}

.checklist-list li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-1) var(--space-2);
  align-items: start;
  min-width: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  background: var(--color-surface-muted);
  padding: var(--space-3);
  color: var(--color-muted);
  font-size: 0.88rem;
}

.checklist-list li strong {
  grid-column: 2;
  color: var(--color-text);
  font-size: 0.82rem;
}

.checklist-list li.is-complete {
  border-color: rgba(22, 135, 93, 0.4);
  background: var(--color-success-soft);
  color: var(--color-text);
}

.checkmark {
  color: var(--color-success);
  font-weight: 900;
}

.research-list {
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  align-items: start;
  gap: var(--space-3);
}

.research-track {
  display: grid;
  gap: var(--space-3);
}

.research-track__header h4,
.research-track__header p,
.research-card h5,
.research-card p,
.event-card h4,
.event-card p,
.location-card h4,
.location-card p,
.encounter-card h4,
.encounter-card p {
  margin-top: 0;
}

.research-track__header h4,
.event-card h4 {
  margin-bottom: var(--space-1);
}

.research-track__header p,
.research-card p {
  margin-bottom: 0;
}

.research-card {
  display: grid;
  gap: var(--space-3);
  background: var(--color-surface);
}

.research-card.is-purchased {
  border-color: rgba(22, 135, 93, 0.42);
  background: var(--color-success-soft);
}

.research-card--exclusive-branch {
  gap: 0;
  overflow: hidden;
  padding: 0;
}

.research-branch__header {
  border-bottom: 1px solid var(--color-border);
  background: var(--color-warning-soft);
  color: var(--color-warning);
  padding: var(--space-2) var(--space-3);
}

.research-branch__header strong {
  font-size: 0.82rem;
}

.research-branch__options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.research-branch__option {
  display: grid;
  align-content: space-between;
  gap: var(--space-3);
  min-width: 0;
  padding: var(--space-3);
}

.research-branch__option + .research-branch__option {
  border-left: 1px solid var(--color-border);
}

.research-branch__option.is-purchased {
  background: rgba(231, 245, 238, 0.8);
}

.research-branch__option.is-blocked {
  background: rgba(238, 243, 248, 0.82);
}

.research-card h5 {
  margin-bottom: var(--space-1);
  font-size: 0.98rem;
}

.research-card__footer {
  flex-wrap: wrap;
}

.research-card__exclusive {
  color: var(--color-warning);
  font-size: 0.78rem;
  font-weight: 800;
}

.research-card__footer button {
  min-height: 2.35rem;
  padding: 0 var(--space-3);
}

.status-pill {
  border-radius: 999px;
  padding: 0.15rem var(--space-2);
  font-size: 0.78rem;
  font-weight: 800;
}

.status-pill.is-good {
  background: var(--color-success-soft);
  color: var(--color-success);
}

.status-pill.is-waiting {
  background: var(--color-warning-soft);
  color: var(--color-warning);
}

.event-card {
  background: var(--color-surface);
}

.event-choice-list {
  display: grid;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.primary-button {
  border-color: var(--color-accent);
  background: var(--color-accent);
  color: #ffffff;
  font-weight: 800;
  box-shadow: var(--shadow-control);
}

.primary-button:hover:not(:disabled),
.primary-button:focus-visible:not(:disabled) {
  border-color: var(--color-accent-strong);
  background: var(--color-accent-strong);
}

.event-choice-list button:not(:disabled) {
  border-color: var(--color-success);
  background: var(--color-success);
  color: #ffffff;
  font-weight: 800;
  box-shadow: var(--shadow-action);
}

.event-choice-list button:hover:not(:disabled),
.event-choice-list button:focus-visible:not(:disabled) {
  border-color: var(--color-success-strong);
  background: var(--color-success-strong);
}

.event-choice-list button:focus-visible:not(:disabled) {
  outline-color: var(--color-success-focus);
}

.research-card__footer button:not(:disabled) {
  border-color: var(--color-accent);
  background: var(--color-accent);
  color: #ffffff;
  font-weight: 800;
  box-shadow: var(--shadow-control);
}

.research-card__footer button:hover:not(:disabled),
.research-card__footer button:focus-visible:not(:disabled) {
  border-color: var(--color-accent-strong);
  background: var(--color-accent-strong);
}

.activity-log {
  margin: 0;
  padding-left: 1.25rem;
}

.activity-log li + li {
  margin-top: var(--space-2);
}

.ending-view[hidden] {
  display: none;
}

.noscript-message {
  margin: var(--space-4) 0 0;
  color: var(--color-warning);
}

@media (max-width: 1100px) {
  .resource-strip {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .progress-strip {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .dashboard-header__actions {
    grid-column: 2;
    grid-row: 1;
  }

  .feed-pane {
    max-height: none;
  }

  .command-grid {
    grid-template-columns: 1fr;
  }

  .encounter-card--rival-battle {
    grid-template-columns: 1fr;
  }

  .rival-battle-card__enemy,
  .rival-battle-card__scene,
  .rival-battle-card__choices {
    grid-column: 1;
  }

  .rival-battle-card__choices {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-top: 1px solid rgba(216, 224, 234, 0.9);
    border-left: 0;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 1rem, 1180px);
    padding: var(--space-3) 0;
  }

  .language-gate {
    min-height: calc(100vh - 1.5rem);
  }

  .language-gate__content,
  .panel,
  .progress-strip {
    padding: var(--space-4);
  }

  .game-app-shell {
    grid-template-columns: 1fr;
  }

  .game-nav {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-3);
    padding: var(--space-3);
    border-right: 0;
    border-bottom: 1px solid var(--color-border);
  }

  .game-nav__links {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--space-1);
  }

  .game-nav__links button {
    padding: var(--space-2);
    text-align: center;
  }

  .game-main {
    padding: var(--space-2);
  }

  .resource-strip,
  .game-workspace,
  .language-grid,
  .resource-list,
  .checklist-list,
  .research-branch__options,
  .location-card {
    grid-template-columns: 1fr;
  }

  .research-branch__option + .research-branch__option {
    border-top: 1px solid var(--color-border);
    border-left: 0;
  }

  .progress-strip {
    align-items: stretch;
  }

  .dashboard-header__actions {
    justify-content: stretch;
  }

  .dashboard-header__actions button {
    flex: 1 1 8rem;
  }

  .progress-strip {
    grid-template-columns: 1fr max-content;
  }

  .progress-meter {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .rival-battle-card {
    flex-direction: column;
  }

  .rival-battle-card__choices {
    grid-template-columns: 1fr;
  }

  .rival-battle-card__enemy {
    flex-basis: auto;
    border-right: 0;
    border-bottom: 1px solid rgba(216, 224, 234, 0.9);
  }

  .rival-encounter {
    gap: var(--space-2);
  }

  .rival-battle-card__enemy {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    justify-items: start;
    border-right: 0;
    border-bottom: 1px solid rgba(216, 224, 234, 0.9);
    text-align: left;
  }

  .rival-battle-card__enemy-copy {
    justify-items: start;
  }

  .rival-avatar {
    width: 68px;
    height: 68px;
    flex-basis: 68px;
  }

  .rival-avatar__frame {
    transform: scale(0.773);
  }
}
