/* ============================================
   白晝之庭 入庭考核 — 白晝庭園主題（暖白＋草綠＋金）
   ============================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, "Noto Sans TC", "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(ellipse 60% 40% at 85% -5%, rgba(214, 190, 120, 0.18), transparent),
    radial-gradient(ellipse 50% 40% at 5% 20%, rgba(140, 180, 120, 0.12), transparent),
    #faf7ef;
  color: #453d33;
  line-height: 1.7;
  min-height: 100vh;
}
a { color: inherit; }
.wrap { max-width: 640px; margin: 0 auto; padding: 20px 16px; }

.head { text-align: center; padding: 22px 0 16px; }
.head h1 {
  font-size: 24px; letter-spacing: 5px;
  background: linear-gradient(180deg, #8a7440 0%, #b08d4f 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.head .sub { font-size: 13px; color: #a09480; letter-spacing: 3px; margin-top: 4px; }

.card {
  background: #fff;
  border: 1px solid rgba(176, 141, 79, 0.35);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 6px 24px rgba(120, 100, 60, 0.1);
}
.rules { font-size: 14px; color: #6b5f50; margin-bottom: 18px; }
.rules p { font-weight: 700; margin-bottom: 6px; }
.rules ul { padding-left: 20px; }
.rules li { margin-bottom: 3px; }
.rules strong { color: #8a7440; }

.form label { display: block; font-size: 14px; color: #6b5f50; margin-bottom: 14px; }
.form input[type="text"], .form select, .form textarea {
  display: block; width: 100%; margin-top: 4px;
  font-size: 15px; padding: 10px;
  border: 1px solid #d8c9ac; border-radius: 10px; background: #fffdf8; color: #453d33;
}
.form input:focus, .form select:focus, .form textarea:focus {
  outline: none; border-color: #b08d4f; box-shadow: 0 0 8px rgba(176, 141, 79, 0.25);
}
.hint { font-size: 12px; color: #a09480; margin: -6px 0 14px; }
.hint-admin { font-size: 12px; color: #a09480; margin-bottom: 10px; }

.btn-start {
  display: block; width: 100%;
  background: linear-gradient(135deg, #7fa564 0%, #5f8a47 100%);
  color: #fff; font-size: 16px; font-weight: 700;
  border: none; border-radius: 12px; padding: 13px; cursor: pointer;
  transition: box-shadow 0.2s, filter 0.2s;
}
.btn-start:hover { box-shadow: 0 0 18px rgba(127, 165, 100, 0.5); filter: brightness(1.05); }

.error { color: #b8452f; font-size: 14px; margin-bottom: 12px; text-align: center; }
.ok { color: #3e7d4f; font-size: 14px; margin-bottom: 12px; }
.empty { text-align: center; color: #a09480; padding: 40px 0; font-size: 14px; }
.foot { text-align: center; font-size: 12px; color: #b5a88f; padding: 24px 0 8px; }
.foot a { color: #8a7440; }

/* ---- 防代考驗證頁 ---- */
.verify-code {
  font-size: 34px; font-weight: 800; letter-spacing: 8px;
  text-align: center; color: #5f8a47;
  background: #f2f6ea; border: 2px dashed #7fa564; border-radius: 12px;
  padding: 14px; margin-bottom: 16px;
  user-select: all;
}

/* ---- 考試中 ---- */
.quiz-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.progress { font-size: 13px; color: #a09480; letter-spacing: 1px; }
.timer {
  font-size: 22px; font-weight: 800; color: #5f8a47;
  min-width: 44px; text-align: center;
  background: #f0f4e8; border-radius: 10px; padding: 2px 10px;
}
.timer.urgent { color: #b8452f; background: #fbeae4; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.55; } }
.timer-bar { height: 5px; background: #eee5d2; border-radius: 3px; overflow: hidden; margin-bottom: 18px; }
.timer-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #7fa564, #b08d4f); transition: width 1s linear; border-radius: 3px; }

.q-text { font-size: 17px; margin-bottom: 16px; color: #453d33; }
.q-form .opt {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid #e2d6bd; border-radius: 12px;
  padding: 12px 14px; margin-bottom: 10px;
  font-size: 15px; cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.q-form .opt:hover { border-color: #b08d4f; background: #fdf9ef; }
.q-form .opt:has(input:checked) { border-color: #5f8a47; background: #f2f6ea; }
.q-form .opt input { width: 16px; height: 16px; flex-shrink: 0; }
.q-form .btn-start { margin-top: 8px; }

/* ---- 結果頁 ---- */
.result { text-align: center; }
.result-icon { font-size: 44px; margin-bottom: 8px; }
.result h2 { font-size: 20px; margin-bottom: 10px; color: #6b5f50; }
.result p { font-size: 14px; color: #6b5f50; }

/* ============ 後台 ============ */
body.admin { background: #f4f1ea; }
body.admin .wrap { max-width: 900px; }
.admin-head {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px; padding: 12px 0 18px;
}
.admin-head h1 { font-size: 19px; }
.admin-head nav { display: flex; gap: 8px; flex-wrap: wrap; }

.btn {
  display: inline-block; background: #7a6a45; color: #fff;
  font-size: 14px; border: none; border-radius: 8px;
  padding: 8px 14px; cursor: pointer; text-decoration: none;
}
.btn.ghost { background: transparent; color: #7a6a45; border: 1px solid #c6b590; }
.btn.small { font-size: 12px; padding: 4px 10px; }
.btn.danger { background: #b8452f; }

.stat-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.stat {
  flex: 1; min-width: 130px; background: #fff; border-radius: 12px;
  padding: 14px; text-align: center; box-shadow: 0 1px 4px rgba(120,100,60,0.1);
}
.stat.warn { background: #fdf0ec; }
.stat-num { font-size: 26px; font-weight: 800; color: #7a6a45; }
.stat-num span { font-size: 14px; color: #b5a88f; font-weight: 400; }
.stat-label { font-size: 12px; color: #a09480; }

.list { width: 100%; border-collapse: collapse; background: #fff; border-radius: 10px; overflow: hidden; font-size: 14px; margin-top: 10px; }
.list th, .list td { padding: 10px 8px; border-bottom: 1px solid #efe7d6; text-align: left; vertical-align: top; }
.list th { background: #ece4d0; font-size: 13px; }
.list tr.off-shelf { opacity: 0.5; }
.list small { color: #b8452f; }
.ops { white-space: nowrap; }
.inline { display: inline; }
.creator-link { color: #5f8a47; font-size: 13px; }

.q-opts-preview { font-size: 12px; color: #a09480; margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.q-opts-preview .correct { color: #3e7d4f; font-weight: 700; }
.opt-edit { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.opt-edit input[type="radio"] { width: 17px; height: 17px; flex-shrink: 0; }
.opt-edit input[type="text"] {
  flex: 1; font-size: 14px; padding: 8px 10px;
  border: 1px solid #d8c9ac; border-radius: 8px; background: #fffdf8;
}

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.tab {
  font-size: 13px; padding: 5px 12px; border-radius: 16px; text-decoration: none;
  background: #fff; border: 1px solid #d8c9ac; color: #6b5f50;
}
.tab.active { background: #7a6a45; border-color: #7a6a45; color: #fff; }

.detail-card {
  background: #fff; border-radius: 12px; padding: 6px 16px; margin-bottom: 14px;
  box-shadow: 0 1px 4px rgba(120,100,60,0.1); font-size: 14px;
}
.detail-row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 9px 0; border-bottom: 1px solid #f2ecdd; flex-wrap: wrap;
}
.detail-row:last-child { border-bottom: none; }
.detail-row > span:first-child { color: #a09480; flex-shrink: 0; }
.section-title { font-size: 15px; margin: 16px 0 8px; color: #6b5f50; }

.login-box {
  max-width: 320px; margin: 18vh auto 0; background: #fff;
  border-radius: 14px; padding: 28px; box-shadow: 0 2px 12px rgba(120,100,60,0.15);
}
.login-box h1 { font-size: 18px; margin-bottom: 16px; text-align: center; }
.login-box input {
  display: block; width: 100%; font-size: 15px; padding: 10px;
  border: 1px solid #d8c9ac; border-radius: 8px; margin-bottom: 12px;
}
.login-box .btn { width: 100%; }
