:root {
  --wm-cream-1: #fff8e6;
  --wm-cream-2: #f6e7c8;
  --wm-wood-1: #c98f5a;
  --wm-wood-2: #8a552c;
  --wm-gold: #f2c141;
  --wm-sage: #879a63;
  --wm-plum: #8d6197;
  --wm-coral: #e98978;
  --wm-ink: #3d3226;
  --wm-navy: #174a7e;
  --wm-green: #3f9a36;
  --paper: #fffaf0;
  --line: #d7ad73;
  --stone: clamp(48px, 4.4vw, 58px);
  --stone-gap: 5px;
  --safe-top: max(10px, env(safe-area-inset-top));
  --safe-right: max(12px, env(safe-area-inset-right));
  --safe-bottom: max(10px, env(safe-area-inset-bottom));
  --safe-left: max(12px, env(safe-area-inset-left));
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background: #2f7cb5;
  color: var(--wm-ink);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

button,
dialog {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible {
  outline: 4px solid #fff;
  outline-offset: 4px;
  box-shadow: 0 0 0 8px var(--wm-gold);
}

[hidden] {
  display: none !important;
}

.game-shell {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100dvh;
  min-height: 100%;
  overflow: hidden;
}

.world-background {
  position: fixed;
  inset: 0;
  z-index: -2;
  background-color: #77c8ee;
  background-image:
    url("assets/backgrounds/play-landscape.webp"),
    url("assets/backgrounds/lodowa-zatoka-landscape.webp");
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.world-background::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgb(255 255 255 / 3%), rgb(26 85 112 / 6%) 58%, rgb(20 54 72 / 14%));
  pointer-events: none;
}

.series-name {
  margin: 0;
  color: var(--wm-navy);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1;
}

.intro-screen {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
  overflow: hidden;
}

.intro-art,
.intro-art picture,
.intro-art img {
  display: block;
  width: 100%;
  height: 100%;
}

.intro-art {
  position: absolute;
  inset: 0;
}

.intro-art img {
  object-fit: cover;
  object-position: right bottom;
}

.intro-art picture {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.intro-fallback {
  display: none;
  position: absolute;
  inset: 0;
  place-items: center;
  background: #73c9ec;
}

.intro-fallback img {
  position: absolute;
  right: 10%;
  bottom: 8%;
  width: min(34vw, 280px);
  height: auto;
  filter: drop-shadow(0 14px 12px rgb(36 50 54 / 32%));
}

.intro-fallback-pack {
  position: absolute;
  left: 48%;
  bottom: 17%;
  display: grid;
  grid-template-columns: repeat(5, 44px);
  gap: 6px;
  padding: 18px;
  border: 7px solid var(--wm-wood-2);
  border-radius: 10px;
  background: #f7efe0;
  box-shadow: 0 12px 20px rgb(35 28 20 / 22%);
  transform: rotate(-4deg);
}

.intro-fallback-pack span,
.mini-stone {
  width: 44px;
  height: 34px;
  border: 2px solid #657684;
  border-radius: 54% 46% 48% 52%;
  background: #aab8bf;
}

.intro-art.is-fallback picture {
  display: none;
}

.intro-art.is-fallback .intro-fallback {
  display: grid;
}

.intro-title-frame {
  position: absolute;
  z-index: 2;
  top: var(--safe-top);
  left: 50%;
  width: max-content;
  max-width: min(88vw, 760px);
  margin: 0;
  padding: 16px 28px 14px;
  border: 4px solid var(--wm-wood-1);
  border-radius: 28px;
  background: rgb(255 248 230 / 95%);
  box-shadow: 0 8px 0 rgb(90 57 31 / 18%);
  text-align: center;
  transform: translateX(-50%);
}

.intro-title-frame h1 {
  margin: 5px 0 0;
  color: var(--wm-navy);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 5vw, 4.6rem);
  line-height: 0.98;
}

.intro-actions {
  position: absolute;
  z-index: 2;
  left: calc(var(--safe-left) + 72px);
  bottom: calc(var(--safe-bottom) + 18px);
  display: flex;
  align-items: center;
  gap: 22px;
  width: min(28vw, 320px);
  margin: 0;
  padding: 14px 18px;
  border: 4px solid rgb(255 248 230 / 82%);
  border-radius: 30px;
  background: rgb(23 74 126 / 88%);
  box-shadow: 0 10px 24px rgb(10 35 57 / 30%);
}

.intro-play-button {
  min-width: 96px;
  min-height: 96px;
  flex: 0 0 auto;
}

.intro-play-button img {
  width: 96px;
  height: 96px;
}

.intro-actions p {
  flex: 1;
  margin: 0;
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.25;
}

.wood-button,
.primary-button,
.secondary-button,
.small-wood-button,
.text-button,
.close-button,
.round-control {
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
}

.wood-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 112px;
  min-height: 64px;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--wm-navy);
  font-weight: 900;
}

.wood-button img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  filter: drop-shadow(0 5px 4px rgb(53 31 18 / 26%));
}

.wood-button span {
  margin-left: 8px;
  padding: 8px 14px;
  border: 3px solid var(--wm-wood-1);
  border-radius: 999px;
  background: var(--wm-cream-1);
  font-size: 1.15rem;
}

.wood-button:active {
  transform: translateY(3px) scale(0.97);
}

.play-button img {
  width: 96px;
  height: 96px;
}

.play-button {
  min-width: 112px;
  min-height: 96px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.game-header {
  position: absolute;
  z-index: 25;
  inset: var(--safe-top) var(--safe-right) auto var(--safe-left);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  pointer-events: none;
}

.title-block,
.helper-note,
.round-label,
.sopo-reaction,
.closed-pack-message {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.control-row {
  display: flex;
  flex-flow: row nowrap;
  align-items: center;
  gap: 6px;
  pointer-events: auto;
}

.round-control {
  position: relative;
  display: block;
  flex: 0 0 56px;
  width: 56px;
  height: 56px;
  min-width: 56px;
  min-height: 56px;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  filter: drop-shadow(0 4px 3px rgb(32 53 68 / 26%));
}

.round-control img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.round-control:active {
  transform: translateY(2px) scale(0.96);
}

.round-control:disabled {
  opacity: 0.48;
  cursor: default;
}

.progress-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-height: 56px;
  padding: 13px 4px;
  opacity: 0.9;
}

.level-path,
.task-stars {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 0;
}

.level-token {
  position: relative;
  display: block;
  width: 28px;
  height: 24px;
  opacity: 0.9;
}

.level-token.is-current {
  filter: drop-shadow(0 0 4px #ffe472);
  opacity: 1;
}

.level-token::before {
  content: "";
  position: absolute;
  left: 4px;
  bottom: 2px;
  width: 19px;
  height: 13px;
  border: 2px solid #82502a;
  border-radius: 3px 3px 5px 5px;
  background: #d2a066;
  box-shadow: inset 0 2px 0 rgb(255 255 255 / 24%);
}

.level-token::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 2px;
  width: 9px;
  height: 7px;
  border-radius: 53% 47% 48% 52%;
  background: #7e9199;
}

.prop-2::after,
.prop-3::after {
  display: none;
}

.prop-4::before {
  background: #d2a066 linear-gradient(180deg, transparent 45%, #9d6837 46% 55%, transparent 56%);
}

.prop-5::after {
  left: 10px;
  top: 8px;
  width: 6px;
  height: 6px;
  background: #f2c141;
}

.level-check {
  position: absolute;
  right: -4px;
  bottom: -5px;
  display: grid;
  place-items: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #3d8a38;
  color: #fff;
  font-size: 0.6rem;
}

.task-star {
  display: block;
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.task-star:not(.is-filled) {
  filter: drop-shadow(0 1px 1px rgb(21 54 63 / 45%));
}

.task-star.is-filled {
  filter: drop-shadow(0 0 3px rgb(242 193 65 / 58%));
}

.play-surface {
  position: absolute;
  inset: 0;
  z-index: auto;
  display: grid;
  grid-template-areas: "guide board";
  grid-template-columns: clamp(320px, 31vw, 400px) minmax(0, 1fr);
  gap: clamp(6px, 1vw, 12px);
  min-width: 0;
  min-height: 0;
  padding: max(74px, calc(var(--safe-top) + 64px)) var(--safe-right) var(--safe-bottom) var(--safe-left);
}

.guide-panel {
  grid-area: guide;
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: end;
  min-width: 0;
  min-height: 0;
}

.hero-figure {
  position: relative;
  left: 0;
  bottom: 0;
  grid-row: 2;
  width: min(100%, clamp(330px, 31vw, 400px));
  aspect-ratio: 5 / 4;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}

.hero-figure img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 10px 7px rgb(28 63 80 / 22%));
}

.hero-figure .sopo-loop {
  position: absolute;
  inset: 0;
  object-fit: cover;
}

.guide-copy {
  position: relative;
  z-index: 2;
  grid-row: 1;
  align-self: end;
  display: grid;
  width: min(calc(100% - clamp(12px, 4vw, 32px)), 340px);
  margin: 0 0 8px clamp(12px, 4vw, 32px);
  gap: 8px;
}

.guide-bubble {
  position: relative;
  isolation: isolate;
  width: 100%;
  aspect-ratio: 900 / 506;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 24px 32px 28px 40px;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}

.guide-bubble::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: url("assets/ui/ori-speech-normal.webp") center / 100% 100% no-repeat;
  transform: rotate(180deg);
}

.guide-bubble #guideText {
  position: relative;
  z-index: 1;
}

.guide-bubble p:first-child {
  margin: 0;
  color: var(--wm-navy);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 24px;
  font-weight: 900;
  line-height: 1.12;
  text-align: center;
}

.tutorial-banner {
  order: -1;
  display: grid;
  grid-template-columns: minmax(72px, 1fr) auto;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: #173b59;
  text-shadow: 0 1px 0 #fff, 0 3px 8px rgb(255 255 255 / 85%);
  pointer-events: auto;
}

.tutorial-banner p {
  margin: 0;
  font-size: 18px;
  font-weight: 900;
  line-height: 1.15;
}

.tutorial-actions {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 6px;
}

.tutorial-actions button {
  min-width: 64px;
  white-space: nowrap;
}

.small-wood-button,
.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 86px;
  min-height: 48px;
  padding: 8px 13px;
  border: 2px solid #9f6837;
  border-radius: 999px;
  background: #efc17e;
  color: #56331c;
  font-size: 18px;
  font-weight: 900;
  box-shadow: inset 0 2px 0 rgb(255 255 255 / 32%), 0 3px 0 #8a552c;
}

.text-button {
  border-color: rgb(255 255 255 / 72%);
  background: rgb(255 248 230 / 82%);
  color: #173b59;
}

.small-wood-button:active,
.text-button:active {
  transform: translateY(3px);
  box-shadow: inset 0 2px 0 rgb(255 255 255 / 25%);
}

.small-wood-button:disabled {
  border-color: #9d8b73;
  background: #e4d3b9;
  color: #594f43;
  box-shadow: inset 0 2px 0 rgb(255 255 255 / 25%), 0 3px 0 #887866;
  opacity: 1;
  cursor: default;
}

.board {
  grid-area: board;
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  width: 100%;
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}

.board-topline {
  position: fixed;
  z-index: 24;
  top: calc(var(--safe-top) + 72px);
  left: var(--safe-left);
  bottom: auto;
  display: flex;
  align-items: center;
  width: max-content;
  height: auto;
  min-height: 56px;
}

.board-topline .small-wood-button {
  min-height: 56px;
  padding: 8px 14px;
}

.board-zones {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(150px, 0.4fr) minmax(450px, 1fr);
  align-items: end;
  gap: clamp(8px, 2vw, 26px);
  min-width: 0;
  min-height: 0;
}

.zone {
  position: relative;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}

.zone.drop-ready {
  filter: drop-shadow(0 0 9px rgb(255 231 124 / 78%));
}

.shore-zone {
  align-self: end;
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 0 2px 16px;
}

.pack-zone {
  align-self: end;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 42px 0 18px;
}

.zone-heading {
  display: flex;
  justify-content: center;
  min-height: 20px;
  margin: 0;
  color: #214762;
  line-height: 1;
  text-shadow: 0 1px 0 #fff, 0 2px 7px rgb(255 255 255 / 88%);
}

.zone-heading h3 {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.zone-heading p {
  margin: 0;
  font-size: 18px;
  font-weight: 900;
  white-space: nowrap;
}

.zone-heading strong {
  font-size: 22px;
}

.pebble-grid {
  display: grid;
  justify-content: center;
  align-content: center;
  gap: var(--stone-gap);
  min-height: 0;
}

.shore-grid {
  grid-template-columns: repeat(var(--shore-columns, 3), var(--stone));
  padding: 4px;
}

.shore-grid[data-count="1"] {
  --shore-columns: 1;
}

.shore-grid[data-count="2"] {
  --shore-columns: 2;
}

.shore-grid[data-count="3"] {
  --shore-columns: 3;
}

.pack-grid {
  position: relative;
  z-index: 3;
  grid-template-columns: repeat(5, var(--stone));
  grid-template-rows: repeat(2, var(--stone));
  min-height: calc(var(--stone) * 2 + var(--stone-gap));
}

.pebble {
  position: relative;
  display: block;
  width: var(--stone);
  height: var(--stone);
  min-width: 48px;
  min-height: 48px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: grab;
  touch-action: none;
  user-select: none;
  transition: transform 120ms ease, filter 120ms ease;
}

.pebble img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  filter: var(--stone-filter, none) drop-shadow(0 4px 2px rgb(43 47 42 / 28%));
}

.pebble[data-color="1"] {
  --stone-filter: saturate(0.82) brightness(1.02);
}

.pebble[data-color="2"] {
  --stone-filter: sepia(0.16) saturate(0.9);
}

.pebble[data-color="3"] {
  --stone-filter: hue-rotate(8deg) saturate(0.9);
}

.pebble[data-color="4"] {
  --stone-filter: hue-rotate(-8deg) saturate(0.85);
}

.pebble:hover {
  filter: brightness(1.06);
}

.pebble:active,
.pebble.is-dragging {
  cursor: grabbing;
  transform: scale(1.06);
  filter: brightness(1.1) drop-shadow(0 8px 6px rgb(42 36 27 / 32%));
}

.pebble.tutorial-carrying {
  z-index: 60;
  pointer-events: none;
  transform: translate(var(--carry-x), var(--carry-y)) scale(1.08);
  transition: transform 1050ms cubic-bezier(0.22, 0.72, 0.2, 1);
  filter: drop-shadow(0 9px 7px rgb(42 36 27 / 34%));
}

.pebble.is-dragging {
  position: relative;
  z-index: 50;
  pointer-events: none;
}

.pebble.just-moved {
  animation: stone-land 340ms cubic-bezier(0.2, 1.4, 0.4, 1);
}

.pack-shell {
  position: relative;
  display: grid;
  place-items: center;
  width: min(100%, 560px);
  aspect-ratio: 1.5 / 1;
  min-height: 0;
  margin: 0 auto;
  padding: 0;
  border: 0;
  background: none;
  transform-origin: 50% 100%;
}

.pack-art {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 12px 8px rgb(38 53 54 / 22%));
}

.pack-art-closed,
.pack-shell:not(.is-open) .pack-art-open {
  display: none;
}

.pack-shell:not(.is-open) .pack-art-closed {
  display: block;
}

.pack-art.is-missing {
  display: none !important;
}

.pack-tray {
  position: absolute;
  z-index: 2;
  left: 10%;
  right: 10%;
  top: 30%;
  bottom: 26%;
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 20% 20% 18% 18% / 30% 30% 24% 24%;
  background: transparent;
  box-shadow: none;
}

.pack-slots {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(5, var(--stone));
  grid-template-rows: repeat(2, var(--stone));
  place-content: center;
  gap: var(--stone-gap);
}

.pack-slots span {
  border: 1px dashed rgb(255 255 255 / 30%);
  border-radius: 50%;
  opacity: 0.32;
}

.pack-shell.show-empty .pack-slots span {
  border-color: rgb(255 245 215 / 84%);
  opacity: 1;
}

.pack-excess {
  position: absolute;
  z-index: 8;
  right: 4%;
  top: -46px;
  display: flex;
  gap: var(--stone-gap);
  min-height: var(--stone);
}

.pack-excess:empty {
  display: none;
}

.pack-toggle {
  position: absolute;
  z-index: 9;
  left: 2%;
  bottom: -10px;
  min-width: 48px;
  min-height: 48px;
  padding: 6px 10px;
  border: 2px solid #9c6434;
  border-radius: 10px 10px 15px 15px;
  background: #e6b875;
  color: #55351d;
  font-size: 18px;
  font-weight: 900;
  box-shadow: inset 0 2px 0 rgb(255 255 255 / 35%), 0 3px 0 #8a552c;
  cursor: pointer;
}

.pack-toggle:active {
  transform: translateY(2px);
}

.pack-shell:not(.is-open) .pack-tray,
.pack-shell:not(.is-open) .pack-excess {
  display: none;
}

.pack-shell.pack-art-missing::before {
  content: "";
  position: absolute;
  inset: 24% 8% 18%;
  border-radius: 18% 18% 24% 24%;
  background: rgb(214 177 126 / 88%);
  box-shadow: inset 0 7px 0 rgb(255 255 255 / 18%), 0 10px 12px rgb(39 52 52 / 18%);
}

.pack-shell.pack-art-missing:not(.is-open) .closed-pack-message {
  position: absolute;
  inset: 24% 8% 18%;
  display: grid;
  place-items: center;
  width: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  clip: auto;
  color: #5b3d26;
  font-size: 18px;
  font-weight: 900;
  text-align: center;
}

.board-result {
  position: absolute;
  z-index: 10;
  right: 92px;
  bottom: 13px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  max-width: calc(100% - 200px);
  min-height: 42px;
  pointer-events: none;
}

.feedback {
  margin: 0;
  color: #173b59;
  font-size: 18px;
  font-weight: 900;
  line-height: 1.2;
  text-align: right;
  text-shadow: 0 1px 0 #fff, 0 3px 8px rgb(255 255 255 / 94%);
}

.feedback:not(.is-detail) {
  opacity: 0;
}

.success-result {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: #365d1f;
  font-size: 20px;
  text-shadow: 0 2px 0 #fff, 0 3px 8px rgb(255 255 255 / 92%);
}

.success-result img {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.guide-bubble .success-result {
  position: relative;
  z-index: 1;
  max-width: 100%;
  min-width: 0;
  gap: 7px;
  font-size: clamp(20px, 2vw, 24px);
  line-height: 1.12;
  text-align: left;
}

.guide-bubble .success-result strong {
  min-width: 0;
}

.guide-bubble .success-result img {
  flex: 0 0 auto;
  width: clamp(24px, 2vw, 30px);
  height: clamp(24px, 2vw, 30px);
}

.answer-row {
  z-index: 11;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-height: 72px;
  padding-right: 1%;
}

.confirm-button {
  display: block;
  width: 72px;
  height: 72px;
  min-width: 72px;
  min-height: 72px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  filter: drop-shadow(0 5px 4px rgb(44 53 30 / 28%));
  cursor: pointer;
}

.confirm-button img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.confirm-button:active {
  transform: translateY(3px) scale(0.96);
}

.confirm-button:disabled {
  opacity: 0.42;
  filter: grayscale(0.35);
  cursor: default;
}

.confirm-button.demo-point {
  animation: demo-pulse 900ms ease-in-out infinite;
}

.next-button {
  min-width: 132px;
}

.next-button img {
  width: 58px;
  height: 58px;
}

.corner-rune {
  position: fixed;
  z-index: 80;
  left: var(--safe-left);
  bottom: var(--safe-bottom);
  display: block;
  width: clamp(42px, 4.5vw, 60px);
  pointer-events: none;
  filter: drop-shadow(0 4px 4px rgb(25 50 56 / 28%));
}

.corner-rune img {
  display: block;
  width: 100%;
  height: auto;
}

#fx-layer {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  overflow: hidden;
}

#fx-layer > * {
  position: absolute;
  pointer-events: none;
}

.fx-landing-ring,
.fx-retry-ring,
.fx-correct-glow,
.fx-spark,
.fx-bloom-core,
.fx-ribbon,
.fx-star-glint {
  opacity: 0;
}

.fx-landing-ring {
  border: 3px solid rgb(255 242 203 / 92%);
  border-radius: 50%;
  animation: fx-landing-ring var(--fx-duration) cubic-bezier(0.16, 1, 0.3, 1) both;
}

.fx-dust {
  width: var(--fx-size);
  height: var(--fx-size);
  margin: calc(var(--fx-size) / -2);
  border-radius: 50%;
  background: #f2dfb4;
  animation: fx-dust var(--fx-duration) cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: var(--fx-delay);
}

.fx-correct-glow {
  border: 0;
  border-radius: 50%;
  background:
    radial-gradient(
      ellipse at center,
      rgb(255 248 230 / 38%) 0%,
      rgb(242 193 65 / 34%) 38%,
      rgb(242 193 65 / 12%) 66%,
      transparent 82%
    );
  filter: blur(2px);
  animation: fx-correct-glow var(--fx-duration) ease-in-out both;
}

.fx-retry-ring {
  border: 4px solid rgb(232 166 88 / 78%);
  border-radius: 18% 18% 24% 24%;
  box-shadow: inset 0 0 18px rgb(232 166 88 / 18%);
  animation: fx-retry-ring var(--fx-duration) ease-out both;
}

.fx-spark {
  width: var(--fx-size);
  height: var(--fx-size);
  margin: calc(var(--fx-size) / -2);
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0 18%, var(--fx-color) 42%, transparent 72%);
  box-shadow: 0 0 9px var(--fx-color), 0 0 18px rgb(255 248 230 / 55%);
  animation: fx-spark var(--fx-duration) cubic-bezier(0.16, 1, 0.3, 1) var(--fx-delay) both;
}

.fx-spark::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 34px;
  height: 2px;
  margin-top: -1px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--fx-color), rgb(255 248 230 / 52%) 34%, transparent);
  box-shadow: 0 0 5px rgb(255 236 178 / 72%);
  transform: rotate(calc(var(--fx-trail-angle) + 180deg));
  transform-origin: 0 50%;
}

.fx-bloom-core {
  width: 76px;
  height: 76px;
  margin: -38px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgb(255 255 255 / 96%) 0%,
    var(--fx-color) 16%,
    rgb(242 193 65 / 38%) 42%,
    transparent 74%
  );
  filter: drop-shadow(0 0 9px rgb(242 193 65 / 72%));
  animation: fx-bloom-core var(--fx-duration) cubic-bezier(0.16, 1, 0.3, 1) var(--fx-delay) both;
}

.fx-ribbon {
  width: 18px;
  height: 4px;
  margin: -2px -9px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--fx-color), transparent);
  animation: fx-ribbon var(--fx-duration) ease-out var(--fx-delay) both;
}

.fx-star-glint {
  border-radius: 50%;
  background: radial-gradient(
    ellipse at center,
    rgb(255 255 255 / 70%) 0%,
    rgb(242 193 65 / 28%) 30%,
    transparent 70%
  );
  animation: fx-star-glint 2300ms ease-in-out both;
}

.fx-ambient {
  position: absolute;
  width: 4px;
  height: 4px;
  margin: -2px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0 22%, #b9ddea 45%, transparent 76%);
  box-shadow: 0 0 7px rgb(202 237 247 / 48%);
  animation: fx-ambient var(--fx-duration) ease-in-out var(--fx-delay) infinite;
}

@keyframes fx-landing-ring {
  0% { opacity: 0; transform: scale(0.62); }
  35% { opacity: 0.72; }
  100% { opacity: 0; transform: scale(1.22); }
}

@keyframes fx-dust {
  0% { opacity: 0; transform: translate(0, 0) scale(0.55); }
  22% { opacity: 0.62; }
  100% { opacity: 0; transform: translate(var(--fx-x), var(--fx-y)) scale(0.25); }
}

@keyframes fx-correct-glow {
  0% { opacity: 0; transform: scale(0.985); }
  60% { opacity: 0.7; transform: scale(1.018); }
  100% { opacity: 0; transform: scale(1.035); }
}

@keyframes fx-retry-ring {
  0% { opacity: 0; transform: scale(0.985); }
  24% { opacity: 0.52; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.008); }
}

@keyframes fx-spark {
  0% { opacity: 0; transform: translate(0, 0) scale(0.45); }
  26% { opacity: 1; transform: translate(0, 0) scale(1); }
  70% { opacity: 0.92; transform: translate(var(--fx-x), var(--fx-y)) scale(1); }
  100% { opacity: 0; transform: translate(var(--fx-x), var(--fx-y)) scale(0.72); }
}

@keyframes fx-bloom-core {
  0% { opacity: 0; transform: scale(0.35); }
  24% { opacity: 0.95; transform: scale(0.95); }
  68% { opacity: 0.82; transform: scale(1.22); }
  100% { opacity: 0; transform: scale(1.3); }
}

@keyframes fx-ribbon {
  0% { opacity: 0; transform: translate(0, -18px) rotate(0deg) scale(0.7); }
  18% { opacity: 0.72; }
  100% { opacity: 0; transform: translate(var(--fx-x), var(--fx-y)) rotate(var(--fx-rotate)) scale(1); }
}

@keyframes fx-star-glint {
  0% { opacity: 0; transform: scale(0.72); }
  24% { opacity: 0.72; }
  55% { opacity: 0.3; transform: scale(1.04); }
  100% { opacity: 0; transform: scale(1.12); }
}

@keyframes fx-ambient {
  0%, 100% { opacity: 0.08; transform: translate(0, 0) scale(0.8); }
  50% { opacity: 0.36; transform: translate(5px, -8px) scale(1.05); }
}

.tutorial-hand {
  position: fixed;
  z-index: 190;
  width: clamp(54px, 6vw, 72px);
  height: auto;
  pointer-events: none;
  filter: drop-shadow(0 6px 4px rgb(39 30 21 / 34%));
  transform: translate(-26%, -18%) rotate(-8deg);
  transform-origin: 34% 70%;
  transition: left 320ms ease, top 320ms ease;
  animation: hand-tap 1100ms ease-in-out infinite;
}

.sheet-dialog {
  width: min(94vw, 720px);
  max-height: min(92dvh, 860px);
  padding: 0;
  border: 0;
  border-radius: 30px;
  background: transparent;
  color: var(--wm-ink);
  overflow: visible;
}

.sheet-dialog > .sheet {
  position: relative;
  z-index: 1;
}

.sheet-dialog[open] > .sheet > :not(#fx-layer) {
  position: relative;
  z-index: 1;
}

.sheet-dialog > .sheet > #fx-layer {
  z-index: 0;
}

.sheet-dialog::backdrop {
  background: rgb(11 46 73 / 68%);
  backdrop-filter: blur(3px);
}

.sheet-dialog::after {
  content: "";
  position: fixed;
  left: max(12px, env(safe-area-inset-left));
  bottom: max(10px, env(safe-area-inset-bottom));
  width: clamp(42px, 5vw, 62px);
  aspect-ratio: 2 / 3;
  background: url("assets/ui/ui-rune-corner.webp") center / contain no-repeat;
  filter: drop-shadow(0 4px 4px rgb(44 26 14 / 30%));
  pointer-events: none;
}

.game-shell[data-state="paused"] .answer-row,
.game-shell[data-state="help"] .answer-row,
.game-shell[data-state="level-complete"] .answer-row,
.game-shell[data-state="game-complete"] .answer-row {
  visibility: hidden;
}

.sheet {
  max-height: min(92dvh, 860px);
  padding: clamp(20px, 4vw, 34px) clamp(18px, 5vw, 42px) 34px;
  border: 4px solid #bd8249;
  border-radius: 30px;
  background: var(--paper);
  box-shadow: 0 18px 42px rgb(21 37 49 / 34%);
  overflow-y: auto;
}

.sheet-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.sheet h2 {
  margin: 4px 0 12px;
  color: var(--wm-navy);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 1;
}

.sheet h3 {
  margin: 18px 0 8px;
  color: var(--wm-navy);
}

.sheet p {
  font-size: 18px;
  line-height: 1.5;
}

.close-button {
  display: grid;
  place-items: center;
  flex: 0 0 56px;
  width: 56px;
  height: 56px;
  min-width: 56px;
  min-height: 56px;
  border: 3px solid #a96d38;
  border-radius: 50%;
  background: #f2c17c;
  color: #53311b;
  font-size: 2rem;
  font-weight: 900;
  line-height: 1;
}

.primary-button,
.secondary-button {
  min-height: 56px;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 18px;
  font-weight: 900;
}

.primary-button {
  border: 3px solid #a76d39;
  background: #efbd68;
  color: #56351e;
  box-shadow: 0 4px 0 #8a552c;
}

.secondary-button {
  border: 3px solid #a76d39;
  background: #f3c985;
  color: #56351e;
  box-shadow: 0 4px 0 #8a552c;
}

.primary-button:active,
.secondary-button:active {
  transform: translateY(3px);
  box-shadow: none;
}

.primary-button:disabled,
.secondary-button:disabled {
  opacity: 0.45;
  cursor: default;
}

.sheet-actions,
.voice-controls,
.final-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 14px 0;
}

.parent-note {
  padding: 14px 16px;
  border-left: 8px solid var(--wm-sage);
  border-radius: 4px 18px 18px 4px;
  background: #f2ebda;
}

.parent-note h3 {
  margin-top: 0;
}

.parent-note p {
  margin-bottom: 0;
}

.picture-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.picture-step {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 150px;
  padding: 12px;
  border: 3px solid #d4b386;
  border-radius: 20px;
  background: #fff8e8;
  text-align: center;
}

.picture-step > img {
  width: 64px;
  height: 64px;
  object-fit: contain;
}

.picture-step p {
  flex-basis: 100%;
  margin: 0;
  color: var(--wm-navy);
  font-weight: 900;
}

.mini-pack {
  display: grid;
  grid-template-columns: repeat(5, 20px);
  align-content: center;
  justify-content: center;
  gap: 2px;
  min-width: 66px;
  min-height: 50px;
  padding: 6px;
  border: 3px solid #96602f;
  border-radius: 4px 4px 10px 10px;
  background: #e4bd87;
}

.mini-pack img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.mini-pack.empty {
  min-height: 42px;
}

.mini-pack.empty::after {
  content: "";
  width: 20px;
  height: 16px;
  border: 2px dashed rgb(150 96 47 / 45%);
  border-radius: 50%;
}

.audio-status {
  min-height: 1.5em;
  color: #6d563e;
  font-size: 18px !important;
}

.level-menu {
  display: grid;
  grid-template-columns: repeat(5, minmax(56px, 1fr));
  gap: 8px;
}

.level-menu button {
  min-height: 64px;
  padding: 8px;
  border: 3px solid #a86c37;
  border-radius: 18px;
  background: #f3c985;
  color: #57361f;
  font-size: 18px;
  font-weight: 900;
}

.level-menu button.is-current {
  outline: 4px solid var(--wm-gold);
  outline-offset: 2px;
}

.reward-dialog .sheet,
.final-dialog .sheet {
  text-align: center;
}

.sopo-celebrates {
  width: min(100%, 280px);
  min-height: 170px;
  margin: 0 auto 12px;
  padding: 8px;
  border: 3px solid #d4b386;
  border-radius: 34px;
  background: #fff6e3;
}

.sopo-celebrates img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 8px 7px rgb(32 51 61 / 24%));
}

.final-star {
  width: clamp(110px, 20vw, 160px);
  height: auto;
  filter: drop-shadow(0 0 18px rgb(242 193 65 / 70%));
}

@keyframes stone-land {
  40% { transform: translateY(-5px) scale(1.08); }
}

@keyframes hand-tap {
  50% { transform: translate(-26%, -12%) rotate(-8deg) scale(0.94); }
}

@keyframes demo-pulse {
  50% { transform: scale(1.09); filter: drop-shadow(0 0 14px var(--wm-gold)); }
}

@media (orientation: portrait) {
  .world-background {
    background-image:
      url("assets/backgrounds/play-portrait.webp"),
      url("assets/backgrounds/lodowa-zatoka-portrait.webp");
  }

  .intro-fallback {
    background: #73c9ec;
  }

  .intro-title-frame {
    width: min(92vw, 460px);
    padding: 12px 18px;
  }

  .intro-art picture {
    inset: 0;
  }

  .intro-actions {
    left: 50%;
    bottom: var(--safe-bottom);
    width: min(94vw, 440px);
    gap: 8px;
    padding: 8px 12px 8px max(66px, calc(12px + env(safe-area-inset-left)));
    text-align: left;
    transform: translateX(-50%);
  }

  .intro-actions p {
    flex: 1;
  }

  .play-button {
    min-height: 82px;
  }

  .play-button img {
    width: 82px;
    height: 82px;
  }

  .game-header {
    gap: 3px;
  }

  .control-row {
    gap: 3px;
  }

  .round-control {
    flex-basis: 56px;
    width: 56px;
    height: 56px;
  }

  .progress-wrap {
    gap: 5px;
    min-height: 48px;
    padding: 17px 0;
  }

  .level-token {
    width: 24px;
    height: 21px;
  }

  .task-star {
    width: 18px;
    height: 18px;
  }

  .play-surface {
    --hero-width: clamp(132px, 38vw, 160px);
    --hero-height: calc(var(--hero-width) * 0.8);
    --hero-top: clamp(210px, 36dvh, 330px);
    --pack-width: clamp(338px, 88vw, 380px);
    grid-template-areas: "scene";
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    gap: 0;
    padding: max(68px, calc(var(--safe-top) + 58px)) max(6px, env(safe-area-inset-right)) var(--safe-bottom) max(6px, env(safe-area-inset-left));
  }

  .guide-panel,
  .board {
    grid-area: scene;
  }

  .guide-panel {
    z-index: 4;
    display: block;
    padding: 0;
    pointer-events: none;
  }

  .hero-figure {
    position: absolute;
    left: 0;
    top: var(--hero-top);
    width: var(--hero-width);
    height: var(--hero-height);
    max-width: none;
    max-height: none;
    pointer-events: auto;
  }

  .guide-copy {
    position: absolute;
    top: var(--hero-top);
    right: 0;
    left: calc(var(--hero-width) + 6px);
    width: min(210px, calc(100% - var(--hero-width) - 12px));
    margin: 0;
    align-self: auto;
    gap: 6px;
    pointer-events: auto;
  }

  .guide-copy:has(.tutorial-banner:not([hidden])) {
    top: calc(var(--hero-top) - 54px);
  }

  .guide-bubble {
    min-height: 0;
    padding: 20px 24px 22px 30px;
  }

  .guide-bubble p:first-child {
    font-size: 20px;
  }

  .tutorial-banner {
    gap: 4px;
  }

  .tutorial-banner p {
    font-size: 16px;
  }

  .tutorial-actions {
    gap: 4px;
  }

  .tutorial-actions button {
    min-width: 52px;
    min-height: 48px;
    padding: 4px 7px;
    font-size: 16px;
    white-space: nowrap;
  }

  .board {
    z-index: 1;
    display: grid;
    grid-template-rows: minmax(0, 1fr);
  }

  .board-zones {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 2px;
    padding: 0;
  }

  .shore-zone {
    justify-self: auto;
    padding: 0;
  }

  .shore-grid {
    grid-template-columns: repeat(var(--shore-columns, 6), var(--stone));
  }

  .pack-zone {
    width: min(100%, var(--pack-width));
    justify-self: auto;
    padding: 2px 0 40px;
  }

  .pack-shell {
    width: 100%;
  }

  .pack-toggle {
    left: 50%;
    right: auto;
    bottom: -10px;
    transform: translateX(-50%);
  }

  .pack-toggle:active {
    transform: translate(-50%, 2px);
  }

  .board-result {
    right: 70px;
    bottom: 8px;
    max-width: calc(100% - 152px);
  }

  .feedback {
    font-size: 18px;
  }

  .answer-row {
    position: absolute;
    right: 0;
    bottom: 0;
    min-height: 56px;
  }

  .confirm-button {
    width: 56px;
    height: 56px;
    min-width: 56px;
    min-height: 56px;
  }

  .next-button {
    min-width: 110px;
    min-height: 56px;
  }

  .next-button img {
    width: 50px;
    height: 50px;
  }

  .success-result {
    font-size: 20px;
  }

  .success-result img {
    width: 28px;
    height: 28px;
  }

  .picture-steps {
    grid-template-columns: 1fr;
  }

  .picture-step {
    min-height: 100px;
  }

  .level-menu {
    grid-template-columns: repeat(5, minmax(48px, 1fr));
    gap: 5px;
  }

  .level-menu button {
    min-height: 56px;
    padding: 4px;
  }
}

@media (max-height: 700px) and (orientation: portrait) {
  .play-surface {
    --hero-top: clamp(210px, 36dvh, 230px);
  }

  .pack-zone {
    padding-top: 0;
  }
}

@media (min-width: 600px) and (orientation: portrait) {
  .world-background {
    background-position: center bottom;
  }

  .play-surface {
    --hero-left: clamp(24px, 4vw, 34px);
    --hero-width: clamp(300px, 44vw, 380px);
    --hero-height: calc(var(--hero-width) * 0.8);
    --hero-top: clamp(118px, 16dvh, 176px);
    --pack-width: min(92vw, 700px);
  }

  .hero-figure {
    top: var(--hero-top);
    left: var(--hero-left);
    bottom: auto;
  }

  .guide-copy {
    top: 2px;
    right: auto;
    bottom: auto;
    left: clamp(192px, 28vw, 220px);
    width: clamp(300px, 42vw, 340px);
    margin: 0;
  }

  .guide-copy:has(.tutorial-banner:not([hidden])) {
    top: 2px;
  }

  .guide-panel:has(.tutorial-banner:not([hidden])) .hero-figure {
    top: calc(var(--hero-top) + 20px);
  }

  .tutorial-banner {
    position: fixed;
    z-index: 26;
    top: 146px;
    left: max(12px, var(--safe-left));
    grid-template-columns: 1fr;
    width: 180px;
  }

  .guide-bubble p:first-child {
    font-size: 24px;
  }

  .tutorial-banner p {
    font-size: 18px;
  }

  .tutorial-actions button {
    flex: 0 0 auto;
    min-width: 64px;
    min-height: 48px;
    font-size: 18px;
  }

  .board-zones {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
  }

  .shore-zone {
    position: absolute;
    z-index: 3;
    top: clamp(240px, 26dvh, 320px);
    left: calc(var(--hero-left) + var(--hero-width) + clamp(12px, 2vw, 22px));
    width: max-content;
    padding: 0;
    --stone: 48px;
  }

  .shore-zone .zone-heading {
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    width: 100%;
    transform: translateX(-50%);
  }

  .shore-grid {
    grid-template-columns: repeat(var(--shore-columns, 6), var(--stone));
  }

  .pack-zone {
    position: absolute;
    z-index: 2;
    bottom: 76px;
    left: 50%;
    width: var(--pack-width);
    padding: 0;
    transform: translateX(-50%);
    --stone: 56px;
    --stone-gap: 6px;
  }

  .pack-zone .zone-heading {
    position: absolute;
    z-index: 10;
    top: 5px;
    left: 3%;
  }

  .pack-shell {
    width: 100%;
  }

  .pack-excess {
    top: 4%;
    right: 2%;
  }

  .board-result {
    right: 68px;
  }
}

@media (min-width: 600px) and (max-width: 660px) and (orientation: portrait) {
  .shore-zone {
    top: 210px;
  }

  .shore-grid {
    grid-template-columns: repeat(var(--shore-columns, 4), var(--stone));
  }
}

@media (min-width: 700px) and (orientation: landscape) {
  :root {
    --stone: 56px;
  }

  .round-control {
    flex-basis: 60px;
    width: 60px;
    height: 60px;
    min-width: 60px;
    min-height: 60px;
  }

  .control-row {
    gap: 8px;
  }
}

@media (max-width: 980px) and (orientation: landscape) {
  .play-surface {
    grid-template-columns: clamp(200px, 27vw, 300px) minmax(0, 1fr);
  }

  .board-zones {
    grid-template-columns: minmax(70px, 0.35fr) minmax(380px, 1fr);
  }
}

@media (max-height: 700px) and (orientation: landscape) {
  .round-control {
    flex-basis: 56px;
    width: 56px;
    height: 56px;
    min-width: 56px;
    min-height: 56px;
  }

  .play-surface {
    gap: 4px;
    padding-top: max(64px, calc(var(--safe-top) + 54px));
    padding-bottom: 2px;
  }

  .hero-figure {
    width: min(94%, clamp(220px, 28vw, 320px));
  }

  .guide-copy {
    top: 0;
    width: min(100%, 235px);
  }

  .guide-bubble {
    min-height: 0;
    padding: 18px 22px 20px 28px;
  }

  .guide-bubble p:first-child {
    font-size: 20px;
  }

  .pack-zone {
    padding-top: 35px;
    padding-bottom: 10px;
  }

  .pack-toggle {
    bottom: -8px;
  }

  .board-result {
    bottom: 3px;
  }

  .answer-row {
    min-height: 60px;
  }

  .confirm-button {
    width: 56px;
    height: 56px;
    min-width: 56px;
    min-height: 56px;
  }
}

@media (max-width: 430px) {
  :root {
    --stone: 48px;
    --stone-gap: 2px;
  }

  .play-surface {
    padding-top: max(96px, calc(var(--safe-top) + 86px));
    padding-left: max(6px, env(safe-area-inset-left));
    padding-right: max(6px, env(safe-area-inset-right));
  }

  .intro-title-frame h1 {
    font-size: 2.2rem;
  }

  .intro-actions {
    bottom: max(12px, var(--safe-bottom));
    gap: 6px;
    padding: 4px 10px 4px max(58px, calc(10px + env(safe-area-inset-left)));
  }

  .intro-actions p {
    font-size: 18px;
  }

  .intro-play-button,
  .intro-play-button img {
    width: 72px;
    height: 72px;
    min-width: 72px;
    min-height: 72px;
  }

  .game-header {
    flex-wrap: wrap;
  }

  .control-row {
    width: 100%;
    justify-content: flex-start;
  }

  .progress-wrap {
    width: 100%;
    min-height: 22px;
    padding: 0;
    justify-content: flex-end;
    gap: 4px;
  }

  .level-token {
    width: 20px;
    height: 18px;
  }

  .task-star {
    width: 16px;
    height: 16px;
  }

  .guide-panel {
    grid-template-columns: minmax(108px, 41%) minmax(0, 59%);
    min-height: clamp(154px, 24vh, 220px);
  }

  .play-surface {
    --hero-top: clamp(140px, 18dvh, 190px);
    --pack-width: clamp(338px, 91vw, 400px);
    --stone: clamp(48px, 12.5vw, 54px);
  }

  .guide-copy {
    top: -18px;
    left: calc(var(--hero-width) - 52px);
    width: clamp(252px, 74vw, 272px);
  }

  .guide-copy:has(.tutorial-banner:not([hidden])) {
    top: -18px;
    left: 116px;
    width: 234px;
  }

  .guide-panel:has(.tutorial-banner:not([hidden])) .hero-figure {
    top: var(--hero-top);
  }

  .guide-bubble {
    min-height: 0;
    padding: 18px 22px 20px 28px;
  }

  .guide-bubble p:first-child {
    font-size: 20px;
  }

  .tutorial-banner p {
    font-size: 16px;
  }

  .tutorial-banner {
    position: fixed;
    z-index: 26;
    top: 146px;
    left: max(8px, var(--safe-left));
    grid-template-columns: 1fr;
    gap: 4px;
    width: 104px;
  }

  .tutorial-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
  }

  .tutorial-actions button {
    width: 100%;
    min-width: 0;
    min-height: 48px;
    padding: 4px 7px;
    font-size: 16px;
    white-space: nowrap;
  }

  .board-zones {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
  }

  .shore-zone {
    position: absolute;
    z-index: 3;
    top: clamp(164px, calc(50dvh - 156px), 300px);
    right: 0;
    width: calc(4 * var(--stone) + 3 * var(--stone-gap) + 8px);
    padding: 0;
  }

  .shore-zone .zone-heading {
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    width: max-content;
    transform: translateX(-50%);
  }

  .shore-grid {
    --shore-columns: 4;
    width: 100%;
    grid-template-columns: repeat(var(--shore-columns, 4), var(--stone));
  }

  .pack-zone {
    position: absolute;
    right: 0;
    bottom: clamp(40px, 6vh, 64px);
    left: auto;
    padding: 0;
  }

  .pack-zone .zone-heading {
    position: absolute;
    z-index: 10;
    top: 0;
    left: 8%;
    justify-content: flex-start;
    width: auto;
    transform: none;
  }

  .pack-toggle {
    left: 22%;
    min-width: 48px;
    padding: 4px 7px;
    font-size: 18px;
  }

  .board-result {
    right: 64px;
    max-width: calc(100% - 142px);
  }

  .feedback {
    font-size: 18px;
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  :root {
    --stone: 48px;
    --stone-gap: 2px;
  }

  .control-row {
    gap: 4px;
  }

  .round-control {
    flex-basis: 56px;
    width: 56px;
    height: 56px;
    min-width: 56px;
    min-height: 56px;
  }

  .progress-wrap {
    gap: 5px;
    min-height: 40px;
    padding: 8px 0;
  }

  .level-token {
    width: 22px;
    height: 19px;
  }

  .task-star {
    width: 18px;
    height: 18px;
  }

  .play-surface {
    grid-template-columns: minmax(160px, 25vw) minmax(0, 1fr);
    gap: 4px;
    padding: max(62px, calc(var(--safe-top) + 52px)) var(--safe-right) max(2px, env(safe-area-inset-bottom)) var(--safe-left);
  }

  .guide-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 2px;
    padding: 0;
    left: 24px;
  }

  .hero-figure {
    position: relative;
    left: auto;
    bottom: auto;
    order: 2;
    width: min(96%, 150px);
    max-width: 150px;
    max-height: 146px;
  }

  .hero-figure .sopo-loop {
    inset: 0;
    width: 100%;
    height: 100%;
  }

  .guide-copy {
    position: relative;
    top: auto;
    right: auto;
    order: 1;
    width: 100%;
    margin: 0;
    gap: 4px;
  }

  .guide-bubble {
    min-height: 0;
    padding: 16px 20px 18px 26px;
    box-shadow: none;
  }

  .guide-bubble p:first-child {
    font-size: 20px;
    line-height: 1.1;
  }

  .tutorial-banner {
    grid-template-columns: 1fr;
  }

  .tutorial-banner p {
    font-size: 16px;
  }

  .tutorial-actions button {
    min-width: 52px;
    min-height: 48px;
    padding: 4px 7px;
    font-size: 16px;
    white-space: nowrap;
  }

  .small-wood-button {
    min-width: 74px;
    min-height: 48px;
    padding: 6px 10px;
  }

  .board-zones {
    grid-template-columns: minmax(160px, 0.58fr) minmax(0, 1.42fr);
    gap: 6px;
  }

  .shore-zone {
    padding-bottom: 8px;
  }

  .pack-zone {
    padding: 28px 0 8px;
  }

  .shore-grid {
    --shore-columns: 3;
    grid-template-columns: repeat(var(--shore-columns, 4), var(--stone));
  }

  .pack-toggle {
    left: 3%;
    bottom: -8px;
    min-width: 48px;
    padding: 4px 8px;
    font-size: 18px;
  }

  .pack-shell {
    width: min(100%, 380px);
  }

  .pack-excess {
    right: 2%;
    top: -46px;
  }

  .board-result {
    right: 62px;
    bottom: 2px;
    max-width: calc(100% - 142px);
  }

  .feedback {
    font-size: 18px;
    line-height: 1.2;
  }

  .success-result {
    gap: 4px;
    font-size: 20px;
  }

  .success-result img {
    width: 24px;
    height: 24px;
  }

  .answer-row {
    position: absolute;
    right: 0;
    bottom: 0;
    min-height: 56px;
    gap: 0;
    padding: 0;
  }

  .confirm-button {
    width: 56px;
    height: 56px;
    min-width: 56px;
    min-height: 56px;
  }

  .next-button {
    min-width: 108px;
    min-height: 56px;
  }

  .next-button img {
    width: 44px;
    height: 44px;
  }

  .next-button span {
    margin-left: 4px;
    padding: 4px 7px;
    font-size: 18px;
  }

  .intro-title-frame {
    padding: 8px 16px;
    border-width: 3px;
    border-radius: 20px;
  }

  .intro-title-frame h1 {
    margin-top: 0;
    font-size: 2rem;
  }

  .intro-actions {
    width: auto;
    padding: 8px;
    border-width: 3px;
  }

  .intro-actions p {
    display: none;
  }

  .intro-play-button,
  .intro-play-button img {
    width: 80px;
    height: 80px;
    min-width: 80px;
    min-height: 80px;
  }
}

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