:root {
  --ink: #17191d;
  --muted: #66707b;
  --line: #d6dbe3;
  --paper: #f4ecdf;
  --surface: #fffaf1;
  --surface-2: #efe6d7;
  --night: #20242c;
  --night-2: #2b303a;
  --teal: #227c79;
  --teal-soft: #dcefeb;
  --coral: #cf5d4d;
  --gold: #b88a2b;
  --blue: #3b638f;
  --green: #4f7d55;
  --shadow: 0 20px 60px rgba(22, 25, 31, 0.18);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #eee7dc;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  background:
    linear-gradient(90deg, rgba(32, 36, 44, 0.052) 1px, transparent 1px),
    linear-gradient(0deg, rgba(32, 36, 44, 0.04) 1px, transparent 1px),
    #eee7dc;
  background-size: 28px 28px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: 100%;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: stretch;
}

.phone-shell {
  position: relative;
  width: 100%;
  max-width: 430px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--paper);
  overflow: visible;
  box-shadow: none;
}

.phone-shell.dark {
  color: #f2efe7;
  background: var(--night);
}

.statusbar {
  height: 28px;
  padding: 8px 16px 0;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: currentColor;
  font-size: 11px;
  opacity: 0.82;
  overflow: hidden;
}

.statusbar span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.statusbar span:last-child {
  text-align: right;
}

.appbar {
  min-height: 62px;
  padding: 12px 16px 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid rgba(23, 25, 29, 0.08);
}

.dark .appbar {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

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

.title-block h1,
.title-block h2 {
  margin: 0;
  line-height: 1.18;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0;
}

.title-block p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dark .title-block p {
  color: #bbc2cc;
}

.content {
  padding: 14px 16px 96px;
}

.content.no-tabs {
  padding-bottom: 28px;
}

.confirm-content {
  padding-bottom: 108px;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  max-width: 160px;
  padding: 5px 9px;
  border: 1px solid rgba(23, 25, 29, 0.14);
  border-radius: 999px;
  color: #49515d;
  background: rgba(255, 250, 241, 0.62);
  font-size: 11px;
  white-space: nowrap;
}

.dark .pill {
  border-color: rgba(255, 255, 255, 0.14);
  color: #d9dde5;
  background: rgba(255, 255, 255, 0.07);
}

.hero-kicker {
  margin-top: 40px;
}

.lead-title {
  margin: 34px 0 14px;
  color: #f6f1e8;
  font-size: 25px;
  line-height: 1.28;
  font-weight: 800;
}

.lead-copy {
  margin: 0 0 26px;
  color: #d9d4ca;
  font-size: 14px;
  line-height: 1.78;
}

.rule-list,
.stack {
  display: grid;
  gap: 10px;
}

.rule {
  display: grid;
  grid-template-columns: 25px 1fr;
  gap: 9px;
  align-items: center;
  min-height: 46px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #ece7de;
  background: rgba(255, 255, 255, 0.055);
  font-size: 12px;
  line-height: 1.5;
}

.icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: #fff;
  font-weight: 800;
  font-size: 12px;
}

.teal {
  background: var(--teal);
}

.coral {
  background: var(--coral);
}

.gold {
  background: var(--gold);
}

.blue {
  background: var(--blue);
}

.primary,
.secondary,
.ghost {
  width: 100%;
  min-height: 46px;
  border-radius: 8px;
  padding: 12px 14px;
  font-weight: 800;
  font-size: 14px;
}

.primary {
  border: 0;
  color: white;
  background: var(--teal);
}

.primary:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.secondary {
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #f2eadf;
  background: transparent;
}

.ghost {
  border: 1px solid #cfd5de;
  color: #47505c;
  background: transparent;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.sticky-actions {
  position: sticky;
  bottom: 0;
  z-index: 5;
  margin: 14px -16px -28px;
  padding: 12px 16px 16px;
  border-top: 1px solid #d2d8e1;
  background: rgba(244, 236, 223, 0.96);
  backdrop-filter: blur(10px);
}

.setup-form {
  display: grid;
  gap: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.field {
  min-width: 0;
}

.field.full {
  grid-column: 1 / -1;
}

.label {
  display: block;
  margin-bottom: 6px;
  color: #5f6875;
  font-size: 11px;
  font-weight: 800;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cfd5de;
  border-radius: 8px;
  padding: 10px 11px;
  color: #20242c;
  background: var(--surface);
  outline: none;
}

.textarea {
  min-height: 74px;
  resize: vertical;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(34, 124, 121, 0.12);
}

.stepper {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-bottom: 16px;
}

.stepper span {
  height: 4px;
  border-radius: 99px;
  background: #d7cdbf;
}

.stepper span.active {
  background: var(--teal);
}

.identity-list,
.lead-list {
  display: grid;
  gap: 9px;
}

.choice-card {
  width: 100%;
  border: 1px solid #d2d8e1;
  border-radius: 8px;
  padding: 11px;
  color: var(--ink);
  background: var(--surface);
  text-align: left;
}

.choice-card.selected {
  border-color: var(--teal);
  box-shadow: inset 0 0 0 1px var(--teal);
  background: #edf6f2;
}

.choice-card h3 {
  margin: 0;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  font-size: 14px;
}

.choice-card p {
  margin: 7px 0 0;
  color: #5f6875;
  font-size: 12px;
  line-height: 1.55;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  padding: 4px 7px;
  color: #58616d;
  background: #eee5d7;
  font-size: 11px;
  white-space: nowrap;
}

.selected .tag {
  color: #25635f;
  background: #dcefeb;
}

.meter-row {
  display: grid;
  grid-template-columns: 40px 1fr 28px;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  color: #4b545f;
  font-size: 11px;
}

.meter {
  height: 6px;
  border-radius: 99px;
  background: #e2d9cc;
  overflow: hidden;
}

.meter b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
}

.role-card,
.panel-card,
.event-card {
  border: 1px solid #d2d8e1;
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}

.panel-card {
  padding: 12px;
}

.panel-card h3 {
  margin: 0 0 8px;
  font-size: 13px;
}

.panel-card p {
  margin: 0;
  color: #4f5864;
  line-height: 1.65;
  font-size: 12px;
}

.role-section {
  padding: 12px;
  border-bottom: 1px solid #ece2d5;
}

.role-section:last-child {
  border-bottom: 0;
}

.role-section h3 {
  margin: 0 0 8px;
  font-size: 13px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.stat-card {
  min-height: 66px;
  border: 1px solid #d6dbe3;
  border-radius: 8px;
  padding: 10px;
  background: var(--surface);
}

.stat-card span {
  display: block;
  margin-bottom: 4px;
  color: #64707c;
  font-size: 11px;
  font-weight: 700;
}

.stat-card strong {
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
}

.stat-card small {
  display: block;
  margin-top: 4px;
  color: #7b8490;
  font-size: 10px;
}

.game-content {
  padding-bottom: 132px;
}

.top-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-bottom: 12px;
}

.top-stat {
  min-height: 48px;
  border: 1px solid rgba(23, 25, 29, 0.1);
  border-radius: 8px;
  padding: 8px;
  background: rgba(255, 250, 241, 0.86);
}

.top-stat span {
  display: block;
  color: #68737f;
  font-size: 10px;
}

.top-stat b {
  display: block;
  margin-top: 2px;
  font-size: 17px;
}

.event-head {
  min-height: 42px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 800;
}

.event-body {
  padding: 12px;
  color: #313842;
  font-size: 13px;
  line-height: 1.75;
}

.event-minis {
  display: grid;
  gap: 7px;
  margin: 10px 0 0;
}

.mini-event {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid #ded5c9;
  border-radius: 8px;
  padding: 8px 10px;
  background: #fbf5eb;
  color: #59616d;
  font-size: 11px;
}

.option-list {
  display: grid;
  gap: 9px;
  margin-top: 12px;
}

.option-card {
  border: 1px solid #d2d8e1;
  border-radius: 8px;
  padding: 11px;
  background: #fbf5eb;
  text-align: left;
}

.option-card strong {
  display: block;
  margin-bottom: 5px;
  font-size: 13px;
}

.option-card span {
  display: block;
  color: #64707c;
  font-size: 12px;
  line-height: 1.5;
}

.option-card small {
  display: block;
  margin-top: 7px;
  color: var(--teal);
  font-size: 11px;
  font-weight: 800;
}

.settlement-list {
  display: grid;
  border: 1px solid #d2d8e1;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}

.settlement-row {
  min-height: 39px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  padding: 9px 12px;
  border-bottom: 1px solid #ece2d5;
  font-size: 12px;
}

.settlement-row:last-child {
  border-bottom: 0;
}

.delta-up {
  color: var(--teal);
  font-weight: 800;
}

.delta-down {
  color: var(--coral);
  font-weight: 800;
}

.feed {
  display: grid;
  gap: 10px;
}

.feed-item {
  border: 1px solid #d2d8e1;
  border-radius: 8px;
  padding: 11px;
  background: var(--surface);
}

.feed-item h3 {
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}

.feed-item p {
  margin: 0;
  color: #4f5864;
  font-size: 12px;
  line-height: 1.58;
}

.notice {
  margin-top: 12px;
  border-left: 3px solid var(--gold);
  padding: 10px;
  background: rgba(255, 250, 241, 0.78);
  color: #535c68;
  font-size: 12px;
  line-height: 1.6;
}

.bottom-tabs {
  position: fixed;
  left: 50%;
  right: auto;
  bottom: 0;
  width: 100%;
  max-width: 430px;
  height: 74px;
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid #d2d8e1;
  background: rgba(255, 250, 241, 0.96);
  z-index: 10;
}

.tab-btn {
  border: 0;
  border-radius: 8px;
  color: #6d7580;
  background: transparent;
  font-size: 10px;
  font-weight: 800;
}

.tab-btn span {
  display: block;
  width: 24px;
  height: 24px;
  margin: 0 auto 2px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  font-size: 12px;
}

.tab-btn.active {
  color: var(--teal);
}

.tab-btn.active span {
  background: rgba(34, 124, 121, 0.14);
}

.top-actions {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}

.icon-btn {
  min-width: 36px;
  min-height: 32px;
  border: 1px solid #cfd5de;
  border-radius: 8px;
  color: #4f5864;
  background: rgba(255, 250, 241, 0.72);
  font-size: 12px;
  font-weight: 800;
}

.empty {
  border: 1px dashed #c8cfd8;
  border-radius: 8px;
  padding: 18px;
  color: #68727e;
  text-align: center;
  font-size: 12px;
  line-height: 1.6;
}

.loading-card {
  border: 1px solid #d2d8e1;
  border-radius: 8px;
  padding: 14px;
  background: var(--surface);
}

.loading-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.loading-head h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.25;
}

.loading-head p {
  margin: 5px 0 0;
  color: #68737f;
  font-size: 11px;
  line-height: 1.5;
}

.loading-head > span {
  flex: 0 0 auto;
  min-width: 36px;
  border-radius: 999px;
  padding: 5px 7px;
  color: var(--teal);
  background: var(--teal-soft);
  text-align: center;
  font-size: 11px;
  font-weight: 800;
}

.loading-visual {
  height: 84px;
  margin: 14px 0 12px;
  border: 1px solid #e0d7cb;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(34, 124, 121, 0.08) 1px, transparent 1px),
    linear-gradient(0deg, rgba(34, 124, 121, 0.06) 1px, transparent 1px),
    #fbf5eb;
  background-size: 18px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  overflow: hidden;
}

.loading-visual span {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--teal);
  animation: pulse-dot 1.15s ease-in-out infinite;
}

.loading-visual span:nth-child(2) {
  background: var(--gold);
  animation-delay: 0.16s;
}

.loading-visual span:nth-child(3) {
  background: var(--coral);
  animation-delay: 0.32s;
}

.progress-track {
  height: 8px;
  border-radius: 99px;
  background: #e2d9cc;
  overflow: hidden;
}

.progress-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--gold));
  transition: width 0.35s ease;
}

.progress-track i.restless {
  background: linear-gradient(90deg, var(--teal), var(--gold), var(--teal));
  background-size: 180% 100%;
  animation: progress-restless 1.8s ease-in-out infinite;
}

.loading-steps {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.loading-steps div {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 8px;
  align-items: center;
  color: #727b86;
  font-size: 12px;
}

.loading-steps b {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: #eee5d7;
  color: #717985;
  font-size: 11px;
}

.loading-steps .active {
  color: var(--ink);
  font-weight: 800;
}

.loading-steps .active b {
  color: white;
  background: var(--teal);
  animation: blink-step 1s ease-in-out infinite;
}

.loading-steps .restless b {
  animation: blink-step 0.72s ease-in-out infinite;
}

.loading-steps .done {
  color: #4f7d55;
}

.loading-steps .done b {
  color: white;
  background: var(--green);
}

.tip-box {
  margin: 14px 0 12px;
  border-left: 3px solid var(--gold);
  padding: 10px;
  background: #fbf5eb;
  color: #535c68;
  font-size: 12px;
  line-height: 1.6;
}

.tip-box strong {
  display: inline-block;
  margin-right: 8px;
  color: var(--gold);
}

.waiting-line {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
  padding: 9px 10px;
  border: 1px solid #e3dacd;
  border-radius: 8px;
  background: rgba(251, 245, 235, 0.66);
}

.waiting-line span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 0 rgba(34, 124, 121, 0.32);
  animation: signal-pulse 1.7s ease-in-out infinite;
}

.waiting-line p {
  margin: 0;
  color: #59636f;
  font-size: 12px;
  line-height: 1.55;
}

.quiet-fallback {
  display: none;
  margin: 8px auto 0;
  width: auto;
  min-height: 34px;
  padding: 7px 10px;
  border-color: rgba(126, 139, 152, 0.3);
  color: #6c737e;
  background: rgba(255, 250, 241, 0.28);
  opacity: 0;
  transition: opacity 0.35s ease;
  font-size: 11px;
  font-weight: 700;
}

.quiet-fallback.visible {
  display: inline-flex;
  opacity: 0.52;
}

.quiet-fallback.visible:focus,
.quiet-fallback.visible:hover {
  opacity: 0.88;
}

@keyframes pulse-dot {
  0%,
  100% {
    transform: translateY(0) scale(0.82);
    opacity: 0.45;
  }

  50% {
    transform: translateY(-8px) scale(1.1);
    opacity: 1;
  }
}

@keyframes blink-step {
  0%,
  100% {
    opacity: 0.72;
  }

  50% {
    opacity: 1;
  }
}

@keyframes signal-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(34, 124, 121, 0.32);
    opacity: 0.7;
  }

  70% {
    box-shadow: 0 0 0 8px rgba(34, 124, 121, 0);
    opacity: 1;
  }

  100% {
    box-shadow: 0 0 0 0 rgba(34, 124, 121, 0);
    opacity: 0.7;
  }
}

@keyframes progress-restless {
  0%,
  100% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }
}

.ending-title {
  margin: 22px 0 10px;
  font-size: 25px;
  line-height: 1.2;
}

.ending-copy {
  color: #3f4650;
  line-height: 1.8;
  font-size: 14px;
}

@media (min-width: 720px) {
  .app-shell {
    padding: 24px;
    align-items: center;
  }

  .phone-shell {
    display: flex;
    flex-direction: column;
    min-height: 820px;
    height: min(900px, calc(100vh - 48px));
    max-height: 900px;
    border: 10px solid #121417;
    border-radius: 30px;
    box-shadow: var(--shadow);
    overflow: hidden;
  }

  .phone-shell.dark {
    border-color: #121417;
  }

  .content {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .content.no-tabs {
    padding-bottom: 28px;
  }

  .confirm-content {
    padding-bottom: 108px;
  }

  .bottom-tabs {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: none;
    transform: none;
  }
}
