:root {
  --paper: #fcf9f4;
  --ink: #35223f;
  --muted: #78697f;
  --purple: #68458c;
  --purple-dark: #47265f;
  --lilac: #eadcf4;
  --pink: #f5deea;
  --line: #e7dfe9;
  --danger: #a52f54;
  --green: #416858;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(ellipse at 100% 0%, #efddf160, transparent 48%), var(--paper); min-height: 100vh; }
a { color: var(--purple-dark); text-underline-offset: 4px; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
:focus-visible { outline: 3px solid #b179c2; outline-offset: 4px; }
[hidden] { display: none !important; }
.skip-link { position: absolute; top: -80px; padding: 12px; background: white; z-index: 20; }
.skip-link:focus { top: 0; }
.site-header { display: flex; align-items: center; justify-content: space-between; padding: 22px 24px; max-width: 1120px; margin: auto; border-bottom: 1px solid var(--line); }
.brand { font-size: 20px; font-weight: 500; letter-spacing: -.8px; text-decoration: none; display: inline-flex; align-items: center; }
.brand span:not(.brand-star) { font-weight: 800; }
.brand b { font-family: Georgia, serif; font-size: 24px; font-style: italic; margin-left: 3px; }
.brand-star { font-size: 28px; color: #9c76ac; margin-right: 8px; }
.page { max-width: 980px; padding: 32px 20px 64px; margin: auto; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin-bottom: 24px; }
.page-heading h1 { margin-bottom: 0; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1 { font-family: Georgia, "Times New Roman", serif; font-size: clamp(35px, 6vw, 60px); line-height: 1.09; letter-spacing: -1.6px; font-weight: 500; margin: 12px 0 24px; }
h1 em { color: var(--purple); }
h2 { font-size: 23px; letter-spacing: -.6px; margin: 28px 0 16px; }
h3 { font-size: 20px; line-height: 1.35; margin: 16px 0 10px; letter-spacing: -.3px; }
p { line-height: 1.65; }
.eyebrow { font-size: 10px; font-weight: 800; letter-spacing: 2.6px; color: var(--purple); margin: 0 0 10px; }
.lead { color: var(--muted); font-size: 17px; max-width: 580px; line-height: 1.75; }
.muted, small, .help-text { color: var(--muted); }
small, .help-text { font-size: 12px; line-height: 1.5; }
.help-text { display: block; }
.lilac { color: #9e72b3; }
.positive { color: var(--purple); }
.negative, .danger { color: var(--danger); }
.button { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 18px; padding: 13px 22px; border: 1px solid var(--purple-dark); border-radius: 12px; color: white; background: var(--purple-dark); font-weight: 650; font-size: 14px; text-decoration: none; transition: background .15s, transform .15s; }
.button:hover:not(:disabled) { background: #603b7d; }
.button.secondary { background: transparent; color: var(--purple-dark); border-color: #d9c7e3; }
.button.secondary:hover { background: #f2eaf6; }
.button.small { min-height: 42px; padding: 10px 16px; font-size: 12px; }
.button.full { display: flex; width: 100%; justify-content: space-between; }
.text-button { border: 0; background: none; padding: 12px 4px; min-height: 44px; font-size: 13px; font-weight: 600; text-decoration: none; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-top: 18px; }
.card { background: #fffdfb; border: 1px solid var(--line); border-radius: 20px; padding: 24px; }
.card p { font-size: 14px; color: var(--muted); }
.card h2:first-child { margin-top: 0; }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.tag { font-size: 10px; letter-spacing: 1.5px; font-weight: 800; color: var(--muted); }
.points { font-family: Georgia, serif; font-size: 29px; white-space: nowrap; }
.badge { display: inline-block; padding: 7px 12px; background: #eee5f4; border-radius: 30px; color: var(--purple-dark); font-size: 11px; font-weight: 600; line-height: 1.4; }
.badge.approved { background: #e4eee6; color: var(--green); }
.badge.rejected { background: #f8e4ea; color: var(--danger); }
.badge.pending { background: #fff0d6; color: #7c5b20; }
.welcome { max-width: 560px; margin: 0 auto; padding-top: 20px; text-align: center; }
.welcome h1 { font-size: clamp(45px, 8vw, 70px); }
.welcome .lead { margin-left: auto; margin-right: auto; }
.welcome.compact { padding-top: 50px; }
.welcome .button { margin: 20px 0; }
.birthday-art { width: 240px; height: 240px; margin: 25px auto 32px; position: relative; display: grid; place-items: center; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #f9e5ed, #e5d2ef 70%, transparent 71%); }
.big-number { font-family: Georgia, serif; font-style: italic; font-size: 140px; line-height: 1; color: var(--purple); letter-spacing: -15px; margin-right: 20px; text-shadow: 3px 3px #fff9; }
.ribbon { position: absolute; bottom: 15px; background: #efe5ba; color: #675527; padding: 9px 28px; transform: rotate(-8deg); font-size: 9px; font-weight: 800; letter-spacing: 2.5px; box-shadow: 0 3px 0 #6c536a10; }
.orbit { position: absolute; color: var(--purple-dark); }
.orbit.one { font-size: 70px; top: -10px; right: -16px; }
.orbit.two { font-size: 46px; bottom: 23px; left: -28px; transform: rotate(-15deg); }
.orbit.three { font-size: 32px; top: 20px; left: -10px; color: #b48e44; }
.intro-card { display: flex; gap: 18px; text-align: left; align-items: center; margin-top: 30px; }
.intro-card h2 { margin: 0; font-size: 18px; }
.intro-card p { margin-bottom: 0; }
.icon-disc { background: var(--lilac); width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center; font-size: 27px; flex-shrink: 0; }
.avatar { height: 42px; width: 42px; display: inline-grid; place-items: center; border-radius: 50%; background: var(--lilac); color: var(--purple-dark); font-weight: 700; flex-shrink: 0; }
.avatar.large { width: 90px; height: 90px; font-size: 35px; margin: 25px; }
.score-hero { position: relative; overflow: hidden; padding: 30px; border-radius: 24px; background: var(--lilac); display: flex; justify-content: space-between; align-items: center; margin: 20px 0 36px; }
.score-hero p { font-size: 12px; margin: 0; color: #654d75; position: relative; z-index: 1; }
.score-number { font-family: Georgia, serif; font-size: 76px; line-height: 1.2; margin: 8px 0; color: var(--purple-dark); position: relative; z-index: 1; }
.score-number span { font-size: 16px; font-family: -apple-system, sans-serif; margin-left: 12px; }
.hero-star { font-size: 140px; line-height: 1; color: #c4a1d3; position: absolute; right: 10px; top: 18px; transform: rotate(12deg); }
.section-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin: 25px 0 18px; }
.section-heading h2 { margin: 0; }
.section-heading .muted { font-size: 12px; }
.mission-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.mission-card { display: flex; flex-direction: column; }
.mission-card > p { flex: 1; margin-top: 0; }
.mission-progress { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--muted); padding: 18px 0; border-top: 1px solid var(--line); margin-top: 10px; }
.mission-state { text-align: center; background: #f3edf4; color: var(--purple); padding: 14px; border-radius: 12px; font-size: 13px; }
.rules-details { margin-top: 28px; }
summary { cursor: pointer; font-weight: 650; font-size: 16px; padding: 5px 0; }
.rule-line { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 17px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.rule-line:last-child { border-bottom: none; }
.rule-line small { display: block; margin-top: 5px; }
.rule-line > strong { white-space: nowrap; }
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; padding: 9px 15px max(9px, env(safe-area-inset-bottom)); background: #fffdfbf5; backdrop-filter: blur(12px); border-top: 1px solid var(--line); display: flex; justify-content: space-around; z-index: 10; }
.bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; text-decoration: none; color: var(--muted); font-size: 10px; padding: 4px 20px; border-radius: 12px; }
.bottom-nav span { font-size: 23px; line-height: 1.2; }
.bottom-nav [aria-current] { color: var(--purple-dark); background: #f1e7f6; }
.site-footer { text-align: center; padding: 0 20px 110px; color: var(--muted); font-size: 11px; }
.site-footer span { color: var(--purple); margin-left: 8px; }
.notice { background: #f0e9f4; color: #654d75; padding: 16px 20px; border-radius: 14px; font-size: 13px; line-height: 1.65; }
.message { padding: 16px 20px; border-radius: 14px; background: #e8f0e8; color: #365842; font-size: 14px; }
.message.error { background: #fae8ed; color: #8d2948; }
.connection-banner { position: sticky; top: 0; z-index: 12; background: #fff0cf; color: #69491b; padding: 12px 20px; text-align: center; font-size: 13px; }
.back-link { display: inline-block; margin-bottom: 25px; text-decoration: none; font-size: 13px; color: var(--muted); }
.form-card { margin: 24px 0; max-width: 680px; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 8px; }
input:not([type=checkbox]):not([type=hidden]), select, textarea { width: 100%; border: 1px solid #d9cfdf; border-radius: 10px; padding: 13px; color: var(--ink); background: white; min-height: 48px; font-size: 16px; }
textarea { resize: vertical; }
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--purple); vertical-align: middle; }
input[type=file] { font-size: 13px !important; }
.errorlist { padding: 12px 12px 12px 28px; color: var(--danger); background: #fae8ed; border-radius: 10px; font-size: 13px; }
progress { width: 100%; accent-color: var(--purple); }
.stack { display: grid; gap: 14px; }
.ranking-list { list-style: none; padding: 0; margin: 20px 0 30px; }
.ranking-row { display: flex; align-items: center; gap: 13px; padding: 20px 14px; border-bottom: 1px solid var(--line); border-radius: 12px; }
.ranking-row:first-child { background: #f2e6f5; }
.ranking-row.is-you { outline: 1px solid #b89cc9; outline-offset: -1px; }
.rank-position { font-family: Georgia, serif; font-size: 24px; width: 28px; color: var(--muted); flex-shrink: 0; }
.rank-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.rank-name strong { font-size: 14px; }
.rank-name small, .rank-score small { display: block; font-weight: 400; margin-top: 5px; font-family: -apple-system, sans-serif; }
.rank-score { font-size: 28px; font-family: Georgia, serif; text-align: right; }
.rank-score small { font-size: 10px; }
.sync-status { color: var(--muted); font-size: 11px; text-align: right; }
.organizer-nav { display: flex; gap: 8px; overflow-x: auto; padding: 0 0 16px; margin: 0 0 24px; border-bottom: 1px solid var(--line); }
.organizer-nav a { white-space: nowrap; padding: 12px 15px; border: 1px solid var(--line); border-radius: 24px; font-size: 12px; text-decoration: none; }
.organizer-nav a:hover { background: var(--lilac); }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat { display: flex; flex-direction: column; padding: 18px 14px; text-decoration: none; }
.stat strong { font-family: Georgia, serif; font-size: 34px; font-weight: 500; }
.stat strong small { font-size: 17px; }
.stat > span { font-size: 11px; color: var(--muted); margin-top: 9px; }
.phase-card { margin-top: 24px; background: #f0e6f4; }
.phase-card h2 { font-family: Georgia, serif; font-weight: 400; font-size: 30px; }
.event-link { display: flex; justify-content: space-between; align-items: center; text-decoration: none; }
.event-link h2 { margin: 12px 0 0; }
.event-link > span { font-size: 28px; }
.invitation-card { text-align: center; max-width: 520px; margin: 0 auto 25px; background: #f5ecf8; }
.invitation-card h2 { font-family: Georgia, serif; font-size: 45px; font-weight: 500; }
.invitation-card .actions { justify-content: center; }
.qr-code { display: block; width: min(280px, 100%); height: auto; margin: 25px auto; border-radius: 15px; }
.invite-url { overflow-wrap: anywhere; font-size: 11px !important; }
.review-select { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.review-select span { flex: 1; }
.proof-thumbnail { width: 100%; height: 220px; object-fit: cover; border-radius: 12px; }
.review-toolbar { position: sticky; bottom: 15px; margin-top: 25px; box-shadow: 0 8px 35px #35223f15; }
.ledger-row { display: flex; align-items: center; gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.ledger-row > div { flex: 1; }
.ledger-row p { margin: 5px 0; }
.ledger-row > strong { font-size: 19px; }
.auth-page { max-width: 500px; margin: 20px auto; }
.auth-page .form-card { margin-bottom: 22px; }
@media (min-width: 640px) {
  .page { padding: 48px 32px 70px; }
  .mission-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
  .score-hero { padding: 35px 40px; }
  .hero-star { right: 60px; font-size: 180px; }
  .bottom-nav { left: 50%; transform: translateX(-50%); width: 430px; bottom: 16px; border: 1px solid var(--line); border-radius: 22px; padding-bottom: 9px; box-shadow: 0 8px 30px #35223f10; }
  .ranking-row { padding: 22px; gap: 22px; }
  .rank-name strong { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
@media print {
  .site-header, .site-footer, .organizer-nav, .back-link, .page-heading, .no-print, .invitation-card .actions, .messages { display: none; }
  .invitation-card { border: 2px solid #d3bddf; break-inside: avoid; }
  body { background: white; }
}
