@font-face { font-family:'Press Start 2P'; font-style:normal; font-weight:400; font-display:swap; src:url('fonts/press-start-2p.ttf') format('truetype'); }
@font-face { font-family:'VT323'; font-style:normal; font-weight:400; font-display:swap; src:url('fonts/vt323.ttf') format('truetype'); }

:root {
  --ink: #0c1424;
  --navy: #101a2a;
  --cream: #fff3d8;
  --sand: #e5bf83;
  --coral: #d95e43;
  --sea: #08a9bd;
  --sea-dark: #075f7a;
  --green: #2e7650;
  --gold: #f2c56a;
  --paper: #fff9e8;
  --pixel: "Press Start 2P", monospace;
  --display: "VT323", monospace;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--ink); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--cream);
  background: #070d18;
  font-family: var(--pixel);
  overflow-x: hidden;
}
button { font: inherit; }
button:focus-visible { outline: 4px solid #fff; outline-offset: 4px; }

.game-shell {
  position: relative;
  min-height: 100svh;
  isolation: isolate;
  overflow: hidden;
  background: var(--navy);
}

.scene, .scene picture, .scene img, .pixel-shade { position: absolute; inset: 0; width: 100%; height: 100%; }
.scene { z-index: -3; overflow: hidden; }
.scene picture { display: block; }
.scene img { object-fit: cover; image-rendering: pixelated; }
.menu-mode .scene {
  background: #087cae;
}
.menu-mode .scene::before {
  content: "";
  position: absolute;
  inset: -3%;
  background: url("okinawa-menu-bg.png") center / cover no-repeat;
  filter: blur(14px) brightness(.68) saturate(.9);
  transform: scale(1.05);
}
.menu-mode .scene img {
  z-index: 0;
  object-fit: contain;
  object-position: center top;
}
.pixel-shade {
  z-index: 1;
  background:
    linear-gradient(180deg, rgba(8,16,31,.1), rgba(8,16,31,.45) 68%, rgba(8,16,31,.88)),
    repeating-linear-gradient(0deg, rgba(255,255,255,.025) 0 1px, transparent 1px 4px);
  box-shadow: inset 0 0 120px rgba(0,0,0,.55);
}

.menu-mode .pixel-shade {
  background:
    linear-gradient(90deg, rgba(3,28,53,.12), rgba(3,28,53,0) 34%, rgba(3,28,53,.06)),
    linear-gradient(180deg, rgba(2,32,67,.02), rgba(2,32,67,.06) 58%, rgba(2,22,42,.34)),
    repeating-linear-gradient(0deg, rgba(255,255,255,.018) 0 1px, transparent 1px 4px);
  box-shadow: inset 0 0 90px rgba(0,21,48,.28);
}

.menu-mode .hud { visibility: hidden; }
.menu-ambience { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; image-rendering: pixelated; }
body:not(.menu-mode) .menu-ambience { display: none; }
.ambient-bird-exit { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 8; image-rendering: pixelated; }

.hud {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 24px;
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 22px 0 12px;
  text-shadow: 3px 3px 0 var(--ink);
  font-size: clamp(.48rem, 1vw, .7rem);
  line-height: 1.75;
}
.hud > :last-child { text-align: right; }
.hud-center { display: flex; align-items: center; gap: 10px; }
.hud-label, .hud-value { display: block; }
.hud-label { color: var(--gold); }
.hud-value { color: white; }
.sun-dot { width: 15px; height: 15px; background: var(--coral); box-shadow: 3px 3px 0 #87351f; }

.screen {
  width: min(1100px, calc(100% - 40px));
  min-height: calc(100svh - 150px);
  margin: 0 auto;
  padding: 5vh 0 110px;
}
.menu-screen {
  display: none;
  grid-template-columns: minmax(310px, 620px);
  place-content: center;
  justify-content: center;
  padding-top: 1vh;
  padding-left: min(25vw, 360px);
  text-align: center;
}
.menu-screen.is-active { display: grid; }

.title-lockup {
  position: relative;
  isolation: isolate;
  width: min(620px, 100%);
  padding: 28px 24px 20px;
  border: 4px solid #071c31;
  background:
    linear-gradient(90deg, #7d281f 0 18px, transparent 18px calc(100% - 18px), #7d281f calc(100% - 18px)),
    linear-gradient(180deg, #bc4b2f 0 12px, #9f3828 12px 100%);
  box-shadow:
    0 0 0 3px #e8b45b,
    8px 8px 0 rgba(3,25,46,.82);
}
.title-lockup::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: -15px;
  left: -13px;
  right: -13px;
  height: 23px;
  background: #5b211f;
  clip-path: polygon(0 58%, 5% 22%, 14% 22%, 14% 8%, 86% 8%, 86% 22%, 95% 22%, 100% 58%, 98% 100%, 2% 100%);
  box-shadow: inset 0 -5px 0 #e8b45b;
}
.title-lockup::after {
  content: "";
  position: absolute;
  z-index: -1;
  left: 15px;
  right: 15px;
  bottom: -13px;
  height: 17px;
  background:
    linear-gradient(90deg,
      #5b211f 0 15px,
      #e8b45b 15px 19px,
      transparent 19px calc(100% - 19px),
      #e8b45b calc(100% - 19px) calc(100% - 15px),
      #5b211f calc(100% - 15px));
}
.title-lockup > * {
  position: relative;
  z-index: 1;
}
.eyebrow {
  margin: 0 0 14px;
  color: var(--gold);
  font-size: clamp(.48rem, 1.2vw, .72rem);
  letter-spacing: .18em;
}
h1 {
  display: grid;
  margin: 0;
  color: var(--paper);
  font-family: var(--display);
  font-size: clamp(5.2rem, 11.5vw, 9rem);
  font-weight: 700;
  line-height: .53;
  letter-spacing: .015em;
  text-transform: uppercase;
  -webkit-text-stroke: 3px #062b4b;
  text-shadow: 5px 5px 0 #062b4b, 9px 9px 0 rgba(2,20,40,.48);
}
h1 span:first-child { color: #fff5dc; }
h1 span:last-child { color: #ee7651; font-size: 1.07em; }
.menu-screen .eyebrow {
  display: inline-block;
  margin-bottom: 18px;
  padding: 8px 12px;
  color: #fff7df;
  background: #64231f;
  box-shadow: 4px 4px 0 #062b4b;
  text-shadow: 2px 2px 0 #062b4b;
}
.subtitle {
  display: inline-block;
  margin: 26px 0 0;
  padding: 9px 13px;
  color: #062b4b;
  background: #f3cf81;
  box-shadow: 4px 4px 0 #062b4b;
  font-size: clamp(.46rem, 1.1vw, .66rem);
  letter-spacing: .13em;
}

.kata-menu {
  display: grid;
  gap: 8px;
  width: min(550px, 100%);
  margin: 28px auto 20px;
  text-align: left;
}
.kata-option {
  display: grid;
  grid-template-columns: 30px 52px 1fr;
  align-items: center;
  gap: 8px;
  min-height: 62px;
  padding: 10px 18px;
  border: 0;
  color: #fff3d8;
  background: rgba(4,57,78,.9);
  box-shadow: inset 0 0 0 3px rgba(174,234,230,.32), 6px 6px 0 rgba(2,28,48,.82);
  text-align: left;
}
.kata-option.is-selected {
  color: #062b4b;
  background: #f2c56a;
  box-shadow: inset 0 0 0 3px #fff3d8, 6px 6px 0 #062b4b;
}
.kata-option:disabled { opacity: .62; }
.cursor { animation: blink 900ms steps(1) infinite; }
.option-number { font-family: var(--display); font-size: 2.1rem; }
.option-copy { display: grid; gap: 6px; }
.option-copy strong { font-size: clamp(.62rem, 1.6vw, .82rem); }
.option-copy small { font-size: .45rem; letter-spacing: .12em; opacity: .75; }

.pixel-button {
  border: 0;
  padding: 16px 24px;
  color: var(--ink);
  background: var(--cream);
  box-shadow: inset -5px -5px 0 #d49a50, inset 5px 5px 0 #fffbdc, 7px 7px 0 var(--ink);
  cursor: pointer;
}
.start-button {
  color: #fff8e9;
  background: #d95e43;
  box-shadow: inset -5px -5px 0 #97372c, inset 5px 5px 0 #ef9270, 7px 7px 0 #062b4b;
}
.start-button:hover {
  box-shadow: inset -5px -5px 0 #97372c, inset 5px 5px 0 #ef9270, 5px 5px 0 #062b4b;
}
.pixel-button:hover { transform: translate(2px,2px); box-shadow: inset -5px -5px 0 #d49a50, inset 5px 5px 0 #fffbdc, 5px 5px 0 var(--ink); }
.pixel-button:active { transform: translate(6px,6px); box-shadow: inset -3px -3px 0 #d49a50, inset 3px 3px 0 #fffbdc, 1px 1px 0 var(--ink); }
.helper-text {
  margin: 20px 0 0;
  color: #fff7df;
  font-family: var(--display);
  font-size: 1.25rem;
  letter-spacing: .05em;
  text-shadow: 2px 2px 0 #062b4b;
}

.draw-screen { display: none; align-content: start; }
.draw-screen.is-active { display: block; }
.draw-heading {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 18px;
  margin: 2vh 0 34px;
  text-align: center;
  text-shadow: 3px 3px 0 var(--ink);
}
.draw-heading h2 { margin: 0; color: white; font-family: var(--display); font-size: clamp(2.6rem, 7vw, 5rem); line-height: .8; }
.draw-heading .eyebrow { margin-bottom: 10px; }
.back-button, .text-button { border: 0; color: var(--cream); background: none; cursor: pointer; font-size: .58rem; }
.back-button { justify-self: start; padding: 12px 0; }
.set-number { justify-self: end; color: var(--gold); font-size: .58rem; }

.card-stage { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(14px, 2vw, 26px); perspective: 1200px; }
.draw-card {
  position: relative;
  min-width: 0;
  aspect-ratio: 5 / 7;
  padding: 12px;
  color: var(--ink);
  background: var(--paper);
  border: 5px solid var(--ink);
  box-shadow: 8px 8px 0 rgba(7,13,24,.85);
  overflow: hidden;
}
.draw-card::after { content: ""; position: absolute; inset: 6px; border: 2px solid #cc8b42; pointer-events: none; }
.card-back { display: grid; place-items: center; align-content: center; gap: 18px; color: var(--cream); background: var(--sea-dark); }
.card-back-mark { display: grid; place-items: center; width: 38%; aspect-ratio: 1; border: 7px double var(--cream); border-radius: 50%; font-family: var(--display); font-size: clamp(2rem, 6vw, 5rem); }
.card-back p { font-size: clamp(.5rem, 1.3vw, .7rem); }
.is-revealed { animation: deal 520ms var(--delay) cubic-bezier(.2,.8,.2,1) both; }
.card-number { position: absolute; z-index: 2; top: 22px; left: 22px; display: grid; place-items: center; width: 40px; height: 40px; color: white; background: var(--coral); font-family: var(--display); font-size: 1.8rem; box-shadow: 3px 3px 0 var(--ink); }
.card-media { height: 68%; margin: 8px 8px 0; overflow: hidden; background: #1c777c; }
.card-media img { width: 100%; height: 100%; object-fit: contain; }
.demo-art { position: relative; display: grid; place-items: center; width: 100%; height: 100%; background: linear-gradient(#f3a65e 0 45%, #1f9ba0 45% 68%, #e5bd72 68%); overflow: hidden; }
.demo-art::before { content: ""; position: absolute; top: 19%; right: 13%; width: 22%; aspect-ratio: 1; background: #ffe9a4; box-shadow: 5px 5px 0 #bd5d3b; }
.demo-art::after { content: ""; position: absolute; bottom: 22%; left: -5%; width: 110%; height: 14%; background: #1a5b46; clip-path: polygon(0 70%,12% 20%,25% 66%,42% 0,55% 75%,72% 27%,86% 72%,100% 10%,100% 100%,0 100%); }
.demo-art span { z-index: 1; color: var(--paper); font-family: var(--display); font-size: clamp(4rem, 10vw, 8rem); line-height: 1; text-shadow: 6px 6px 0 rgba(12,20,36,.55); }
.demo-art i { position: absolute; z-index: 2; bottom: 17%; width: 60%; height: 7%; background: #74391e; box-shadow: 0 5px 0 #4e2417; transform: skewX(-22deg); }
.demo-art b { position: absolute; z-index: 3; bottom: 6%; color: var(--cream); font-size: clamp(.38rem, 1.2vw, .6rem); letter-spacing: .08em; text-shadow: 2px 2px 0 var(--ink); }
.card-copy { position: relative; z-index: 2; padding: 14px 12px; }
.card-copy h3 { margin: 0 0 8px; color: #812b24; font-family: var(--display); font-size: clamp(1.8rem, 4vw, 3rem); line-height: .8; }
.card-copy p { margin: 0; font-family: var(--display); font-size: clamp(.9rem, 1.7vw, 1.3rem); line-height: 1.05; }

.draw-controls { display: flex; justify-content: center; align-items: center; gap: 28px; margin: 32px 0 18px; }
.draw-button { background: var(--gold); min-width: 230px; }
.deck-status { margin: 0; text-align: center; color: rgba(255,255,255,.75); font-family: var(--display); font-size: 1.2rem; text-shadow: 2px 2px 0 var(--ink); }

.game-footer {
  position: absolute;
  inset: auto 0 0;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 24px;
  color: rgba(255,255,255,.65);
  background: rgba(7,13,24,.82);
  font-size: clamp(.38rem, 1vw, .52rem);
  letter-spacing: .1em;
}
.menu-mode .game-footer {
  color: #fff3d8;
  background: rgba(3,39,61,.78);
  border-top: 4px solid rgba(255,243,216,.65);
}

@keyframes blink { 50% { opacity: 0; } }
@keyframes deal { from { opacity: 0; transform: translateY(40px) rotateY(70deg) scale(.88); } to { opacity: 1; transform: none; } }

@media (max-width: 720px) {
  .hud { width: calc(100% - 28px); gap: 10px; padding-top: 14px; }
  .hud-center { display: none; }
  .hud { grid-template-columns: 1fr 1fr; }
  .screen { width: min(100% - 24px, 520px); padding-top: 3vh; }
  .menu-mode .game-shell {
    min-height: 100svh;
    background: #073d60;
  }
  .menu-mode .scene {
    inset: 0;
    height: 100svh;
    max-height: none;
    background: #087cae;
  }
  .menu-mode .scene::before { display: none; }
  .menu-mode .scene img {
    object-fit: cover;
    object-position: center;
  }
  .menu-mode .pixel-shade {
    background:
      linear-gradient(90deg, rgba(2,24,44,.04), rgba(2,24,44,.02) 48%, rgba(2,24,44,.2)),
      linear-gradient(180deg, rgba(2,24,44,.02), rgba(2,24,44,.04) 62%, rgba(2,24,44,.28));
    box-shadow: inset 0 0 38px rgba(0,21,48,.18);
  }
  .menu-mode .menu-screen {
    position: absolute;
    inset: 0;
    width: min(84vw, 350px);
    min-height: 0;
    height: 100svh;
    max-height: none;
    margin: 0 auto;
    padding: 9svh 0 54px;
    grid-template-columns: minmax(0, 1fr);
    place-content: start stretch;
  }
  .menu-mode .title-lockup {
    width: calc(100% - 8px);
    margin: 5px auto 0;
    padding: 20px 12px 17px;
    border-width: 3px;
    box-shadow: 0 0 0 2px #e8b45b, 6px 6px 0 rgba(3,25,46,.82);
  }
  .menu-mode .title-lockup::before {
    top: -12px;
    left: -10px;
    right: -10px;
    height: 19px;
    box-shadow: inset 0 -4px 0 #e8b45b;
  }
  .menu-mode .title-lockup::after {
    left: 12px;
    right: 12px;
    bottom: -10px;
    height: 14px;
  }
  .menu-mode .menu-screen .eyebrow {
    margin: 0 0 10px;
    padding: 6px 8px;
    font-size: clamp(.33rem, 1.55vw, .48rem);
    line-height: 1.35;
    letter-spacing: .11em;
    box-shadow: 3px 3px 0 #062b4b;
    text-shadow: 2px 2px 0 #062b4b;
  }
  .menu-mode h1 {
    font-size: clamp(3.55rem, 15.5vw, 5.25rem);
    line-height: .5;
    -webkit-text-stroke-width: 2px;
    text-shadow: 4px 4px 0 #062b4b, 7px 7px 0 rgba(2,20,40,.48);
  }
  .menu-mode .subtitle {
    margin-top: 12px;
    padding: 6px 9px;
    font-size: clamp(.34rem, 1.55vw, .48rem);
    line-height: 1.35;
    letter-spacing: .1em;
    box-shadow: 3px 3px 0 #062b4b;
  }
  .menu-mode .kata-menu {
    gap: 7px;
    width: 100%;
    margin: 17px 0 12px;
  }
  .menu-mode .kata-option {
    grid-template-columns: 17px 39px 1fr;
    gap: 8px;
    min-height: 52px;
    padding: 8px 12px;
    box-shadow: inset 0 0 0 2px rgba(174,234,230,.32), 5px 5px 0 rgba(2,28,48,.82);
  }
  .menu-mode .kata-option.is-selected {
    box-shadow: inset 0 0 0 2px #fff3d8, 5px 5px 0 #062b4b;
  }
  .menu-mode .option-number { font-size: 1.6rem; }
  .menu-mode .option-copy { gap: 5px; }
  .menu-mode .option-copy strong { font-size: clamp(.48rem, 2.25vw, .68rem); }
  .menu-mode .option-copy small { font-size: clamp(.28rem, 1.3vw, .4rem); letter-spacing: .08em; }
  .menu-mode .pixel-button {
    min-height: 48px;
    padding: 11px 15px;
    font-size: clamp(.54rem, 2.5vw, .76rem);
    box-shadow: inset -4px -4px 0 #97372c, inset 4px 4px 0 #ef9270, 6px 6px 0 #062b4b;
  }
  .menu-mode .helper-text {
    margin-top: 13px;
    font-size: clamp(.8rem, 4vw, 1.15rem);
    text-shadow: 2px 2px 0 #062b4b;
  }
  .menu-mode .game-footer {
    position: absolute;
    inset: auto 0 0;
    height: 34px;
    margin: 0;
    padding: 10px 12px;
    border-top-width: 2px;
    font-size: .28rem;
  }
  .draw-heading { grid-template-columns: 1fr 1fr; align-items: center; }
  .draw-heading > div { grid-column: 1 / -1; grid-row: 1; }
  .back-button { grid-column: 1; grid-row: 2; }
  .set-number { grid-column: 2; grid-row: 2; }
  .card-stage { grid-template-columns: 1fr; width: min(340px, 100%); margin: 0 auto; }
  .draw-card { aspect-ratio: 5 / 6.8; }
  .draw-controls { flex-direction: column; gap: 20px; }
  .game-footer { position: relative; margin-top: -60px; }
}

@media (max-height: 520px) and (min-width: 721px) {
  .menu-screen {
    position: absolute;
    inset: 0 0 40px;
    width: min(1100px, calc(100% - 24px));
    min-height: 0;
    padding: 6px 0 4px min(27vw, 300px);
    place-content: start center;
    grid-template-columns: minmax(300px, 520px);
  }
  .title-lockup { padding: 0 12px 2px; }
  .menu-screen .eyebrow {
    margin-bottom: 5px;
    padding: 5px 9px;
    font-size: .42rem;
  }
  h1 {
    font-size: clamp(3.9rem, 8.5vw, 5.2rem);
    line-height: .48;
    -webkit-text-stroke-width: 2px;
    text-shadow: 4px 4px 0 #062b4b, 7px 7px 0 rgba(2,20,40,.48);
  }
  .subtitle {
    margin-top: 6px;
    padding: 6px 10px;
    font-size: .43rem;
  }
  .kata-menu {
    gap: 4px;
    width: min(500px, 100%);
    margin: 6px auto 4px;
  }
  .kata-option {
    grid-template-columns: 20px 38px 1fr;
    gap: 6px;
    min-height: 37px;
    padding: 5px 12px;
    box-shadow: inset 0 0 0 2px rgba(174,234,230,.32), 4px 4px 0 rgba(2,28,48,.82);
  }
  .kata-option.is-selected {
    box-shadow: inset 0 0 0 2px #fff3d8, 4px 4px 0 #062b4b;
  }
  .option-number { font-size: 1.55rem; }
  .option-copy { gap: 3px; }
  .option-copy strong { font-size: .56rem; }
  .option-copy small { font-size: .36rem; }
  .pixel-button { padding: 8px 18px; font-size: .56rem; }
  .helper-text { margin-top: 4px; font-size: .85rem; }
  .game-footer { padding: 9px 18px; font-size: .34rem; }
}

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

/* Kata level wireframes */
.draw-mode .scene img {
  object-fit: cover;
  object-position: center top;
}
.draw-mode .pixel-shade {
  z-index: 2;
  background:
    linear-gradient(180deg, rgba(5,18,28,.18), rgba(5,18,28,.03) 26%, rgba(5,18,28,.08) 58%, rgba(5,18,28,.66)),
    repeating-linear-gradient(0deg, rgba(255,255,255,.025) 0 1px, transparent 1px 4px);
  box-shadow: inset 0 0 72px rgba(0,0,0,.28);
}
.progress-art {
  position: absolute;
  z-index: 1;
  inset: 0;
  pointer-events: none;
}
.progress-flower,
.progress-practitioner {
  opacity: 0;
  transform: scale(0);
  transition: opacity 280ms steps(2), transform 420ms cubic-bezier(.2,1.7,.4,1);
}
.progress-flower.is-earned,
.progress-practitioner.is-earned {
  opacity: 1;
  transform: scale(1);
}
.progress-flowers {
  inset: 0;
  display: block;
}
.progress-flowers .progress-flower {
  position: absolute;
}
.progress-flower {
  position: relative;
  display: block;
  width: clamp(5px, 1.4vw, 12px);
  height: clamp(9px, 2.4vw, 20px);
  border-bottom: clamp(4px, 1vw, 8px) solid #238043;
}
.progress-flower::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 58%;
  aspect-ratio: 1;
  background: var(--flower-color);
  box-shadow:
    calc(-1 * clamp(3px, .65vw, 5px)) 0 0 var(--flower-color),
    clamp(3px, .65vw, 5px) 0 0 var(--flower-color),
    0 calc(-1 * clamp(3px, .65vw, 5px)) 0 var(--flower-color),
    0 clamp(3px, .65vw, 5px) 0 var(--flower-color);
  transform: translateX(-50%);
}
.progress-flower::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 50%;
  width: 3px;
  height: 3px;
  background: #fff2a2;
  transform: translateX(-50%);
}
.progress-garland .progress-flower {
  position: absolute;
  width: clamp(5px, 1.1vw, 10px);
  height: clamp(8px, 1.8vw, 16px);
}
.progress-practitioners {
  inset: 58% 7% 8%;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  grid-template-rows: repeat(7, 1fr);
  align-items: end;
  justify-items: center;
  perspective: 500px;
}
.progress-practitioner {
  position: relative;
  display: block;
  width: clamp(6px, 1.6vw, 15px);
  height: clamp(13px, 3vw, 28px);
  margin-top: var(--row-delay);
  background:
    linear-gradient(90deg, transparent 0 24%, #f7f1df 24% 76%, transparent 76%) 50% 24% / 100% 42% no-repeat,
    linear-gradient(90deg, #f7f1df 0 38%, transparent 38% 62%, #f7f1df 62%) 50% 82% / 100% 44% no-repeat;
  filter: drop-shadow(1px 2px 0 rgba(20,30,35,.85));
}
.progress-practitioner::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 38%;
  aspect-ratio: 1;
  background: #c88b62;
  transform: translateX(-50%);
}
.progress-practitioner::after {
  content: "";
  position: absolute;
  top: 55%;
  left: 18%;
  right: 18%;
  height: 2px;
  background: white;
  box-shadow: 0 2px 0 #d5d5cf;
}
.draw-screen {
  position: relative;
  z-index: 3;
  min-height: calc(100svh - 110px);
  padding-top: 12px;
}
.draw-screen.is-active {
  display: grid;
  grid-template-rows: auto 1fr auto auto;
}
.level-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  border: 3px solid #071c31;
  color: #fff3d8;
  background: rgba(91,33,31,.92);
  box-shadow: 0 0 0 2px #e8b45b, 6px 6px 0 rgba(3,25,46,.84);
  text-align: center;
}
.level-title .eyebrow {
  margin: 0 0 7px;
  color: #f3cf81;
  font-size: .52rem;
}
.level-title h2 {
  margin: 0;
  color: white;
  font-family: var(--display);
  font-size: clamp(2rem, 5vw, 3.8rem);
  line-height: .8;
  text-shadow: 3px 3px 0 #062b4b;
}
.level-progress {
  display: grid;
  justify-items: end;
  gap: 7px;
  color: #f3cf81;
  font-size: .42rem;
}
.level-progress strong {
  color: white;
  font-family: var(--display);
  font-size: 1.7rem;
}
.draw-screen .card-stage {
  align-self: center;
  width: min(880px, 100%);
  margin: 3vh auto 0;
}
.draw-screen .draw-card {
  background: rgba(255,249,232,.96);
  backdrop-filter: blur(2px);
}
.draw-screen .draw-controls {
  margin: 18px 0 14px;
}
.draw-screen .draw-button {
  min-width: min(300px, 72vw);
  color: #fff8e9;
  background: #d95e43;
  box-shadow: inset -5px -5px 0 #97372c, inset 5px 5px 0 #ef9270, 7px 7px 0 #062b4b;
}
.draw-screen .deck-status {
  display: inline-block;
  justify-self: center;
  margin: 0 0 12px;
  padding: 8px 12px;
  color: #fff7df;
  background: rgba(5,45,61,.82);
  box-shadow: 3px 3px 0 #062b4b;
  font-size: 1rem;
}
.game-modal[hidden] { display: none; }
.game-modal {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(2,16,31,.56);
  backdrop-filter: blur(3px);
}
.modal-panel {
  width: min(520px, 100%);
  padding: clamp(26px, 6vw, 48px);
  border: 4px solid #071c31;
  color: #fff3d8;
  background: #9f3828;
  box-shadow: 0 0 0 3px #e8b45b, 10px 10px 0 rgba(3,25,46,.9);
  text-align: center;
}
.modal-panel h2 {
  margin: 14px 0 20px;
  color: white;
  font-family: var(--display);
  font-size: clamp(2.7rem, 9vw, 4.8rem);
  line-height: .82;
  text-shadow: 4px 4px 0 #5b211f;
}
.modal-panel p {
  font-family: var(--display);
  font-size: clamp(1.15rem, 4vw, 1.6rem);
  line-height: 1.15;
}
.modal-kicker {
  color: #f3cf81;
  font-family: var(--pixel) !important;
  font-size: .62rem !important;
  letter-spacing: .12em;
}
.modal-note { color: #ffe1b2; }
.modal-actions {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-top: 28px;
}
.next-button { background: #f2c56a; }

@media (max-width: 720px) {
  .draw-mode .game-shell { min-height: 100svh; }
  .draw-mode .hud { visibility: hidden; position: absolute; }
  .draw-mode .scene { height: 100svh; }
  .draw-mode .scene img { object-fit: cover; object-position: center top; }
  .draw-mode .screen {
    width: 100%;
    min-height: 100svh;
    padding: 12px 12px 48px;
  }
  .draw-screen.is-active {
    grid-template-rows: auto minmax(0,1fr) auto auto;
  }
  .level-bar {
    grid-template-columns: 66px 1fr 66px;
    gap: 4px;
    padding: 8px 8px;
    border-width: 2px;
    box-shadow: 0 0 0 2px #e8b45b, 4px 4px 0 rgba(3,25,46,.84);
  }
  .level-bar .back-button {
    grid-column: auto;
    grid-row: auto;
    justify-self: start;
    padding: 8px 0;
    font-size: .38rem;
  }
  .level-title .eyebrow {
    margin-bottom: 5px;
    font-size: .37rem;
    letter-spacing: .1em;
  }
  .level-title h2 {
    font-size: clamp(1.55rem, 7.4vw, 2.1rem);
    text-shadow: 2px 2px 0 #062b4b;
  }
  .level-progress { gap: 4px; font-size: .27rem; }
  .level-progress strong { font-size: 1.15rem; }
  .draw-screen .card-stage {
    grid-template-columns: repeat(3, minmax(0,1fr));
    align-self: end;
    gap: 5px;
    width: 100%;
    margin: 0 auto 3svh;
  }
  .draw-screen .draw-card {
    aspect-ratio: 5 / 7;
    padding: 4px;
    border-width: 3px;
    box-shadow: 4px 4px 0 rgba(7,13,24,.82);
  }
  .draw-screen .draw-card::after { inset: 3px; border-width: 1px; }
  .draw-screen .card-back { gap: 8px; }
  .draw-screen .card-back-mark { border-width: 3px; font-size: 1.5rem; }
  .draw-screen .card-back p { font-size: .32rem; }
  .draw-screen .card-number {
    top: 9px;
    left: 9px;
    width: 22px;
    height: 22px;
    font-size: 1rem;
    box-shadow: 2px 2px 0 var(--ink);
  }
  .draw-screen .card-media { height: 68%; margin: 3px 3px 0; }
  .draw-screen .demo-art span { font-size: clamp(2.5rem, 13vw, 3.4rem); text-shadow: 3px 3px 0 rgba(12,20,36,.55); }
  .draw-screen .demo-art i { box-shadow: 0 3px 0 #4e2417; }
  .draw-screen .demo-art b { bottom: 5%; font-size: .24rem; }
  .draw-screen .card-copy { padding: 7px 4px 3px; }
  .draw-screen .card-copy h3 { margin-bottom: 3px; font-size: clamp(.95rem, 4.6vw, 1.3rem); }
  .draw-screen .card-copy p { font-size: clamp(.48rem, 2.25vw, .65rem); }
  .draw-screen .draw-controls { margin: 0 0 13px; }
  .draw-screen .draw-button {
    min-width: min(250px, 67vw);
    min-height: 48px;
    padding: 12px 18px;
    font-size: .7rem;
  }
  .draw-screen .deck-status {
    margin-bottom: 4px;
    padding: 7px 9px;
    font-size: .72rem;
  }
  .draw-mode .game-footer {
    position: absolute;
    z-index: 5;
    inset: auto 0 0;
    height: 34px;
    margin: 0;
    padding: 10px 12px;
    border-top: 2px solid rgba(255,243,216,.65);
    font-size: .28rem;
  }
  .progress-flowers { inset: 46% 3% 39%; }
  .progress-practitioners { inset: 44% 6% 38%; }
  .modal-panel { padding: 28px 20px; border-width: 3px; }
  .modal-actions { flex-direction: column; gap: 15px; }
  .modal-actions .pixel-button { width: 100%; }
}

/* Hidden 10,000-draw achievement */
.milestone-number {
  margin: 0 0 8px !important;
  color: #f3cf81;
  font-family: var(--pixel) !important;
  font-size: clamp(1.35rem, 6vw, 2.5rem) !important;
  line-height: 1.1 !important;
  text-shadow: 4px 4px 0 #5b211f;
}
.easter-panel {
  background:
    linear-gradient(135deg, rgba(255,255,255,.04) 25%, transparent 25%) 0 0 / 16px 16px,
    #272052;
}
.symbol-puzzle {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: min(360px, 82vw);
  margin: 22px auto;
  image-rendering: pixelated;
}
.symbol-stage {
  display: grid;
  gap: 7px;
  justify-items: center;
  color: rgba(255,255,255,.38);
  font-size: clamp(.32rem, 1.8vw, .48rem);
}
.symbol-stage img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  image-rendering: pixelated;
  filter: grayscale(1) brightness(.42);
}
.symbol-piece {
  opacity: .22;
  transition: opacity 260ms steps(2), filter 260ms steps(2);
}
.symbol-piece.is-earned { opacity: 1; filter: none; }
.symbol-piece.is-new { animation: newPiecePulse 900ms steps(2) 2; }
.achievement-name {
  margin: 16px 0 7px;
  color: #c8c1ff;
  font-size: clamp(.64rem, 3vw, .9rem);
  line-height: 1.4;
}
.easter-panel .achievement-description {
  max-width: 420px;
  margin: 0 auto 22px;
  color: #eeeaff;
  font-size: clamp(.95rem, 3.7vw, 1.25rem);
}
.golden-panel {
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 32%, rgba(255,221,96,.2), transparent 35%),
    #282044;
}
.transformation-stage {
  position: relative;
  width: min(250px, 68vw);
  aspect-ratio: 1;
  margin: 0 auto 20px;
}
.complete-symbol {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  animation: symbolTransform 3.2s steps(16) forwards;
}
.golden-spiral-art {
  position: absolute;
  inset: 3%;
  opacity: 0;
  filter: drop-shadow(0 0 8px rgba(255,213,74,.72));
  animation: goldenReveal 1s steps(6) 2.35s forwards;
}
.golden-spiral-art i {
  position: absolute;
  border: 6px solid #ffd54a;
  border-left-color: transparent;
  border-bottom-color: transparent;
  border-radius: 50%;
  box-shadow: 3px -3px 0 #a86c18;
}
.golden-spiral-art i:nth-child(1) { inset: 2%; transform: rotate(0deg); }
.golden-spiral-art i:nth-child(2) { inset: 14%; transform: rotate(90deg); }
.golden-spiral-art i:nth-child(3) { inset: 25%; transform: rotate(180deg); }
.golden-spiral-art i:nth-child(4) { inset: 35%; transform: rotate(270deg); }
.golden-spiral-art i:nth-child(5) { inset: 44%; transform: rotate(0deg); }
.golden-spiral-art i:nth-child(6) { inset: 52%; transform: rotate(90deg); }
.golden-spiral-art i:nth-child(7) { inset: 59%; transform: rotate(180deg); }
.has-golden-spiral .progress-flowers .progress-flower,
.has-golden-spiral .progress-garland .progress-flower {
  --flower-color: #ffd54a !important;
  filter: drop-shadow(0 0 3px rgba(255,213,74,.85));
}
.progress-dancer {
  position: relative;
  display: block;
  width: clamp(7px, 1.8vw, 16px);
  height: clamp(14px, 3.2vw, 30px);
  opacity: 0;
  transform: scale(0);
  transform-origin: 50% 100%;
  background:
    linear-gradient(90deg, transparent 0 17%, var(--costume-color) 17% 83%, transparent 83%) 50% 30% / 100% 48% no-repeat,
    linear-gradient(90deg, var(--costume-color) 0 38%, transparent 38% 62%, var(--costume-color) 62%) 50% 90% / 100% 43% no-repeat;
  filter: drop-shadow(1px 2px 0 rgba(20,30,35,.88));
}
.progress-dancer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 42%;
  aspect-ratio: 1;
  background: #c98e65;
  border-top: 3px solid #2b1716;
  transform: translateX(-50%);
}
.progress-dancer::after {
  content: "";
  position: absolute;
  top: 31%;
  left: -18%;
  width: 136%;
  height: 3px;
  background: var(--costume-color);
  box-shadow: 0 3px 0 rgba(255,255,255,.5);
}
.progress-dancer.is-earned {
  opacity: 1;
  animation: okinawanDance 3s steps(1, end) infinite;
}

.lock-message {
  place-items: end center;
  padding: 18px 18px 54px;
  background: transparent;
  backdrop-filter: none;
  pointer-events: none;
}
.lock-message .modal-panel {
  width: min(390px, 100%);
  padding: 14px 16px;
  border-width: 2px;
  background: rgba(6,43,75,.88);
  box-shadow: 0 0 0 2px rgba(232,180,91,.92), 5px 5px 0 rgba(3,25,46,.78);
  pointer-events: auto;
}
.lock-message .modal-kicker {
  margin: 0 0 7px;
  font-size: .42rem !important;
}
.lock-message h2 {
  margin: 0 0 8px;
  font-family: var(--pixel);
  font-size: .75rem;
  line-height: 1.3;
  text-shadow: 2px 2px 0 #03192e;
}
.lock-message p {
  margin: 0 0 10px;
  font-size: .92rem;
}
.lock-message .pixel-button {
  padding: 9px 12px;
  font-size: .48rem;
}

@keyframes newPiecePulse {
  0%,100% { filter: brightness(1); transform: scale(1); }
  50% { filter: brightness(1.8) drop-shadow(0 0 12px #958cff); transform: scale(1.08); }
}
@keyframes symbolTransform {
  0% { opacity: 1; transform: rotate(0) scale(1); }
  70% { opacity: 1; transform: rotate(1080deg) scale(.82); }
  100% { opacity: 0; transform: rotate(1440deg) scale(.2); }
}
@keyframes goldenReveal {
  from { opacity: 0; transform: scale(.25) rotate(-180deg); }
  to { opacity: 1; transform: scale(1) rotate(0); }
}
@keyframes okinawanDance {
  0%,100% { transform: translateY(0) rotate(-7deg) scale(1); }
  33.333% { transform: translateY(-3px) rotate(7deg) scale(1); }
  66.666% { transform: translateY(0) rotate(0deg) scale(1.08); }
}

@media (max-width: 720px) {
  .easter-panel,
  .golden-panel { padding: 24px 18px; }
  .easter-panel h2,
  .golden-panel h2 { font-size: clamp(2.25rem, 11vw, 3.4rem); }
  .golden-panel h2 { line-height: .75; }
  .transformation-stage { width: min(210px, 58vw); }
  .draw-mode .scene {
    background: #087cae;
  }
  .draw-mode .scene img {
    object-fit: cover;
    object-position: center top;
  }
  .draw-mode .pixel-shade {
    background:
      linear-gradient(180deg, rgba(5,18,28,.11), rgba(5,18,28,0) 22%, rgba(5,18,28,.04) 74%, rgba(5,18,28,.34)),
      repeating-linear-gradient(0deg, rgba(255,255,255,.018) 0 1px, transparent 1px 4px);
    box-shadow: inset 0 0 34px rgba(0,0,0,.18);
  }
  .draw-screen.is-active {
    display: block;
    position: absolute;
    inset: 0;
    min-height: 100svh;
    --card-top: 36.5svh;
    --card-height: calc(((100vw - 34px) / 3) * 1.66);
  }
  body[data-kata="naihanchi-2"] .draw-screen.is-active { --card-top: 40.5svh; }
  body[data-kata="naihanchi-3"] .draw-screen.is-active { --card-top: 36.5svh; }
  .draw-mode .level-bar {
    position: absolute;
    z-index: 5;
    top: 11px;
    left: 12px;
    right: 12px;
  }
  .draw-screen .card-stage {
    position: absolute;
    z-index: 4;
    top: var(--card-top);
    left: 12px;
    right: 12px;
    width: auto;
    height: var(--card-height);
    margin: 0;
    align-items: stretch;
  }
  .draw-screen .draw-card {
    height: var(--card-height);
    aspect-ratio: auto;
  }
  .draw-screen .draw-controls {
    position: absolute;
    z-index: 5;
    top: calc(var(--card-top) + var(--card-height) + 14px);
    left: 12px;
    right: 12px;
    margin: 0;
  }
  .draw-screen .deck-status {
    position: absolute;
    z-index: 5;
    top: calc(var(--card-top) + var(--card-height) + 74px);
    left: 50%;
    width: max-content;
    max-width: calc(100% - 34px);
    transform: translateX(-50%);
  }
  body[data-kata="naihanchi-2"] .scene img {
    transform: scale(1.07);
    transform-origin: center top;
  }
  .progress-flowers { inset: 74% 3% 5%; }
  .progress-garland { inset: 0; }
  .progress-practitioners { inset: 72% 6% 6%; }
  .progress-practitioners .progress-practitioner,
  .progress-practitioners .progress-dancer {
    width: clamp(5px, 1.8vw, 8px);
    height: clamp(11px, 4vw, 18px);
  }
  .symbol-puzzle { gap: 6px; width: min(320px, 86vw); }
  .symbol-stage { gap: 5px; }
  .lock-message { padding-bottom: 48px; }
  .lock-message .modal-panel { width: min(350px, 92vw); }
}

/* Shuri gate and Fibonacci-inspired kata completion notice */
.unlock-panel {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 24%, rgba(242,197,106,.18), transparent 29%),
    linear-gradient(180deg, #76261f 0 38%, #9f3828 38% 100%);
}
.unlock-panel::before,
.unlock-panel::after {
  content: "";
  position: absolute;
  z-index: 0;
  bottom: -8px;
  width: 42%;
  height: 34%;
  opacity: .2;
  background: repeating-linear-gradient(90deg, #f3cf81 0 4px, transparent 4px 12px);
  clip-path: polygon(0 100%, 18% 34%, 34% 69%, 52% 12%, 70% 62%, 84% 30%, 100% 100%);
}
.unlock-panel::before { left: -7%; }
.unlock-panel::after { right: -7%; transform: scaleX(-1); }
.unlock-panel > * { position: relative; z-index: 1; }
.unlock-gate {
  position: relative;
  width: min(230px, 66vw);
  height: 112px;
  margin: 0 auto 18px;
  filter: drop-shadow(5px 6px 0 #4f1c1b);
}
.unlock-gate::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 3%;
  right: 3%;
  height: 23px;
  background: #e65d42;
  border: 5px solid #562026;
  clip-path: polygon(0 70%, 8% 25%, 36% 25%, 40% 0, 60% 0, 64% 25%, 92% 25%, 100% 70%, 96% 100%, 4% 100%);
}
.unlock-gate::after {
  content: "";
  position: absolute;
  top: 34px;
  left: 16%;
  right: 16%;
  height: 69px;
  border-left: 13px solid #c93f32;
  border-right: 13px solid #c93f32;
  box-shadow: inset 9px 0 0 #f0a04a, inset -9px 0 0 #f0a04a;
}
.unlock-gate b {
  position: absolute;
  top: 39px;
  left: 10%;
  right: 10%;
  height: 13px;
  background: #ef8a43;
  border: 4px solid #562026;
}
/* Exact supplied crest, framed in CSS without redrawing or recoloring it. */
.unlock-gate .unlock-crest { position:absolute; z-index:2; top:49px; left:50%; width:54px; height:54px; overflow:hidden; border-radius:50%; background:#fff; transform:translateX(-50%); }
.unlock-crest img { position:absolute; width:238.1%; max-width:none; height:auto; left:-64.3%; top:-20.3%; image-rendering:auto; }
.draw-button:disabled {
  cursor: not-allowed;
  opacity: .58;
  filter: grayscale(.35);
}
.deck-status[hidden] { display: none !important; }

/* Keep the approved scenery and card ratios. */
.save-warning { position: fixed; z-index: 50; bottom: 34px; left: 8px; right: 8px; padding: 10px; margin: 0; color: #fff3d8; background: #702a28; font-family: var(--display); font-size: 1rem; text-align: center; }
.level-progress strong.long-count { font-size: 1.05rem; white-space: nowrap; }
@media (max-width: 720px) { .level-progress strong.long-count { font-size: .86rem; } }
.game-modal { overflow-y: auto; }
.menu-mode h1 { -webkit-text-stroke-width: .7px; line-height: .68; text-shadow: 3px 3px 0 #062b4b, 5px 5px 0 rgba(2,20,40,.48); }
@media (max-width: 720px) { .menu-mode .title-lockup { padding-top: 11px; padding-bottom: 8px; } }
.playing-player { margin: 7px 0 0; color: #f3cf81; font-family: var(--display); font-size: 1.15rem; line-height: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 28ch; }
@media (max-width: 720px) {
  .playing-player { font-size: .95rem; max-width: 21ch; margin-top: 5px; }
  .level-bar { min-height: 66px; }
}

/* Save squares replace kata squares inside the same menu. */
.kata-menu[hidden] { display: none !important; }
.new-game-row { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 9px; }
.menu-mode .square-save-back { display: grid; grid-template-columns: 1fr; place-items: center; padding: 0; font-family: var(--display); font-size: 1.8rem; }
.menu-mode .new-game-option { grid-template-columns: 20px minmax(0, 1fr); }
.inline-save-list { display: grid; gap: 9px; max-height: 30svh; overflow-y: auto; padding: 0 6px 7px 0; margin-right: -6px; }
.inline-save-row { position: relative; min-height: 62px; }
.menu-mode .save-game-option { width: 100%; grid-template-columns: 52px minmax(0, 1fr); padding-right: 48px; }
.save-game-option strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.save-dropdown { position: absolute; right: 4px; top: 8px; z-index: 2; }
.save-dropdown[open] { z-index: 8; }
.save-dropdown > summary { list-style: none; cursor: pointer; display: grid; place-items: center; min-width: 35px; min-height: 40px; color: #fff3d8; font-size: .6rem; }
.save-dropdown > summary::-webkit-details-marker { display: none; }
.save-dropdown-actions { position: absolute; right: 0; top: 1px; display: grid; min-width: 185px; background: #062b4b; border: 2px solid #f3cf81; box-shadow: 3px 3px 0 #03192e; }
.save-dropdown-actions button { min-height: 42px; border: 0; border-bottom: 1px solid #497879; padding: 10px; background: #063e53; color: #fff3d8; font-size: .48rem; text-align: left; cursor: pointer; }
.save-name-editor { position: absolute; inset: 0; z-index: 9; width: 100%; padding: 12px; color: #062b4b; background: #f3cf81; border: 3px solid #fff3d8; font-size: 16px; font-family: var(--pixel); }
.save-game-option[hidden] { display: none; }
.tiny-delete-confirmation { position: absolute; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: space-around; gap: 6px; padding: 8px; border: 2px solid #f3cf81; color: #fff3d8; background: #063e53; font-family: var(--display); font-size: 1rem; }
.tiny-delete-confirmation button { min-width: 43px; min-height: 36px; border: 1px solid #f3cf81; padding: 5px; color: #fff3d8; background: #703127; cursor: pointer; font-size: .48rem; }
@media (max-width: 720px) {
  .inline-save-row { min-height: 52px; }
  .new-game-row { grid-template-columns: 48px minmax(0, 1fr); }
  .menu-mode .save-game-option { grid-template-columns: 39px minmax(0,1fr); }
  .save-dropdown { top: 4px; }
}
.save-dropdown-actions { top: 40px; }
.inline-save-row:has(.save-dropdown[open]) { min-height: 142px; }

/* Stage header: stronger controls within a compact scenery overlay. */
.level-bar .back-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 92px;
  min-height: 44px;
  padding: 10px 9px;
  border: 2px solid #fff3d8;
  color: #062b4b;
  background: #f2c56a;
  box-shadow: inset -3px -3px 0 #c68a3e, 3px 3px 0 #062b4b;
  font-size: .68rem;
  line-height: 1.2;
  white-space: nowrap;
  text-shadow: none;
}
.level-bar .back-button:hover { background: #fff3d8; }
.level-bar .back-button:active { transform: translate(2px, 2px); }
.level-title { min-width: 0; }
.level-title .eyebrow { font-size: .65rem; line-height: 1.25; }
.level-progress { font-size: .55rem; }
.level-progress strong { font-size: 2.1rem; line-height: 1; }
.level-progress strong.long-count { font-size: 1.6rem; }
.playing-player { font-size: 1.3rem; }
@media (max-width: 720px) {
  .level-bar {
    grid-template-columns: 76px minmax(0, 1fr) 82px;
    min-height: 74px;
    gap: 5px;
    padding: 6px;
  }
  .level-bar .back-button {
    min-width: 0;
    width: 76px;
    min-height: 44px;
    padding: 8px 5px;
    font-size: .55rem;
  }
  .level-title .eyebrow { margin-bottom: 4px; font-size: .47rem; letter-spacing: .02em; }
  .level-title h2 { font-size: clamp(1.65rem, 7.6vw, 2.05rem); line-height: .86; }
  body[data-kata="naihanchi-3"] .level-title h2 { font-size: clamp(1.35rem, 6.1vw, 1.7rem); }
  .level-title .playing-player { margin-top: 4px; max-width: 100%; font-size: 1.125rem; }
  .level-progress { gap: 5px; font-size: .4rem; }
  .level-progress strong { font-size: 1.6rem; }
  .level-progress strong.long-count { font-size: 1.25rem; }
}
@media (max-width: 360px) {
  .level-bar { grid-template-columns: 69px minmax(0, 1fr) 69px; gap: 3px; padding: 5px; }
  .level-bar .back-button { width: 69px; font-size: .5rem; }
  .level-title h2 { font-size: 1.5rem; }
  body[data-kata="naihanchi-3"] .level-title h2 { font-size: 1.15rem; }
  .level-title .eyebrow { font-size: .41rem; }
  .level-progress { font-size: .35rem; }
  .level-progress strong.long-count { font-size: 1.1rem; }
}

/* Real cards fill the approved slots; the PDF artwork supplies its own number. */
.draw-screen .draw-card.has-artwork { display: block; padding: 3px; background: #fff; cursor: zoom-in; }
.draw-screen .draw-card.has-artwork::after { display: none; }
.draw-screen .has-artwork .card-media { display: block; height: 100%; width: 100%; margin: 0; background: #fff; }
.draw-screen .has-artwork .card-media img { display: block; width: 100%; height: 100%; object-fit: contain; image-rendering: auto; }
.draw-card.artwork-error::before { content: 'Image unavailable'; display: block; padding: 10px; font: 16px var(--display); }
.card-viewer { z-index: 50; padding: 12px; background: rgba(3,20,34,.92); }
.card-viewer-panel { display: flex; flex-direction: column; width: min(620px,100%); height: min(900px,calc(100dvh - 24px)); margin: auto; }
.card-viewer-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 10px; }
.card-viewer-bar h2 { margin: 0; color: var(--cream); font: 1.7rem var(--display); }
.card-viewer-bar .pixel-button { min-width: 96px; padding: 12px; font-size: .65rem; }
.card-viewer-panel > img { display: block; min-height: 0; flex: 1; width: 100%; object-fit: contain; background: #fff; image-rendering: auto; }
@media (max-width:720px) { .draw-screen .draw-card.has-artwork { padding: 1px; } }

/* Desktop stages fill the viewport. The phone rules above remain unchanged. */
@media (min-width:721px) {
  .draw-mode .game-shell { height:100svh; min-height:100svh; }
  .draw-mode .hud { display:none; }
  .draw-mode .scene { height:100%; background:#3e9df2; }
  .draw-mode .scene::before { display:none; }
  .draw-mode .scene picture { inset:min(128px,14svh) 0 0; height:calc(100% - min(128px,14svh)); visibility:visible; }
  .draw-mode .scene img { object-fit:cover; object-position:center top; }
  .draw-mode .pixel-shade { background:linear-gradient(180deg,rgba(5,18,28,.07),transparent 40%,rgba(5,18,28,.12)); box-shadow:inset 0 0 45px rgba(0,0,0,.16); }
  .draw-mode .screen { position:absolute; inset:0; width:100%; min-height:100svh; margin:0; padding:0; }
  .draw-screen.is-active { display:block; --card-top:max(138px,17svh); --card-height:min(48svh,calc(65svh - var(--card-top))); --card-gap:clamp(14px,1.5vw,32px); }
  .draw-mode .level-bar { position:absolute; z-index:5; top:16px; left:3vw; right:3vw; padding:10px 22px; min-height:82px; }
  .draw-mode .level-title h2 { font-size:clamp(2.4rem,3.6vw,4rem); }
  .draw-mode .level-title .eyebrow { font-size:clamp(.45rem,.65vw,.65rem); }
  .draw-mode .level-progress { font-size:clamp(.4rem,.6vw,.6rem); }
  .draw-mode .level-progress strong { font-size:clamp(1.7rem,2.5vw,3rem); }
  .draw-screen .card-stage { position:absolute; z-index:4; top:var(--card-top); left:50%; transform:translateX(-50%); width:calc(var(--card-height) * 1.65 + var(--card-gap) * 2); max-width:calc(100% - 64px); height:var(--card-height); gap:var(--card-gap); margin:0; }
  .draw-screen .draw-card { height:100%; aspect-ratio:auto; padding:3px; }
  .draw-screen .draw-controls { position:absolute; z-index:5; top:calc(var(--card-top) + var(--card-height) + 14px); left:0; right:0; margin:0; }
  .draw-screen .draw-button { min-width:clamp(240px,24vw,450px); min-height:48px; height:5.5svh; padding:12px 22px; font-size:clamp(.75rem,1.1vw,1.3rem); }
  .draw-screen .deck-status { display:none; }
  .draw-mode .progress-art { inset:0; width:auto; transform:none; }
  .draw-mode .progress-flowers { inset:76% 4% 7%; }
  .draw-mode .progress-flowers .progress-flower { left:var(--desktop-x)!important; top:var(--desktop-y)!important; }
  .draw-mode .progress-flower { width:clamp(12px,1vw,22px); height:clamp(20px,1.7vw,34px); }
  .draw-mode .progress-practitioners { inset:76% 6% 7%; }
  .draw-mode .progress-practitioner,.draw-mode .progress-dancer { margin-top:0; width:clamp(9px,1vw,16px); height:clamp(20px,2vw,32px); }
  .draw-mode .game-footer { height:30px; padding:11px 24px; font-size:clamp(.35rem,.5vw,.55rem); }
  body[data-kata="naihanchi-3"] .draw-screen.is-active { --card-top:35svh; --card-height:37svh; }
  body[data-kata="naihanchi-3"] .progress-practitioners { inset:82% 6% 4%; grid-template-columns:repeat(var(--desktop-columns,24),minmax(0,1fr)); grid-template-rows:repeat(3,minmax(0,1fr)); gap:8px; place-content:center; justify-items:center; }
  body[data-kata="naihanchi-2"] .draw-screen.is-active { --card-top:43svh; --card-height:44svh; }
  body[data-kata="naihanchi-2"] .progress-garland .progress-flower { top:var(--gate-desktop-y)!important; left:var(--gate-desktop-x)!important; }
}

@media(min-width:721px) and (max-height:760px) { body[data-kata="naihanchi-2"] .draw-screen.is-active { --card-top:42svh; --card-height:39svh; } }

/* Center the first hand like the other levels, between the roof and grass. */
@media (min-width:721px) {
  body[data-kata="naihanchi-1"] .draw-screen.is-active { --card-top:max(260px,35svh); --card-height:min(35svh,calc(70svh - var(--card-top))); }
  body[data-kata="naihanchi-1"] .progress-flowers { inset:80% 4% 7%; }
}
