/* ==========================================================================
   Puti-AI Classroomscreen - Design System & Styles
   Aesthetic: Puti Warm Web UI (日系暖心美學 / 莫蘭迪粉彩 / 大圓角柔和陰影)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Zen+Maru+Gothic:wght@400;500;700;900&family=Outfit:wght@400;600;700;800&display=swap');

:root {
  /* Warm Theme Palette */
  --bg-body: #FFFDF9;
  --bg-card: rgba(255, 255, 255, 0.92);
  --bg-card-header: rgba(255, 250, 242, 0.95);
  --primary: #FF9F1C;
  --primary-hover: #F28E0B;
  --primary-light: #FFE8CC;
  --secondary: #FFBF69;
  --accent: #2EC4B6;
  --accent-pink: #FF85A1;
  --accent-purple: #9A8CFF;
  --accent-blue: #4EA8DE;
  --accent-green: #52B788;
  --text: #2D3748;
  --text-muted: #718096;
  --border-subtle: rgba(230, 220, 205, 0.6);
  --shadow-sm: 0 4px 12px rgba(45, 55, 72, 0.06);
  --shadow-md: 0 10px 25px rgba(45, 55, 72, 0.08);
  --shadow-lg: 0 20px 45px rgba(45, 55, 72, 0.14);
  --shadow-active: 0 22px 50px rgba(255, 159, 28, 0.22);
  --radius-sm: 14px;
  --radius-md: 22px;
  --radius-lg: 28px;
  --radius-pill: 9999px;
  --font-main: 'Zen Maru Gothic', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-num: 'Outfit', 'Roboto Mono', 'SF Mono', Consolas, Monaco, monospace;
  --blur-glass: blur(18px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

input, textarea, [contenteditable="true"] {
  user-select: text;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-body);
  color: var(--text);
  line-height: 1.6;
  letter-spacing: 0.03em;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  position: relative;
}

/* Background Wallpaper Layer */
#desktop-wallpaper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  transition: filter 0.3s ease, background-image 0.5s ease-in-out;
  z-index: 0;
}

.wallpaper-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, rgba(255,255,255,0.08) 0%, rgba(0,0,0,0.18) 100%);
  pointer-events: none;
  z-index: 1;
}

/* Window Canvas Desktop Area */
#desktop-canvas {
  position: absolute;
  top: 60px;
  left: 0;
  right: 0;
  bottom: 84px;
  overflow: hidden;
  z-index: 2;
  pointer-events: auto;
}

/* Top App Bar */
.top-bar {
  position: absolute;
  top: 12px;
  left: 16px;
  right: 16px;
  height: 52px;
  background: var(--bg-card);
  backdrop-filter: var(--blur-glass);
  -webkit-backdrop-filter: var(--blur-glass);
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  z-index: 100;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo-icon {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, #FF9F1C, #FFBF69);
  color: #FFF;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  box-shadow: 0 4px 10px rgba(255, 159, 28, 0.3);
}

.brand-title {
  font-weight: 900;
  font-size: 1.15rem;
  color: var(--text);
  letter-spacing: 0.05em;
}

.brand-title span {
  color: var(--primary);
}

.badge-tag {
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
}

.ticker-section {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px dashed var(--secondary);
  border-radius: var(--radius-pill);
  padding: 4px 16px;
  max-width: 450px;
  cursor: text;
}

.ticker-icon {
  color: var(--primary);
  font-size: 0.9rem;
}

.ticker-text {
  font-size: 0.92rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  outline: none;
  font-weight: 500;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-btn {
  background: #FFF;
  border: 1px solid var(--border-subtle);
  color: var(--text);
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  font-size: 0.88rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.top-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--secondary);
  transform: translateY(-2px);
}

.top-btn.icon-only {
  width: 36px;
  padding: 0;
  justify-content: center;
}

/* Bottom Floating Dock */
.bottom-dock-container {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.bottom-dock {
  background: var(--bg-card);
  backdrop-filter: var(--blur-glass);
  -webkit-backdrop-filter: var(--blur-glass);
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  max-width: 95vw;
  overflow-x: auto;
  scrollbar-width: none;
}

.bottom-dock::-webkit-scrollbar {
  display: none;
}

.dock-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  height: 56px;
  padding: 4px 6px;
  border-radius: 18px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

.dock-item i {
  font-size: 1.35rem;
  margin-bottom: 2px;
  transition: transform 0.2s ease;
}

.dock-item span {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.dock-item:hover {
  background: rgba(255, 255, 255, 0.95);
  transform: translateY(-6px) scale(1.12);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.1);
  color: var(--primary);
}

.dock-item:active {
  transform: translateY(-2px) scale(1.05);
}

.dock-divider {
  width: 1px;
  height: 32px;
  background: rgba(0, 0, 0, 0.1);
  margin: 0 4px;
}

/* Floating Window System */
.floating-window {
  position: absolute;
  background: var(--bg-card);
  backdrop-filter: var(--blur-glass);
  -webkit-backdrop-filter: var(--blur-glass);
  border-radius: var(--radius-lg);
  border: 2px solid rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  min-width: 260px;
  min-height: 180px;
  transition: box-shadow 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
  user-select: none;
  touch-action: none;
}

.floating-window.active {
  box-shadow: var(--shadow-active);
  border-color: var(--secondary);
}

.window-header {
  height: 48px;
  padding: 0 16px;
  background: var(--bg-card-header);
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: grab;
}

.window-header:active {
  cursor: grabbing;
}

.window-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.96rem;
  color: var(--text);
}

.window-title-icon {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.88rem;
  background: #FFF;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.window-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.win-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: #FFF;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.win-btn:hover {
  transform: scale(1.1);
  color: #FFF;
}

.win-btn.btn-min:hover { background: #FFB703; }
.win-btn.btn-max:hover { background: #2EC4B6; }
.win-btn.btn-close:hover { background: #E63946; }

.window-body {
  flex: 1;
  padding: 16px;
  overflow: auto;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Resize Handle */
.resize-handle {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 18px;
  height: 18px;
  cursor: nwse-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--secondary);
  font-size: 0.7rem;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

.resize-handle:hover {
  opacity: 1;
}

/* ==========================================================================
   Widget 1: Traffic Light (紅綠燈)
   ========================================================================== */
.traffic-light-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  height: 100%;
  justify-content: center;
}

.traffic-box {
  background: #2D3748;
  padding: 16px 18px;
  border-radius: 36px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: inset 0 4px 10px rgba(0,0,0,0.4), 0 8px 20px rgba(0,0,0,0.15);
}

.traffic-light-container.horizontal .traffic-box {
  flex-direction: row;
}

.traffic-lamp {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #4A5568;
  cursor: pointer;
  position: relative;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: inset 0 3px 8px rgba(0,0,0,0.6);
  border: 3px solid #1A202C;
}

.traffic-lamp:hover {
  transform: scale(1.08);
}

.traffic-lamp.red.on {
  background: #FF4757;
  box-shadow: 0 0 25px #FF4757, 0 0 50px rgba(255, 71, 87, 0.5), inset 0 2px 6px #FFF;
}

.traffic-lamp.yellow.on {
  background: #FFA502;
  box-shadow: 0 0 25px #FFA502, 0 0 50px rgba(255, 165, 2, 0.5), inset 0 2px 6px #FFF;
}

.traffic-lamp.green.on {
  background: #2ED573;
  box-shadow: 0 0 25px #2ED573, 0 0 50px rgba(46, 213, 115, 0.5), inset 0 2px 6px #FFF;
}

.traffic-status-text {
  font-size: 1.15rem;
  font-weight: 800;
  text-align: center;
  color: var(--text);
  padding: 6px 18px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.85);
  box-shadow: var(--shadow-sm);
  letter-spacing: 0.05em;
}

/* ==========================================================================
   Widget 2: Work Symbols (工作符號)
   ========================================================================== */
.work-symbols-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
  justify-content: center;
}

.symbol-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.symbol-card {
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.symbol-card:hover {
  transform: translateY(-3px) scale(1.03);
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.symbol-card.active {
  background: linear-gradient(135deg, rgba(255, 159, 28, 0.15), rgba(255, 191, 105, 0.25));
  border-color: var(--primary);
  box-shadow: 0 8px 22px rgba(255, 159, 28, 0.25);
}

.symbol-icon-wrapper {
  font-size: 2rem;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.symbol-name {
  font-weight: 800;
  font-size: 0.96rem;
  color: var(--text);
}

.symbol-desc {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ==========================================================================
   Widget 3: Random Picker (幸運抽籤)
   ========================================================================== */
.picker-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
}

.picker-display {
  flex: 1;
  background: linear-gradient(135deg, #FFF6E5, #FFFDF8);
  border-radius: var(--radius-md);
  border: 2px dashed var(--secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  position: relative;
  overflow: hidden;
}

.picker-result {
  font-family: var(--font-num);
  font-size: 3.4rem;
  font-weight: 800;
  color: var(--primary);
  text-shadow: 0 3px 10px rgba(255, 159, 28, 0.25);
  transition: transform 0.15s ease;
}

.picker-subtext {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

.picker-options-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.82rem;
}

.picker-btn-grid {
  display: flex;
  gap: 8px;
}

.action-btn-main {
  flex: 1;
  height: 44px;
  background: linear-gradient(135deg, #FF9F1C, #FF7B00);
  color: #FFF;
  border: none;
  border-radius: var(--radius-pill);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 6px 16px rgba(255, 159, 28, 0.35);
  transition: all 0.2s ease;
}

.action-btn-main:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(255, 159, 28, 0.45);
}

.action-btn-main:active {
  transform: translateY(0);
}

.action-btn-secondary {
  height: 44px;
  padding: 0 16px;
  background: #FFF;
  color: var(--text);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.action-btn-secondary:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.picker-history-badge {
  font-size: 0.76rem;
  color: var(--text-muted);
  background: rgba(0,0,0,0.04);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ==========================================================================
   Widget 4: Timer & Stopwatch (多功能計時器)
   ========================================================================== */
.timer-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  height: 100%;
  justify-content: space-between;
}

.timer-mode-switcher {
  display: flex;
  background: #F0EDE6;
  padding: 3px;
  border-radius: var(--radius-pill);
  gap: 4px;
}

.timer-mode-btn {
  border: none;
  background: transparent;
  padding: 4px 14px;
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: var(--radius-pill);
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.timer-mode-btn.active {
  background: #FFF;
  color: var(--primary);
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.timer-circle-wrap {
  position: relative;
  width: 170px;
  height: 170px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.timer-svg {
  transform: rotate(-90deg);
  width: 170px;
  height: 170px;
}

.timer-bg-circle {
  fill: none;
  stroke: #F0EDE6;
  stroke-width: 10;
}

.timer-progress-circle {
  fill: none;
  stroke: var(--primary);
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.25s linear, stroke 0.3s ease;
}

.timer-digits-overlay {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.timer-digits {
  font-family: var(--font-num);
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

.timer-millis {
  font-family: var(--font-num);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-top: -6px;
}

.timer-preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.preset-chip {
  background: #FFF;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 3px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
}

.preset-chip:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--secondary);
}

.timer-controls-row {
  display: flex;
  gap: 10px;
  width: 100%;
}

/* ==========================================================================
   Widget 5: Whiteboard / Canvas (塗鴉白板)
   ========================================================================== */
.whiteboard-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  gap: 8px;
}

.whiteboard-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.9);
  padding: 6px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  gap: 6px;
}

.wb-color-palette {
  display: flex;
  gap: 6px;
}

.color-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid #FFF;
  box-shadow: 0 2px 5px rgba(0,0,0,0.15);
  transition: transform 0.15s ease;
}

.color-dot:hover {
  transform: scale(1.2);
}

.color-dot.active {
  outline: 2px solid var(--primary);
  transform: scale(1.2);
}

.wb-tools-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.wb-btn {
  background: #FFF;
  border: 1px solid var(--border-subtle);
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text);
  font-size: 0.8rem;
  transition: all 0.15s ease;
}

.wb-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.wb-btn.active {
  background: var(--primary);
  color: #FFF;
}

.canvas-wrapper {
  flex: 1;
  background: #FFF;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.04);
  position: relative;
  overflow: hidden;
}

.canvas-wrapper.theme-blackboard {
  background: #203A2B;
}

.canvas-wrapper.theme-grid {
  background-image: linear-gradient(rgba(0,0,0,0.06) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(0,0,0,0.06) 1px, transparent 1px);
  background-size: 20px 20px;
}

#wb-canvas {
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}

/* ==========================================================================
   Widget 6: Sticky Notes (便利貼)
   ========================================================================== */
.sticky-container {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sticky-palette-row {
  display: flex;
  gap: 6px;
}

.sticky-color-btn {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  cursor: pointer;
  border: 1px solid rgba(0,0,0,0.1);
}

.sticky-textarea {
  flex: 1;
  width: 100%;
  border: none;
  background: transparent;
  resize: none;
  outline: none;
  font-family: var(--font-main);
  font-size: 1.15rem;
  line-height: 1.7;
  color: #332C2B;
}

/* ==========================================================================
   Widget 7: Sound Meter (音量分貝監測)
   ========================================================================== */
.sound-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  height: 100%;
  justify-content: center;
}

.sound-meter-bar-outer {
  width: 100%;
  height: 32px;
  background: #E2E8F0;
  border-radius: var(--radius-pill);
  overflow: hidden;
  padding: 4px;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.1);
  position: relative;
}

.sound-meter-bar-fill {
  height: 100%;
  width: 10%;
  background: linear-gradient(90deg, #52B788 0%, #FFA502 70%, #FF4757 100%);
  border-radius: var(--radius-pill);
  transition: width 0.08s ease;
}

.sound-threshold-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  background: #FF4757;
  z-index: 2;
  box-shadow: 0 0 6px #FF4757;
}

.sound-status-display {
  font-size: 1.1rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sound-warning-badge {
  display: none;
  background: #FF4757;
  color: #FFF;
  padding: 4px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.88rem;
  font-weight: 800;
  animation: pulseWarning 0.6s infinite alternate;
}

@keyframes pulseWarning {
  from { transform: scale(1); opacity: 0.9; }
  to { transform: scale(1.08); opacity: 1; }
}

/* ==========================================================================
   Widget 8: Clock & Calendar (時鐘與日曆)
   ========================================================================== */
.clock-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 6px;
}

.clock-time {
  font-family: var(--font-num);
  font-size: 3.2rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}

.clock-date {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary);
}

.clock-extra {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ==========================================================================
   Widget 9: Dice & Coin (骰子與硬幣)
   ========================================================================== */
.dice-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  gap: 12px;
}

.dice-display-area {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex: 1;
}

.dice-cube {
  width: 72px;
  height: 72px;
  background: #FFF;
  border: 3px solid #E2E8F0;
  border-radius: 18px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.1), inset 0 2px 4px rgba(255,255,255,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
  color: var(--primary);
  font-family: var(--font-num);
  font-weight: 900;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.dice-cube.rolling {
  animation: diceRoll 0.4s ease-in-out infinite alternate;
}

@keyframes diceRoll {
  0% { transform: rotate(-15deg) scale(0.9); }
  100% { transform: rotate(15deg) scale(1.1); }
}

/* ==========================================================================
   Widget 10: Group Maker (隨機分組器)
   ========================================================================== */
.groups-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  gap: 10px;
}

.groups-result-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  overflow-y: auto;
  padding: 4px;
}

.group-card {
  background: #FFF;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px;
  box-shadow: var(--shadow-sm);
}

.group-card-header {
  font-weight: 800;
  font-size: 0.88rem;
  color: var(--primary);
  border-bottom: 1px dashed var(--secondary);
  padding-bottom: 4px;
  margin-bottom: 6px;
}

.group-member-list {
  font-size: 0.82rem;
  color: var(--text);
  line-height: 1.5;
}

/* ==========================================================================
   Modal Dialogs (桌布切換 / 名單設定 / 說明)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(45, 55, 72, 0.45);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.modal-backdrop.show {
  display: flex;
  opacity: 1;
}

.modal-box {
  background: #FFF;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 580px;
  max-height: 85vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 24px;
  transform: translateY(20px) scale(0.95);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-backdrop.show .modal-box {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.wallpaper-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.wallpaper-thumb {
  height: 95px;
  border-radius: var(--radius-sm);
  background-size: cover;
  background-position: center;
  cursor: pointer;
  border: 3px solid transparent;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.wallpaper-thumb:hover {
  transform: scale(1.04);
  box-shadow: var(--shadow-md);
}

.wallpaper-thumb.active {
  border-color: var(--primary);
  box-shadow: 0 0 14px rgba(255, 159, 28, 0.4);
}

.wallpaper-thumb span {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.55);
  color: #FFF;
  font-size: 0.72rem;
  text-align: center;
  padding: 2px;
  backdrop-filter: blur(4px);
}

/* ==========================================================================
   Mandatory Footer Copyright Area
   ========================================================================== */
.app-footer-copyright {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
  padding: 4px 10px;
  font-size: 0.76rem;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
  z-index: 90;
  pointer-events: auto;
  background: linear-gradient(to top, rgba(0,0,0,0.45) 0%, transparent 100%);
}

.app-footer-copyright a {
  color: #FFD166;
  font-weight: 800;
  text-decoration: none;
  margin-left: 4px;
}

.app-footer-copyright a:hover {
  text-decoration: underline;
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-width: 768px) {
  .top-bar {
    top: 6px;
    left: 8px;
    right: 8px;
    height: 46px;
    padding: 0 12px;
  }
  .ticker-section {
    display: none;
  }
  .bottom-dock {
    padding: 6px 10px;
    gap: 4px;
  }
  .dock-item {
    min-width: 46px;
    height: 48px;
  }
  .dock-item i {
    font-size: 1.15rem;
  }
  .dock-item span {
    font-size: 0.65rem;
  }
  .floating-window {
    min-width: 240px;
  }
}

/* ==========================================================================
   Desktop Canvas: Hide All Windows (淨空桌面)
   ========================================================================== */
#desktop-canvas.hide-all-windows .floating-window {
  opacity: 0 !important;
  pointer-events: none !important;
  transform: scale(0.94) !important;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

/* ==========================================================================
   26 Widgets Library Modal (更多工具抽屜)
   ========================================================================== */
.modal-box.modal-box-large {
  max-width: 960px;
  width: 94%;
  height: 85vh;
  padding: 24px 28px;
}

.widget-lib-filter-bar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #F7F5F0;
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 8px 18px;
  transition: all 0.2s ease;
}

.search-box:focus-within {
  border-color: var(--primary);
  background: #FFF;
  box-shadow: 0 0 0 3px rgba(255, 159, 28, 0.15);
}

.search-box i {
  color: var(--primary);
  font-size: 1rem;
}

.search-box input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-family: var(--font-main);
  font-size: 0.95rem;
  color: var(--text);
}

.category-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.cat-pill {
  border: 1px solid var(--border-subtle);
  background: #FFF;
  color: var(--text);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.cat-pill:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.cat-pill.active {
  background: var(--primary);
  color: #FFF;
  border-color: var(--primary);
  box-shadow: 0 4px 10px rgba(255, 159, 28, 0.3);
}

.widget-lib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  overflow-y: auto;
  padding-right: 4px;
}

.widget-card-item {
  background: #FFF;
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.widget-card-item:hover {
  transform: translateY(-4px);
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.widget-card-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.widget-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  box-shadow: 0 4px 10px rgba(0,0,0,0.06);
}

.widget-card-badge {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: rgba(0,0,0,0.05);
  color: var(--text-muted);
}

.widget-card-title {
  font-weight: 800;
  font-size: 1rem;
  color: var(--text);
  margin-top: 4px;
}

.widget-card-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* ==========================================================================
   New Widgets: Visual Timer (視覺沙漏計時器)
   ========================================================================== */
.visual-timer-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  height: 100%;
  justify-content: space-between;
}

.visual-pie-wrap {
  position: relative;
  width: 170px;
  height: 170px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#vt-canvas {
  width: 170px;
  height: 170px;
}

/* ==========================================================================
   New Widgets: Scoreboard (小組記分板)
   ========================================================================== */
.scoreboard-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  gap: 12px;
}

.scoreboard-teams-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 10px;
  overflow-y: auto;
}

.team-score-card {
  background: #FFF;
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.team-score-card.leading {
  border-color: #FFA502;
  box-shadow: 0 4px 16px rgba(255, 165, 2, 0.25);
}

.team-name {
  font-weight: 800;
  font-size: 0.88rem;
  color: var(--text);
  text-align: center;
  outline: none;
}

.team-points {
  font-family: var(--font-num);
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--primary);
  line-height: 1;
}

.team-ctrl-row {
  display: flex;
  gap: 6px;
}

.point-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #F0EDE6;
  font-weight: 900;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.point-btn:hover {
  background: var(--primary);
  color: #FFF;
}

/* ==========================================================================
   New Widgets: Poll (課堂即時投票)
   ========================================================================== */
.poll-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
}

.poll-question-input {
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  font-weight: 700;
  font-size: 0.95rem;
  outline: none;
}

.poll-options-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.poll-opt-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.poll-opt-btn {
  background: #FFF;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.88rem;
  transition: all 0.15s ease;
}

.poll-opt-btn:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.poll-bar-outer {
  height: 10px;
  background: #EAE5DE;
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.poll-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #FF9F1C, #2EC4B6);
  border-radius: var(--radius-pill);
  transition: width 0.3s ease;
}

/* ==========================================================================
   New Widgets: Rock-Paper-Scissors (猜拳)
   ========================================================================== */
.rps-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 14px;
}

.rps-display-card {
  width: 110px;
  height: 110px;
  border-radius: 26px;
  background: #FFF;
  border: 3px solid var(--secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
  box-shadow: var(--shadow-md);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.rps-display-card.rolling {
  animation: rpsShake 0.3s infinite alternate;
}

@keyframes rpsShake {
  0% { transform: scale(0.9) rotate(-10deg); }
  100% { transform: scale(1.1) rotate(10deg); }
}

/* ==========================================================================
   New Widgets: QR Code & Hyperlinks
   ========================================================================== */
.qrcode-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  gap: 10px;
}

.qrcode-box {
  background: #FFF;
  padding: 12px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.hyperlink-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  height: 100%;
  align-content: start;
}

.hyperlink-card {
  background: #FFF;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.hyperlink-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   New Widgets: Video & Web Embed & Webcam
   ========================================================================== */
.video-container, .embed-container, .webcam-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  gap: 8px;
}

.media-frame-wrapper {
  flex: 1;
  background: #000;
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
}

.media-frame-wrapper iframe, .media-frame-wrapper video, .media-frame-wrapper embed {
  width: 100%;
  height: 100%;
  border: none;
  object-fit: cover;
}

/* ==========================================================================
   New Widgets: Ambient Sounds (專注環境音)
   ========================================================================== */
.ambient-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  height: 100%;
  align-content: start;
}

.ambient-btn {
  background: #FFF;
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.86rem;
  transition: all 0.2s ease;
}

.ambient-btn:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.ambient-btn.active {
  background: linear-gradient(135deg, rgba(255, 159, 28, 0.2), rgba(255, 191, 105, 0.3));
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 4px 12px rgba(255, 159, 28, 0.25);
}

/* ==========================================================================
   New Widgets: Visual Schedule / Agenda (作息時間表)
   ========================================================================== */
.agenda-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  gap: 8px;
}

.agenda-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
}

.agenda-item {
  background: #FFF;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 600;
}

.agenda-item.done {
  opacity: 0.55;
  text-decoration: line-through;
  background: #F0EDE6;
}

.agenda-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

/* ==========================================================================
   New Widgets: Electronic Stickers (獎勵貼紙)
   ========================================================================== */
.stickers-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 6px;
}

.sticker-badge {
  font-size: 2.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 60px;
  background: #FFF;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.2s ease;
}

.sticker-badge:hover {
  transform: scale(1.2);
  box-shadow: var(--shadow-sm);
}

@keyframes stampBounce {
  0% { transform: scale(0.2) rotate(-15deg); opacity: 0; }
  60% { transform: scale(1.15) rotate(5deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* ==========================================================================
   Font Scale Controls (通用字級放大縮小控制列)
   ========================================================================== */
.font-scale-controls {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: #F0EDE6;
  padding: 2px 6px;
  border-radius: var(--radius-pill);
}

.font-scale-btn {
  border: none;
  background: transparent;
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 8px;
  font-size: 0.8rem;
  transition: all 0.15s ease;
}

.font-scale-btn:hover {
  background: #FFF;
  color: var(--primary);
}

/* ==========================================================================
   Exquisite Giant 3D Dice & 3D Gold Coin (巨大精緻立體骰子與金幣)
   ========================================================================== */
.dice-display-area-giant {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 12px 0;
  min-height: 140px;
  perspective: 800px;
}

/* Realistic Ivory 3D Die */
.die-face-3d {
  width: 108px;
  height: 108px;
  background: linear-gradient(145deg, #FFFFFF, #F0ECE4);
  border-radius: 26px;
  border: 3px solid #E2DCD2;
  box-shadow: 0 16px 30px rgba(0,0,0,0.12), inset 0 3px 6px rgba(255,255,255,0.9), inset 0 -4px 8px rgba(0,0,0,0.06);
  display: grid;
  padding: 14px;
  position: relative;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.die-face-3d.rolling {
  animation: diceRoll3D 0.35s ease-in-out infinite alternate;
}

@keyframes diceRoll3D {
  0% { transform: rotate3d(1, 1, 0, -25deg) scale(0.92); }
  100% { transform: rotate3d(1, 1, 0, 25deg) scale(1.08); }
}

/* Pip Dot Layouts */
.pip {
  display: block;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #2D3748;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.6), 0 1px 2px rgba(255,255,255,0.8);
  justify-self: center;
  align-self: center;
}

.pip.red {
  background: #E63946;
  width: 32px;
  height: 32px;
  box-shadow: inset 0 2px 5px rgba(0,0,0,0.5), 0 1px 3px rgba(255,255,255,0.8);
}

.die-pips-1 {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
}

.die-pips-2 {
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
}
.die-pips-2 .pip:nth-child(2) { grid-column: 2; grid-row: 2; }

.die-pips-3 {
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
}
.die-pips-3 .pip:nth-child(1) { grid-column: 1; grid-row: 1; }
.die-pips-3 .pip:nth-child(2) { grid-column: 2; grid-row: 2; }
.die-pips-3 .pip:nth-child(3) { grid-column: 3; grid-row: 3; }

.die-pips-4 {
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
}

.die-pips-5 {
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
}
.die-pips-5 .pip:nth-child(1) { grid-column: 1; grid-row: 1; }
.die-pips-5 .pip:nth-child(2) { grid-column: 3; grid-row: 1; }
.die-pips-5 .pip:nth-child(3) { grid-column: 2; grid-row: 2; }
.die-pips-5 .pip:nth-child(4) { grid-column: 1; grid-row: 3; }
.die-pips-5 .pip:nth-child(5) { grid-column: 3; grid-row: 3; }

.die-pips-6 {
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(3, 1fr);
}

/* Gleaming 3D Gold Coin */
.gold-coin-3d {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #FFF275 0%, #FFD166 40%, #E09F3E 80%, #9E6B1F 100%);
  border: 5px solid #FFBE0B;
  box-shadow: 0 16px 32px rgba(224, 159, 62, 0.4), inset 0 4px 8px rgba(255,255,255,0.7), inset 0 -6px 12px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #7A4900;
  font-family: var(--font-num);
  font-size: 2.2rem;
  font-weight: 900;
  text-shadow: 0 1px 2px rgba(255,255,255,0.6), 0 -1px 2px rgba(0,0,0,0.3);
  transition: transform 0.2s ease;
  user-select: none;
}

.gold-coin-3d.flipping {
  animation: coinFlip3D 0.4s ease-in-out infinite alternate;
}

@keyframes coinFlip3D {
  0% { transform: rotateY(0deg) scale(0.9); }
  50% { transform: rotateY(90deg) scale(1.1); }
  100% { transform: rotateY(180deg) scale(0.9); }
}

/* ==========================================================================
   Classroom Homework & Contact Book (家庭聯絡簿)
   ========================================================================== */
.homework-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  gap: 10px;
  background: #FFFDF9;
}

.hw-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--secondary);
  padding-bottom: 8px;
}

.hw-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 900;
  font-size: 1.15rem;
  color: var(--primary);
}

.hw-list-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  padding-right: 4px;
}

.hw-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #FFF;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}

.hw-subject-badge {
  font-size: 0.8rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  min-width: 52px;
  text-align: center;
}

.hw-content-input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-family: var(--font-main);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}

.hw-memo-box {
  border: 2px dashed var(--secondary);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  background: #FFF9F0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ==========================================================================
   Classroom Quick Buzzer System (課堂搶答神器)
   ========================================================================== */
.buzzer-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.buzzer-status-banner {
  width: 100%;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  text-align: center;
  font-weight: 800;
  font-size: 1.05rem;
  background: #F0EDE6;
  color: var(--text);
  transition: all 0.2s ease;
}

.buzzer-status-banner.winner {
  background: linear-gradient(135deg, #2EC4B6, #20A498);
  color: #FFF;
  box-shadow: 0 6px 20px rgba(46, 196, 182, 0.4);
  animation: pulseWinner 0.6s infinite alternate;
}

@keyframes pulseWinner {
  from { transform: scale(1); }
  to { transform: scale(1.03); }
}

.buzzer-teams-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  width: 100%;
  flex: 1;
}

.team-buzz-card {
  background: #FFF;
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: var(--shadow-sm);
}

.team-buzz-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
}

.team-buzz-card.locked {
  opacity: 0.4;
  pointer-events: none;
}

.team-buzz-card.won {
  background: linear-gradient(135deg, #FFE8CC, #FFD8A8);
  border-color: #FF9F1C;
  box-shadow: 0 8px 24px rgba(255, 159, 28, 0.35);
  transform: scale(1.06);
}

.team-buzz-key-badge {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: #EDF2F7;
  color: #718096;
}

/* ==========================================================================
   Giant QR Code Lightbox Modal (巨幅投影掃描彈窗)
   ========================================================================== */
.qr-lightbox-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(10px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
}

.qr-lightbox-backdrop.show {
  display: flex;
}

.qr-lightbox-box {
  background: #FFF;
  border-radius: 32px;
  padding: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  box-shadow: 0 25px 60px rgba(0,0,0,0.4);
  max-width: 90vw;
}

/* ==========================================================================
   Global Screen Scale for Interactive Touchscreens (大螢幕全域字級階梯)
   ========================================================================== */
/* ==========================================================================
   Full Screen Scale Hierarchy for Smartboards (75~86 inch)
   ========================================================================== */
html[data-screen-scale="default"] { font-size: 16px; }
html[data-screen-scale="medium"]  { font-size: 20px; }
html[data-screen-scale="large"]   { font-size: 24px; }
html[data-screen-scale="huge"]    { font-size: 28px; }

html[data-screen-scale="medium"] .floating-window,
html[data-screen-scale="large"] .floating-window,
html[data-screen-scale="huge"] .floating-window {
  font-size: 1rem;
}

html[data-screen-scale="medium"] .win-title,
html[data-screen-scale="large"] .win-title,
html[data-screen-scale="huge"] .win-title {
  font-size: 1rem;
}

html[data-screen-scale="medium"] .scale-btn.active,
html[data-screen-scale="large"] .scale-btn.active,
html[data-screen-scale="huge"] .scale-btn.active {
  background: var(--primary) !important;
  color: #FFF !important;
  font-weight: 900 !important;
  box-shadow: 0 2px 6px rgba(255, 123, 0, 0.3);
}

/* ==========================================================================
   Quick Snippet Tags Bar in Homework (聯絡簿常用詞庫膠囊)
   ========================================================================== */
.hw-quick-tags-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px;
  background: #FFF9DB;
  border-radius: 10px;
  border: 1px dashed #FFE066;
}

.hw-tag-chip {
  background: #FFF;
  border: 1.5px solid #FFD43B;
  color: #D9480F;
  font-size: 0.82rem;
  font-weight: 800;
  padding: 4px 11px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.hw-tag-chip:hover {
  background: #FFE066;
  color: #C92A2A;
  border-color: #FCC419;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(217, 72, 15, 0.2);
}

.hw-tag-chip:active {
  transform: translateY(1px);
}


/* ==========================================================================
   Individual Score Counter (個人計分器)
   ========================================================================== */
.tally-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.08);
  border-color: #FFD8A8 !important;
}

.tally-plus-btn:hover {
  background: #F76707 !important;
}

.tally-minus-btn:hover {
  background: #E9ECEF !important;
}

/* ==========================================================================
   Class Timetable (班級功課表)
   ========================================================================== */
.tt-sub-chip {
  background: #FFF;
  border: 1px solid #CED4DA;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.76rem;
  font-weight: 800;
  color: #495057;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tt-sub-chip:hover {
  background: #E7F5FF;
  border-color: #74C0FC;
  color: #1971C2;
}

.tt-sub-chip.active {
  background: #FF922B !important;
  border-color: #F76707 !important;
  color: #FFF !important;
  box-shadow: 0 2px 6px rgba(255, 146, 43, 0.35);
}

.tt-cell:hover .tt-subject-badge {
  background: #FFE8CC !important;
  color: #D9480F !important;
  transform: scale(1.04);
}


/* ==========================================================================
   Tabular Numbers (解決時間數字字體跳動抖動問題)
   ========================================================================== */
.clock-time,
.timer-time-display,
.visual-timer-time,
.stopwatch-time,
.tally-score,
.time-num,
[data-tabular-num] {
  font-family: var(--font-num) !important;
  font-variant-numeric: tabular-nums !important;
  font-feature-settings: "tnum" 1 !important;
  letter-spacing: 0.04em !important;
  display: inline-block !important;
  text-align: center !important;
}

/* Ensure modal-backdrop is safely on top of all floating windows */
.modal-backdrop {
  z-index: 10005 !important;
}

#roster-modal .modal-box {
  background: #FFF;
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.2);
}
