/* Skiliograph Word Train v1.0.0 */
/* Skiliograph game core styles — matched to Math Flash Cards (scoped to .skg) */
.skg {
  --skg-ink: #2b2d42; --skg-soft: #5c5f78; --skg-card: #ffffff; --skg-bg: #fff7e6;
  --skg-sun: #ffcf4a; --skg-sun-deep: #e8a917;
  --skg-sky: #a9dcff; --skg-sky-deep: #7cbfee;
  --skg-lilac: #dccbff; --skg-lilac-deep: #b49ef0;
  --skg-peach: #ffd3a8; --skg-peach-deep: #f0ae70;
  --skg-right: #8fe3a5; --skg-right-deep: #5cc27b;
  --skg-cream: #fdeec8; --skg-line: #e8dcc4;
  --skg-level: #e8a917; --skg-level-soft: #fff1a8;
  max-width: 520px; margin: 24px auto; padding: 20px 16px 24px;
  background: var(--skg-bg); border-radius: 24px; text-align: center;
  font-family: "Baloo 2", "Comic Sans MS", "Trebuchet MS", system-ui, sans-serif;
  color: var(--skg-ink); box-sizing: border-box; -webkit-tap-highlight-color: transparent;
}
.skg *, .skg *::before, .skg *::after { box-sizing: border-box; }
.skg [hidden] { display: none !important; }
.skg button { font-family: inherit; color: inherit; cursor: pointer; margin: 0; line-height: 1.2; text-transform: none; letter-spacing: normal; -webkit-tap-highlight-color: transparent; }
.skg button:focus-visible { outline: 4px solid var(--skg-ink); outline-offset: 3px; }
.skg p { margin: 0; }
.skg .skg-title { margin: 0 0 8px; font-family: inherit; font-size: 28px; font-weight: 800; line-height: 1.2; color: var(--skg-ink); }

/* ---------- menu ---------- */
.skg .skg-lead { margin: 0 0 14px; font-size: 18px; font-weight: 600; color: var(--skg-soft); }
.skg-levels { display: grid; gap: 12px; margin-bottom: 18px; }
.skg .skg-level {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; text-align: left;
  background: var(--s); border: 3px solid transparent; border-radius: 18px; color: var(--skg-ink);
  box-shadow: 0 4px 0 rgba(43, 45, 66, .12); transition: transform .1s, border-color .15s;
}
.skg .skg-level:hover { transform: translateY(-2px); }
.skg .skg-level[aria-pressed="true"] { border-color: var(--skg-ink); }
.skg-level-icon { flex: 0 0 64px; font-size: 22px; line-height: 1; letter-spacing: -2px; color: #ffb703; text-shadow: 0 2px 0 #d99500; text-align: center; }
.skg-level-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.skg-level-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.skg-level-name { font-size: 22px; font-weight: 800; line-height: 1.15; }
.skg-level-ages { font-size: 13px; font-weight: 700; letter-spacing: .03em; padding: 1px 8px; border-radius: 999px; background: rgba(255, 255, 255, .75); }
.skg-level-count { flex: 0 0 auto; margin-left: auto; align-self: flex-start; font-size: 15px; font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.skg-level-blurb { font-size: 15px; font-weight: 600; line-height: 1.3; color: var(--skg-soft); }

.skg .skg-ops-label { margin: 0 0 8px; font-size: 16px; font-weight: 700; color: var(--skg-soft); }
.skg-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 18px; }
.skg .skg-chip {
  padding: 8px 14px; font-size: 17px; font-weight: 800; color: var(--skg-soft);
  background: #fff; border: 2px dashed #cfc4ad; border-radius: 999px; transition: background .15s, transform .1s;
}
.skg .skg-chip[aria-pressed="true"] { color: var(--skg-ink); border: 2px solid var(--skg-ink); background: var(--skg-level-soft); }
.skg .skg-chip:active { transform: scale(.95); }
.skg .skg-chip.is-nudge { animation: skg-shake .35s ease; }
.skg-chips--4 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 440px; margin-left: auto; margin-right: auto; }
.skg .skg-chips--4 .skg-chip { width: 100%; padding: 8px 8px; display: flex; align-items: center; justify-content: center; gap: 5px; border-radius: 22px; }
.skg-chips--2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 440px; margin-left: auto; margin-right: auto; }
.skg .skg-chips--2 .skg-chip { width: 100%; padding: 8px 8px; display: flex; align-items: center; justify-content: center; gap: 5px; border-radius: 22px; }
.skg-chips--3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 470px; margin-left: auto; margin-right: auto; }
.skg .skg-chips--3 .skg-chip { width: 100%; padding: 8px 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; border-radius: 18px; line-height: 1.15; }
@media (max-width: 400px) { .skg .skg-chips--3 .skg-chip { font-size: 15px; } }
@media (max-width: 400px) { .skg .skg-chips--4 .skg-chip, .skg .skg-chips--2 .skg-chip { font-size: 15px; } }
@media (max-width: 360px) { .skg .skg-chips--4 .skg-chip { font-size: 14px; padding: 7px 5px; gap: 3px; } }

.skg .skg-big {
  display: block; width: 100%; padding: 16px 20px; font-size: 26px; font-weight: 800; color: var(--skg-ink);
  background: var(--skg-sun); border: none; border-radius: 18px; box-shadow: 0 6px 0 var(--skg-sun-deep);
  transition: transform .1s, box-shadow .1s;
}
.skg .skg-big:hover { transform: translateY(-2px); }
.skg .skg-big:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--skg-sun-deep); }
.skg-reset { margin-top: 10px; font-size: 14px; }
.skg .skg-link { margin-top: 14px; padding: 8px 16px; background: none; border: none; font-size: 18px; font-weight: 700; color: var(--skg-ink); text-decoration: underline; text-underline-offset: 4px; }
.skg .skg-reset .skg-link { margin-top: 0; font-size: 14px; color: var(--skg-soft); }
.skg-reset-ask { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 10px; }
.skg-reset-q { font-weight: 700; }
.skg .skg-reset-yes { padding: 6px 14px; font-size: 14px; font-weight: 800; color: #fff; background: #c4495a; border: none; border-radius: 999px; }

/* ---------- play ---------- */
.skg-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.skg .skg-back { padding: 6px 14px; font-size: 16px; font-weight: 700; color: var(--skg-ink); background: #fff; border: 2px solid var(--skg-ink); border-radius: 999px; }
.skg .skg-back:active { transform: scale(.95); }
.skg-tag { font-size: 16px; font-weight: 800; padding: 5px 14px; border-radius: 999px; background: var(--skg-level-soft); }
.skg-stars { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; font-size: 34px; line-height: 1.1; margin-bottom: 12px; user-select: none; }
.skg-stars--many { font-size: 26px; gap: 3px; }
.skg-star { color: #ddd3bf; transition: color .2s, transform .25s; display: inline-block; }
.skg-star.is-on { color: #ffb703; transform: scale(1.15); text-shadow: 0 2px 0 #e09400; }

.skg-prompt {
  background: var(--skg-card); border-radius: 20px; padding: 22px 12px; margin: 0 auto 18px;
  box-shadow: 0 6px 0 var(--skg-line), 0 10px 24px rgba(0, 0, 0, .08);
  font-size: 20px; font-weight: 800; line-height: 1.25;
}
.skg-prompt.is-new { animation: skg-flip .45s ease; }
.skg-prompt.is-shake { animation: skg-shake .4s ease; }
.skg .skg-q { margin: 8px 0 0; font-size: 20px; font-weight: 800; line-height: 1.25; }
.skg-big-q { font-size: clamp(32px, 10vw, 56px); font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }

.skg-choices { display: grid; grid-template-columns: 1fr; gap: 12px; }
.skg-choices--row { grid-template-columns: repeat(3, 1fr); }
.skg .skg-choice {
  font-size: clamp(22px, 7vw, 32px); font-weight: 800; color: var(--skg-ink); padding: 14px 6px; min-height: 64px;
  border: none; border-radius: 18px; font-variant-numeric: tabular-nums; transition: transform .1s, box-shadow .1s, opacity .2s;
}
.skg .skg-c0 { background: var(--skg-sky); box-shadow: 0 5px 0 var(--skg-sky-deep); }
.skg .skg-c1 { background: var(--skg-lilac); box-shadow: 0 5px 0 var(--skg-lilac-deep); }
.skg .skg-c2 { background: var(--skg-peach); box-shadow: 0 5px 0 var(--skg-peach-deep); }
.skg .skg-choice:hover { transform: translateY(-2px); }
.skg .skg-choice:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(43, 45, 66, .15); }
.skg .skg-choice.is-correct { background: var(--skg-right); box-shadow: 0 5px 0 var(--skg-right-deep); animation: skg-pop .4s ease; }
.skg .skg-choice.is-wrong, .skg .skg-choice:disabled { background: #ece6da; box-shadow: 0 5px 0 #d8d0c0; color: #a29b8c; cursor: default; transform: none; }
.skg .skg-choice.is-correct:disabled { background: var(--skg-right); color: var(--skg-ink); box-shadow: 0 5px 0 var(--skg-right-deep); }
.skg .skg-choice.is-wrong svg, .skg .skg-choice.is-wrong .skg-pic { opacity: .45; filter: grayscale(1); }
.skg .skg-msg { min-height: 1.6em; margin-top: 16px; font-size: 22px; font-weight: 700; line-height: 1.3; }

/* ---------- done ---------- */
.skg-done { padding: 10px 0 4px; }
.skg-done-star { font-size: 96px; line-height: 1; color: #ffb703; text-shadow: 0 5px 0 #d99500; animation: skg-bob 2.4s ease-in-out infinite; }
.skg .skg-done-title { margin: 8px 0 0; font-size: 34px; font-weight: 800; line-height: 1.15; }
.skg .skg-done-text { margin: 4px 0 20px; font-size: 18px; font-weight: 600; color: var(--skg-soft); }
.skg .skg-total { margin: 8px 0 0; font-size: 15px; color: var(--skg-soft); }

/* ---------- celebration overlay ---------- */
.skg-party { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 99999; transition: opacity .7s ease; }
.skg-party.is-leaving { opacity: 0; }
.skg-confetti { position: absolute; inset: 0; }
.skg-banner {
  position: absolute; top: 36%; left: 50%; transform: translate(-50%, -50%); background: #fff; color: #2b2d42;
  padding: 14px 28px; border-radius: 999px; font: 800 clamp(22px, 6vw, 34px)/1.2 "Baloo 2", "Comic Sans MS", system-ui, sans-serif;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .15); white-space: nowrap; animation: skg-banner-in .8s cubic-bezier(.2, .9, .3, 1.2) .15s both;
}
.skg-balloon { position: absolute; bottom: -150px; animation-name: skg-rise; animation-timing-function: cubic-bezier(.35, .1, .6, 1); animation-fill-mode: both; }
.skg-balloon-body { position: relative; width: 56px; height: 70px; background: var(--c); border-radius: 50% 50% 46% 46%; box-shadow: inset -8px -10px 0 rgba(0, 0, 0, .1); animation: skg-sway 2s ease-in-out infinite alternate; transform-origin: 50% 140%; }
.skg-balloon-body::before { content: ""; position: absolute; top: 12px; left: 13px; width: 10px; height: 16px; background: rgba(255, 255, 255, .6); border-radius: 50%; }
.skg-balloon-body::after { content: ""; position: absolute; top: 70px; left: 27px; width: 2px; height: 60px; background: rgba(0, 0, 0, .25); }

@keyframes skg-flip { 0% { transform: rotateY(90deg); } 100% { transform: rotateY(0); } }
@keyframes skg-shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-10px); } 75% { transform: translateX(10px); } }
@keyframes skg-pop { 50% { transform: scale(1.12); } }
@keyframes skg-bob { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-8px) rotate(4deg); } }
@keyframes skg-rise { 0% { transform: translateY(0); opacity: 0; } 8% { opacity: 1; } 100% { transform: translateY(calc(-100vh - 260px)); opacity: 1; } }
@keyframes skg-sway { from { transform: rotate(-7deg) translateX(-6px); } to { transform: rotate(7deg) translateX(6px); } }
@keyframes skg-banner-in { from { transform: translate(-50%, -40%) scale(.85); opacity: 0; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .skg-prompt.is-new, .skg-prompt.is-shake, .skg .skg-choice.is-correct, .skg-done-star, .skg .skg-chip.is-nudge { animation: none; }
  .skg-banner { animation-duration: .01s; }
}
@media (max-width: 380px) {
  .skg-choices { gap: 8px; }
  .skg-prompt { padding: 18px 8px; }
  .skg .skg-level { gap: 10px; padding: 12px; }
  .skg-level-icon { flex-basis: 44px; font-size: 16px; }
  .skg .skg-chip { padding: 7px 11px; font-size: 15px; }
}
/* Word Train */
.skw-clue { font-size: 60px; line-height: 1.05; }
.skw { margin-top: -4px; }
.skw-track { overflow: hidden; padding: 4px 0 10px; margin: 0 -8px; }
.skw-train { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: center; gap: 12px 6px; padding: 0 8px; transition: transform 1.2s cubic-bezier(.5, 0, .9, .4); }
.skw-train.is-going { transform: translateX(-130%); }
.skw-train.is-shake { animation: skg-shake .4s ease; }
.skw-engine { width: 68px; height: 50px; flex: 0 0 auto; }
.skg .skw-car {
  position: relative; min-width: 58px; height: 46px; padding: 0 10px; margin-bottom: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff; border: 2.5px dashed #cfc4ad; border-radius: 10px; font-size: 20px; font-weight: 800; color: var(--skg-ink);
}
.skg .skw-car::before, .skg .skw-car::after { content: ""; position: absolute; bottom: -9px; width: 13px; height: 13px; border-radius: 50%; background: #fff; border: 2.5px solid #2b2d42; }
.skg .skw-car::before { left: 8px; } .skg .skw-car::after { right: 8px; }
.skg .skw-car.is-full { background: var(--skg-sky); border: 2.5px solid #2b2d42; }
.skg .skw-caboose { background: var(--skg-sun); border: 2.5px solid #2b2d42; min-width: 40px; font-size: 26px; cursor: default; }
.skw.is-right .skw-car.is-full { background: var(--skg-right); }
.skw-tray { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 12px; min-height: 52px; }
.skg .skw-tile {
  padding: 8px 14px; font-size: 21px; font-weight: 800; color: var(--skg-ink); background: var(--skg-peach);
  border: none; border-radius: 14px; box-shadow: 0 4px 0 var(--skg-peach-deep); transition: transform .1s;
}
.skg .skw-tile:nth-child(3n+2) { background: var(--skg-lilac); box-shadow: 0 4px 0 var(--skg-lilac-deep); }
.skg .skw-tile:nth-child(3n) { background: var(--skg-sky); box-shadow: 0 4px 0 var(--skg-sky-deep); }
.skg .skw-tile:active { transform: translateY(3px); box-shadow: none; }
.skg .skw-hint { margin-top: 14px; padding: 6px 16px; font-size: 16px; font-weight: 800; color: var(--skg-ink); background: #fff; border: 2px solid var(--skg-ink); border-radius: 999px; }
@keyframes skw-puff { 0% { transform: translateY(0); opacity: .9; } 100% { transform: translateY(-6px) scale(1.6); opacity: 0; } }
.skw-puff { animation: skw-puff 1.2s ease-out infinite; transform-box: fill-box; transform-origin: center; }
@media (max-width: 380px) { .skg .skw-car { min-width: 48px; font-size: 18px; padding: 0 7px; } .skg .skw-tile { font-size: 19px; padding: 7px 11px; } }
@media (prefers-reduced-motion: reduce) { .skw-train { transition: none; } .skw-train.is-going { transform: none; } .skw-puff { animation: none; } }
