*, *::before, *::after { box-sizing: border-box; }
html { font-size: var(--fs-base); scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font-family); background: var(--color-bg); color: var(--color-text); line-height: 1.6; }
body.has-contact-footer { padding-bottom: calc(var(--contact-footer-h) + var(--bottom-nav-h) + var(--safe-area-bottom)); }
.container { max-width: 960px; margin: 0 auto; padding: 0 16px; }
.section-title { font-size: var(--fs-h2); color: var(--color-primary); margin: 0 0 8px; }
.section-desc { color: var(--color-text-secondary); margin: 0 0 24px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 18px; border-radius: 10px; border: none; font-size: 15px;
  cursor: pointer; text-decoration: none; font-family: inherit;
}
.btn-primary { background: var(--color-primary); color: #fff; font-weight: 600; }
.btn-secondary { background: var(--color-bg-card); color: var(--color-text); border: 1px solid var(--color-border); }
.skip-link { position: absolute; left: -9999px; z-index: 9999; }
.skip-link:focus { left: 0; padding: 8px 16px; background: #000; color: #fff; }
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: rgba(255,255,255,0.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-border);
}
.navbar-inner { display: flex; align-items: center; gap: 10px; padding: 10px 16px; }
.navbar-title { font-weight: 600; flex: 1; }
.navbar-actions { display: flex; gap: 6px; }
.navbar-actions .btn { padding: 6px 10px; font-size: 12px; }

.contact-footer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 850;
  background: #1a1a1a; padding: .55rem .75rem calc(.55rem + var(--safe-area-bottom));
}
.contact-footer__btns {
  display: grid; grid-template-columns: repeat(3, minmax(0, 88px));
  justify-content: center; gap: .4rem; max-width: 320px; margin: 0 auto;
}
.contact-footer__cta {
  display: block; background: #c41e1e !important; color: #fff !important;
  text-align: center; padding: .48rem .2rem; border-radius: 6px;
  font-size: .72rem; font-weight: 700; text-decoration: none;
}
.contact-footer__btn {
  display: block; background: transparent; border: 1px solid rgba(255,255,255,0.35);
  color: #fff; padding: .48rem .2rem; border-radius: 6px; font-size: .72rem;
  cursor: pointer; text-align: center; text-decoration: none; font-family: inherit;
}
.contact-footer__brand { text-align: center; font-size: .62rem; color: rgba(255,255,255,0.5); margin: .4rem 0 0; }

.chapter { min-height: 100vh; padding: 64px 0 48px; scroll-snap-align: start; }
main.snap-scroll { scroll-snap-type: y proximity; }
.chapter-hero {
  text-align: center; color: #fff;
  background: linear-gradient(160deg, var(--color-primary), #064E3B);
}
.hero-logo { width: 88px; height: 88px; border-radius: 50%; border: 3px solid rgba(255,255,255,0.5); object-fit: cover; margin-bottom: 12px; }
.hero-title { font-size: clamp(1.75rem, 5vw, 2.25rem); margin: 0 0 8px; }
.hero-sub { opacity: 0.9; margin: 0 0 4px; }
.hero-org { font-size: 14px; opacity: 0.75; margin: 0 0 16px; }
.demo-badge {
  display: inline-block; font-size: 12px; padding: 4px 10px; border-radius: 20px;
  background: rgba(255,255,255,0.15); margin-bottom: 12px;
}

.bottom-nav {
  position: fixed; bottom: calc(var(--contact-footer-h) + var(--safe-area-bottom));
  left: 0; right: 0; z-index: 800; height: var(--bottom-nav-h);
  background: var(--color-bg-card); border-top: 1px solid var(--color-border);
  padding: 4px 8px;
}
.bottom-nav ul { display: flex; justify-content: space-around; list-style: none; margin: 0; padding: 0; }
.bottom-nav a { color: var(--color-text-secondary); text-decoration: none; font-size: 11px; }
.bottom-nav a.active { color: var(--color-primary); font-weight: 600; }

.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 768px) { .stats-grid { grid-template-columns: repeat(4, 1fr); } }
.stat-card {
  background: var(--color-bg-card); border-radius: 14px; padding: 16px; text-align: center;
  border: 1px solid var(--color-border); box-shadow: var(--theme-shadow);
}
.stat-icon { font-size: 22px; }
.stat-value { font-size: var(--fs-stat); font-weight: 700; color: var(--color-primary); }
.stat-suffix { font-size: 13px; color: var(--color-text-secondary); }
.stat-label { font-size: 12px; color: var(--color-text-secondary); }

.filter-chip {
  padding: 6px 12px; border-radius: 20px; border: 1px solid var(--color-border);
  background: var(--color-bg-card); font-size: 12px; cursor: pointer; margin-right: 6px; font-family: inherit;
}
.filter-chip.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

.bento-wall { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 768px) { .bento-wall { grid-template-columns: repeat(4, 1fr); } }
.bento-card {
  background: var(--color-bg-card); border-radius: 12px; overflow: hidden;
  border: 1px solid var(--color-border); animation: fadeUp .5s ease both;
  animation-delay: calc(var(--delay, 0) * 0.05s);
}
.bento-large { grid-column: span 2; }
.bento-card img { width: 100%; aspect-ratio: 16/10; object-fit: cover; display: block; }
.bento-meta { padding: 10px; font-size: 13px; }
.honor-badge {
  display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 10px;
  background: var(--color-accent); color: #fff; margin-bottom: 4px;
}

.story-card { display: flex; gap: 12px; background: var(--color-bg-card);
  border-radius: 12px; padding: 14px; border: 1px solid var(--color-border); margin-bottom: 12px; }
.story-card-link { text-decoration: none; color: inherit; transition: transform .15s; }
.story-card-link:hover { transform: translateY(-2px); }
.story-avatar { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.story-role { font-size: 12px; color: var(--color-primary); display: block; }

.radar-wrap { text-align: center; margin-top: 16px; }

.share-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.share-landing-card {
  background: var(--color-bg-card); border-radius: 16px; padding: 24px;
  border: 1px solid var(--color-border); text-align: center;
}

.volunteer-page .vol-avatar { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; }
.vol-stars { color: var(--color-accent); font-size: 18px; }
.vol-stats { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 12px; }
.vol-stats span { background: var(--color-bg-card); padding: 8px 14px; border-radius: 10px; border: 1px solid var(--color-border); }

.timeline-item {
  display: grid; grid-template-columns: 64px 1fr; gap: 12px; margin-bottom: 12px;
  background: var(--color-bg-card); border-radius: 12px; padding: 12px; border: 1px solid var(--color-border);
}
.timeline-year { font-weight: 700; color: var(--color-primary); }

.medal-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 360px; margin: 0 auto; }
.medal-card { aspect-ratio: 1; cursor: pointer; }
.medal-card-inner {
  position: relative; width: 100%; height: 100%; transform-style: preserve-3d;
  transition: transform .5s;
}
.medal-card.flipped .medal-card-inner { transform: rotateY(180deg); }
.medal-face {
  position: absolute; inset: 0; backface-visibility: hidden;
  border-radius: 12px; display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--medal-color, var(--color-primary));
  background: var(--color-bg-card);
}
.medal-back { transform: rotateY(180deg); font-size: 12px; padding: 8px; text-align: center; }
.medal-emoji { font-size: 32px; }

.project-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.project-card {
  background: var(--color-bg-card); border-radius: 10px; padding: 10px;
  border: 1px solid var(--color-border); font-size: 13px;
}
.project-card img { width: 100%; border-radius: 8px; margin-bottom: 6px; }

.fab-top {
  position: fixed; right: 16px;
  bottom: calc(var(--contact-footer-h) + var(--bottom-nav-h) + 16px + var(--safe-area-bottom));
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--color-border);
  background: var(--color-bg-card); cursor: pointer; z-index: 120;
}
.a11y-toolbar {
  position: fixed; left: 8px;
  bottom: calc(var(--contact-footer-h) + var(--bottom-nav-h) + 12px + var(--safe-area-bottom));
  z-index: 120; display: flex; flex-direction: column; gap: 4px;
}
.a11y-toolbar button {
  width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--color-border);
  background: var(--color-bg-card); cursor: pointer; font-size: 12px;
}
.editor-page { padding: 16px; max-width: 720px; margin: 0 auto; }
.form-field { margin-bottom: 14px; }
.form-field label { display: block; font-size: 13px; margin-bottom: 4px; color: var(--color-text-secondary); }
.form-field input, .form-field select {
  width: 100%; padding: 10px; border-radius: 8px; border: 1px solid var(--color-border);
  background: var(--color-bg-card); font-family: inherit;
}
.editor-hint, .field-hint { font-size: 12px; color: var(--color-text-secondary); }
.editor-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.animate-in { animation: fadeUp .6s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

.r159-toast {
  position: fixed; left: 50%; bottom: calc(var(--contact-footer-h) + 80px);
  transform: translateX(-50%); background: rgba(0,0,0,.8); color: #fff;
  padding: 10px 18px; border-radius: 8px; z-index: 9999; opacity: 0; transition: opacity .2s;
}
.r159-toast.show { opacity: 1; }

.vol-editor-row {
  margin-bottom: 16px; padding: 12px; border-radius: 12px;
  border: 1px solid var(--color-border); background: var(--color-bg-card);
}
.vol-editor-row__head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.vol-editor-row__actions { display: flex; gap: 6px; }
.import-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.editor-section-title { font-size: 17px; margin: 20px 0 10px; padding-top: 8px; border-top: 1px solid var(--color-border); }
.hidden-input { position: absolute; width: 0; height: 0; opacity: 0; pointer-events: none; }
.avatar-field { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.avatar-preview { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; background: var(--color-border); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.student-editor-star { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-top: 8px; }
.editor-modal {
  position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.editor-modal.hidden { display: none; }
.editor-modal__panel {
  background: var(--color-bg-card); border-radius: 16px; padding: 16px;
  max-width: 480px; width: 100%;
}
.editor-modal__panel--wide { max-width: 560px; max-height: 90vh; overflow-y: auto; }
.detail-subtitle { font-size: 14px; margin: 14px 0 8px; color: var(--color-text-secondary); }
.detail-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.detail-item-row {
  display: grid; grid-template-columns: repeat(4, 1fr) auto; gap: 6px; align-items: center;
}
.detail-item-row--project { grid-template-columns: 1fr 1fr 72px 88px 1fr auto; }
.detail-item-row input {
  width: 100%; padding: 6px 8px; border-radius: 6px; border: 1px solid var(--color-border);
  font-size: 13px; min-width: 0;
}
@media (max-width: 520px) {
  .detail-item-row, .detail-item-row--project { grid-template-columns: 1fr 1fr; }
}
.editor-modal__panel textarea {
  width: 100%; padding: 10px; border-radius: 8px; border: 1px solid var(--color-border);
  font-family: inherit; margin: 8px 0;
}
.editor-modal__actions { display: flex; gap: 8px; margin-top: 12px; }
.import-mode { display: flex; gap: 12px; font-size: 14px; margin: 8px 0; }
.roster-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.roster-chip {
  display: flex; align-items: center; gap: 6px; padding: 6px 10px;
  border-radius: 20px; border: 1px solid var(--color-border);
  background: var(--color-bg-card); text-decoration: none; color: inherit; font-size: 13px;
}
.roster-chip img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.roster-chip.active { border-color: var(--color-primary); background: rgba(5,150,105,0.1); }
