:root {
  --ink: #171a13;
  --paper: #fff7df;
  --paper-deep: #f3e6bf;
  --sun: #f3b83f;
  --sun-bright: #ffd85a;
  --grass: #727946;
  --grass-dark: #37432f;
  --orange: #dc542e;
  --red: #b83225;
  --blue: #477184;
  --cream: #f8eac2;
  --line: rgba(23, 26, 19, 0.18);
  --shadow: 0 18px 50px rgba(52, 42, 20, 0.24);
  --display: "STKaiti", "KaiTi", "Kaiti SC", serif;
  --body: "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  color: var(--ink);
  font-family: var(--body);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  background: var(--sun);
}

body {
  margin: 0;
  min-width: 320px;
  height: 100vh;
  height: 100svh;
  height: var(--viewport-height, 100svh);
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 74% 14%, rgba(255, 236, 150, 0.78) 0 7%, transparent 24%),
    linear-gradient(180deg, #f3ba42 0%, #e9aa36 58%, #9d7843 100%);
}

body.has-modal {
  overflow: hidden;
}

button {
  border: 0;
  color: inherit;
  font: inherit;
}

button:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

.sky-texture {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.2;
  background-image:
    repeating-linear-gradient(103deg, transparent 0 12px, rgba(66, 43, 11, 0.12) 12px 13px),
    repeating-linear-gradient(7deg, transparent 0 19px, rgba(255, 248, 218, 0.16) 19px 20px);
  mix-blend-mode: multiply;
}

.sun {
  position: fixed;
  width: min(52vw, 340px);
  aspect-ratio: 1;
  left: 63%;
  top: 8vh;
  border-radius: 50%;
  background: rgba(255, 226, 108, 0.74);
  box-shadow: 0 0 80px rgba(255, 225, 101, 0.68);
  pointer-events: none;
}

.mountains {
  position: fixed;
  left: -10vw;
  right: -10vw;
  bottom: 0;
  height: 32vh;
  pointer-events: none;
  clip-path: polygon(0 57%, 9% 31%, 18% 47%, 29% 12%, 39% 51%, 53% 28%, 64% 58%, 78% 22%, 89% 42%, 100% 18%, 100% 100%, 0 100%);
}

.mountains--back {
  bottom: 8vh;
  background: #9b7f50;
  opacity: 0.26;
  filter: blur(1px);
}

.mountains--front {
  height: 22vh;
  background: linear-gradient(180deg, var(--grass) 0%, var(--grass-dark) 100%);
  clip-path: polygon(0 62%, 10% 44%, 21% 57%, 36% 35%, 52% 66%, 67% 41%, 80% 62%, 92% 37%, 100% 56%, 100% 100%, 0 100%);
  opacity: 0.85;
}

.app-shell {
  position: relative;
  z-index: 1;
  display: flex;
  height: 100vh;
  height: 100svh;
  height: var(--viewport-height, 100svh);
  min-height: 0;
  width: min(100%, 510px);
  flex-direction: column;
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) 20px max(12px, env(safe-area-inset-bottom));
  overflow: hidden;
}

.topbar {
  position: relative;
  z-index: 20;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  background: transparent;
  cursor: pointer;
  font-family: Georgia, serif;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.wordmark b {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  background: var(--red);
  color: var(--paper);
  font-family: var(--display);
  font-size: 18px;
  transform: rotate(-6deg);
  box-shadow: 2px 2px 0 var(--ink);
}

.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  padding: 9px;
  place-items: center;
  border: 1px solid rgba(23, 26, 19, 0.35);
  border-radius: 50%;
  background: rgba(255, 247, 223, 0.28);
  cursor: pointer;
  backdrop-filter: blur(6px);
}

.icon-button svg {
  width: 23px;
  fill: var(--ink);
}

.icon-button .sound-wave {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.8;
  stroke-linecap: round;
}

.icon-button[aria-pressed="false"] .sound-wave {
  display: none;
}

.screen {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  animation: screen-in 0.58s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.screen::-webkit-scrollbar {
  display: none;
}

.screen[hidden] {
  display: none !important;
}

@keyframes screen-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.screen--intro {
  display: grid;
  height: 100%;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding-top: clamp(32px, 7vh, 68px);
  overflow: hidden;
}

.intro-copy {
  position: relative;
  z-index: 3;
}

.eyebrow {
  display: inline-flex;
  margin: 0 0 10px;
  padding: 6px 9px;
  border: 1px solid var(--ink);
  background: rgba(255, 245, 211, 0.35);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.intro-copy h1 {
  display: flex;
  align-items: center;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(66px, 22vw, 104px);
  font-weight: 900;
  letter-spacing: -0.1em;
  line-height: 0.82;
  text-shadow: 4px 4px 0 rgba(255, 244, 203, 0.5);
}

.intro-copy h1 em {
  position: relative;
  display: grid;
  width: 0.84em;
  height: 0.84em;
  margin-left: 0.13em;
  place-items: center;
  background: var(--red);
  color: var(--paper);
  font-family: var(--display);
  font-size: 0.72em;
  font-style: normal;
  letter-spacing: 0;
  transform: rotate(5deg) translateY(-0.04em);
  box-shadow: 5px 5px 0 var(--ink);
}

.intro-subtitle {
  margin: 17px 0 0 4px;
  font-family: var(--display);
  font-size: 17px;
  letter-spacing: 0.12em;
}

.hero-stage {
  position: relative;
  min-height: 0;
  margin-top: -10px;
}

.hero-halo {
  position: absolute;
  left: 50%;
  top: 47%;
  width: min(280px, 42dvh);
  aspect-ratio: 1;
  border: 1px solid rgba(70, 48, 13, 0.22);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.hero-halo::before,
.hero-halo::after {
  content: "";
  position: absolute;
  inset: 16px;
  border: inherit;
  border-radius: inherit;
}

.hero-halo::after {
  inset: 34px;
}

.hero-character {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: 0;
  width: min(310px, 78vw, 45dvh);
  transform: translateX(-50%);
  filter: drop-shadow(0 24px 14px rgba(45, 40, 20, 0.27));
  animation: hero-breathe 3.6s ease-in-out infinite;
}

.hero-character svg,
.event-character svg,
.ending-art svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

@keyframes hero-breathe {
  0%, 100% { transform: translateX(-50%) translateY(0) rotate(-0.5deg); }
  50% { transform: translateX(-50%) translateY(-5px) rotate(0.5deg); }
}

.floating-paper {
  position: absolute;
  z-index: 4;
  padding: 7px 10px;
  border: 1px solid var(--ink);
  background: var(--paper);
  box-shadow: 3px 3px 0 rgba(23, 26, 19, 0.7);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  animation: paper-float 4s ease-in-out infinite;
}

.floating-paper--one { left: 2%; top: 31%; transform: rotate(-9deg); }
.floating-paper--two { right: -2%; top: 19%; transform: rotate(8deg); animation-delay: -1.1s; color: var(--red); }
.floating-paper--three { right: 4%; top: 62%; transform: rotate(-3deg); animation-delay: -2s; }

@keyframes paper-float {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -9px; }
}

.intro-actions {
  position: relative;
  z-index: 4;
  padding-top: 18px;
}

.intro-actions p {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 12px 0 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.intro-actions p i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(184, 50, 37, 0.16);
}

.primary-button,
.secondary-button {
  display: flex;
  width: 100%;
  min-height: 54px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 20px;
  border: 2px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  box-shadow: 5px 5px 0 rgba(255, 247, 223, 0.7);
  cursor: pointer;
  font-weight: 900;
  letter-spacing: 0.12em;
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.primary-button:hover:not(:disabled),
.secondary-button:hover:not(:disabled) {
  transform: translate(-2px, -2px);
  box-shadow: 7px 7px 0 rgba(255, 247, 223, 0.76);
}

.primary-button:active:not(:disabled),
.secondary-button:active:not(:disabled) {
  transform: translate(3px, 3px);
  box-shadow: 2px 2px 0 rgba(255, 247, 223, 0.6);
}

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

.primary-button svg {
  width: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.primary-button--big {
  min-height: 64px;
  font-size: 17px;
}

.screen--setup {
  display: flex;
  flex-direction: column;
  padding-top: clamp(28px, 6vh, 58px);
}

.section-heading .step-number {
  display: block;
  margin-bottom: 12px;
  color: var(--red);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.section-heading h2 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(42px, 12vw, 58px);
  font-weight: 900;
  line-height: 0.98;
  letter-spacing: -0.04em;
}

.section-heading p {
  max-width: 360px;
  margin: 16px 0 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.75;
}

.role-list {
  display: grid;
  gap: 11px;
  margin-top: 30px;
}

.role-card {
  position: relative;
  display: grid;
  grid-template-columns: 24px 58px 1fr auto;
  gap: 12px;
  min-height: 94px;
  align-items: center;
  padding: 12px 13px;
  border: 1.5px solid var(--ink);
  background: rgba(255, 247, 223, 0.86);
  box-shadow: 4px 4px 0 rgba(23, 26, 19, 0.76);
  cursor: pointer;
  text-align: left;
  transition: transform 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.role-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 rgba(23, 26, 19, 0.82);
}

.role-card.is-selected {
  background: var(--ink);
  color: var(--paper);
  transform: translate(4px, 4px);
  box-shadow: 0 0 0 rgba(23, 26, 19, 0);
}

.role-index {
  align-self: start;
  padding-top: 3px;
  font-family: Georgia, serif;
  font-size: 10px;
  font-weight: 900;
}

.role-icon {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50% 46% 48% 45%;
  font-family: Georgia, serif;
  font-size: 20px;
  font-weight: 900;
  transform: rotate(-3deg);
}

.role-icon--dev { background: #cf5d37; }
.role-icon--pm { background: #a4a84e; }
.role-icon--design { background: #668899; }

.role-info b,
.role-info small {
  display: block;
}

.role-info b {
  font-family: var(--display);
  font-size: 21px;
}

.role-info small {
  margin-top: 4px;
  font-size: 10px;
  font-weight: 700;
  opacity: 0.68;
}

.role-stats {
  padding-left: 10px;
  border-left: 1px solid currentColor;
  font-size: 9px;
  font-weight: 900;
  line-height: 1.7;
  opacity: 0.7;
}

.setup-footer {
  margin-top: 26px;
}

.setup-footer p {
  margin: 0;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.screen--game {
  display: flex;
  flex-direction: column;
  padding-top: clamp(10px, 2.8dvh, 24px);
  overflow: hidden;
}

.game-header,
.stage-meta,
.round-counter {
  display: flex;
}

.game-header {
  flex: 0 0 auto;
  align-items: flex-end;
  justify-content: space-between;
}

.stage-meta {
  flex-direction: column;
  gap: 3px;
}

.stage-meta span {
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.stage-meta b {
  font-family: var(--display);
  font-size: 28px;
  letter-spacing: -0.04em;
}

.round-counter {
  align-items: baseline;
  font-family: Georgia, serif;
}

.round-counter b {
  font-size: 28px;
}

.round-counter span {
  font-size: 11px;
  font-weight: 900;
  opacity: 0.55;
}

.progress-track {
  position: relative;
  flex: 0 0 auto;
  height: 5px;
  margin: 18px 2px 20px;
  background: rgba(23, 26, 19, 0.2);
}

.progress-fill {
  height: 100%;
  width: 5%;
  background: var(--red);
  transition: width 0.65s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.progress-cow {
  position: absolute;
  left: 5%;
  top: 50%;
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: var(--sun-bright);
  font-family: var(--display);
  font-size: 11px;
  font-weight: 900;
  transform: translate(-50%, -50%) rotate(-8deg);
  transition: left 0.65s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.stats-grid {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  margin-bottom: 12px;
}

.stat {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px;
  padding: 8px 9px 7px;
  border: 1px solid rgba(23, 26, 19, 0.55);
  background: rgba(255, 247, 223, 0.52);
  transition: background 180ms ease, transform 180ms ease;
}

.stat.is-up { animation: stat-up 420ms ease; }
.stat.is-down { animation: stat-down 420ms ease; }

@keyframes stat-up {
  50% { transform: translateY(-3px); background: #d8df94; }
}

@keyframes stat-down {
  50% { transform: translateY(3px); background: #eda08b; }
}

.stat span,
.stat b {
  font-size: 10px;
  font-weight: 900;
}

.stat > div {
  grid-column: 1 / -1;
  height: 3px;
  background: rgba(23, 26, 19, 0.18);
}

.stat i {
  display: block;
  width: 50%;
  height: 100%;
  background: var(--ink);
  transition: width 0.5s ease;
}

.event-card {
  display: grid;
  min-height: 0;
  flex: 1 1 auto;
  grid-template-rows: clamp(120px, 19dvh, 160px) minmax(0, 1fr);
  overflow: hidden;
  border: 2px solid var(--ink);
  background: var(--paper);
  box-shadow: 7px 8px 0 rgba(23, 26, 19, 0.83);
}

.event-card.is-changing {
  animation: card-change 440ms ease both;
}

@keyframes card-change {
  0% { opacity: 0; transform: translateX(18px) rotate(0.8deg); }
  100% { opacity: 1; transform: translateX(0) rotate(0); }
}

.event-scene {
  position: relative;
  height: auto;
  min-height: 0;
  overflow: hidden;
  border-bottom: 2px solid var(--ink);
  background:
    radial-gradient(circle at 74% 30%, #ffdb67 0 11%, transparent 12%),
    linear-gradient(170deg, #c88142 0 46%, #857f49 47% 63%, #4c5b3d 64% 100%);
}

.event-scene::before {
  content: "";
  position: absolute;
  inset: auto 0 17px;
  height: 1px;
  background: rgba(24, 24, 16, 0.46);
  box-shadow: 0 7px 0 rgba(24, 24, 16, 0.21), 0 -19px 0 rgba(255, 244, 194, 0.12);
}

.event-character {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: -48px;
  width: 188px;
  transform: translateX(-50%);
  filter: drop-shadow(0 12px 7px rgba(19, 22, 15, 0.33));
}

.event-character.is-reacting {
  animation: cow-reaction 520ms steps(3, end);
}

@keyframes cow-reaction {
  0% { transform: translateX(-50%) rotate(0); }
  33% { transform: translateX(-50%) rotate(-3deg); }
  66% { transform: translateX(-50%) rotate(3deg); }
  100% { transform: translateX(-50%) rotate(0); }
}

.event-stamp {
  position: absolute;
  z-index: 3;
  right: 16px;
  top: 15px;
  padding: 5px 8px;
  border: 2px solid var(--paper);
  color: var(--paper);
  font-family: var(--display);
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.16em;
  transform: rotate(6deg);
  opacity: 0.88;
}

.scene-shadow {
  position: absolute;
  left: 50%;
  bottom: 5px;
  width: 180px;
  height: 22px;
  border-radius: 50%;
  background: rgba(23, 26, 19, 0.32);
  filter: blur(4px);
  transform: translateX(-50%);
}

.event-body {
  display: flex;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  padding: 18px 17px 20px;
}

.event-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.event-label i {
  flex: 1;
  height: 1px;
  background: var(--line);
}

.event-label b {
  color: var(--red);
}

.event-body h2 {
  margin: 11px 0 8px;
  font-family: var(--display);
  font-size: clamp(27px, 8vw, 36px);
  line-height: 1.08;
}

.event-body > p {
  min-height: 42px;
  margin: 0;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: rgba(23, 26, 19, 0.73);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.7;
}

.choice-list {
  display: grid;
  min-height: 0;
  max-height: 214px;
  flex: 1 1 auto;
  grid-template-rows: repeat(3, minmax(56px, 1fr));
  gap: 8px;
  margin-top: 17px;
}

.outcome-notice[hidden] {
  display: none;
}

.outcome-notice {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 9px;
  margin-top: 12px;
  padding: 9px 10px;
  border-left: 3px solid var(--red);
  background: rgba(243, 184, 63, 0.2);
  opacity: 0;
  transform: translateY(-4px);
}

.outcome-notice.is-visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 180ms ease, transform 180ms ease;
}

.outcome-notice span {
  align-self: start;
  padding: 3px 5px;
  background: var(--red);
  color: var(--paper);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.outcome-notice p {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: var(--ink);
  font-family: var(--display);
  font-size: 13px;
  font-weight: 900;
  line-height: 1.45;
}

.choice-button {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid var(--ink);
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.choice-button:hover:not(:disabled),
.choice-button:focus-visible,
.choice-button.is-selected {
  background: var(--ink);
  color: var(--paper);
  transform: translateX(3px);
}

.choice-button:disabled {
  cursor: default;
}

.choice-key {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-family: Georgia, serif;
  font-size: 10px;
  font-weight: 900;
}

.choice-copy b,
.choice-copy small {
  display: block;
}

.choice-copy b {
  font-size: 12px;
  font-weight: 900;
}

.choice-copy small {
  margin-top: 3px;
  font-size: 9px;
  font-weight: 700;
  opacity: 0.58;
}

.choice-arrow {
  font-size: 18px;
}

.screen--ending {
  padding-top: clamp(12px, 3.5dvh, 30px);
}

.ending-ticket {
  position: relative;
  overflow: hidden;
  padding: 16px 17px 18px;
  border: 2px solid var(--ink);
  background:
    linear-gradient(rgba(255, 247, 223, 0.92), rgba(255, 247, 223, 0.92)),
    repeating-linear-gradient(0deg, transparent 0 16px, rgba(23, 26, 19, 0.08) 16px 17px);
  box-shadow: 8px 9px 0 rgba(23, 26, 19, 0.84);
}

.ending-ticket::before,
.ending-ticket::after {
  content: "";
  position: absolute;
  top: 58%;
  width: 24px;
  height: 24px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: #bf8b3d;
}

.ending-ticket::before { left: -15px; }
.ending-ticket::after { right: -15px; }

.ticket-topline,
.ticket-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.ticket-topline {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--ink);
}

.ending-art {
  width: min(205px, 25dvh);
  height: min(230px, 28dvh);
  margin: -5px auto -8px;
  filter: drop-shadow(0 17px 7px rgba(23, 26, 19, 0.24));
}

.ending-visual {
  position: relative;
}

.ending-qr {
  position: absolute;
  z-index: 2;
  right: 0;
  top: 50%;
  display: grid;
  justify-items: center;
  width: 84px;
  transform: translateY(-43%) rotate(1deg);
}

.ending-qr canvas {
  display: block;
  width: 76px;
  height: 76px;
  border: 2px solid var(--ink);
  background: var(--paper);
  box-shadow: 3px 3px 0 rgba(23, 26, 19, 0.72);
  image-rendering: pixelated;
}

.ending-qr span,
.ending-qr small {
  display: block;
  max-width: 84px;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ending-qr span {
  margin-top: 6px;
  font-size: 8px;
  font-weight: 900;
}

.ending-qr small {
  margin-top: 2px;
  font-family: Georgia, serif;
  font-size: 7px;
  font-weight: 900;
  opacity: 0.62;
}

.ending-kicker {
  margin: 0;
  color: var(--red);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-align: center;
}

.ending-ticket h2 {
  margin: 7px 0 9px;
  font-family: var(--display);
  font-size: clamp(38px, 11vw, 52px);
  line-height: 1;
  text-align: center;
}

.ending-description {
  max-width: 350px;
  margin: 0 auto;
  color: rgba(23, 26, 19, 0.7);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.65;
  text-align: center;
}

.ending-ticket blockquote {
  margin: 15px 0;
  padding: 11px 13px;
  border: 1px solid var(--ink);
  background: var(--sun-bright);
  font-family: var(--display);
  font-size: 15px;
  font-weight: 900;
  line-height: 1.5;
  text-align: center;
  transform: rotate(-0.5deg);
}

.ending-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 15px 0;
  border-top: 1px dashed var(--line);
  border-bottom: 1px dashed var(--line);
}

.ending-stat {
  text-align: center;
}

.ending-stat span,
.ending-stat b {
  display: block;
}

.ending-stat span {
  margin-bottom: 4px;
  font-size: 9px;
  font-weight: 900;
}

.ending-stat b {
  font-family: Georgia, serif;
  font-size: 21px;
}

.ticket-footer {
  padding-top: 13px;
}

.ending-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.ending-actions .text-button {
  grid-column: 1 / -1;
}

.secondary-button {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 5px 5px 0 rgba(23, 26, 19, 0.75);
}

.text-button {
  padding: 11px;
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.best-record {
  margin: 12px 0 0;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-align: center;
}

.toast {
  position: fixed;
  z-index: 300;
  left: 50%;
  top: auto;
  bottom: 20px;
  bottom: max(20px, calc(env(safe-area-inset-bottom) + 12px));
  width: min(320px, calc(100vw - 48px));
  padding: 9px 13px;
  border: 1px solid var(--paper);
  background: var(--ink);
  color: var(--paper);
  box-shadow: 4px 4px 0 rgba(255, 247, 223, 0.35);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.45;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity 200ms ease, transform 200ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

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

.poster-modal {
  position: fixed;
  z-index: 200;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 14px;
  padding: max(14px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom));
  background: rgba(19, 22, 16, 0.76);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  animation: poster-backdrop-in 220ms ease both;
}

@keyframes poster-backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.poster-dialog {
  display: grid;
  width: min(100%, 460px);
  max-height: calc(100vh - 28px);
  max-height: calc(100dvh - 28px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  overflow: hidden;
  border: 2px solid var(--ink);
  background: var(--paper);
  box-shadow: 8px 9px 0 rgba(255, 247, 223, 0.42);
  animation: poster-dialog-in 300ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes poster-dialog-in {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.poster-dialog__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 14px 11px;
  border-bottom: 2px solid var(--ink);
  background: var(--sun-bright);
}

.poster-dialog__header span {
  display: block;
  margin-bottom: 3px;
  font-family: Georgia, serif;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.poster-dialog__header h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 23px;
  line-height: 1;
}

.poster-close {
  display: grid;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  background: var(--paper);
  cursor: pointer;
  font-family: Georgia, serif;
  font-size: 25px;
  line-height: 1;
}

.poster-preview {
  min-height: 0;
  overflow: auto;
  padding: 12px;
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,.04) 0 8px, transparent 8px 16px),
    #273027;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.poster-preview img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid rgba(255, 247, 223, 0.64);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  user-select: auto;
  -webkit-touch-callout: default;
  -webkit-user-drag: auto;
}

.poster-help {
  margin: 0;
  padding: 10px 14px 0;
  color: rgba(23, 26, 19, 0.68);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.55;
  text-align: center;
}

.poster-dialog__actions {
  display: grid;
  gap: 2px;
  padding: 10px 14px 12px;
}

.poster-dialog__actions .primary-button {
  min-height: 48px;
  padding-block: 11px;
}

.poster-dialog__actions .text-button {
  padding-block: 8px;
}

@media (min-width: 760px) {
  .app-shell {
    width: min(100%, 560px);
    padding-inline: 28px;
  }

  .app-shell::before,
  .app-shell::after {
    content: "秋招 / AUTUMN RECRUITMENT";
    position: fixed;
    top: 50%;
    color: rgba(23, 26, 19, 0.5);
    font-family: Georgia, serif;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 0.32em;
    writing-mode: vertical-rl;
  }

  .app-shell::before { left: calc(50% - 320px); }
  .app-shell::after { right: calc(50% - 320px); transform: rotate(180deg); }
}

@media (max-height: 740px) {
  .app-shell {
    padding-top: max(8px, env(safe-area-inset-top));
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }

  .icon-button {
    width: 36px;
    height: 36px;
    padding: 7px;
  }

  .wordmark b {
    width: 25px;
    height: 25px;
    font-size: 16px;
  }

  .screen--intro { padding-top: 16px; }
  .intro-copy h1 { font-size: min(18vw, 78px); }
  .intro-subtitle { margin-top: 10px; font-size: 14px; }
  .eyebrow { margin-bottom: 7px; padding-block: 4px; }
  .intro-actions { padding-top: 8px; }
  .intro-actions p { margin-top: 7px; }
  .primary-button--big { min-height: 52px; }

  .screen--setup { padding-top: 18px; }
  .section-heading .step-number { margin-bottom: 7px; }
  .section-heading h2 { font-size: clamp(34px, 9dvh, 48px); }
  .section-heading p { margin-top: 9px; line-height: 1.5; }
  .role-list { gap: 7px; margin-top: 15px; }
  .role-card {
    grid-template-columns: 20px 48px 1fr auto;
    gap: 9px;
    min-height: 72px;
    padding: 7px 9px;
  }
  .role-icon { width: 46px; height: 46px; font-size: 17px; }
  .role-info b { font-size: 18px; }
  .setup-footer { margin-top: 12px; }

  .screen--game { padding-top: 8px; }
  .stage-meta { gap: 1px; }
  .stage-meta b, .round-counter b { font-size: 23px; }
  .progress-track { margin: 11px 2px 12px; }
  .progress-cow { width: 21px; height: 21px; font-size: 9px; }
  .stats-grid { gap: 5px; margin-bottom: 8px; }
  .stat { gap: 4px; padding: 5px 6px; }
  .stat span, .stat b { font-size: 9px; }

  .event-card { grid-template-rows: clamp(100px, 19dvh, 138px) minmax(0, 1fr); }
  .event-character { width: 154px; bottom: -46px; }
  .event-stamp { right: 11px; top: 10px; padding: 3px 6px; font-size: 12px; }
  .event-body { padding: 10px 12px 12px; }
  .event-label { gap: 6px; font-size: 8px; }
  .event-body h2 { margin: 6px 0 5px; font-size: clamp(22px, 5dvh, 28px); }
  .event-body > p { min-height: 28px; font-size: 10.5px; line-height: 1.4; }
  .outcome-notice { gap: 6px; margin-top: 6px; padding: 5px 7px; }
  .outcome-notice span { padding: 2px 4px; font-size: 7px; }
  .outcome-notice p { font-size: 11px; line-height: 1.3; }
  .choice-list {
    max-height: 190px;
    grid-template-rows: repeat(3, minmax(44px, 1fr));
    gap: 5px;
    margin-top: 7px;
  }
  .choice-button {
    grid-template-columns: 26px 1fr auto;
    gap: 7px;
    min-height: 44px;
    padding: 6px 8px;
  }
  .choice-key { width: 24px; height: 24px; }
  .choice-copy b { font-size: 11px; }
  .choice-copy small { margin-top: 1px; font-size: 8px; }

  .screen--ending { padding-top: 8px; }
  .ending-ticket { padding: 10px 12px 11px; }
  .ticket-topline { padding-bottom: 6px; }
  .ending-art { width: min(150px, 23dvh); height: min(164px, 25dvh); margin: -5px auto -8px; }
  .ending-qr { right: -2px; width: 72px; }
  .ending-qr canvas { width: 64px; height: 64px; }
  .ending-qr span { margin-top: 4px; font-size: 7px; }
  .ending-qr small { max-width: 72px; font-size: 6px; }
  .ending-ticket h2 { margin: 4px 0 5px; font-size: clamp(31px, 7dvh, 40px); }
  .ending-description {
    display: -webkit-box;
    overflow: hidden;
    font-size: 9.5px;
    line-height: 1.4;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }
  .ending-ticket blockquote { margin: 7px 0; padding: 6px 9px; font-size: 12px; line-height: 1.35; }
  .ending-stats { padding: 7px 0; }
  .ending-stat span { margin-bottom: 1px; font-size: 8px; }
  .ending-stat b { font-size: 17px; }
  .ticket-footer { padding-top: 7px; }
  .ending-actions { gap: 5px 7px; margin-top: 8px; }
  .ending-actions .primary-button,
  .ending-actions .secondary-button { min-height: 42px; padding: 8px; font-size: 11px; letter-spacing: 0.06em; }
  .ending-actions .text-button { padding: 6px; }
  .best-record { margin-top: 5px; }
}

@media (max-height: 620px) {
  .screen--intro { padding-top: 9px; }
  .intro-copy h1 { font-size: min(16vw, 66px); }
  .intro-subtitle { margin-top: 7px; font-size: 12px; }
  .floating-paper { padding: 4px 7px; font-size: 8px; }
  .intro-actions p { font-size: 9px; }

  .screen--setup { padding-top: 9px; }
  .section-heading p { margin-top: 6px; font-size: 11px; }
  .role-list { gap: 5px; margin-top: 9px; }
  .role-card { min-height: 62px; }
  .role-info small, .role-stats { font-size: 8px; }
  .setup-footer { margin-top: 7px; }

  .stage-meta span { font-size: 8px; }
  .stage-meta b, .round-counter b { font-size: 20px; }
  .progress-track { margin: 8px 2px 9px; }
  .stats-grid { margin-bottom: 6px; }
  .stat { padding-block: 4px; }
  .event-card { grid-template-rows: clamp(90px, 17dvh, 104px) minmax(0, 1fr); }
  .event-character { width: 132px; bottom: -44px; }
  .event-body { padding: 8px 10px 9px; }
  .event-body h2 { margin: 4px 0; font-size: 21px; }
  .event-body > p { min-height: 15px; -webkit-line-clamp: 1; }
  .outcome-notice { margin-top: 4px; padding-block: 4px; }
  .outcome-notice p { -webkit-line-clamp: 1; }
  .choice-list {
    max-height: 190px;
    grid-template-rows: repeat(3, minmax(41px, 1fr));
    gap: 4px;
    margin-top: 5px;
  }
  .choice-button { min-height: 41px; padding-block: 4px; }

  .ending-art { width: min(112px, 20dvh); height: min(122px, 22dvh); }
  .ending-qr { right: -4px; width: 62px; }
  .ending-qr canvas { width: 54px; height: 54px; box-shadow: 2px 2px 0 rgba(23, 26, 19, 0.72); }
  .ending-qr span { max-width: 62px; font-size: 6px; }
  .ending-qr small { max-width: 62px; font-size: 5px; }
  .ending-kicker { font-size: 8px; }
  .ending-ticket h2 { font-size: 29px; }
  .ending-ticket blockquote { margin: 5px 0; padding-block: 4px; }
  .ending-stats { padding: 5px 0; }
  .ticket-footer { padding-top: 5px; }
  .ending-actions .primary-button,
  .ending-actions .secondary-button { min-height: 38px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
