/* /match-three/ — Match 3, the Pocket Games candy campaign. The stage keeps
   the app's own candy-world palette (mint tray, pink chrome, purple board);
   the page frame, rank box and seo cards come from games.css. Shared by all locales. */

.m3-seo-lead { color: var(--text-muted); max-width: 760px; margin: 0 auto 1.35rem; text-align: center; line-height: 1.65; }
.m3-play { text-align: center; max-inline-size: 100%; min-inline-size: 0; }
.m3-card { padding: 0 !important; overflow: hidden; }
.m3-lb-cta { display: flex; justify-content: center; margin-block: var(--space-4, 1.5rem); }

/* ── stage: the app's game host ─────────────────────────────────── */
.m3-stage {
  --m3-ink: #663558;
  position: relative;
  display: flex; flex-direction: column; align-items: center;
  padding: 14px 14px 16px;
  min-block-size: 420px;
  color: var(--m3-ink);
  font-family: Nunito, 'Nunito Variable', var(--font-body), system-ui, sans-serif;
  background: radial-gradient(ellipse at 12% 6%, #fff5df 0, transparent 45%), radial-gradient(ellipse at 95% 86%, #95d8d0 0, transparent 48%), linear-gradient(155deg, #e3f7e7, #bcebe0 62%, #a6e0d6);
  border-radius: var(--radius-lg, 18px);
  isolation: isolate;
  overflow: hidden;
}
.m3-stage :where(b, strong, small) { color: inherit; font-weight: inherit; }
.m3-stage, .m3-stage * { -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
.m3-stage button { font: inherit; cursor: pointer; touch-action: manipulation; }
.m3-stage button:focus-visible { outline: 3px solid #744399; outline-offset: 3px; }
.m3-stage::before, .m3-stage::after { content: ''; position: absolute; z-index: -1; pointer-events: none; width: 160px; height: 160px; border: 18px solid #fff5e644; border-radius: 45%; transform: rotate(28deg); }
.m3-stage::before { left: -115px; top: 12%; }
.m3-stage::after { right: -105px; bottom: 6%; border-radius: 50%; border-color: #d0f3db77; width: 200px; height: 200px; }
.m3-lobby, .m3-game { inline-size: 100%; display: flex; flex-direction: column; align-items: center; }
.m3-lobby[hidden], .m3-game[hidden] { display: none; }

/* ── start card (StartScreen) ──────────────────────────────────── */
.m3-start-card { inline-size: min(100%, 400px); display: grid; gap: 14px; padding: 22px; border-radius: 28px; background: linear-gradient(145deg, #fffcf1, #ffedf0); border: 1px solid #dfc0cb; box-shadow: 0 4px 0 #d9b5c5, inset 0 3px 0 #fff, 0 16px 32px #476a5e30; }
.m3-candy-mark { display: flex; align-items: flex-end; justify-content: center; height: 86px; }
.m3-candy-mark .m3-candy-icon { width: 72px; height: 72px; margin: 0 -8px; transform: rotate(-14deg); }
.m3-candy-mark .m3-candy-icon:nth-child(2) { width: 92px; height: 92px; transform: none; z-index: 1; }
.m3-candy-mark .m3-candy-icon:last-child { transform: rotate(14deg); }
.m3-start-title { margin: 0; font-size: 31px; line-height: 1.1; font-weight: 900; color: #9f487a; letter-spacing: -.025em; font-family: inherit; text-transform: none; }
.m3-start-sub { margin: -8px 0 0; font-size: 13px; font-weight: 800; color: #7d4b6c; }
.m3-chapter { display: flex; justify-content: space-between; gap: 10px; align-items: center; color: #735074; }
.m3-chapter strong { font-size: 13px; text-align: start; }
.m3-chapter span { font-size: 10px; font-weight: 900; background: #efdde6; padding: 4px 8px; border-radius: 8px; flex: none; }
.m3-preview { display: flex; align-items: center; gap: 9px; padding: 10px; border-radius: 17px; background: #f2e0e6; border: 1px solid #e4c7d5; box-shadow: inset 0 2px 3px #ad86a414; }
.m3-shape { flex: none; display: grid; grid-template-columns: repeat(8, 8px); grid-auto-rows: 8px; gap: 1px; padding: 5px; background: #71547f; border-radius: 9px; }
.m3-shape i { display: block; border-radius: 2px; background: #a589b4; }
.m3-shape i.hole { background: transparent; }
.m3-shape i.chain { background: #ef9abb; }
.m3-shape i.crate { background: #fff0cf; }
.m3-shape i.jelly { background: #f3a0d2; box-shadow: inset 0 0 0 1px #ffe1f3; }
.m3-preview-body { flex: 1; min-width: 0; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 8px; }
.m3-preview-label { font-size: 11px; font-weight: 900; color: #81516e; text-align: start; }
.m3-preview-goals { grid-row: 1 / 3; grid-column: 2; display: flex; justify-content: flex-end; gap: 6px; }
.m3-preview-moves { font-size: 12px; font-weight: 900; color: #754b6c; text-align: start; }
.m3-lesson { margin: 0; text-align: start; font-size: 11px; line-height: 1.4; font-weight: 800; color: #7c5779; padding: 9px 11px; border-radius: 12px; background: #fff7e6; border: 1px solid #e3ccd0; }
.m3-lesson[hidden] { display: none; }
.m3-lesson.live { inline-size: 100%; max-inline-size: 580px; margin: 5px 0 0; font-size: 10px; padding: 6px 10px; }
.m3-journey { display: grid; gap: 9px; }
.m3-journey-nav { display: flex; align-items: center; justify-content: space-between; }
.m3-journey-nav span { font-size: 11px; color: #7b4e6d; font-weight: 900; }
.m3-journey-nav button { width: 36px; height: 32px; border: 0; border-radius: 11px; background: #f8cadd; color: #954478; font-size: 24px; line-height: 1; }
.m3-journey-nav button:disabled { opacity: .3; cursor: default; }
.m3-levels { display: grid; grid-template-columns: repeat(6, 1fr); gap: 7px; }
.m3-levels button { min-height: 46px; min-width: 0; padding: 2px; border-radius: 14px; border: 0; background: linear-gradient(#ffeff5, #f8c9df); color: #8d4a72; box-shadow: inset 0 1px 0 #fff8f7, 0 2px 4px #ac62872b; }
.m3-levels button.current { background: linear-gradient(#ec83b7, #ca4189); color: #fffaf4; box-shadow: inset 0 1px 0 #ffbedc, 0 3px 7px #ae467940; }
.m3-levels button:disabled { opacity: .38; box-shadow: none; cursor: default; }
.m3-levels b { display: block; font-size: 15px; }
.m3-levels small { display: block; height: 10px; font-size: 8px; color: #915320; line-height: 10px; }
.m3-levels .current small { color: #ffe6a8; }
.m3-start-btn, .m3-btn { display: inline-flex; align-items: center; justify-content: center; gap: .5em; min-height: 48px; padding: 10px 22px; border: 0; border-radius: 18px; font-size: 17px; font-weight: 900; background: linear-gradient(#ef77b0, #cf4187); color: #fffaf5; box-shadow: inset 0 2px 0 #ffafd3, 0 5px 10px #a6427140; }
.m3-btn.ghost { background: linear-gradient(#ffeaf2, #ffd7e8); color: #813d66; box-shadow: inset 0 2px 0 #fff9f5, 0 3px 7px #b766932b; }
.m3-start-btn:active, .m3-btn:active { transform: scale(.97); }

/* ── HUD ──────────────────────────────────────────────────────── */
.m3-topline, .m3-hud { inline-size: 100%; max-inline-size: 580px; flex: none; }
.m3-topline { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: #644777; font-size: 12px; font-weight: 900; padding: 0 6px 7px; }
.m3-topline > span:first-child { display: flex; align-items: center; gap: 7px; }
.m3-topline > span:last-child { text-align: end; font-size: 11px; opacity: .85; }
.m3-hard { padding: 3px 6px; border-radius: 7px; background: #f1bfca; color: #803b63; font-size: 8px; }
.m3-hud { display: flex; align-items: stretch; gap: 8px; padding: 7px; border-radius: 22px; border: 1px solid #e2bccb; background: linear-gradient(150deg, #fff3e7, #f6d6de); box-shadow: 0 3px 0 #d6a7bf, inset 0 2px 0 #fffaf4, 0 7px 14px #5e776026; }
.m3-moves { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 64px; flex: none; padding: 4px 3px; color: #a74978; }
.m3-moves strong { font-size: 34px; line-height: 1; font-weight: 900; font-variant-numeric: tabular-nums; text-shadow: 0 2px 0 #fff6f7; }
.m3-moves span { font-size: 10px; font-weight: 900; margin-top: 4px; color: #874565; }
.m3-moves.low strong { color: #af2e54; }
.m3-goals { flex: 1; min-width: 0; display: flex; gap: 7px; align-items: center; justify-content: space-evenly; background: #fffaf0; border-radius: 16px; padding: 4px 8px; box-shadow: inset 0 2px 4px #86587322, 0 1px 0 #fff; }
.m3-goal { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; min-width: 30px; font-size: 17px; font-weight: 900; color: #684575; }
.m3-candy-icon, .m3-goal-svg { width: 35px; height: 35px; overflow: visible; display: block; flex: none; filter: drop-shadow(0 2px 1px #6f39772b); }
.m3-goal.score b { font-size: 14px; }
.m3-goal b { line-height: 1.1; min-width: 24px; text-align: center; font-variant-numeric: tabular-nums; animation: m3-collect 200ms cubic-bezier(.23, 1, .32, 1); }
.m3-goal.done b { color: #337b61; }
.m3-goal.done .m3-candy-icon { opacity: .6; }
@keyframes m3-collect { 0% { transform: scale(1.12); color: #ba4c88; } 100% { transform: scale(1); } }

/* ── board ────────────────────────────────────────────────────── */
.m3-area { inline-size: 100%; max-inline-size: 580px; flex: none; margin: 10px 0 6px; height: 420px; }
.m3-wrap { position: relative; inline-size: 100%; block-size: 100%; touch-action: none; }
.m3-wrap canvas { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; touch-action: none; outline: none; }
.m3-wrap.is-shake { animation: m3-shake 260ms ease-out; }
@keyframes m3-shake { 20% { transform: translate(-4px, 2px); } 40% { transform: translate(4px, -2px); } 60% { transform: translate(-3px, 1px); } 80% { transform: translate(2px, 0); } }
.m3-praise { position: absolute; inset-inline: 0; top: 38%; display: grid; justify-items: center; pointer-events: none; opacity: 0; transform: scale(.8); }
.m3-praise.is-on { animation: m3-praise 1100ms cubic-bezier(.23, 1, .32, 1) forwards; }
.m3-praise strong { font-size: clamp(26px, 7vw, 40px); font-weight: 900; color: #fff9dc; -webkit-text-stroke: 2px #bb397d; paint-order: stroke fill; text-shadow: 0 3px 4px #aa3b786b, 0 8px 20px #306f8d40; letter-spacing: -.02em; }
.m3-praise small { font-size: 14px; font-weight: 900; color: #fff9dc; text-shadow: 0 2px 3px #8d396c; }
@keyframes m3-praise { 0% { opacity: 0; transform: scale(.7); } 18% { opacity: 1; transform: scale(1.06); } 30% { transform: scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: translateY(-14px); } }
.m3-toast { position: absolute; top: 8px; left: 50%; max-inline-size: calc(100% - 24px); transform: translate(-50%, -8px); padding: 7px 13px; border-radius: 14px; background: #fff6e8; color: #6b3d5d; font-size: 12px; font-weight: 800; box-shadow: 0 4px 12px #43829b40; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.m3-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ── bottom bar (levels / score / restart) ────────────────────── */
.m3-bar { inline-size: 100%; max-inline-size: 580px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.m3-tool { inline-size: 44px; block-size: 44px; border-radius: 50%; border: 0; color: #765078; background: #fff6e8; box-shadow: 0 3px 0 #dfc9ca, 0 6px 12px #526e6022, inset 0 2px 0 #fff; font-size: 16px; }
.m3-score { display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 14px; border-radius: 14px; background: #fff0d3; border: 1px solid #e3cdaa; color: #97622e; font-weight: 900; }
.m3-score small { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.m3-score b { font-size: 18px; font-variant-numeric: tabular-nums; }

/* ── standalone overlay (pause / result) ──────────────────────── */
.m3-overlay { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; padding: 16px; background: #3567799e; backdrop-filter: blur(4px); }
.m3-overlay[hidden] { display: none; }
.m3-sheet { inline-size: min(100%, 340px); display: grid; gap: 10px; justify-items: center; padding: 22px; border-radius: 26px; background: #fff4e8; box-shadow: 0 12px 36px #427b9459; }
.m3-sheet h2 { margin: 0; font-family: inherit; text-transform: none; line-height: 1.1; font-size: 28px; font-weight: 900; color: #633654; letter-spacing: -.025em; }
.m3-kicker { margin: 0; font-size: 12px; font-weight: 900; color: #784f70; text-transform: uppercase; letter-spacing: .06em; }
.m3-stars { margin: 0; font-size: 34px; line-height: 1; letter-spacing: 4px; color: #e6d3c4; }
.m3-stars .on { color: #ffc53d; text-shadow: 0 2px 0 #d28a27; }
.m3-result { margin: 0; font-weight: 800; color: #724e65; }
.m3-sheet-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 4px; }

/* ── play layer ───────────────────────────────────────────────── */
html.play-open .m3-play { inline-size: min(760px, calc(100vw - 2 * var(--gutter, 16px))) !important; }
html.play-open .m3-card { border: 0 !important; background: none !important; box-shadow: none !important; }
html.play-open .m3-card::before, html.play-open .m3-card::after { display: none !important; }
html.play-open .m3-stage { min-block-size: 0; padding: 10px; }
html.play-open .m3-bar { display: none; }

@media (max-width: 420px) {
  .m3-stage { padding: 10px 8px 12px; }
  .m3-hud { gap: 4px; padding: 6px; }
  .m3-moves { width: 53px; }
  .m3-moves strong { font-size: 30px; }
  .m3-candy-icon, .m3-goal-svg { width: 30px; height: 30px; }
  .m3-start-card { padding: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  .m3-goal b, .m3-wrap.is-shake { animation: none; }
  .m3-praise.is-on { animation: m3-praise-calm 1100ms linear forwards; }
  .m3-toast { transition: none; }
}
@keyframes m3-praise-calm { 0%, 80% { opacity: 1; transform: none; } 100% { opacity: 0; transform: none; } }
