.social-classroom {
  --primary: #14749c;
  --primary-dark: #106187;
  --primary-light: #e4f2ff;
  --ink: #263f34;
  --ink-light: #58685d;
  background: #faf6e9;
  font-family: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  height: 100dvh;
  min-height: 0;
}

.social-classroom :is(button, select) { font-family: inherit; }
.social-classroom :is(button, a, select, [tabindex]):focus-visible { outline: 3px solid #146278; outline-offset: 3px; }
.classroom-skip-link { position: fixed; top: 8px; left: 16px; padding: 12px; background: white; color: #194735; transform: translateY(-160%); z-index: 10000; }
.classroom-skip-link:focus { transform: none; }
.social-classroom .classroom-header { display: grid; grid-template-columns: auto minmax(0, 1fr) 230px; gap: 12px 24px; padding: 14px 24px; background: #fffdf7; border-bottom: 1px solid #a9b99d; box-shadow: none; backdrop-filter: none; flex-shrink: 0; }
.classroom-brand { display: flex; align-items: center; gap: 10px; color: #285d4b; text-decoration: none; }
.classroom-brand img { flex-shrink: 0; }
.classroom-brand strong { display: block; font-size: 1rem; letter-spacing: .02em; }
.classroom-brand small { display: block; font-size: .72rem; line-height: 1.7; color: #58685d; }
.classroom-brand b { color: #865616; font-weight: 700; }
.social-classroom .lesson-info { min-width: 0; display: block; }
.social-classroom .lesson-day-badge { display: inline-block; padding: 2px 9px; border-radius: 6px; background: #ffedb1; border: 1px solid #d3b269; color: #68491d; box-shadow: none; font-size: .75rem; }
.social-classroom .lesson-title-text { max-width: none; margin: 5px 0 0; font-size: .97rem; color: #263f34; }
.classroom-course-picker { min-width: 0; font-size: .72rem; font-weight: 700; color: #58685d; }
.social-classroom .date-selector-select { display: block; width: 100%; max-width: none; min-height: 36px; border: 1px solid #8ca683; border-radius: 8px; box-shadow: none; background: #edf3e7; color: #284f3b; margin-top: 4px; }
.social-classroom .classroom-controls { grid-column: 1 / -1; align-items: stretch; justify-content: flex-start; gap: 10px; min-width: 0; }
.social-classroom .classroom-controls .c-btn { font-size: .75rem; }
.social-classroom .classroom-controls .star-toggle-btn { gap: 3px; font-size: .7rem; }
.social-classroom .c-btn { min-height: 38px; border-radius: 8px; border-width: 1px; box-shadow: 0 2px 0 #c9d2c3; padding: 6px 10px; font-weight: 700; }
.social-classroom .c-btn:hover { transform: translateY(-1px); }
.social-classroom .c-btn:active { transform: translateY(1px); }

.social-classroom .classroom-tool { background: var(--tool-bg); color: var(--tool-ink, white); border-color: var(--tool-edge); box-shadow: 0 2px 0 var(--tool-edge); gap: 6px; }
.social-classroom .classroom-tool:hover { background: var(--tool-bg); filter: brightness(1.07); }
.tool-icon { width: 28px; height: 28px; flex-shrink: 0; }
.tool-calm { --tool-bg: #087650; --tool-edge: #06563a; }
.tool-whiteboard { --tool-bg: #f5b23e; --tool-edge: #b67c24; --tool-ink: #482e0c; }
.tool-communication { --tool-bg: #6541bd; --tool-edge: #482c8c; }
.tool-island { --tool-bg: #087997; --tool-edge: #07576d; }
.tool-worksheet { --tool-bg: #ffedb1; --tool-edge: #bc974a; --tool-ink: #68491d; }
.tool-prep { --tool-bg: #ffe0d2; --tool-edge: #bd8168; --tool-ink: #803f2c; }
.social-classroom .students-star-widget { margin: 0; }
.social-classroom .students-bar { border: 1px solid #bca15b; border-radius: 12px; background: #fffdf7; max-height: min(480px, 70dvh); overflow-y: auto; }
.social-classroom .c-btn-primary { background: #285d4b; border-color: #194735; box-shadow: 0 3px 0 #194735; }
.social-classroom .c-btn-primary:hover { background: #194735; }
.social-classroom .c-btn-accent { background: #ffedb1; color: #68491d; border-color: #bc974a; box-shadow: 0 2px 0 #bc974a; }
.social-classroom .slide-viewport { padding: 18px 76px; overflow: hidden; }
.social-classroom .slide-canvas { width: min(1280px, 100%); height: 100%; min-height: 0; border: 2px solid #b9c5aa; border-radius: 18px; box-shadow: 0 5px 0 #d7dbc5; }
.social-classroom .washi-tape-strip { display: none; }
.social-classroom .slide-top { gap: 12px; padding: 12px 16px; background: #fffdf7; border-bottom: 1px solid #d7dbc5; }
.social-classroom .slide-step-indicator { flex: 1; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 9px; min-width: 0; }
.social-classroom .step-dot { display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 48px; padding: 6px 8px; border: 1px solid var(--step-edge); border-radius: 10px; background: var(--step-bg); color: var(--step-ink); box-shadow: 0 2px 0 var(--step-edge); font-size: .85rem; line-height: 1.4; font-weight: 700; }
.step-dot:nth-child(1) { --step-bg: #e4f2ff; --step-edge: #86afd1; --step-ink: #225777; --step-active: #14749c; }
.step-dot:nth-child(2) { --step-bg: #fff0c9; --step-edge: #cba15c; --step-ink: #775012; --step-active: #8b5c12; }
.step-dot:nth-child(3) { --step-bg: #eee6fc; --step-edge: #ac95d3; --step-ink: #59378a; --step-active: #6541bd; }
.step-dot:nth-child(5) { --step-bg: #dff4ed; --step-edge: #7cb6a3; --step-ink: #245f4c; --step-active: #087650; }
.step-dot:nth-child(6) { --step-bg: #ffe4d7; --step-edge: #d09a7c; --step-ink: #844429; --step-active: #a14f2c; }
.social-classroom .step-dot.active { background: var(--step-active); color: white; border-color: var(--step-active); box-shadow: 0 3px 0 var(--step-edge); }
.step-number { width: 25px; height: 25px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; background: #ffffffd9; color: var(--step-ink); font-size: .8rem; }
.step-label { display: flex; flex-direction: column; text-align: left; }
.step-label small { font-size: .63rem; font-weight: 600; opacity: .9; }
.social-classroom .slide-time-tag { display: none; }
.social-classroom .slide-content { background: #fffcf4; padding: 18px 24px 24px; scroll-behavior: auto; }
.social-classroom .slide-bottom { background: #fffdf7; border-top: 1px solid #d7dbc5; }
.social-classroom .nav-hint { font-size: .75rem; font-weight: 500; color: #58685d; }
.social-classroom .slide-nav-btn { width: 44px; height: 52px; border: 1px solid #9aaf91; border-radius: 12px; color: #285d4b; background: #edf3e7; box-shadow: 0 3px 0 #b9c5aa; }
.social-classroom .slide-nav-btn:hover { background: #285d4b; color: white; }
.social-classroom .slide-prev { left: 16px; }
.social-classroom .slide-next { right: 16px; }
.social-classroom .story-wrapper { border-color: #cba878; border-radius: 16px; box-shadow: 0 3px 0 #ecdfc6; }
.classroom-companion { display: inline-block; width: 44px; height: 54px; vertical-align: middle; flex-shrink: 0; }
.social-classroom .pill-avatar { width: 42px; height: 48px; display: flex; align-items: center; justify-content: center; }
.social-classroom .pill-avatar .classroom-companion { width: 36px; height: 45px; }
.social-classroom .rp-card { border-radius: 14px; box-shadow: 0 3px 0 #dedfcf; }
.social-classroom .rp-card-header { gap: 8px; padding: 10px; }
.social-classroom .rp-student-tag { border-radius: 10px; }
.social-classroom .rp-student-tag .classroom-companion { width: 32px; height: 40px; }
.social-classroom .student-score-card { border: 2px solid var(--companion-edge); background: var(--companion-bg); border-radius: 16px; box-shadow: 0 4px 0 var(--companion-edge); }
.student-score-card[data-companion="yu"] { --companion-bg: #e4f2ff; --companion-edge: #86afd1; }
.student-score-card[data-companion="he"] { --companion-bg: #dff4ed; --companion-edge: #7cb6a3; }
.student-score-card[data-companion="jia"] { --companion-bg: #fff0c9; --companion-edge: #cba15c; }
.student-score-card[data-companion="jun"] { --companion-bg: #eee6fc; --companion-edge: #ac95d3; }
.social-classroom .card-name-plate { display: flex; align-items: center; justify-content: center; gap: 12px; background: none; color: #263f34; border: none; }
.social-classroom .card-name-plate .classroom-companion { width: 66px; height: 82px; }
.social-classroom .game-container { border-color: #b9c5aa; border-radius: 16px; box-shadow: 0 3px 0 #d7dbc5; }
.social-classroom #decisionCardImpulsive { background: #fff1ea; border: 3px solid #d99c89; }
.social-classroom #decisionCardSuper { background: #eaf5df; border: 3px solid #8bad77; }
.social-classroom #decisionFeedbackBox { box-sizing: border-box; }
body.social-classroom.simulated-fullscreen .slide-viewport { height: auto !important; max-height: none !important; }
body.social-classroom.simulated-fullscreen .slide-canvas { max-height: none !important; }

@media (max-width: 1100px) {
  .social-classroom .classroom-header { grid-template-columns: auto minmax(0, 1fr); gap: 12px 18px; padding: 12px 18px; }
  .classroom-course-picker { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; }
  .classroom-course-picker > span { flex-shrink: 0; }
  .social-classroom .date-selector-select { margin: 0; }
  .social-classroom .slide-viewport { padding: 14px 60px; }
  .social-classroom .slide-top { padding: 10px; }
  .social-classroom .step-dot { gap: 5px; font-size: .78rem; padding: 6px; }
  .social-classroom .slide-prev { left: 7px; }
  .social-classroom .slide-next { right: 7px; }
}

@media (max-width: 700px) {
  .social-classroom { height: auto; min-height: 100dvh; }
  .social-classroom .classroom-header { display: flex; flex-direction: column; align-items: stretch; padding: 14px; }
  .classroom-brand { padding-bottom: 10px; border-bottom: 1px solid #d7dbc5; }
  .social-classroom .lesson-title-text { white-space: normal; line-height: 1.6; }
  .social-classroom .classroom-controls { display: grid; grid-template-columns: 1fr; gap: 8px; }
  .social-classroom .classroom-controls > * { min-width: 0; width: 100%; box-sizing: border-box; }
  .social-classroom .classroom-controls .c-btn { min-height: 44px; justify-content: center; font-size: .77rem; padding: 5px; }
  .social-classroom .students-star-widget { margin: 0; }
  .social-classroom .students-bar { width: min(295px, calc(100vw - 40px)); }
  .social-classroom .classroom-controls .c-icon-btn { border-radius: 8px; }
  .social-classroom .slide-viewport { padding: 10px 10px 76px; overflow: visible; display: block; }
  .social-classroom .slide-canvas { width: 100%; height: auto; min-height: 520px; }
  .social-classroom .slide-step-indicator { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 5px; }
  .social-classroom .step-dot { flex-direction: column; gap: 4px; font-size: .72rem; padding: 6px 3px; }
  .step-label { text-align: center; }
  .step-label small { display: none; }
  .social-classroom .slide-top { position: sticky; top: 0; padding: 8px; }
  .social-classroom .slide-content { padding: 12px 10px 18px; overflow: visible; }
  .social-classroom .slide-bottom { padding: 10px; }
  .social-classroom .slide-nav-btn { position: fixed; top: auto; bottom: 14px; transform: none; width: 48px; height: 48px; z-index: 25; }
  .social-classroom .slide-nav-btn:hover { transform: none; }
  .social-classroom .slide-prev { left: 18px; }
  .social-classroom .slide-next { right: 18px; }
  .social-classroom .rp-grid { grid-template-columns: 1fr; }
  .social-classroom .rp-header-banner { flex-direction: column; }
  .social-classroom .student-scoreboard { grid-template-columns: 1fr; }
  .social-classroom .game-master-wrapper > div:first-child { width: 100%; }
  .social-classroom .game-master-wrapper > div:first-child .c-btn { white-space: normal; width: 100%; font-size: .85rem !important; }
  .social-classroom #decisionCardImpulsive, .social-classroom #decisionCardSuper { padding: 14px !important; min-width: 0; }
  .social-classroom #decisionCardImpulsive > div:first-child, .social-classroom #decisionCardSuper > div:first-child { flex-wrap: wrap; }
  .social-classroom .game-container:has(#decisionCardImpulsive) > div:has(> #decisionCardImpulsive) { grid-template-columns: 1fr !important; }
  .social-classroom .story-wrapper { padding: 14px !important; }
  .social-classroom .radar-screen { max-width: 100%; box-sizing: border-box; }
}

@media (prefers-reduced-motion: reduce) {
  .social-classroom *, .social-classroom *::before, .social-classroom *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* 按上課流程分組；常用工具直接可見，閱讀設定按需展開。 */
.classroom-tool-group { min-width: 0; padding: 7px 9px 9px; border: 1px solid #d5dfcb; border-radius: 12px; background: #f2f5eb; }
.tool-group-label { display: block; margin-bottom: 6px; font-size: .7rem; font-weight: 700; line-height: 1.3; color: #52674d; }
.tool-group-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.tools-support { margin-left: auto; background: #fffdf7; }
.social-classroom .classroom-controls .c-btn { min-height: 44px; line-height: 1.4; text-align: center; }
.social-classroom .classroom-controls .tool-icon { width: 26px; height: 26px; }
.social-classroom .classroom-controls .c-icon-btn { width: auto; height: auto; padding: 6px 10px; gap: 6px; }
.social-classroom .classroom-controls .c-icon-btn::after { content: "全螢幕"; }
.classroom-reading-menu { position: relative; }
.classroom-reading-menu > summary { display: flex; gap: 8px; list-style: none; cursor: pointer; }
.classroom-reading-menu > summary::-webkit-details-marker { display: none; }
.classroom-reading-menu[open] > summary { background: #e4f2ff; border-color: #14749c; }
.classroom-reading-panel { position: absolute; left: 0; top: calc(100% + 10px); z-index: 300; display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 10px; width: 340px; max-width: calc(100vw - 40px); padding: 14px; background: #fffdf7; border: 1px solid #8ca683; border-radius: 12px; box-shadow: 0 8px 24px #293f3424; }
.reading-panel-title { grid-column: 1 / -1; font-size: .85rem; font-weight: 700; color: #285d4b; }
.classroom-reading-panel #zhuyinToggleBtn { grid-column: 1 / -1; }
.reading-speed-label { font-size: .8rem; color: #52674d; }
.classroom-reading-panel .c-btn { justify-content: center; white-space: normal; }
@media (max-width: 1100px) {
  .social-classroom .classroom-controls { display: grid; grid-template-columns: 1fr 1fr; }
  .tools-support { margin: 0; }
}
@media (max-width: 700px) {
  .social-classroom .classroom-controls { grid-template-columns: 1fr; }
  .tool-group-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .tools-present .tool-group-actions { grid-template-columns: 1fr 1fr 1fr; }
  .classroom-reading-panel { left: auto; right: 0; }
  .social-classroom .classroom-reading-panel .c-btn { min-height: 44px; }
}

.step-dot:nth-child(4) { --step-bg:#fff4d7; --step-edge:#c8ad63; --step-ink:#705920; --step-active:#8c6d25; }

/* 六步流程：分頁具有編號、說明與選取狀態。 */
.game-master-wrapper { width: 100%; min-width: 0; }
.game-master-wrapper .game-container { margin-left: auto; margin-right: auto; box-sizing: border-box; }
.game-tabs-hint { margin: 0 0 8px; color: #58685d; font-size: .85rem; }
.game-practice-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.game-practice-tab { display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 94px; padding: 12px; border: 2px solid #b8c9bc; border-radius: 14px; background: #fff; color: #294b3c; box-shadow: 0 3px 0 #dce3d5; text-align: left; cursor: pointer; }
.game-practice-tab:hover { background: #f0f7ed; border-color: #6c9978; }
.game-practice-tab[aria-selected="true"] { background: #fff0bc; border-color: #a9771d; box-shadow: 0 3px 0 #cba15c; color: #68491d; }
.game-tab-number { display: grid; place-items: center; flex-shrink: 0; width: 32px; height: 32px; border-radius: 50%; background: #e9f1e7; font-size: 1rem; font-weight: 800; }
[aria-selected="true"] > .game-tab-number { background: #805c1c; color: white; }
.game-tab-copy { flex: 1; min-width: 0; }
.game-tab-copy strong { display: block; font-size: clamp(.85rem, 1.3vw, 1.05rem); line-height: 1.5; }
.game-tab-copy small { display: block; margin-top: 4px; font-size: .75rem; line-height: 1.4; }
.game-tab-state { align-self: flex-end; flex-shrink: 0; font-size: .65rem; font-weight: 700; }
.class-island-entry { max-width: 720px; margin: 0 auto; padding: 30px 16px; line-height: 1.7; }
.class-island-entry h2 { font-size: 1.4rem; }
.class-island-entry .c-btn { display: inline-flex; margin-top: 12px; white-space: normal; }
.social-classroom .worksheet-slide { padding: 10px; align-items: stretch; overflow: hidden; }
.class-worksheet-intro { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-shrink: 0; text-align: left; font-size: .8rem; line-height: 1.5; }
.class-worksheet-intro p { margin: 0; }
.class-worksheet-intro .c-btn { flex-shrink: 0; }
.class-worksheet-frame { display: block; width: 100%; min-height: 180px; flex: 1; margin-top: 8px; border: 1px solid #c9d5bc; border-radius: 10px; background: #fffdf7; }

/* 星星與回饋紀錄採用同一種 −／分數／＋ 操作。 */
.award-scoreboard { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; width: min(920px, 100%); }
.award-actions { display: flex; justify-content: center; gap: 12px; margin-top: 16px; flex-wrap: wrap; max-width: 100%; }
.award-actions .c-btn { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.award-score-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; border: 2px solid var(--companion-edge); border-left-width: 6px; border-radius: 16px; background: var(--companion-bg); }
.award-score-row[data-companion="yu"] { --companion-bg: #e4f2ff; --companion-edge: #86afd1; }
.award-score-row[data-companion="he"] { --companion-bg: #dff4ed; --companion-edge: #7cb6a3; }
.award-score-row[data-companion="jia"] { --companion-bg: #fff0c9; --companion-edge: #cba15c; }
.award-score-row[data-companion="jun"] { --companion-bg: #eee6fc; --companion-edge: #ac95d3; }
.award-student-name { display: flex; align-items: center; gap: 12px; font-size: 1.6rem; color: #263f34; }
.award-score-controls { display: flex; align-items: center; gap: 10px; }
.award-score-adjust { display: grid; place-items: center; flex-shrink: 0; width: 44px; height: 44px; padding: 0; border-radius: 50%; font-size: 1.8rem; font-weight: 800; line-height: 1; cursor: pointer; box-shadow: 0 3px 0 #0002; }
.award-minus { background: white; color: #cf343b; border: 2px solid #ff9fa7; }
.award-plus { background: #f5a000; color: white; border: 2px solid #bd7900; }
.award-score-adjust:hover { filter: brightness(.95); }
.award-score-adjust:active { transform: translateY(2px); box-shadow: none; }
.award-score-value { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 88px; padding: 7px 10px; box-sizing: border-box; border: 2px solid #f5d856; border-radius: 30px; background: #fff7bc; color: #75480f; font-size: 1.3rem; font-weight: 800; transition: transform .2s; }
.award-slide .lesson-reflection { margin: 0 0 10px; padding: 8px 16px; font-size: .8rem; }
.award-slide .lesson-reflection h2 { font-size: 1.05rem; }
.award-slide .lesson-reflection p { margin: 3px 0; }
.award-slide .lesson-reflection .c-btn { min-height: 32px; font-size: .75rem; }
.award-slide .slide-title { font-size: 1.35rem; }
.award-slide .slide-subtitle { margin: 2px 0 12px; font-size: .85rem; }
@media (min-width: 701px) {
  .award-slide .lesson-reflection { display: grid; grid-template-columns: 1fr auto; column-gap: 16px; width: min(920px, 100%); box-sizing: border-box; text-align: left; }
  .award-slide .lesson-reflection > :is(h2, p) { grid-column: 1; }
  .award-slide .lesson-reflection .c-btn { grid-column: 2; grid-row: 1 / 4; align-self: center; }
}
@media (max-width: 1100px) {
  .game-practice-tab { flex-wrap: wrap; padding: 10px; gap: 6px; }
  .game-tab-state { width: 100%; text-align: right; }
  .award-score-row { padding: 8px 10px; gap: 6px; }
  .award-student-name { gap: 5px; font-size: 1.3rem; }
  .award-score-controls { gap: 6px; }
  .award-score-value { min-width: 74px; }
}
@media (max-width: 700px) {
  .social-classroom .slide-step-indicator { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .step-label small { display: block; }
  .game-practice-tabs { grid-template-columns: 1fr; gap: 8px; }
  .game-practice-tab { min-height: 70px; flex-wrap: nowrap; }
  .game-tab-state { width: auto; }
  .game-tab-copy strong { font-size: .85rem; }
  .class-worksheet-intro { flex-wrap: wrap; }
  .class-worksheet-frame { flex: none; height: 70dvh; min-height: 400px; }
  .award-scoreboard { grid-template-columns: 1fr; }
  .award-score-controls { gap: 8px; }
  .award-score-value { min-width: 76px; }
  .award-student-name .classroom-companion { width: 36px; height: 46px; }
  html[lang="en"] .award-student-name { flex-direction: column; gap: 0; font-size: .9rem; }
  html[lang="en"] .award-score-controls { gap: 6px; }
  html[lang="en"] .award-score-value { min-width: 70px; }
}
