/* ZELTREX Kids shared parts: sheets, buttons, the voice recorder, the little book, stickers.
   Every class starts with k- so a game with its own stylesheet (the mirror hall) can load this file safely. */
:root {
  --night: #24124d; --night-2: #3a1d7a; --sun: #ffd23f; --pink: #ff5d8f; --mint: #3de0c5; --sky: #58b7ff;
  --ink: #1b1036; --paper: #fffaf0; --soft: rgba(255, 255, 255, .16);
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Varela Round", "Segoe UI", system-ui, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
[hidden] { display: none !important; }
.k-sheet, .k-sheet *, .k-round, .k-btn, .k-pill { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
.k-sheet { font-family: var(--font); font-weight: 700; color: #fff; line-height: 1.35; }
.k-sheet h2 { margin: 0; font-weight: 900; line-height: 1.1; font-size: clamp(1.5rem, 6.5vw, 2rem); font-family: var(--font); color: #fff; }
.k-sheet p { margin: .6em 0; }
.k-btn, .k-round, .k-pill, .k-hold, .mic-ring, .k-page-del { font: inherit; font-family: var(--font); color: inherit; border: 0; cursor: pointer; padding: 0; margin: 0; }
.k-small { font-size: .9rem; font-weight: 600; opacity: .85; }

.k-btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 56px; padding: 0 1.4em; border-radius: 999px;
  font-weight: 900; font-size: 1.1rem; text-decoration: none; transition: transform .12s;
}
.k-btn:active { transform: scale(.94); }
.k-go { background: var(--sun); color: var(--ink); box-shadow: 0 6px 0 #d49b00; }
.k-go:active { box-shadow: 0 2px 0 #d49b00; transform: translateY(4px); }
.k-quiet { background: var(--soft); }
.k-big { min-height: 76px; font-size: 1.45rem; padding: 0 1.6em; animation: pulse 1.6s ease-in-out infinite; }
.k-btn:disabled { opacity: .6; animation: none; }
.k-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.k-round {
  width: 56px; height: 56px; border-radius: 50%; background: rgba(27, 16, 54, .55); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: inline-flex; align-items: center; justify-content: center; font-size: 1.6rem; text-decoration: none; position: relative;
  border: 3px solid rgba(255, 255, 255, .35); transition: transform .12s;
}
.k-round:active { transform: scale(.88); }
.k-pill { background: var(--soft); border-radius: 999px; padding: .5em 1em; min-height: 48px; font-weight: 900; }
/* ---- sheets ---- */
.k-sheet { position: fixed; inset: 0; z-index: 50; background: rgba(20, 10, 45, .72); display: flex; align-items: flex-end; justify-content: center; animation: fade .2s both; }
.k-card {
  width: 100%; max-width: 520px; max-height: 92%; overflow-y: auto; background: var(--night-2); border-radius: 32px 32px 0 0; padding: 26px 20px calc(24px + var(--safe-b));
  text-align: center; position: relative; animation: rise .32s cubic-bezier(.2, 1.2, .4, 1) both; border-top: 4px solid var(--sun);
}
.k-close { position: absolute; right: 14px; top: 14px; width: 48px; height: 48px; font-size: 1.2rem; }
.k-card h2 { padding: 0 44px; }

/* ---- voice ---- */
.voice[data-state="notice"] .voice-main, .voice:not([data-state="notice"]) .voice-notice { display: none; }
.voice-notice p { text-align: left; }
.mic-ring { width: 168px; height: 168px; border-radius: 50%; background: var(--pink); position: relative; margin: 22px auto 10px; display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 0 #c12d62; transition: background .2s, transform .12s; }
.mic-ring:active { transform: scale(.95); }
.mic-icon { font-size: 4.4rem; position: relative; line-height: 1; }
.mic-halo { position: absolute; inset: -6px; border-radius: 50%; border: 8px solid var(--sun); opacity: 0; transition: transform .08s linear; }
.mic-clock { position: absolute; right: -6px; top: -6px; min-width: 44px; height: 44px; border-radius: 22px; background: var(--paper); color: var(--ink); display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 1.2rem; }
.mic-clock:empty { display: none; }
.voice[data-state="ready"] .mic-ring, .voice[data-state="error"] .mic-ring { animation: pulse 1.4s ease-in-out infinite; }
.voice[data-state="rec"] .mic-ring { background: var(--mint); box-shadow: 0 8px 0 #1ea58f; }
.voice[data-state="rec"] .mic-halo { opacity: .9; }
.voice[data-state="sending"] .mic-ring { background: var(--sky); box-shadow: 0 8px 0 #2f7fc0; pointer-events: none; }
.voice[data-state="sending"] .mic-icon { animation: rocket 1s ease-in-out infinite; }
.voice[data-state="thanks"] .mic-ring { background: var(--sun); box-shadow: 0 8px 0 #d49b00; pointer-events: none; animation: jump .6s ease 2; }
.voice-bars { height: 46px; display: flex; gap: 6px; align-items: center; justify-content: center; opacity: 0; }
.voice[data-state="rec"] .voice-bars { opacity: 1; }
.voice-bars i { width: 9px; height: 46px; border-radius: 5px; background: var(--sun); transform: scaleY(.15); }
.voice-bars i:nth-child(odd) { background: var(--mint); }
.voice-line { font-size: 1.35rem; font-weight: 900; min-height: 2.6em; margin-bottom: 0; }
.voice[data-state="error"] .voice-line { color: var(--sun); }
.k-confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.k-confetti i { position: absolute; top: -20px; width: 12px; height: 18px; border-radius: 3px; animation: fall 2s linear forwards; }
.k-confetti .c1 { background: var(--sun); } .k-confetti .c2 { background: var(--pink); } .k-confetti .c3 { background: var(--mint); } .k-confetti .c4 { background: var(--sky); border-radius: 50%; }

/* ---- the little book: small on purpose ---- */
.k-book { text-align: center; }
.k-book-empty { font-size: 1.2rem; padding: 30px 0; }
.k-pages { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 10px; padding: 18px 6px 8px; }
.k-page { margin: 0; background: var(--paper); padding: 5px 5px 0; border-radius: 6px; box-shadow: 0 4px 0 rgba(0, 0, 0, .3); position: relative; }
.k-page img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; display: block; border-radius: 3px; pointer-events: none; }
.k-page figcaption { color: var(--ink); font-size: .8rem; padding: 2px 0 3px; }
.k-page-del { position: absolute; right: -8px; top: -8px; width: 36px; height: 36px; border-radius: 50%; background: var(--ink); font-size: .85rem; border: 2px solid #fff; }
.k-page-del::after { content: ""; position: absolute; inset: -8px; }
.k-page-del.k-sure { background: var(--pink); }
.k-tilt0 { transform: rotate(-2.5deg); } .k-tilt1 { transform: rotate(1.5deg); } .k-tilt2 { transform: rotate(-1deg); } .k-tilt3 { transform: rotate(2.5deg); }
.k-hold { width: 120px; height: 120px; border-radius: 50%; background: var(--soft); margin: 14px auto; display: flex; align-items: center; justify-content: center; font-size: 2.6rem; position: relative; touch-action: none; }
.k-hold::before { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--mint); transform: scale(0); }
.k-hold.holding::before { transform: scale(1); transition: transform 3s linear; }
.k-hold span { position: relative; }

@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-10px) rotate(3deg); } }
@keyframes wobble { 0%, 100% { transform: rotate(-6deg) scale(1); } 50% { transform: rotate(6deg) scale(1.06); } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes popin { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes sayin { from { transform: translateX(-50%) scale(.5) rotate(-6deg); opacity: 0; } to { transform: translateX(-50%) scale(1) rotate(0); opacity: 1; } }
@keyframes twinkle { 0%, 100% { opacity: .2; transform: scale(.7); } 50% { opacity: .9; transform: scale(1.2); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes jump { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-16px) scale(1.08); } }
@keyframes rocket { 0%, 100% { transform: translate(0, 0) rotate(-8deg); } 50% { transform: translate(6px, -10px) rotate(8deg); } }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }
@keyframes flash { from { opacity: .9; } to { opacity: 0; } }
@keyframes blink { 50% { transform: scale(1.25) rotate(20deg); background: #fff; } }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, 10px); } 10%, 80% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, 0); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01s !important; animation-iteration-count: 1 !important; } }

/* ---- stickers ---- */
.k-sticker { aspect-ratio: 1; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; font-weight: 900; background: rgba(255, 255, 255, .12); color: rgba(255, 255, 255, .45); border: 3px dashed rgba(255, 255, 255, .3); }
.k-sticker.got { background: var(--paper); border: 3px solid var(--sun); color: var(--ink); box-shadow: 0 4px 0 rgba(0, 0, 0, .25); animation: popin .5s cubic-bezier(.3, 1.6, .5, 1) both; }
.k-sticker-toast { position: fixed; left: 50%; top: calc(10px + var(--safe-t)); transform: translateX(-50%); z-index: 70; background: var(--sun); color: var(--ink); font-family: var(--font); font-weight: 900; font-size: clamp(.9rem, 4.2vw, 1.1rem); line-height: 1.1; max-width: calc(100vw - 16px); border-radius: 999px; padding: 8px 20px 8px 8px; display: flex; align-items: center; gap: 10px; box-shadow: 0 6px 0 rgba(0, 0, 0, .3); animation: stickerin 3.6s ease both; pointer-events: none; }
.k-sticker-toast b { width: 48px; height: 48px; border-radius: 50%; background: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.6rem; }
@keyframes stickerin { 0% { opacity: 0; transform: translate(-50%, -30px) scale(.6); } 10%, 85% { opacity: 1; transform: translate(-50%, 0) scale(1); } 100% { opacity: 0; transform: translate(-50%, -10px) scale(1); } }

/* ---- around the mirror hall ---- */
.kx-defs { position: absolute; }
.kx-dock { position: fixed; right: max(8px, env(safe-area-inset-right, 0px)); top: 34%; z-index: 12; display: flex; flex-direction: column; gap: 10px; transition: opacity .2s; }
body.ui-off .kx-dock, body.ui-off .kx-say { opacity: 0; pointer-events: none; }
.kx-dock .k-round { width: 50px; height: 50px; font-size: 1.4rem; color: #fff; backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(27, 16, 54, .72); }
@media (orientation: landscape) and (max-height: 480px) { .kx-dock { top: 50%; transform: translateY(-50%); display: grid; grid-template-columns: 50px 50px; } }
.kx-dock .k-round[aria-pressed="true"] { background: var(--sun); border-color: #fff; }
.kx-dock .k-round[aria-pressed="false"] { opacity: .75; }
.kx-book b { position: absolute; right: -6px; top: -8px; min-width: 24px; height: 24px; border-radius: 12px; background: var(--pink); color: #fff; font: 900 .8rem var(--font); display: flex; align-items: center; justify-content: center; padding: 0 6px; }
.kx-pop { animation: jump .45s ease; }
.kx-blink { animation: blink .5s ease; }
.kx-say { position: fixed; left: 50%; top: 30%; transform: translateX(-50%); z-index: 11; max-width: 64%; text-align: center; background: var(--pink); color: var(--ink); font: 900 1.3rem var(--font); border-radius: 22px; padding: .5em 1em; box-shadow: 0 5px 0 #c12d62; pointer-events: none; }
.kx-say.kx-in { animation: sayin .5s cubic-bezier(.3, 1.8, .5, 1) both; }
.kx-flash { position: fixed; inset: 0; background: #fff; pointer-events: none; z-index: 40; animation: flash .45s ease-out both; }
.kx-home-link { display: inline-block; margin-bottom: 6px; font: 800 .95rem var(--font); color: #4a2bd6; text-decoration: none; }
.kx-home-link::before { content: "← "; }
