/* Zatoona Kids - "Python with Zeto" 🫒  (light, playful, phone first) */
.kp {
  --bg: #FFF8EC; --ink: #3A3355; --soft: #7A7398; --card: #FFFFFF; --line: #EFE4CF;
  --green: #5CC46A; --green-d: #3E9E4B; --yellow: #FFE08A; --cream: #FFFDF5;
  --pink: #FFE1EC; --blue: #E2EEFF; --mint: #DDF7E7; --lilac: #EEE7FF; --peach: #FFEBD9;
  --mono: "Cascadia Code", Consolas, "Courier New", monospace, "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji";
  font-family: "Segoe UI", Tahoma, "Noto Sans Arabic", "Noto Sans", system-ui, sans-serif, "Segoe UI Emoji", "Apple Color Emoji";
  color: var(--ink); background: var(--bg);
  max-width: 820px; margin: 0 auto; padding: 14px; border-radius: 26px;
  font-size: 16px; line-height: 1.5; position: relative; overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}
.kp *, .kp *::before, .kp *::after { box-sizing: border-box; }
:where(.kp) button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.kp h2, .kp h3, .kp p { margin: 0; }
.kp .kp-hidden { display: none; }

/* ---- Zeto */
.kp-zeto { display: block; flex: none; }
.kp-z-xs { width: 38px; height: 38px; }
.kp-z-sm { width: 34px; height: 34px; }
.kp-z-md { width: 60px; height: 60px; }
.kp-z-big { width: 92px; height: 92px; }
.kp-bob { animation: kp-bob 2.6s ease-in-out infinite; }
.kp-jump { animation: kp-jump .7s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes kp-bob { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-6px) rotate(3deg); } }
@keyframes kp-jump { 0% { transform: scale(.3) translateY(30px); } 100% { transform: scale(1) translateY(0); } }

/* ---- top bar */
.kp-top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.kp-brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 20px; flex: 1; min-width: 0; }
.kp-total, .kp-where { background: #FFF; border: 2px solid var(--line); border-radius: 999px; padding: 6px 14px; font-weight: 700; white-space: nowrap; }
.kp-where { flex: 1; text-align: center; overflow: hidden; text-overflow: ellipsis; }
.kp-icon { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--line); background: #FFF; font-size: 20px; flex: none; }
.kp-btn { background: #FFF; border: 2px solid var(--line); border-radius: 999px; padding: 8px 16px; font-weight: 700; min-height: 44px; box-shadow: 0 3px 0 var(--line); }
.kp-btn:active, .kp-icon:active { transform: translateY(2px); box-shadow: none; }
.kp-back { flex: none; }

/* ---- map */
.kp-hero { display: flex; align-items: center; gap: 14px; margin: 4px 0 16px; }
.kp-say { position: relative; background: #FFF; border: 2px solid var(--yellow); border-radius: 20px; padding: 12px 16px; font-size: 17px; font-weight: 600; flex: 1; }
.kp-world { border-radius: 24px; padding: 14px; margin-bottom: 14px; border: 2px solid rgba(58, 51, 85, .07); }
.kp-w1 { background: #FFF1C9; } .kp-w2 { background: #E9E1FF; } .kp-w3 { background: #DDF7E7; } .kp-w4 { background: #E2EEFF; } .kp-w5 { background: #FFE1EC; }
.kp-whead { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.kp-wemoji { font-size: 34px; width: 54px; height: 54px; display: grid; place-items: center; background: rgba(255, 255, 255, .75); border-radius: 18px; flex: none; }
.kp-whead h3 { font-size: 19px; }
.kp-whead small { color: var(--soft); font-weight: 600; }
.kp-lvls { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.kp-lvl { position: relative; aspect-ratio: 1 / 1; min-height: 58px; border: 0; border-radius: 20px; background: #FFF; box-shadow: 0 5px 0 rgba(58, 51, 85, .13); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 4px; transition: transform .12s; }
.kp-lvl:hover { transform: translateY(-2px); }
.kp-lvl:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(58, 51, 85, .13); }
.kp-lnum { font-size: 24px; font-weight: 800; line-height: 1.1; }
.kp-lstars { font-size: 13px; color: #F2A900; letter-spacing: 1px; line-height: 1; min-height: 13px; }
.kp-ltype { position: absolute; top: 3px; inset-inline-end: 5px; font-size: 13px; }
.kp-done { background: #FFFBEA; }
.kp-now { outline: 3px solid var(--green); animation: kp-glow 1.6s ease-in-out infinite; }
.kp-locked { background: rgba(255, 255, 255, .55); box-shadow: none; color: #9a93b3; }
.kp-locked .kp-ltype { opacity: .4; }
@keyframes kp-glow { 50% { outline-color: #B8EBBE; } }

/* ---- cards */
.kp-card { background: var(--card); border-radius: 22px; padding: 14px; margin-bottom: 12px; border: 2px solid var(--line); position: relative; }
.kp-chead { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 10px; font-weight: 800; margin-bottom: 10px; }
.kp-chead small { color: var(--soft); font-weight: 600; font-size: 13px; }

.kp-mission { display: flex; gap: 12px; align-items: flex-start; background: #FFFBEA; border-color: var(--yellow); flex-wrap: wrap; }
.kp-zbtn { border: 0; background: none; padding: 0; flex: none; }
.kp-mtext { flex: 1; min-width: 0; }
.kp-mtext h2 { font-size: 21px; margin: 4px 0; }
.kp-mtext p { font-size: 16.5px; }
.kp-tag { display: inline-block; background: #FFF; border-radius: 999px; padding: 2px 10px; font-size: 13px; font-weight: 700; color: var(--soft); border: 1.5px solid var(--yellow); }
.kp-hint { margin-top: 8px; border: 0; background: #FFF; border-radius: 999px; padding: 6px 14px; font-weight: 700; font-size: 14px; box-shadow: 0 2px 0 var(--yellow); min-height: 36px; }

.kp-goalcard { background: #F4FFF7; border-color: #BDEBCB; }

/* mini screens (goal + choices) */
.kp-mini { background: #FFF; border: 2px dashed #CFE9D7; border-radius: 14px; padding: 6px 8px; font-family: var(--mono); font-size: 15px; text-align: left; overflow-x: auto; }
.kp-mline { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 2px 4px; border-radius: 8px; white-space: pre; min-height: 26px; font-family: var(--mono); }
button.kp-mline:hover { background: #EAFBF0; }

/* ---- code */
.kp-codecard { background: var(--cream); border-color: #E7DDF8; }
.kp-code { font-family: var(--mono); font-size: 17px; line-height: 1.45; text-align: left; overflow-x: auto; padding-bottom: 2px; }
.kp-line { display: flex; align-items: stretch; border-radius: 12px; transition: background .2s; }
.kp-gut { flex: none; align-self: center; min-height: 34px; width: 34px; border: 0; background: none; color: #B4ACCB; font-family: var(--mono); font-size: 13px; border-radius: 10px; }
.kp-gut:hover { background: var(--lilac); color: var(--ink); }
.kp-src { white-space: pre; padding: 3px 4px; min-height: 40px; display: block; line-height: 34px; }
.kp-tok { border: 0; background: none; font-family: var(--mono); font-size: inherit; padding: 4px 1px; margin: 0; border-radius: 7px; white-space: pre; line-height: 1.3; min-height: 34px; }
.kp-tok:hover { background: #FFF1B8; }
.kp-tok.kp-sel { background: #FFE58F; box-shadow: 0 0 0 2px #F5C542; }
.kp-kw { color: #9B3BD6; font-weight: 700; }
.kp-fn { color: #2F6BDB; font-weight: 700; }
.kp-str { color: #23944A; }
.kp-num { color: #E0700B; font-weight: 700; }
.kp-op { color: #D6336C; font-weight: 700; padding-left: 3px; padding-right: 3px; }
.kp-vname { color: #3A3355; }
.kp-cmt { color: #9C96AE; font-style: italic; }
.kp-bad { color: #C2410C; text-decoration: wavy underline; }
.kp-ind { background-image: linear-gradient(90deg, #DCD2F7 2px, transparent 2px); background-repeat: repeat-y; background-size: 2.4em 100%; background-position: 3px 0; color: transparent; }
.kp-blank { color: #2F7FD8; background: #E6F2FF; box-shadow: inset 0 0 0 2px #7DB7F0; padding: 4px 6px; animation: kp-wiggle 1.4s ease-in-out infinite; }
.kp-slot { background: #E6F2FF; box-shadow: inset 0 0 0 2px #7DB7F0; }
.kp-pop { animation: kp-pop .45s ease; }
.kp-line.kp-cur { background: #FFF0B3; box-shadow: inset 4px 0 0 #F5B700; }
.kp-line.kp-errline { background: #FFE3E3; box-shadow: inset 4px 0 0 #FF8A8A; }
.kp-line.kp-flash { animation: kp-flash 1.2s ease; }
@keyframes kp-pop { 40% { transform: scale(1.25); } }
@keyframes kp-wiggle { 50% { transform: translateY(-2px); } }
@keyframes kp-flash { 0%, 60% { background: #D9F5FF; } 100% { background: transparent; } }

/* ---- tray: choices, chips, stepper */
.kp-tray { background: #FBF8FF; border-color: #E7DDF8; }
.kp-tray:empty { display: none; }
.kp-choices { display: grid; gap: 10px; }
.kp-choice { display: flex; align-items: center; gap: 10px; border: 2px solid #E3DAF5; background: #FFF; border-radius: 18px; padding: 8px; text-align: start; box-shadow: 0 4px 0 #E3DAF5; transition: transform .12s; }
.kp-choice:hover { transform: translateY(-1px); border-color: #C6B5F2; }
.kp-choice:active { transform: translateY(3px); box-shadow: none; }
.kp-choice .kp-mini { flex: 1; min-width: 0; border-color: #EEE7FF; }
.kp-abc { flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--lilac); display: grid; place-items: center; font-weight: 800; }
.kp-choice.kp-ok { border-color: var(--green); background: #EDFCF1; box-shadow: 0 4px 0 #A9E5B4; }
.kp-choice.kp-ok .kp-abc { background: var(--green); color: #FFF; }
.kp-choice.kp-x { opacity: .5; box-shadow: none; transform: none; cursor: default; }
.kp-choice.kp-x .kp-abc { background: #FFD6D6; }
.kp-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.kp-chip { font-family: var(--mono); font-size: 18px; font-weight: 700; min-height: 48px; min-width: 64px; padding: 8px 18px; border-radius: 16px; border: 2px solid #CFC3F2; background: #FFF; box-shadow: 0 4px 0 #CFC3F2; white-space: pre; }
.kp-chip:active { transform: translateY(3px); box-shadow: none; }
.kp-chip.kp-on { background: var(--lilac); border-color: #8B6CE8; box-shadow: 0 4px 0 #8B6CE8; }
.kp-stepper { display: flex; align-items: center; justify-content: center; gap: 18px; }
.kp-sbtn { width: 58px; height: 58px; border-radius: 50%; border: 0; background: var(--lilac); font-size: 30px; font-weight: 800; box-shadow: 0 4px 0 #CFC3F2; }
.kp-sbtn:active { transform: translateY(3px); box-shadow: none; }
.kp-sval { font-family: var(--mono); font-size: 34px; font-weight: 800; color: #E0700B; min-width: 64px; text-align: center; background: #E6F2FF; border-radius: 16px; padding: 2px 10px; box-shadow: inset 0 0 0 2px #7DB7F0; }

/* ---- run */
.kp-runrow { display: flex; justify-content: center; margin: 4px 0 14px; }
.kp-run { border: 0; background: var(--green); color: #FFF !important; font-weight: 800; font-size: 22px; min-height: 58px; padding: 10px 44px; border-radius: 999px; box-shadow: 0 6px 0 var(--green-d); letter-spacing: .3px; }
.kp-run:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--green-d); }
.kp-run:disabled { background: #A9DDB1; box-shadow: 0 6px 0 #8CC596; cursor: wait; }
.kp-pulse { animation: kp-pulse 1.1s ease-in-out infinite; }
@keyframes kp-pulse { 50% { transform: scale(1.07); } }

/* ---- console + memory */
.kp-console { background: #F2FFF6; border-color: #BDEBCB; }
.kp-out { background: #FFF; border-radius: 16px; border: 3px solid #CDEBD8; min-height: 74px; padding: 8px; font-family: var(--mono); font-size: 17px; text-align: left; overflow-x: auto; }
.kp-oline { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 3px 8px; border-radius: 10px; white-space: pre; font-family: var(--mono); font-size: inherit; min-height: 32px; animation: kp-in .3s ease; }
.kp-oline:hover { background: #E7FAEE; }
.kp-oerr { display: block; width: 100%; text-align: start; border: 0; background: #FFECEC; color: #A23434; border-radius: 12px; padding: 8px 12px; margin-top: 4px; font-family: "Segoe UI", Tahoma, sans-serif; font-size: 15.5px; font-weight: 600; white-space: normal; animation: kp-in .3s ease; }
.kp-empty { color: #A7A1BC; padding: 10px; font-family: "Segoe UI", Tahoma, sans-serif; text-align: center; }
@keyframes kp-in { from { opacity: 0; transform: translateY(6px); } }
.kp-mem { background: #FFF6EC; border-color: #FFDDBF; }
.kp-vars { display: flex; flex-wrap: wrap; gap: 8px; }
.kp-var { display: inline-flex; align-items: stretch; border: 2px solid #FFC999; border-radius: 12px; background: #FFF; padding: 0; overflow: hidden; font-family: var(--mono); min-height: 40px; }
.kp-var b { background: #FFE2C7; padding: 6px 10px; display: flex; align-items: center; }
.kp-var span { padding: 6px 12px; display: flex; align-items: center; white-space: pre; }

/* ---- Zeto bubble */
.kp-bubble { display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; background: #FFFBE0; border: 2px solid var(--yellow); border-radius: 18px; padding: 10px 36px 10px 10px; position: relative; animation: kp-in .25s ease; text-align: start; }
.kp[dir="rtl"] .kp-bubble { padding: 10px 10px 10px 36px; }
.kp-bbody { flex: 1; min-width: 0; }
.kp-bbody p { font-size: 16.5px; line-height: 1.65; overflow-wrap: anywhere; }
.kp-bcode { display: inline-block; max-width: 100%; font-family: var(--mono); font-size: 15px; background: #FFF; border: 1.5px solid #F3D77A; border-radius: 8px; padding: 1px 8px; margin-bottom: 4px; white-space: pre-wrap; overflow-wrap: anywhere; }
.kp-bx { position: absolute; top: 6px; inset-inline-end: 6px; width: 30px; height: 30px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .8); font-size: 18px; line-height: 1; color: var(--soft); }
.kp-bugbtn { margin-top: 8px; border: 0; background: #FF8FAB; color: #FFF; font-weight: 800; border-radius: 999px; padding: 8px 18px; min-height: 44px; box-shadow: 0 4px 0 #E06B8A; }
.kp-bugbtn:active { transform: translateY(3px); box-shadow: none; }

/* ---- stage: grid with Zeto */
.kp-obj { color: #0F8A8A; font-weight: 700; }
.kp-stagecard { background: #F6F2FF; border-color: #DCD0FA; }
.kp-gridwrap { position: relative; max-width: 460px; margin: 30px auto 4px; }
.kp-grid { display: grid; border-radius: 16px; overflow: hidden; border: 3px solid #CBBEF2; background: #FFFFFF; }
.kp-cell { position: relative; aspect-ratio: 1 / 1; border: 0; padding: 0; background: #FFFFFF; box-shadow: inset 0 0 0 1px #ECE5FB; display: grid; place-items: center; font-size: clamp(18px, 6vw, 30px); }
.kp-cell:nth-child(odd) { background: #FBF9FF; }
.kp-cell:hover { background: #FFF6CC; }
.kp-ce { line-height: 1; }
.kp-ghost { opacity: .28; filter: grayscale(.3); }
.kp-goalc { background: #EFFFF3 !important; box-shadow: inset 0 0 0 2px #9EDDB0; }
.kp-flagc { position: absolute; top: 2px; right: 3px; font-size: 45%; }
.kp-cell:not(:has(.kp-ce)) .kp-flagc { position: static; font-size: 100%; }
.kp-markc { position: absolute; bottom: 2px; left: 4px; font-size: 42%; font-weight: 800; color: #7A5AE0; background: #EEE7FF; border-radius: 6px; padding: 0 5px; line-height: 1.4; }
.kp-markcell { background: #F8F4FF !important; }
.kp-rockc { background: #F3EEE8 !important; }
.kp-spr { position: absolute; top: 0; left: 0; pointer-events: none; transition: transform .32s cubic-bezier(.4, 1.4, .6, 1); display: grid; place-items: center; }
.kp-z-cell { width: 78%; height: 78%; filter: drop-shadow(0 3px 2px rgba(58, 51, 85, .2)); }
.kp-arrow { position: absolute; right: -2px; top: 50%; margin-top: -9px; width: 18px; height: 18px; line-height: 18px; text-align: center; font-size: 13px; font-weight: 800; color: #FFF; background: #FF8FAB; border-radius: 50%; transition: transform .25s; transform-origin: center; }
.kp-said { position: absolute; bottom: 92%; left: 50%; transform: translateX(-50%); white-space: nowrap; background: #FFF; border: 2px solid var(--yellow); border-radius: 12px; padding: 2px 8px; font-size: 13px; font-weight: 700; pointer-events: auto; animation: kp-in .25s ease; font-family: var(--mono); }
.kp-said.kp-said-l { left: auto; right: 40%; transform: none; }
.kp-choices-row { grid-template-columns: repeat(3, 1fr); }
.kp-choices-row .kp-choice { flex-direction: column; justify-content: center; gap: 4px; }
.kp-sqname { font-weight: 700; font-size: 14px; color: var(--soft); }

/* ---- stage: rocket */
.kp-sky { position: relative; height: 240px; border-radius: 18px; overflow: hidden; background: linear-gradient(#DDEEFF, #F3F9FF 70%); border: 3px solid #CDE2FA; }
.kp-cloud { position: absolute; font-size: 34px; opacity: .9; animation: kp-drift 9s ease-in-out infinite alternate; }
.kp-c1 { top: 18px; left: 10%; } .kp-c2 { top: 60px; right: 12%; animation-delay: -4s; }
@keyframes kp-drift { to { transform: translateX(30px); } }
.kp-ground { position: absolute; left: 0; right: 0; bottom: 0; height: 30px; background: #BFE8B0; border-top: 3px solid #9ED38C; }
.kp-bignum { position: absolute; top: 50%; left: 18%; transform: translateY(-50%); border: 0; background: none; font-family: var(--mono); font-size: 56px; font-weight: 800; color: #FF7A59; text-shadow: 0 3px 0 #FFD2C4; min-width: 40px; }
.kp-rocket { position: absolute; bottom: 24px; left: 58%; border: 0; background: none; padding: 0; width: 72px; height: 110px; transition: transform 1.8s cubic-bezier(.5, 0, .9, .4); }
.kp-rk { display: block; font-size: 60px; line-height: 1; transform: rotate(-45deg); }
.kp-flame { position: absolute; left: 50%; bottom: 0; margin-left: -14px; font-size: 26px; transform: rotate(180deg); opacity: 0; }
.kp-rocket.kp-fly { transform: translateY(-330px); }
.kp-rocket.kp-fly .kp-flame { opacity: 1; animation: kp-flick .15s linear infinite alternate; }
@keyframes kp-flick { to { transform: rotate(180deg) scale(1.25); } }

/* ---- toast, win overlay, confetti */
.kp-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #FFF; border: 2px solid var(--yellow); border-radius: 999px; padding: 10px 20px; font-weight: 700; box-shadow: 0 8px 24px rgba(58, 51, 85, .15); z-index: 50; max-width: calc(100% - 32px); text-align: center; animation: kp-in .25s ease; transition: opacity .4s; }
.kp-toast.kp-out-go { opacity: 0; }
.kp-overlay { position: fixed; inset: 0; background: rgba(255, 248, 236, .86); display: grid; place-items: center; z-index: 60; padding: 16px; -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.kp-wincard { background: #FFF; border: 3px solid var(--yellow); border-radius: 30px; padding: 22px 20px; text-align: center; width: 100%; max-width: 400px; box-shadow: 0 16px 40px rgba(58, 51, 85, .18); animation: kp-in .3s ease; }
.kp-wincard .kp-zeto { margin: 0 auto 6px; }
.kp-wincard h2 { font-size: 26px; }
.kp-wincard p { color: var(--soft); font-weight: 600; margin-top: 4px; }
.kp-bigstars { margin: 8px 0 2px; }
.kp-star { display: inline-block; font-size: 52px; color: #E8E2F2; margin: 0 4px; animation: kp-starin .5s cubic-bezier(.3, 1.8, .5, 1) both; }
.kp-star.kp-on { color: #FFC21A; text-shadow: 0 3px 0 #E8A200; }
@keyframes kp-starin { from { transform: scale(0) rotate(-90deg); } }
.kp-winbtns { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; align-items: stretch; }
.kp-next { padding: 10px 24px; }
.kp-confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 70; }
.kp-confetti i { position: absolute; top: -16px; width: 10px; height: 14px; border-radius: 3px; animation: kp-fall 2.4s linear forwards; }
@keyframes kp-fall { to { transform: translate(var(--dx, 0), 105vh) rotate(720deg); opacity: .8; } }

/* ---- phones */
@media (max-width: 520px) {
  .kp { padding: 10px; border-radius: 0; font-size: 15.5px; }
  .kp-brand { font-size: 17px; }
  .kp-z-sm { width: 30px; height: 30px; }
  .kp-total, .kp-where { padding: 5px 10px; font-size: 14px; }
  .kp-z-big { width: 72px; height: 72px; }
  .kp-say { font-size: 15.5px; padding: 10px 12px; }
  .kp-lvls { gap: 7px; }
  .kp-lnum { font-size: 20px; }
  .kp-lstars { font-size: 11px; letter-spacing: 0; }
  .kp-ltype { font-size: 11px; top: 2px; }
  .kp-card { padding: 11px; border-radius: 20px; }
  .kp-z-md { width: 48px; height: 48px; }
  .kp-mtext h2 { font-size: 19px; }
  .kp-mtext p { font-size: 15.5px; }
  .kp-code { font-size: 13.5px; }
  .kp-op { padding-left: 1px; padding-right: 1px; }
  .kp-gut { width: 24px; font-size: 12px; }
  .kp-src { padding: 2px; }
  .kp-out { font-size: 15px; }
  .kp-run { font-size: 20px; padding: 10px 36px; }
}
@media (prefers-reduced-motion: reduce) {
  .kp *, .kp-confetti i { animation: none !important; transition: none !important; }
}
