/* SWORD DRILL (kids/sword.js): Kids mode's books-of-the-Bible game, in the kids' own look (as Dig it up, kids/dig.css): a
   cream box, big round buttons; and its own: the shelves of colored books, the commands, the spines to find, the stars. */
.ksw { position: fixed; inset: 0; z-index: 2147483100; display: flex; align-items: center; justify-content: center; padding: 12px; background: rgba(20, 16, 12, 0.55); opacity: 0; transition: opacity 0.22s ease; }
.ksw[hidden] { display: none; }
.ksw.on { opacity: 1; }
.ksw-box { --c: #E0892F; position: relative; display: flex; flex-direction: column; width: min(720px, 100%); height: min(900px, 100%); overflow: hidden; border-radius: 24px; background: #FFF8EC; color: #3A2A1E; box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.6); }
.ksw-head { flex: none; display: flex; align-items: center; gap: 8px; padding: 10px 12px 10px 14px; padding-top: max(10px, env(safe-area-inset-top)); background: #FFFDF7; border-bottom: 2px solid #F1E3C8; }
.ksw-title { flex: 1; min-width: 0; display: flex; flex-direction: column; font: 800 18px/1.2 var(--sans); }
.ksw-title small { font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--c); }
.ksw-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ksw-round { flex: none; display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 1px solid #E6D6B8; border-radius: 50%; background: #fff; color: #3A2A1E; font: 700 26px/1 var(--sans); cursor: pointer; }
.ksw-round svg { width: 20px; height: 20px; }
.ksw-body { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 12px 14px calc(16px + env(safe-area-inset-bottom)); }
.ksw-lead { margin: 4px 0 12px; font: 700 16px/1.45 var(--sans); }

/* (the armory: the sword, the stars so far, the shelves, the Big Drill) */
.ksw-hero { display: flex; align-items: center; gap: 12px; margin: 2px 0 10px; }
.ksw-sword { flex: none; width: 58px; height: 58px; }
.ksw-sword svg, .ksw-big-s svg { width: 100%; height: 100%; }
.ksw-hero p { margin: 0; font: 600 14.5px/1.45 var(--sans); }
.ksw-hero small { color: #8A7660; font-weight: 700; }
.ksw-all { display: flex; align-items: center; gap: 10px; margin: 0 0 6px; font: 800 13px var(--sans); color: #B57D12; }
.ksw-bar { flex: 1; height: 10px; border-radius: 999px; background: #F1E3C8; overflow: hidden; }
.ksw-bar i { display: block; height: 100%; border-radius: inherit; background: #F2B134; }
.ksw-testament { margin: 14px 2px 8px; font: 800 13px var(--sans); letter-spacing: 0.06em; text-transform: uppercase; color: #8A7660; }
.ksw-testament small { margin-left: 6px; font-weight: 700; text-transform: none; letter-spacing: 0; }
.ksw-shelves { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.ksw-shelf { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 10px 12px 12px; border: 2px solid color-mix(in srgb, var(--c) 35%, #F1E3C8); border-radius: 18px; background: #fff; color: #3A2A1E; font: inherit; text-align: left; cursor: pointer; transition: transform 0.12s ease; }
.ksw-shelf:active, .ksw-game:active, .ksw-big:active, .ksw-go:active, .ksw-choice:active { transform: scale(0.96); }
.ksw-spines { display: flex; align-items: flex-end; gap: 2px; height: 30px; margin-bottom: 4px; }
.ksw-spines i { width: 7px; border-radius: 2px 2px 1px 1px; background: var(--c); }
.ksw-spines i:nth-child(3n+1) { height: 26px; } .ksw-spines i:nth-child(3n+2) { height: 30px; opacity: 0.85; } .ksw-spines i:nth-child(3n) { height: 22px; opacity: 0.7; }
.ksw-shelf b { font: 800 15px/1.2 var(--sans); }
.ksw-shelf small { font: 600 12px/1.3 var(--sans); color: #8A7660; }
.ksw-stars { display: inline-flex; gap: 3px; vertical-align: -2px; }
.ksw-stars i { width: 16px; height: 16px; clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); background: #E6DCCB; }
.ksw-stars i.is-on { background: #F2B134; }
.ksw-big { display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 16px; padding: 14px 16px; border: 0; border-radius: 20px; background: linear-gradient(135deg, #3A2A1E, #6A4A2E); color: #FFF3DC; font: inherit; text-align: left; cursor: pointer; box-shadow: 0 12px 24px -14px rgba(0, 0, 0, 0.6); }
.ksw-big-s { flex: none; width: 46px; height: 46px; }
.ksw-big b { display: block; font: 800 18px/1.2 var(--sans); }
.ksw-big small { font: 600 13px/1.3 var(--sans); color: #F2D59A; }

/* (a shelf: its books, and its three games) */
.ksw-row, .ksw-tray, .ksw-plank, .ksw-seq { display: flex; flex-wrap: wrap; gap: 6px; }
.ksw-row { margin-bottom: 14px; }
.ksw-book { display: inline-flex; align-items: center; padding: 8px 12px; border-radius: 10px 10px 6px 6px; background: var(--c); color: #fff; font: 800 15px/1.1 var(--sans); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.15); border: 0; }
.ksw-game { display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 10px; padding: 14px; border: 2px solid #F1E3C8; border-radius: 18px; background: #fff; color: #3A2A1E; font: inherit; text-align: left; cursor: pointer; }
.ksw-game.is-done { border-color: #F2B134; }
.ksw-num { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--c); color: #fff; font: 800 18px var(--sans); }
.ksw-game.is-done .ksw-num { background: #F2B134; }
.ksw-game b { display: block; font: 800 17px/1.2 var(--sans); }
.ksw-game small { font: 600 13px var(--sans); color: #8A7660; }

/* (line them up: the plank above, its empty places filling; the books to tap below) */
.ksw-plank { min-height: 52px; margin: 0 0 16px; padding: 8px 8px 12px; border-bottom: 8px solid #B98A55; border-radius: 6px; background: linear-gradient(#FFF3DC, #F7E6C6); }
.ksw-slot { min-width: 54px; min-height: 34px; border-radius: 10px 10px 6px 6px; border: 2px dashed #D8C3A0; }
.ksw-slot.is-in { display: inline-flex; align-items: center; padding: 6px 10px; border: 0; background: var(--c); color: #fff; font: 800 14px/1.1 var(--sans); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.15); animation: ksw-land 0.35s cubic-bezier(0.2, 1.4, 0.4, 1); }
.ksw-book.is-tap { cursor: pointer; padding: 12px 16px; font-size: 17px; transition: transform 0.12s ease, opacity 0.25s ease; }
.ksw-book.is-gone { opacity: 0; transform: scale(0.6); pointer-events: none; }
.ksw-book.is-hint { animation: ksw-glow 1s ease-in-out infinite; }
.is-no { animation: ksw-shake 0.4s ease; }
@keyframes ksw-land { from { transform: translateY(18px) scale(0.6); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes ksw-shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
@keyframes ksw-glow { 50% { box-shadow: 0 0 0 5px rgba(242, 177, 52, 0.7), inset 0 -4px 0 rgba(0, 0, 0, 0.15); transform: scale(1.06); } }
.ksw-fact { margin: 14px 0 0; padding: 10px 14px; border-radius: 14px; background: #fff; border: 2px solid #F1E3C8; font: 600 14.5px/1.45 var(--sans); }
.ksw-fact b { color: var(--c); }
.ksw-fact.is-pop { animation: ksw-land 0.3s ease; }
.ksw-fact.is-float { position: absolute; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); margin: 0; z-index: 3; box-shadow: 0 12px 28px -12px rgba(0, 0, 0, 0.4); }

/* (what comes next: two books, an arrow, the one to find; three to choose from) */
.ksw-prog { margin: 0 0 6px; }
.ksw-prog .ksw-stars i { width: 13px; height: 13px; }
.ksw-seq { align-items: center; margin: 4px 0 18px; }
.ksw-arrow { font: 800 20px var(--sans); color: #B9A27F; }
.ksw-book.is-q { background: #fff; color: var(--c); border: 3px dashed var(--c); box-shadow: none; min-width: 60px; justify-content: center; }
.ksw-book.is-q.is-in { background: var(--c); color: #fff; border-style: solid; animation: ksw-land 0.35s ease; }
.ksw-choices { display: grid; gap: 10px; }
.ksw-choice { padding: 16px; border: 2px solid #F1E3C8; border-radius: 16px; background: #fff; color: #3A2A1E; font: 800 19px var(--sans); cursor: pointer; transition: transform 0.12s ease; }
.ksw-choice.is-yes { background: #3F9E66; border-color: #3F9E66; color: #fff; }
.ksw-choice:disabled:not(.is-yes) { opacity: 0.45; }

/* (the drill: the call at the top, the time; the bookcase of spines) */
.ksw-call { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; background: #3A2A1E; color: #FFF3DC; }
.ksw-call-t { font: 800 22px/1.2 var(--sans); }
.ksw-call.is-cmd .ksw-call-t { letter-spacing: 0.02em; }
.ksw-call.is-go { background: #C0392B; }
.ksw-call.is-book { background: var(--c); }
.ksw-call.is-pop .ksw-call-t { animation: ksw-call 0.35s cubic-bezier(0.2, 1.4, 0.4, 1); }
@keyframes ksw-call { from { transform: scale(0.6); opacity: 0; } to { transform: none; opacity: 1; } }
.ksw-time { flex: none; font: 800 16px var(--sans); font-variant-numeric: tabular-nums; opacity: 0.9; }
.ksw-case-body { padding-bottom: calc(90px + env(safe-area-inset-bottom)); }
.ksw-case-h { margin: 10px 2px 4px; font: 800 11px var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--c); }
.ksw-case { display: flex; flex-wrap: wrap; gap: 5px; padding: 6px 6px 10px; border-bottom: 7px solid #B98A55; border-radius: 4px; background: linear-gradient(#FFF6E4, #F5E4C2); }
.ksw-spine { padding: 9px 9px; border: 0; border-radius: 8px 8px 4px 4px; background: color-mix(in srgb, var(--c) 82%, #fff); color: #fff; font: 800 13.5px/1.1 var(--sans); cursor: pointer; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.15); transition: transform 0.12s ease; }
.ksw-spine:disabled { opacity: 0.55; cursor: default; }
.ksw-spine:active { transform: scale(0.94); }
.ksw-spine.is-yes { background: #3F9E66; transform: scale(1.12); box-shadow: 0 0 0 4px rgba(63, 158, 102, 0.35); }

/* (a win: a burst of stars, the big star, what's next) */
.ksw-win { display: flex; flex-direction: column; align-items: center; text-align: center; position: relative; overflow: hidden; }
.ksw-win h2 { margin: 6px 0 4px; font: 800 22px/1.3 var(--sans); }
.ksw-bigstar { margin-top: 18px; font: 400 92px/1 var(--sans); color: #F2B134; text-shadow: 0 6px 18px rgba(242, 177, 52, 0.5); }
.ksw-bigstar.is-new { animation: ksw-star 0.8s cubic-bezier(0.2, 1.5, 0.4, 1); }
@keyframes ksw-star { from { transform: scale(0.2) rotate(-90deg); opacity: 0; } to { transform: none; opacity: 1; } }
.ksw-burst { position: absolute; left: 50%; top: 80px; width: 0; height: 0; pointer-events: none; }
.ksw-burst i { position: absolute; width: 10px; height: 10px; border-radius: 2px; background: #F2B134; transform: rotate(var(--a)) translateY(0); animation: ksw-burst 1s ease-out var(--d) forwards; opacity: 0; }
.ksw-burst i:nth-child(3n) { background: #E58A2E; } .ksw-burst i:nth-child(3n+1) { background: #3E78CC; }
@keyframes ksw-burst { 0% { opacity: 1; transform: rotate(var(--a)) translateY(0); } 100% { opacity: 0; transform: rotate(var(--a)) translateY(-130px); } }
.ksw-acts { display: flex; flex-direction: column; gap: 10px; width: min(340px, 100%); margin-top: 16px; }
.ksw-go { padding: 15px 18px; border: 0; border-radius: 999px; background: #F2B134; color: #3A2A1E; font: 800 17px var(--sans); cursor: pointer; }
.ksw-go.is-soft { background: #fff; border: 2px solid #F1E3C8; }

@media (max-height: 500px) { /* (a phone on its side: more of the bookcase in view) */
  .ksw { padding: 6px; }
  .ksw-box { height: 100%; }
  .ksw-hero .ksw-sword { width: 44px; height: 44px; }
  .ksw-call { padding: 8px 14px; } .ksw-call-t { font-size: 19px; }
  .ksw-bigstar { font-size: 64px; margin-top: 6px; }
}
@media (prefers-reduced-motion: reduce) { .ksw *, .ksw *::after { animation: none !important; transition: none !important; } }
