* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body {
  font-family: -apple-system, "PingFang TC", "Noto Sans TC", sans-serif;
  background: #0d1b2a; color: #fff; min-height: 100vh;
}
#app { max-width: 480px; margin: 0 auto; padding: 24px 20px 40px; }
.view { text-align: center; }
.hidden { display: none !important; }

h1 { font-size: 1.5rem; line-height: 1.4; margin-bottom: 8px; }
.sub { color: #a8c0d8; font-size: .95rem; margin-bottom: 16px; }
.deadline { color: #ffd166; font-size: .85rem; margin-bottom: 16px; }
.msg { margin-top: 12px; font-size: .9rem; color: #ffd166; min-height: 1.2em; }
.hint { margin-top: 16px; font-size: .8rem; color: #6b8aa5; }

.btn {
  display: block; width: 100%; padding: 14px; margin-top: 12px;
  border: none; border-radius: 12px; font-size: 1rem; font-weight: 700; cursor: pointer;
}
.btn.primary { background: #06c755; color: #fff; }
.btn.primary:disabled { background: #2e4a5e; color: #6b8aa5; }
.btn.outline { background: transparent; color: #06c755; border: 2px solid #06c755; }
.btn.link { background: none; color: #a8c0d8; font-weight: 400; text-decoration: underline; }

.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 16px 0; }
.team-card {
  background: #1b2f45; border: 2px solid transparent; border-radius: 14px;
  padding: 14px 8px; cursor: pointer; transition: border-color .15s, transform .1s;
}
.team-card img { width: 64px; height: 44px; object-fit: cover; border-radius: 6px; }
.team-card .name { margin-top: 8px; font-weight: 700; }
.team-card.selected { border-color: #06c755; background: #14402a; transform: scale(1.02); }

.tabs { display: flex; gap: 8px; justify-content: center; margin-bottom: 12px; }
.tab {
  padding: 8px 18px; border-radius: 999px; border: 1px solid #2e4a5e;
  background: transparent; color: #a8c0d8; cursor: pointer;
}
.tab.active { background: #06c755; border-color: #06c755; color: #fff; }

#stats-bars { text-align: left; margin: 8px 0 20px; }
.stat-row { margin-bottom: 10px; }
.stat-label { display: flex; justify-content: space-between; font-size: .9rem; margin-bottom: 4px; }
.stat-track { background: #1b2f45; border-radius: 6px; height: 14px; overflow: hidden; }
.stat-fill { height: 100%; background: linear-gradient(90deg, #06c755, #4ade80); border-radius: 6px; min-width: 2px; }
.stat-fill.mine { background: linear-gradient(90deg, #ffd166, #fca311); }

.progress-wrap { margin: 20px 0; }
.progress-bar { background: #1b2f45; border-radius: 999px; height: 18px; overflow: hidden; }
#ref-progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, #06c755, #4ade80); transition: width .4s; }
.progress-text { margin-top: 8px; font-size: 1.2rem; font-weight: 700; }

/* ===== 扭蛋 ===== */
.gacha {
  width: 150px; height: 150px; margin: 36px auto 8px;
  position: relative; cursor: pointer;
  filter: drop-shadow(0 8px 16px rgba(0,0,0,.45));
}
.cap-top, .cap-bottom { position: absolute; left: 0; width: 150px; height: 75px; transition: transform .45s ease, opacity .45s; }
.cap-top { top: 0; background: linear-gradient(180deg, #ff5d8f, #ef476f); border-radius: 75px 75px 0 0; }
.cap-top::after { /* 高光 */
  content: ''; position: absolute; top: 14px; left: 24px;
  width: 36px; height: 18px; background: rgba(255,255,255,.55); border-radius: 50%; transform: rotate(-20deg);
}
.cap-bottom { bottom: 0; background: linear-gradient(180deg, #f8f9fa, #ced4da); border-radius: 0 0 75px 75px; }
.gacha.shake { animation: gacha-shake .9s ease; }
@keyframes gacha-shake {
  0%, 100% { transform: rotate(0); }
  12% { transform: rotate(-14deg) translateX(-4px); }
  28% { transform: rotate(11deg) translateX(4px); }
  44% { transform: rotate(-9deg); }
  60% { transform: rotate(7deg); }
  76% { transform: rotate(-4deg); }
  88% { transform: rotate(2deg); }
}
.gacha.open .cap-top { transform: translateY(-70px) rotate(-25deg); opacity: 0; }
.gacha.open .cap-bottom { transform: translateY(70px) rotate(25deg); opacity: 0; }
.gacha-result {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 72px; transform: scale(0);
  transition: transform .4s cubic-bezier(.18, 1.7, .45, 1) .15s;
}
.gacha.open .gacha-result { transform: scale(1); }

.spinner {
  width: 40px; height: 40px; margin: 80px auto 16px;
  border: 4px solid #1b2f45; border-top-color: #06c755; border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
