/* =========================================================
   hao_inclass 共用樣式 v3 — 童趣卡通 / 大按鈕 / 投影大螢幕
   ========================================================= */
@import url('https://fonts.googleapis.com/css2?family=Andika:wght@400;700&family=Baloo+2:wght@600;800&family=Noto+Sans+TC:wght@500;700;900&display=swap');

:root {
  --bg: #FFF6E0;
  --bg-dots: #FFE8B0;
  --ink: #3B2A4D;
  --ink-soft: #7A6A8C;
  --card: #FFFFFF;
  --line: #F1DFC0;
  --orange: #FF8A00;
  --pink: #FF4F8B;
  --yellow: #FFC93C;
  --green: #2DBE6C;
  --teal: #12B5CB;
  --blue: #3D8BFF;
  --purple: #8E6CFF;
  --red-team: #FF4D5E;
  --blue-team: #2E9BFF;
  --good: #2DBE6C;
  --bad: #FF4D5E;
  --shadow: 0 6px 0 rgba(59, 42, 77, .18);
  --radius: 24px;
  --font-ui: 'Baloo 2', 'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei', sans-serif;
  --font-word: 'Andika', 'Baloo 2', 'Noto Sans TC', sans-serif; /* Andika：單層 a / g，適合初學閱讀 */
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-ui);
  color: var(--ink);
  background-color: var(--bg);
  background-image: radial-gradient(var(--bg-dots) 2px, transparent 2.5px);
  background-size: 28px 28px;
  -webkit-tap-highlight-color: transparent;
}
button { font-family: inherit; color: inherit; }
img { -webkit-user-drag: none; user-select: none; }
.word { font-family: var(--font-word); font-weight: 700; }
.hidden { display: none !important; }

/* ---------- 遊戲頁共用骨架 ---------- */
body.game {
  display: flex; flex-direction: column; height: 100vh; height: 100dvh;
  overflow: hidden; user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  background: var(--card); border-bottom: 4px solid var(--line); z-index: 50; flex-shrink: 0;
}
.topbar .title { font-weight: 800; font-size: 22px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .title small { font-size: 15px; color: var(--ink-soft); font-weight: 600; margin-left: 8px; }
.icon-btn {
  width: 52px; height: 52px; border-radius: 50%; border: 3px solid var(--line); background: #fff;
  font-size: 24px; cursor: pointer; display: grid; place-items: center; flex-shrink: 0;
  box-shadow: 0 3px 0 var(--line); transition: transform .1s;
}
.icon-btn:active { transform: translateY(3px); box-shadow: none; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 16px; border-radius: 999px;
  font-weight: 800; font-size: 24px; background: #FFF1D6; border: 3px solid var(--line); white-space: nowrap;
}
.pill.red { color: var(--red-team); background: #FFE9EB; border-color: #FFC9CE; }
.pill.blue { color: var(--blue-team); background: #E6F3FF; border-color: #BFE0FF; }
.pill.warn { color: var(--bad); animation: pulse .6s infinite alternate; }
@keyframes pulse { to { transform: scale(1.08); } }
.stage { flex: 1; position: relative; overflow: hidden; }

/* ---------- 大按鈕 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 16px 32px; border: none; border-radius: 999px; cursor: pointer;
  font-size: 26px; font-weight: 800; color: #fff; background: var(--orange);
  box-shadow: 0 6px 0 rgba(0,0,0,.22); transition: transform .08s, box-shadow .08s;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(5px); box-shadow: 0 1px 0 rgba(0,0,0,.22); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.green { background: var(--green); } .btn.blue { background: var(--blue); }
.btn.pink { background: var(--pink); } .btn.purple { background: var(--purple); }
.btn.ghost { background: #fff; color: var(--ink); border: 3px solid var(--line); box-shadow: 0 5px 0 var(--line); }
.btn.big { font-size: 34px; padding: 20px 48px; }

/* ---------- 覆蓋層：設定 / 結算 / 倒數 ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center;
  background: rgba(59, 42, 77, .55); backdrop-filter: blur(4px); padding: 16px;
  animation: fadeIn .25s ease;
}
@keyframes fadeIn { from { opacity: 0; } }
.panel {
  background: var(--card); border-radius: 32px; padding: 28px 32px; width: min(760px, 100%);
  max-height: 100%; overflow-y: auto; box-shadow: 0 12px 0 rgba(0,0,0,.15);
  border: 5px solid var(--line); animation: popIn .35s cubic-bezier(.2,1.4,.4,1);
}
@keyframes popIn { from { transform: scale(.7); opacity: 0; } }
.panel h2 { font-size: 36px; text-align: center; font-weight: 800; }
.panel .lead { text-align: center; color: var(--ink-soft); font-size: 20px; margin: 4px 0 18px; }
.panel .big-icon { font-size: 72px; text-align: center; line-height: 1; animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-8px) rotate(-4deg); } }
.field { margin: 14px 0; }
.field-label { font-weight: 800; font-size: 19px; margin-bottom: 8px; color: var(--ink-soft); }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  flex: 1 1 120px; min-height: 70px; border-radius: 20px; border: 4px solid var(--line);
  background: #fff; cursor: pointer; font-size: 18px; font-weight: 800; padding: 8px 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  transition: transform .1s;
}
.chip .ci { font-size: 30px; line-height: 1; }
.chip:hover { transform: translateY(-2px); }
.chip.on { border-color: var(--orange); background: #FFF1DD; box-shadow: 0 4px 0 var(--orange); }
.panel .actions { display: flex; gap: 14px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }

.countdown { font-size: 220px; font-weight: 800; color: #fff; text-shadow: 0 10px 0 rgba(0,0,0,.25); animation: zoom .8s ease; }
@keyframes zoom { from { transform: scale(2.2); opacity: 0; } 40% { opacity: 1; } to { transform: scale(.9); } }

.result-score { display: flex; justify-content: center; gap: 30px; margin: 18px 0; flex-wrap: wrap; }
.result-score .team { text-align: center; padding: 14px 28px; border-radius: 24px; min-width: 180px; }
.result-score .team .n { font-size: 80px; font-weight: 800; line-height: 1; }
.result-score .team.red { background: #FFE9EB; color: var(--red-team); }
.result-score .team.blue { background: #E6F3FF; color: var(--blue-team); }
.result-score .team.solo { background: #E7F8EE; color: var(--green); }
.result-score .team.win { outline: 6px solid var(--yellow); transform: scale(1.06); }
.stars { font-size: 56px; text-align: center; letter-spacing: 6px; }

/* ---------- 回饋特效 ---------- */
.float-text {
  position: fixed; z-index: 2000; pointer-events: none; font-size: 44px; font-weight: 800;
  animation: floatUp .9s ease-out forwards;
  text-shadow: 0 3px 0 #fff, 0 -3px 0 #fff, 3px 0 0 #fff, -3px 0 0 #fff;
}
@keyframes floatUp { to { transform: translateY(-90px) scale(1.4); opacity: 0; } }
.shake { animation: shake .45s ease; }
@keyframes shake { 20%,60% { transform: translateX(-10px) rotate(-3deg); } 40%,80% { transform: translateX(10px) rotate(3deg); } }
.bounce { animation: bounce .5s ease; }
@keyframes bounce { 40% { transform: scale(1.15); } 70% { transform: scale(.95); } }
.confetti { position: fixed; top: -20px; width: 12px; height: 18px; z-index: 3000; pointer-events: none; border-radius: 3px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

/* 圖片 / 內容卡 */
.vimg { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 14px; display: block; }
.speaker { font-size: 1.4em; line-height: 1; }
.loading { text-align: center; padding: 40px; font-size: 24px; color: var(--ink-soft); }

/* 雙隊分屏 */
.arena { display: flex; height: 100%; }
.arena .side { flex: 1; position: relative; display: flex; flex-direction: column; padding: 16px; gap: 14px; min-width: 0; }
.arena .side.red { background: rgba(255, 77, 94, .07); }
.arena .side.blue { background: rgba(46, 155, 255, .07); border-left: 6px dashed var(--line); }
.team-tag { align-self: center; padding: 4px 22px; border-radius: 999px; color: #fff; font-weight: 800; font-size: 22px; }
.side.red .team-tag { background: var(--red-team); } .side.blue .team-tag { background: var(--blue-team); }

@media (max-width: 700px) {
  .topbar .title { font-size: 18px; }
  .pill { font-size: 18px; padding: 4px 10px; }
  .btn { font-size: 20px; padding: 12px 22px; }
  .panel { padding: 20px 16px; }
  .panel h2 { font-size: 28px; }
  .icon-btn { width: 44px; height: 44px; font-size: 20px; }
}

/* 內容框裡的圖片一律完整顯示（不裁切） */
.pic { position: relative; }
.inner > .vimg, .pic > .vimg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.result-score .team > div:not(.n) { font-size: 20px; font-weight: 800; }
@media (max-width: 700px) {
  .topbar { gap: 6px; padding: 8px; }
  .topbar .title small, #tb-full, #tb-voice { display: none; }
  #tb-right { gap: 4px !important; min-width: 0; }
}
.inner { display: grid; place-items: center; }
