:root {
  color-scheme: dark;
  --ink: #f7ead0;
  --muted: #c9b78f;
  --paper: #e7d0a2;
  --paper-ink: #2d1b13;
  --gold: #d6a74c;
  --red: #8d3030;
  --teal: #3f8d8a;
  --black: #151014;
  --panel: rgba(24, 18, 20, 0.82);
  --panel-solid: #21191b;
  --line: rgba(230, 200, 132, 0.22);
  --good: #83c783;
  --bad: #d86f62;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  background:
    linear-gradient(180deg, rgba(10, 8, 10, 0.2), rgba(10, 8, 10, 0.92)),
    url("/assets/nightcrown-parliament.png") center / cover fixed,
    #120f12;
  color: var(--ink);
}

button,
select {
  font: inherit;
}

button {
  border: 0;
  color: var(--ink);
  background: none;
  cursor: pointer;
}

.game {
  width: min(100%, 460px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 12px max(18px, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(16, 11, 14, 0.22), rgba(16, 11, 14, 0.72));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  min-height: 54px;
  margin: -4px -2px 10px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(18, 13, 16, 0.96), rgba(18, 13, 16, 0.74));
  backdrop-filter: blur(12px);
}

.icon-btn {
  width: 38px;
  height: 38px;
  margin: auto;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(245, 218, 154, 0.08);
  display: grid;
  place-items: center;
  font-size: 18px;
}

.top-spacer {
  width: 38px;
  height: 38px;
}

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

.info-bar button {
  min-height: 34px;
  padding: 4px 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(245, 218, 154, 0.08);
  color: var(--muted);
  font-size: 11px;
}

.title {
  min-width: 0;
  text-align: center;
}

.title strong {
  display: block;
  font-size: 16px;
  letter-spacing: 0;
}

.title span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.screen {
  display: none;
  animation: rise 320ms ease both;
}

.screen.active {
  display: block;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.band,
.panel {
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(14px);
}

.band {
  padding: 14px;
  border-radius: 8px;
}

.panel {
  padding: 12px;
  border-radius: 8px;
}

.hero {
  min-height: 66dvh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 14px;
  padding: 18px 2px 22px;
}

.hero h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.08;
  color: #ffe0a0;
  text-shadow: 0 3px 18px rgba(0, 0, 0, 0.8);
}

.hero p {
  margin: 0;
  color: #f5dfb7;
  line-height: 1.7;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.9);
}

.primary,
.secondary,
.danger {
  min-height: 44px;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 700;
}

.primary {
  background: linear-gradient(180deg, #d7a951, #9a5d25);
  color: #160d09;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.34);
}

.secondary {
  border: 1px solid var(--line);
  background: rgba(245, 218, 154, 0.08);
}

.wide {
  width: 100%;
  margin-top: 8px;
}

.step-row {
  margin-top: 10px;
}

.danger {
  background: rgba(141, 48, 48, 0.72);
}

.row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.row > * {
  flex: 1;
}

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

.section-title h2,
.section-title h3 {
  margin: 0;
}

.section-title h2 {
  font-size: 20px;
}

.section-title h3 {
  font-size: 15px;
}

.section-title small,
.muted {
  color: var(--muted);
}

.cards,
.choice-list,
.compact-list {
  display: grid;
  gap: 8px;
}

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

.card {
  position: relative;
  min-height: 132px;
  padding: 10px;
  border: 1px solid rgba(228, 190, 105, 0.32);
  border-radius: 8px;
  background:
    linear-gradient(160deg, rgba(238, 205, 127, 0.16), rgba(35, 23, 20, 0.9)),
    #231816;
  box-shadow: inset 0 0 0 1px rgba(255, 239, 179, 0.04);
  text-align: left;
}

.card.selected {
  border-color: #ffe19b;
  box-shadow: 0 0 0 2px rgba(214, 167, 76, 0.26), 0 12px 24px rgba(0, 0, 0, 0.34);
}

.card.disabled {
  opacity: 0.45;
}

.card b {
  display: block;
  color: #ffd98a;
  font-size: 15px;
  margin-bottom: 6px;
}

.card small {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--teal);
}

.card p {
  margin: 0;
  color: #ead7af;
  font-size: 12px;
  line-height: 1.55;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(245, 218, 154, 0.08);
  color: var(--muted);
  font-size: 11px;
}

.paper-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  padding: 18px;
  background: rgba(9, 7, 8, 0.72);
}

.paper-modal.active {
  display: grid;
  place-items: center;
}

.paper {
  width: min(100%, 440px);
  max-height: 86dvh;
  overflow: auto;
  padding: 22px;
  border-radius: 8px;
  color: var(--paper-ink);
  background:
    linear-gradient(90deg, rgba(92, 48, 18, 0.08), transparent 18%, transparent 82%, rgba(92, 48, 18, 0.1)),
    radial-gradient(circle at 20% 10%, rgba(255, 255, 255, 0.28), transparent 20%),
    var(--paper);
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.58);
}

.paper h2 {
  margin-top: 0;
}

.paper p,
.paper li {
  line-height: 1.72;
}

.tendency-paper .panel {
  border-color: rgba(45, 27, 19, 0.22);
  background: rgba(255, 246, 220, 0.22);
  color: var(--paper-ink);
}

.tendency-paper .argument {
  background: rgba(45, 27, 19, 0.08);
  border-color: rgba(45, 27, 19, 0.18);
}

.tendency-paper .argument p,
.tendency-paper .section-title small,
.tendency-paper .muted {
  color: rgba(45, 27, 19, 0.72);
}

.paper-meter {
  margin: 12px 0;
}

.choice {
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(23, 17, 19, 0.74);
  text-align: left;
  line-height: 1.45;
}

.choice.selected {
  border-color: #ffd98a;
  background: rgba(133, 84, 34, 0.52);
}

.topic-line {
  padding: 18px 8px;
  text-align: center;
  font-size: 20px;
  line-height: 1.52;
  color: #ffe4ac;
  animation: floatText 2.7s ease-in-out infinite alternate;
}

@keyframes floatText {
  to {
    transform: translateY(-5px);
  }
}

.argument-grid {
  display: grid;
  gap: 8px;
}

.argument {
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(20, 15, 17, 0.75);
}

.argument h4 {
  margin: 0 0 5px;
  color: #ffd98a;
}

.argument p {
  margin: 0;
  color: #dccaa4;
  font-size: 12px;
  line-height: 1.5;
}

.progress {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.track {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--red), #5b4f45 50%, var(--teal));
}

.knob {
  position: absolute;
  top: 50%;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #f8dfa1;
  background: #2a1d1c;
  transform: translate(-50%, -50%);
  transition: left 280ms ease;
}

.status-line {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.round-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 34px;
  margin: -2px 0 10px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(24, 18, 20, 0.7);
  color: #ffe0a0;
}

.round-strip small {
  color: var(--muted);
  font-size: 11px;
}

.gold {
  color: #ffd86b;
  text-shadow: 0 0 12px rgba(255, 194, 54, 0.7);
}

.lost {
  opacity: 0.48;
  text-decoration: line-through;
}

.meter {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
}

.meter-bar {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.meter-fill {
  height: 100%;
  width: 50%;
  background: linear-gradient(90deg, #bb4545, #d6a74c);
  transition: width 280ms ease;
}

.clash-stage,
.move-grid {
  display: grid;
  gap: 8px;
}

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

.move-review {
  min-height: 82px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(20, 15, 17, 0.75);
}

.move-review strong {
  color: #ffd98a;
}

.settlement {
  padding: 12px;
  border: 1px solid rgba(255, 217, 138, 0.42);
  border-radius: 8px;
  background: rgba(70, 44, 24, 0.72);
  animation: rise 260ms ease both;
}

.settlement p {
  margin: 10px 0 0;
  line-height: 1.62;
}

.countdown {
  height: 5px;
  margin: 12px 0 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
}

.countdown span {
  display: block;
  height: 100%;
  background: #ffd98a;
  animation: drain 5s linear forwards;
}

@keyframes drain {
  from {
    width: 100%;
  }
  to {
    width: 0;
  }
}

.log {
  display: grid;
  gap: 8px;
  max-height: 270px;
  overflow: auto;
  padding-right: 2px;
}

.modal-log {
  display: grid;
  gap: 8px;
}

.speech {
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 240, 196, 0.08);
  border: 1px solid var(--line);
  line-height: 1.62;
}

.speech strong {
  color: #ffd98a;
}

.footer-actions {
  position: sticky;
  bottom: 0;
  z-index: 4;
  display: flex;
  gap: 8px;
  padding: 10px 0 0;
  background: linear-gradient(180deg, transparent, rgba(18, 13, 16, 0.96) 30%);
}

.footer-actions > button {
  flex: 1;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 30;
  width: min(92%, 420px);
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(20, 14, 16, 0.96);
  color: var(--ink);
  transform: translateX(-50%);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.45);
}

.hidden {
  display: none !important;
}

@media (min-width: 760px) {
  body {
    background-size: cover;
  }

  .game {
    border-left: 1px solid rgba(255, 220, 150, 0.15);
    border-right: 1px solid rgba(255, 220, 150, 0.15);
  }
}
