:root {
  --paper: #fbf6ec;
  --paper-soft: rgba(251, 246, 236, 0.88);
  --indigo: #1d4b53;
  --indigo-deep: #123238;
  --jade: #2e7d5b;
  --amber: #e8b349;
  --coral: #d95b56;
  --ink: #253336;
  --muted: #67726f;
  --border: rgba(29, 75, 83, 0.14);
  --shadow-soft: 0 14px 32px rgba(18, 50, 56, 0.18);
  --radius-lg: 22px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
  background: radial-gradient(circle at top, #245760 0%, var(--indigo-deep) 72%);
  color: var(--ink);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  user-select: none;
  -webkit-user-select: none;
}

button,
input {
  font: inherit;
}

button:focus-visible,
input:focus-visible,
.story-card:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 2px;
}

.app-shell {
  width: 100vw;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stage {
  position: relative;
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
  background: var(--paper);
}

@media (min-width: 540px) {
  .stage {
    width: min(430px, calc(100dvh * 9 / 16));
    height: min(100dvh, 860px);
    border-radius: 28px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.42);
    border: 1px solid rgba(251, 246, 236, 0.18);
  }
}

@keyframes mugedaFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes mugedaPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 6px 0 #9e6514, 0 12px 24px rgba(18, 50, 56, 0.32), 0 0 0 0 rgba(232, 179, 73, 0.55); }
  50% { transform: scale(1.03); box-shadow: 0 6px 0 #9e6514, 0 16px 28px rgba(18, 50, 56, 0.36), 0 0 0 12px rgba(232, 179, 73, 0); }
}

@keyframes mugedaSheen {
  0% { transform: translateX(-140%) skewX(-24deg); }
  35%, 100% { transform: translateX(260%) skewX(-24deg); }
}

@keyframes mugedaFadeUp {
  0% { opacity: 0; transform: translateY(18px) scale(0.96); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes cardDealIn {
  0% { opacity: 0; transform: translate3d(0, 26px, 0) scale(0.92); }
  65% { opacity: 1; transform: translate3d(0, -4px, 0) scale(1.015); }
  100% { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}

@keyframes statPop {
  0% { transform: scale(1); }
  40% { transform: scale(1.28); }
  100% { transform: scale(1); }
}

@keyframes modalPop {
  0% { opacity: 0; transform: translateY(20px) scale(0.94); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes tipSlideIn {
  0% { opacity: 0; transform: translateY(-10px) scale(0.97); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.bg-layer {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 0.8s ease;
  pointer-events: none;
}

.bg-day {
  background-image: url("../images/bg_day.webp");
}

.bg-night {
  background-image: url("../images/bg_night.webp");
}

.bg-layer.is-visible {
  opacity: 1;
}

.bg-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(251, 246, 236, 0.52) 0%, rgba(251, 246, 236, 0.25) 45%, rgba(251, 246, 236, 0.72) 100%);
  pointer-events: none;
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  padding: calc(12px + env(safe-area-inset-top)) 14px calc(12px + env(safe-area-inset-bottom));
  z-index: 2;
}

.screen.is-active {
  display: flex;
  animation: mugedaFadeUp 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Loader */
.screen-loader {
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(29, 75, 83, 0.92), rgba(18, 50, 56, 0.96));
  z-index: 20;
}

.loader-card {
  width: 86%;
  padding: 26px 22px;
  border-radius: var(--radius-lg);
  background: rgba(251, 246, 236, 0.94);
  text-align: center;
  box-shadow: var(--shadow-soft);
}

.loader-eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  color: var(--jade);
  letter-spacing: 1px;
}

.loader-title {
  margin: 0 0 8px;
  font-size: 24px;
  color: var(--indigo);
  font-family: "Songti SC", "SimSun", serif;
}

.loader-desc {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--muted);
}

.progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(29, 75, 83, 0.14);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--jade), var(--amber));
  transition: width 0.2s ease;
}

.loader-percent {
  display: inline-block;
  margin-top: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--indigo);
}

/* Cover */
.screen-cover {
  justify-content: space-between;
}

.cover-backdrop {
  position: absolute;
  inset: 0;
  background: url("../images/cover.webp") center / cover no-repeat;
  z-index: -1;
}

.cover-backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(18, 50, 56, 0.36) 0%, rgba(18, 50, 56, 0.12) 45%, rgba(18, 50, 56, 0.84) 100%);
}

.cover-top-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.icon-pill {
  border: 1px solid rgba(252, 226, 166, 0.48);
  background: linear-gradient(180deg, rgba(35, 89, 98, 0.82), rgba(18, 50, 56, 0.88));
  backdrop-filter: blur(8px);
  color: var(--paper);
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(10, 28, 32, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  transition: transform 0.14s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.14s ease;
}

.icon-pill:active {
  transform: translateY(2px) scale(0.97);
  box-shadow: 0 1px 0 rgba(10, 28, 32, 0.55);
}

.cover-content {
  padding: 18px 16px 8px;
  color: var(--paper);
  text-align: center;
}

.cover-tag {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 999px;
  background: rgba(232, 179, 73, 0.26);
  border: 1px solid rgba(252, 226, 166, 0.65);
  font-size: 12px;
  color: #fff3d2;
  margin-bottom: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
  animation: mugedaFadeUp 0.5s ease 0.08s both;
}

.cover-title {
  margin: 0 0 10px;
  font-size: 38px;
  line-height: 1.15;
  font-family: "Songti SC", "SimSun", serif;
  letter-spacing: 3px;
  text-shadow: 0 4px 18px rgba(0, 0, 0, 0.45), 0 1px 0 rgba(252, 226, 166, 0.3);
  animation: mugedaFadeUp 0.55s ease 0.16s both, mugedaFloat 4.2s ease-in-out 0.8s infinite;
}

.cover-title span {
  font-size: 24px;
  color: #fce2a6;
  letter-spacing: 4px;
}

.cover-subtitle {
  margin: 0 auto 18px;
  max-width: 310px;
  font-size: 13px;
  line-height: 1.55;
  color: rgba(251, 246, 236, 0.9);
  animation: mugedaFadeUp 0.55s ease 0.24s both;
}

.btn-primary {
  position: relative;
  overflow: hidden;
  border: 1.5px solid #fff0c2;
  border-radius: 999px;
  padding: 13px 34px;
  background: linear-gradient(180deg, #f6cc68 0%, var(--amber) 52%, #cf8b22 100%);
  color: #2c1e08;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 2px;
  cursor: pointer;
  box-shadow: 0 5px 0 #9e6514, 0 12px 24px rgba(18, 50, 56, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.65);
  transition: transform 0.14s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.14s ease;
}

.btn-primary::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 42%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  animation: mugedaSheen 3.2s ease-in-out infinite;
  pointer-events: none;
}

.btn-primary:active {
  transform: translateY(4px) scale(0.98);
  box-shadow: 0 1px 0 #9e6514, 0 4px 10px rgba(18, 50, 56, 0.25);
}

#startGameBtn {
  animation: mugedaFadeUp 0.55s ease 0.32s both, mugedaPulse 2.4s ease-in-out 1s infinite;
}

.btn-secondary {
  border: 1.5px solid rgba(29, 75, 83, 0.28);
  border-radius: 999px;
  padding: 11px 18px;
  background: linear-gradient(180deg, #fffdf8, #f2e8d4);
  color: var(--indigo);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(29, 75, 83, 0.22), inset 0 1px 0 #fff;
  transition: transform 0.14s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.14s ease;
}

.btn-secondary:active {
  transform: translateY(3px) scale(0.98);
  box-shadow: 0 1px 0 rgba(29, 75, 83, 0.22);
}

.btn-block {
  width: 100%;
}

.compliance-line {
  margin: 12px 0 0;
  font-size: 11px;
  opacity: 0.85;
  text-align: center;
}

/* Play HUD */
.hud-top {
  background: rgba(251, 246, 236, 0.86);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 10px 12px;
  box-shadow: 0 8px 20px rgba(29, 75, 83, 0.1);
}

.hud-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.day-pill,
.turn-pill {
  font-size: 12px;
  font-weight: 700;
  color: var(--indigo);
  background: rgba(29, 75, 83, 0.08);
  padding: 4px 10px;
  border-radius: 999px;
}

.hud-tools {
  display: flex;
  gap: 6px;
}

.mini-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(29, 75, 83, 0.22);
  background: linear-gradient(180deg, #ffffff, #f2e8d4);
  color: var(--indigo);
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 2px 0 rgba(29, 75, 83, 0.18);
  transition: transform 0.12s ease;
}

.mini-btn:active {
  transform: translateY(2px) scale(0.95);
}

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

.stat-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.stat-head {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  color: var(--ink);
  font-weight: 600;
}

.stat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.stat-dot.is-small {
  opacity: 1;
  transform: scale(0.85);
}

.stat-dot.is-large {
  opacity: 1;
  transform: scale(1.25);
  background: var(--coral);
}

.stat-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(29, 75, 83, 0.12);
  overflow: hidden;
}

.stat-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.35s ease;
}

.stat-val {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  display: inline-block;
}

.stat-val.is-up {
  color: var(--jade);
  animation: statPop 0.36s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.stat-val.is-down {
  color: var(--coral);
  animation: statPop 0.36s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.buff-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.buff-chip {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(217, 91, 86, 0.14);
  color: #a6332f;
  border: 1px solid rgba(217, 91, 86, 0.32);
}

/* Tip Banner */
.tip-banner {
  position: relative;
  z-index: 12;
  margin-top: 10px;
  border-radius: 18px;
  background: rgba(255, 252, 246, 0.9);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow:
    0 10px 26px rgba(18, 50, 56, 0.14),
    0 2px 6px rgba(18, 50, 56, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
  overflow: hidden;
  transition: box-shadow 0.28s ease, transform 0.28s ease;
  animation: tipSlideIn 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.tip-banner.is-good {
  box-shadow:
    0 10px 26px rgba(46, 125, 91, 0.15),
    0 0 0 1px rgba(46, 125, 91, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.tip-banner.is-bad {
  box-shadow:
    0 10px 26px rgba(217, 91, 86, 0.16),
    0 0 0 1px rgba(217, 91, 86, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.tip-summary-row {
  width: 100%;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
}

.tip-seal {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-family: "Songti SC", "SimSun", serif;
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(145deg, #3ba076 0%, #246a4d 100%);
  box-shadow: 0 4px 10px rgba(46, 125, 91, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.tip-banner.is-bad .tip-seal {
  background: linear-gradient(145deg, #e7716c 0%, #c4443f 100%);
  box-shadow: 0 4px 10px rgba(217, 91, 86, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.tip-summary-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tip-summary-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: var(--jade);
}

.tip-banner.is-bad .tip-summary-kicker {
  color: var(--coral);
}

.tip-summary-text {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.4;
}

.tip-chevron {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 5px 10px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffffff 0%, #f1e8d6 100%);
  border: 1px solid rgba(29, 75, 83, 0.15);
  box-shadow: 0 2px 0 rgba(29, 75, 83, 0.12);
  font-size: 11px;
  font-weight: 700;
  color: var(--indigo);
  transition: all 0.2s ease;
}

.tip-chevron-arrow {
  display: inline-block;
  font-size: 14px;
  line-height: 1;
  transition: transform 0.26s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tip-banner.is-expanded .tip-chevron {
  background: var(--indigo);
  color: var(--paper);
  border-color: var(--indigo);
  box-shadow: none;
}

.tip-banner.is-expanded .tip-chevron-arrow {
  transform: rotate(90deg);
}

.tip-detail-wrap {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows 0.3s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.24s ease;
}

.tip-banner.is-expanded .tip-detail-wrap {
  grid-template-rows: 1fr;
  opacity: 1;
}

.tip-detail-inner {
  overflow: hidden;
}

.tip-detail-card {
  margin: 0 12px 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(246, 251, 248, 0.92) 0%, rgba(235, 245, 240, 0.82) 100%);
  border: 1px solid rgba(46, 125, 91, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.tip-banner.is-bad .tip-detail-card {
  background: linear-gradient(180deg, rgba(254, 247, 246, 0.94) 0%, rgba(252, 237, 235, 0.85) 100%);
  border-color: rgba(217, 91, 86, 0.2);
}

.tip-detail-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
}

.tip-detail-tag {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: var(--jade);
  white-space: nowrap;
}

.tip-banner.is-bad .tip-detail-tag {
  color: #b8423d;
}

.tip-detail-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(46, 125, 91, 0.28), transparent);
}

.tip-banner.is-bad .tip-detail-line {
  background: linear-gradient(90deg, rgba(217, 91, 86, 0.28), transparent);
}

.tip-detail {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.68;
  color: #2f3e40;
}

.tip-detail-foot {
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted);
  text-align: right;
}

/* Card Arena */
.card-arena {
  --swipe-progress: 0;
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 10px 0;
  touch-action: none;
  perspective: 1200px;
}

.card-stack-back {
  position: absolute;
  width: 96%;
  height: min(465px, 100%);
  border-radius: var(--radius-lg);
  background: #f3ead7;
  border: 1px solid rgba(29, 75, 83, 0.16);
  box-shadow: 0 6px 12px rgba(18, 50, 56, 0.1);
  transform: translateY(calc(12px - 8px * var(--swipe-progress))) scale(calc(0.96 + 0.04 * var(--swipe-progress)));
  transition: transform 0.3s cubic-bezier(0.18, 1.32, 0.4, 1);
  pointer-events: none;
}

.story-card {
  position: relative;
  width: 96%;
  height: min(465px, 100%);
  background: transparent;
  touch-action: none;
  cursor: grab;
  transform: translate3d(0, 0, 0) rotate(0deg);
  transform-origin: 50% 76%;
  will-change: transform;
}

.story-card.is-entering .card-face-front {
  animation: cardDealIn 0.36s cubic-bezier(0.22, 1, 0.36, 1);
}

.card-arena.is-dragging .story-card {
  cursor: grabbing;
}

.story-card.is-returning {
  transition: transform 0.36s cubic-bezier(0.19, 1.42, 0.38, 1);
}

.story-card.is-exiting {
  opacity: 0;
  pointer-events: none;
  transition:
    transform var(--swipe-exit-duration) cubic-bezier(0.22, 0.68, 0.42, 1),
    opacity var(--swipe-exit-duration) cubic-bezier(0.55, 0, 1, 1);
}

.story-card.is-reveal-prompt {
  cursor: pointer;
}

.story-card.is-flipped {
  cursor: default;
}

.card-flip-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
}

.story-card.is-flipped .card-flip-inner {
  transform: rotateY(180deg);
  transition: transform 0.62s cubic-bezier(0.22, 1, 0.36, 1);
}

.card-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--radius-lg);
  background: rgba(251, 246, 236, 0.97);
  border: 2px solid rgba(29, 75, 83, 0.2);
  box-shadow: 0 16px 34px rgba(18, 50, 56, 0.22), inset 0 0 0 3px rgba(255, 252, 245, 0.85);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.card-face-back {
  transform: rotateY(180deg);
  padding: 18px 16px 16px;
  justify-content: space-between;
  background: linear-gradient(180deg, #fffdf8 0%, #f7efe0 100%);
}

.card-face-back.is-good {
  border-color: rgba(46, 125, 91, 0.42);
}

.card-face-back.is-bad {
  border-color: rgba(217, 91, 86, 0.42);
}

.flip-prompt-pill {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translate(-50%, 0);
  padding: 7px 16px;
  border-radius: 999px;
  background: rgba(29, 75, 83, 0.88);
  border: 1.5px solid rgba(252, 226, 166, 0.8);
  color: #fff8e6;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
  animation: flipPillFloat 1.8s ease-in-out infinite;
}

@keyframes flipPillFloat {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, -6px); }
}

.back-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.back-seal {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-family: "Songti SC", "SimSun", serif;
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(145deg, #3ba076 0%, #246a4d 100%);
  box-shadow: 0 4px 12px rgba(46, 125, 91, 0.3);
}

.card-face-back.is-bad .back-seal {
  background: linear-gradient(145deg, #e7716c 0%, #c4443f 100%);
  box-shadow: 0 4px 12px rgba(217, 91, 86, 0.3);
}

.back-header-text {
  flex: 1;
  min-width: 0;
}

.back-kicker {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--jade);
  margin-bottom: 2px;
}

.card-face-back.is-bad .back-kicker {
  color: var(--coral);
}

.back-title {
  margin: 0;
  font-size: 18px;
  color: var(--indigo);
  font-family: "Songti SC", "SimSun", serif;
}

.back-summary-box {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(46, 125, 91, 0.08);
  border: 1px solid rgba(46, 125, 91, 0.2);
}

.card-face-back.is-bad .back-summary-box {
  background: rgba(217, 91, 86, 0.08);
  border-color: rgba(217, 91, 86, 0.22);
}

.back-summary {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.55;
  color: var(--ink);
}

.back-detail-box {
  flex: 1;
  margin: 12px 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(29, 75, 83, 0.12);
  overflow-y: auto;
}

.back-detail-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--indigo);
  margin-bottom: 6px;
}

.back-detail {
  margin: 0;
  font-size: 13px;
  line-height: 1.7;
  color: #364547;
}

.back-next-btn {
  padding: 12px 20px;
  font-size: 15px;
}

.reveal-dock {
  display: flex;
}

.reveal-dock[hidden],
.choice-dock[hidden] {
  display: none;
}
.urgent-bar-wrap {
  position: relative;
  height: 24px;
  background: rgba(217, 91, 86, 0.16);
  overflow: hidden;
}

.urgent-bar-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #d95b56, #ef7e4d);
  transition: width 0.08s linear;
}

.urgent-bar-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.card-image-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 0.84;
  background: #e8e0cf;
  overflow: hidden;
}

.card-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.card-stamp {
  position: absolute;
  top: 16px;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 2px;
  font-family: "Songti SC", "SimSun", serif;
  opacity: 0;
  border: 2.5px solid currentColor;
  background: rgba(251, 246, 236, 0.95);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.16);
  pointer-events: none;
  transform: rotate(var(--stamp-angle)) scale(calc(0.88 + 0.12 * var(--swipe-progress)));
  transition: opacity 0.16s ease, transform 0.22s ease;
}

.card-stamp-left {
  right: 14px;
  color: var(--coral);
  --stamp-angle: 8deg;
}

.card-stamp-right {
  left: 14px;
  color: var(--jade);
  --stamp-angle: -8deg;
}

.screen-play[data-swipe-side="left"] .card-stamp-left,
.screen-play[data-swipe-side="right"] .card-stamp-right {
  opacity: var(--swipe-progress);
}

.card-arena.is-dragging .card-stack-back,
.card-arena.is-dragging .card-stamp {
  transition: none;
}

.story-card.is-reveal-prompt .card-stamp {
  visibility: hidden;
}

.card-tag {
  position: absolute;
  bottom: 10px;
  left: 10px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(29, 75, 83, 0.85);
  color: var(--paper);
  font-size: 11px;
}

.card-body {
  padding: 12px 14px 14px;
}

.card-speaker {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--jade);
}

.card-title {
  margin: 0 0 6px;
  font-size: 18px;
  color: var(--indigo);
  font-family: "Songti SC", "SimSun", serif;
}

.card-text {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink);
}

/* Choice Dock */
.choice-dock {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.choice-btn {
  position: relative;
  border: 1.5px solid rgba(29, 75, 83, 0.2);
  border-radius: 16px;
  background: linear-gradient(180deg, #fffdf8 0%, #f3ead7 100%);
  padding: 11px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(29, 75, 83, 0.22), 0 8px 16px rgba(18, 50, 56, 0.12), inset 0 1px 0 #ffffff;
  transition: transform 0.14s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.14s ease;
}

.choice-left {
  border-color: rgba(217, 91, 86, 0.35);
  box-shadow: 0 4px 0 rgba(176, 68, 63, 0.32), 0 8px 16px rgba(18, 50, 56, 0.12), inset 0 1px 0 #ffffff;
}

.choice-right {
  border-color: rgba(46, 125, 91, 0.35);
  box-shadow: 0 4px 0 rgba(34, 96, 69, 0.32), 0 8px 16px rgba(18, 50, 56, 0.12), inset 0 1px 0 #ffffff;
}

.screen-play[data-swipe-side="left"] .choice-left {
  border-color: var(--coral);
  background: linear-gradient(180deg, #fff9f2, #f6dfcf);
}

.screen-play[data-swipe-side="right"] .choice-right {
  border-color: var(--jade);
  background: linear-gradient(180deg, #f9fcf3, #e0ebd6);
}

.choice-btn:active {
  transform: translateY(3px) scale(0.97);
  box-shadow: 0 1px 0 rgba(29, 75, 83, 0.22), 0 3px 8px rgba(18, 50, 56, 0.1);
}

.choice-dir {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
}

.choice-left .choice-dir {
  color: var(--coral);
}

.choice-right .choice-dir {
  color: var(--jade);
}

.choice-label {
  font-size: 14px;
  font-weight: 800;
  color: var(--indigo);
}

/* Ending */
.screen-ending {
  padding: 0;
  background: var(--paper);
}

.ending-scroll {
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
}

.ending-hero {
  position: relative;
  width: 100%;
  height: 250px;
  overflow: hidden;
}

.ending-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ending-badge {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top));
  right: 14px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(29, 75, 83, 0.88);
  color: var(--paper);
  font-size: 12px;
  font-weight: 700;
}

.ending-card {
  margin: -24px 14px 0;
  position: relative;
  background: #fffcf5;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 16px;
  box-shadow: var(--shadow-soft);
}

.ending-subtitle {
  margin: 0 0 4px;
  font-size: 12px;
  color: var(--jade);
  font-weight: 700;
}

.ending-title {
  margin: 0 0 8px;
  font-size: 24px;
  color: var(--indigo);
  font-family: "Songti SC", "SimSun", serif;
}

.ending-desc {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink);
}

.ending-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.metric-box {
  background: rgba(29, 75, 83, 0.06);
  border-radius: 12px;
  padding: 8px 6px;
  text-align: center;
}

.metric-box strong {
  display: block;
  font-size: 16px;
  color: var(--indigo);
}

.metric-box span {
  font-size: 11px;
  color: var(--muted);
}

.poster-panel {
  padding: 12px;
  border-radius: var(--radius-md);
  background: rgba(232, 179, 73, 0.1);
  border: 1px solid rgba(232, 179, 73, 0.32);
  margin-bottom: 14px;
}

.nickname-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--indigo);
}

.nickname-row input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 7px 10px;
  background: #fff;
  user-select: text;
  -webkit-user-select: text;
}

.poster-preview {
  margin-top: 12px;
  text-align: center;
}

.poster-preview img {
  width: 100%;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.14);
  user-select: auto;
  -webkit-touch-callout: default;
}

.poster-hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--jade);
  font-weight: 600;
}

.feedback-box {
  padding: 12px;
  border-radius: var(--radius-md);
  background: rgba(29, 75, 83, 0.05);
  margin-bottom: 14px;
}

.feedback-q {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--indigo);
}

.feedback-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.feedback-btn {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 6px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.feedback-btn.is-selected {
  background: var(--jade);
  color: #fff;
  border-color: var(--jade);
}

.feedback-thanks {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--jade);
}

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

/* Modals */
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 50, 56, 0.62);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 30;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-sheet {
  width: 100%;
  max-height: 82%;
  background: var(--paper);
  border: 2px solid rgba(232, 179, 73, 0.45);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-soft);
  animation: modalPop 0.26s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  margin: 0;
  font-size: 17px;
  color: var(--indigo);
}

.modal-close {
  border: none;
  background: transparent;
  font-size: 18px;
  color: var(--muted);
  cursor: pointer;
}

.modal-body {
  padding: 14px 16px 18px;
  overflow-y: auto;
}

.rule-list {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.65;
}

.rule-list li {
  margin-bottom: 8px;
}

.compliance-box {
  margin: 12px 0 0;
  padding: 10px;
  border-radius: 10px;
  background: rgba(29, 75, 83, 0.08);
  font-size: 12px;
  color: var(--indigo);
  text-align: center;
}

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

.gallery-item {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #fff;
}

.gallery-thumb {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  display: block;
}

.gallery-item.is-locked .gallery-thumb {
  filter: brightness(0.18) saturate(0.2);
}

.gallery-meta {
  padding: 8px;
}

.gallery-meta h3 {
  margin: 0 0 3px;
  font-size: 13px;
  color: var(--indigo);
}

.gallery-meta p {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
