/* 靈光腦 LuminoBrain 核心視覺樣式 (極致可愛軟Q黏土風 · Pastel Claymorphism) */

:root {
  --primary-yellow: #fed330;
  --bg-creamy: #fdfaf0;
  --text-main: #2d3436;
  --text-muted: #636e72;
  --color-identify: #ff7675;
  --color-memorize: #74b9ff;
  --color-analyze: #55efc4;
  --color-compute: #feca57;
  --color-visualize: #a29bfe;
  --clay-radius: 28px;
  --clay-btn-radius: 24px;
  --clay-shadow: 0 12px 28px rgba(0, 0, 0, 0.08), inset 0 2px 4px rgba(255, 255, 255, 0.8), inset 0 -4px 6px rgba(0, 0, 0, 0.06);
  --bouncy-transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  touch-action: manipulation; /* 消除移動設備雙擊縮放延遲 */
}

html, body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "PingFang TC", "Hiragino Sans", "Microsoft JhengHei", sans-serif;
  background-color: var(--bg-creamy);
  background-image: 
    radial-gradient(#e8e1cb 1.5px, transparent 1.5px),
    radial-gradient(#f7f1df 1.5px, var(--bg-creamy) 1.5px);
  background-size: 28px 28px;
  background-position: 0 0, 14px 14px;
  color: var(--text-main);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* 外框卡片容器 */
#app-root {
  width: 100%;
  max-width: 900px;
  min-height: 100vh;
  background: #ffffff;
  position: relative;
  display: flex;
  flex-direction: column;
}

@media (min-width: 769px) {
  body {
    padding: 24px 16px;
  }
  #app-root {
    min-height: 700px;
    border-radius: 40px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.12), 0 0 0 10px #f5ebd0;
    overflow: hidden;
  }
}

/* 畫面轉場 */
.screen-view {
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  animation: viewPop 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.2);
}

.hidden-screen {
  display: none !important;
}

@keyframes viewPop {
  from { opacity: 0; transform: scale(0.98) translateY(6px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* 頂部導航與標題 */
.page-top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  background: #fffcf5;
  border-bottom: 2px solid #f1ece1;
}

.back-btn {
  background: #ffffff;
  border: 2px solid #e2e8f0;
  padding: 10px 20px;
  border-radius: 22px;
  font-size: 15px;
  font-weight: 800;
  color: #4a5568;
  cursor: pointer;
  box-shadow: 0 4px 0 #cbd5e0;
  transition: var(--bouncy-transition);
}

.back-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #cbd5e0;
}

.page-title {
  font-size: 22px;
  font-weight: 900;
  color: #2d3436;
}

/* 首頁頂部控制欄 */
.home-container {
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.home-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.game-logo-badge {
  display: flex;
  align-items: center;
  gap: 14px;
}

.cute-brain-mascot {
  font-size: 46px;
  display: inline-block;
  animation: brainWiggle 3s ease-in-out infinite alternate;
  filter: drop-shadow(0 6px 10px rgba(255, 107, 129, 0.3));
}

@keyframes brainWiggle {
  0% { transform: rotate(-5deg) scale(1); }
  50% { transform: rotate(5deg) scale(1.06); }
  100% { transform: rotate(-5deg) scale(1); }
}

.brand-titles h1 {
  font-size: 28px;
  font-weight: 900;
  color: #ff4757;
  letter-spacing: 0.5px;
  text-shadow: 0 2px 0 rgba(0,0,0,0.06);
}

.brand-titles .subtitle {
  font-size: 13px;
  color: #747d8c;
  font-weight: 700;
}

/* 右上方工具群組 (語系切換 + 音效開關) */
.home-tools-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lang-select-pill {
  background: #ffffff;
  border: 2px solid #e0e7ff;
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 800;
  color: #4f46e5;
  cursor: pointer;
  box-shadow: 0 4px 0 #c7d2fe;
  outline: none;
  transition: var(--bouncy-transition);
}

.sound-btn {
  background: #ffffff;
  border: 2px solid #fed330;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 800;
  color: #d48806;
  cursor: pointer;
  box-shadow: 0 4px 0 #ffd666;
  transition: var(--bouncy-transition);
}

.sound-btn:active, .lang-select-pill:active {
  transform: translateY(2px);
}

/* 靈光校長超可愛橫幅 */
.dr-lobe-banner {
  background: linear-gradient(135deg, #fff9e6, #fff3cd);
  border-radius: 26px;
  padding: 16px 22px;
  display: flex;
  align-items: center;
  gap: 18px;
  border: 3px solid #ffeaa7;
  box-shadow: 0 8px 20px rgba(254, 202, 87, 0.2);
}

.lobe-avatar {
  font-size: 46px;
  background: #ffffff;
  border-radius: 50%;
  width: 66px;
  height: 66px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 14px rgba(0,0,0,0.08);
  border: 2px solid #f9ca24;
  flex-shrink: 0;
}

.lobe-speech {
  font-size: 15px;
  font-weight: 700;
  color: #795548;
  line-height: 1.55;
}

/* 個人成就儀表板 */
.player-dashboard-card {
  background: linear-gradient(135deg, #6c5ce7, #a29bfe);
  border-radius: 28px;
  padding: 20px 26px;
  color: #ffffff;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  align-items: center;
  box-shadow: 0 14px 30px rgba(108, 92, 231, 0.32), inset 0 2px 4px rgba(255,255,255,0.4);
}

.stats-item {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 13px;
  opacity: 0.9;
  font-weight: 700;
}

.stat-val {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

.stat-val.rank {
  color: #fed330;
  text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.medals-shelf-strip {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.medal-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255, 255, 255, 0.22);
  border-radius: 12px;
  padding: 4px 6px;
  min-width: 44px;
}

.slot-medal-icon {
  font-size: 20px;
}

.slot-name {
  font-size: 10px;
  font-weight: 800;
  margin-top: 2px;
}

/* 三大核心遊玩模式卡 (超軟Q黏土立體按鈕) */
.home-menu-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.main-action-btn {
  border-radius: 28px;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: var(--bouncy-transition);
  border: 3px solid transparent;
  outline: none;
}

.main-action-btn:hover {
  transform: translateY(-5px);
}

.main-action-btn:active {
  transform: translateY(4px);
}

.main-action-btn.btn-exam {
  background: linear-gradient(to bottom, #ffffff, #fff2f2);
  border-color: #ff7675;
  box-shadow: 0 10px 0 #d63031, 0 16px 25px rgba(255, 118, 117, 0.35);
}

.main-action-btn.btn-exam:active {
  box-shadow: 0 2px 0 #d63031;
}

.main-action-btn.btn-practice {
  background: linear-gradient(to bottom, #ffffff, #f0fdfc);
  border-color: #00cec9;
  box-shadow: 0 10px 0 #009893, 0 16px 25px rgba(0, 206, 201, 0.35);
}

.main-action-btn.btn-practice:active {
  box-shadow: 0 2px 0 #009893;
}

.main-action-btn.btn-versus {
  background: linear-gradient(to bottom, #ffffff, #fffaf0);
  border-color: #feca57;
  box-shadow: 0 10px 0 #e67e22, 0 16px 25px rgba(254, 202, 87, 0.35);
}

.main-action-btn.btn-versus:active {
  box-shadow: 0 2px 0 #e67e22;
}

.btn-icon-giant {
  font-size: 48px;
  margin-bottom: 8px;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
}

.btn-label-title {
  font-size: 20px;
  font-weight: 900;
  color: #2d3436;
}

.btn-label-desc {
  font-size: 13px;
  color: #636e72;
  margin-top: 4px;
  font-weight: 600;
  text-align: center;
}

/* 歷史檔案按鈕 */
.home-sub-actions {
  display: flex;
  justify-content: center;
}

.text-action-btn {
  background: #f1f2f6;
  border: 2px solid #dfe4ea;
  color: #4a5568;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  padding: 10px 22px;
  border-radius: 20px;
  transition: var(--bouncy-transition);
}

.text-action-btn:hover {
  background: #e4e7eb;
  transform: translateY(-2px);
}

/* HUD 抬頭顯示條 (計時條與計分) */
.test-hud-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 22px;
  background: #ffffff;
  border-bottom: 3px solid #f1ece1;
}

.hud-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hud-cat-indicator {
  padding: 8px 16px;
  border-radius: 22px;
  color: #ffffff;
  font-weight: 900;
  font-size: 15px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.12);
}

.hud-score-box {
  font-size: 16px;
  font-weight: 800;
  color: #4a5568;
}

.hud-score-box strong {
  font-size: 24px;
  color: #ff4757;
}

.hud-center {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  max-width: 320px;
  margin: 0 16px;
}

.timer-gauge-wrap {
  flex: 1;
  height: 16px;
  background: #edf2f7;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.timer-gauge-bar {
  height: 100%;
  background: linear-gradient(90deg, #2ed573, #7bed9f);
  border-radius: 10px;
  transition: width 0.3s linear, background 0.3s;
}

.timer-text {
  font-size: 18px;
  font-weight: 900;
  color: #2d3436;
  min-width: 44px;
}

.combo-bubble {
  background: linear-gradient(135deg, #ff4757, #ff6b81);
  color: #ffffff;
  font-size: 14px;
  font-weight: 900;
  padding: 6px 14px;
  border-radius: 20px;
  box-shadow: 0 4px 10px rgba(255, 71, 87, 0.4);
}

.combo-bubble.pop-anim {
  transform: scale(1.25);
}

.quit-hud-btn {
  background: #f1f2f6;
  border: none;
  padding: 8px 14px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 800;
  color: #747d8c;
  cursor: pointer;
}

/* 遊戲視口 */
.game-viewport {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px 24px;
  background: #fafafc;
}

/* 典禮結算畫面 */
.ceremony-container {
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.ceremony-header {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #fdf6e2;
  padding: 14px 20px;
  border-radius: 24px;
  border: 2px dashed #fbd38d;
}

.ceremony-main-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 22px;
  align-items: center;
}

.scale-section {
  background: #ffffff;
  border: 3px solid #f1ece1;
  border-radius: 28px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: var(--clay-shadow);
}

.scale-machine {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 12px;
}

.scale-pan {
  width: 160px;
  height: 96px;
  border-bottom: 10px solid #a4b0be;
  border-left: 5px solid #a4b0be;
  border-right: 5px solid #a4b0be;
  border-radius: 0 0 80px 80px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(241, 242, 246, 0.5);
}

.brain-specimen {
  font-size: 68px;
}

.scale-dial-box {
  background: #2d3436;
  border-radius: 22px;
  padding: 12px 28px;
  margin-top: 16px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  position: relative;
  box-shadow: 0 8px 20px rgba(0,0,0,0.25);
}

.scale-weight-digits {
  font-size: 44px;
  font-weight: 900;
  color: #2ed573;
  letter-spacing: 1px;
}

.scale-unit {
  font-size: 22px;
  color: #a4b0be;
  font-weight: bold;
}

.scale-rank-stamp {
  position: absolute;
  right: -24px;
  top: -20px;
  background: linear-gradient(135deg, #ff4757, #ff6b81);
  color: #ffffff;
  font-size: 26px;
  font-weight: 900;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 4px solid #ffffff;
  box-shadow: 0 6px 16px rgba(255, 71, 87, 0.45);
  transform: rotate(-15deg) scale(0);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.scale-rank-stamp.stamp-drop {
  transform: rotate(-15deg) scale(1);
}

.player-title-display {
  font-size: 16px;
  font-weight: 900;
  color: #4a5568;
  margin-top: 10px;
}

.radar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.radar-title {
  font-size: 16px;
  font-weight: 900;
  color: #2d3436;
  margin-bottom: 8px;
}

.radar-canvas-wrap {
  background: #ffffff;
  border-radius: 24px;
  box-shadow: var(--clay-shadow);
  padding: 6px;
}

.evaluation-card {
  background: #f8fafc;
  border-left: 6px solid #2ed573;
  border-radius: 16px;
  padding: 16px 20px;
  font-size: 14.5px;
  line-height: 1.6;
  color: #2d3436;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ceremony-actions {
  display: flex;
  justify-content: center;
  gap: 18px;
}

.menu-btn {
  border: none;
  padding: 14px 32px;
  border-radius: 28px;
  font-size: 17px;
  font-weight: 900;
  cursor: pointer;
  transition: var(--bouncy-transition);
}

.menu-btn.primary-btn {
  background: #ff4757;
  color: #ffffff;
  box-shadow: 0 8px 0 #d63031, 0 12px 20px rgba(255, 71, 87, 0.3);
}

.menu-btn.primary-btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #d63031;
}

.menu-btn.secondary-btn {
  background: #f1f2f6;
  color: #4a5568;
  box-shadow: 0 8px 0 #ced6e0;
}

.menu-btn.secondary-btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #ced6e0;
}

/* 手機與平板專用響應式佈局 (需求 4) */
@media (max-width: 768px) {
  .home-container {
    padding: 16px;
    gap: 16px;
  }
  .player-dashboard-card {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 16px;
  }
  .home-menu-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .main-action-btn {
    flex-direction: row;
    padding: 16px 20px;
    gap: 16px;
    text-align: left;
  }
  .btn-icon-giant {
    font-size: 42px;
    margin-bottom: 0;
  }
  .btn-label-desc {
    text-align: left;
  }
  .ceremony-main-grid {
    grid-template-columns: 1fr;
  }
  .hud-center {
    max-width: 140px;
    margin: 0 8px;
  }
  .test-hud-bar {
    padding: 10px 14px;
  }
  .game-viewport {
    padding: 12px;
  }
}
