:root {
  color-scheme: dark;
  --bg: #111318;
  --panel: #191d25;
  --panel-soft: #212734;
  --panel-muted: #2a3142;
  --text: #f4f7fb;
  --muted: #aab4c7;
  --accent: #6ee7b7;
  --accent-strong: #34d399;
  --danger: #fb7185;
  --warn: #fbbf24;
  --border: rgba(255, 255, 255, 0.08);
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top, rgba(52, 211, 153, 0.1), transparent 24%),
    linear-gradient(180deg, #0c0f14 0%, #151925 100%);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 120ms ease, opacity 120ms ease, background 120ms ease;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.shell {
  max-width: 1360px;
  margin: 0 auto;
  padding: 20px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 16px 18px;
  margin-bottom: 20px;
  background: rgba(17, 19, 24, 0.88);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.eyebrow,
.hint,
.stat span,
.small-label,
.meta,
.section-subtext {
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(88px, 1fr));
  gap: 12px;
  min-width: min(100%, 520px);
}

.stat {
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.stat span {
  display: block;
  font-size: 12px;
  margin-bottom: 8px;
}

.stat strong {
  font-size: 22px;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(330px, 0.88fr);
  gap: 20px;
}

.phone,
.section-block,
.auth-card {
  background: rgba(25, 29, 37, 0.92);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.phone {
  padding: 20px;
}

.phone-speaker {
  width: 96px;
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  margin: 0 auto 18px;
}

.phone-screen {
  display: grid;
  gap: 16px;
}

.mode-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.mode-tab,
.auth-card button,
.deal-actions button,
.inventory-card button,
.action-card button,
.composer button,
.cta-button {
  background: var(--accent-strong);
  color: #062218;
  font-weight: 700;
  padding: 12px 14px;
}

.mode-tab {
  background: var(--panel-soft);
  color: var(--text);
}

.mode-tab.is-active {
  background: var(--accent-strong);
  color: #062218;
}

.market-header,
.chat-head,
.section-title,
.mode-card,
.listing-card,
.inventory-card,
.action-card,
.event-entry,
.gate-card {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.market-header,
.chat-head,
.section-title,
.mode-card,
.listing-card,
.inventory-card,
.action-card,
.event-entry,
.auth-card,
.gate-card {
  align-items: center;
}

.badge,
.pill {
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(110, 231, 183, 0.12);
  color: var(--accent);
  font-size: 12px;
  border: 1px solid rgba(110, 231, 183, 0.2);
}

.panel-stack,
.listing-panel,
.messages,
.inventory-grid,
.action-grid,
.event-log,
.modes-list,
.meta-grid {
  display: grid;
  gap: 12px;
}

.listing-card,
.inventory-card,
.action-card,
.mode-card,
.gate-card,
.auth-card {
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
}

.listing-card,
.inventory-card,
.action-card,
.mode-card,
.gate-card {
  align-items: flex-start;
}

.listing-main,
.inventory-main,
.action-main {
  display: grid;
  gap: 6px;
}

.price-line,
.detail-line {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
}

.chat-panel {
  min-height: 540px;
  background: linear-gradient(180deg, rgba(18, 22, 30, 0.95), rgba(24, 29, 39, 0.95));
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 14px;
}

.messages {
  min-height: 320px;
  max-height: 420px;
  overflow: auto;
  padding-right: 6px;
}

.message {
  max-width: 82%;
  padding: 10px 12px;
  border-radius: 10px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.message.system {
  justify-self: center;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 13px;
}

.message.buyer {
  justify-self: start;
  background: #20283a;
}

.message.player {
  justify-self: end;
  background: rgba(52, 211, 153, 0.18);
  border: 1px solid rgba(52, 211, 153, 0.24);
}

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

.composer input,
.auth-card input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0f131b;
  color: var(--text);
}

.control-panel {
  display: grid;
  gap: 16px;
}

.section-block {
  padding: 16px;
}

.section-title {
  margin-bottom: 14px;
}

.section-title button,
.inventory-card button,
.action-card button {
  padding: 8px 10px;
}

.icon-button,
.secondary {
  background: var(--panel-muted) !important;
  color: var(--text) !important;
}

.danger {
  background: rgba(251, 113, 133, 0.18) !important;
  color: #ffd6dd !important;
}

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

.log-block {
  min-height: 260px;
}

.event-log {
  max-height: 220px;
  overflow: auto;
}

.event-entry {
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.event-entry time {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

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

.meta-box {
  padding: 12px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
}

.gate-card,
.auth-card {
  flex-direction: column;
  align-items: stretch;
}

.gate-card {
  gap: 12px;
}

.auth-shell {
  display: grid;
  gap: 16px;
}

.auth-card {
  gap: 12px;
}

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

.empty-state {
  padding: 24px 16px;
  text-align: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed var(--border);
  border-radius: 10px;
}

.hidden {
  display: none !important;
}

@media (max-width: 1080px) {
  .game-layout {
    grid-template-columns: 1fr;
  }

  .stats {
    min-width: 0;
  }
}

@media (max-width: 720px) {
  .shell {
    padding: 12px;
  }

  .topbar {
    position: static;
    flex-direction: column;
    align-items: stretch;
  }

  .stats,
  .mode-tabs,
  .deal-actions,
  .auth-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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