:root {
  --bg: #101417;
  --panel: rgba(236, 230, 216, 0.95);
  --ink: #172124;
  --muted: #667072;
  --line: rgba(23, 33, 36, 0.16);
  --red: #a93432;
  --red-dark: #742321;
  --teal: #0c5a62;
  --teal-dark: #083f45;
  --gold: #c79848;
  --paper: #f5f1e7;
  --green: #3c7a57;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, system-ui, sans-serif;
  background:
    radial-gradient(circle at center, rgba(16, 20, 23, 0.24), rgba(16, 20, 23, 0.88) 78%),
    linear-gradient(90deg, rgba(16, 20, 23, 0.74), rgba(16, 20, 23, 0.42)),
    url("assets/premier-office.png") center / cover fixed;
}

button {
  font: inherit;
}

.shell {
  display: grid;
  width: min(760px, calc(100vw - 24px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 14px 0;
  align-items: stretch;
}

.game-panel {
  border: 1px solid rgba(245, 241, 231, 0.42);
  background:
    linear-gradient(180deg, rgba(236, 230, 216, 0.97), rgba(219, 211, 194, 0.96)),
    var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.game-panel {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 28px);
  padding: 16px 18px 18px;
}

.topbar,
.state-row,
.choice-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.kicker,
.speaker,
.state-row,
.history-choice {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: Fraunces, Georgia, serif;
  line-height: 0.96;
}

h1 {
  font-size: clamp(2rem, 6vw, 4.5rem);
  color: var(--red-dark);
}

.intro p,
.ending p {
  line-height: 1.55;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.42);
  cursor: pointer;
}

.icon-button svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.meters {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 14px 0 8px;
}

.meter {
  min-width: 0;
}

.meter-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 28px;
  margin-bottom: 6px;
  border: 1px solid rgba(23, 33, 36, 0.14);
  border-radius: 999px;
  padding: 0 9px;
  background: rgba(255, 255, 255, 0.32);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.meter-label span:last-child {
  color: rgba(23, 33, 36, 0.56);
  font-size: 0.62rem;
}

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

.pip {
  min-width: 0;
  border-radius: 999px;
  background: rgba(23, 33, 36, 0.14);
  transition: background-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.pip.is-filled {
  background: var(--teal);
}

.meter.is-danger .pip.is-filled {
  background: var(--red);
}

.pip.preview-good {
  background: rgba(60, 122, 87, 0.86);
  box-shadow: 0 0 0 2px rgba(60, 122, 87, 0.24);
  transform: translateY(-1px);
}

.pip.preview-bad {
  background: rgba(169, 52, 50, 0.9);
  box-shadow: 0 0 0 2px rgba(169, 52, 50, 0.24);
  transform: translateY(-1px);
}

.intro,
.ending {
  display: grid;
  gap: 18px;
  margin: auto 0;
  padding: 8vh 0;
}

.mandate {
  max-width: 660px;
  font-family: Fraunces, Georgia, serif;
  font-size: clamp(1.8rem, 4vw, 3.6rem);
  line-height: 1.02;
}

.primary-button {
  width: fit-content;
  border: 0;
  border-radius: 8px;
  padding: 13px 18px;
  color: white;
  background: var(--teal);
  font-weight: 800;
  cursor: pointer;
}

.play {
  display: flex;
  flex: 1;
  flex-direction: column;
}

.card-stage {
  position: relative;
  display: grid;
  place-items: center;
  flex: 1;
  min-height: 600px;
  padding: 10px 0 8px;
  perspective: 1200px;
}

.card-stage::before,
.card-stage::after {
  position: absolute;
  top: 50%;
  z-index: 0;
  border-radius: 8px;
  padding: 16px 18px;
  color: white;
  font-size: clamp(1.35rem, 4vw, 2.2rem);
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(-50%) scale(0.94);
  transition: opacity 70ms ease, transform 70ms ease;
  pointer-events: none;
}

.card-stage::before {
  left: 18px;
  content: "Reject";
  background: rgba(169, 52, 50, 0.92);
  box-shadow: 0 18px 46px rgba(169, 52, 50, 0.28);
}

.card-stage::after {
  right: 18px;
  content: "Approve";
  background: rgba(60, 122, 87, 0.94);
  box-shadow: 0 18px 46px rgba(60, 122, 87, 0.28);
}

.card-stage.drag-left::before,
.card-stage.drag-right::after {
  opacity: 1;
  transform: translateY(-50%) scale(1);
}

.choice-preview {
  position: absolute;
  bottom: 16px;
  z-index: 3;
  display: grid;
  gap: 4px;
  width: min(330px, calc(100% - 28px));
  border-radius: 8px;
  padding: 12px 14px;
  color: white;
  opacity: 0;
  pointer-events: none;
  text-align: center;
  transform: translateY(10px) scale(0.98);
  transition: opacity 70ms ease, transform 70ms ease;
}

.choice-preview span {
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.choice-preview strong {
  font-size: clamp(1rem, 3vw, 1.35rem);
  line-height: 1.15;
}

.choice-preview-left {
  background: rgba(169, 52, 50, 0.96);
  box-shadow: 0 18px 42px rgba(169, 52, 50, 0.32);
}

.choice-preview-right {
  background: rgba(60, 122, 87, 0.96);
  box-shadow: 0 18px 42px rgba(60, 122, 87, 0.32);
}

.card-stage.drag-left .choice-preview-left,
.card-stage.drag-right .choice-preview-right {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.decision-card {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto 1fr;
  width: min(390px, 100%);
  min-height: 585px;
  overflow: hidden;
  border: 1px solid rgba(23, 33, 36, 0.18);
  border-radius: 8px;
  background: #fbf7ec;
  box-shadow: 0 20px 58px rgba(23, 33, 36, 0.32);
  cursor: grab;
  touch-action: pan-y;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.decision-card:active {
  cursor: grabbing;
}

.decision-card.drag-left {
  box-shadow: 0 22px 58px rgba(169, 52, 50, 0.34);
}

.decision-card.drag-right {
  box-shadow: 0 22px 58px rgba(60, 122, 87, 0.34);
}

.portrait {
  aspect-ratio: 1 / 1;
  width: 100%;
  border-bottom: 1px solid var(--line);
  background-image: url("assets/advisor-sheet.png");
  background-repeat: no-repeat;
  background-size: 300% 200%;
  background-position: center;
  background-color: #d5ccba;
}

.advisor-chief {
  background-position: 0 0;
}

.advisor-deputy {
  background-position: 50% 0;
}

.advisor-influencer {
  background-position: 100% 0;
}

.advisor-business {
  background-position: 0 100%;
}

.advisor-federal {
  background-position: 50% 100%;
}

.advisor-nurse {
  background-position: 100% 100%;
}

.advisor-organizer {
  background-image: url("assets/separatist-organizer.png");
  background-size: cover;
  background-position: center;
  filter: saturate(1.06) contrast(1.04);
}

.advisor-event {
  background:
    linear-gradient(135deg, rgba(12, 90, 98, 0.78), rgba(169, 52, 50, 0.76)),
    url("assets/premier-office.png") center / cover;
}

.card-copy {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 22px;
}

.card-copy h2 {
  font-size: clamp(1.7rem, 5vw, 2.55rem);
  color: var(--teal-dark);
}

.card-copy p:last-child {
  margin: 0;
  color: #253133;
  font-size: 1.05rem;
  line-height: 1.5;
}

.swipe-hint {
  position: absolute;
  top: 18px;
  z-index: 2;
  border: 0;
  border-radius: 8px;
  padding: 12px 16px;
  opacity: 0;
  color: white;
  font-size: 1.2rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: opacity 70ms ease, transform 70ms ease;
}

.swipe-hint-left {
  left: 18px;
  background: rgba(169, 52, 50, 0.95);
  transform: rotate(-10deg) scale(0.94);
  box-shadow: 0 12px 30px rgba(169, 52, 50, 0.35);
}

.swipe-hint-right {
  right: 18px;
  background: rgba(60, 122, 87, 0.95);
  transform: rotate(10deg) scale(0.94);
  box-shadow: 0 12px 30px rgba(60, 122, 87, 0.35);
}

.decision-card.drag-left .swipe-hint-left,
.decision-card.drag-right .swipe-hint-right {
  opacity: 1;
  transform: rotate(var(--hint-rotate, 0deg)) scale(1);
}

.decision-card.drag-left .swipe-hint-left {
  --hint-rotate: -10deg;
}

.decision-card.drag-right .swipe-hint-right {
  --hint-rotate: 10deg;
}

.choice-bar {
  display: none;
}

.choice {
  display: grid;
  grid-template-columns: minmax(86px, auto) 1fr;
  align-items: center;
  gap: 12px;
  width: calc(50% - 6px);
  min-height: 64px;
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  font-weight: 800;
  cursor: pointer;
  text-align: left;
}

.choice-left {
  border-color: rgba(169, 52, 50, 0.58);
}

.choice-right {
  border-color: rgba(60, 122, 87, 0.62);
}

.choice-action {
  display: inline-grid;
  place-items: center;
  min-height: 36px;
  border-radius: 6px;
  padding: 7px 10px;
  color: white;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.choice-left .choice-action {
  background: var(--red);
}

.choice-right .choice-action {
  background: var(--green);
}

.nine-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 23px;
}

.nine-list li {
  color: var(--muted);
  line-height: 1.3;
}

.nine-list li.done {
  color: var(--ink);
  font-weight: 800;
}

.history {
  display: grid;
  gap: 10px;
  max-height: 38vh;
  overflow: auto;
  padding-right: 4px;
}

.history-item {
  border-left: 4px solid var(--line);
  padding-left: 10px;
  font-size: 0.88rem;
}

.history-item strong {
  display: block;
}

.ending h2 {
  color: var(--red-dark);
  font-size: clamp(2rem, 6vw, 4.2rem);
}

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

.stat-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.44);
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.stat-card strong {
  font-size: 1.4rem;
}

.is-hidden {
  display: none;
}

@media (max-width: 900px) {
  body {
    background-attachment: scroll;
  }

  .shell {
    width: min(560px, calc(100vw - 16px));
    padding: 12px 0;
  }

  .game-panel {
    min-height: auto;
    padding: 16px;
  }

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

  .card-stage {
    min-height: 560px;
  }

  .decision-card {
    width: min(370px, 100%);
    min-height: 560px;
  }
}

@media (max-width: 520px) {
  .meters {
    grid-template-columns: 1fr;
  }

  .choice-bar {
    flex-direction: column;
  }

  .choice {
    grid-template-columns: 1fr;
    width: 100%;
    text-align: center;
  }

  .ending-stats {
    grid-template-columns: 1fr;
  }
}
