/* ==========================================
   🎨 KEZITY STUDIO - 數學/英語 獨立專案樣式
   ========================================== */
:root {
  /* 品牌核心色彩：莫蘭迪暖色系 */
  --bg-color: #faf8f5;           /* 燕麥暖白背景，降低眼睛疲勞 */
  --card-bg: #ffffff;            /* 純白卡片，保持內容清晰 */
  --text-primary: #3d3b38;       /* 內斂深灰褐，取代刺眼的純黑 */
  --text-secondary: #7f8c8d;     /* 莫蘭迪灰（副標題/說明文字） */
  
  --primary-color: #5c6b6a;      /* 莫蘭迪霧綠藍（主視覺色系） */
  --border-color: #e6e4de;       /* 柔和的沙色邊框 */

  /* 互動回饋色系退溫：拒絕罐頭大紅大綠 */
  --success-bg: #eaf1eb;         /* 柔霧薄荷綠 */
  --success-color: #4a6b4a;
  --error-bg: #fdf5e6;           /* 暖沙橘/奶茶色 */
  --error-color: #a67c52;
}

body {
  margin: 0; 
  padding: 60px 20px 40px; /* 拉大上下留白，不再擠滿螢幕 */
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  display: flex; 
  flex-direction: column; /* 改為垂直排列，以容納 footer */
  align-items: center;
  min-height: 100vh;
  box-sizing: border-box;
  -webkit-user-select: none; 
  user-select: none;
  position: relative;
}

/* ------------------------------------------
   🔘 頂部導航 Home 鍵 & 底部版權
   ------------------------------------------ */
.nav-home {
  position: absolute; top: 24px; left: 24px; 
  font-size: 12px; font-weight: 500; opacity: 0.6; 
  text-decoration: none; letter-spacing: 1px; 
  color: var(--text-primary); transition: opacity 0.3s ease;
  z-index: 100;
}
.nav-home:hover { opacity: 1; }

.app-footer {
  margin-top: auto; /* 自動推到底部 */
  padding-top: 30px; text-align: center; font-size: 11px; 
  color: var(--text-secondary); opacity: 0.5; letter-spacing: 0.5px;
}

/* ------------------------------------------
   📦 主容器與排版呼吸感
   ------------------------------------------ */
.app-container {
  width: 100%; max-width: 500px;
  background: var(--card-bg);
  padding: 35px 30px; /* 增加卡片內部的呼吸感 */
  border-radius: 20px; /* 圓角加大更親和 */
  box-shadow: 0 10px 30px rgba(61, 59, 56, 0.04); /* 極柔和的陰影 */
  box-sizing: border-box;
  margin-bottom: 20px;
}

.screen { transition: all 0.3s ease; }
.hidden { display: none !important; }

h1 { font-size: 22px; text-align: center; color: var(--primary-color); margin-bottom: 5px; letter-spacing: 0.5px;}
h2 { text-align: center; font-size: 24px; margin-top: 10px; color: var(--text-primary); }
.subtitle { text-align: center; color: var(--text-secondary); font-size: 13px; margin-bottom: 30px; }

/* ------------------------------------------
   📚 選單與題目區塊
   ------------------------------------------ */
.menu-section {
  background: #fbfaf8; padding: 16px;
  border-radius: 16px; margin-bottom: 20px;
  border: 1px solid var(--border-color);
}
.menu-section h3 { margin-top: 0; color: var(--text-primary); font-size: 15px; }

.menu-section button {
  width: 100%; padding: 14px;
  background-color: white; border: 1px solid var(--border-color);
  border-radius: 12px; font-size: 15px; font-weight: 500;
  color: var(--text-primary); cursor: pointer;
  margin-bottom: 10px; text-align: left;
  transition: all 0.2s ease;
}
.menu-section button:active { background-color: #f4f1eb; border-color: #dcd7ce; }

.btn-exam { 
  background-color: #fdf5e6 !important; /* 柔和的燕麥黃 */
  border-color: #f1dfc3 !important; 
  color: #8c6a46 !important;
  text-align: center !important; 
  font-weight: bold;
}

.question-box {
  background: #f7f6f4; padding: 25px 20px;
  border-radius: 16px; font-size: 16px;
  line-height: 1.7; margin: 20px 0;
  position: relative; font-weight: 500;
}
.q-badge {
  position: absolute; top: -12px; left: 18px;
  background: var(--primary-color); color: white;
  font-size: 11px; padding: 4px 10px; border-radius: 6px;
  letter-spacing: 1px;
}

/* ------------------------------------------
   ⌨️ 輸入框與互動元素
   ------------------------------------------ */
.num-input-box {
  display: inline-block; background: #fff;
  border: 2px solid var(--border-color); border-radius: 10px;
  min-width: 55px; height: 42px; font-size: 20px;
  text-align: center; line-height: 40px;
  vertical-align: middle; margin: 0 6px; cursor: pointer;
  color: var(--text-primary);
}
.num-input-box.active {
  border-color: var(--primary-color);
  background-color: #f2f5f5; /* 搭配主色的微透背景 */
}

/* 數字時鐘柔化 */
.digital-clock-box {
  display: inline-block; background: #3d3b38; color: #d4e0d7;
  font-family: 'Courier New', Courier, monospace;
  font-size: 32px; font-weight: bold; padding: 10px 25px;
  border-radius: 8px; border: 3px solid #2a2927;
  letter-spacing: 3px; margin: 10px 0;
}

.option-btn {
  width: 100%; padding: 16px; margin-bottom: 12px;
  background: #fff; border: 1px solid var(--border-color);
  border-radius: 12px; font-size: 15px; text-align: left;
  color: var(--text-primary); font-weight: 500;
  box-shadow: 0 2px 6px rgba(0,0,0,0.01);
}
.option-btn:active { background: #f4f1eb; }

/* 核心按鈕：質感提升 */
#submit-btn {
  width: 100%; padding: 16px;
  background-color: var(--text-primary); /* 使用深灰褐作為主按鈕，非常高級 */
  color: white; text-align: center; border: none; 
  border-radius: 12px; font-size: 16px; font-weight: bold; 
  margin-top: 15px; letter-spacing: 1px; cursor: pointer;
}
#submit-btn:active { background-color: #2a2927; }

/* ------------------------------------------
   💬 回饋訊息區 (溫暖手寫感)
   ------------------------------------------ */
.feedback-box {
  padding: 18px 20px; border-radius: 12px;
  margin-top: 20px; font-size: 15px; line-height: 1.6;
}
.feedback-title { font-size: 16px; font-weight: bold; margin-bottom: 8px; }
.feedback-explain { font-size: 14px; margin-top: 8px; border-top: 1px dashed rgba(0,0,0,0.1); padding-top: 10px;}
.correct { background-color: var(--success-bg); color: var(--success-color); }
.wrong { background-color: var(--error-bg); color: var(--error-color); }

/* ------------------------------------------
   📱 數字小鍵盤 (柔和色系)
   ------------------------------------------ */
.keyboard-container {
  margin-top: 20px; background: #f7f6f4;
  padding: 12px; border-radius: 16px;
}
.key-row { display: flex; justify-content: space-between; margin-bottom: 10px; }
.key-row:last-child { margin-bottom: 0; }
.key-btn {
  width: 31%; padding: 14px 0; font-size: 20px; color: var(--text-primary);
  background: white; border: 1px solid var(--border-color); border-radius: 10px;
  box-shadow: 0 2px 4px rgba(61,59,56,0.03); text-align: center;
}
.key-btn:active { background: #e6e4de; }

/* 退格與確認鍵改用莫蘭迪色 */
.btn-del { background: #e8d5ce; color: #a66a5e; border: none; font-size: 16px; font-weight: bold; }
.btn-del:active { background: #dabaaf; }
.btn-ok { background: #d4e0d7; color: #4a6b4a; border: none; font-size: 16px; font-weight: bold; }
.btn-ok:active { background: #c1cfc5; }

/* ------------------------------------------
   ⏱️ 測驗標頭與進度條
   ------------------------------------------ */
.quiz-header { display: flex; justify-content: space-between; font-weight: bold; align-items: center; color: var(--text-primary);}
#timer { background: var(--error-bg); padding: 4px 10px; border-radius: 6px; color: var(--error-color); font-size: 14px; }

.progress-bar-container { width: 100%; height: 8px; background: #e6e4de; border-radius: 4px; margin-top: 10px; overflow: hidden;}
#progress-bar { width: 0%; height: 100%; background: var(--primary-color); transition: width 0.3s ease; }

/* ------------------------------------------
   🏆 結果頁面
   ------------------------------------------ */
.result-card { background: #f7f6f4; padding: 20px; border-radius: 16px; margin: 25px 0; font-size: 16px; text-align: center;}
.score-board { text-align: center; margin-top: 25px; font-size: 15px;}
.btn-clear { background: none; border: none; color: var(--text-secondary); text-decoration: underline; font-size: 13px; margin-top: 10px; cursor: pointer;}
.btn-home { background: var(--primary-color); color: white; border: none; text-align: center; width: 100%; padding: 15px; border-radius: 12px; font-size: 16px; margin-top: 15px; cursor: pointer; letter-spacing: 1px;}
.btn-home:active { opacity: 0.9; }
