:root {
  color-scheme: dark;
  --ink: #101516;
  --ink-2: #17211f;
  --paper: #f7ecd2;
  --paper-2: #fff8e7;
  --jade: #2abf95;
  --red: #f04f3d;
  --gold: #ffd36f;
  --blue: #64a8ff;
  --rose: #ff5b91;
  --muted: rgba(255, 248, 231, 0.7);
  --line: rgba(255, 231, 176, 0.18);
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  letter-spacing: 0;
}

* {
  box-sizing: border-box;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--paper-2);
  background:
    linear-gradient(135deg, rgba(240, 79, 61, 0.14), transparent 28%),
    linear-gradient(225deg, rgba(42, 191, 149, 0.18), transparent 32%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 9px),
    var(--ink);
}

button,
input,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

.page-shell {
  width: min(1200px, 100%);
  margin: 0 auto;
  padding: 20px;
}

.app {
  min-height: calc(100vh - 40px);
}

.landing-hero {
  position: relative;
  min-height: 270px;
  padding: 28px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(16, 21, 22, 0.1), rgba(16, 21, 22, 0.74)),
    var(--ink-2);
  box-shadow: var(--shadow);
}

.hero-map {
  position: absolute;
  inset: 0;
  background-image: url("../assets/jianghu-map.svg");
  background-size: cover;
  background-position: center;
  opacity: 0.9;
}

.landing-hero > *:not(.hero-map) {
  position: relative;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--gold);
  font-weight: 800;
}

.brand-row img {
  width: 44px;
  height: 44px;
}

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

h1,
h2,
h3 {
  font-family: "STKaiti", "KaiTi", "FangSong", "Microsoft YaHei", serif;
  line-height: 1.12;
}

.landing-hero h1 {
  max-width: 720px;
  margin: 42px 0 16px;
  font-size: clamp(3.4rem, 8vw, 6.8rem);
  color: var(--paper-2);
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.25);
}

.hero-subtitle {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.75;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 800;
}

.layout {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.two-panel {
  grid-template-columns: minmax(0, 1fr) 360px;
  align-items: start;
}

.self-panel,
.trait-card,
.choice-card,
.talent-board,
.stat-board,
.log-item,
.resume-strip,
.chosen-hero,
.name-strip,
.leaderboard-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 248, 231, 0.08);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
}

.avatar,
.avatar-mini,
.avatar-orbit {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 8px;
  color: var(--ink);
  background: linear-gradient(135deg, var(--gold), var(--jade));
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 1.7rem;
  font-weight: 900;
}

.avatar-orbit {
  width: 96px;
  height: 96px;
  margin-bottom: 18px;
  font-size: 3.1rem;
}

.chosen-hero h2,
.talent-board h2 {
  margin-bottom: 12px;
  font-size: 1.65rem;
}

.mini-stats,
.tag-cloud,
.choice-meta,
.action-row,
.top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mini-stats span,
.tag-cloud span,
.choice-meta span {
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 231, 176, 0.2);
  border-radius: 999px;
  color: var(--paper-2);
  background: rgba(16, 21, 22, 0.34);
  font-size: 0.82rem;
}

.primary-action,
.ghost-action,
.choice-button,
.icon-action {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
}

.primary-action,
.choice-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-top: 20px;
  padding: 13px 18px;
  color: #101516;
  background: linear-gradient(135deg, var(--gold), var(--jade));
  font-weight: 900;
}

.primary-action.compact {
  width: auto;
  margin-top: 0;
}

.ghost-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 14px;
  color: var(--paper-2);
  border: 1px solid var(--line);
  background: rgba(255, 248, 231, 0.08);
}

.icon-action {
  display: grid;
  place-items: center;
  width: 44px;
  color: var(--paper-2);
  border: 1px solid var(--line);
  background: rgba(16, 21, 22, 0.48);
}

.resume-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  padding: 14px;
}

.name-strip {
  display: grid;
  grid-template-columns: auto minmax(160px, 260px) minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  padding: 14px;
}

.name-strip label {
  color: var(--gold);
  font-weight: 900;
}

.name-strip input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  color: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(16, 21, 22, 0.55);
}

.name-strip span {
  color: var(--muted);
}

.self-panel {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  align-items: center;
  gap: 22px;
  margin-top: 18px;
  padding: 22px;
}

.self-panel .avatar-orbit {
  margin-bottom: 0;
}

.self-copy input {
  width: min(420px, 100%);
  min-height: 54px;
  margin-bottom: 12px;
  padding: 12px 14px;
  color: var(--paper-2);
  border: 1px solid rgba(255, 211, 111, 0.45);
  border-radius: 8px;
  background: rgba(16, 21, 22, 0.55);
  font-size: 1.35rem;
  font-weight: 900;
}

.self-copy p {
  color: var(--muted);
  line-height: 1.7;
}

.self-copy .primary-action {
  width: min(420px, 100%);
}

.resume-strip strong,
.resume-strip span {
  display: block;
}

.resume-strip span {
  margin-top: 4px;
  color: var(--muted);
}

.trait-stage {
  margin-top: 18px;
}

.chosen-hero {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 18px;
}

.trait-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.trait-card {
  min-height: 245px;
  padding: 18px;
}

.trait-card.locked {
  border-color: rgba(42, 191, 149, 0.8);
  background: rgba(42, 191, 149, 0.13);
}

.trait-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tier {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--ink);
  background: var(--gold);
  font-weight: 900;
}

.trait-card h2 {
  margin: 18px 0 10px;
  font-size: 1.8rem;
}

.trait-card p,
.chosen-hero p,
.choice-card p,
.log-item p,
.ending-summary {
  color: var(--muted);
  line-height: 1.7;
}

.action-row {
  justify-content: flex-end;
  margin-top: 16px;
}

.action-row .primary-action {
  width: auto;
  margin-top: 0;
}

.game-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.game-top h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 3.6rem);
}

.progress-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  margin: 18px 0;
}

.progress-strip span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 248, 231, 0.06);
}

.progress-strip .active {
  color: var(--ink);
  background: var(--gold);
}

.progress-strip .done {
  color: var(--paper-2);
  background: rgba(42, 191, 149, 0.3);
}

.dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
}

.stat-board,
.talent-board {
  padding: 16px;
}

.stat-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.stat-row {
  display: grid;
  gap: 8px;
}

.stat-row > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.stat-row span {
  color: var(--muted);
}

.stat-row strong {
  color: var(--paper-2);
}

.stat-row i {
  display: block;
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 248, 231, 0.11);
}

.stat-row i::before {
  content: "";
  display: block;
  width: var(--value);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--jade), var(--gold));
}

.stat-row.danger i::before {
  background: linear-gradient(90deg, var(--rose), var(--red));
}

.choice-zone,
.log-zone {
  margin-top: 22px;
}

.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.section-title h2 {
  margin-bottom: 0;
  font-size: 2rem;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.choice-card {
  min-height: 300px;
  padding: 18px;
  border-top: 4px solid var(--category);
}

.choice-card h3 {
  margin: 16px 0 10px;
  font-size: 1.72rem;
}

.preview {
  min-height: 58px;
  margin-top: 16px;
  padding: 12px;
  border-radius: 8px;
  color: var(--paper-2);
  background: rgba(16, 21, 22, 0.42);
  line-height: 1.55;
}

.choice-button {
  margin-top: 16px;
}

.log-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.log-item {
  padding: 14px;
}

.log-item time,
.log-item small {
  display: block;
  color: var(--gold);
  font-size: 0.78rem;
}

.log-item strong {
  display: block;
  margin-top: 8px;
}

.log-item p {
  margin: 8px 0;
}

.ending-screen {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 40px);
  padding: 28px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(16, 21, 22, 0.38), rgba(16, 21, 22, 0.9)),
    url("../assets/jianghu-map.svg") center/cover,
    var(--ink-2);
}

.ending-mark img {
  width: 92px;
  height: 92px;
}

.ending-screen h1 {
  margin: 18px 0 10px;
  font-size: clamp(2.6rem, 8vw, 5.6rem);
}

.ending-rank {
  color: var(--gold);
  font-weight: 900;
}

.ending-player {
  margin-bottom: 8px;
  color: var(--jade);
  font-weight: 900;
}

.ending-summary {
  max-width: 700px;
  font-size: 1.08rem;
}

.ending-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 120px));
  gap: 10px;
  width: min(620px, 100%);
  margin: 18px 0;
}

.ending-stats div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(16, 21, 22, 0.56);
}

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

.ending-stats span {
  color: var(--muted);
  font-size: 0.82rem;
}

.ending-stats strong {
  margin-top: 4px;
  color: var(--paper-2);
  font-size: 1.35rem;
}

.centered {
  justify-content: center;
}

.badge {
  color: #101516 !important;
  background: var(--gold) !important;
}

.share-box {
  width: min(680px, 100%);
  min-height: 140px;
  margin-top: 18px;
  padding: 14px;
  resize: vertical;
  color: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(16, 21, 22, 0.68);
  line-height: 1.6;
}

.leaderboard-panel {
  width: 100%;
  margin-top: 18px;
  padding: 16px;
  text-align: left;
}

.leaderboard-list {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.leaderboard-list li {
  display: grid;
  grid-template-columns: 42px minmax(80px, 1fr) minmax(120px, 1.5fr) 72px;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(16, 21, 22, 0.42);
}

.leaderboard-list li.mine {
  border-color: rgba(255, 211, 111, 0.9);
  background: rgba(255, 211, 111, 0.13);
}

.leaderboard-list b,
.leaderboard-list strong {
  color: var(--gold);
}

.leaderboard-list em {
  color: var(--muted);
  font-style: normal;
}

.leaderboard-list .empty-board {
  grid-template-columns: 1fr;
}

.own-rank {
  margin: 12px 0 0;
  color: var(--jade);
  font-weight: 800;
}

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

  .landing-hero {
    min-height: 245px;
    padding: 20px;
  }

  .two-panel,
  .dashboard {
    grid-template-columns: 1fr;
  }

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

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

@media (max-width: 640px) {
  body {
    font-size: 15px;
  }

  .page-shell {
    padding: 8px;
  }

  .app {
    min-height: calc(100vh - 16px);
  }

  .landing-hero {
    min-height: 188px;
    padding: 14px;
  }

  .brand-row {
    gap: 8px;
    font-size: 0.92rem;
  }

  .brand-row img {
    width: 34px;
    height: 34px;
  }

  .landing-hero h1 {
    margin: 28px 0 12px;
    font-size: 2.55rem;
    line-height: 1.04;
  }

  .hero-subtitle {
    font-size: 0.94rem;
    line-height: 1.62;
  }

  .self-panel,
  .trait-card,
  .choice-card,
  .talent-board,
  .stat-board,
  .log-item,
  .resume-strip,
  .chosen-hero,
  .leaderboard-panel {
    border-radius: 8px;
  }

  .self-panel {
    gap: 14px;
    margin-top: 10px;
    padding: 14px;
  }

  .self-panel .avatar-orbit {
    width: 76px;
    height: 76px;
    font-size: 2.35rem;
  }

  .self-copy input {
    min-height: 46px;
    margin-bottom: 10px;
    padding: 9px 11px;
    font-size: 1.12rem;
  }

  .self-copy p {
    margin-bottom: 12px;
    line-height: 1.62;
  }

  .mini-stats,
  .tag-cloud,
  .choice-meta,
  .action-row,
  .top-actions {
    gap: 6px;
  }

  .mini-stats span,
  .tag-cloud span,
  .choice-meta span {
    min-height: 28px;
    padding: 5px 8px;
    font-size: 0.82rem;
    line-height: 1.2;
  }

  .primary-action,
  .ghost-action,
  .choice-button,
  .icon-action {
    min-height: 42px;
  }

  .primary-action,
  .choice-button {
    margin-top: 14px;
    padding: 11px 14px;
  }

  .choice-grid,
  .stat-board,
  .log-list,
  .ending-stats {
    grid-template-columns: 1fr;
  }

  .resume-strip {
    grid-template-columns: 1fr;
  }

  .name-strip,
  .self-panel,
  .leaderboard-list li {
    grid-template-columns: 1fr;
  }

  .chosen-hero,
  .game-top {
    align-items: flex-start;
  }

  .chosen-hero,
  .game-top,
  .section-title {
    flex-direction: column;
  }

  .chosen-hero {
    gap: 12px;
    padding: 14px;
  }

  .avatar-mini {
    width: 46px;
    height: 46px;
    font-size: 1.35rem;
  }

  .chosen-hero h2,
  .talent-board h2 {
    font-size: 1.34rem;
  }

  .trait-stage,
  .trait-grid,
  .choice-zone,
  .log-zone {
    margin-top: 12px;
  }

  .trait-card {
    min-height: 0;
    padding: 14px;
  }

  .trait-card h2 {
    margin: 12px 0 8px;
    font-size: 1.45rem;
  }

  .choice-card {
    min-height: 0;
    padding: 14px;
  }

  .choice-card h3 {
    margin: 12px 0 8px;
    font-size: 1.42rem;
  }

  .section-title h2 {
    font-size: 1.55rem;
  }

  .game-top h1 {
    font-size: 1.9rem;
  }

  .progress-strip {
    gap: 5px;
  }

  .progress-strip span {
    min-height: 36px;
    font-size: 0.8rem;
  }

  .preview {
    min-height: 0;
    margin-top: 10px;
    padding: 10px;
    line-height: 1.45;
  }

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

  .action-row,
  .action-row .primary-action,
  .ghost-action {
    width: 100%;
  }

  .action-row {
    flex-direction: column;
  }
}

@media (max-width: 420px) {
  .landing-hero h1 {
    font-size: 2.28rem;
  }

  .hero-subtitle {
    font-size: 0.9rem;
  }

  .self-copy input {
    font-size: 1.04rem;
  }
}
