:root {
  color-scheme: light;
  --paper: #f4f0e8;
  --panel: #fffaf1;
  --ink: #241b16;
  --muted: #75685f;
  --line: #d7c9b8;
  --red: #c74331;
  --gold: #c79035;
  --green: #2f8f73;
  --escape: #0fbd77;
  --escape-soft: #dff8ec;
  --teal: #247b82;
  --night: #303f6d;
  --shadow: 0 18px 44px rgba(56, 39, 22, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  background: linear-gradient(135deg, #f8f4eb 0%, #e8f0ed 50%, #f4eadb 100%);
}

button {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 32px;
}

.topbar,
.section-title,
.status-strip,
.profile-row,
.progress-row {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 48px;
  line-height: 1;
}

h2 {
  font-size: 18px;
  line-height: 1.25;
}

.status-strip {
  gap: 10px;
  min-width: 0;
  color: var(--muted);
  font-size: 14px;
}

.icon-button {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--panel);
  box-shadow: 0 8px 20px rgba(57, 39, 22, 0.08);
  cursor: pointer;
}

.hero-grid,
.play-grid,
.data-grid {
  display: grid;
  gap: 16px;
}

.hero-grid {
  grid-template-columns: minmax(0, 1.65fr) minmax(280px, 0.75fr);
  align-items: start;
}

.play-grid {
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.8fr);
  margin-top: 16px;
}

.data-grid {
  grid-template-columns: 1fr;
  margin-top: 16px;
}

.scene-panel,
.summary-panel,
.predict-panel,
.metrics-panel,
.timeline-panel,
.record-panel {
  border: 1px solid rgba(94, 70, 50, 0.2);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.86);
  box-shadow: var(--shadow);
}

.scene-panel {
  position: relative;
  height: 320px;
  min-height: 320px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(36, 27, 22, 0.78), rgba(29, 64, 70, 0.72)),
    #263b47;
}

#voyageCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

.scene-overlay {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  pointer-events: none;
}

.scene-overlay > div,
.signal-item {
  border: 1px solid rgba(255, 250, 241, 0.34);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.88);
  padding: 10px;
}

.scene-overlay .escape-overlay,
.escape-signal {
  border-color: rgba(15, 189, 119, 0.42);
  background: rgba(223, 248, 236, 0.92);
}

.escape-overlay strong,
.escape-signal strong {
  color: #06784d;
}

.danger-signal {
  border-color: rgba(199, 67, 49, 0.42);
  background: rgba(255, 235, 230, 0.94);
}

.danger-signal strong {
  color: var(--red);
}

.scene-overlay span,
.signal-item span,
.progress-row span,
.ship-card small,
.analysis-note,
.career-note,
.factor-item span,
.trend-item time {
  color: var(--muted);
  font-size: 12px;
}

.scene-overlay strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
}

.summary-panel,
.predict-panel,
.metrics-panel,
.timeline-panel,
.record-panel {
  padding: 18px;
}

.section-title.compact {
  margin-bottom: 12px;
}

.profile-row {
  gap: 12px;
}

.avatar {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 1px solid #b58e4f;
  border-radius: 8px;
  color: #fffaf1;
  background: linear-gradient(135deg, var(--red), var(--gold));
  font-weight: 900;
}

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

.signal-item {
  border-color: var(--line);
  background: #fffdf8;
}

.signal-item strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
  line-height: 1;
}

.signal-item.wide {
  grid-column: 1 / -1;
}

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

.signal-row.wide {
  grid-column: 1 / -1;
}

.progress-row {
  gap: 10px;
}

.progress-row span {
  flex: 0 0 auto;
}

.progress-track,
.bar {
  position: relative;
  overflow: hidden;
  height: 10px;
  border-radius: 999px;
  background: #e1d5c5;
}

.progress-track {
  flex: 1;
}

.progress-fill,
.bar i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--gold));
  transition: width 280ms ease;
}

.career-note {
  margin: 14px 0 0;
  line-height: 1.6;
}

.section-title {
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.badge {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--teal);
  background: #f7efe1;
  font-size: 12px;
  font-weight: 800;
}

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

.ship-card {
  min-height: 156px;
  border: 1px solid rgba(199, 67, 49, 0.35);
  border-radius: 8px;
  padding: 16px;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(199, 67, 49, 0.12), transparent),
    #fffdf8;
  text-align: left;
}

.ship-card.is-danger {
  border-color: rgba(199, 67, 49, 0.7);
  background:
    linear-gradient(180deg, rgba(199, 67, 49, 0.18), rgba(255, 235, 230, 0.72)),
    #fffdf8;
  box-shadow: inset 0 0 0 1px rgba(199, 67, 49, 0.18);
}

.ship-card.is-escape {
  border-color: rgba(15, 189, 119, 0.72);
  background:
    linear-gradient(180deg, rgba(15, 189, 119, 0.18), rgba(223, 248, 236, 0.78)),
    #fffdf8;
  box-shadow: inset 0 0 0 1px rgba(15, 189, 119, 0.2);
}

.ship-card.night {
  border-color: rgba(48, 63, 109, 0.35);
  background:
    linear-gradient(180deg, rgba(48, 63, 109, 0.12), transparent),
    #fffdf8;
}

.ship-card.night.is-danger,
.ship-card.is-danger {
  border-color: rgba(199, 67, 49, 0.72);
}

.ship-card.night.is-escape,
.ship-card.is-escape {
  border-color: rgba(15, 189, 119, 0.72);
}

.ship-name {
  display: block;
  font-size: 16px;
  font-weight: 900;
}

.danger-label {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.ship-card strong {
  display: block;
  margin: 8px 0 12px;
  font-size: 48px;
  line-height: 0.92;
}

.ship-card .bar {
  display: block;
  margin-bottom: 12px;
}

.ship-card.night .bar i {
  background: linear-gradient(90deg, var(--night), var(--teal));
}

.ship-card.is-danger .bar i {
  background: linear-gradient(90deg, #f05a47, var(--red));
}

.ship-card.is-escape .bar i {
  background: linear-gradient(90deg, var(--escape), #55d6a2);
}

.ship-card.is-escape strong {
  color: #06784d;
}

.ship-card.is-danger strong {
  color: var(--red);
}

.analysis-note {
  margin: 12px 0 0;
  line-height: 1.6;
}

.factor-list {
  display: grid;
  gap: 10px;
}

.factor-item {
  display: grid;
  grid-template-columns: 98px minmax(0, 1fr) 54px;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(117, 104, 95, 0.16);
}

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

.factor-track {
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  background: #e3d8c8;
}

.factor-track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--red), var(--night));
}

.trend-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 8px;
  max-height: 380px;
  overflow: auto;
}

.trend-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fffdf8;
}

.trend-item strong,
.trend-item span,
.trend-item time {
  display: block;
}

.trend-item strong {
  color: #9e3c2f;
  font-size: 13px;
}

.trend-item span {
  margin: 6px 0;
  font-size: 15px;
  font-weight: 900;
}

.trend-item[data-room="2"] strong {
  color: var(--night);
}

.record-list {
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
}

.record-empty,
.record-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
}

.record-empty {
  display: grid;
  gap: 6px;
  padding: 14px;
}

.record-empty span,
.record-item span {
  color: var(--muted);
  font-size: 12px;
}

.record-item {
  display: grid;
  grid-template-columns: 82px repeat(3, minmax(72px, 1fr)) 52px;
  align-items: center;
  gap: 10px;
  padding: 10px;
}

.record-item strong,
.record-item span {
  display: block;
}

.record-item em {
  justify-self: end;
  border-radius: 999px;
  padding: 5px 8px;
  color: #fffaf1;
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.record-item.success {
  border-color: rgba(47, 143, 115, 0.35);
}

.record-item.success em {
  background: var(--escape);
}

.record-item.fail {
  border-color: rgba(199, 67, 49, 0.35);
}

.record-item.fail em {
  background: var(--red);
}

@media (max-width: 860px) {
  .app-shell {
    width: min(100% - 20px, 560px);
    padding-top: 14px;
  }

  .topbar {
    align-items: flex-start;
  }

  h1 {
    font-size: 38px;
  }

  .hero-grid,
  .play-grid,
  .data-grid,
  .choice-board,
  .scene-overlay {
    grid-template-columns: 1fr;
  }

  .scene-panel,
  #voyageCanvas {
    height: 280px;
    min-height: 280px;
  }

  .summary-panel,
  .predict-panel,
  .metrics-panel,
  .timeline-panel,
  .record-panel {
    padding: 14px;
  }

  .status-strip {
    flex-direction: column;
    align-items: flex-end;
  }

  .ship-card strong {
    font-size: 40px;
  }
}

@media (max-width: 460px) {
  .topbar {
    flex-direction: column;
  }

  .status-strip {
    width: 100%;
    flex-direction: row;
    justify-content: space-between;
  }

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

  .signal-row {
    grid-template-columns: 1fr;
  }

  .factor-item {
    grid-template-columns: 78px minmax(0, 1fr) 46px;
  }

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

  .record-item em {
    justify-self: start;
  }
}
