/* Safe Playlist Player */
.spp-app {
	--spp-bg: #101827;
	--spp-card: #1c2639;
	--spp-card-hover: #27344f;
	--spp-accent: #ffb703;
	--spp-accent-ink: #1a1300;
	--spp-text: #f4f6fb;
	position: relative;
	box-sizing: border-box;
	background: var(--spp-bg);
	color: var(--spp-text);
	border-radius: 16px;
	padding: 16px;
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	line-height: 1.35;
}
.spp-app *, .spp-app *::before, .spp-app *::after { box-sizing: border-box; }
.spp-app [hidden] { display: none !important; }

.spp-app .spp-btn {
	appearance: none; -webkit-appearance: none;
	border: 0; margin: 0; box-shadow: none; min-height: 0;
	font: inherit; font-weight: 600; text-transform: none; letter-spacing: normal;
	color: inherit; background: var(--spp-card);
	border-radius: 12px; padding: 10px 14px; line-height: 1.2;
	cursor: pointer; transition: background .15s, transform .1s;
}
.spp-app .spp-btn:hover, .spp-app .spp-btn:focus-visible { background: var(--spp-card-hover); color: inherit; }
.spp-app .spp-btn:active { transform: scale(.97); }
.spp-app .spp-btn svg { width: 22px; height: 22px; fill: currentColor; display: block; }

.spp-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.spp-timer { display: inline-block; background: var(--spp-card); border-radius: 999px; padding: 7px 14px; font-size: 15px; font-weight: 700; margin-bottom: 12px; }
.spp-timer.is-low { background: #8a2b0c; }
.spp-done { text-align: center; padding: 48px 16px; font-size: 21px; font-weight: 700; }
.spp-app .spp-card[hidden] { display: none !important; }
.spp-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.spp-app .spp-tab { font-size: 17px; padding: 10px 18px; }
.spp-app .spp-tab.is-active { background: var(--spp-accent); color: var(--spp-accent-ink); }

.spp-msg { padding: 28px 12px; text-align: center; font-size: 17px; opacity: .85; }

.spp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.spp-app .spp-card { padding: 0; overflow: hidden; text-align: left; display: flex; flex-direction: column; border-radius: 14px; }
.spp-app .spp-card img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; display: block; background: #000; margin: 0; border-radius: 0; }
.spp-cap {
	white-space: normal; word-break: break-word;
	padding: 10px 12px 12px; font-size: 15px; font-weight: 600; min-height: 3.3em;
	display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.spp-app .spp-card.spp-bad { opacity: .4; cursor: not-allowed; }

.spp-stage { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 14px; overflow: hidden; }
.spp-player-wrap, .spp-player-wrap iframe { position: absolute; inset: 0; width: 100% !important; height: 100% !important; border: 0; }
.spp-shield { position: absolute; inset: 0; z-index: 2; cursor: pointer; background: transparent; -webkit-tap-highlight-color: transparent; }
.spp-cover { position: absolute; inset: 0; z-index: 3; background: rgba(10, 14, 24, .94); display: flex; align-items: center; justify-content: center; }
.spp-app .spp-bigplay { width: 96px; height: 96px; border-radius: 50%; padding: 0; background: var(--spp-accent); color: var(--spp-accent-ink); display: flex; align-items: center; justify-content: center; }
.spp-app .spp-bigplay:hover { background: var(--spp-accent); filter: brightness(1.08); color: var(--spp-accent-ink); }
.spp-app .spp-bigplay svg { width: 50px; height: 50px; margin-left: 4px; }

.spp-title { font-size: 19px; font-weight: 700; margin: 12px 2px 10px; min-height: 1.35em; }
.spp-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spp-seek { flex: 1 1 200px; min-width: 120px; height: 28px; accent-color: var(--spp-accent); margin: 0; }
.spp-time { font-variant-numeric: tabular-nums; font-size: 14px; opacity: .85; min-width: 96px; text-align: center; }

.spp-toast { position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 10; background: rgba(0, 0, 0, .85); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 15px; white-space: nowrap; }

.spp-loaderbox { position: absolute; left: -10000px; top: 0; width: 320px; height: 180px; overflow: hidden; pointer-events: none; }

/* Our own full screen (also used as a fallback where the browser can't do real full screen) */
.spp-app.spp-is-full { position: fixed; inset: 0; z-index: 999999; border-radius: 0; display: flex; flex-direction: column; overflow: auto; width: 100vw; height: 100vh; height: 100dvh; }
.spp-app.spp-is-full.spp-watching .spp-tabs { display: none; }
.spp-app.spp-is-full .spp-watch { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.spp-app.spp-is-full .spp-stage { flex: 1; aspect-ratio: auto; min-height: 0; }
html.spp-lock, html.spp-lock body { overflow: hidden; }

.spp-login { max-width: 360px; margin: 24px auto; padding: 20px 24px; border: 1px solid #ddd; border-radius: 12px; }
.spp-login input[type="text"], .spp-login input[type="password"] { width: 100%; }

@media (max-width: 600px) {
	.spp-app { padding: 10px; border-radius: 12px; }
	.spp-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
	.spp-time { min-width: 0; }
}

/* Quiz */
.spp-quiz { background: var(--spp-card); border-radius: 14px; padding: 22px; min-height: 320px; }
.spp-qhead { font-size: 15px; font-weight: 700; color: var(--spp-accent); margin-bottom: 10px; }
.spp-qrow { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 18px; }
.spp-qtext { flex: 1; font-size: 24px; font-weight: 700; line-height: 1.3; }
.spp-app .spp-hear { font-size: 26px; padding: 8px 12px; background: var(--spp-bg); }
.spp-answers { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.spp-app .spp-answer { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 96px; padding: 16px; font-size: 20px; background: var(--spp-bg); border: 3px solid transparent; text-align: center; white-space: normal; }
.spp-app .spp-answer:disabled { cursor: default; opacity: .55; }
.spp-app .spp-answer.is-picked { opacity: 1; border-color: var(--spp-accent); }
.spp-app .spp-answer.is-reading { border-color: #7cc4ff; }
.spp-emoji { font-size: 44px; line-height: 1; }
.spp-quiz.is-aloud .spp-emoji { font-size: 64px; }
.spp-quiz.is-aloud .spp-answer { min-height: 150px; }
.spp-qresult { font-size: 30px; font-weight: 800; text-align: center; margin: 10px 0 6px; }
.spp-qstars { font-size: 36px; text-align: center; margin-bottom: 8px; }
.spp-qearn { font-size: 20px; font-weight: 700; text-align: center; color: var(--spp-accent); margin-bottom: 16px; min-height: 1em; }
.spp-qreview { font-size: 15px; opacity: .9; margin: 0 auto 18px; max-width: 640px; }
.spp-qline { padding: 4px 0; }
.spp-app .spp-qgo { display: block; margin: 0 auto; font-size: 20px; padding: 14px 28px; background: var(--spp-accent); color: var(--spp-accent-ink); }
.spp-app .spp-qgo:hover { background: var(--spp-accent); filter: brightness(1.08); color: var(--spp-accent-ink); }
.spp-app.spp-is-full .spp-quiz { flex: 1; }

/* Phase 1: gate, shop, checking */
.spp-app .spp-tab.is-locked { opacity: .55; }
.spp-app button.spp-stars { cursor: pointer; border: 0; color: inherit; font: inherit; font-weight: 700; font-size: 15px; }
.spp-app button.spp-stars:disabled { cursor: default; }
.spp-checking { text-align: center; padding: 30px 10px; }
.spp-spin { font-size: 56px; animation: spp-bob 1.2s ease-in-out infinite; }
@keyframes spp-bob { 0%,100% { transform: translateY(0) rotate(-8deg); } 50% { transform: translateY(-8px) rotate(8deg); } }
.spp-checking .spp-back { margin-top: 18px; }

/* Homeschool */
.spp-hwmeta { padding: 0 12px 12px; font-size: 13px; opacity: .9; white-space: normal; }
.spp-hwnote { margin-top: 4px; font-style: italic; }
.spp-open-text { width: 100%; font: inherit; font-size: 18px; padding: 12px; border-radius: 12px; border: 2px solid #34405a; background: var(--spp-bg); color: var(--spp-text); margin-bottom: 8px; }
.spp-rec { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 8px 0; }
.spp-app .spp-recbtn { min-width: 240px; }
.spp-app .spp-recbtn.is-recording { border-color: #ff5d5d; animation: spp-pulse 1s infinite; }
@keyframes spp-pulse { 50% { box-shadow: 0 0 0 8px rgba(255,93,93,.25); } }

/* Subjects & weekly goals */
.spp-subjbar { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 12px; }
.spp-app .spp-subj { font-size: 13px; padding: 6px 12px; border-radius: 999px; background: var(--spp-card); }
.spp-app .spp-subj.is-active { background: #7cc4ff; color: #0b1a2b; }
.spp-week { display: flex; flex-direction: column; gap: 10px; max-width: 640px; margin: 10px auto 0; }
.spp-weekrow { display: grid; grid-template-columns: 170px 1fr 110px auto; gap: 10px; align-items: center; }
.spp-weekname { font-weight: 700; }
.spp-weekbar { height: 12px; background: var(--spp-bg); border-radius: 999px; overflow: hidden; }
.spp-weekfill { height: 100%; background: var(--spp-accent); border-radius: 999px; }
.spp-weekrow.is-done .spp-weekfill { background: #5ad17a; }
.spp-weeknum { font-size: 13px; opacity: .85; text-align: right; }
@media (max-width: 600px) { .spp-weekrow { grid-template-columns: 1fr 90px; } .spp-weekbar { grid-column: 1 / -1; } }

/* ---- v2.0: greeting, search, up next, badges, unlock, breaks, picker ---- */
.spp-hello { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.spp-hi { font-size: 22px; font-weight: 800; margin-right: auto; }
.spp-app .spp-search { flex: 1 1 200px; max-width: 340px; min-height: 42px; border: 0; border-radius: 999px; padding: 8px 16px; font: inherit; font-size: 16px; background: var(--spp-card); color: var(--spp-text); outline: none; }
.spp-app .spp-search:focus { box-shadow: 0 0 0 2px var(--spp-accent); }
.spp-app .spp-search::placeholder { color: rgba(244,246,251,.6); }
.spp-app .spp-switchbtn { border-radius: 999px; }
.spp-upnext { margin-bottom: 18px; }
.spp-upnext-h { font-size: 18px; font-weight: 800; margin-bottom: 8px; }
.spp-upnext-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(200px, 240px); gap: 12px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x mandatory; }
.spp-upnext-row > * { scroll-snap-align: start; }
.spp-why { display: block; padding: 0 12px 10px; font-size: 13px; color: var(--spp-accent); font-weight: 700; }
.spp-app .spp-card { position: relative; }
.spp-badge { position: absolute; top: 8px; right: 8px; background: rgba(16,24,39,.88); color: #fff; font-size: 13px; font-weight: 800; padding: 4px 9px; border-radius: 999px; }
.spp-badge.is-lock { background: var(--spp-accent); color: var(--spp-accent-ink); }
.spp-cardwrap { position: relative; display: flex; flex-direction: column; }
.spp-cardwrap > .spp-card { flex: 1; }
.spp-app .spp-cardhear { position: absolute; left: 8px; top: 8px; width: 44px; height: 44px; padding: 0; border-radius: 50%; font-size: 20px; background: rgba(16,24,39,.85); z-index: 1; }
.spp-big .spp-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.spp-big .spp-cap { font-size: 18px; }
.spp-big .spp-tab { font-size: 20px; padding: 14px 22px; }
.spp-unlockimg { display: block; width: min(360px, 90%); margin: 0 auto 10px; border-radius: 12px; }
.spp-unlockrow { justify-content: center; gap: 12px; margin-top: 16px; }
.spp-breakmove { font-size: 30px; font-weight: 800; text-align: center; margin: 18px 0; }
.spp-breakcount { font-size: 72px; font-weight: 900; text-align: center; color: var(--spp-accent); font-variant-numeric: tabular-nums; }
.spp-app.spp-picker { text-align: center; padding: 28px 16px; }
.spp-pickhead { font-size: 28px; font-weight: 800; margin-bottom: 22px; }
.spp-pickgrid { display: flex; flex-wrap: wrap; justify-content: center; gap: 18px; }
.spp-app .spp-picktile { width: 160px; padding: 20px 10px; display: flex; flex-direction: column; align-items: center; gap: 10px; border-radius: 22px; }
.spp-pickav { font-size: 72px; line-height: 1; }
.spp-pickname { font-size: 20px; }
.spp-pindots { font-size: 30px; letter-spacing: 4px; margin: 6px 0 4px; min-height: 40px; }
.spp-pindots.is-shake { animation: spp-shake .4s; }
@keyframes spp-shake { 25% { transform: translateX(-10px); } 50% { transform: translateX(10px); } 75% { transform: translateX(-6px); } }
.spp-pinerr { min-height: 24px; color: #ff9b85; font-weight: 700; margin-bottom: 8px; }
.spp-pinpad { display: grid; grid-template-columns: repeat(3, 84px); gap: 12px; justify-content: center; margin-bottom: 18px; }
.spp-app .spp-pinkey { height: 84px; font-size: 32px; border-radius: 50%; }
.spp-app .spp-pinkey.is-go { background: var(--spp-accent); color: var(--spp-accent-ink); }
.spp-app .spp-switch { appearance: none; border: 0; background: #1c2639; color: #f4f6fb; font: inherit; font-weight: 700; padding: 10px 18px; border-radius: 999px; cursor: pointer; margin-top: 16px; }
.spp-kidmode .spp-app { min-height: calc(100vh - 24px); border-radius: 0; }
@media (max-width: 600px) { .spp-hi { font-size: 19px; width: 100%; } .spp-app .spp-search { max-width: none; } }
.spp-app .spp-rmbtn { position: absolute; right: 8px; bottom: 8px; padding: 6px 10px; font-size: 13px; border-radius: 999px; background: rgba(16,24,39,.9); z-index: 1; }
.spp-app .spp-card.is-removed { opacity: .35; filter: grayscale(1); }
.spp-histlist { display: flex; flex-direction: column; gap: 10px; max-width: 760px; margin: 12px auto 0; text-align: left; }
.spp-app .spp-histrow { display: flex; gap: 12px; align-items: center; padding: 8px; text-align: left; }
.spp-app .spp-histrow img { width: 140px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; flex: none; margin: 0; }
.spp-app .spp-histrow.is-gone { opacity: .5; }
.spp-histinfo { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
.spp-histtitle { font-size: 16px; font-weight: 700; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.spp-histbar { display: block; height: 10px; background: rgba(255,255,255,.15); border-radius: 999px; overflow: hidden; }
.spp-histfill { display: block; height: 100%; background: var(--spp-accent); border-radius: 999px; }
.spp-histmeta { font-size: 13px; opacity: .8; }
@media (max-width: 600px) { .spp-app .spp-histrow img { width: 100px; } }

/* ---- v2.0 sidebar layout ---- */
.spp-body { display: flex; gap: 18px; align-items: flex-start; }
.spp-main { flex: 1; min-width: 0; }
.spp-side { flex: 0 0 230px; position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto; background: rgba(255,255,255,.04); border-radius: 14px; padding: 10px; }
.spp-has-side .spp-tabs { flex-direction: column; flex-wrap: nowrap; gap: 4px; margin: 0; }
.spp-has-side .spp-tab { width: 100%; text-align: left; font-size: 16px; padding: 10px 12px; background: transparent; white-space: normal; }
.spp-has-side .spp-tab:hover { background: var(--spp-card-hover); }
.spp-has-side .spp-tab.is-active { background: var(--spp-accent); color: var(--spp-accent-ink); }
.spp-has-side .spp-tab.is-locked { opacity: .55; }
.spp-sidehead { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; opacity: .65; margin: 14px 12px 4px; }
.spp-sideextra { border-top: 1px solid rgba(255,255,255,.1); margin-top: 12px; padding-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.spp-app .spp-menubtn { display: none; width: 100%; }
.spp-gridh { grid-column: 1 / -1; font-size: 19px; font-weight: 800; margin: 6px 0 -4px; }
.spp-has-side .spp-tabs[hidden] { display: none !important; }
.spp-big.spp-has-side .spp-tab { font-size: 19px; padding: 13px 14px; }
@media (max-width: 820px) {
	.spp-body { flex-direction: column; gap: 10px; }
	.spp-side { position: static; flex: none; width: 100%; max-height: none; padding: 6px; }
	.spp-app .spp-menubtn { display: block; }
	.spp-side .spp-tabs, .spp-side .spp-sideextra { display: none; }
	.spp-side.is-open .spp-tabs, .spp-side.is-open .spp-sideextra { display: flex; margin-top: 6px; }
}
@media (max-width: 600px) {
	.spp-chips { gap: 6px; }
	.spp-timer { font-size: 13px; padding: 5px 10px; margin-bottom: 6px; }
	.spp-hello { gap: 8px; }
	.spp-app .spp-search { flex: 1 1 60%; }
}
