/* ===== Variables ===== */
:root {
  --color-bg-dark: #1a1a4e;
  --color-bg-mid: #2d4aa8;
  --color-parchment: #fff8e0;
  --color-parchment-dark: #ffe9a8;
  --color-gold: #ffcc00;
  --color-gold-light: #ffe566;
  --color-red: #ff3333;
  --color-red-dark: #cc0000;
  --color-red-glow: rgba(255, 51, 51, 0.6);
  --color-text-dark: #1a1a2e;
  --color-text-light: #ffffff;
  --color-sky-top: #3eb5ff;
  --color-sky-mid: #6ecfff;
  --color-sky-bottom: #b8ecff;
  --color-grass: #4caf35;
  --color-outline: #1a1a2e;
  --font-display: 'Jua', sans-serif;
  --font-body: 'Noto Sans KR', sans-serif;
  --shadow-modal: 0 8px 0 var(--color-outline), 0 16px 40px rgba(0, 0, 0, 0.35);
  --shadow-flash: 4px 4px 0 var(--color-outline);
  --border-gold: 3px solid var(--color-outline);

  /* Exhibition display: Left + Front + Right (floor excluded) */
  --exhibit-w: 5352px;
  --exhibit-h: 1200px;
  --panel-left-w: 1666px;
  --panel-front-w: 2020px;
  --panel-right-w: 1666px;
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-body);
  background: #000;
  color: var(--color-text-light);
}

/* ===== Exhibition triple-screen layout ===== */
#exhibit {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--exhibit-w);
  height: var(--exhibit-h);
  display: flex;
  flex-direction: row;
  transform-origin: center center;
  transform: translate(-50%, -50%) scale(var(--exhibit-scale, 0.2));
  overflow: hidden;
  background: #000;
}

.exhibit-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.exhibit-bg.dimmed::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(26, 26, 78, 0.45);
  z-index: 2;
}

.panel {
  height: 100%;
  width: var(--panel-front-w);
  position: relative;
  flex: 0 0 auto;
  overflow: hidden;
  z-index: 1;
}

.panel-left {
  width: var(--panel-left-w);
  flex-basis: var(--panel-left-w);
}

.panel-front {
  width: var(--panel-front-w);
  flex-basis: var(--panel-front-w);
}

.panel-right {
  width: var(--panel-right-w);
  flex-basis: var(--panel-right-w);
}

.panel-side {
  pointer-events: none;
  background: transparent;
}

/* Full-width gameplay canvas under panels */
.game-canvas-full {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: none;
  z-index: 1;
  pointer-events: none;
}

#exhibit.playing .game-canvas-full {
  display: block;
}

#exhibit.playing .exhibit-bg {
  opacity: 0;
  pointer-events: none;
}

#app {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  background: transparent;
}

#exhibit.playing .panel-front {
  background: transparent;
}

/* ===== Screens ===== */
.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.screen.active {
  display: flex;
}

.title-bg {
  position: absolute;
  inset: 0;
  z-index: -1;
}

.flash-bg {
  background: linear-gradient(180deg, var(--color-sky-top) 0%, var(--color-sky-mid) 45%, var(--color-sky-bottom) 100%);
  overflow: hidden;
}

.flash-bg.dimmed::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(26, 26, 78, 0.45);
  z-index: 2;
}

.flash-sun {
  position: absolute;
  top: 8%;
  /* Front panel center: ~50% of 5352 (front is 31%~69%) */
  left: 50%;
  transform: translateX(-50%);
  width: 110px;
  height: 110px;
  background: radial-gradient(circle, #fff9c4 30%, #ffeb3b 70%);
  border-radius: 50%;
  border: 4px solid var(--color-outline);
  box-shadow: 0 0 40px rgba(255, 235, 59, 0.8);
  animation: sun-pulse 3s ease-in-out infinite;
  z-index: 2;
}

@keyframes sun-pulse {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.06); }
}

.flash-cloud {
  position: absolute;
  background: #fff;
  border: 3px solid var(--color-outline);
  border-radius: 50px;
  opacity: 0.95;
  z-index: 3;
}

.flash-cloud::before,
.flash-cloud::after {
  content: '';
  position: absolute;
  background: #fff;
  border: 3px solid var(--color-outline);
  border-radius: 50%;
}

/* Left panel clouds */
.flash-cloud.c1 {
  width: 100px; height: 36px; top: 12%; left: 3%;
  animation: cloud-drift 18s linear infinite;
}
.flash-cloud.c1::before { width: 44px; height: 44px; top: -22px; left: 14px; }
.flash-cloud.c1::after { width: 56px; height: 56px; top: -28px; right: 10px; }

.flash-cloud.c2 {
  width: 85px; height: 30px; top: 24%; left: 14%;
  animation: cloud-drift 22s linear infinite reverse;
}
.flash-cloud.c2::before { width: 38px; height: 38px; top: -19px; left: 12px; }
.flash-cloud.c2::after { width: 46px; height: 46px; top: -23px; right: 8px; }

.flash-cloud.c3 {
  width: 70px; height: 26px; top: 8%; left: 22%;
  animation: cloud-drift 16s linear infinite;
  animation-delay: -3s;
}
.flash-cloud.c3::before { width: 32px; height: 32px; top: -16px; left: 10px; }
.flash-cloud.c3::after { width: 38px; height: 38px; top: -19px; right: 6px; }

/* Front panel clouds */
.flash-cloud.c4 {
  width: 120px; height: 40px; top: 14%; left: 34%;
  animation: cloud-drift 20s linear infinite;
  animation-delay: -5s;
}
.flash-cloud.c4::before { width: 48px; height: 48px; top: -24px; left: 16px; }
.flash-cloud.c4::after { width: 58px; height: 58px; top: -29px; right: 12px; }

.flash-cloud.c5 {
  width: 90px; height: 32px; top: 26%; left: 42%;
  animation: cloud-drift 24s linear infinite reverse;
}
.flash-cloud.c5::before { width: 40px; height: 40px; top: -20px; left: 12px; }
.flash-cloud.c5::after { width: 48px; height: 48px; top: -24px; right: 8px; }

.flash-cloud.c6 {
  width: 75px; height: 28px; top: 10%; left: 58%;
  animation: cloud-drift 19s linear infinite;
  animation-delay: -2s;
}
.flash-cloud.c6::before { width: 34px; height: 34px; top: -17px; left: 10px; }
.flash-cloud.c6::after { width: 42px; height: 42px; top: -21px; right: 8px; }

.flash-cloud.c7 {
  width: 105px; height: 36px; top: 22%; left: 62%;
  animation: cloud-drift 21s linear infinite reverse;
  animation-delay: -4s;
}
.flash-cloud.c7::before { width: 44px; height: 44px; top: -22px; left: 14px; }
.flash-cloud.c7::after { width: 52px; height: 52px; top: -26px; right: 10px; }

/* Right panel clouds */
.flash-cloud.c8 {
  width: 110px; height: 38px; top: 12%; left: 74%;
  animation: cloud-drift 18s linear infinite;
}
.flash-cloud.c8::before { width: 46px; height: 46px; top: -23px; left: 14px; }
.flash-cloud.c8::after { width: 56px; height: 56px; top: -28px; right: 10px; }

.flash-cloud.c9 {
  width: 80px; height: 28px; top: 28%; left: 82%;
  animation: cloud-drift 23s linear infinite reverse;
}
.flash-cloud.c9::before { width: 36px; height: 36px; top: -18px; left: 10px; }
.flash-cloud.c9::after { width: 44px; height: 44px; top: -22px; right: 8px; }

.flash-cloud.c10 {
  width: 95px; height: 34px; top: 8%; left: 90%;
  animation: cloud-drift 17s linear infinite;
  animation-delay: -6s;
}
.flash-cloud.c10::before { width: 42px; height: 42px; top: -21px; left: 12px; }
.flash-cloud.c10::after { width: 50px; height: 50px; top: -25px; right: 10px; }

.flash-cloud.c11 {
  width: 65px; height: 24px; top: 18%; left: 48%;
  animation: cloud-drift 15s linear infinite reverse;
  animation-delay: -1s;
}
.flash-cloud.c11::before { width: 28px; height: 28px; top: -14px; left: 8px; }
.flash-cloud.c11::after { width: 34px; height: 34px; top: -17px; right: 6px; }

.flash-cloud.c12 {
  width: 88px; height: 30px; top: 20%; left: 8%;
  animation: cloud-drift 25s linear infinite;
  animation-delay: -7s;
}
.flash-cloud.c12::before { width: 38px; height: 38px; top: -19px; left: 12px; }
.flash-cloud.c12::after { width: 46px; height: 46px; top: -23px; right: 8px; }

@keyframes cloud-drift {
  0% { transform: translateX(0); }
  50% { transform: translateX(30px); }
  100% { transform: translateX(0); }
}

.flash-hill {
  position: absolute;
  bottom: 0;
  height: 26%;
  background: var(--color-grass);
  border: 4px solid var(--color-outline);
  border-bottom: none;
}

/* Continuous ground across all 3 panels — no center seam */
.flash-hill.left {
  left: 0;
  width: 100%;
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
  transform: scaleY(0.55);
  transform-origin: bottom center;
}

.flash-hill.right {
  display: none;
}

/* Long rope spanning Left + Front + Right — near warrior height */
.flash-rope-line {
  position: absolute;
  top: 72%;
  left: 3%;
  width: 94%;
  height: 8px;
  background: linear-gradient(180deg, #d4b07a 0%, #a07840 50%, #8b5a2b 100%);
  border: 3px solid var(--color-outline);
  border-radius: 4px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.2);
  z-index: 6;
}

.flash-rope-post {
  position: absolute;
  top: 66%;
  width: 22px;
  height: 120px;
  background: linear-gradient(180deg, #a07850 0%, #6b4423 100%);
  border: 4px solid var(--color-outline);
  border-radius: 6px;
  z-index: 7;
}

.flash-rope-post::before {
  content: '';
  position: absolute;
  top: -12px;
  left: -8px;
  right: -8px;
  height: 20px;
  background: #8b5a2b;
  border: 3px solid var(--color-outline);
  border-radius: 4px;
}

.flash-rope-post.post-left {
  left: 2.5%;
}

.flash-rope-post.post-right {
  left: auto;
  right: 2.5%;
}

.flash-spark {
  position: absolute;
  font-size: 1.4rem;
  color: var(--color-gold);
  text-shadow: 2px 2px 0 var(--color-outline);
  animation: spark-twinkle 2s ease-in-out infinite;
}

.flash-spark.s1 { top: 18%; left: 22%; }
.flash-spark.s2 { top: 30%; right: 15%; animation-delay: 0.5s; }
.flash-spark.s3 { top: 55%; left: 12%; animation-delay: 1s; font-size: 1rem; }
.flash-spark.s4 { top: 45%; right: 28%; animation-delay: 1.5s; font-size: 1rem; }

@keyframes spark-twinkle {
  0%, 100% { opacity: 1; transform: scale(1) rotate(0deg); }
  50% { opacity: 0.4; transform: scale(0.7) rotate(20deg); }
}

.title-bg.dimmed {
  filter: none;
}

.title-bg::after {
  display: none;
}

/* ===== Header ===== */
.screen-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 28px;
  z-index: 10;
}

.flash-header {
  background: linear-gradient(180deg, rgba(255, 204, 0, 0.95) 0%, rgba(255, 153, 0, 0.95) 100%);
  border-bottom: 4px solid var(--color-outline);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.15);
}

.logo-icon {
  font-size: 1.5rem;
  filter: drop-shadow(2px 2px 0 var(--color-outline));
}

.logo-text {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--color-text-dark);
  letter-spacing: 0.02em;
  text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.5);
}

/* ===== Title Screen ===== */
#screen-title {
  justify-content: flex-end;
  align-items: center;
  padding-bottom: 10vh;
}

.title-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 960px;
  padding: 0 24px;
  z-index: 5;
}

.title-warrior-cartoon {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(calc(-50% - 420px));
  width: clamp(140px, 22vw, 220px);
  height: clamp(200px, 32vw, 300px);
  animation: warrior-bob 2s ease-in-out infinite;
  pointer-events: none;
  z-index: 1;
}

@keyframes warrior-bob {
  0%, 100% { transform: translateX(calc(-50% - 420px)) translateY(0) rotate(-2deg); }
  50% { transform: translateX(calc(-50% - 420px)) translateY(-14px) rotate(2deg); }
}

.cartoon-body {
  position: absolute;
  bottom: 18%;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 140px;
}

.cartoon-head {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 44px;
  height: 44px;
  z-index: 3;
}

.cartoon-face {
  width: 36px;
  height: 36px;
  background: #f4c99b;
  border: 3px solid var(--color-outline);
  border-radius: 50%;
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
}

.cartoon-helmet {
  width: 48px;
  height: 28px;
  background: linear-gradient(180deg, #aaa 0%, #777 100%);
  border: 3px solid var(--color-outline);
  border-radius: 24px 24px 8px 8px;
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
}

.cartoon-torso {
  position: absolute;
  top: 38px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 44px;
  background: linear-gradient(180deg, #888 0%, #666 100%);
  border: 3px solid var(--color-outline);
  border-radius: 8px;
  z-index: 2;
}

.cartoon-cape {
  position: absolute;
  top: 42px;
  left: 50%;
  transform: translateX(-50%);
  width: 52px;
  height: 50px;
  background: var(--color-red);
  border: 3px solid var(--color-outline);
  border-radius: 0 0 20px 20px;
  z-index: 1;
}

.cartoon-arm {
  position: absolute;
  top: 44px;
  width: 28px;
  height: 10px;
  background: #888;
  border: 3px solid var(--color-outline);
  border-radius: 5px;
  z-index: 4;
}

.cartoon-arm.left {
  left: 4px;
  transform: rotate(-35deg);
  transform-origin: right center;
}

.cartoon-arm.right {
  right: 4px;
  transform: rotate(35deg);
  transform-origin: left center;
}

.cartoon-leg {
  position: absolute;
  top: 78px;
  width: 12px;
  height: 36px;
  background: #5c3d1e;
  border: 3px solid var(--color-outline);
  border-radius: 4px;
  z-index: 2;
}

.cartoon-leg.left { left: 28px; transform: rotate(8deg); }
.cartoon-leg.right { right: 28px; transform: rotate(-8deg); }

.cartoon-sword {
  position: absolute;
  top: 50px;
  right: -8px;
  width: 8px;
  height: 50px;
  background: linear-gradient(90deg, #ccc 0%, #fff 50%, #ccc 100%);
  border: 2px solid var(--color-outline);
  border-radius: 2px;
  transform: rotate(25deg);
  z-index: 5;
}

.title-panel {
  flex: 0 1 auto;
  width: 100%;
  max-width: 520px;
  padding: 28px 36px 32px;
  text-align: center;
  position: relative;
  z-index: 2;
  margin: 0 auto;
}

.title-badge {
  display: inline-block;
  background: var(--color-red);
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.95rem;
  padding: 6px 18px;
  border: 3px solid var(--color-outline);
  border-radius: 20px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-flash);
  animation: badge-bounce 1.5s ease-in-out infinite;
}

@keyframes badge-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.title-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 40px;
  margin-bottom: 16px;
}

.main-title {
  text-align: center;
  font-family: var(--font-display);
  line-height: 1.15;
}

.flash-title .title-line {
  display: block;
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  color: #fff;
  -webkit-text-stroke: 2px var(--color-outline);
  paint-order: stroke fill;
  text-shadow: 4px 4px 0 var(--color-outline);
}

.flash-title .title-line.accent {
  font-size: clamp(2.8rem, 9vw, 5rem);
  color: var(--color-gold);
  -webkit-text-stroke: 3px var(--color-outline);
  animation: title-wiggle 3s ease-in-out infinite;
}

@keyframes title-wiggle {
  0%, 100% { transform: rotate(-1deg) scale(1); }
  50% { transform: rotate(1deg) scale(1.02); }
}

.title-decoration .deco-icon {
  font-size: 3rem;
  opacity: 0.7;
  animation: float 3s ease-in-out infinite;
}

.title-decoration.right .deco-icon {
  animation-delay: 1.5s;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

.title-subtitle {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--color-text-dark);
  margin: 12px 0 24px;
  letter-spacing: 0.02em;
}

/* ===== Buttons ===== */
.btn {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 400;
  letter-spacing: 0.05em;
  border: none;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.btn-flash-start {
  background: linear-gradient(180deg, #ffe566 0%, #ff9900 55%, #ff6600 100%);
  color: var(--color-text-dark);
  padding: 16px 56px;
  border: 4px solid var(--color-outline);
  border-radius: 16px;
  box-shadow: 0 6px 0 var(--color-outline), 0 10px 24px rgba(0, 0, 0, 0.25);
  text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.4);
  animation: btn-pulse 2s ease-in-out infinite;
}

.btn-flash-start.btn-small {
  padding: 12px 36px;
  font-size: 1rem;
}

.btn-flash-start:hover {
  transform: translateY(-3px);
  box-shadow: 0 9px 0 var(--color-outline), 0 14px 28px rgba(0, 0, 0, 0.3);
}

.btn-flash-start:active {
  transform: translateY(3px);
  box-shadow: 0 3px 0 var(--color-outline);
}

@keyframes btn-pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.08); }
}

.btn-flash-secondary {
  background: #fff;
  color: var(--color-text-dark);
  padding: 12px 36px;
  border: 4px solid var(--color-outline);
  border-radius: 14px;
  box-shadow: 0 5px 0 var(--color-outline);
}

.btn-flash-secondary:hover {
  background: #f0f0f0;
  transform: translateY(-2px);
  box-shadow: 0 7px 0 var(--color-outline);
}

.btn-flash-secondary:active {
  transform: translateY(2px);
  box-shadow: 0 3px 0 var(--color-outline);
}

.btn-primary {
  background: linear-gradient(180deg, #ffe566 0%, #ff9900 55%, #ff6600 100%);
  color: var(--color-text-dark);
  padding: 16px 64px;
  border-radius: 16px;
  border: 4px solid var(--color-outline);
  box-shadow: 0 6px 0 var(--color-outline);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 0 var(--color-outline);
}

.btn-primary:active {
  transform: translateY(2px);
  box-shadow: 0 4px 0 var(--color-outline);
}

.btn-glow {
  animation: btn-pulse 2s ease-in-out infinite;
}

.btn-secondary {
  background: #fff;
  color: var(--color-text-dark);
  padding: 12px 40px;
  border: 4px solid var(--color-outline);
  border-radius: 14px;
  box-shadow: 0 5px 0 var(--color-outline);
}

.btn-secondary:hover {
  background: #f5f5f5;
}

.btn-flash-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(180deg, #ffe566 0%, #ff9900 100%);
  color: var(--color-text-dark);
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 4px solid var(--color-outline);
  box-shadow: 0 5px 0 var(--color-outline), var(--shadow-modal);
}

.btn-flash-icon:hover {
  transform: scale(1.08) translateY(-2px);
}

.btn-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(180deg, #ffe566 0%, #ff9900 100%);
  color: var(--color-text-dark);
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 4px solid var(--color-outline);
  box-shadow: 0 5px 0 var(--color-outline);
}

.btn-icon:hover {
  transform: scale(1.05);
}

.btn-restart {
  font-size: 1.8rem;
}

/* ===== Modals ===== */
.modal-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 20px;
  padding-top: 70px;
}

.flash-panel {
  position: relative;
  background: linear-gradient(180deg, #fffef5 0%, var(--color-parchment) 100%);
  color: var(--color-text-dark);
  border-radius: 20px;
  border: 4px solid var(--color-outline);
  box-shadow: var(--shadow-modal);
}

.modal {
  position: relative;
  padding: 36px 40px;
  max-width: 520px;
  width: 100%;
  text-align: center;
}

.flash-border {
  position: absolute;
  inset: 10px;
  border: 3px dashed rgba(255, 153, 0, 0.5);
  border-radius: 14px;
  pointer-events: none;
}

.modal.parchment::before {
  display: none;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--color-red);
  margin-bottom: 20px;
  position: relative;
  -webkit-text-stroke: 1px var(--color-outline);
  paint-order: stroke fill;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.1);
}

.modal-icon {
  font-size: 3.5rem;
  margin-bottom: 16px;
  filter: drop-shadow(3px 3px 0 var(--color-outline));
}

.modal-desc {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--color-text-dark);
  margin-bottom: 28px;
  position: relative;
}

.modal-desc strong {
  color: var(--color-red);
  font-weight: 900;
}

.modal-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  position: relative;
}

.modal-close,
.flash-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 38px;
  height: 38px;
  border: 3px solid var(--color-outline);
  border-radius: 50%;
  background: var(--color-red);
  font-size: 1rem;
  cursor: pointer;
  color: #fff;
  z-index: 2;
  transition: transform 0.15s;
  box-shadow: 0 3px 0 var(--color-outline);
}

.modal-close:hover,
.flash-close:hover {
  transform: scale(1.1);
  background: var(--color-red-dark);
}

/* ===== Tutorial Poses ===== */
.tutorial-poses {
  display: flex;
  gap: 24px;
  justify-content: center;
  margin-bottom: 24px;
  position: relative;
}

.pose-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: rgba(44, 24, 16, 0.6);
}

.pose-card.active {
  color: var(--color-red);
  font-weight: 900;
  transform: scale(1.08);
}

.pose-figure {
  width: 60px;
  height: 90px;
  position: relative;
}

.pose-head {
  width: 16px;
  height: 16px;
  background: #f4c99b;
  border: 2px solid var(--color-outline);
  border-radius: 50%;
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
}

.pose-body {
  width: 8px;
  height: 30px;
  background: #888;
  border: 2px solid var(--color-outline);
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 2px;
}

.pose-arm {
  width: 28px;
  height: 6px;
  background: #888;
  border: 2px solid var(--color-outline);
  position: absolute;
  top: 24px;
  border-radius: 2px;
}

.pose-arm.left {
  left: 2px;
  transform-origin: right center;
  transform: rotate(-20deg);
}

.pose-arm.right {
  right: 2px;
  transform-origin: left center;
  transform: rotate(20deg);
}

.pose-leg {
  width: 6px;
  height: 28px;
  background: #5c3d1e;
  border: 2px solid var(--color-outline);
  position: absolute;
  top: 46px;
  border-radius: 2px;
}

.pose-leg.left { left: 22px; }
.pose-leg.right { right: 22px; }

.pose-figure.tilt-left {
  transform: rotate(-15deg);
}

.pose-figure.tilt-right {
  transform: rotate(15deg);
}

.tutorial-text {
  margin-bottom: 0;
}

/* ===== Nickname ===== */
.nickname-modal {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.input-group {
  width: 100%;
  position: relative;
}

.input-field {
  width: 100%;
  padding: 14px 20px;
  font-family: var(--font-body);
  font-size: 1rem;
  border: 3px solid var(--color-outline);
  border-radius: 12px;
  background: #fff;
  color: var(--color-text-dark);
  text-align: center;
  outline: none;
  transition: box-shadow 0.2s;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.08);
}

.input-field:focus {
  box-shadow: 0 0 0 4px rgba(255, 153, 0, 0.4), inset 0 2px 6px rgba(0, 0, 0, 0.08);
}

.input-field::placeholder {
  color: rgba(44, 24, 16, 0.4);
}

/* ===== Game Screen ===== */
#screen-game {
  display: none;
  background: transparent;
}

#screen-game.active {
  display: block;
}

.game-hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

.game-hud .warning-flash,
.game-hud .jump-flash,
.game-hud .duck-flash,
.game-hud .countdown-number,
.game-hud .countdown-hint {
  -webkit-text-stroke: 0.2px #fff;
  paint-order: stroke fill;
  text-shadow:
    -0.5px -0.5px 0 #fff,
    0.5px -0.5px 0 #fff,
    -0.5px 0.5px 0 #fff,
    0.5px 0.5px 0 #fff,
    0 1px 3px rgba(0, 0, 0, 0.45);
}

.camera-preview {
  position: absolute;
  top: 20px;
  left: 20px;
  width: 160px;
  height: 120px;
  border: 3px solid var(--color-outline);
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 4px 0 var(--color-outline);
}

.camera-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
  transform: scaleX(-1);
  -webkit-transform: scaleX(-1);
}

.camera-preview canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
  opacity: 0.4;
}

.camera-label {
  position: absolute;
  bottom: 4px;
  right: 6px;
  font-family: var(--font-display);
  font-size: 0.65rem;
  color: var(--color-gold);
  letter-spacing: 0.1em;
  z-index: 2;
}

.balance-meter {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.balance-track {
  width: 200px;
  height: 14px;
  background: rgba(0, 0, 0, 0.5);
  border: 3px solid var(--color-outline);
  border-radius: 10px;
  position: relative;
  overflow: hidden;
}

.balance-zone.safe {
  position: absolute;
  left: 35%;
  width: 30%;
  height: 100%;
  background: rgba(76, 175, 80, 0.3);
}

.balance-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  background: var(--color-gold);
  border: 2px solid var(--color-outline);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: left 0.1s ease;
  box-shadow: 0 2px 0 var(--color-outline);
}

.balance-indicator.danger {
  background: var(--color-red);
  box-shadow: 0 0 12px var(--color-red-glow);
}

.balance-label {
  font-size: 0.75rem;
  color: var(--color-gold);
  letter-spacing: 0.1em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

.stats-panel {
  position: absolute;
  bottom: 24px;
  left: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(255, 248, 224, 0.92);
  border: 3px solid var(--color-outline);
  border-radius: 14px;
  padding: 14px 22px;
  box-shadow: 0 4px 0 var(--color-outline);
}

.stat {
  display: flex;
  gap: 12px;
  align-items: baseline;
}

.stat-label {
  font-size: 0.8rem;
  color: rgba(26, 26, 46, 0.65);
  min-width: 80px;
  font-weight: 700;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--color-red);
}

.warning-flash {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--color-red);
  text-shadow: 0 0 20px var(--color-red-glow);
  animation: warning-pulse 0.5s ease-in-out infinite;
  pointer-events: none;
}

.warning-flash.hidden {
  display: none;
}

.jump-flash {
  position: absolute;
  top: 38%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--color-gold-light);
  text-shadow: 0 0 20px rgba(212, 175, 55, 0.8);
  pointer-events: none;
  animation: jump-pop 0.4s ease-out;
}

.jump-flash.hidden {
  display: none;
}

.duck-flash {
  position: absolute;
  top: 42%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: #7ec8ff;
  text-shadow: 0 0 20px rgba(126, 200, 255, 0.8);
  pointer-events: none;
  animation: duck-pop 0.4s ease-out;
}

.duck-flash.hidden {
  display: none;
}

@keyframes jump-pop {
  0% { transform: translate(-50%, -50%) scale(0.6); opacity: 0; }
  50% { transform: translate(-50%, -60%) scale(1.1); opacity: 1; }
  100% { transform: translate(-50%, -70%) scale(1); opacity: 0; }
}

@keyframes duck-pop {
  0% { transform: translate(-50%, -50%) scale(0.6); opacity: 0; }
  50% { transform: translate(-50%, -30%) scale(1.1); opacity: 1; }
  100% { transform: translate(-50%, -20%) scale(1); opacity: 0; }
}

.countdown-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(26, 15, 10, 0.55);
  backdrop-filter: blur(2px);
  z-index: 10;
  pointer-events: none;
}

.countdown-overlay.hidden {
  display: none;
}

.countdown-number {
  font-family: var(--font-display);
  font-size: clamp(5rem, 18vw, 9rem);
  color: var(--color-gold);
  text-shadow:
    0 0 40px rgba(212, 175, 55, 0.6),
    0 4px 20px rgba(0, 0, 0, 0.5);
  line-height: 1;
  animation: countdown-pop 0.9s ease-out;
}

.countdown-hint {
  margin-top: 20px;
  font-size: 1.1rem;
  color: rgba(245, 230, 200, 0.85);
  letter-spacing: 0.05em;
}

@keyframes countdown-pop {
  0% { transform: scale(1.6); opacity: 0; }
  30% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes warning-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ===== Result Screen ===== */
.result-container {
  display: flex;
  gap: 48px;
  align-items: stretch;
  max-width: 1800px;
  width: 100%;
  padding: 90px 48px 40px;
  flex: 1;
  box-sizing: border-box;
}

.result-left {
  flex: 1.1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  min-width: 0;
}

.result-hero {
  font-size: 6.5rem;
  filter: drop-shadow(0 4px 20px rgba(0, 0, 0, 0.3));
}

.result-name {
  font-family: var(--font-display);
  font-size: 2.6rem;
  color: var(--color-gold);
  -webkit-text-stroke: 2px var(--color-outline);
  paint-order: stroke fill;
  text-shadow: 3px 3px 0 var(--color-outline);
}

.result-stats {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 20px 0;
}

.result-stat {
  display: flex;
  gap: 20px;
  align-items: baseline;
}

.result-label {
  font-size: 1.15rem;
  color: rgba(255, 255, 255, 0.85);
  min-width: 130px;
  font-weight: 700;
}

.result-value {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--color-gold);
  -webkit-text-stroke: 1px var(--color-outline);
}

.game-over-banner {
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 5vw, 4.2rem);
  color: var(--color-red);
  -webkit-text-stroke: 2px var(--color-outline);
  paint-order: stroke fill;
  text-shadow: 4px 4px 0 var(--color-outline);
  letter-spacing: 0.05em;
  margin-top: 16px;
  animation: title-wiggle 2s ease-in-out infinite;
}

.result-right {
  flex: 1;
  max-width: 820px;
  width: 100%;
  padding: 40px 48px;
  position: relative;
  color: var(--color-text-dark);
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.ranking-title {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--color-red);
  text-align: center;
  margin-bottom: 24px;
  position: relative;
  -webkit-text-stroke: 1px var(--color-outline);
  flex-shrink: 0;
}

.ranking-list {
  list-style: none;
  position: relative;
  flex: 1;
  overflow: auto;
}

.ranking-list li {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(44, 24, 16, 0.1);
  font-size: 1.2rem;
  transition: background 0.2s;
  gap: 12px;
}

.ranking-list li:last-child {
  border-bottom: none;
}

.ranking-list li.highlight {
  background: rgba(255, 51, 51, 0.15);
  font-weight: 900;
  color: var(--color-red);
  border-radius: 10px;
}

.ranking-list .rank-num {
  font-family: var(--font-display);
  width: 40px;
  color: var(--color-red);
  font-weight: 400;
  font-size: 1.35rem;
}

.ranking-list .rank-name {
  flex: 1;
  font-size: 1.2rem;
}

.ranking-list .rank-score {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: rgba(44, 24, 16, 0.6);
}

.result-actions {
  position: absolute;
  bottom: 36px;
  right: 40px;
  display: flex;
  gap: 18px;
  z-index: 10;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .title-stage {
    flex-direction: column;
    align-items: center;
    padding-bottom: 20px;
  }

  .title-warrior-cartoon {
    position: relative;
    left: auto;
    transform: none;
    width: 120px;
    height: 180px;
    margin-bottom: 8px;
  }

  @keyframes warrior-bob {
    0%, 100% { transform: translateY(0) rotate(-2deg); }
    50% { transform: translateY(-10px) rotate(2deg); }
  }

  .title-panel {
    padding: 20px 24px;
  }

  .title-content {
    flex-direction: column;
    gap: 16px;
  }

  .title-decoration {
    display: none;
  }

  .flash-sun {
    width: 60px;
    height: 60px;
  }

  .modal {
    padding: 28px 24px;
  }

  .tutorial-poses {
    gap: 12px;
  }

  .result-container {
    flex-direction: column;
    align-items: center;
    padding-top: 70px;
  }

  .result-right {
    max-width: 100%;
    width: 100%;
  }

  .camera-preview {
    width: 120px;
    height: 90px;
  }

  .stats-panel {
    padding: 10px 16px;
  }

  .stat-value {
    font-size: 1rem;
  }
}
