/* R199 style.css · civilization-station · red theme · v1.0 */

:root {
  --primary: #C41E3A;
  --secondary: #E53E3E;
  --accent: #F6AD55;
  --bg: #FFF5F5;
  --card: #FFFFFF;
  --text: #2D1B1B;
  --text-secondary: #718096;
  --border: #FED7D7;
  --success: #38A169;
  --warning: #D69E2E;
  --danger: #C41E3A;
  --tile-bg: #FEB2B2;
  --contact-footer-h: 92px;
  --bottom-nav-h: 52px;
  --bottom-chrome-h: calc(var(--contact-footer-h) + var(--bottom-nav-h));
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
  --float-gap: 12px;
  --zw-fab-size: 52px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
}

body.has-contact-footer.has-bottom-nav {
  padding-bottom: calc(var(--bottom-chrome-h) + 16px + var(--safe-area-bottom));
}

button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }

.app-header {
  padding: 12px 16px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-header h1 { font-size: 17px; font-weight: 700; }
.app-sub { font-size: 12px; opacity: 0.9; margin-top: 4px; }
.header-row { display: flex; justify-content: space-between; align-items: center; }
.header-share { font-size: 18px; color: #fff; padding: 8px; opacity: 0.95; }

#main { padding: 12px 16px 20px; min-height: 50vh; }

/* Bottom nav + contact footer dual chrome */
.bottom-nav {
  position: fixed;
  bottom: calc(var(--contact-footer-h) + var(--safe-area-bottom));
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: var(--card);
  border-top: 1px solid var(--border);
  z-index: 80;
  padding: 4px 0;
  min-height: var(--bottom-nav-h);
  box-shadow: 0 -2px 12px rgba(196, 30, 58, 0.08);
}

.bottom-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 44px;
  font-size: 0.58rem;
  color: var(--text-secondary);
  padding: 4px 2px;
  border: none;
  background: transparent;
  cursor: pointer;
}

.bottom-nav-btn span { font-size: 1.1rem; line-height: 1; }
.bottom-nav-btn.active { color: var(--primary); font-weight: 700; }

.contact-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: #1a1a1a;
  z-index: 850;
  padding: 0.55rem 0.75rem calc(0.55rem + var(--safe-area-bottom));
  min-height: var(--contact-footer-h);
}

.contact-footer__btns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 88px));
  justify-content: center;
  gap: 0.4rem;
  max-width: 320px;
  margin: 0 auto;
}

.contact-footer__cta,
.contact-footer__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.48rem 0.2rem;
}

.contact-footer__cta { background: #c41e1e !important; color: #fff; }
.contact-footer__btn { background: transparent; color: #fff; border: 1px solid #555; cursor: pointer; }
.contact-footer__brand { text-align: center; color: #888; font-size: 10px; margin-top: 6px; }

body[data-brand="civilization-station"] .zw-root .zw-fab,
body[data-brand="civilization-station"] .em-entry-btn {
  bottom: calc(var(--bottom-chrome-h) + var(--float-gap) + var(--safe-area-bottom)) !important;
}

body[data-brand="civilization-station"] .toast-container {
  bottom: calc(var(--bottom-chrome-h) + var(--zw-fab-size) + var(--float-gap) + var(--safe-area-bottom));
  top: auto;
}

/* Hero banner */
.hero-banner {
  background: linear-gradient(145deg, var(--primary) 0%, #9B2C2C 100%);
  color: #fff;
  border-radius: 18px;
  padding: 22px 18px;
  margin-bottom: 14px;
  box-shadow: 0 8px 24px rgba(196, 30, 58, 0.25);
}

.hero-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.2);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  margin-bottom: 10px;
}

.hero-banner h2 { font-size: 20px; margin-bottom: 6px; font-weight: 700; }
.hero-banner p { font-size: 13px; opacity: 0.95; }
.hero-intro { font-size: 12px; opacity: 0.85; margin-top: 10px; line-height: 1.6; }

/* Bento grid M1 */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: auto auto auto;
  gap: 10px;
  margin-bottom: 14px;
}

.bento-zone {
  border: none;
  background: var(--card);
  border-radius: 14px;
  padding: 14px 10px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  border: 1px solid var(--border);
  transition: transform 0.15s, box-shadow 0.15s;
  color: var(--text);
}

.bento-zone:active { transform: scale(0.98); }
.bento-large { grid-column: span 2; grid-row: span 1; padding: 18px; }
.bento-medium { grid-column: span 1; }
.bento-small { grid-column: span 1; padding: 12px 8px; }

.bento-icon { display: block; font-size: 24px; margin-bottom: 6px; }
.bento-num { display: block; font-size: 22px; font-weight: 800; color: var(--primary); }
.bento-title { display: block; font-size: 11px; color: var(--text-secondary); margin-top: 4px; }

/* Cards & buttons */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  min-height: 44px;
  cursor: pointer;
  display: inline-block;
  text-align: center;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-outline { background: var(--card); border: 2px solid var(--border); color: var(--text); }
.btn-block { width: 100%; margin-top: 8px; }
.btn-sm { padding: 6px 12px; min-height: 32px; font-size: 12px; }

.section-title { font-size: 15px; font-weight: 700; margin: 12px 0 8px; color: var(--text); }
.page-title { font-size: 18px; font-weight: 700; margin: 8px 0 12px; }
.empty-hint { text-align: center; padding: 24px; color: var(--text-secondary); font-size: 13px; }

.form-group { display: block; margin-bottom: 10px; font-size: 12px; font-weight: 600; }
.form-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-top: 4px;
  font-weight: 400;
  background: #fff;
  color: var(--text);
}

.chip {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 12px;
  cursor: pointer;
  margin-right: 6px;
  margin-bottom: 6px;
}

.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.badge {
  background: var(--tile-bg);
  color: var(--text);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 8px;
}

.badge-activity { background: #FED7D7; color: var(--primary); }
.badge-volunteer { background: #C6F6D5; color: #276749; }

/* Calendar M4 */
.track-tabs { margin-bottom: 10px; }
.cal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.cal-week { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: 11px; color: var(--text-secondary); margin-bottom: 4px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 14px; }
.cal-empty { aspect-ratio: 1; }
.cal-day {
  aspect-ratio: 1;
  border: none;
  background: var(--card);
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  position: relative;
  color: var(--text);
  border: 1px solid transparent;
}

.cal-day.has-event { background: #FFF0F0; border-color: var(--border); }
.cal-day.selected { background: var(--primary); color: #fff; }
.cal-dots { position: absolute; bottom: 2px; left: 50%; transform: translateX(-50%); display: flex; gap: 2px; }
.cal-dot { width: 4px; height: 4px; border-radius: 50%; display: inline-block; }
.cal-dot-activity { background: var(--primary); }
.cal-dot-volunteer { background: var(--success); }
.cal-day.selected .cal-dot { background: #fff; }

.activity-card__top { display: flex; justify-content: space-between; margin-bottom: 8px; }
.activity-card__actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.activity-admin-panel { margin-bottom: 12px; }
.activity-admin-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px;
  background: var(--card); border: 1px dashed var(--primary); border-radius: 12px 12px 0 0;
}
.activity-admin-label { font-size: 13px; font-weight: 700; color: var(--primary); }
.activity-manage-list {
  list-style: none; margin: 0; padding: 0;
  background: var(--card); border: 1px dashed var(--primary); border-top: none;
  border-radius: 0 0 12px 12px; overflow: hidden;
}
.activity-manage-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 12px; border-top: 1px solid var(--border);
}
.activity-manage-row:first-child { border-top: none; }
.activity-manage-row__info { flex: 1; min-width: 0; }
.activity-manage-row__title { display: block; font-size: 13px; font-weight: 600; }
.activity-manage-row__meta { display: block; font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.activity-manage-row__actions { display: flex; flex-shrink: 0; gap: 6px; }
.activity-manage-empty { padding: 12px; font-size: 12px; color: var(--text-secondary); text-align: center; }
.form-row-inline { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn-danger { color: var(--danger); border-color: var(--danger); }
.activity-title, .activity-card h4 { font-size: 15px; margin-bottom: 6px; }
.activity-meta { font-size: 12px; color: var(--text-secondary); }
.quota-bar { height: 6px; background: var(--border); border-radius: 3px; margin: 8px 0; overflow: hidden; }
.quota-bar__fill { height: 100%; background: var(--primary); border-radius: 3px; }

/* Volunteer M6 */
.leaderboard-row {
  display: grid;
  grid-template-columns: 32px 1fr auto auto;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  align-items: center;
}

.lb-rank { font-size: 16px; }
.lb-hours { font-weight: 700; color: var(--primary); }
.lb-team { font-size: 11px; color: var(--text-secondary); }

.medal-wall { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.medal-card {
  text-align: center;
  padding: 12px 6px;
  background: var(--tile-bg);
  border-radius: 12px;
  font-size: 11px;
}

.medal-icon { display: block; font-size: 28px; margin-bottom: 4px; }
.medal-name { display: block; font-weight: 700; font-size: 12px; }

.volunteer-card { display: flex; gap: 12px; align-items: center; }
.vol-avatar { font-size: 36px; }

/* Review M8 */
.star-input { margin-bottom: 10px; }
.star-btn {
  border: none;
  background: none;
  font-size: 28px;
  color: var(--border);
  cursor: pointer;
  padding: 0 2px;
}

.star-btn.active { color: #F6AD55; }
.review-stars { color: #F6AD55; font-size: 14px; margin-bottom: 6px; }
.review-meta { font-size: 11px; color: var(--text-secondary); margin-top: 8px; }

.barrage-wrap { padding: 0; overflow: hidden; margin-bottom: 12px; }
.barrage-stage-host {
  position: relative;
  height: 112px;
  overflow: hidden;
  background: linear-gradient(90deg, var(--primary), var(--secondary, var(--primary)));
}
.barrage-stage { position: relative; width: 100%; height: 100%; }
.barrage-item {
  position: absolute;
  left: 0;
  white-space: nowrap;
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.18);
  transition: transform 0.15s ease;
  cursor: pointer;
}
.barrage-item.barrage-enter { animation: barrage-enter 0.5s ease; }
.barrage-item.barrage-paused { z-index: 2; }
@keyframes barrage-enter {
  from { opacity: 0; transform: scale(0.6); }
  to { opacity: 1; transform: scale(1); }
}
.barrage-static { padding: 8px 12px; color: #fff; }
.barrage-static .barrage-item { position: static; display: block; margin-bottom: 4px; }
.barrage-star-5 { color: #FFD700; }
.barrage-star-4 { color: #90CDF4; }
.barrage-star-3 { color: #E2E8F0; }

.review-audit-panel { border: 1px dashed var(--warning); margin-bottom: 12px; }
.review-audit-row { padding: 10px 0; border-bottom: 1px solid var(--border); }
.review-audit-row:last-child { border-bottom: none; }

.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.archive-section-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 10px; }
.archive-check { font-size: 13px; display: flex; align-items: center; gap: 6px; }
.archive-progress { height: 6px; background: var(--border); border-radius: 3px; margin: 10px 0; overflow: hidden; }
.archive-progress__bar { height: 100%; width: 0; background: var(--primary); transition: width 0.2s; }
.archive-preview { margin: 10px 0; overflow-x: auto; }
.archive-canvas { max-width: 100%; height: auto; border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,.08); }
.backup-file-label { display: block; text-align: center; margin-top: 8px; cursor: pointer; }
.backup-preview { margin-top: 12px; padding: 12px; background: var(--bg); }
.hidden { display: none !important; }

/* legacy barrage strip removed in P2 */
.barrage-strip {
  overflow: hidden;
  white-space: nowrap;
  background: var(--primary);
  color: #fff;
  padding: 8px 0;
  margin: 0 -16px 12px;
  font-size: 12px;
}

.barrage-item { display: inline-block; padding: 0 24px; }
.barrage-static { white-space: normal; }
.barrage-static .barrage-item { display: block; padding: 4px 16px; }

/* More menu */
.more-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.more-menu-item {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 12px;
  padding: 14px 8px;
  text-align: center;
  font-size: 12px;
  cursor: pointer;
  color: var(--text);
}

.more-icon { display: block; font-size: 24px; margin-bottom: 4px; }
.theme-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* Position M2 compare slider */
.compare-slider {
  position: relative;
  height: 120px;
  margin-top: 12px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--tile-bg);
}

.compare-before, .compare-after {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
}

.compare-after { clip-path: inset(0 50% 0 0); background: rgba(196, 30, 58, 0.1); }
.compare-range {
  position: absolute;
  bottom: 8px;
  left: 10%;
  width: 80%;
  z-index: 2;
}

.compare-label { position: absolute; bottom: 28px; left: 0; right: 0; text-align: center; font-size: 10px; color: var(--text-secondary); }

/* Team M3 */
.org-tree { width: 100%; height: auto; display: block; }
.org-fallback { font-size: 13px; line-height: 2; }
.team-head { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.team-emoji { font-size: 32px; }

/* Brand accordion M7 */
.accordion-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
  overflow: hidden;
}

.accordion-item summary {
  padding: 12px 14px;
  font-weight: 600;
  cursor: pointer;
  background: var(--tile-bg);
  list-style: none;
}

.accordion-item summary::-webkit-details-marker { display: none; }
.accordion-item p { padding: 12px 14px; font-size: 13px; line-height: 1.6; }

/* Dashboard M5 */
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.stat-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 8px;
  text-align: center;
}

.stat-item span { display: block; font-size: 20px; font-weight: 800; color: var(--primary); }
.stat-item small { font-size: 11px; color: var(--text-secondary); }
.chart-card { text-align: center; }
.chart-label, .chart-fallback, .bar-fallback { font-size: 12px; color: var(--text-secondary); margin-top: 6px; }
.ring-chart { display: block; margin: 0 auto; }

/* Quiz M10 */
.quiz-progress { font-size: 12px; color: var(--text-secondary); margin-bottom: 8px; }
.quiz-card h3 { font-size: 16px; margin-bottom: 14px; line-height: 1.5; }
.quiz-options { display: flex; flex-direction: column; gap: 8px; }
.quiz-opt {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 10px;
  padding: 12px;
  text-align: left;
  font-size: 14px;
  cursor: pointer;
}

.quiz-opt:active { background: var(--tile-bg); }
.quiz-result { text-align: center; }
.success-icon { font-size: 48px; margin-bottom: 8px; }

/* Poster */
.poster-area { margin: 12px auto; max-width: 300px; }
.poster-canvas { width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--border); }
.poster-fallback {
  background: var(--primary);
  color: #fff;
  padding: 24px;
  border-radius: 12px;
  text-align: center;
}

.back-btn { margin-bottom: 8px; }
.site-contact p { font-size: 13px; margin-bottom: 6px; }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal { max-width: 360px; width: 100%; max-height: 90vh; overflow-y: auto; }
.modal-title { font-size: 16px; margin-bottom: 12px; }
.modal-actions { display: flex; gap: 8px; margin-top: 12px; }
.modal-actions .btn { flex: 1; }

/* Share page */
.share-main { padding: 24px 16px; }
.share-card {
  background: var(--card);
  border-radius: 20px;
  padding: 28px 20px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(196, 30, 58, 0.12);
  border: 1px solid var(--border);
}

.share-icon { font-size: 56px; margin-bottom: 8px; }
.share-slogan { color: var(--primary); font-weight: 600; margin: 8px 0 16px; }
.share-link { font-size: 11px; color: var(--text-secondary); word-break: break-all; margin: 8px 0; }
.share-qr { text-align: center; margin: 12px 0; }
.qr-fallback { font-size: 12px; color: var(--text-secondary); }

/* Toast */
.toast-container {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99999;
  pointer-events: none;
}

.toast-item {
  background: rgba(45, 27, 27, 0.92);
  color: #fff;
  padding: 10px 18px;
  border-radius: 20px;
  margin-top: 6px;
  opacity: 0;
  transition: opacity 0.3s;
  font-size: 13px;
}

.toast-item.show { opacity: 1; }

.editable-field { outline: 2px dashed var(--warning); outline-offset: 2px; }

/* Print */
@media print {
  .contact-footer, .bottom-nav, .app-header .header-share { display: none !important; }
  body { padding-bottom: 0; max-width: none; }
  .hero-banner { break-inside: avoid; }
}

@media (min-width: 481px) {
  body { box-shadow: 0 0 24px rgba(196, 30, 58, 0.08); }
  .bottom-nav, .contact-footer { max-width: 480px; left: 50%; right: auto; width: 100%; transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
