:root {
  color-scheme: light;
  --ink: #29424b;
  --muted: #66808a;
  --sky: #8dd6e7;
  --cream: #fff9e9;
  --blue: #36aee4;
  --blue-dark: #197fae;
  --red: #f06a70;
  --red-dark: #bf3f49;
  --yellow: #f7c94a;
  --yellow-dark: #bd8614;
  --shadow: 0 14px 36px rgba(42, 79, 89, .18);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

body {
  min-width: 320px;
  color: var(--ink);
  font-family: "Hiragino Maru Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
  background:
    radial-gradient(circle at 12% 8%, rgba(255,255,255,.72) 0 2px, transparent 3px),
    radial-gradient(circle at 87% 18%, rgba(255,255,255,.6) 0 3px, transparent 4px),
    linear-gradient(180deg, #8ed7e7 0%, #c7eef1 52%, #fff6d9 100%);
  background-size: 72px 72px, 92px 92px, auto;
  overscroll-behavior: none;
}

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

button {
  color: inherit;
  font: inherit;
}

.game-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100svh;
  min-height: 0;
  margin: 0 auto;
  padding: max(10px, env(safe-area-inset-top)) 0 max(8px, env(safe-area-inset-bottom));
  overflow: hidden;
}

.topbar {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  flex: 0 0 auto;
  min-height: 42px;
  padding-inline: 14px;
}

.home-link {
  grid-column: 1;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(132,167,184,.55);
  border-radius: 12px;
  color: #587080;
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
  background: rgba(255,255,255,.86);
  box-shadow: 0 4px 10px rgba(68,86,92,.1);
  transition: transform .12s, box-shadow .12s, background .12s;
}

.home-link:active { transform: translateY(2px); box-shadow: 0 2px 5px rgba(68,86,92,.1); }
.home-link:focus-visible { outline: 3px solid #ffe88c; outline-offset: 2px; }

.turn-pill {
  grid-column: 2;
  min-width: 138px;
  padding: 8px 18px;
  border: 2px solid rgba(255,255,255,.92);
  border-radius: 999px;
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  text-align: center;
  background: var(--blue);
  box-shadow: 0 5px 14px rgba(23, 104, 134, .18);
  transition: background .25s, transform .25s;
}

.turn-pill[data-color="blue"] { background: var(--blue); }
.turn-pill[data-color="red"] { background: var(--red); }
.turn-pill[data-color="yellow"] { color: #614a00; background: var(--yellow); }

.round-button {
  display: grid;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(118,190,224,.46);
  border-radius: 50%;
  color: #29483e;
  font-size: 19px;
  line-height: 1;
  background: rgba(255,255,255,.92);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 3px 7px rgba(0,0,0,.14);
  cursor: pointer;
  transition: transform .12s, box-shadow .12s, opacity .12s;
}

.round-button:active {
  transform: translateY(2px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 1px 3px rgba(0,0,0,.14);
}

.round-button:focus-visible { outline: 3px solid #ffe88c; outline-offset: 2px; }

.top-actions {
  grid-column: 3;
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 7px;
}

.coin-balance {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 34px;
  padding: 4px 9px 4px 6px;
  border: 2px solid rgba(255,255,255,.9);
  border-radius: 999px;
  color: #53666c;
  font-size: 12px;
  background: rgba(255,255,255,.66);
  box-shadow: 0 4px 11px rgba(39,80,90,.12);
}

.coin-balance img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.round-button[aria-pressed="true"] {
  opacity: .72;
  background: #e9f0ed;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.title-screen {
  position: relative;
  padding: 34px 12px 24px;
  text-align: center;
  animation: rise-in .55s ease both;
}

.title-screen.active {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.title-art {
  position: relative;
  width: min(520px, 95vw);
  height: 230px;
  margin: 0 auto -8px;
}

.title-peso {
  position: absolute;
  bottom: 4px;
  z-index: 2;
  width: clamp(126px, 24vw, 190px);
  max-height: 210px;
  object-fit: contain;
  filter: drop-shadow(0 10px 8px rgba(28,77,88,.18));
}

.peso-left {
  left: 2%;
  transform: rotate(-4deg);
}

.peso-right {
  right: 2%;
  transform: scaleX(-1) rotate(-4deg);
}

.mini-star {
  position: absolute;
  top: 8px;
  left: 50%;
  width: 188px;
  height: 188px;
  border: 11px solid rgba(255,255,255,.9);
  clip-path: polygon(50% 0,61% 31%,94% 25%,69% 47%,100% 65%,66% 64%,67% 100%,50% 72%,32% 100%,34% 64%,0 65%,31% 47%,6% 25%,39% 31%);
  background: rgba(255, 245, 187, .8);
  transform: translateX(-50%) rotate(-3deg);
  filter: drop-shadow(0 10px 14px rgba(41,91,103,.16));
}

.mini-star i {
  position: absolute;
  width: 15px;
  height: 15px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--blue);
}

.mini-star i:nth-child(1) { top: 22px; left: 75px; }
.mini-star i:nth-child(2) { top: 52px; left: 42px; background: var(--red); }
.mini-star i:nth-child(3) { top: 52px; right: 42px; background: var(--yellow); }
.mini-star i:nth-child(4) { top: 83px; left: 74px; }
.mini-star i:nth-child(5) { top: 113px; left: 42px; background: var(--yellow); }
.mini-star i:nth-child(6) { top: 113px; right: 42px; background: var(--red); }
.mini-star i:nth-child(7) { bottom: 19px; left: 74px; }

.title-logo {
  display: block;
  width: min(440px, 90vw);
  height: auto;
  margin: 0 auto;
  object-fit: contain;
  filter: drop-shadow(0 7px 12px rgba(40,98,112,.14));
}

.title-character-image {
  display: block;
  width: min(370px, 82vw);
  max-height: 145px;
  margin: -6px auto 3px;
  object-fit: contain;
  filter: drop-shadow(0 8px 8px rgba(37,79,89,.16));
}

.title-kicker,
.modal-kicker,
.result-panel > p:first-of-type {
  margin: 0 0 7px;
  color: #26788e;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .16em;
}

.title-screen h1 {
  margin: 0;
  line-height: 1.05;
  text-shadow: 0 3px 0 #fff, 0 7px 18px rgba(40,98,112,.14);
}

.title-screen h1 span {
  display: block;
  margin-bottom: 8px;
  color: #397486;
  font-size: clamp(20px, 4.2vw, 31px);
}

.title-screen h1 b {
  display: block;
  color: #fff;
  font-size: clamp(35px, 8vw, 62px);
  letter-spacing: -.06em;
  -webkit-text-stroke: 2px #2c91ad;
}

.title-copy {
  margin: 20px 0 14px;
  color: #3e6976;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.8;
}

.title-feature {
  color: #9a7116;
  font-size: .88em;
  font-weight: 900;
}

.color-picker {
  width: min(290px, 88vw);
  margin: 0 auto 17px;
}

.color-picker > p {
  margin: 8px 0 0;
  color: #3e6976;
  font-size: 12px;
  font-weight: 900;
}

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

.color-button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 5px 8px;
  border: 3px solid rgba(255,255,255,.82);
  border-radius: 999px;
  color: #526c75;
  font-size: 14px;
  font-weight: 900;
  background: rgba(255,255,255,.5);
  box-shadow: 0 4px 11px rgba(40,78,88,.1);
  cursor: pointer;
  transition: transform .18s, background .18s, box-shadow .18s;
}

.color-character {
  position: absolute;
  z-index: 2;
  bottom: 28px;
  left: 50%;
  width: 58px;
  height: 58px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 18px) scale(.62);
  transform-origin: 50% 100%;
}

.color-character img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 5px 5px rgba(39,72,79,.24));
}

.color-button.selected .color-character {
  opacity: 1;
  animation: color-character-pop .42s cubic-bezier(.2,.86,.3,1.3) both;
}

.color-button i {
  width: 18px;
  height: 18px;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(43,68,74,.2);
}

.color-button[data-color="blue"] i { background: var(--blue); }
.color-button[data-color="red"] i { background: var(--red); }
.color-button[data-color="yellow"] i { background: var(--yellow); }

.color-button.selected {
  color: #294f5b;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(255,255,255,.38), 0 6px 14px rgba(40,78,88,.16);
  transform: translateY(-2px);
}

.main-button {
  display: block;
  width: min(310px, 88vw);
  min-height: 56px;
  margin: 0 auto;
  border: 0;
  border-bottom: 5px solid #1a7598;
  border-radius: 999px;
  color: #fff;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: .04em;
  background: linear-gradient(#54c4ec, #289ed2);
  box-shadow: 0 9px 22px rgba(29,110,140,.23), inset 0 2px rgba(255,255,255,.5);
  cursor: pointer;
}

.main-button:active {
  border-bottom-width: 2px;
  transform: translateY(3px);
}

.main-button.small {
  width: min(230px, 75vw);
  min-height: 48px;
  font-size: 15px;
}

.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  margin-top: 14px;
  padding: 8px 16px;
  border: 1px solid #c8dbe5;
  border-radius: 12px;
  color: #587080;
  font-size: 14px;
  font-weight: 900;
  text-decoration: none;
  background: rgba(234,243,247,.94);
  box-shadow: 0 3px 0 #c8d9e2;
  cursor: pointer;
  transition: transform .12s, box-shadow .12s, background .12s;
}

.text-button:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #c8d9e2;
}

.text-button:focus-visible { outline: 3px solid #ffe88c; outline-offset: 2px; }

.title-secondary-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
}

.title-secondary-actions .text-button { min-width: 120px; margin-top: 0; }
.shop-open-button {
  border-color: #ead3a2;
  color: #8a5a0a;
  background: rgba(255,246,215,.96);
  box-shadow: 0 3px 0 #dec89d;
}
.shop-open-button:active { box-shadow: 0 1px 0 #dec89d; }
.result-panel .text-button { display: flex; width: min(230px, 75vw); margin: 10px auto 0; }

.title-app-promo {
  width: min(660px, calc(100% - 16px));
  margin: 12px auto 0;
  padding: 5px 7px 6px;
  border: 1px solid rgba(185,226,238,.92);
  border-radius: 12px;
  background: rgba(248,253,255,.86);
  box-shadow: 0 5px 16px rgba(40,92,120,.12);
}

.title-app-promo-heading {
  display: block;
  margin-bottom: 4px;
  color: #315c73;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
}

.title-app-promo-banners {
  display: flex;
  justify-content: center;
  gap: 7px;
}

.title-app-promo-banner {
  display: block;
  flex: 1 1 0;
  max-width: 320px;
  aspect-ratio: 4 / 1;
  overflow: hidden;
  border: 1px solid #b9e2ee;
  border-radius: 9px;
  background: #e5f8fd;
}

.title-app-promo-banner:focus-visible { outline: 3px solid #ffbf27; outline-offset: 2px; }
.title-app-promo-banner img { display: block; width: 100%; height: 100%; object-fit: cover; }
.title-app-promo[data-platform="android"] .title-app-promo-banner,
.title-app-promo[data-platform="ios"] .title-app-promo-banner { flex: 0 1 260px; max-width: 260px; }

.battle-screen {
  position: relative;
  min-height: 0;
  padding-top: 6px;
  animation: fade-in .38s ease both;
}

.battle-screen.active {
  display: grid;
  flex: 1 1 auto;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  overflow: hidden;
}

.rivals {
  position: relative;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  width: min(680px, 100%);
  margin: 0 auto 5px;
  pointer-events: none;
}

.rival {
  display: flex;
  align-items: center;
  width: min(43%, 205px);
  padding: 4px 8px 4px 4px;
  border: 2px solid #fff;
  border-radius: 22px;
  background: rgba(255,255,255,.73);
  box-shadow: 0 7px 18px rgba(40,78,88,.14);
  transition: transform .25s, box-shadow .25s;
}

.rival.active {
  transform: translateY(-3px);
  box-shadow: 0 0 0 5px rgba(255,255,255,.45), 0 9px 20px rgba(40,78,88,.2);
}

.rival-face {
  position: relative;
  flex: 0 0 46px;
  height: 46px;
  overflow: hidden;
  border-radius: 50%;
  background: #eaf8f7;
}

.rival-face img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.thinking {
  position: absolute;
  inset: 0;
  display: none;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  padding-bottom: 4px;
  background: linear-gradient(transparent 52%, rgba(30,62,69,.55));
}

.active .thinking { display: flex; }

.thinking i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #fff;
  animation: dot 1s infinite ease-in-out;
}

.thinking i:nth-child(2) { animation-delay: .15s; }
.thinking i:nth-child(3) { animation-delay: .3s; }

.rival-copy {
  min-width: 0;
  padding-left: 7px;
  text-align: left;
}

.rival-copy strong,
.rival-copy span {
  display: block;
  white-space: nowrap;
}

.rival-copy strong {
  overflow: hidden;
  font-size: clamp(10px, 2.2vw, 13px);
  text-overflow: ellipsis;
}

.rival-copy span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.rival[data-color="blue"] .rival-copy b { color: var(--blue-dark); }
.rival[data-color="red"] .rival-copy b { color: var(--red-dark); }
.rival[data-color="yellow"] .rival-copy b { color: var(--yellow-dark); }

.board-panel {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: 100%;
  min-height: 0;
  overflow: hidden;
}

.board-zoom {
  position: relative;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  min-height: 34px;
  width: min(720px, 100%);
  margin: 0 auto 3px;
  padding-right: 8px;
}

.board-zoom button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 50%;
  color: #276c80;
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
  background: rgba(255,255,255,.9);
  box-shadow: 0 4px 11px rgba(39,80,90,.16);
  cursor: pointer;
}

.board-zoom button:disabled {
  opacity: .38;
  cursor: default;
}

.board-zoom output {
  min-width: 48px;
  color: #496b75;
  font-size: 11px;
  font-weight: 900;
  text-align: center;
}

.board-viewport {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  touch-action: pan-x pan-y;
}

.board-viewport::-webkit-scrollbar {
  display: none;
}

.board-wrap {
  position: relative;
  width: min(720px, 100%);
  margin-right: auto;
  margin-left: auto;
  filter: drop-shadow(0 16px 17px rgba(62,75,69,.19));
}

.game-board {
  display: block;
  width: 100%;
  height: auto;
  touch-action: manipulation;
  user-select: none;
}

.board-shape {
  fill: #dce4e6;
  stroke: #f9fcfd;
  stroke-width: 14;
  stroke-linejoin: round;
}

.camp-shape {
  opacity: .16;
}

.camp-shape.camp-blue { fill: var(--blue); }
.camp-shape.camp-red { fill: var(--red); }
.camp-shape.camp-yellow { fill: var(--yellow); }

.hole {
  fill: #a8b4b8;
  stroke: rgba(255,255,255,.82);
  stroke-width: 3;
  filter: url(#holeShadow);
}

.hole.camp-blue {
  fill: #b2c5c9;
  stroke: #d8eff5;
}

.hole.camp-red {
  fill: #c9babb;
  stroke: #f3d9dc;
}

.hole.camp-yellow {
  fill: #c9c3ad;
  stroke: #eee3b7;
}

.hole.target {
  fill: #fffef6;
  stroke: #46c9ed;
  stroke-width: 6;
  animation: target-pulse .85s ease-in-out infinite alternate;
  cursor: pointer;
}

.hole.jump-target {
  fill: #fffef6;
  stroke: #d96724;
  stroke-dasharray: 6 4;
}

.piece {
  stroke: #fff;
  stroke-width: 5;
  cursor: default;
  filter: url(#pieceShadow);
  transition: filter .15s;
}

.piece.color-blue { fill: var(--blue); stroke: #e9faff; }
.piece.color-red { fill: var(--red); stroke: #7e2630; stroke-dasharray: 8 4; }
.piece.color-yellow { fill: var(--yellow); stroke: #674d00; stroke-dasharray: 2.5 3.5; }

.piece-image {
  overflow: visible;
  stroke: none;
  transform-box: fill-box;
  transform-origin: center;
  transition: transform .16s ease, filter .16s ease;
}

.piece.king {
  stroke-width: 8;
}

.piece.selectable {
  cursor: pointer;
}

.piece.selectable:hover,
.piece.selected {
  stroke: #fff;
  stroke-width: 8;
  filter: url(#pieceShadow) drop-shadow(0 0 8px rgba(42,188,238,.95));
}

.piece.selected {
  animation: selected-bob .7s ease-in-out infinite alternate;
}

.piece-image.selectable:hover {
  transform: scale(1.06);
}

.piece-image.selected {
  animation: image-selected-bob .68s ease-in-out infinite alternate;
}

.piece-image.color-blue.selected {
  filter: url(#pieceShadow) drop-shadow(0 0 3px #fff) drop-shadow(0 0 10px rgba(54,174,228,.95));
}

.piece-image.color-red.selected {
  filter: url(#pieceShadow) drop-shadow(0 0 3px #fff) drop-shadow(0 0 10px rgba(240,106,112,.95));
}

.piece-image.color-yellow.selected {
  filter: url(#pieceShadow) drop-shadow(0 0 3px #fff) drop-shadow(0 0 10px rgba(225,170,25,.98));
}

.piece-image-selection {
  stroke-width: 5;
  pointer-events: none;
  transform-box: fill-box;
  transform-origin: center;
  filter: drop-shadow(0 0 7px rgba(255,255,255,.95));
  animation: image-selection-ring .68s ease-in-out infinite alternate;
}

.piece-image-selection.color-blue { fill: rgba(54,174,228,.25); stroke: #36aee4; }
.piece-image-selection.color-red { fill: rgba(240,106,112,.25); stroke: #f06a70; }
.piece-image-selection.color-yellow { fill: rgba(247,201,74,.28); stroke: #d39a00; }

.piece-mark {
  fill: rgba(255,255,255,.74);
  pointer-events: none;
}

.piece.color-yellow + .piece-mark,
.piece.color-yellow + .king-mark {
  fill: #493800;
}

.king-mark {
  fill: #fff;
  font-family: "Yu Gothic", "Meiryo", sans-serif;
  font-size: 20px;
  font-weight: 900;
  text-anchor: middle;
  paint-order: stroke;
  stroke: rgba(57,72,76,.22);
  stroke-width: 2px;
  pointer-events: none;
}

.last-move {
  fill: none;
  stroke: rgba(255,255,255,.8);
  stroke-width: 5;
  stroke-dasharray: 5 7;
  pointer-events: none;
  animation: ring-turn 5s linear infinite;
}

.board-coin-halo {
  fill: rgba(255,242,158,.72);
  stroke: rgba(255,255,255,.9);
  stroke-width: 3;
  pointer-events: none;
  transform-box: fill-box;
  transform-origin: center;
  animation: coin-glow 1s ease-in-out infinite alternate;
}

.board-coin {
  pointer-events: none;
  filter: drop-shadow(0 3px 4px rgba(129,88,14,.35));
}

.board-item-halo {
  fill: #a978d5;
  stroke: #fff;
  stroke-width: 4;
  pointer-events: none;
  transform-box: fill-box;
  transform-origin: center;
  filter: drop-shadow(0 4px 5px rgba(75,44,105,.35));
  animation: item-glow .8s ease-in-out infinite alternate;
}

.board-item-mark {
  fill: #fff;
  font-family: "Yu Gothic", "Meiryo", sans-serif;
  font-size: 24px;
  font-weight: 900;
  text-anchor: middle;
  pointer-events: none;
}

.target-overlay-back,
.target-overlay {
  fill: none;
  pointer-events: none;
  transform-box: fill-box;
  transform-origin: center;
}

.target-overlay-back {
  stroke: rgba(255,255,255,.96);
  stroke-width: 10;
}

.target-overlay {
  stroke: #20bde8;
  stroke-width: 5;
  filter: drop-shadow(0 0 5px rgba(29,170,217,.8));
  animation: target-overlay-pulse .68s ease-in-out infinite alternate;
}

.target-overlay.jump { stroke-dasharray: 8 5; }

.cpu-banner {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 8;
  display: none;
  min-width: 190px;
  padding: 11px 18px;
  border: 3px solid #fff;
  border-radius: 999px;
  color: #496068;
  font-size: 13px;
  font-weight: 900;
  text-align: center;
  background: rgba(255,255,255,.92);
  box-shadow: var(--shadow);
  transform: translate(-50%, -50%);
}

.cpu-banner.show { display: block; animation: pop-in .2s ease both; }

.control-panel {
  position: relative;
  z-index: 8;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  width: min(720px, 100%);
  min-height: 64px;
  margin: 4px auto 0;
  padding: 8px 10px;
  border: 3px solid rgba(255,255,255,.93);
  border-radius: 22px;
  background: rgba(255,255,255,.76);
  box-shadow: 0 9px 24px rgba(48,80,87,.15);
  pointer-events: none;
}

.item-bar {
  position: relative;
  z-index: 7;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: min(720px, 100%);
  min-height: 40px;
  margin: 2px auto 0;
}

.item-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
}

.item-bar-label {
  flex: 0 0 auto;
  color: #49636b;
  font-size: 10px;
  font-weight: 900;
  white-space: nowrap;
}

.item-use-button {
  position: relative;
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 36px;
  padding: 4px 10px;
  border: 2px solid rgba(255,255,255,.94);
  border-radius: 999px;
  color: #53676d;
  font-size: 11px;
  background: rgba(255,255,255,.82);
  box-shadow: 0 5px 12px rgba(42,78,87,.13);
  transform: translateY(0);
  transition: transform .22s ease, opacity .22s ease, box-shadow .22s ease, background .18s ease;
}

.item-use-button > span { color: #d69a20; font-size: 18px; line-height: 1; }
.item-use-button small { color: var(--muted); font-weight: 900; }
.item-use-button.active { color: #8a5a06; background: #fff2bc; box-shadow: 0 0 0 3px rgba(255,230,118,.45); }
.item-use-button:not(:disabled):active { transform: translateY(2px); }
.item-use-button:disabled {
  opacity: .64;
  box-shadow: none;
  transform: translateY(12px);
  cursor: default;
}

.board-coin-count {
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: 33px;
  padding: 4px 8px;
  border: 2px solid rgba(255,255,255,.94);
  border-radius: 999px;
  color: #9a6810;
  font-size: 11px;
  font-weight: 900;
  background: rgba(255,249,215,.9);
  box-shadow: 0 5px 12px rgba(90,70,20,.11);
}

.board-coin-count img { width: 20px; height: 20px; object-fit: contain; }

.item-notice {
  position: absolute;
  bottom: calc(100% + 3px);
  left: 50%;
  display: none;
  max-width: min(340px, 92vw);
  margin: 0;
  padding: 7px 13px;
  border: 2px solid #fff;
  border-radius: 999px;
  color: #566d74;
  font-size: 11px;
  font-weight: 900;
  text-align: center;
  background: rgba(255,255,255,.94);
  box-shadow: 0 7px 16px rgba(38,72,80,.16);
  transform: translateX(-50%);
}

.item-notice.show { display: block; animation: fade-in .18s ease both; }

.control-panel button {
  pointer-events: auto;
}

.you-chip {
  display: flex;
  align-items: center;
  gap: 7px;
}

.you-face {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  overflow: hidden;
  border: 3px solid var(--blue);
  border-radius: 50%;
  background: #eef8f7;
  box-shadow: 0 4px 7px rgba(24,101,132,.22);
}

.you-face img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: 50% 50%;
}

.you-chip strong,
.you-chip small {
  display: block;
  white-space: nowrap;
}

.you-chip strong { font-size: 13px; }
.you-chip small { margin-top: 2px; color: var(--muted); font-size: 10px; font-weight: 800; }
.you-chip[data-color="blue"] .you-face { border-color: var(--blue); }
.you-chip[data-color="red"] .you-face { border-color: var(--red); }
.you-chip[data-color="yellow"] .you-face { border-color: var(--yellow); }
.you-chip[data-color="blue"] b { color: var(--blue-dark); }
.you-chip[data-color="red"] b { color: var(--red-dark); }
.you-chip[data-color="yellow"] b { color: var(--yellow-dark); }

.guide {
  margin: 0;
  font-size: clamp(12px, 3vw, 15px);
  font-weight: 900;
  text-align: center;
}

.help-button {
  display: grid;
  width: 36px;
  height: 36px;
  padding: 0;
  place-items: center;
  border: 2px solid #9cbec7;
  border-radius: 50%;
  color: #54818d;
  font-size: 18px;
  font-weight: 900;
  background: #fff;
  cursor: pointer;
}

.result-panel,
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(35,67,75,.52);
  backdrop-filter: blur(6px);
}

.result-panel.show,
.modal.show {
  display: flex;
  animation: fade-in .25s ease both;
}

.result-panel {
  flex-direction: column;
  text-align: center;
}

.result-panel::before {
  position: absolute;
  z-index: -1;
  width: min(440px, 90vw);
  height: min(540px, 82vh);
  border: 5px solid #fff;
  border-radius: 36px;
  background: linear-gradient(180deg, #fffef7, #eaf9f9);
  box-shadow: 0 24px 60px rgba(19,45,52,.3);
  content: "";
}

.result-panel > img {
  width: min(200px, 48vw);
  max-height: 190px;
  object-fit: contain;
  filter: drop-shadow(0 8px 8px rgba(48,78,85,.15));
}

.result-reward {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  width: min(300px, 78vw);
  margin: -8px auto 12px;
  padding: 9px 14px;
  border: 2px solid #fff;
  border-radius: 18px;
  color: #587079;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
  text-align: left;
  background: #eef8f7;
  box-shadow: 0 5px 13px rgba(43,80,88,.1);
}

.result-reward > strong {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #df8a17;
  font-size: 24px;
}

.result-reward img {
  width: 27px;
  height: 27px;
  object-fit: contain;
}

.result-reward small,
.result-reward em {
  grid-column: 1 / -1;
  font-size: 10px;
  font-style: normal;
}

.result-reward em {
  min-height: 0;
  color: #b14a55;
}

.result-panel h2 {
  margin: 2px 0 8px;
  color: #258aad;
  font-size: clamp(28px, 7vw, 42px);
}

.result-panel > p:not(:first-of-type) {
  min-height: 24px;
  margin: 0 20px 20px;
  font-size: 14px;
  font-weight: 700;
}

.modal-card {
  position: relative;
  width: min(520px, 100%);
  max-height: 88svh;
  overflow: auto;
  padding: 28px 24px 24px;
  border: 5px solid #fff;
  border-radius: 30px;
  text-align: center;
  background: linear-gradient(180deg, #fffdf4, #f1fbfb);
  box-shadow: 0 24px 60px rgba(19,45,52,.3);
}

.modal-card h2 {
  margin: 0 0 18px;
  font-size: 26px;
}

.shop-card { width: min(600px, 100%); }

.shop-balance {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 13px;
  padding: 10px 14px;
  border-radius: 16px;
  color: #5c737a;
  font-size: 12px;
  font-weight: 900;
  background: #edf7f6;
}

.shop-balance strong { display: flex; align-items: center; gap: 6px; color: #da8618; font-size: 23px; }
.shop-balance img { width: 27px; height: 27px; object-fit: contain; }
.shop-items { display: grid; gap: 10px; }

.shop-item {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 11px;
  border: 2px solid #e2edef;
  border-radius: 18px;
  text-align: left;
  background: #fff;
}

.shop-item-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 14px;
  color: #9a6710;
  font-size: 24px;
  background: #fff3bf;
}

.shop-item p { margin: 3px 0; color: var(--muted); font-size: 10px; font-weight: 700; line-height: 1.45; }
.shop-item small { color: #71858b; font-size: 10px; font-weight: 900; }
.shop-item > button { display: flex; align-items: center; gap: 4px; min-height: 38px; padding: 6px 10px; border: 0; border-radius: 12px; color: #80550b; font-size: 11px; font-weight: 900; background: #ffedaa; }
.shop-item > button img { width: 20px; height: 20px; object-fit: contain; }
.shop-item > button:disabled { opacity: .45; }
.shop-status { min-height: 20px; margin: 10px 0 5px; color: #527078; font-size: 11px; font-weight: 900; }
.shop-status.error { color: #b34550; }
.shop-status.success { color: #23755f; }

.modal-close {
  position: absolute;
  top: 11px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  color: #607a82;
  font-size: 24px;
  line-height: 1;
  background: #e7f2f2;
  cursor: pointer;
}

.rule-list {
  display: grid;
  gap: 10px;
  text-align: left;
}

.rule-list > div {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 15px;
  background: rgba(125,211,225,.13);
}

.rule-list b {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--blue);
}

.rule-list p {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.6;
}

.help-section-title {
  margin: 18px 0 10px;
  color: #3e6875;
  font-size: 17px;
}

.item-rule-list > div { background: rgba(255,214,104,.18); }
.item-rule-list b { background: #e2a92c; }

.help-item-note {
  margin: 11px 4px 0;
  padding: 10px 12px;
  border-radius: 13px;
  color: #675922;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.6;
  background: rgba(255,235,153,.38);
}

.help-note {
  margin: 16px 4px 18px;
  color: #5c757e;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.6;
}

@keyframes fade-in { from { opacity: 0; } }
@keyframes color-character-pop {
  0% { opacity: 0; transform: translate(-50%, 18px) scale(.62); }
  65% { opacity: 1; transform: translate(-50%, -4px) scale(1.08); }
  100% { opacity: 1; transform: translate(-50%, 0) scale(1); }
}
@keyframes rise-in { from { opacity: 0; transform: translateY(12px); } }
@keyframes pop-in { from { opacity: 0; transform: translate(-50%,-50%) scale(.85); } }
@keyframes dot { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-5px); } }
@keyframes selected-bob { to { transform: translateY(-5px); } }
@keyframes image-selected-bob {
  from { transform: translateY(-1px) scale(1.08); }
  to { transform: translateY(-5px) scale(1.15); }
}
@keyframes image-selection-ring {
  from { opacity: .72; transform: scale(.94); }
  to { opacity: 1; transform: scale(1.06); }
}
@keyframes target-pulse { to { stroke-width: 9; } }
@keyframes ring-turn { to { stroke-dashoffset: -60; } }
@keyframes coin-glow { to { opacity: .64; transform: scale(1.12); } }
@keyframes item-glow { to { transform: scale(1.1) rotate(4deg); } }
@keyframes target-overlay-pulse { to { opacity: .72; transform: scale(1.08); } }

@media (max-width: 600px) {
  .topbar { min-height: 38px; padding-inline: 8px; }
  .turn-pill { min-width: 122px; padding: 7px 14px; font-size: 12px; }
  .title-screen { padding-top: 21px; }
  .title-art { height: 205px; }
  .mini-star { width: 166px; height: 166px; }
  .mini-star i { display: none; }
  .color-options { padding-top: 37px; }
  .color-character { bottom: 27px; width: 52px; height: 52px; }
  .rivals { margin-bottom: 3px; }
  .rival { width: min(45%, 170px); padding: 3px 6px 3px 3px; }
  .rival-face { flex-basis: 38px; height: 38px; }
  .rival-copy { padding-left: 4px; }
  .rival-copy span { font-size: 9px; }
  .board-zoom { min-height: 32px; margin-bottom: 1px; }
  .board-zoom button { width: 32px; height: 32px; font-size: 20px; }
  .board-zoom { padding-right: 8px; }
  .control-panel { margin-top: 3px; padding: 7px; gap: 6px; }
  .item-bar { min-height: 36px; margin-top: 1px; }
  .item-use-button { min-height: 33px; padding: 3px 8px; font-size: 10px; }
  .board-coin-count { min-height: 31px; padding-inline: 6px; font-size: 10px; }
  .you-face { flex-basis: 30px; width: 30px; height: 30px; }
  .you-chip strong { font-size: 11px; }
  .you-chip small { font-size: 9px; }
}

@media (max-width: 420px) {
  .home-link { min-height: 32px; padding-inline: 6px; font-size: 10px; }
  .round-button { width: 34px; height: 34px; }
  .top-actions { gap: 4px; }
  .coin-balance { padding-right: 7px; font-size: 10px; }
  .coin-balance img { width: 19px; height: 19px; }
  .title-art { height: 185px; }
  .title-peso { width: 132px; }
  .mini-star { width: 150px; height: 150px; }
  .control-panel { grid-template-columns: auto 1fr 32px; }
  .help-button { width: 32px; height: 32px; }
  .shop-item { grid-template-columns: 38px 1fr; }
  .shop-item-icon { width: 38px; height: 38px; }
  .shop-item > button { grid-column: 1 / -1; justify-content: center; }
}

@media (max-height: 700px) {
  .result-panel::before { height: min(560px, 94svh); }
  .result-panel > img { width: min(125px, 34vw); max-height: 120px; }
  .result-panel h2 { margin-bottom: 4px; font-size: clamp(25px, 6vw, 34px); }
  .result-panel > p:not(:first-of-type) { margin-bottom: 10px; }
  .result-reward { margin-bottom: 7px; padding-block: 6px; }
  .result-panel > .main-button { min-height: 48px; }
}

@media (max-height: 700px) and (orientation: landscape) {
  .rivals { position: relative; inset: auto; width: min(680px, 100%); }
  .rival { width: min(42%, 170px); }
  .control-panel { width: min(680px, 92%); margin-top: 2px; }
}

@media (max-height: 800px) and (orientation: landscape) {
  .title-screen.active {
    display: grid;
    grid-template-columns: minmax(290px, 430px);
    grid-template-rows: repeat(5, auto);
    align-content: center;
    justify-content: center;
    padding: 2px 12px 6px;
  }

  .title-art {
    grid-column: 1;
    grid-row: 1 / 7;
    align-self: center;
    width: 100%;
    height: min(300px, calc(100svh - 82px));
    margin: 0;
  }

  .title-peso {
    width: clamp(102px, 16vw, 170px);
    max-height: min(280px, calc(100svh - 96px));
  }

  .mini-star {
    top: 50%;
    width: min(170px, 42vh);
    height: min(170px, 42vh);
    transform: translate(-50%, -50%) rotate(-3deg);
  }

  .title-logo,
  .title-copy,
  .color-picker,
  .title-screen > .main-button,
  .title-secondary-actions {
    grid-column: 1;
  }

  .title-app-promo { grid-column: 1; width: min(550px, 96%); margin-top: 8px; }
  .title-app-promo-banner { max-width: 260px; }

  .title-logo {
    width: auto;
    max-width: 100%;
    height: min(150px, 29svh);
  }
  .title-character-image { width: min(300px, 55vw); max-height: 108px; margin-block: -5px 1px; }
  .title-copy { margin: 7px 0 5px; font-size: 12px; line-height: 1.35; }
  .color-picker { margin-bottom: 6px; }
  .color-picker > p { margin: 3px 0 0; font-size: 11px; }
  .color-options { padding-top: 31px; }
  .color-character { bottom: 25px; width: 46px; height: 46px; }
  .color-button { min-height: 36px; padding-block: 3px; font-size: 12px; }
  .title-screen > .main-button { min-height: 44px; font-size: 15px; }
  .title-secondary-actions { margin-top: 10px; }
  .title-secondary-actions .text-button { margin-top: 0; padding-block: 4px; font-size: 12px; }
}

@media (max-height: 720px) and (orientation: portrait) {
  .title-screen { padding: 7px 10px 4px; }
  .title-art { height: 145px; margin-bottom: -5px; }
  .title-peso { width: clamp(100px, 34vw, 132px); max-height: 140px; }
  .mini-star { top: 0; width: 138px; height: 138px; border-width: 8px; }
  .title-logo { width: min(350px, 88vw); }
  .title-character-image { width: min(310px, 78vw); max-height: 112px; margin-block: -5px 1px; }
  .title-copy { margin: 7px 0 5px; font-size: 12px; line-height: 1.4; }
  .color-picker { margin-bottom: 7px; }
  .color-picker > p { margin: 3px 0 0; font-size: 11px; }
  .color-options { padding-top: 31px; }
  .color-character { bottom: 25px; width: 46px; height: 46px; }
  .color-button { min-height: 36px; padding-block: 3px; font-size: 12px; }
  .title-screen > .main-button { min-height: 44px; font-size: 15px; }
  .title-secondary-actions { margin-top: 10px; }
  .title-secondary-actions .text-button { margin-top: 0; padding-block: 4px; font-size: 12px; }
  .title-app-promo { width: min(300px, 84vw); margin-top: 7px; padding: 3px 5px 4px; }
  .title-app-promo-heading { margin-bottom: 3px; font-size: 9px; }
}

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