* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

html, body {
  height: 100%;
  overflow: hidden;
  background: #FBF3E4;
  font-family: sans-serif;
  color: #22303A;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 11px calc(env(safe-area-inset-bottom, 0px) + 10px);
}

/* ---------- 顶部进度 ---------- */
#topline {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}
#topbar {
  flex: 1 1 auto;
  height: 14px;
  border-radius: 7px;
  background: #E8DBC0;
  overflow: hidden;
}
#bar {
  height: 100%;
  width: 0%;
  border-radius: 7px;
  background: linear-gradient(90deg, #F2C14E, #D9822B);
  transition: width .6s ease;
}
#pgText {
  font-size: 15px;
  color: #9A8358;
  font-weight: 600;
  letter-spacing: .5px;
  min-width: 46px;
  text-align: right;
}

/* ---------- 主舞台 ---------- */
#stage {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 0;
}

#board {
  width: min(96vw, 62vh);
  height: min(96vw, 62vh);
  display: block;
  border-radius: 28px;
  background: #FFFDF7;
  box-shadow: 0 10px 30px rgba(120, 90, 40, .13), inset 0 0 0 3px #F2E6CE;
}

/* ---------- 底部按钮 ---------- */
#dock {
  flex: 0 0 auto;
  height: 18vh;
  min-height: 92px;
  max-height: 150px;
  display: flex;
  gap: 14px;
  align-items: stretch;
  padding-top: 12px;
}

.bigbtn {
  flex: 1 1 auto;
  border: none;
  border-radius: 34px;
  background: linear-gradient(180deg, #4CAF50, #2E7D32);
  box-shadow: 0 8px 0 #1F5C24, 0 12px 22px rgba(46,125,50,.28);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  transition: transform .12s, box-shadow .12s, opacity .2s;
}
.bigbtn:active {
  transform: translateY(6px);
  box-shadow: 0 2px 0 #1F5C24, 0 4px 10px rgba(46,125,50,.25);
}

.tri {
  width: 0; height: 0;
  border-left: 34px solid #fff;
  border-top: 22px solid transparent;
  border-bottom: 22px solid transparent;
  margin-left: 6px;
}
.tick {
  width: 44px; height: 24px;
  border-left: 9px solid #fff;
  border-bottom: 9px solid #fff;
  transform: rotate(-45deg) translate(4px, -6px);
  border-radius: 2px;
}
.lbl {
  font-size: 21px;
  font-weight: 700;
  color: #FFF8EC;
  letter-spacing: 2px;
}
.lb-dark { color: #7A4E0B; }

.sidebtn {
  flex: 0 0 27%;
  border: none;
  border-radius: 34px;
  background: linear-gradient(180deg, #FFD98A, #E8B23A);
  box-shadow: 0 8px 0 #C08A1C, 0 12px 22px rgba(232,178,58,.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: transform .12s, box-shadow .12s;
}
.sidebtn:active {
  transform: translateY(6px);
  box-shadow: 0 2px 0 #C08A1C;
}
.sidebtn svg { width: 40%; height: 40%; fill: #7A4E0B; }
.sidebtn .lbl { font-size: 17px; letter-spacing: 1px; }

/* ---------- 提示浮层 ---------- */
#toast {
  position: absolute;
  left: 50%;
  top: 4%;
  transform: translateX(-50%);
  background: rgba(192,57,43,.95);
  color: #fff;
  padding: 15px 28px;
  border-radius: 20px;
  font-size: 24px;
  font-weight: 600;
  opacity: 0;
  transition: opacity .25s;
  pointer-events: none;
  white-space: nowrap;
}
#toast.show { opacity: 1; }

/* ---------- 星星 ---------- */
#stars {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.star {
  position: absolute;
  font-size: 40px;
  animation: pop .9s ease-out forwards;
  color: #E8B23A;
  text-shadow: 0 0 12px rgba(232,178,58,.8);
}
@keyframes pop {
  0% { transform: scale(.2) translateY(0); opacity: 0; }
  30% { transform: scale(1.2) translateY(-30px); opacity: 1; }
  100% { transform: scale(.8) translateY(-120px); opacity: 0; }
}

/* ---------- 启动页 ---------- */
#boot {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 42%, #FFFDF7 0%, #F6E7C8 62%, #EFD9AE 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  transition: opacity .5s;
}
#boot.hide { opacity: 0; pointer-events: none; }

.boot-ring {
  width: min(46vw, 200px);
  height: min(46vw, 200px);
  border-radius: 50%;
  border: 12px solid #E8B23A;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: breathe 2s ease-in-out infinite;
  box-shadow: 0 0 0 18px rgba(232,178,58,.16), 0 0 60px rgba(232,178,58,.35);
}
.boot-dot {
  width: 62%;
  height: 62%;
  border-radius: 50%;
  background: linear-gradient(180deg,#4CAF50,#2E7D32);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 -6px 14px rgba(0,0,0,.18);
}
@keyframes breathe {
  0%,100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.finger {
  position: absolute;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: 5px solid rgba(255,255,255,.9);
  animation: tap 1.6s ease-in-out infinite;
}
@keyframes tap {
  0%,100% { transform: scale(1.5); opacity: 0; }
  40% { transform: scale(.9); opacity: .9; }
  70% { transform: scale(1.25); opacity: 0; }
}

/* ---------- 组间休息 / 全部完成 ---------- */
#group, #finish {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 40%, #FFFDF7 0%, #F7E6BF 65%, #EFD59C 100%);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  z-index: 40;
}
#group.show, #finish.show { display: flex; }

.medal {
  width: min(46vw, 210px);
  height: min(46vw, 210px);
  border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, #FFE79A, #E8B23A 60%, #C08A1C);
  box-shadow: 0 16px 40px rgba(192,138,28,.45), inset 0 -10px 22px rgba(0,0,0,.18);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: breathe 2.4s ease-in-out infinite;
}
.medal.small {
  width: min(34vw, 150px);
  height: min(34vw, 150px);
}
.medal .num {
  font-size: min(14vw, 62px);
  font-weight: 800;
  color: #7A4E0B;
}
.medal.small .num { font-size: min(10vw, 44px); }

.group-hint, .finish-hint {
  font-size: 19px;
  color: #8A7248;
}
.group-btn {
  width: min(62vw, 260px);
  height: 96px;
  border-radius: 48px;
  background: linear-gradient(180deg, #4CAF50, #2E7D32);
  box-shadow: 0 8px 0 #1F5C24, 0 12px 26px rgba(46,125,50,.3);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: breathe 2s ease-in-out infinite;
}
.group-btn .tri {
  border-left-width: 30px;
  border-top-width: 19px;
  border-bottom-width: 19px;
}
