/* Labumen shared game styles. Every game page loads this file. */
:root {
  --sky: #FFF7EA;
  --card: #FFFFFF;
  --ink: #3B2A20;
  --muted: #7A6455;
  --line: #F0DFC8;
  --orange: #F28C28;
  --green: #3FA34D;
  --red: #E5483E;
  --blue: #2F8CF0;
  --gold: #FFC93C;
  --round: ui-rounded, "Arial Rounded MT Bold", "Nunito", system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--sky);
  color: var(--ink);
  font: 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-left: max(12px, env(safe-area-inset-left, 0px));
  padding-right: max(12px, env(safe-area-inset-right, 0px));
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
[hidden] { display: none !important; }

.lb-app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding-block: max(10px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-bottom, 0px));
}

/* Top bar */
.lb-bar { display: flex; align-items: center; gap: 8px; min-height: 52px; }
.lb-bar .lb-title { flex: 1; min-width: 0; font: 700 1.05rem/1.2 var(--round); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-icon {
  width: 44px; height: 44px; border-radius: 14px; border: 0;
  background: var(--card); box-shadow: 0 2px 0 var(--line);
  display: grid; place-items: center; font-size: 1.25rem; flex: none;
}
.lb-pill {
  border: 0; border-radius: 999px; padding: 0 14px; height: 44px;
  background: var(--card); box-shadow: 0 2px 0 var(--line);
  font: 700 0.95rem var(--round); flex: none;
}

/* Progress */
.lb-progress { display: flex; gap: 6px; justify-content: center; padding: 6px 0 2px; }
.lb-progress i { width: 26px; height: 8px; border-radius: 4px; background: var(--line); }
.lb-progress i.done { background: var(--green); }
.lb-progress i.now { background: var(--orange); }

/* Screens */
.lb-screen { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 14px; padding-top: 8px; text-align: center; }
.lb-mascot { width: 150px; height: auto; }
.lb-mascot.small { width: 84px; }
.lb-h1 { margin: 0; font: 800 1.7rem/1.15 var(--round); text-wrap: balance; }
.lb-sub { margin: 0; color: var(--muted); max-width: 34ch; }

.lb-levels { display: grid; gap: 10px; width: 100%; max-width: 360px; }
.lb-level {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border: 3px solid transparent; border-radius: 18px; padding: 14px 18px;
  background: var(--card); box-shadow: 0 3px 0 var(--line);
  font: 700 1.15rem var(--round); text-align: left;
}
.lb-level[aria-pressed="true"] { border-color: var(--orange); }
.lb-level small { display: block; font: 400 0.85rem system-ui, sans-serif; color: var(--muted); }
.lb-stars { color: var(--gold); letter-spacing: 2px; font-size: 1.1rem; white-space: nowrap; }
.lb-stars .off { color: var(--line); }

.lb-go {
  border: 0; border-radius: 999px; padding: 16px 40px; min-width: 220px;
  background: var(--orange); color: #fff; box-shadow: 0 5px 0 #C9661A;
  font: 800 1.3rem var(--round);
}
.lb-go:active { transform: translateY(3px); box-shadow: 0 2px 0 #C9661A; }
.lb-go.alt { background: var(--card); color: var(--ink); box-shadow: 0 5px 0 var(--line); }
a.lb-go { display: inline-block; text-decoration: none; text-align: center; box-sizing: border-box; }
.lb-go.share { background: var(--blue); box-shadow: 0 5px 0 #1C63B8; }
.lb-go.share:active { box-shadow: 0 2px 0 #1C63B8; }
.lb-feedback { color: var(--muted); font-size: 0.9rem; margin-top: 4px; }
.lb-row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }

/* Play area: games draw inside .lb-stage */
.lb-stage { flex: 1; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.lb-feedback { min-height: 1.6em; font: 700 1.1rem var(--round); color: var(--green); }
.lb-feedback.oops { color: var(--red); }
.lb-corner { position: fixed; right: max(10px, env(safe-area-inset-right, 0px)); bottom: max(10px, env(safe-area-inset-bottom, 0px)); width: 78px; pointer-events: none; }

/* End screen */
.lb-bigstars { font-size: 3.2rem; letter-spacing: 6px; color: var(--gold); line-height: 1; }
.lb-bigstars .off { color: var(--line); }
.lb-bigstars span { display: inline-block; animation: lb-pop .5s both; }
.lb-bigstars span:nth-child(2) { animation-delay: .25s; }
.lb-bigstars span:nth-child(3) { animation-delay: .5s; }
.lb-score { font: 700 1.1rem var(--round); color: var(--muted); }

/* Share panel */
.lb-share { display: grid; gap: 10px; width: 100%; max-width: 320px; }
.lb-share a, .lb-share button {
  display: block; text-decoration: none; text-align: center; border: 0; border-radius: 14px; padding: 12px;
  background: var(--card); box-shadow: 0 3px 0 var(--line); font: 700 1rem var(--round); color: var(--ink);
}
.lb-share .wa { background: #25D366; color: #fff; box-shadow: 0 3px 0 #1a9e4b; }

/* Motion */
@keyframes lb-pop { from { transform: scale(0); } 70% { transform: scale(1.25); } to { transform: scale(1); } }
@keyframes lb-shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-8px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(5px); } }
@keyframes lb-bounce { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-14px); } }
@keyframes lb-pulse { 0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(242, 140, 40, .6); } 50% { transform: scale(1.08); box-shadow: 0 0 0 10px rgba(242, 140, 40, 0); } }
.lb-shake { animation: lb-shake .45s; }
.lb-cheer { animation: lb-bounce .6s 2; }
.lb-hint { animation: lb-pulse 1s 3; }
@media (prefers-reduced-motion: reduce) {
  .lb-shake, .lb-cheer, .lb-hint, .lb-bigstars span { animation: none; }
}
