/* StayKR 簡單版介面（試作）。所有規則都掛在 html.ui2 底下，沒開的人完全不受影響。 */
html.ui2 .tools-wrap { display: none !important; }
html.ui2 body[data-p="home"] .levels,
html.ui2 body[data-p="srs"] .levels,
html.ui2 body[data-p="explore"] .levels { display: none !important; }

/* 底部分頁：手機電腦都顯示，四格 */
html.ui2 .bnav { display: flex; justify-content: center; }
html.ui2 .bnav .bn-item { max-width: 180px; font-size: 11.5px; padding: 6px 0; }
html.ui2 .wrap { max-width: 560px; padding-bottom: calc(104px + env(safe-area-inset-bottom)); }
html.ui2 .sheet-bg, html.ui2 #moreSheet { display: none; }

/* 首頁 */
.s2 { display: flex; flex-direction: column; gap: 16px; }
.s2-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 2px 2px 0; }
.s2-hi { font-size: 24px; font-weight: 800; color: var(--tx); letter-spacing: .01em; }
.s2-streak { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 700; color: #C8621B; background: rgba(242,154,58,.14); border-radius: 999px; padding: 6px 12px; }
.s2-streak svg { width: 15px; height: 15px; }

.s2-hero { position: relative; overflow: hidden; border-radius: 26px; padding: 22px 22px 20px; color: #fff;
  background: linear-gradient(160deg, #3F78D0 0%, #2A5CAA 55%, #1F4685 100%); box-shadow: 0 14px 34px rgba(31,70,133,.28); }
.s2-hero.done { background: linear-gradient(160deg, #3FA37A 0%, #2B8562 60%, #1E6A4D 100%); box-shadow: 0 14px 34px rgba(30,106,77,.26); }
.s2-hero-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.s2-hero-k { font-size: 13px; font-weight: 700; opacity: .88; letter-spacing: .04em; }
.s2-dots { display: inline-flex; gap: 6px; }
.s2-dots i { width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,.32); }
.s2-dots i.on { background: #fff; }
.s2-hero-t { font-size: 34px; font-weight: 800; line-height: 1.25; margin: 18px 100px 6px 0; word-break: keep-all; overflow-wrap: anywhere; }
.s2-hero-m { font-size: 15px; line-height: 1.6; opacity: .92; margin-right: 100px; min-height: 48px; }
.s2-hero-tg { position: absolute; right: 14px; top: 58px; width: 92px; height: 92px; object-fit: contain; filter: drop-shadow(0 6px 10px rgba(0,0,0,.18)); }
.s2-go { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin-top: 20px; padding: 17px 16px; border: none; border-radius: 18px;
  background: #fff; color: #1F4685; font-size: 18px; font-weight: 800; font-family: inherit; cursor: pointer; box-shadow: 0 5px 0 rgba(0,0,0,.16); -webkit-tap-highlight-color: transparent; }
.s2-hero.done .s2-go { color: #1E6A4D; }
.s2-go:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0,0,0,.16); }
.s2-go svg { width: 18px; height: 18px; }
.s2-hero-f { font-size: 12.5px; text-align: center; opacity: .82; margin-top: 14px; }

/* 一列一件事 */
.s2-row { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 15px 16px; border: 1px solid var(--line); border-radius: 18px;
  background: var(--bg2); color: var(--tx); font-family: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.s2-row-ic { flex: 0 0 42px; height: 42px; border-radius: 13px; background: var(--ac-soft); color: var(--ac); display: flex; align-items: center; justify-content: center; font-size: 19px; font-weight: 700; }
.s2-row-ic svg { width: 21px; height: 21px; }
.s2-row-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.s2-row-tx b { font-size: 15.5px; font-weight: 700; }
.s2-row-tx small { font-size: 13px; color: var(--tx2); line-height: 1.5; }
.s2-row-ch { color: var(--tx3); font-size: 22px; line-height: 1; }

.s2-prog { padding: 4px 4px 0; }
.s2-prog-h { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--tx2); margin-bottom: 2px; }
.s2-switch { align-self: center; background: none; border: none; color: var(--tx3); font-size: 12.5px; font-family: inherit; text-decoration: underline; text-underline-offset: 3px; padding: 10px; cursor: pointer; margin-top: 4px; }

/* 探索 */
.s2-h { font-size: 24px; font-weight: 800; margin: 2px 2px 0; }
.s2-lead { font-size: 14px; color: var(--tx2); margin: -8px 2px 0; }
.s2-grp { display: flex; flex-direction: column; gap: 8px; }
.s2-grp-h { font-size: 12.5px; font-weight: 700; color: var(--tx2); letter-spacing: .08em; padding: 4px 4px 0; }
.s2-list { border: 1px solid var(--line); border-radius: 18px; background: var(--bg2); overflow: hidden; }
.s2-row.in { border: none; border-radius: 0; border-bottom: 1px solid var(--line); background: none; padding: 14px 16px; }
.s2-row.in:last-child { border-bottom: none; }

/* 上課：全螢幕專心模式 */
html.ui2 body.s2-lesson .hd,
html.ui2 body.s2-lesson .bnav,
html.ui2 body.s2-lesson .levels,
html.ui2 body.s2-lesson .ft,
html.ui2 body.s2-lesson footer { display: none !important; }
html.ui2 body.s2-lesson .wrap { padding-top: calc(env(safe-area-inset-top) + 18px); padding-bottom: calc(28px + env(safe-area-inset-bottom)); }
html.ui2 body.s2-lesson .kr-lesson-card { border-radius: 22px; padding: 22px 20px; }
html.ui2 body.s2-lesson .kr-submit { position: sticky; bottom: calc(14px + env(safe-area-inset-bottom)); margin-top: 16px; padding: 16px; font-size: 17px; font-weight: 800; border-radius: 16px; box-shadow: 0 8px 22px rgba(0,0,0,.14); z-index: 5; }

.s2-word { text-align: center; cursor: pointer; padding-top: 26px !important; padding-bottom: 26px !important; }
.s2-word-w { font-size: 52px; font-weight: 800; line-height: 1.25; margin: 26px 0 10px; color: var(--tx); word-break: keep-all; overflow-wrap: anywhere; }
.s2-word-p { font-size: 14px; color: var(--tx2); min-height: 22px; }
.s2-word-m { font-size: 22px; font-weight: 700; margin: 18px 0 0; }
.s2-word-ex { font-size: 14.5px; line-height: 1.8; color: var(--tx2); background: var(--bg3); border-radius: 14px; padding: 13px 14px; margin: 22px 0 0; text-align: left; }
.s2-word-ex [lang="ko"] { color: var(--tx); font-size: 16px; }
.s2-word-say { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--tx3); margin-top: 20px; }
.s2-word-say svg { width: 15px; height: 15px; }

/* 上課時主按鈕固定在畫面底部（結果頁除外），一個畫面一顆主按鈕 */
html.ui2 body.s2-lesson:not([data-step="result"]) .wrap { padding-bottom: calc(110px + env(safe-area-inset-bottom)); }
html.ui2 body.s2-lesson:not([data-step="result"]) .kr-submit { position: fixed; left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); width: auto; max-width: 528px; margin: 0 auto; z-index: 130; }
html.ui2 body.s2-lesson:not([data-step="result"])::after { content: ""; position: fixed; left: 0; right: 0; bottom: 0; height: calc(96px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg) 62%, transparent); z-index: 125; pointer-events: none; }
html.ui2 body.s2-lesson[data-step="result"] .kr-lesson-card .btn { margin-top: 12px !important; }
/* 一個主色：進度條、小標都跟主色走 */
html.ui2 body.s2-lesson .kr-path-bar i { background: var(--ac); }
html.ui2 body.s2-lesson .kr-lesson-k { color: var(--ac); }
html.ui2 body.s2-lesson #priceNotice, html.ui2 body.s2-lesson .pn-card { display: none !important; }

/* 句型第一頁：只有句型、意思、一個例句 */
.s2-gram .kr-lesson-pat { margin-top: 18px; }
.s2-gram-m { font-size: 18px; font-weight: 700; line-height: 1.6; margin: 10px 0 0; color: var(--tx); }
.s2-gram-eg { margin-top: 24px; background: var(--bg3); border-radius: 16px; padding: 4px 14px; }
.s2-gram-eg .kr-lesson-eg { border: none; }
.s2-gram .kr-gp { margin-top: 14px; }
.s2-gram .kr-form { margin-top: 14px; }

/* 課前短劇：上面一格場景，下面一張台詞卡，底部一顆主按鈕 */
.s2-skit { display: flex; flex-direction: column; gap: 14px; }
.s2-stage { position: relative; aspect-ratio: 1 / 0.86; border-radius: 22px; overflow: hidden; background-size: cover; background-position: center 30%; border: 1px solid var(--line); }
.s2-stage::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 34%; background: linear-gradient(to top, rgba(0,0,0,.22), transparent); pointer-events: none; }
.s2-ep { position: absolute; left: 12px; top: 12px; z-index: 2; background: rgba(0,0,0,.5); color: #fff; font-size: 12px; font-weight: 700; padding: 5px 11px; border-radius: 999px; letter-spacing: .04em; }
.s2-ch { position: absolute; bottom: 3%; width: 46%; height: auto; z-index: 1; transition: transform .25s var(--ease, ease), filter .25s, opacity .25s; filter: drop-shadow(0 6px 8px rgba(0,0,0,.22)); }
.s2-ch.l { left: 3%; transform-origin: bottom left; }
.s2-ch.r { right: 3%; transform-origin: bottom right; }
.s2-ch.c { left: 50%; width: 34%; bottom: 20%; transform: translateX(-50%); }
.s2-ch.dim { transform: scale(.86); filter: brightness(.82) drop-shadow(0 4px 6px rgba(0,0,0,.18)); }
.s2-cap { background: var(--bg2); border: 1px solid var(--line); border-radius: 20px; padding: 18px 18px 20px; }
.s2-cap.say { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.s2-cap-t { font-size: 22px; font-weight: 800; color: var(--tx); }
.s2-cap-d { font-size: 15px; line-height: 1.75; color: var(--tx2); margin: 8px 0 0; }
.s2-cap-who { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; font-weight: 700; color: var(--ac); letter-spacing: .04em; }
.s2-cap.say.j .s2-cap-who { color: var(--ac2); }
.s2-cap-vol { display: inline-flex; width: 30px; height: 30px; border-radius: 50%; background: var(--ac-soft); color: var(--ac); align-items: center; justify-content: center; }
.s2-cap-vol svg { width: 16px; height: 16px; }
.s2-cap-ko { font-size: 25px; font-weight: 800; line-height: 1.45; color: var(--tx); margin: 8px 0 6px; word-break: keep-all; overflow-wrap: anywhere; }
.s2-cap-m { font-size: 15px; color: var(--tx2); line-height: 1.6; }
.s2-cap-key { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 5px; }
.s2-cap-key small { font-size: 12.5px; color: var(--tx2); }
.s2-cap-key b { font-size: 24px; font-weight: 800; color: var(--tx); }
.s2-skdots { display: flex; justify-content: center; gap: 7px; padding-top: 2px; }
.s2-skdots i { width: 8px; height: 8px; border-radius: 50%; background: var(--bg3); border: 1px solid var(--line); }
.s2-skdots i.on { background: var(--ac); border-color: var(--ac); }
.s2-skip { display: block; margin: 0 auto; background: none; border: none; color: var(--tx3); font-size: 13px; font-family: inherit; text-decoration: underline; text-underline-offset: 3px; padding: 12px; cursor: pointer; position: fixed; left: 0; right: 0; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 131; }
html.ui2 body.s2-lesson[data-step="skit"] .wrap { padding-bottom: calc(150px + env(safe-area-inset-bottom)); }
html.ui2 body.s2-lesson[data-step="skit"]::after { height: calc(140px + env(safe-area-inset-bottom)); }

/* ── 短劇動畫播放器（skitplay.js）── */
.sp { display: flex; flex-direction: column; gap: 14px; }
.sp-stage { position: relative; aspect-ratio: 1 / 1.12; border-radius: 24px; overflow: hidden; background: #F3E3CC; border: 1px solid var(--line); cursor: pointer; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }
.sp-cam { position: absolute; inset: 0; transform-origin: 50% 70%; transition: transform .7s cubic-bezier(.3,.7,.3,1); will-change: transform; }
.sp-cam[data-at="t"] { transform: scale(1.14) translate(5%, -1%); }
.sp-cam[data-at="j"] { transform: scale(1.14) translate(-5%, -1%); }
.sp-bg { position: absolute; left: -6%; top: -4%; width: 112%; height: 108%; object-fit: cover; object-position: 50% 60%; animation: spDrift 16s ease-in-out infinite alternate; }
@keyframes spDrift { from { transform: translateX(-1.6%); } to { transform: translateX(1.6%); } }
.sp-ch { position: absolute; bottom: 7%; height: 52%; aspect-ratio: 522 / 640; transition: transform 1.7s linear, opacity .3s; }
.sp-t { left: 4%; }
.sp-j { right: 3%; height: 54%; aspect-ratio: 504 / 640; }
.sp-t.off-l { transform: translateX(-150%); transition: none; }
.sp-body { position: absolute; inset: 0; transform-origin: 50% 100%; animation: spBreath 2.8s ease-in-out infinite; }
.sp-j .sp-body { animation-delay: -1.3s; }
.sp-body img { position: absolute; right: 0; bottom: 0; height: 100%; width: auto; max-width: none; opacity: 0; pointer-events: none; filter: drop-shadow(0 5px 6px rgba(60,30,10,.2)); }
.sp-body img.on { opacity: 1; }
@keyframes spBreath { 0%,100% { transform: scale(1, 1); } 50% { transform: scale(.988, 1.022); } }
.sp-ch.walking .sp-body { animation: spWalk .34s ease-in-out infinite; }
@keyframes spWalk { 0%,100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-5%) rotate(3deg); } }
.sp-ch.talking .sp-body { animation: spTalk .42s ease-in-out infinite; }
@keyframes spTalk { 0%,100% { transform: scale(1, 1) rotate(0); } 50% { transform: scale(.985, 1.03) rotate(-1.2deg); } }
.sp-body.hop { animation: spHop .42s cubic-bezier(.3,.6,.4,1) !important; }
@keyframes spHop { 0% { transform: translateY(0) scale(1, 1); } 22% { transform: translateY(0) scale(1.06, .93); } 55% { transform: translateY(-9%) scale(.97, 1.05); } 100% { transform: translateY(0) scale(1, 1); } }
.sp-body.pop { animation: spPop .3s ease-out !important; }
@keyframes spPop { 0% { transform: scale(.93, 1.06); } 60% { transform: scale(1.04, .97); } 100% { transform: scale(1, 1); } }
.sp-shadow { position: absolute; left: 12%; right: 12%; bottom: -2.5%; height: 7%; border-radius: 50%; background: rgba(70,40,20,.2); filter: blur(3px); }
.sp-emo { position: absolute; top: -4%; left: 62%; min-width: 34px; height: 34px; padding: 0 8px; border-radius: 999px; background: #fff; color: #E4583B; font-size: 21px; font-weight: 900; line-height: 34px; text-align: center; box-shadow: 0 3px 8px rgba(0,0,0,.18); opacity: 0; transform: scale(.3); pointer-events: none; }
.sp-j .sp-emo { left: auto; right: 62%; }
.sp-emo.on { animation: spEmo 1.5s ease-out forwards; }
@keyframes spEmo { 0% { opacity: 0; transform: scale(.3) translateY(10px); } 14% { opacity: 1; transform: scale(1.18) translateY(0); } 24% { transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: scale(1) translateY(-8px); } }
.sp.paused .sp-body, .sp.paused .sp-bg, .sp.paused .sp-emo { animation-play-state: paused !important; }
.sp-ep { position: absolute; left: 12px; top: 12px; z-index: 3; background: rgba(0,0,0,.5); color: #fff; font-size: 12px; font-weight: 700; padding: 5px 11px; border-radius: 999px; letter-spacing: .04em; }
.sp-paused { position: absolute; left: 50%; top: 40%; width: 64px; height: 64px; margin: -32px 0 0 -32px; border-radius: 50%; background: rgba(0,0,0,.5); color: #fff; display: none; align-items: center; justify-content: center; z-index: 4; }
.sp-paused svg { width: 28px; height: 28px; }
.sp.paused .sp-paused { display: flex; }
.sp-sub { position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 3; background: rgba(22,22,26,.78); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); color: #fff; border-radius: 16px; padding: 11px 14px 13px; text-align: center; opacity: 0; transform: translateY(8px); pointer-events: none; }
.sp-sub.on { animation: spSub .28s ease-out forwards; }
@keyframes spSub { to { opacity: 1; transform: none; } }
.sp-sub-who { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; color: #FFC46B; }
.sp-sub-who.j { color: #9CC8FF; }
.sp-sub-ko { font-size: 21px; font-weight: 800; line-height: 1.4; margin: 3px 0 2px; word-break: keep-all; overflow-wrap: anywhere; }
.sp-sub-m { font-size: 13.5px; opacity: .86; line-height: 1.5; }
.sp-dots { display: flex; justify-content: center; gap: 7px; }
.sp-dots i { width: 22px; height: 5px; border-radius: 999px; background: var(--bg3); transition: background .3s; }
.sp-dots i.on { background: var(--ac); opacity: .45; }
.sp-dots i.cur { background: var(--ac); }
.sp-info { background: var(--bg2); border: 1px solid var(--line); border-radius: 20px; padding: 16px 18px 18px; }
.sp-info-t { font-size: 21px; font-weight: 800; color: var(--tx); }
.sp-info-d { font-size: 15px; line-height: 1.75; color: var(--tx2); margin: 6px 0 0; }
.sp-info-key { margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 5px; }
.sp-info-key small { font-size: 12.5px; color: var(--tx2); }
.sp-info-key b { font-size: 23px; font-weight: 800; color: var(--tx); }
.s2-skip.sp-skip { bottom: calc(18px + env(safe-area-inset-bottom)); }
html.ui2 body.s2-lesson[data-step="skitplay"] .wrap { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
html.ui2 body.s2-lesson[data-step="skitplay"]::after { height: calc(60px + env(safe-area-inset-bottom)); }

/* 字幕放在場景下面（放場景裡會蓋住角色） */
.sp-sub { position: static; background: var(--bg2); border: 1px solid var(--line); color: var(--tx); backdrop-filter: none; -webkit-backdrop-filter: none; border-radius: 20px; padding: 14px 16px 16px; min-height: 108px; }
.sp-sub:empty { display: none; }
.sp-sub-who { color: #C8621B; font-size: 12.5px; }
.sp-sub-who.j { color: var(--ac); }
.sp-sub-ko { font-size: 24px; margin: 6px 0 4px; color: var(--tx); }
.sp-sub-m { font-size: 15px; color: var(--tx2); opacity: 1; }
.sp-cam[data-at="t"] { transform: scale(1.08) translate(3%, -1%); }
.sp-cam[data-at="j"] { transform: scale(1.08) translate(-3%, -1%); }

/* 場景高度跟著螢幕縮：字幕、句型卡、主按鈕不用往下滑就看得到（11/25 Mia 在大螢幕上看不到句子） */
.sp-stage { width: min(100%, calc((100dvh - 372px) / 1.12)); min-width: 200px; margin: 0 auto; }
@supports not (height: 100dvh) { .sp-stage { width: min(100%, calc((100vh - 372px) / 1.12)); } }
.sp-sub { min-height: 104px; }

/* 短劇：背景音樂開關 */
.sp-bgm { position: absolute; right: 12px; top: 10px; z-index: 3; width: 34px; height: 34px; border-radius: 50%; border: none; background: rgba(0,0,0,.5); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; -webkit-tap-highlight-color: transparent; }
.sp-bgm svg { width: 17px; height: 17px; }
.sp-bgm.off { opacity: .55; }
.sp-bgm.off::after { content: ""; position: absolute; left: 7px; right: 7px; top: 50%; height: 2px; background: #fff; transform: rotate(-45deg); border-radius: 2px; }

/* 短劇多集：同角色所有姿勢同一個裁切框（一樣大），第三個角色站後面中間 */
.sp-t { aspect-ratio: 562 / 640; left: 0; height: 52%; }
.sp-j { aspect-ratio: 599 / 640; right: -3%; height: 54%; }
.sp-body img { left: 0; right: auto; width: 100%; height: 100%; }
.sp-x { aspect-ratio: 389 / 640; height: 40%; left: 50%; bottom: 20%; margin-left: -13%; transition: transform 1.05s linear, opacity .3s; }
.sp-x.off-r { transform: translateX(260%); transition: none; }
.sp-x { height: 38%; bottom: 27%; margin-left: -12%; }
.sp-t { aspect-ratio: 601 / 640; }   /* 虎虎裁切框加寬（舉錢包的姿勢），跟 images/skit/v2/sizes.json 一致 */
.sp-t { aspect-ratio: 601 / 640; }
.sp-j { aspect-ratio: 624 / 640; }
.sp-x { aspect-ratio: 389 / 640; }
.sp-x .sp-emo { left: 60%; }
.sp-sub-who.b { color: #8A5FBF; }
/* 兔子老師講話時往前站一步，不然被喳喳擋住 */
.sp-x.talking { z-index: 5; transform: translateY(14%) scale(1.22); transition: transform .28s ease-out; }
.sp-x { transition: transform .5s ease-out, opacity .3s; }
.sp-x.walking, .sp-x.off-r { transition: transform 1.05s linear; }
.sp-x.off-r { transition: none; }

/* 完整版介面裡的短劇：頂列跟底部分頁都還在，場景再矮一點；按鈕不固定在底部 */
html:not(.ui2) .sp-stage { width: min(100%, calc((100dvh - 470px) / 1.12), 440px); }
html:not(.ui2) #spAct { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
html:not(.ui2) #spAct .kr-submit { width: 100%; }
html:not(.ui2) #spAct .s2-skip { position: static; margin: 0 auto; }
html:not(.ui2) .sp { max-width: 560px; margin: 0 auto; }
