
:root{
  --bg:#F8F1E6;
  --bg-soft:#FBF6EF;
  --card:#FFFDF9;
  --line:#EAD7BF;
  --brown:#5B3318;
  --brown-soft:#866041;
  --orange:#D8832B;
  --orange-dark:#B5641B;
  --shadow:0 16px 36px rgba(91,51,24,.10);
  --radius-xl:28px;
  --radius-lg:22px;
  --radius-md:16px;
}

*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang TC","Noto Sans TC","Microsoft JhengHei",sans-serif;
  color:var(--brown);
  background:
    radial-gradient(circle at 8% 12%, rgba(228,170,108,.16), transparent 20%),
    radial-gradient(circle at 92% 40%, rgba(228,170,108,.13), transparent 18%),
    linear-gradient(180deg,#FCF7F0 0%, #F4E8D8 100%);
}

button,input,textarea{font:inherit}
img{max-width:100%;display:block}

.app-shell{
  width:min(100%, 460px);
  margin:0 auto;
  min-height:100dvh;
  padding:18px 14px calc(18px + env(safe-area-inset-bottom));
  display:flex;
  flex-direction:column;
  gap:14px;
}

.app-top{position:relative}
.brand-bar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
}
.brand-logo{width:220px;max-width:72%}
.install-btn{
  width:42px;height:42px;border-radius:50%;
  border:0;background:linear-gradient(180deg,#E79B45,#D17F35);
  color:#fff;font-size:24px;font-weight:800;box-shadow:var(--shadow);
}

.app-main{
  display:block;
}
.screen{
  display:none;
  width:100%;
  flex-direction:column;
  gap:14px;
}
.screen.active{display:flex}

.hero-card,.card,.bottom-nav,.modal-card{
  background:rgba(255,253,249,.95);
  border:1px solid var(--line);
  border-radius:var(--radius-xl);
  box-shadow:var(--shadow);
}

.hero-card{
  padding:20px;
}
.period-chip,.section-tag,.title-chip{
  display:inline-flex;
  align-items:center;
  border-radius:999px;
  padding:6px 12px;
  font-size:12px;
  font-weight:800;
}
.period-chip{
  background:#FFF1DF;
  color:var(--orange-dark);
  margin-bottom:12px;
}
.section-tag{
  background:linear-gradient(180deg,#D78435,#B86A2C);
  color:#fff;
  margin-bottom:10px;
}
.hero-copy h1{
  margin:0 0 8px;
  font-size:30px;
  line-height:1.2;
}
.hero-sub{
  margin:0;
  color:var(--brown-soft);
  line-height:1.7;
}
.hero-visual{
  margin:14px auto 8px;
  display:flex;
  justify-content:center;
}
.hero-tiger{
  width:min(270px, 100%);
}
.tiger{user-select:none}

.status-row{width:100%}
.status-pill{
  width:100%;
  background:#F5F1EA;
  border:1px solid var(--line);
  border-radius:18px;
  padding:14px 16px;
  display:flex;
  align-items:center;
  gap:10px;
  font-size:18px;
  font-weight:700;
}
.status-icon{font-size:22px}

.action-stack{
  display:grid;
  gap:10px;
  margin-top:14px;
}
.action-stack.compact{margin-top:12px}
.btn{
  border:0;
  border-radius:18px;
  padding:15px 18px;
  font-weight:800;
  cursor:pointer;
  transition:.18s ease;
}
.btn:active{transform:scale(.99)}
.btn-primary{
  background:linear-gradient(180deg,#E58F34,#D87D1D);
  color:#fff;
}
.btn-secondary{
  background:#FFF;
  color:var(--orange-dark);
  border:2px solid #E5A05F;
}
.btn-ghost{
  background:#F2EBE0;
  color:var(--brown);
}
.btn-link{
  background:transparent;
  color:var(--orange-dark);
  text-decoration:underline;
  padding-top:4px;
  padding-bottom:4px;
}
.wide{width:100%}

.card{padding:18px}
.card h2{
  margin:0 0 12px;
  font-size:20px;
}
.tip-text,.small-note,.support-hint,.screen-head p,.card p,.card li{
  color:var(--brown-soft);
  line-height:1.7;
}
.tip-text{margin:0}
.screen-head{
  padding:4px 4px 0;
}
.screen-head h1{
  margin:0 0 8px;
  font-size:28px;
}
.screen-head p{
  margin:0;
}

.period-box{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
}
.info-box,.count-card,.stat-box,.install-box{
  background:#FFF8EF;
  border:1px solid var(--line);
  border-radius:20px;
  padding:16px;
}
.info-box strong,.mini-label,.stat-label{
  display:block;
  font-size:14px;
  color:#9A734A;
  margin-bottom:8px;
}
.info-box span{
  font-size:18px;
  font-weight:800;
}
.count-grid{
  display:grid;
  gap:12px;
}
.big-time,.big-days{
  font-size:26px;
  font-weight:900;
  color:#C26D1A;
}
.count-card.secondary .big-days{font-size:22px}

.first-vote-gallery{
  display:grid;
  gap:14px;
}
.fv-item{
  background:#FFF8EF;
  border:1px solid var(--line);
  border-radius:22px;
  padding:14px;
}
.fv-item h3{
  margin:0 0 10px;
  font-size:17px;
  line-height:1.5;
}
.fv-item p{margin:10px 0 0}
.fv-image{
  border-radius:18px;
  border:1px solid var(--line);
  background:#fff;
}
.note-card ul{
  margin:0;
  padding-left:20px;
}

.card-cheer{
  text-align:center;
}
.badge-line{
  margin-bottom:10px;
}
.title-chip{
  background:#FFF1DF;
  color:var(--orange-dark);
}
.tiger-cheer{
  width:min(220px, 100%);
  margin:0 auto 12px;
}
.stats-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
}
.stat-box{
  text-align:center;
}
.stat-box strong{
  font-size:34px;
  color:#C26D1A;
}
.progress-wrap{display:grid;gap:12px}
.progress-header{
  display:flex;justify-content:space-between;align-items:center;
  font-weight:700;
}
.progress-bar{
  height:14px;border-radius:999px;background:#F0E7D9;overflow:hidden;
}
.progress-bar span{
  display:block;height:100%;width:0;
  background:linear-gradient(90deg,#F0B35E 0%, #D87D1D 100%);
  border-radius:999px;
}

.share-text,.input{
  width:100%;
  border:1px solid var(--line);
  border-radius:18px;
  background:#FFF8EF;
  color:var(--brown);
}
.share-text{
  min-height:132px;
  padding:14px;
  resize:none;
}
.input{
  padding:14px;
}
.field-label{
  display:block;
  margin-bottom:8px;
  font-weight:700;
}
.install-grid{
  display:grid;
  gap:12px;
}
.install-box h3{
  margin:0 0 8px;
  font-size:17px;
  color:var(--orange-dark);
}
.install-box ol{
  margin:0;
  padding-left:18px;
}
.office-logo{
  width:180px;
  margin:0 auto 12px;
}
.official-card{
  text-align:center;
}

.bottom-nav{
  margin-top:auto;
  padding:8px;
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:8px;
  position:static;
}
.nav-btn{
  border:0;
  background:transparent;
  color:#fff;
  background:rgba(91,51,24,.92);
  border-radius:18px;
  padding:14px 6px;
  font-weight:800;
}
.nav-btn.active{
  background:linear-gradient(180deg,#E4943C,#D8832B);
}

.modal{
  position:fixed;inset:0;
  background:rgba(0,0,0,.4);
  display:flex;align-items:center;justify-content:center;
  padding:16px;
  z-index:20;
}
.modal.hidden{display:none}
.modal-card{
  width:min(100%, 360px);
  padding:22px;
  text-align:center;
}
.tiger-done{
  width:150px;margin:0 auto 12px;
}
.modal-card h2{margin:0 0 8px}

.toast{
  position:fixed;
  left:50%;
  bottom:20px;
  transform:translateX(-50%) translateY(20px);
  background:rgba(50,32,20,.92);
  color:#fff;
  padding:10px 16px;
  border-radius:999px;
  opacity:0;
  pointer-events:none;
  transition:.2s ease;
  z-index:30;
  white-space:nowrap;
}
.toast.show{
  opacity:1;
  transform:translateX(-50%) translateY(0);
}

@media (max-width:380px){
  .hero-copy h1{font-size:26px}
  .status-pill{font-size:16px}
  .period-box,.stats-grid{grid-template-columns:1fr}
}

@media (min-width:700px){
  body{padding:18px 0}
}


/* v5.2 return-to-app check-in flow */
.btn.is-hidden{
  display:none !important;
}

/* v5.3 practical test fixes */
.return-checkin-hint{margin-top:12px;padding:14px 16px;border-radius:18px;background:#FFF1DF;border:1px solid #EAC89E;color:#7A4318;display:grid;gap:4px}
.return-checkin-hint strong{font-size:15px}
.return-checkin-hint span{font-size:14px;line-height:1.6}
.is-hidden{display:none!important}
select.input{appearance:auto}


/* v5.4 cheer upgrade */
.featured-achievement{
  width:min(320px, 70vw);
  max-width:320px;
  margin-inline:auto;
}
.mini-chip,.small-chip{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:6px 10px;
  border-radius:999px;
  background:#FFF2DF;
  border:1px solid #E9C79E;
  color:#8B562A;
  font-size:12px;
  font-weight:700;
}
.section-title-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:14px;
  flex-wrap:wrap;
}
.achievement-gallery{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:14px;
}
.achievement-card{
  border:1px solid #E6D4BF;
  border-radius:22px;
  padding:14px;
  background:#FFFDF8;
  display:grid;
  gap:10px;
  box-shadow:0 8px 20px rgba(95,56,21,.05);
}
.achievement-card.locked{
  opacity:.62;
}
.achievement-card img{
  width:100%;
  aspect-ratio:1/1;
  object-fit:contain;
  background:#FFF8EE;
  border-radius:18px;
  padding:8px;
}
.achievement-card h3{
  margin:0;
  font-size:17px;
  color:#5C3318;
}
.achievement-card p{
  margin:0;
  color:#7D5A41;
  font-size:13px;
  line-height:1.55;
}
.achievement-meta{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  flex-wrap:wrap;
}
.achievement-threshold{
  color:#A66C3A;
  font-size:12px;
  font-weight:700;
}
.unlock-chip{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius:999px;
  padding:6px 10px;
  font-size:12px;
  font-weight:700;
}
.unlock-chip.on{
  background:#FFE8C4;
  color:#A35B15;
}
.unlock-chip.off{
  background:#EFE7DD;
  color:#8B7D70;
}
.support-list{
  margin:0;
  padding-left:1.1em;
  color:#7A583C;
  display:grid;
  gap:8px;
}
@media (max-width: 640px){
  .achievement-gallery{grid-template-columns:1fr;}
}


/* v5.5 official medal wall */
.medal-head h1{
  letter-spacing:.02em;
}
.medal-summary-card{
  overflow:hidden;
  position:relative;
}
.medal-summary-card:before{
  content:"";
  position:absolute;
  inset:auto -60px -90px auto;
  width:220px;
  height:220px;
  border-radius:50%;
  background:rgba(216,131,43,.08);
}
.medal-summary-top{
  display:grid;
  grid-template-columns:1.1fr .9fr;
  gap:16px;
  align-items:center;
  position:relative;
  z-index:1;
}
.medal-summary-top h2{
  font-size:27px;
  margin:6px 0 8px;
}
.featured-medal-image{
  width:100%;
  max-height:210px;
  object-fit:contain;
  background:#FFF8EF;
  border:1px solid #E9D5BA;
  border-radius:24px;
  padding:10px;
}
.medal-overview-grid{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:10px;
  margin-top:16px;
  position:relative;
  z-index:1;
}
.overview-box{
  background:#FFF8EF;
  border:1px solid #E8D3B9;
  border-radius:18px;
  padding:14px 10px;
  text-align:center;
}
.overview-box span{
  display:block;
  font-size:12px;
  color:#8C6848;
  margin-bottom:6px;
}
.overview-box strong{
  font-size:20px;
  color:#B76519;
}
.next-medal-box{
  margin-top:14px;
  border-radius:20px;
  border:1px solid #E8D3B9;
  background:linear-gradient(180deg,#FFF8EF,#FFFDF8);
  padding:14px 16px;
  position:relative;
  z-index:1;
}
.next-medal-box strong{
  display:block;
  font-size:18px;
  color:#5B3318;
  margin:4px 0;
}
.next-medal-box p{
  margin:0;
  color:#7A583C;
  line-height:1.55;
}
.medal-book{
  display:grid;
  gap:16px;
}
.medal-chapter{
  background:rgba(255,253,249,.96);
  border:1px solid #E8D3B9;
  border-radius:28px;
  box-shadow:0 16px 36px rgba(91,51,24,.08);
  padding:18px;
}
.chapter-title{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:14px;
  flex-wrap:wrap;
}
.chapter-title h2{
  margin:0;
  font-size:20px;
}
.chapter-title span{
  border-radius:999px;
  padding:6px 10px;
  background:#FFF1DF;
  color:#A45D1F;
  font-size:12px;
  font-weight:800;
}
.medal-grid{
  display:grid;
  grid-template-columns:1fr;
  gap:14px;
}
.medal-card{
  display:grid;
  grid-template-columns:118px 1fr;
  gap:14px;
  padding:14px;
  border-radius:24px;
  background:#FFF8EF;
  border:1px solid #E7D2B8;
  position:relative;
  overflow:hidden;
}
.medal-card.unlocked{
  background:linear-gradient(180deg,#FFF8EF,#FFF3E4);
  border-color:#E4AA63;
}
.medal-card.locked{
  filter:saturate(.82);
}
.medal-card.locked .medal-image{
  opacity:.46;
  filter:grayscale(.65);
}
.medal-image-wrap{
  background:#FFFDF8;
  border:1px solid #E6D4BF;
  border-radius:22px;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:8px;
}
.medal-image{
  width:100%;
  aspect-ratio:1/1;
  object-fit:contain;
}
.medal-content{
  min-width:0;
}
.medal-no{
  display:inline-flex;
  border-radius:999px;
  padding:5px 9px;
  background:#5B3318;
  color:#fff;
  font-size:11px;
  font-weight:800;
  letter-spacing:.06em;
}
.medal-card.unlocked .medal-no{
  background:#D8832B;
}
.medal-card h3{
  margin:8px 0 6px;
  font-size:18px;
  color:#5B3318;
}
.medal-card p{
  margin:0;
  color:#78583F;
  line-height:1.58;
  font-size:14px;
}
.medal-meta{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  margin-top:10px;
}
.medal-meta span{
  border-radius:999px;
  padding:6px 9px;
  background:#FFFDF8;
  border:1px solid #E7D2B8;
  color:#8C5F37;
  font-size:12px;
  font-weight:700;
}
.medal-state{
  position:absolute;
  right:12px;
  top:12px;
  border-radius:999px;
  padding:6px 10px;
  font-size:12px;
  font-weight:900;
}
.medal-state.on{
  background:#FFE2B6;
  color:#A45D1F;
}
.medal-state.off{
  background:#EEE5D9;
  color:#8B8074;
}
@media (max-width:420px){
  .medal-summary-top{
    grid-template-columns:1fr;
  }
  .medal-overview-grid{
    grid-template-columns:1fr;
  }
  .medal-card{
    grid-template-columns:96px 1fr;
    gap:12px;
  }
}
