/* R84 社群公告板 H5 */
:root {
  --color-primary: #FF6B35;
  --color-secondary: #004E89;
  --color-success: #28A745;
  --color-danger: #E10600;
  --color-bg: #F5F5F5;
  --color-card: #FFFFFF;
  --color-text: #1A1A1A;
  --color-text-secondary: #6B6B6B;
  --color-divider: #E8E8E8;
  --color-urgent-bg: #FFF5F5;
  --color-pinned-bg: #FFF8F0;
  --header-h: 56px;
  --tabbar-h: 56px;
  --contact-footer-h: 58px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --shadow: 0 2px 12px rgba(0,0,0,.06);
  --font: -apple-system, 'PingFang SC', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
  padding-bottom: calc(var(--tabbar-h) + var(--contact-footer-h) + env(safe-area-inset-bottom, 0));
  -webkit-tap-highlight-color: transparent;
}
body.modal-open { overflow: hidden; }
button, input, select, textarea { font: inherit; }
.hidden { display: none !important; }

.app { max-width: 480px; margin: 0 auto; min-height: 100vh; position: relative; }

.header {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; background: var(--color-card);
  border-bottom: 1px solid var(--color-divider);
  padding-top: calc(12px + env(safe-area-inset-top, 0));
  position: sticky; top: 0; z-index: 50;
}
.header-info { flex: 1; min-width: 0; }
.header-share {
  flex-shrink: 0; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  background: var(--color-bg); border-radius: var(--radius-full); text-decoration: none; font-size: 16px;
}
.header-logo { font-size: 32px; }
.header-title { margin: 0; font-size: 18px; }
.header-count { font-size: 12px; color: var(--color-text-secondary); }

.hero {
  margin: 12px 16px 0; padding: 14px 16px; border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  color: #fff;
}
.hero-slogan { margin: 0; font-size: 14px; opacity: .95; }

.urgent-banner {
  display: flex; align-items: center; gap: 8px;
  margin: 10px 16px 0; padding: 10px 12px;
  background: var(--color-danger); color: #fff; border-radius: var(--radius-md);
  cursor: pointer; animation: marquee-bg 2s ease-in-out infinite;
}
.urgent-banner-text { flex: 1; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.urgent-banner-close { border: 0; background: rgba(255,255,255,.2); color: #fff; width: 28px; height: 28px; border-radius: var(--radius-full); cursor: pointer; }

.search-bar { padding: 10px 16px 0; position: relative; }
.search-input-wrapper {
  display: flex; align-items: center; gap: 8px;
  background: var(--color-card); border-radius: var(--radius-full);
  padding: 10px 14px; box-shadow: var(--shadow);
}
.search-input-wrapper input { flex: 1; border: 0; outline: none; background: transparent; font-size: 14px; }
.search-clear { border: 0; background: var(--color-bg); width: 24px; height: 24px; border-radius: var(--radius-full); cursor: pointer; }
.search-suggestions {
  position: absolute; left: 16px; right: 16px; top: 100%; z-index: 40;
  background: var(--color-card); border-radius: var(--radius-md); box-shadow: var(--shadow);
  margin-top: 4px; max-height: 200px; overflow-y: auto;
}
.suggestion-item {
  display: block; width: 100%; border: 0; background: none; text-align: left;
  padding: 10px 14px; font-size: 14px; cursor: pointer; border-bottom: 1px solid var(--color-divider);
}

.pinned-zone {
  margin: 12px 16px 0; padding: 12px; background: var(--color-pinned-bg);
  border-radius: var(--radius-md); border: 1px solid #FDE68A;
}
.pinned-header { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.pinned-count { color: var(--color-text-secondary); font-weight: 400; }
.pinned-list { display: flex; flex-direction: column; gap: 6px; }
.pinned-card {
  border: 0; background: var(--color-card); border-radius: var(--radius-sm);
  padding: 10px 12px; text-align: left; font-size: 13px; cursor: pointer; box-shadow: var(--shadow);
}

.category-tabs { padding: 12px 16px 0; position: sticky; top: var(--header-h); z-index: 40; background: var(--color-bg); display: flex; align-items: center; gap: 8px; }
.tabs-scroll { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; -webkit-overflow-scrolling: touch; flex: 1; min-width: 0; }
.view-toggle {
  flex-shrink: 0; width: 36px; height: 36px; border: 1px solid var(--color-divider);
  background: var(--color-card); border-radius: var(--radius-sm); cursor: pointer; font-size: 16px;
}
.announcement-list.grid-mode { padding-top: 4px; }
.announcement-grid {
  display: grid; grid-template-columns: 3fr 2fr; gap: 10px;
  animation: grid-in .25s ease;
}
@keyframes grid-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.grid-card {
  background: var(--color-card); border-radius: var(--radius-md); padding: 12px;
  box-shadow: var(--shadow); cursor: pointer; position: relative;
}
.grid-card--wide { grid-column: 1 / -1; }
.grid-card.urgent { background: var(--color-urgent-bg); border-left: 3px solid var(--color-danger); }
.grid-card__icon { font-size: 24px; display: block; margin-bottom: 4px; }
.grid-card h3 { margin: 0 0 6px; font-size: 14px; }
.grid-card p { margin: 0; font-size: 12px; color: var(--color-text-secondary); }

.reaction-bar { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.reaction-btn {
  border: 1px solid var(--color-divider); background: var(--color-bg);
  padding: 6px 10px; border-radius: var(--radius-full); cursor: pointer; font-size: 14px;
}
.reaction-btn.is-on { border-color: var(--color-primary); background: #FFF8F0; }
.reaction-btn em { font-style: normal; font-size: 11px; margin-left: 2px; }
.card-reactions { margin-left: auto; font-size: 11px; }

.comment-reply { margin: 6px 0 6px 12px; padding: 8px; background: var(--color-bg); border-radius: var(--radius-sm); font-size: 12px; }
.comment-reply-btn { border: 0; background: none; color: var(--color-primary); font-size: 12px; cursor: pointer; padding: 0; }

.hero-festival { float: right; font-size: 28px; }
.hero-slogan { clear: both; }

.notification-bar {
  display: flex; align-items: center; gap: 8px; margin: 8px 16px 0;
  padding: 10px 12px; background: var(--color-secondary); color: #fff;
  border-radius: var(--radius-md); transform: translateY(-120%); opacity: 0;
  transition: transform .3s, opacity .3s;
}
.notification-bar.is-show { transform: translateY(0); opacity: 1; }
.notif-close { margin-left: auto; border: 0; background: rgba(255,255,255,.2); color: #fff; width: 24px; height: 24px; border-radius: 50%; cursor: pointer; }

.festival-switcher, .push-switcher { margin-bottom: 16px; font-size: 13px; }
.festival-picker { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.festival-chip {
  border: 1px solid var(--color-divider); background: var(--color-card);
  padding: 6px 10px; border-radius: var(--radius-full); font-size: 12px; cursor: pointer;
}
.push-switcher { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.template-picker { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.template-chip {
  border: 1px dashed var(--color-primary); background: #FFF8F0; color: var(--color-primary);
  padding: 6px 10px; border-radius: var(--radius-full); font-size: 11px; cursor: pointer;
}

.share-canvas-wrap { padding: 12px 16px 16px; }
.share-canvas-wrap canvas { width: 100%; height: auto; border-radius: var(--radius-md); }
.share-hint { font-size: 11px; color: var(--color-text-secondary); text-align: center; margin: 6px 0 0; }

[data-festival="spring"] .hero { background: linear-gradient(135deg, #E10600, #FFD700); }
[data-festival="midautumn"] .hero { background: linear-gradient(135deg, #F5A623, #1E3A5F); }
[data-festival="christmas"] .hero { background: linear-gradient(135deg, #C8102E, #165B33); }
[data-festival="dragon"] .hero { background: linear-gradient(135deg, #047857, #065F46); }

.contact-footer__brand { margin: 6px 0 0; text-align: center; font-size: 10px; color: var(--color-text-secondary); }
.tab-item {
  flex-shrink: 0; border: 1px solid var(--color-divider); background: var(--color-card);
  padding: 6px 12px; border-radius: var(--radius-full); font-size: 12px; cursor: pointer;
}
.tab-item.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

.announcement-list { padding: 8px 16px 24px; }
.timeline-group { margin-bottom: 8px; }
.timeline-group-header {
  width: 100%; border: 0; background: none; display: flex; align-items: center; gap: 8px;
  padding: 8px 0; font-size: 14px; font-weight: 600; cursor: pointer;
}
.timeline-month-count { color: var(--color-text-secondary); font-size: 12px; font-weight: 400; }
.timeline-toggle { margin-left: auto; transition: transform .2s; }
.timeline-toggle.collapsed { transform: rotate(-90deg); }

.timeline-item { display: flex; gap: 12px; margin-bottom: 12px; }
.timeline-node {
  width: 12px; height: 12px; border-radius: 50%; background: #CBD5E1;
  margin-top: 18px; flex-shrink: 0; position: relative;
}
.timeline-node.important { background: var(--color-secondary); }
.timeline-node.urgent { background: var(--color-danger); }
.timeline-node.pulse::after {
  content: ''; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid var(--color-danger); animation: pulse-ring 1.5s ease-out infinite;
}
@keyframes pulse-ring {
  0% { transform: scale(.8); opacity: 1; }
  100% { transform: scale(1.8); opacity: 0; }
}

.announcement-card {
  flex: 1; background: var(--color-card); border-radius: var(--radius-md);
  padding: 14px; box-shadow: var(--shadow); cursor: pointer;
  border-left: 3px solid transparent;
}
.announcement-card.important { border-left-color: var(--color-secondary); }
.announcement-card.urgent { border-left-color: var(--color-danger); background: var(--color-urgent-bg); }
.announcement-card.compact { margin-bottom: 8px; }
.card-tag {
  display: inline-block; font-size: 10px; padding: 2px 8px; border-radius: var(--radius-full);
  margin-bottom: 6px; font-weight: 600;
}
.card-tag.urgent { background: var(--color-danger); color: #fff; }
.card-tag.important { background: var(--color-secondary); color: #fff; }
.card-title { margin: 0 0 6px; font-size: 15px; line-height: 1.4; }
.card-excerpt { margin: 0 0 8px; font-size: 13px; color: var(--color-text-secondary); line-height: 1.5; }
.card-meta { display: flex; flex-wrap: wrap; gap: 8px; font-size: 11px; color: var(--color-text-secondary); }
.confirm-badge.done { color: var(--color-success); font-weight: 600; }
.card-stats { display: flex; gap: 12px; margin-top: 8px; font-size: 11px; color: var(--color-text-secondary); }

.empty-state { text-align: center; padding: 40px 24px; }
.empty-illustration { font-size: 48px; margin-bottom: 12px; }
.empty-text { font-size: 16px; font-weight: 600; margin: 0 0 6px; }
.empty-sub { font-size: 13px; color: var(--color-text-secondary); margin: 0; }
.empty-tip { text-align: center; color: var(--color-text-secondary); font-size: 13px; padding: 20px; }

.tab-bar {
  position: fixed; left: 0; right: 0; bottom: var(--contact-footer-h);
  z-index: 90; background: var(--color-card); border-top: 1px solid var(--color-divider);
  display: flex; max-width: 480px; margin: 0 auto;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.tab-bar-item {
  flex: 1; border: 0; background: none; padding: 8px 4px; font-size: 10px;
  color: var(--color-text-secondary); cursor: pointer; position: relative;
}
.tab-bar-item.active { color: var(--color-primary); font-weight: 700; }
.tab-icon { display: block; font-size: 18px; margin-bottom: 2px; }
.tab-badge {
  position: absolute; top: 4px; right: 20%; min-width: 16px; height: 16px;
  background: var(--color-danger); color: #fff; font-size: 10px; border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
}

.fab {
  position: fixed; right: 20px; bottom: calc(var(--tabbar-h) + var(--contact-footer-h) + 16px);
  width: 52px; height: 52px; border-radius: 50%; border: 0;
  background: var(--color-primary); color: #fff; font-size: 28px; line-height: 1;
  box-shadow: 0 4px 16px rgba(255,107,53,.4); cursor: pointer; z-index: 80;
}

.panel-page { padding: 16px; padding-bottom: 80px; }
.panel-head h2 { margin: 0 0 4px; font-size: 20px; }
.panel-head p { margin: 0 0 16px; font-size: 13px; color: var(--color-text-secondary); }
.panel-list { display: flex; flex-direction: column; gap: 8px; }

.profile-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.profile-avatar { font-size: 40px; }
.profile-name { display: block; font-weight: 700; }
.profile-role { font-size: 12px; color: var(--color-text-secondary); }
.stat-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.stat-card {
  background: var(--color-card); border-radius: var(--radius-md); padding: 14px 10px;
  text-align: center; box-shadow: var(--shadow);
}
.stat-value { display: block; font-size: 22px; font-weight: 700; color: var(--color-primary); }
.stat-label { font-size: 11px; color: var(--color-text-secondary); }
.theme-switcher, .role-switcher { margin-bottom: 16px; font-size: 13px; }
.theme-dots { display: flex; gap: 8px; margin-top: 8px; }
.theme-dot { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff; box-shadow: var(--shadow); cursor: pointer; }
.role-switcher { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.section-head h3 { margin: 16px 0 8px; font-size: 15px; }

.modal-overlay {
  position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.45);
  display: flex; align-items: flex-end; justify-content: center;
}
.modal-container {
  width: 100%; max-width: 480px; max-height: 92vh; background: var(--color-card);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0; display: flex; flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--color-divider);
}
.modal-back, .modal-share { border: 0; background: none; color: var(--color-primary); font-size: 14px; cursor: pointer; }
.modal-title { font-weight: 700; }
.modal-publish { border: 0; background: var(--color-primary); color: #fff; padding: 8px 16px; border-radius: var(--radius-full); cursor: pointer; }
.modal-publish:disabled { opacity: .4; cursor: not-allowed; }
.modal-body { flex: 1; overflow-y: auto; padding: 16px; }
.modal-footer { padding: 12px 16px; border-top: 1px solid var(--color-divider); }
.footer-stats { font-size: 12px; color: var(--color-text-secondary); margin-bottom: 10px; }
.footer-actions { display: flex; gap: 8px; align-items: center; }
.action-btn {
  border: 1px solid var(--color-divider); background: var(--color-bg);
  padding: 10px 12px; border-radius: var(--radius-full); cursor: pointer; font-size: 13px;
}
.action-btn.primary { background: var(--color-primary); color: #fff; border-color: var(--color-primary); flex: 1; }
.action-btn.confirmed { background: var(--color-success); border-color: var(--color-success); }
.action-btn.is-active { border-color: var(--color-primary); color: var(--color-primary); }

.detail-title { margin: 8px 0; font-size: 20px; line-height: 1.4; }
.detail-meta { font-size: 12px; color: var(--color-text-secondary); margin: 0 0 12px; }
.detail-body { font-size: 15px; line-height: 1.7; white-space: pre-wrap; }
.detail-tag { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: var(--radius-full); margin-bottom: 8px; }
.detail-tag--urgent { background: var(--color-danger); color: #fff; }
.detail-tag--important { background: var(--color-secondary); color: #fff; }

.comment-section { padding: 0 16px 16px; border-top: 1px solid var(--color-divider); }
.comment-list { margin-bottom: 12px; }
.comment-item { padding: 10px 0; border-bottom: 1px solid var(--color-divider); font-size: 13px; }
.comment-item strong { margin-right: 8px; }
.comment-time { font-size: 11px; color: var(--color-text-secondary); }
.comment-empty { font-size: 13px; color: var(--color-text-secondary); }
.comment-form { display: flex; flex-direction: column; gap: 8px; }
.comment-form input, .comment-form textarea {
  border: 1px solid var(--color-divider); border-radius: var(--radius-sm); padding: 8px 10px;
}

.editor-input, .editor-textarea {
  width: 100%; border: 1px solid var(--color-divider); border-radius: var(--radius-md);
  padding: 12px; margin-bottom: 10px; resize: vertical;
}
.editor-options { display: flex; flex-direction: column; gap: 10px; font-size: 14px; margin-bottom: 12px; }
.editor-options label { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.option-switch input { width: 18px; height: 18px; }

.btn {
  border: 0; padding: 10px 16px; border-radius: var(--radius-full);
  font-size: 14px; cursor: pointer; font-weight: 600;
}
.btn--primary { background: var(--color-primary); color: #fff; }
.btn--outline { background: transparent; border: 1px solid var(--color-divider); }
.btn--danger { background: var(--color-danger); color: #fff; }
.btn--full { display: block; width: 100%; text-align: center; }
.btn--sm { padding: 6px 12px; font-size: 12px; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--contact-footer-h) + 20px);
  transform: translateX(-50%); background: rgba(26,26,26,.9); color: #fff;
  padding: 10px 18px; border-radius: var(--radius-full); font-size: 13px; z-index: 300;
}
.toast.is-show { display: block; }
.toast--success { background: var(--color-success); }

.contact-footer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 85;
  background: var(--color-card); border-top: 1px solid var(--color-divider);
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0));
  max-width: 480px; margin: 0 auto;
}
.contact-footer__btns { display: flex; gap: 8px; }
.contact-footer__cta {
  flex: 1; text-align: center; background: var(--color-primary); color: #fff !important;
  padding: 10px; border-radius: var(--radius-full); font-size: 13px; font-weight: 600; text-decoration: none;
}
.contact-footer__btn {
  flex: 1; text-align: center; background: var(--color-bg); padding: 10px;
  border-radius: var(--radius-full); font-size: 13px; border: 0; cursor: pointer; text-decoration: none; color: inherit;
}
.contact-footer__brand { margin: 6px 0 0; text-align: center; font-size: 10px; color: var(--color-text-secondary); }

/* 分享页 */
body.share-page { padding-bottom: calc(var(--contact-footer-h) + env(safe-area-inset-bottom, 0)); }
.share-card {
  max-width: 480px; margin: 0 auto; padding: 24px 16px 32px; text-align: center;
}
.share-card__eyebrow { font-size: 13px; color: var(--color-text-secondary); margin: 0 0 8px; }
.share-logo-wrap { font-size: 48px; margin-bottom: 8px; }
.share-card h1 { margin: 0 0 8px; font-size: 24px; }
.share-card__tagline { margin: 0 0 8px; font-size: 15px; color: var(--color-primary); font-weight: 600; }
.share-card__desc { margin: 0 0 16px; font-size: 13px; color: var(--color-text-secondary); line-height: 1.5; }
.share-stats { display: flex; justify-content: center; gap: 20px; margin-bottom: 20px; }
.share-stats div { font-size: 12px; color: var(--color-text-secondary); }
.share-stats strong { display: block; font-size: 14px; color: var(--color-primary); margin-bottom: 2px; }
.share-event-list { list-style: none; padding: 0; margin: 0 0 20px; text-align: left; }
.share-event-list li {
  padding: 10px 12px; background: var(--color-card); border-radius: var(--radius-md);
  margin-bottom: 8px; font-size: 13px; box-shadow: var(--shadow);
}
.share-event-list a { color: inherit; text-decoration: none; display: block; }
.share-poster-panel {
  margin-top: 24px; padding: 16px; background: var(--color-card);
  border-radius: var(--radius-lg); box-shadow: var(--shadow); text-align: left;
}
.share-poster-panel h2 { margin: 0 0 6px; font-size: 16px; }
.share-poster-hint { margin: 0 0 12px; font-size: 12px; color: var(--color-text-secondary); }
.poster-wrap { margin: 12px 0; overflow: hidden; border-radius: var(--radius-md); }
.poster-wrap canvas { width: 100%; height: auto; display: block; }
