:root {
  color-scheme: dark;
  --bg: #090d14;
  --bg-deep: #060910;
  --panel: #101721;
  --panel-raised: #131c28;
  --panel-soft: #0d141e;
  --line: rgba(178, 194, 218, 0.14);
  --line-strong: rgba(178, 194, 218, 0.24);
  --text: #edf3fb;
  --muted: #8592a7;
  --muted-bright: #b6c2d4;
  --purple: #9d86ff;
  --purple-light: #c8bcff;
  --pink: #f28ebf;
  --gold: #e5bd71;
  --cyan: #72c8d8;
  --success: #79d19f;
  --danger: #e98091;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.2);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  background:
    linear-gradient(rgba(154, 170, 198, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(154, 170, 198, 0.025) 1px, transparent 1px),
    radial-gradient(circle at 65% -12%, rgba(93, 104, 184, 0.16), transparent 33rem),
    var(--bg);
  background-size: 42px 42px, 42px 42px, auto, auto;
  letter-spacing: 0.01em;
}

button {
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

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

.app-shell {
  width: min(1660px, 100%);
  margin: 0 auto;
  padding: 22px 28px 18px;
}

.topbar,
.game-layout,
.footer-note {
  width: 100%;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 56px;
  margin-bottom: 22px;
  padding-bottom: 17px;
  border-bottom: 1px solid var(--line);
}

.brand-block,
.topbar-actions,
.resource-pill,
.panel-heading,
.hero-heading,
.level-line,
.hero-actions,
.action-note,
.skill-title-row,
.skill-bottom-row,
.footer-note,
.status-chip,
.live-label,
.run-state,
.codex-item,
.offline-time,
.offline-rewards,
.milestone-card,
.panel-footnote {
  display: flex;
  align-items: center;
}

.brand-block {
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  width: 39px;
  height: 39px;
  flex: 0 0 auto;
  place-items: center;
  color: #ffedb4;
  border: 1px solid rgba(229, 189, 113, 0.42);
  border-radius: 9px;
  background: rgba(229, 189, 113, 0.1);
  font-size: 18px;
}

.brand-copy {
  min-width: 0;
}

.eyebrow,
.section-kicker {
  margin: 0 0 4px;
  color: var(--purple-light);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.topbar h1 {
  overflow: hidden;
  margin: 0;
  font-size: clamp(18px, 2vw, 24px);
  font-weight: 800;
  letter-spacing: -0.035em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar h1 span {
  color: var(--muted);
  font-weight: 500;
}

.topbar-actions {
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.run-state {
  gap: 7px;
  min-height: 34px;
  padding: 0 10px;
  color: var(--success);
  border: 1px solid rgba(121, 209, 159, 0.2);
  border-radius: 7px;
  background: rgba(121, 209, 159, 0.06);
  font-size: 10px;
  font-weight: 700;
}

.run-state i,
.status-chip i,
.event-status i,
.live-label i {
  display: block;
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 9px currentColor;
}

.resource-pill {
  min-width: 105px;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(16, 23, 33, 0.92);
}

.resource-icon {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 6px;
  font-size: 14px;
}

.resource-icon.purple {
  color: var(--purple-light);
  background: rgba(157, 134, 255, 0.13);
}

.resource-icon.gold {
  color: var(--gold);
  background: rgba(229, 189, 113, 0.13);
}

.resource-label,
.resource-pill strong {
  display: block;
}

.resource-label {
  color: var(--muted);
  font-size: 9px;
}

.resource-pill strong {
  margin-top: 1px;
  font-size: 14px;
  letter-spacing: 0.02em;
}

.icon-button,
.modal-close {
  display: grid;
  place-items: center;
  color: var(--muted-bright);
  background: var(--panel-raised);
  border: 1px solid var(--line);
}

.icon-button {
  width: 35px;
  height: 35px;
  border-radius: 7px;
  font-size: 21px;
  line-height: 1;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}

.icon-button:hover {
  color: var(--gold);
  border-color: rgba(229, 189, 113, 0.45);
  background: rgba(229, 189, 113, 0.1);
}

.utility-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 35px;
  padding: 0 9px;
  color: var(--muted-bright);
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-raised);
  font-size: 9px;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}

.utility-button span:first-child {
  color: var(--cyan);
  font-size: 14px;
  line-height: 1;
}

.utility-button:hover {
  color: var(--text);
  border-color: rgba(114, 200, 216, 0.45);
  background: rgba(114, 200, 216, 0.09);
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(285px, 0.76fr) minmax(440px, 1.42fr) minmax(285px, 0.82fr);
  align-items: start;
  gap: 14px;
}

.control-column,
.main-column,
.record-column {
  display: grid;
  align-content: start;
  gap: 14px;
  min-width: 0;
}

.main-column {
  min-width: 0;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

.panel-heading {
  justify-content: space-between;
  gap: 12px;
}

.panel-heading h2,
.workspace-heading h2 {
  margin: 0;
  font-size: 17px;
  letter-spacing: -0.025em;
}

.workspace-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 15px;
  min-height: 48px;
  padding: 1px 2px 0;
}

.workspace-heading > p {
  max-width: 370px;
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
  text-align: right;
}

.hero-panel {
  overflow: hidden;
  padding: 17px;
}

.hero-heading {
  margin-bottom: 14px;
}

.status-chip {
  gap: 6px;
  padding: 5px 7px;
  color: var(--success);
  border: 1px solid rgba(121, 209, 159, 0.17);
  border-radius: 6px;
  background: rgba(121, 209, 159, 0.06);
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
}

.idle-summary {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.idle-summary-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.idle-emblem {
  display: grid;
  width: 39px;
  height: 39px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--gold);
  border: 1px solid rgba(229, 189, 113, 0.35);
  border-radius: 8px;
  background: rgba(229, 189, 113, 0.09);
  font-size: 19px;
}

.idle-summary-copy {
  min-width: 0;
  flex: 1;
}

.idle-summary-copy .section-kicker {
  margin-bottom: 2px;
}

.idle-summary-copy h3 {
  overflow: hidden;
  margin: 0;
  font-size: 13px;
  letter-spacing: -0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.idle-summary-copy p:last-child {
  overflow: hidden;
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.console-label {
  align-self: flex-start;
  padding: 4px 5px;
  color: var(--purple-light);
  border: 1px solid rgba(157, 134, 255, 0.24);
  border-radius: 4px;
  background: rgba(157, 134, 255, 0.08);
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.idle-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding-top: 11px;
}

.idle-summary-grid > div {
  min-width: 0;
  padding: 0 8px;
  border-right: 1px solid var(--line);
}

.idle-summary-grid > div:first-child {
  padding-left: 0;
}

.idle-summary-grid > div:last-child {
  padding-right: 0;
  border-right: 0;
}

.idle-summary-grid span,
.idle-summary-grid strong {
  display: block;
}

.idle-summary-grid span {
  color: var(--muted);
  font-size: 8px;
}

.idle-summary-grid strong {
  overflow: hidden;
  margin-top: 4px;
  color: var(--muted-bright);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.idle-summary-grid strong i {
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 3px;
  vertical-align: 1px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 7px var(--success);
}

.level-module {
  padding: 15px 1px 0;
}

.module-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 9px;
}

.module-hint b {
  color: var(--purple-light);
  font-weight: 700;
}

.level-line {
  gap: 9px;
  margin-bottom: 8px;
}

.level-badge {
  padding: 5px 7px;
  color: var(--gold);
  border: 1px solid rgba(229, 189, 113, 0.3);
  border-radius: 5px;
  background: rgba(229, 189, 113, 0.08);
  font-size: 8px;
  font-weight: 800;
}

.level-badge strong {
  margin-left: 2px;
  font-size: 13px;
}

.title-block {
  min-width: 0;
  flex: 1;
}

.title-block strong,
.title-block span {
  display: block;
}

.title-block strong {
  font-size: 12px;
}

.title-block span {
  margin-top: 1px;
  color: var(--muted);
  font-size: 9px;
}

.progress-track {
  height: 6px;
  overflow: hidden;
  border-radius: 2px;
  background: rgba(135, 150, 178, 0.13);
}

.progress-track.large {
  height: 8px;
}

.progress-track span {
  display: block;
  height: 100%;
  min-width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #7d6be2, #b88bd2, #e5bd71);
  box-shadow: 0 0 12px rgba(157, 134, 255, 0.4);
  transition: width 250ms ease;
}

.hero-actions {
  align-items: stretch;
  gap: 9px;
  margin-top: 15px;
}

.primary-button {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 49px;
  padding: 8px 10px;
  border: 1px solid rgba(211, 199, 255, 0.28);
  border-radius: 8px;
  background: #6254b7;
  box-shadow: 0 8px 18px rgba(54, 44, 122, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  transition: transform 140ms ease, filter 140ms ease, box-shadow 140ms ease;
}

.primary-button:hover {
  filter: brightness(1.1);
  box-shadow: 0 10px 22px rgba(54, 44, 122, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.primary-button:active {
  transform: translateY(1px);
}

.button-glyph {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border-radius: 6px;
  color: #fff3c8;
  background: rgba(255, 255, 255, 0.12);
  font-size: 15px;
}

.primary-button strong,
.primary-button small {
  display: block;
  text-align: left;
}

.primary-button strong {
  font-size: 11px;
}

.primary-button small {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.66);
  font-size: 8px;
}

.train-button {
  min-width: 0;
  flex: 1;
}

kbd {
  margin-left: auto;
  padding: 3px 5px;
  color: rgba(255, 255, 255, 0.52);
  border: 1px solid rgba(255, 255, 255, 0.17);
  border-bottom-width: 2px;
  border-radius: 4px;
  font-size: 7px;
  letter-spacing: 0.08em;
}

.action-note {
  gap: 6px;
  color: var(--muted);
  font-size: 9px;
  white-space: nowrap;
}

.action-note strong {
  color: var(--purple-light);
}

.mini-orb {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--purple);
  box-shadow: 0 0 9px rgba(157, 134, 255, 0.8);
}

.quick-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 15px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

.quick-stat {
  min-width: 0;
  padding: 0 8px;
  border-right: 1px solid var(--line);
}

.quick-stat:first-child { padding-left: 0; }
.quick-stat:last-child { padding-right: 0; border-right: 0; }

.quick-stat span,
.quick-stat strong,
.quick-stat small {
  display: block;
}

.quick-stat span,
.quick-stat small {
  color: var(--muted);
  font-size: 8px;
}

.quick-stat strong {
  margin: 3px 0;
  font-size: 16px;
}

.panel-footnote {
  gap: 6px;
  margin-top: 15px;
  padding-top: 11px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 8px;
}

.footnote-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.overview-card {
  position: relative;
  min-height: 100px;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  overflow: hidden;
  padding: 14px;
}

.overview-card::after {
  position: absolute;
  right: -25px;
  bottom: -35px;
  width: 100px;
  height: 100px;
  content: "";
  border-radius: 50%;
  opacity: 0.1;
  background: currentColor;
  filter: blur(21px);
}

.overview-card.accent-purple { color: var(--purple); }
.overview-card.accent-gold { color: var(--gold); }
.overview-card.accent-pink { color: var(--pink); }

.overview-icon {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 7px;
  background: color-mix(in srgb, currentColor 11%, transparent);
  font-size: 16px;
}

.overview-card > div:nth-child(2) {
  min-width: 0;
}

.overview-card span,
.overview-card strong,
.overview-card small {
  display: block;
}

.overview-card span,
.overview-card small {
  color: var(--muted);
  font-size: 9px;
}

.overview-card strong {
  margin: 3px 0;
  color: var(--text);
  font-size: 21px;
  letter-spacing: -0.04em;
}

.overview-card small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sparkline {
  position: absolute;
  right: 12px;
  bottom: 15px;
  display: flex;
  align-items: end;
  gap: 3px;
  height: 24px;
}

.sparkline i {
  display: block;
  width: 3px;
  border-radius: 2px 2px 1px 1px;
  background: currentColor;
  opacity: 0.62;
}

.sparkline i:nth-child(1) { height: 7px; }
.sparkline i:nth-child(2) { height: 10px; }
.sparkline i:nth-child(3) { height: 9px; }
.sparkline i:nth-child(4) { height: 15px; }
.sparkline i:nth-child(5) { height: 13px; }
.sparkline i:nth-child(6) { height: 20px; }
.sparkline i:nth-child(7) { height: 24px; opacity: 0.95; }

.mini-ring {
  position: absolute;
  right: 14px;
  bottom: 15px;
  width: 29px;
  height: 29px;
  border: 3px solid rgba(229, 189, 113, 0.13);
  border-radius: 50%;
}

.mini-ring span {
  position: absolute;
  inset: -3px;
  display: block;
  border-radius: 50%;
  background: conic-gradient(var(--gold) var(--progress, 0deg), transparent 0deg);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 0);
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 0);
  transform: rotate(-90deg);
}

.power-bars {
  position: absolute;
  right: 14px;
  bottom: 15px;
  display: flex;
  align-items: end;
  gap: 3px;
  height: 24px;
}

.power-bars i {
  width: 4px;
  border-radius: 3px 3px 1px 1px;
  background: var(--pink);
  opacity: 0.72;
}

.power-bars i:nth-child(1) { height: 7px; }
.power-bars i:nth-child(2) { height: 12px; }
.power-bars i:nth-child(3) { height: 16px; }
.power-bars i:nth-child(4) { height: 20px; }
.power-bars i:nth-child(5) { height: 23px; opacity: 0.26; }

.cultivation-panel,
.automation-panel,
.activity-panel,
.codex-panel {
  padding: 17px;
}

.automation-panel {
  background: #111b28;
}

.compact-heading {
  margin-bottom: 14px;
}

.event-status {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--success);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.automation-copy {
  margin: -4px 0 12px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.55;
}

.strategy-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.strategy-button {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  min-width: 0;
  padding: 9px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
  text-align: left;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.strategy-button:hover {
  border-color: var(--line-strong);
  background: var(--panel-raised);
}

.strategy-button.active {
  border-color: rgba(229, 189, 113, 0.48);
  background: rgba(229, 189, 113, 0.08);
  box-shadow: inset 0 0 0 1px rgba(229, 189, 113, 0.06);
  transform: translateY(-1px);
}

.strategy-index {
  display: grid;
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--muted);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font-size: 8px;
  font-weight: 800;
}

.strategy-button.active .strategy-index {
  color: var(--gold);
  border-color: rgba(229, 189, 113, 0.45);
}

.strategy-button strong,
.strategy-button small {
  display: block;
}

.strategy-button strong {
  color: var(--text);
  font-size: 10px;
}

.strategy-button small {
  overflow: hidden;
  margin-top: 3px;
  color: var(--muted);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.automation-stats {
  display: grid;
  grid-template-columns: 0.72fr 0.72fr 1.56fr;
  gap: 0;
  margin-top: 12px;
  padding-top: 11px;
  border-top: 1px solid var(--line);
}

.automation-stats > div {
  min-width: 0;
  padding: 0 9px;
  border-right: 1px solid var(--line);
}

.automation-stats > div:first-child { padding-left: 0; }
.automation-stats > div:last-child { padding-right: 0; border-right: 0; }

.automation-stats span,
.automation-stats strong {
  display: block;
}

.automation-stats span {
  color: var(--muted);
  font-size: 8px;
}

.automation-stats strong {
  overflow: hidden;
  margin-top: 4px;
  color: var(--muted-bright);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cultivation-panel .panel-heading {
  margin-bottom: 14px;
}

.ghost-button {
  padding: 7px 9px;
  color: var(--gold);
  border: 1px solid rgba(229, 189, 113, 0.27);
  border-radius: 6px;
  background: rgba(229, 189, 113, 0.06);
  font-size: 9px;
  transition: background 160ms ease, border-color 160ms ease, opacity 160ms ease;
}

.ghost-button:hover:not(:disabled) {
  border-color: rgba(229, 189, 113, 0.5);
  background: rgba(229, 189, 113, 0.12);
}

.ghost-button span {
  margin-left: 4px;
  color: #ffefb8;
  font-weight: 800;
}

.ghost-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.skills-list {
  display: grid;
  gap: 7px;
}

.skill-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 70px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  transition: border-color 160ms ease, background 160ms ease;
}

.skill-card:hover {
  border-color: var(--line-strong);
  background: var(--panel-raised);
}

.skill-icon {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 7px;
  font-size: 19px;
}

.moon-icon { color: #c4b6ff; background: rgba(125, 107, 226, 0.2); }
.sigil-icon { color: #ef9dc8; background: rgba(190, 90, 148, 0.18); }
.star-icon { color: #ffdc8e; background: rgba(206, 151, 67, 0.18); }

.skill-info {
  min-width: 0;
  flex: 1;
}

.skill-title-row {
  gap: 7px;
}

.skill-title-row h3 {
  margin: 0;
  font-size: 11px;
}

.skill-level {
  padding: 2px 4px;
  color: var(--purple-light);
  border-radius: 3px;
  background: rgba(157, 134, 255, 0.11);
  font-size: 8px;
  font-weight: 800;
}

.skill-info p {
  overflow: hidden;
  margin: 4px 0 7px;
  color: var(--muted);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.skill-bottom-row {
  justify-content: space-between;
  gap: 8px;
}

.skill-effect {
  color: var(--muted-bright);
  font-size: 8px;
}

.upgrade-button {
  padding: 5px 7px;
  color: #eee9ff;
  border: 1px solid rgba(157, 134, 255, 0.3);
  border-radius: 5px;
  background: rgba(125, 107, 226, 0.15);
  font-size: 8px;
  transition: background 160ms ease, border-color 160ms ease, opacity 160ms ease;
}

.upgrade-button:hover:not(:disabled) {
  border-color: rgba(195, 181, 255, 0.62);
  background: rgba(125, 107, 226, 0.28);
}

.upgrade-button b {
  margin-left: 2px;
  color: var(--gold);
}

.upgrade-button:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.activity-panel,
.codex-panel {
  overflow: hidden;
}

.live-label {
  gap: 6px;
  color: var(--pink);
  font-size: 8px;
  font-weight: 700;
}

.activity-list {
  display: grid;
  gap: 1px;
  min-height: 180px;
}

.activity-item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(178, 194, 218, 0.08);
}

.activity-item:last-child {
  border-bottom: 0;
}

.activity-icon {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 5px;
  color: var(--purple-light);
  background: rgba(157, 134, 255, 0.11);
  font-size: 11px;
}

.activity-item.crit .activity-icon {
  color: var(--gold);
  background: rgba(229, 189, 113, 0.12);
}

.activity-copy {
  min-width: 0;
}

.activity-copy strong,
.activity-copy small {
  display: block;
}

.activity-copy strong {
  overflow: hidden;
  font-size: 9px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-copy small,
.activity-time {
  color: var(--muted);
  font-size: 8px;
}

.activity-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-value {
  color: var(--success);
  font-size: 8px;
  font-weight: 800;
  white-space: nowrap;
}

.activity-time {
  display: block;
  margin-top: 2px;
  text-align: right;
}

.empty-log {
  display: grid;
  min-height: 160px;
  place-items: center;
  color: var(--muted);
  font-size: 9px;
  text-align: center;
}

.codex-count {
  color: var(--muted);
  font-size: 9px;
}

.milestone-card {
  gap: 9px;
  margin-bottom: 11px;
  padding: 10px;
  border: 1px solid rgba(229, 189, 113, 0.18);
  border-radius: 8px;
  background: rgba(229, 189, 113, 0.06);
}

.milestone-medal {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--gold);
  border: 1px solid rgba(229, 189, 113, 0.35);
  border-radius: 50%;
  background: rgba(229, 189, 113, 0.08);
  font-size: 15px;
}

.milestone-card > div:last-child {
  min-width: 0;
  flex: 1;
}

.milestone-card strong,
.milestone-card p,
.milestone-card small {
  display: block;
}

.milestone-card strong {
  font-size: 10px;
}

.milestone-card p {
  overflow: hidden;
  margin: 3px 0 6px;
  color: var(--muted);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.milestone-card small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 8px;
  text-align: right;
}

.milestone-card .progress-track span {
  background: linear-gradient(90deg, #b48a55, #e5bd71);
  box-shadow: 0 0 10px rgba(229, 189, 113, 0.28);
}

.codex-list {
  display: grid;
  gap: 1px;
}

.codex-item {
  gap: 7px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(178, 194, 218, 0.08);
}

.codex-item:last-child {
  border-bottom: 0;
}

.codex-item > span {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  color: var(--muted-bright);
  border-radius: 5px;
  background: rgba(157, 134, 255, 0.08);
  font-size: 11px;
}

.codex-item div {
  min-width: 0;
  flex: 1;
}

.codex-item strong,
.codex-item small {
  display: block;
}

.codex-item strong {
  font-size: 9px;
}

.codex-item small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 8px;
}

.codex-item b {
  color: var(--muted);
  font-size: 8px;
  font-weight: 500;
  white-space: nowrap;
}

.codex-item.completed > span {
  color: var(--gold);
  background: rgba(229, 189, 113, 0.13);
}

.codex-item.completed b {
  color: var(--success);
}

.footer-note {
  justify-content: space-between;
  gap: 12px;
  padding: 13px 2px 0;
  color: #657286;
  font-size: 8px;
}

.footer-note b {
  color: var(--success);
  font-weight: 700;
}

.toast-stack {
  position: fixed;
  z-index: 100;
  right: 17px;
  bottom: 17px;
  display: grid;
  gap: 7px;
  width: min(290px, calc(100vw - 34px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(16, 23, 33, 0.97);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  animation: toast-in 180ms ease-out both;
}

.toast.fade-out {
  animation: toast-out 180ms ease-in both;
}

.toast-icon {
  color: var(--gold);
  font-size: 14px;
}

.toast strong,
.toast small {
  display: block;
}

.toast strong {
  font-size: 10px;
}

.toast small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.45;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(6px); }
}

.modal-backdrop {
  position: fixed;
  z-index: 90;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 17px;
  background: rgba(4, 7, 12, 0.76);
  backdrop-filter: blur(5px);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-card {
  position: relative;
  width: min(390px, 100%);
  padding: 26px 23px 22px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--panel-raised);
  box-shadow: 0 24px 55px rgba(0, 0, 0, 0.5);
  text-align: center;
}

.modal-emblem {
  display: grid;
  width: 48px;
  height: 48px;
  margin: 0 auto 13px;
  place-items: center;
  color: var(--gold);
  border: 1px solid rgba(229, 189, 113, 0.34);
  border-radius: 10px;
  background: rgba(229, 189, 113, 0.09);
  font-size: 23px;
}

.modal-card .section-kicker {
  margin-bottom: 6px;
}

.modal-card h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.04em;
}

.modal-copy {
  margin: 8px 0 17px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.65;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 25px;
  height: 25px;
  border-radius: 6px;
  font-size: 18px;
  line-height: 1;
}

.offline-time {
  justify-content: space-between;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
  font-size: 9px;
}

.offline-time span {
  color: var(--muted);
}

.offline-time strong {
  color: var(--purple-light);
  font-size: 11px;
}

.offline-rewards {
  gap: 7px;
  margin: 7px 0 17px;
}

.offline-rewards > div,
.offline-events > div {
  flex: 1;
  padding: 10px 7px;
  border: 1px solid rgba(229, 189, 113, 0.14);
  border-radius: 7px;
  background: rgba(229, 189, 113, 0.05);
}

.offline-events {
  display: flex;
  gap: 6px;
  margin: -8px 0 11px;
}

.offline-events > div {
  padding: 8px 5px;
  border-color: rgba(157, 134, 255, 0.15);
  background: rgba(157, 134, 255, 0.05);
}

.offline-events span,
.offline-events strong {
  display: block;
}

.offline-events span {
  color: var(--muted);
  font-size: 8px;
}

.offline-events strong {
  margin-top: 3px;
  color: var(--purple-light);
  font-size: 11px;
}

.offline-event-note {
  margin: -1px 0 15px;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.5;
}

.offline-rewards span,
.offline-rewards strong {
  display: block;
}

.offline-rewards span {
  color: var(--muted);
  font-size: 8px;
}

.offline-rewards strong {
  margin-top: 3px;
  color: var(--gold);
  font-size: 16px;
}

.modal-button {
  width: 100%;
  justify-content: center;
}

.secondary-button {
  min-height: 49px;
  padding: 8px 15px;
  color: var(--muted-bright);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel-soft);
  font-size: 10px;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}

.secondary-button:hover {
  color: var(--text);
  border-color: rgba(178, 194, 218, 0.42);
  background: var(--panel-raised);
}

.modal-actions {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.modal-actions .modal-button {
  flex: 1;
}

.import-emblem {
  color: var(--cyan);
  border-color: rgba(114, 200, 216, 0.35);
  background: rgba(114, 200, 216, 0.08);
}

.import-preview {
  display: grid;
  gap: 7px;
  margin: -2px 0 16px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
  color: var(--muted-bright);
  font-size: 9px;
  line-height: 1.5;
  text-align: left;
}

.import-preview[hidden] {
  display: none;
}

.import-preview strong {
  color: var(--text);
}

@media (max-width: 1240px) {
  .game-layout {
    grid-template-columns: minmax(275px, 0.8fr) minmax(430px, 1.4fr);
  }

  .record-column {
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
    align-items: start;
  }
}

@media (max-width: 900px) {
  .app-shell {
    padding: 18px 16px 16px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
  }

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

  .record-column {
    grid-column: auto;
    grid-template-columns: 1fr;
  }

  .workspace-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .workspace-heading > p {
    max-width: none;
    text-align: left;
  }
}

@media (max-width: 560px) {
  .brand-copy {
    max-width: calc(100vw - 80px);
  }

  .topbar h1 {
    font-size: 18px;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 35px auto;
  }

  .run-state {
    justify-content: center;
    grid-column: 1 / -1;
  }

  .utility-button {
    justify-content: center;
    padding: 0 8px;
  }

  .utility-button span:last-child {
    display: none;
  }

  .modal-actions {
    flex-direction: column-reverse;
  }

  .secondary-button {
    width: 100%;
  }

  .resource-pill {
    min-width: 0;
  }

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

  .overview-card {
    min-height: 85px;
  }

  .hero-panel,
  .cultivation-panel,
  .automation-panel,
  .activity-panel,
  .codex-panel {
    padding: 14px;
  }

  .hero-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .train-button {
    width: 100%;
  }

  .action-note {
    justify-content: center;
  }

  .strategy-options {
    grid-template-columns: 1fr;
  }

  .strategy-button small {
    white-space: normal;
  }

  .offline-events {
    flex-wrap: wrap;
  }

  .offline-events > div {
    min-width: calc(50% - 3px);
  }

  .skill-card {
    align-items: flex-start;
  }

  .skill-bottom-row {
    align-items: flex-end;
    flex-direction: column;
  }

  .footer-note {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
