/* AI 學習營 — 遊戲共用樣式 */
:root {
  --ink: #1d1b33; --ink2: #4b4870; --muted: #7b789c;
  --bg: #fff8ef; --paper: #ffffff; --line: #ece6dc;
  --red: #ff5a36; --yellow: #ffc531; --green: #2bd4a4; --blue: #4aa8ff; --pink: #ff7ab6; --purple: #7c5cff;
  --accent: var(--purple);
  --r: 18px; --shadow: 0 10px 30px rgba(40, 30, 80, .12); --shadow-sm: 0 4px 12px rgba(40, 30, 80, .10);
  --font: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  --font-en: "Baloo 2", "Nunito", "Arial Rounded MT Bold", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 16px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
.en { font-family: var(--font-en); }
.muted { color: var(--muted); }
button { font-family: inherit; }
[hidden] { display: none !important; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4em; border: 0; border-radius: 999px; padding: .7em 1.4em;
  font-weight: 800; font-size: 1rem; cursor: pointer; transition: transform .12s, box-shadow .12s, background .12s; text-decoration: none; color: var(--ink); background: #fff; box-shadow: var(--shadow-sm); }
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(1px) scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 6px 0 rgba(0,0,0,.18); }
.btn-ghost { background: #f1edf9; color: var(--ink2); box-shadow: none; }
.btn-big { font-size: 1.25rem; padding: .9em 1.8em; }
.btn:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }

/* card */
.card { background: var(--paper); border-radius: var(--r); box-shadow: var(--shadow); padding: 20px; }
.chip { display: inline-block; padding: .15em .7em; border-radius: 999px; background: #f1edf9; color: var(--ink2); font-size: .85rem; font-weight: 700; }

/* HUD */
.camp-hud { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 50; display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 8px 14px; background: rgba(255,255,255,.92); backdrop-filter: blur(8px); border-bottom: 3px solid var(--accent); box-shadow: var(--shadow-sm); }
.hud-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.hud-home { font-size: 1.4rem; text-decoration: none; }
.hud-title { display: flex; flex-direction: column; line-height: 1.2; }
.hud-title b { font-size: 1.05rem; white-space: nowrap; }
.tier-badge { font-size: .75rem; font-weight: 800; padding: 1px 8px; border-radius: 999px; color: #fff; width: fit-content; }
.tier-badge.t-low { background: var(--green); } .tier-badge.t-mid { background: var(--blue); } .tier-badge.t-high { background: var(--red); }
.hud-steps { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; flex: 1; justify-content: center; flex-wrap: wrap; }
.hud-steps li { display: flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: #f4f1fa; color: var(--muted); font-size: .85rem; font-weight: 700; }
.hud-steps li .n { width: 22px; height: 22px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: .8rem; }
.hud-steps li .m { opacity: .7; font-size: .75rem; }
.hud-steps li.active { background: var(--accent); color: #fff; }
.hud-steps li.active .n { color: var(--accent); }
.hud-steps li.done { background: #e2f8f1; color: #138a68; }
.hud-steps li.done .n::after { content: '✓'; }
.hud-steps li.done .n { font-size: 0; }
.hud-steps li.done .n::after { font-size: .8rem; }
.hud-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hud-clock { font-family: var(--font-en); font-weight: 800; background: #1d1b33; color: #fff; padding: 2px 10px; border-radius: 8px; font-variant-numeric: tabular-nums; }
.hud-clock.over { background: var(--red); }
.hud-scorebox { text-align: center; line-height: 1; }
.hud-scorebox small { display: block; font-size: .65rem; color: var(--muted); }
.hud-score { font-family: var(--font-en); font-weight: 800; font-size: 1.4rem; color: var(--accent); display: inline-block; }
.hud-coin { font-weight: 800; background: #fff6d6; padding: 3px 10px; border-radius: 999px; }
.hud-items { display: flex; gap: 4px; }
.hud-item, .hud-btn { position: relative; width: 36px; height: 36px; border-radius: 10px; border: 2px solid var(--line); background: #fff; cursor: pointer; font-size: 1.1rem; display: grid; place-items: center; }
.hud-item i { position: absolute; right: -6px; bottom: -6px; font-style: normal; font-size: .7rem; font-weight: 800; background: var(--accent); color: #fff; border-radius: 999px; min-width: 18px; height: 18px; display: grid; place-items: center; }
.hud-item.empty { opacity: .35; }
.hud-btn.on { background: var(--yellow); border-color: var(--yellow); }
@media (max-width: 760px) { .hud-steps li .l, .hud-steps li .m { display: none; } .hud-title b { font-size: .95rem; } .hud-title small { display: none; } .hud-steps li { padding: 3px 7px; } .hud-steps { gap: 4px; } }

/* teacher tip */
.teacher-tip { position: fixed; left: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); max-width: 340px; z-index: 60; background: #fffbe6; border: 3px dashed var(--yellow); border-radius: 16px; padding: 10px 14px; box-shadow: var(--shadow); font-size: .95rem; }
.teacher-tip p { margin: 4px 0 0; }
body:not(.teacher-mode) .teacher-tip { display: none !important; }
body.teacher-mode .tm-big { font-size: 1.3em; }

/* modal */
.camp-modal-back { position: fixed; inset: 0; background: rgba(29,27,51,.55); display: grid; place-items: center; z-index: 100; padding: 16px; }
.camp-modal { background: #fff; border-radius: 24px; padding: 24px 26px; max-width: 520px; width: 100%; box-shadow: 0 30px 80px rgba(0,0,0,.3); max-height: 90vh; overflow: auto; }
.camp-modal.wide { max-width: 940px; }
.camp-modal h2 { margin: 0 0 8px; font-size: 1.4rem; }
.camp-modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.goal-box { background: #f6f3ff; border-radius: 14px; padding: 10px 14px; margin-top: 10px; }
.goal-box ul { margin: 6px 0 0; padding-left: 1.2em; }

/* tier pick */
.tier-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin-top: 14px; }
.tier-card { text-align: left; border: 3px solid var(--line); border-radius: 20px; background: #fff; padding: 16px; cursor: pointer; transition: transform .15s, border-color .15s; font-size: .95rem; color: var(--ink); }
.tier-card:hover { transform: translateY(-4px); border-color: var(--accent); }
.tier-card.rec { border-color: var(--green); background: #f2fdf9; }
.tier-mult { font-family: var(--font-en); font-weight: 800; font-size: 2rem; color: var(--accent); line-height: 1; }
.tier-name { font-weight: 900; font-size: 1.2rem; margin-top: 4px; }
.tier-band { font-size: .8rem; color: var(--muted); font-weight: 700; }
.tier-desc { margin: 6px 0; }
.tier-goals { margin: 0; padding-left: 1.1em; color: var(--ink2); font-size: .85rem; }

/* toasts */
.camp-toasts { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 8px; z-index: 200; align-items: flex-end; pointer-events: none; }
.camp-toast { background: #1d1b33; color: #fff; padding: 10px 16px; border-radius: 14px; font-weight: 700; box-shadow: var(--shadow); transition: opacity .3s; max-width: 80vw; }
.camp-toast.ok { background: #138a68; } .camp-toast.bad { background: #c9302c; } .camp-toast.warn { background: #b7791f; }

.camp-confetti { position: fixed; top: 0; width: 10px; height: 14px; border-radius: 3px; z-index: 300; pointer-events: none; }
.camp-float { position: fixed; z-index: 300; font-family: var(--font-en); font-weight: 900; font-size: 1.6rem; pointer-events: none; text-shadow: 0 2px 0 #fff, 0 0 6px rgba(0,0,0,.2); transform: translate(-50%, -50%); }

.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

/* game stage */
.stage { max-width: 1180px; margin: 0 auto; padding: 18px 16px 120px; }
.option-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.option { border: 3px solid var(--line); background: #fff; border-radius: 20px; padding: 16px; cursor: pointer; font-size: 1.05rem; font-weight: 700; text-align: center; transition: transform .12s, border-color .12s; color: var(--ink); }
.option:hover { transform: translateY(-3px); border-color: var(--accent); }
.option.right { border-color: var(--green); background: #e8fbf5; }
.option.wrongpick { border-color: var(--red); background: #ffeee9; }
.option .big { font-size: 3rem; display: block; line-height: 1.2; }
.speak-btn { display: inline-flex; align-items: center; gap: 8px; border: 0; background: var(--yellow); color: var(--ink); padding: .6em 1.2em; border-radius: 999px; font-weight: 900; cursor: pointer; font-size: 1.05rem; box-shadow: 0 5px 0 #d9a514; }
.speak-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #d9a514; }
.bubble { position: relative; background: #fff; border-radius: 20px; padding: 14px 18px; box-shadow: var(--shadow-sm); font-size: 1.1rem; }
.bubble::after { content: ''; position: absolute; left: 30px; bottom: -14px; border: 8px solid transparent; border-top: 10px solid #fff; }
input.text-in, textarea.text-in { width: 100%; font: inherit; font-size: 1.1rem; padding: 12px 14px; border-radius: 14px; border: 3px solid var(--line); background: #fff; color: var(--ink); }
input.text-in:focus, textarea.text-in:focus { outline: none; border-color: var(--accent); }
.progress { height: 12px; background: #eee8f7; border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; width: 0; transition: width .4s; }
