@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&display=swap");

/* ============================ TOKENS ============================ */
:root {
  --bg: #eef2f5;
  --card: #ffffff;
  --text: #1e1e1e;
  --muted: #97a4a6;
  --line: #e9edf3;

  --blue: #66b6e8;
  --blue-dark: #4ba3dc;
  --blue-soft: #eaf6ff;
  --blue-line: #cbd5f5;

  --green: #a4d6ba;
  --green-soft: #dff0e5;
  --green-ink: #3e8e63;
  --red: #ff9d9d;
  --red-soft: #ffe3e3;
  --gold: #ffb11b;
  --gold-soft: #fff4de;

  --r-xl: 32px;
  --r-lg: 24px;
  --r-md: 16px;
  --r-pill: 999px;

  --shadow: 0 10px 30px rgba(24, 50, 80, 0.06);
  --sidebar-w: 248px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: "Poppins", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
img { max-width: 100%; }

/* ============================ BUTTONS ============================ */
.btnPrimary {
  background: var(--blue);
  color: #fff;
  font-weight: 600;
  border-radius: var(--r-pill);
  padding: 15px 28px;
  transition: background .15s ease, transform .15s ease;
}
.btnPrimary:hover { background: var(--blue-dark); }
.btnPrimary:active { transform: translateY(1px); }
.btnPrimary:disabled { opacity: .55; cursor: default; }

.btnGhost {
  background: var(--blue-soft);
  color: var(--text);
  font-weight: 500;
  border-radius: var(--r-pill);
  padding: 15px 28px;
  transition: background .15s ease;
}
.btnGhost:hover { background: #dcefff; }

/* ============================ LOGIN ============================ */
.loginScreen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
body:not(.show-login) .loginScreen { display: none; }

.loginCard {
  width: min(420px, 100%);
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.loginLogo { width: 190px; margin-bottom: 30px; }
.loginService {
  position: absolute;
  width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%);
}
.formRow { width: 100%; position: relative; }
.formRow input {
  width: 100%;
  border: none;
  background: #fff;
  border-radius: var(--r-pill);
  padding: 20px 24px;
  font-size: 16px;
  font-family: inherit;
  color: var(--text);
  outline: none;
  transition: box-shadow .15s ease;
}
.formRow input:focus { box-shadow: 0 0 0 2px var(--blue); }
.formRowPass input { padding-right: 60px; }
.passToggle {
  position: absolute;
  right: 20px; top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  display: flex;
}
.loginError { color: #eb5757; font-weight: 500; min-height: 20px; text-align: center; }
.loginSubmit { width: 100%; margin-top: 10px; }

/* ============================ SHELL ============================ */
#app {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
}

#sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 28px 18px 22px;
  background: #fff;
  border-right: 1px solid var(--line);
}
.sbBrand { padding: 0 10px; display: flex; flex-direction: column; gap: 4px; }
.sbLogo { width: 128px; }
.sbTag { font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: .12em; text-transform: uppercase; padding-left: 2px; }

.sbNav { display: flex; flex-direction: column; gap: 6px; }
.sbItem {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 16px;
  border-radius: var(--r-md);
  color: #6b7580;
  font-weight: 500;
  transition: background .15s ease, color .15s ease;
}
.sbItem:hover { background: #f4f8fb; color: var(--text); }
.sbItem.is-active { background: var(--blue-soft); color: var(--text); font-weight: 600; }
.sbIcon { width: 22px; height: 22px; fill: currentColor; flex: none; }

.sbLogout {
  margin-top: auto;
  display: flex; align-items: center; gap: 14px;
  padding: 13px 16px;
  border-radius: var(--r-md);
  color: #6b7580;
  font-weight: 500;
}
.sbLogout:hover { background: #fdf0f0; color: #eb5757; }

#main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

#topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(16px, 3vw, 40px);
  background: rgba(238, 242, 245, .92);
  backdrop-filter: blur(8px);
}
.tbLeft { display: flex; align-items: center; gap: 12px; min-width: 0; }
.tbMiniLogo { width: 30px; display: none; }
.tbTitle { font-size: clamp(20px, 2.6vw, 30px); font-weight: 600; }

.tbRight { display: flex; align-items: center; gap: 10px; }
.pill {
  display: flex; align-items: center; gap: 7px;
  background: #fff;
  border-radius: var(--r-pill);
  padding: 10px 18px;
  font-weight: 600;
  min-width: 82px;
  justify-content: center;
}
.pillIcon { width: 20px; height: 20px; object-fit: contain; }
.pillStreak.is-hot { background: var(--gold-soft); }
.tbAvatar { width: 46px; height: 46px; border-radius: 50%; }

#views { flex: 1; padding: 4px clamp(16px, 3vw, 40px) 40px; }
.view { max-width: 1180px; margin: 0 auto; animation: fadeUp .22s ease; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.card {
  background: var(--card);
  border-radius: var(--r-xl);
  padding: 26px;
  box-shadow: var(--shadow);
}
.cardTitle { font-weight: 600; font-size: 17px; }

/* ============================ HOME ============================ */
.homeGrid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(260px, .95fr);
  gap: 22px;
  align-items: start;
}
.hello { font-size: clamp(30px, 4vw, 48px); font-weight: 500; margin-bottom: 18px; }

.chapterCard { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 28px; align-items: center; }
.chapterArt {
  width: 190px; height: 190px;
  border-radius: 42px;
  background: var(--blue-soft);
  display: grid; place-items: center;
  overflow: hidden;
  flex: none;
}
.chapterArt img { width: 100%; height: 100%; object-fit: cover; }
.chapterEnding { color: var(--muted); font-weight: 600; font-size: 14px; }
.chapterName { font-size: clamp(22px, 2.4vw, 30px); font-weight: 700; margin: 4px 0 18px; }

.statsRow { display: flex; align-items: stretch; gap: 18px; }
.stat { display: flex; align-items: center; gap: 12px; }
.stat img { width: 46px; height: 46px; object-fit: contain; }
.stat div { display: flex; flex-direction: column; }
.statLabel { font-size: 15px; }
.statValue { font-size: 26px; font-weight: 700; }
.statDivider { width: 1px; background: #e5eaf0; }

.chapterActions { display: flex; gap: 12px; margin-top: 22px; flex-wrap: wrap; }
.chapterActions button { flex: 1 1 150px; }

.homeSide { display: grid; gap: 18px; }
.sideCard { padding: 22px; }
.sideLabel { font-size: 13px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.sideStreak { display: flex; align-items: center; gap: 12px; margin: 12px 0 14px; }
.sideStreak img { width: 54px; height: 54px; }
.sideStreak strong { display: block; font-size: 28px; font-weight: 700; line-height: 1.1; }
.sideStreak span { font-size: 14px; color: var(--muted); }
.weekDots { display: flex; gap: 6px; }
.weekDots i {
  flex: 1; height: 10px; border-radius: 5px; background: #eef3f4;
}
.weekDots i.is-done { background: var(--gold); }
.weekDots i.is-missed { background: #bde7ff; }

.sideQuestTitle { font-weight: 600; margin: 10px 0 12px; }
.sideQuestCount { font-size: 13px; color: var(--muted); font-weight: 600; }
.sideRank { display: flex; align-items: baseline; gap: 10px; margin-top: 10px; }
.sideRank strong { font-size: 34px; font-weight: 700; }
.sideRank span { color: var(--muted); font-size: 14px; }

.bar { position: relative; height: 16px; border-radius: var(--r-pill); background: #eef3f4; overflow: visible; }
.bar > .barFill { height: 100%; border-radius: var(--r-pill); transition: width .4s ease; }
.barTall { height: 20px; }
.barFillGold { background: linear-gradient(90deg, #ffe37b, #ff9600); }
.barFillBlue { background: linear-gradient(90deg, #9fd8f6, #66b6e8); }
.barTip {
  position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%);
  background: #161616; color: #fff; font-size: 13px; font-weight: 700;
  padding: 5px 12px; border-radius: 12px; white-space: nowrap;
}

/* ============================ EVENTS ============================ */
.questGrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 22px; }
.questCard { display: flex; flex-direction: column; gap: 18px; }
.questBadges { display: flex; gap: 8px; justify-content: flex-end; }
.badge { border-radius: var(--r-pill); padding: 6px 16px; font-size: 13px; font-weight: 700; color: #fff; }
.badgeDaily { background: var(--gold); }
.badgeMonthly { background: #57c4f4; }
.badgeReward { background: #fff7ec; border: 1px solid #ffcf73; color: #161616; display: flex; align-items: center; gap: 5px; }
.badgeReward.is-blue { background: #e9f7ff; border-color: #a8e1ff; }
.badgeReward img { width: 14px; height: 14px; }
.questMain { display: flex; align-items: center; gap: 22px; }
.questMain > img { width: 66px; height: 66px; flex: none; }
.questComplete { color: #9ba9ad; font-weight: 500; }
.questName { font-size: clamp(22px, 2.2vw, 30px); font-weight: 500; line-height: 1.2; }
.questName small { font-size: .6em; display: block; color: #050505; }
.questFoot { display: flex; align-items: center; gap: 12px; }
.questFoot .bar { flex: 1; }
.questFoot > img { width: 62px; height: 54px; object-fit: contain; }

/* ============================ TROPHIES ============================ */
.trophyGrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 22px; align-items: start; }
.streakCard { display: flex; flex-direction: column; align-items: center; text-align: center; }
.streakFlame { width: 150px; height: 150px; }
.streakDays { font-size: 32px; font-weight: 600; }
.streakBest { color: #6e737a; font-size: 14px; margin-top: 6px; }
.weekRow { display: flex; gap: 8px; width: 100%; margin-top: 24px; justify-content: space-between; }
.weekRow div { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.weekRow span.dot {
  width: 100%; max-width: 44px; height: 34px; border-radius: 17px; background: #eef3f4;
  display: grid; place-items: center; color: #fff; font-weight: 800;
}
.weekRow span.dot.is-done { background: var(--gold); }
.weekRow span.dot.is-missed { background: #bde7ff; }
.weekRow small { font-size: 12px; }

.rewardsCard { display: flex; flex-direction: column; gap: 16px; }
.rewardsRow { display: flex; justify-content: space-around; }
.rewardItem { display: flex; flex-direction: column; align-items: center; }
.rewardMark {
  background: #65c7f8; color: #fff; font-size: 11px; font-weight: 700;
  border-radius: 14px; padding: 4px 10px; margin-bottom: -8px; z-index: 2;
}
.rewardMark.is-done { background: var(--gold); font-size: 15px; }
.rewardBubble {
  width: 74px; height: 74px; border-radius: 50%;
  background: #eef7fa; border: 1px solid #bde7ff;
  display: grid; place-items: center;
}
.rewardBubble.is-done { background: #eaf8ff; border-color: #9cdcff; }
.rewardBubble img { width: 50px; height: 50px; }
.rewardBubble:not(.is-done) img { opacity: .4; }
#rewardBarWrap { cursor: pointer; }

/* ============================ RANKING ============================ */
.rankHead { display: flex; justify-content: flex-end; margin-bottom: 18px; }
.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 500; }
.switch input { display: none; }
.switchTrack { width: 60px; height: 32px; border-radius: var(--r-pill); background: #fff; padding: 4px; display: flex; }
.switchThumb { width: 24px; height: 24px; border-radius: 50%; background: #facc15; transition: transform .2s ease, background .2s ease; }
.switch input:checked + .switchTrack .switchThumb { transform: translateX(28px); background: var(--blue); }

.soloCard { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 40px 26px; }
.soloBar {
  width: 110px; border-radius: 18px; background: linear-gradient(0deg, #fc9c02, #ffcc00);
  display: flex; align-items: flex-end; justify-content: center; padding-bottom: 26px; color: #111; font-weight: 700;
  gap: 8px;
}
.soloBar img { width: 20px; height: 20px; }
.soloName { display: flex; align-items: center; }
.soloName img { width: 44px; height: 44px; border-radius: 50%; margin-right: -14px; z-index: 2; }
.soloName span { background: #fff; border-radius: var(--r-pill); padding: 10px 22px 10px 26px; font-weight: 500; }
.soloHint { color: var(--muted); text-align: center; }

.podium { display: flex; align-items: flex-end; justify-content: center; gap: clamp(10px, 3vw, 34px); margin-bottom: 26px; }
.podCol { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.podBar {
  width: clamp(74px, 12vw, 110px); border-radius: 18px; background: #a3cbe5;
  display: flex; align-items: flex-end; justify-content: center; gap: 8px;
  padding-bottom: 24px; font-weight: 700; color: #111;
}
.podBar.is-me { background: linear-gradient(0deg, #fc9c02, #ffcc00); }
.podBar.is-dim { background: rgba(163, 203, 229, .4); }
.podBar img { width: 18px; height: 18px; }
.podName { background: #fff; border-radius: var(--r-pill); padding: 9px 20px; font-weight: 500; font-size: 15px; }

.rankList { padding: 10px 14px; }
.rankRow { display: flex; align-items: center; gap: 14px; padding: 15px 16px; border-radius: var(--r-md); }
.rankRow.is-alt { background: #f7fafc; }
.rankRow.is-me { background: var(--blue-soft); font-weight: 600; }
.rankPlace { width: 30px; font-weight: 600; }
.rankName { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }
.rankName img { width: 26px; height: 26px; border-radius: 50%; }
.rankName span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rankPoints { font-weight: 700; white-space: nowrap; }

/* ============================ RESOURCES ============================ */
.resHead { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.btnBack { display: flex; align-items: center; gap: 12px; font-weight: 600; }
.btnBack img { width: 14px; height: 14px; }
.resCount { display: flex; align-items: center; gap: 12px; }
.resCount img { width: 54px; height: 54px; object-fit: contain; }
.resCount div { display: flex; flex-direction: column; }
.resCount span { color: var(--muted); font-size: 14px; }
.resCount strong { font-size: 26px; font-weight: 700; }

.resGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; }
.resTile {
  background: #fff; border-radius: var(--r-xl); overflow: hidden;
  aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  box-shadow: var(--shadow); position: relative; transition: transform .15s ease;
}
.resTile:hover { transform: translateY(-3px); }
.resTile img { width: 55%; height: 55%; object-fit: contain; }
.resTile span {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: #fff; border-top: 1px solid var(--line);
  padding: 16px 20px; font-weight: 700; font-size: 15px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.resEmpty { color: var(--muted); }

/* ============================ LESSON ============================ */
.viewLesson { max-width: 820px; }
.lessonWrap { display: flex; flex-direction: column; gap: 14px; }
.lessonTop { display: flex; align-items: center; gap: 14px; }
.lessonAvatar { width: 46px; height: 46px; border-radius: 50%; }
.lessonTop .bar { flex: 1; }
.lessonQuit { color: var(--muted); font-size: 22px; padding: 4px 8px; }
.lessonQuit:hover { color: var(--text); }
.lessonTitle { font-size: clamp(26px, 3.4vw, 38px); font-weight: 500; margin-top: 10px; }
.lessonStep { color: var(--muted); font-weight: 500; }
.lessonCard { min-height: 260px; padding: clamp(22px, 3vw, 34px); display: flex; flex-direction: column; justify-content: center; }
.lessonActions { display: flex; justify-content: center; }
.lessonActions .btnPrimary { width: min(420px, 100%); }

/* --- type 1: sentence order --- */
.shelfArea { display: flex; flex-direction: column; gap: 12px; }
.shelf { min-height: 56px; border-bottom: 2px solid #e5eaf0; display: flex; flex-wrap: wrap; gap: 10px; align-content: flex-start; padding-bottom: 10px; }
.wordPool { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; justify-content: center; }
.wordPill {
  background: var(--blue-soft); border-radius: var(--r-pill);
  padding: 11px 20px; font-weight: 500; transition: transform .12s ease, background .15s ease;
}
.wordPill:hover { background: #dcefff; transform: translateY(-1px); }

/* --- type 2/3: gaps --- */
.gapSentence { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; justify-content: center; font-size: clamp(17px, 2vw, 21px); line-height: 1.9; }
.gapInput {
  border: none; border-bottom: 2px solid var(--blue); background: var(--blue-soft);
  border-radius: 12px 12px 0 0; padding: 8px 14px; font: inherit; font-weight: 600;
  text-align: center; outline: none; min-width: 90px;
}
.gapInput:focus { background: #dcefff; }
.letterRow { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center; font-size: clamp(28px, 5vw, 44px); font-weight: 600; }
.letterInput {
  width: 52px; height: 58px; border: none; background: var(--blue-soft);
  border-radius: 14px; text-align: center; font: inherit; font-size: clamp(24px, 4vw, 34px); outline: none;
}
.letterInput:focus { box-shadow: 0 0 0 2px var(--blue); }
.gapHint { text-align: center; color: var(--muted); font-weight: 600; margin-bottom: 14px; }

/* --- type 4: match --- */
.matchRows { display: flex; flex-direction: column; gap: 14px; }
.matchRow { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.matchPill {
  border-radius: var(--r-pill); padding: 14px 20px; text-align: center; font-weight: 500;
  border: 1px solid transparent; transition: background .15s ease, border-color .15s ease;
}
.matchLeft { background: var(--blue-soft); }
.matchRight { background: #fff; border-color: var(--blue-line); }
.matchPill.is-sel { border-color: var(--blue); border-width: 2px; }
.matchPill.is-ok { background: var(--green-soft); border-color: var(--green); border-width: 2px; }
.matchPill.is-bad { background: var(--red-soft); border-color: var(--red); border-width: 2px; }
.matchPill:disabled { cursor: default; }

/* --- type 5: choice --- */
.choiceQuestion { text-align: center; font-size: clamp(19px, 2.2vw, 24px); margin-bottom: 22px; }
.choiceList { display: flex; flex-direction: column; gap: 10px; }
.choiceOption {
  display: flex; align-items: center; gap: 14px; text-align: left;
  background: #fff; border: 1px solid var(--blue-line); border-radius: 26px;
  padding: 13px 16px; transition: background .15s ease, border-color .15s ease;
}
.choiceOption:hover { background: #f7fbff; }
.choiceOption.is-sel { background: var(--blue-soft); border-color: var(--blue); border-width: 2px; }
.choiceOption.is-ok { background: var(--green-soft); border-color: var(--green); border-width: 2px; }
.choiceOption.is-bad { background: var(--red-soft); border-color: var(--red); border-width: 2px; }
.choiceBadge {
  width: 34px; height: 34px; border-radius: 50%; background: var(--blue-soft);
  display: grid; place-items: center; text-transform: uppercase; flex: none;
}
.choiceOption.is-sel .choiceBadge { background: var(--blue); color: #fff; }

/* --- feedback --- */
.feedback {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: flex-end; justify-content: center;
  padding: 22px;
  background: rgba(20, 32, 44, .12);
  animation: fadeUp .2s ease;
}
.feedbackCard {
  width: min(760px, 100%);
  border-radius: 42px;
  padding: 28px 32px 20px;
  background: var(--green);
  color: #fff;
}
.feedbackCard.is-bad { background: var(--red); }
.fbTitle { font-size: clamp(26px, 3.4vw, 34px); font-weight: 700; display: block; }
.fbBody { margin-top: 8px; font-size: 18px; font-weight: 500; }
.fbAnswer { font-size: 20px; margin-top: 8px; line-height: 1.5; white-space: pre-line; }
.fbBtn { margin-top: 16px; width: 100%; padding: 12px; font-size: 18px; font-weight: 700; color: #fff; }

.xpPop {
  position: fixed; left: 50%; bottom: 42%; transform: translateX(-50%);
  z-index: 70; display: flex; align-items: center; gap: 2px;
  font-size: 30px; font-weight: 800; color: var(--green-ink);
  animation: xpPop 1.6s ease forwards;
  pointer-events: none;
}
.xpPop img { width: 26px; height: 26px; }
@keyframes xpPop {
  0% { opacity: 0; transform: translate(-50%, 60px) scale(.6); }
  18% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  75% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -26px) scale(1); }
}

/* ============================ SUMMARY ============================ */
.summaryWrap { display: flex; flex-direction: column; align-items: center; gap: 26px; padding-top: 20px; }
.summaryTitle { font-size: clamp(30px, 4vw, 46px); font-weight: 600; }
.summaryGrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; width: 100%; }
.sumCard { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.sumCard img { width: 54px; height: 54px; }
.sumCard strong { font-size: 32px; font-weight: 700; }
.sumCard span { color: var(--muted); }
.summaryBtn { width: min(420px, 100%); }

/* ============================ SKELETON ============================ */
.skel { background: #dfe7ee; border-radius: var(--r-md); animation: pulse 1.5s ease-in-out infinite; }
.skel + .skel { margin-top: 12px; }
@keyframes pulse { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }

/* ============================ BOTTOM NAV ============================ */
#bottomNav {
  position: sticky; bottom: 0; z-index: 30;
  display: none;
  background: var(--bg);
  padding: 10px max(12px, env(safe-area-inset-left)) max(10px, env(safe-area-inset-bottom));
  justify-content: space-around;
  border-top: 1px solid var(--line);
}
.bnItem { padding: 10px 14px; color: #b8c4cc; }
.bnItem svg { width: 26px; height: 26px; fill: currentColor; display: block; }
.bnItem.is-active { color: var(--text); }

/* ============================ RESPONSIVE ============================ */
@media (max-width: 1080px) {
  :root { --sidebar-w: 92px; }
  .sbItem span, .sbLogout span, .sbTag { display: none; }
  .sbItem, .sbLogout { justify-content: center; padding: 14px 0; }
  .sbLogo { width: 44px; }
  .sbBrand { align-items: center; padding: 0; }
  .homeGrid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 860px) {
  #app { grid-template-columns: minmax(0, 1fr); }
  #sidebar { display: none; }
  #bottomNav { display: flex; }
  .tbMiniLogo { display: block; }
  .tbTitle { display: none; }
  #topbar { padding: 14px 16px; }
  .pill { padding: 9px 14px; min-width: 72px; }
  .tbAvatar { width: 42px; height: 42px; }
  #views { padding: 4px 16px 24px; }
  .chapterCard { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; gap: 18px; }
  .chapterArt { width: 160px; height: 160px; }
  .statsRow { justify-content: center; }
  .chapterActions { width: 100%; }
  .card { padding: 22px; border-radius: var(--r-lg); }
  .feedbackCard { border-radius: 32px; padding: 24px 22px 16px; }
}

@media (max-width: 520px) {
  .matchRow { gap: 10px; }
  .matchPill { padding: 13px 10px; font-size: 15px; }
  .resGrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .resTile span { padding: 12px 14px; font-size: 13px; }
  .statValue { font-size: 22px; }
  .podium { gap: 8px; }
  .summaryGrid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
  .sumCard { padding: 18px; }
  .sumCard strong { font-size: 26px; }
}

/* ---------- quest reward banners (summary) ---------- */
.sumRewards { display: grid; gap: 12px; width: 100%; }
.rewardBanner {
  display: flex; align-items: center; gap: 16px;
  background: var(--gold-soft); border-radius: var(--r-lg); padding: 16px 22px;
}
.rewardBanner.is-monthly { background: #e1f3ff; }
.rewardBanner img { width: 52px; height: 46px; object-fit: contain; }
.rewardBanner strong { display: block; font-weight: 700; }
.rewardBanner span { color: var(--muted); font-weight: 600; }
