* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body, html {
  width: 100%;
  height: 100%;
  background-color: #121212;
  color: #ffffff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ==========================================
   1. 頂部功能導覽列
   ========================================== */
.top-nav {
  height: 60px;
  background-color: #1f1f1f;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  border-bottom: 2px solid #333333;
}

.top-nav .nav-group {
  display: flex;
  gap: 12px;
}

.nav-btn {
  padding: 10px 20px;
  font-size: 1.1rem;
  background-color: #333333;
  color: #cccccc;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
}

.nav-btn.active {
  background-color: #0066cc;
  color: #ffffff;
}

.nav-btn.btn-announce {
  background-color: #e65100;
  color: #ffffff;
}

.clock-display {
  font-size: 1.3rem;
  font-weight: bold;
  color: #00ffcc;
  font-family: monospace;
}

/* ==========================================
   2. 中央主作業區 (平板優化)
   ========================================== */
.main-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  gap: 20px;
  position: relative;
}

.camera-box {
  position: relative;
  width: 360px;
  height: 270px;
  background-color: #000000;
  border-radius: 12px;
  overflow: hidden;
  border: 3px solid #444444;
}

video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

canvas {
  display: none;
}

#module-stage {
  width: 100%;
  max-width: 500px;
  display: flex;
  justify-content: center;
}

/* ==========================================
   3. 全螢幕公告彈窗 (修正：蓋滿螢幕與文字對比)
   ========================================== */
.modal-overlay {
  display: none;             /* 預設隱藏 */
  position: fixed;           /* 強制覆蓋全螢幕 */
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: #121212;
  color: #ffffff;
  z-index: 9999;             /* 置頂最上層 */
  flex-direction: column;
  padding: 24px;
  box-sizing: border-box;
}

.announce-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 2px solid #333333;
  margin-bottom: 20px;
}

.announce-header h2 {
  font-size: 1.8rem;
  color: #ff9800;
  margin: 0;
}

.back-btn {
  padding: 12px 28px;
  font-size: 1.3rem;
  font-weight: bold;
  background-color: #0066cc;
  color: #ffffff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
}

.announce-body {
  flex: 1;
  background-color: #2a2a2a;
  color: #ffffff !important;
  padding: 24px;
  border-radius: 12px;
  font-size: 1.5rem;
  line-height: 1.8;
  overflow-y: auto;
  border: 1px solid #444444;
}

.announce-body * {
  color: #ffffff !important;
}

/* ==========================================
   4. 打卡成功 Toast 彈窗 (修正：預設隱藏 + 懸浮)
   ========================================== */
.toast-popup {
  display: none;             /* 🔥 修正：預設隱藏，打卡成功時才跳出 */
  position: fixed;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: rgba(0, 200, 83, 0.95);
  color: #ffffff;
  padding: 20px 40px;
  border-radius: 16px;
  font-size: 2rem;
  font-weight: bold;
  z-index: 10000;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.6);
  text-align: center;
  white-space: pre-line;
}
