:root {
  color-scheme: light;
  --navy: #102343;
  --navy-2: #19365f;
  --ink: #18233a;
  --muted: #6f7888;
  --cream: #fffaf1;
  --paper: #ffffff;
  --canvas: #f3f4ed;
  --coral: #ff765f;
  --coral-dark: #e85643;
  --mint: #56cfac;
  --mint-dark: #229e7c;
  --gold: #ffc857;
  --line: #e5e7de;
  --shadow: 0 18px 50px rgba(16, 35, 67, .12);
  --shadow-small: 0 8px 20px rgba(16, 35, 67, .10);
  --radius: 24px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 94px; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 0%, rgba(86, 207, 172, .13), transparent 31rem),
    radial-gradient(circle at 86% 13%, rgba(255, 118, 95, .12), transparent 28rem),
    var(--canvas);
  font-family: Inter, ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
a { color: inherit; text-decoration: none; }
.ambient { position: fixed; pointer-events: none; z-index: -1; border-radius: 50%; filter: blur(1px); opacity: .45; }
.ambient-one { width: 220px; height: 220px; background: rgba(255, 200, 87, .18); left: -80px; top: 42%; }
.ambient-two { width: 280px; height: 280px; background: rgba(86, 207, 172, .14); right: -140px; top: 67%; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 78px;
  padding: 10px max(24px, calc((100% - 1180px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(243, 244, 237, .82);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(16, 35, 67, .08);
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand img { border-radius: 15px; box-shadow: 0 5px 16px rgba(16, 35, 67, .22); }
.brand span { display: grid; line-height: 1.12; }
.brand strong { font-size: 16px; letter-spacing: -.02em; }
.brand small { margin-top: 4px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.header-actions { display: flex; align-items: center; gap: 9px; }
.sync-status { display: flex; align-items: center; gap: 7px; margin-right: 6px; color: var(--muted); font-size: 12px; font-weight: 750; }
.sync-status i { width: 8px; height: 8px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 4px rgba(86, 207, 172, .16); }
.sync-status.offline i { background: var(--coral); box-shadow: 0 0 0 4px rgba(255, 118, 95, .15); }
.icon-button { width: 42px; height: 42px; border: 1px solid rgba(16, 35, 67, .1); border-radius: 14px; background: rgba(255, 255, 255, .72); cursor: pointer; font-size: 18px; transition: transform .18s ease, background .18s ease; }
.icon-button:hover { transform: translateY(-2px); background: white; }

main { width: min(1180px, calc(100% - 48px)); margin: 0 auto; }
.hero { min-height: 570px; padding: 66px 0 78px; display: grid; grid-template-columns: 1.04fr .96fr; gap: 60px; align-items: center; }
.hero-copy h1 { max-width: 650px; margin: 12px 0 20px; font-size: clamp(48px, 6.2vw, 82px); line-height: .96; letter-spacing: -.065em; color: var(--navy); }
.hero-copy h1 em { color: var(--coral); font-style: normal; }
.hero-copy p { max-width: 540px; margin: 0; color: var(--muted); font-size: 18px; line-height: 1.65; }
.eyebrow { display: inline-block; color: var(--mint-dark); font-size: 11px; font-weight: 900; letter-spacing: .16em; }
.eyebrow.coral { color: var(--coral-dark); }
.eyebrow.mint { color: var(--mint-dark); }
.eyebrow.gold { color: #b77a00; }
.eyebrow.dark { color: rgba(255,255,255,.68); }
.hero-buttons { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.button { min-height: 49px; padding: 0 21px; display: inline-flex; justify-content: center; align-items: center; border: 0; border-radius: 15px; cursor: pointer; font-weight: 850; transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease; }
.button:hover { transform: translateY(-2px); }
.button:active { transform: translateY(1px) scale(.99); }
.button.primary { color: white; background: var(--coral); box-shadow: 0 9px 0 #d74c3b, 0 16px 24px rgba(255, 118, 95, .22); margin-bottom: 9px; }
.button.primary:active { box-shadow: 0 5px 0 #d74c3b, 0 10px 18px rgba(255, 118, 95, .2); }
.button.ghost { color: var(--navy); background: rgba(255, 255, 255, .65); border: 1px solid rgba(16,35,67,.10); }
.button.light { color: var(--navy); background: white; box-shadow: 0 7px 0 rgba(6, 18, 37, .25); }
.button.wide { width: 100%; }
.button[disabled] { opacity: .56; cursor: default; transform: none; }

.level-card { position: relative; padding: 26px; color: white; background: linear-gradient(145deg, var(--navy-2), var(--navy)); border: 1px solid rgba(255,255,255,.08); border-radius: 34px; box-shadow: 0 28px 70px rgba(16, 35, 67, .27); overflow: hidden; }
.level-card::before { content: ""; position: absolute; width: 270px; height: 270px; border-radius: 50%; right: -110px; top: -140px; background: rgba(86, 207, 172, .13); }
.level-card::after { content: "✦"; position: absolute; right: 23px; top: 18px; color: var(--gold); font-size: 28px; transform: rotate(14deg); }
.level-emblem { position: absolute; left: 26px; top: 26px; width: 118px; height: 118px; padding: 7px; border-radius: 29px; background: linear-gradient(145deg, var(--gold), #fff0b0); box-shadow: 0 12px 28px rgba(0,0,0,.28); transform: rotate(-3deg); }
.level-emblem img { width: 100%; height: 100%; object-fit: cover; border-radius: 22px; }
.level-content { min-height: 146px; padding-left: 142px; display: flex; flex-direction: column; justify-content: center; }
.level-kicker { color: rgba(255,255,255,.60); font-size: 10px; font-weight: 900; letter-spacing: .14em; }
.level-content > strong { font-size: 58px; line-height: 1; color: var(--gold); }
.xp-row { margin: 10px 0 8px; display: flex; justify-content: space-between; color: rgba(255,255,255,.72); font-size: 11px; font-weight: 800; }
.progress-track { height: 9px; border-radius: 10px; background: rgba(255,255,255,.12); overflow: hidden; }
.progress-track i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--mint), #a3f1d9); box-shadow: 0 0 15px rgba(86, 207, 172, .5); transition: width .5s ease; }
.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid rgba(255,255,255,.11); padding-top: 20px; }
.hero-stats div { display: grid; text-align: center; border-right: 1px solid rgba(255,255,255,.11); }
.hero-stats div:last-child { border: 0; }
.hero-stats b { font-size: 21px; color: white; }
.hero-stats span { margin-top: 3px; color: rgba(255,255,255,.52); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }

.notify-banner { margin-bottom: 95px; min-height: 136px; padding: 24px 28px; display: grid; grid-template-columns: auto 1fr auto; gap: 21px; align-items: center; color: white; background: linear-gradient(120deg, #e95745, var(--coral) 55%, #ff8d72); border-radius: 26px; box-shadow: 0 18px 40px rgba(232, 86, 67, .23); }
.notify-banner.enabled { background: linear-gradient(120deg, #1e9676, var(--mint)); }
.notify-icon { position: relative; width: 66px; height: 66px; display: grid; place-items: center; border-radius: 21px; background: rgba(255,255,255,.18); font-size: 31px; }
.notify-icon i { position: absolute; right: 3px; top: 3px; width: 12px; height: 12px; background: var(--gold); border-radius: 50%; border: 3px solid var(--coral); }
.notify-banner.enabled .notify-icon i { border-color: var(--mint-dark); }
.notify-banner h2 { margin: 4px 0 5px; font-size: 22px; letter-spacing: -.03em; }
.notify-banner p { margin: 0; color: rgba(255,255,255,.78); font-size: 13px; }

.content-section { padding: 0 0 104px; }
.section-heading { margin-bottom: 27px; display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.section-heading h2 { margin: 7px 0 5px; color: var(--navy); font-size: clamp(31px, 4vw, 46px); letter-spacing: -.045em; }
.section-heading p { margin: 0; color: var(--muted); font-size: 14px; }
.ring-stat { --progress: 0deg; width: 76px; height: 76px; flex: 0 0 76px; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(var(--coral) var(--progress), #e1e3db 0); position: relative; }
.ring-stat::before { content: ""; position: absolute; inset: 7px; background: var(--canvas); border-radius: 50%; }
.ring-stat span { position: relative; z-index: 1; color: var(--navy); font-size: 15px; font-weight: 900; }

.quest-list { display: grid; gap: 13px; }
.quest-card { min-height: 116px; padding: 18px 20px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px; background: rgba(255,255,255,.84); border: 1px solid rgba(16,35,67,.07); border-radius: 22px; box-shadow: var(--shadow-small); transition: transform .2s ease, border-color .2s ease, background .2s ease; }
.quest-card:hover { transform: translateY(-2px); }
.quest-card.complete { background: rgba(238, 253, 247, .86); border-color: rgba(86,207,172,.34); }
.quest-icon { width: 66px; height: 66px; display: grid; place-items: center; border-radius: 20px; background: #f0f1eb; font-size: 31px; box-shadow: inset 0 -3px 0 rgba(16,35,67,.05); }
.quest-card.complete .quest-icon { background: rgba(86,207,172,.17); }
.quest-info h3 { margin: 0 0 6px; font-size: 17px; letter-spacing: -.02em; }
.quest-info p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.quest-meta { margin-top: 9px; display: flex; flex-wrap: wrap; gap: 6px; }
.pill { padding: 4px 8px; border-radius: 7px; background: #f1f2ed; color: var(--muted); font-size: 10px; font-weight: 850; }
.pill.reward { color: #986500; background: #fff3c8; }
.quest-control { display: flex; align-items: center; gap: 8px; }
.quest-check, .counter-button { border: 0; cursor: pointer; transition: transform .15s ease, background .15s ease; }
.quest-check { width: 50px; height: 50px; display: grid; place-items: center; border-radius: 16px; color: transparent; background: #e9ebe5; box-shadow: inset 0 -3px 0 rgba(16,35,67,.09); font-size: 23px; font-weight: 900; }
.quest-check:hover, .counter-button:hover { transform: scale(1.05); }
.quest-check.checked { color: white; background: var(--mint); box-shadow: inset 0 -3px 0 #34af8d; }
.counter { display: flex; align-items: center; gap: 7px; padding: 6px; border-radius: 16px; background: #f0f1ec; }
.counter-button { width: 38px; height: 38px; border-radius: 12px; background: white; color: var(--navy); font-size: 21px; font-weight: 900; box-shadow: 0 3px 8px rgba(16,35,67,.09); }
.counter-button.plus { color: white; background: var(--coral); }
.counter-value { min-width: 31px; text-align: center; font-size: 14px; font-weight: 900; }

.campaign-score { display: flex; align-items: center; gap: 10px; }
.campaign-score strong { color: var(--mint-dark); font-size: 45px; line-height: 1; }
.campaign-score span { color: var(--muted); font-size: 10px; font-weight: 850; text-transform: uppercase; letter-spacing: .06em; }
.event-list { position: relative; display: grid; gap: 17px; }
.event-card { background: rgba(255,255,255,.87); border: 1px solid rgba(16,35,67,.08); border-radius: 24px; box-shadow: var(--shadow-small); overflow: hidden; }
.event-card[open] { box-shadow: var(--shadow); }
.event-card.today { border: 2px solid var(--coral); }
.event-card.done { border-color: rgba(86,207,172,.5); }
.event-card summary { list-style: none; padding: 20px 22px; display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; cursor: pointer; }
.event-card summary::-webkit-details-marker { display: none; }
.event-date { width: 61px; min-height: 64px; padding: 8px 3px; display: grid; place-items: center; align-content: center; border-radius: 17px; background: var(--navy); color: white; line-height: 1; }
.event-date strong { font-size: 25px; }
.event-date span { margin-top: 5px; color: rgba(255,255,255,.62); font-size: 9px; font-weight: 900; letter-spacing: .12em; }
.event-card.today .event-date { background: var(--coral); }
.event-card.done .event-date { background: var(--mint-dark); }
.event-title-row { min-width: 0; }
.event-title-row h3 { margin: 0 0 5px; font-size: 18px; letter-spacing: -.02em; }
.event-title-row p { margin: 0; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-badge { padding: 7px 10px; border-radius: 10px; color: var(--muted); background: #eff0eb; font-size: 10px; font-weight: 900; letter-spacing: .07em; white-space: nowrap; text-transform: uppercase; }
.status-badge.today { color: #b83324; background: #ffe0da; }
.status-badge.done { color: #147659; background: #d9f7ed; }
.event-body { padding: 0 22px 24px; }
.event-flavor { margin: 0 0 17px; padding: 15px 17px; color: var(--muted); background: #f5f5f0; border-left: 4px solid var(--gold); border-radius: 10px; font-size: 13px; line-height: 1.5; }
.event-progress-line { height: 7px; margin-bottom: 17px; border-radius: 8px; background: #e5e7e0; overflow: hidden; }
.event-progress-line i { display: block; height: 100%; background: linear-gradient(90deg, var(--mint-dark), var(--mint)); border-radius: inherit; }
.event-items { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.event-item { min-height: 49px; padding: 10px 12px; display: flex; align-items: center; gap: 10px; border: 1px solid #e5e7df; border-radius: 13px; background: white; text-align: left; cursor: pointer; color: var(--ink); }
.event-item i { width: 23px; height: 23px; flex: 0 0 23px; display: grid; place-items: center; border: 2px solid #d3d7ce; border-radius: 8px; color: transparent; font-style: normal; font-weight: 900; }
.event-item span { font-size: 12px; line-height: 1.3; }
.event-item.checked { background: #edf9f5; border-color: rgba(86,207,172,.38); color: #557069; }
.event-item.checked i { border-color: var(--mint); background: var(--mint); color: white; }
.event-item.checked span { text-decoration: line-through; }

.achievements-section { padding-bottom: 80px; }
.achievement-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; }
.achievement-card { min-height: 190px; padding: 19px; position: relative; display: flex; flex-direction: column; background: rgba(255,255,255,.86); border: 1px solid rgba(16,35,67,.08); border-radius: 21px; overflow: hidden; }
.achievement-card.locked { filter: grayscale(.7); opacity: .58; }
.achievement-card.unlocked { border-color: rgba(255,200,87,.6); box-shadow: 0 12px 28px rgba(255,200,87,.13); }
.achievement-icon { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 17px; background: #efefea; font-size: 27px; }
.achievement-card.unlocked .achievement-icon { background: #fff0ba; box-shadow: inset 0 -3px 0 rgba(183,122,0,.12); }
.achievement-card h3 { margin: 17px 0 6px; font-size: 15px; }
.achievement-card p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.lock-label { margin-top: auto; padding-top: 12px; color: var(--muted); font-size: 9px; font-weight: 900; letter-spacing: .11em; }
.achievement-card.unlocked .lock-label { color: #a06e07; }

footer { min-height: 118px; padding: 24px max(24px, calc((100% - 1180px) / 2)); display: flex; align-items: center; gap: 12px; color: white; background: var(--navy); }
footer img { border-radius: 13px; }
footer div { display: grid; }
footer strong { font-size: 14px; }
footer div span { margin-top: 3px; color: rgba(255,255,255,.48); font-size: 10px; }
.footer-motto { margin-left: auto; color: rgba(255,255,255,.55); font-size: 12px; }

dialog { width: min(440px, calc(100% - 28px)); padding: 32px; border: 0; border-radius: 27px; color: var(--ink); background: var(--cream); box-shadow: 0 30px 100px rgba(0,0,0,.35); }
dialog::backdrop { background: rgba(10, 24, 48, .68); backdrop-filter: blur(5px); }
.dialog-close { position: absolute; right: 14px; top: 12px; width: 37px; height: 37px; border: 0; border-radius: 50%; background: #e9ebe4; color: var(--navy); cursor: pointer; font-size: 24px; }
.dialog-icon { width: 67px; height: 67px; display: grid; place-items: center; border-radius: 21px; background: #dff7ef; font-size: 34px; }
dialog h2 { margin: 20px 0 8px; color: var(--navy); font-size: 27px; letter-spacing: -.035em; }
dialog p, dialog li { color: var(--muted); font-size: 14px; line-height: 1.55; }
dialog ol { margin: 20px 0 25px; padding-left: 22px; }
dialog li { margin: 8px 0; padding-left: 4px; }
.toast { position: fixed; z-index: 50; left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); max-width: calc(100% - 28px); padding: 13px 18px; color: white; background: var(--navy); border-radius: 14px; box-shadow: 0 12px 35px rgba(16,35,67,.3); font-size: 13px; font-weight: 750; transform: translate(-50%, 130px); opacity: 0; transition: .28s ease; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.error { background: var(--coral-dark); }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 9px; height: 15px; border-radius: 2px; animation: fall 1.7s ease-in forwards; }
@keyframes fall { to { transform: translate(var(--drift), 110vh) rotate(720deg); opacity: .8; } }
.skeleton-card { height: 116px; border-radius: 22px; background: linear-gradient(90deg, rgba(255,255,255,.55), white, rgba(255,255,255,.55)); background-size: 200% 100%; animation: shimmer 1.1s infinite linear; }
@keyframes shimmer { to { background-position: -200% 0; } }
noscript { display: block; padding: 20px; text-align: center; color: white; background: var(--coral-dark); }

@media (max-width: 880px) {
  .hero { grid-template-columns: 1fr; padding-top: 48px; gap: 38px; }
  .hero-copy { text-align: center; }
  .hero-copy p { margin-inline: auto; }
  .hero-buttons { justify-content: center; }
  .level-card { width: min(560px, 100%); margin: 0 auto; }
  .achievement-grid { grid-template-columns: repeat(2, 1fr); }
  .notify-banner { grid-template-columns: auto 1fr; }
  .notify-banner .button { grid-column: 1 / -1; }
}

@media (max-width: 620px) {
  .topbar { height: 68px; padding: 8px 14px; padding-top: max(8px, env(safe-area-inset-top)); }
  .brand img { width: 43px; height: 43px; }
  .brand strong { font-size: 14px; }
  .brand small, .sync-status span { display: none; }
  .sync-status { margin-right: 2px; }
  main { width: min(100% - 28px, 1180px); }
  .hero { min-height: auto; padding: 45px 0 65px; }
  .hero-copy h1 { font-size: clamp(45px, 14vw, 67px); }
  .hero-copy p { font-size: 15px; }
  .hero-buttons .button { flex: 1; min-width: 145px; padding-inline: 12px; }
  .level-card { padding: 20px; border-radius: 26px; }
  .level-emblem { left: 20px; top: 21px; width: 90px; height: 90px; border-radius: 23px; }
  .level-emblem img { border-radius: 17px; }
  .level-content { min-height: 118px; padding-left: 105px; }
  .level-content > strong { font-size: 48px; }
  .notify-banner { margin-bottom: 76px; padding: 21px; grid-template-columns: auto 1fr; gap: 14px; border-radius: 22px; }
  .notify-icon { width: 55px; height: 55px; border-radius: 17px; font-size: 26px; }
  .notify-banner h2 { font-size: 18px; }
  .notify-banner p { display: none; }
  .content-section { padding-bottom: 80px; }
  .section-heading { align-items: center; }
  .section-heading h2 { font-size: 34px; }
  .section-heading p { display: none; }
  .ring-stat { width: 65px; height: 65px; flex-basis: 65px; }
  .quest-card { min-height: 106px; padding: 15px; grid-template-columns: auto 1fr auto; gap: 12px; }
  .quest-icon { width: 54px; height: 54px; border-radius: 17px; font-size: 27px; }
  .quest-info h3 { font-size: 14px; }
  .quest-info p { display: none; }
  .quest-meta { margin-top: 7px; }
  .quest-check { width: 44px; height: 44px; border-radius: 14px; }
  .counter { flex-direction: column-reverse; gap: 4px; padding: 5px; }
  .counter-button { width: 34px; height: 31px; }
  .counter-value { min-width: auto; font-size: 11px; }
  .event-card summary { padding: 15px; gap: 11px; }
  .event-date { width: 52px; min-height: 57px; border-radius: 15px; }
  .event-title-row h3 { font-size: 15px; }
  .event-title-row p { font-size: 10px; }
  .status-badge { padding: 6px 7px; font-size: 8px; }
  .event-body { padding: 0 15px 18px; }
  .event-items { grid-template-columns: 1fr; }
  .achievement-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .achievement-card { min-height: 178px; padding: 15px; }
  .achievement-card h3 { font-size: 13px; }
  footer { padding: 24px 18px calc(24px + env(safe-area-inset-bottom)); }
  .footer-motto { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
