/* GivingRank — design system */
:root {
  --ink: #0d1b1e;
  --ink-2: #26383c;
  --muted: #5d7076;
  --line: #dde5e3;
  --bg: #f4f7f5;
  --card: #ffffff;
  --teal: #0f766e;
  --teal-dark: #0a4f49;
  --teal-soft: #e6f4f1;
  --gold: #c98a12;
  --gold-soft: #fdf3dd;
  --coral: #c2410c;
  --danger: #b91c1c;
  --shadow: 0 1px 2px rgba(13, 27, 30, .06), 0 12px 32px -18px rgba(13, 27, 30, .35);
  --radius: 16px;
  --max: 1180px;
  --font: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, "Noto Sans KR", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
img { max-width: 100%; display: block; }
a { color: var(--teal); }
button { font-family: inherit; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- top bar ---------- */
.topbar {
  background: var(--ink);
  color: #cfe3df;
  font-size: 12.5px;
  letter-spacing: .01em;
}
.topbar .wrap {
  display: flex; gap: 14px; align-items: center; justify-content: center;
  padding: 9px 20px; text-align: center; flex-wrap: wrap;
}
.topbar b { color: #fff; font-weight: 600; }
.topbar .pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.1); border-radius: 999px; padding: 2px 10px;
  font-size: 11.5px; color: #e7f5f2;
}
.topbar a { color: #8fe3d5; text-decoration: none; border-bottom: 1px solid rgba(143,227,213,.4); }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(244, 247, 245, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  max-width: var(--max); margin: 0 auto; padding: 12px 22px;
  display: flex; align-items: center; gap: 22px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 19px; color: var(--ink); text-decoration: none;
  letter-spacing: -.02em;
}
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(145deg, var(--teal), #14b8a6 55%, #f0b429);
  display: grid; place-items: center; color: #fff; font-size: 17px;
  box-shadow: 0 6px 14px -6px rgba(15,118,110,.7);
}
.brand small { display: block; font-size: 9.5px; letter-spacing: .16em; color: var(--muted); font-weight: 600; text-transform: uppercase; white-space: nowrap; }
.nav { display: flex; gap: 20px; margin-left: 8px; }
.nav a { color: var(--ink-2); text-decoration: none; font-size: 14px; font-weight: 550; }
.nav a:hover { color: var(--teal); }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 999px; padding: 10px 18px; font-size: 14px; font-weight: 650;
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--teal); color: #fff; box-shadow: 0 8px 20px -12px rgba(15,118,110,.9); }
.btn-primary:hover { background: var(--teal-dark); }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: #b9ccc8; }
.btn-gold { background: #f0b429; color: #3a2a02; }
.btn-sm { padding: 7px 13px; font-size: 13px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.user-chip {
  display: flex; align-items: center; gap: 8px; background: #fff;
  border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px 5px 5px;
  font-size: 13px; font-weight: 600; white-space: nowrap; max-width: 180px;
}
.user-chip > span { overflow: hidden; text-overflow: ellipsis; }
.user-chip img, .user-chip .avatar {
  width: 26px; height: 26px; border-radius: 50%; object-fit: cover;
  background: var(--teal-soft); color: var(--teal); display: grid; place-items: center;
  font-size: 12px; font-weight: 700;
}

/* ---------- hero ---------- */
.hero {
  position: relative; overflow: hidden;
  background:
    radial-gradient(900px 420px at 78% -10%, rgba(20,184,166,.28), transparent 60%),
    radial-gradient(700px 380px at 8% 0%, rgba(240,180,41,.16), transparent 55%),
    linear-gradient(180deg, #0b1f22 0%, #0e2b2c 60%, #10383a 100%);
  color: #eaf5f2;
}
.hero::after {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px);
  background-size: 46px 46px; mask-image: linear-gradient(180deg, #000 20%, transparent 85%);
  pointer-events: none;
}
.hero .wrap {
  position: relative; z-index: 1;
  max-width: var(--max); margin: 0 auto; padding: 64px 22px 60px;
  display: grid; grid-template-columns: 1.15fr .85fr; gap: 48px; align-items: center;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11.5px; letter-spacing: .18em; text-transform: uppercase;
  color: #7fe0d2; font-weight: 700; margin-bottom: 16px;
}
.eyebrow::before { content: ""; width: 22px; height: 1px; background: #7fe0d2; }
.hero h1 {
  font-size: clamp(34px, 4.4vw, 56px); line-height: 1.04; margin: 0 0 18px;
  letter-spacing: -.035em; font-weight: 800; color: #fff;
}
.hero h1 em { font-style: normal; color: #f0b429; }
.hero p.lede { font-size: 16.5px; color: #b9d3ce; max-width: 560px; margin: 0 0 26px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-note { margin-top: 18px; font-size: 12.5px; color: #8fb3ad; }
.hero-note a { color: #9fe8dc; }

.hero-stats {
  background: rgba(255,255,255,.055);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 20px; padding: 22px;
  backdrop-filter: blur(6px);
}
.hero-stats .label {
  font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: #8fbcb5;
  margin-bottom: 6px; font-weight: 700;
}
.hero-stats .big { font-size: clamp(30px, 3.4vw, 42px); font-weight: 800; color: #fff; letter-spacing: -.03em; line-height: 1.05; }
.hero-stats .big span { font-size: .5em; color: #9fd8ce; font-weight: 600; letter-spacing: 0; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 20px; }
.stat-grid .cell { border-top: 1px solid rgba(255,255,255,.12); padding-top: 12px; }
.stat-grid .num { font-size: 20px; font-weight: 750; color: #fff; }
.stat-grid .cap { font-size: 11.5px; color: #93b8b2; }
.demo-tag {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 16px;
  font-size: 11px; letter-spacing: .04em; color: #ffe6b0;
  background: rgba(240,180,41,.14); border: 1px solid rgba(240,180,41,.32);
  border-radius: 8px; padding: 6px 10px;
}

/* ---------- sections ---------- */
section.block { padding: 58px 0; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 22px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; flex-wrap: wrap; }
.section-head h2 { font-size: clamp(24px, 2.6vw, 32px); letter-spacing: -.03em; margin: 0 0 6px; font-weight: 800; }
.section-head p { margin: 0; color: var(--muted); font-size: 14.5px; max-width: 620px; }
.kicker { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--teal); font-weight: 750; margin-bottom: 10px; }

/* ---------- map ---------- */
.map-layout { display: grid; grid-template-columns: minmax(0, 1.62fr) minmax(300px, .9fr); gap: 22px; align-items: stretch; }
.map-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; position: relative; overflow: hidden;
}
.map-toolbar {
  display: flex; align-items: center; gap: 12px; justify-content: space-between;
  padding: 2px 4px 12px; flex-wrap: wrap;
}
.legend { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted); }
.legend .swatches { display: flex; gap: 3px; }
.legend .swatches i { width: 16px; height: 8px; border-radius: 2px; display: block; }
.seg { display: inline-flex; background: #eef3f1; border-radius: 999px; padding: 3px; }
.seg button {
  border: 0; background: transparent; padding: 6px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 650; color: var(--muted); cursor: pointer;
}
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.12); }

#world { width: 100%; height: auto; display: block; }
#world .land { fill: #e8eeec; stroke: #fff; stroke-width: .4; cursor: pointer; transition: fill .15s ease; }
#world .land.has-data:hover, #world .land.sel { fill: #0f766e !important; }
#world .land.sel { stroke: #0b4f4a; stroke-width: 1; }
#world .marker { fill: rgba(15,118,110,.85); stroke: #fff; stroke-width: 1; pointer-events: none; }
#world .marker.top { fill: #c2410c; }
.map-hint { font-size: 11.5px; color: var(--muted); padding: 4px 4px 0; }
.map-loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 13px; }

.country-panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px; display: flex; flex-direction: column;
}
.panel-empty { color: var(--muted); font-size: 14px; line-height: 1.7; }
.panel-empty .icon { font-size: 30px; margin-bottom: 10px; }
.cp-head { display: flex; align-items: center; gap: 12px; }
.cp-flag { font-size: 34px; line-height: 1; display: flex; align-items: center; }
.cp-name { font-size: 21px; font-weight: 800; letter-spacing: -.02em; }
.cp-rank { font-size: 12px; color: var(--muted); font-weight: 600; }
.cp-figures { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 18px 0 4px; }
.cp-figures div { background: #f7faf9; border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.cp-figures .n { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.cp-figures .c { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.cp-charity { margin-top: 16px; border-top: 1px dashed var(--line); padding-top: 16px; }
.cp-charity .lbl { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--teal); font-weight: 750; }
.cp-charity .who { font-weight: 700; margin-top: 4px; font-size: 15px; }
.cp-charity .note { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.cp-actions { margin-top: auto; padding-top: 18px; display: grid; gap: 8px; }
.mini-note { font-size: 11.5px; color: var(--muted); }

/* ---------- leaderboard ---------- */
.board-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.board-top { display: flex; align-items: center; gap: 16px; padding: 16px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tabs { display: inline-flex; background: #eef3f1; border-radius: 999px; padding: 4px; gap: 2px; }
.tabs button {
  border: 0; background: transparent; padding: 8px 16px; border-radius: 999px;
  font-size: 13.5px; font-weight: 650; color: var(--muted); cursor: pointer; white-space: nowrap;
}
.tabs button.on { background: var(--ink); color: #fff; }
.board-meta { margin-left: auto; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 10px; }
table.board { width: 100%; border-collapse: collapse; }
table.board th {
  text-align: left; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; padding: 12px 18px; border-bottom: 1px solid var(--line);
  background: #fbfdfc;
}
table.board th.num, table.board td.num { text-align: right; }
table.board td { padding: 13px 18px; border-bottom: 1px solid #edf2f0; vertical-align: middle; }
table.board tr:last-child td { border-bottom: 0; }
table.board tr:hover td { background: #fafcfb; }
.rank-cell { width: 54px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 14px; }
.rank-cell.top1 { color: #b45309; }
.rank-cell.top2 { color: #64748b; }
.rank-cell.top3 { color: #9a3412; }
.who-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who-flag { font-size: 18px; line-height: 1; }
.flag-img { display: inline-block; width: 20px; height: 14px; object-fit: cover; border-radius: 2px; box-shadow: 0 0 0 1px rgba(13,27,30,.08); vertical-align: -2px; }
.flag-img.lg { width: 24px; height: 17px; }
.flag-img.xl { width: 38px; height: 27px; border-radius: 4px; }
.who-name { font-weight: 700; font-size: 14px; }
.who-sub { font-size: 11.5px; color: var(--muted); }
.msg-cell { color: var(--ink-2); font-size: 13px; max-width: 380px; }
.msg-cell .m { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.amount-cell { font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-wrap { height: 4px; background: #eef3f1; border-radius: 999px; margin-top: 6px; overflow: hidden; }
.bar { height: 100%; background: linear-gradient(90deg, var(--teal), #2dd4bf); border-radius: 999px; }
.sample-chip {
  display: inline-block; font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase;
  background: var(--gold-soft); color: #8a5a06; border: 1px solid #f1d9a8;
  padding: 1px 6px; border-radius: 5px; font-weight: 750; margin-left: 6px; vertical-align: 1px;
}
.board-empty { padding: 44px 22px; text-align: center; color: var(--muted); font-size: 14px; }
.board-foot { padding: 14px 18px; font-size: 12px; color: var(--muted); background: #fbfdfc; border-top: 1px solid var(--line); }

/* ---------- feed ---------- */
.feed-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.feed-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px;
  box-shadow: 0 1px 2px rgba(13,27,30,.04);
}
.feed-card .head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; margin-bottom: 8px; }
.feed-card .head .flag { font-size: 16px; }
.feed-card .head .name { font-weight: 700; }
.feed-card .head .when { margin-left: auto; color: var(--muted); font-size: 11.5px; }
.feed-card .quote { font-size: 13.5px; color: var(--ink-2); }
.feed-card .amt { margin-top: 10px; font-size: 11.5px; color: var(--teal); font-weight: 700; }
.feed-empty { color: var(--muted); font-size: 14px; }

/* ---------- how it works ---------- */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.step { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.step .n {
  width: 28px; height: 28px; border-radius: 9px; background: var(--teal-soft); color: var(--teal);
  display: grid; place-items: center; font-weight: 800; font-size: 13px; margin-bottom: 12px;
}
.step h3 { margin: 0 0 6px; font-size: 15px; }
.step p { margin: 0; color: var(--muted); font-size: 13px; }

.transparency {
  display: grid; grid-template-columns: 1.05fr 1fr; gap: 26px; align-items: center;
  background: linear-gradient(135deg, #0e2b2c, #12403f); color: #e6f2ef;
  border-radius: 20px; padding: 34px; margin-top: 30px;
}
.transparency h3 { font-size: 24px; margin: 0 0 10px; letter-spacing: -.02em; color: #fff; }
.transparency p { color: #a8c9c3; font-size: 14px; margin: 0 0 8px; }
.split-visual { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.14); border-radius: 14px; padding: 18px; }
.split-bar { display: flex; height: 34px; border-radius: 9px; overflow: hidden; font-size: 11px; font-weight: 750; }
.split-bar .a { background: #14b8a6; color: #062a26; display: grid; place-items: center; }
.split-bar .b { background: #f0b429; color: #3a2a02; display: grid; place-items: center; }
.split-legend { display: flex; justify-content: space-between; margin-top: 10px; font-size: 11.5px; color: #a8c9c3; gap: 10px; }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(8,20,22,.62); backdrop-filter: blur(3px);
  display: none; align-items: flex-start; justify-content: center; z-index: 90; padding: 34px 16px;
  overflow-y: auto;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: #fff; border-radius: 18px; width: 100%; max-width: 560px;
  box-shadow: 0 30px 80px -30px rgba(0,0,0,.6); overflow: hidden;
  animation: pop .18s ease-out;
}
@keyframes pop { from { transform: translateY(10px) scale(.99); opacity: 0 } to { transform: none; opacity: 1 } }
.modal-head { display: flex; align-items: flex-start; gap: 14px; padding: 20px 22px 0; }
.modal-head h3 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
.modal-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.modal-close {
  margin-left: auto; border: 0; background: #f1f5f3; width: 32px; height: 32px; border-radius: 50%;
  font-size: 16px; cursor: pointer; color: var(--muted);
}
.modal-body { padding: 18px 22px 22px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; letter-spacing: .01em; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px;
  font-family: inherit; font-size: 14px; color: var(--ink); background: #fff;
}
.field textarea { resize: vertical; min-height: 74px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid #99e0d5; border-color: var(--teal); }
.field .hint { font-size: 11.5px; color: var(--muted); margin-top: 5px; }
.amount-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.amount-row button {
  border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 14px;
  font-size: 13px; font-weight: 650; cursor: pointer; color: var(--ink-2);
}
.amount-row button.on { border-color: var(--teal); background: var(--teal-soft); color: var(--teal-dark); }
.charity-box { border: 1px solid var(--line); background: #f7faf9; border-radius: 12px; padding: 14px; }
.charity-box .icalc { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--teal); font-weight: 750; }
.charity-box .cname { font-weight: 750; margin-top: 4px; }
.charity-box .cnote { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.split-preview { margin: 14px 0 4px; border: 1px dashed #cfe0dc; border-radius: 12px; padding: 14px; background: #fbfdfc; }
.split-preview .row { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0; }
.split-preview .row b { font-variant-numeric: tabular-nums; }
.split-preview .note { font-size: 11.5px; color: var(--muted); margin-top: 8px; }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.modal-actions .btn { flex: 1; min-width: 140px; }
.step-sep { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 11.5px; margin: 18px 0 12px; text-transform: uppercase; letter-spacing: .1em; }
.step-sep::before, .step-sep::after { content: ""; height: 1px; background: var(--line); flex: 1; }
.alert { border-radius: 10px; padding: 11px 13px; font-size: 12.5px; margin: 12px 0; }
.alert-info { background: #eef7f5; color: #14544d; border: 1px solid #cfe9e3; }
.alert-warn { background: #fff8e8; color: #7a5307; border: 1px solid #f2dfb4; }
.alert-err { background: #fdf0ef; color: #8f1f18; border: 1px solid #f4cfcb; }

/* ---------- footer ---------- */
footer.site-footer { background: var(--ink); color: #93aba7; margin-top: 30px; padding: 44px 0 30px; font-size: 13px; }
footer.site-footer .cols { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 30px; }
footer.site-footer h4 { color: #e9f2f0; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; margin: 0 0 12px; }
footer.site-footer a { color: #b6cdc8; text-decoration: none; display: block; margin-bottom: 7px; }
footer.site-footer a:hover { color: #fff; }
footer .brand { color: #fff; }
footer .legal { border-top: 1px solid rgba(255,255,255,.1); margin-top: 30px; padding-top: 18px; display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; font-size: 11.5px; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .hero .wrap { grid-template-columns: 1fr; gap: 34px; padding: 48px 22px; }
  .map-layout { grid-template-columns: 1fr; }
  .feed-grid { grid-template-columns: 1fr 1fr; }
  .steps { grid-template-columns: 1fr 1fr; }
  .transparency { grid-template-columns: 1fr; }
  footer.site-footer .cols { grid-template-columns: 1fr 1fr; }
  .nav { display: none; }
}
@media (max-width: 620px) {
  .site-header .wrap { padding: 10px 14px; gap: 12px; }
  .brand { font-size: 17px; }
  .brand small { display: none; }
  .user-chip { max-width: 120px; }
  .header-actions .btn span.long { display: none; }
  .topbar .wrap { padding: 8px 14px; font-size: 11.5px; }
  .wrap { padding: 0 14px; }
  section.block { padding: 42px 0; }
  .feed-grid { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; }
  .hero-stats { padding: 18px; }
  .modal-backdrop { padding: 12px 8px; }
  .modal { border-radius: 16px; }
  table.board th, table.board td { padding: 11px 12px; }
  table.board th.msg-col, table.board td.msg-cell { display: none; }
  .board-top { padding: 12px; gap: 10px; }
  .tabs { width: 100%; }
  .tabs button { flex: 1; padding: 8px 6px; font-size: 12.5px; }
  .board-meta { margin-left: 0; width: 100%; justify-content: space-between; }
  .cp-figures .n { font-size: 19px; }
  footer.site-footer .cols { grid-template-columns: 1fr 1fr; gap: 22px; }
}
