.activity-hall-toggle {
  position: fixed;
  right: 22px;
  bottom: 144px;
  z-index: 83;
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255,255,255,.68);
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(145deg,#ff9e2c,#ff6b35 55%,#ff466e);
  box-shadow: 0 9px 23px rgba(229,91,43,.3), inset 0 1px rgba(255,255,255,.3);
  cursor: pointer;
  animation: ngFloatingBreath 3.1s ease-in-out infinite;
}
.activity-hall-toggle[hidden] { display: none !important; }
.activity-hall-toggle:hover { filter: brightness(1.07); transform: translateY(-2px); }
.activity-hall-toggle:focus-visible { outline: 3px solid rgba(255,123,51,.28); outline-offset: 3px; }
.activity-hall-toggle > span { font-size: 22px; line-height: 1; }
.activity-hall-toggle > b {
  position: absolute;
  top: -5px;
  right: -5px;
  display: grid;
  min-width: 20px;
  height: 20px;
  place-items: center;
  padding: 0 5px;
  border: 2px solid #fff;
  border-radius: 999px;
  color: #fff;
  background: #ed4862;
  font-size: 10px;
}
body:not(.theme-has-service) .activity-hall-toggle { bottom: 84px; }
body.activity-hall-open { overflow: hidden; }
body.activity-hall-open .theme-mode-toggle,
body.activity-hall-open .page-shell .service-float-btn { opacity: 0; pointer-events: none; }

.activity-hall-backdrop {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(4, 21, 65, 0.66);
  backdrop-filter: blur(9px);
}
.activity-hall-backdrop[hidden] { display: none !important; }
.activity-hall-panel {
  width: min(720px,100%);
  max-height: min(820px,calc(100vh - 40px));
  overflow: auto;
  border: 1px solid rgba(99, 139, 237, 0.38);
  border-radius: 24px;
  color: #0f2761;
  background: #dbe5fe;
  box-shadow: 0 28px 90px rgba(2, 23, 74, 0.38);
}
.activity-hall-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px;
  color: #fff;
  background: linear-gradient(135deg,#134edf,#3770fb 58%,#3c71f3);
}
.activity-hall-title strong,.activity-hall-title span { display: block; }
.activity-hall-title strong { font-size: 20px; }
.activity-hall-title span { margin-top: 6px; color: #c1d2fe; font-size: 12px; }
.activity-hall-close { display: grid; width: 38px; height: 38px; place-items: center; border: 1px solid rgba(255,255,255,.25); border-radius: 12px; color: #fff; background: rgba(4, 32, 100, 0.25); font-size: 24px; cursor: pointer; }
.activity-hall-body { display: grid; gap: 16px; padding: 20px; }
.activity-notice-list,.activity-card-list { display: grid; gap: 12px; }
.activity-notice,.activity-card,.activity-apply-form { padding: 16px; border: 1px solid #c1d1f8; border-radius: 17px; background: #fff; }
.activity-notice { border-color: #b3c8fd; background: #d2dffe; }
.activity-notice.is-approved { border-color: #a4e6e0; background: #cff4f1; }
.activity-notice.is-rejected { border-color: #f2c8cf; background: #fff2f4; }
.activity-notice strong,.activity-notice span,.activity-card strong,.activity-card span { display: block; }
.activity-notice strong { font-size: 14px; }
.activity-notice span { margin-top: 6px; color: #687894; font-size: 12px; line-height: 1.65; }
.activity-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.activity-card h3 { margin: 0; font-size: 17px; }
.activity-card .activity-reward { margin-top: 7px; color: #f06b2f; font-size: 12px; font-weight: 850; }
.activity-card p { margin: 12px 0 0; color: #64738d; font-size: 12px; line-height: 1.7; white-space: pre-line; }
.activity-card .activity-rules { padding-top: 11px; border-top: 1px dashed #c0cff5; }
.activity-apply-button,.activity-submit-button {
  min-height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(135deg,#336dfb,#4778f3);
  font-weight: 850;
  cursor: pointer;
}
.activity-apply-button:disabled,.activity-submit-button:disabled { opacity: .52; cursor: not-allowed; }
.activity-apply-form { display: grid; gap: 13px; border-color: #b5cafd; box-shadow: 0 10px 30px rgba(51, 109, 251, 0.09); }
.activity-apply-form h3 { margin: 0; font-size: 16px; }
.activity-apply-form label { display: grid; gap: 7px; color: #52627d; font-size: 12px; font-weight: 800; }
.activity-apply-form input,.activity-apply-form textarea { width: 100%; border: 1px solid #bbcbf4; border-radius: 11px; outline: 0; color: #112966; background: #dde7fe; font: inherit; }
.activity-apply-form input { height: 44px; padding: 0 12px; }
.activity-apply-form textarea { min-height: 78px; padding: 11px 12px; resize: vertical; }
.activity-apply-form input:focus,.activity-apply-form textarea:focus { border-color: #6792fc; box-shadow: 0 0 0 3px rgba(51, 109, 251, 0.1); }
.activity-form-note { color: #8692a6; font-size: 11px; line-height: 1.6; }
.activity-empty { padding: 42px 20px; color: #7b889e; text-align: center; }
.activity-feedback { min-height: 18px; color: #d04658; font-size: 12px; }

html[data-theme="dark"] .activity-hall-panel { border-color: #183a8f; color: #ccdbfe; background: #0a1f54; }
html[data-theme="dark"] .activity-notice,html[data-theme="dark"] .activity-card,html[data-theme="dark"] .activity-apply-form { border-color: #183989; background: #0d2562; }
html[data-theme="dark"] .activity-notice { background: #0d2a73; }
html[data-theme="dark"] .activity-notice.is-approved { background: #144b47; }
html[data-theme="dark"] .activity-notice.is-rejected { background: #3a1e29; }
html[data-theme="dark"] .activity-notice span,html[data-theme="dark"] .activity-card p,html[data-theme="dark"] .activity-apply-form label { color: #7d9ae2; }
html[data-theme="dark"] .activity-apply-form input,html[data-theme="dark"] .activity-apply-form textarea { border-color: #193b90; color: #ccdbfe; background: #091e52; }

@media (max-width: 560px) {
  .activity-hall-toggle { right: 14px; bottom: calc(130px + env(safe-area-inset-bottom,0px)); width: 46px; height: 46px; }
  body:not(.theme-has-service) .activity-hall-toggle { bottom: calc(72px + env(safe-area-inset-bottom,0px)); }
  .activity-hall-backdrop { align-items: end; padding: 0; }
  .activity-hall-panel { width: 100%; max-height: 92vh; border-radius: 22px 22px 0 0; }
  .activity-hall-head { padding: 18px; }
  .activity-hall-body { padding: 14px; }
  .activity-card-head { align-items: stretch; flex-direction: column; }
  .activity-apply-button { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .activity-hall-toggle { animation: none; } }

/* 2.1.9.45 增量合并：活动详情改为独立弹窗，不再把活动列表撑长。 */
.activity-application-backdrop {
  position: fixed;
  inset: 0;
  z-index: 170;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(3,11,25,.54);
  -webkit-backdrop-filter: blur(8px) saturate(.9);
  backdrop-filter: blur(8px) saturate(.9);
}
.activity-application-backdrop[hidden] { display: none !important; }
.activity-application-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(560px, 100%);
  max-height: min(760px, calc(100vh - 40px));
  max-height: min(760px, calc(100dvh - 40px));
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--ng-accent, #6c4cff) 42%, #dce6f5);
  border-radius: 22px;
  color: var(--ng-text, #152239);
  background: color-mix(in srgb, var(--ng-panel-solid, #f8fbff) 97%, transparent);
  box-shadow: 0 30px 90px rgba(2,13,34,.46), 0 0 0 1px rgba(255,255,255,.3) inset;
  animation: activityApplicationEnter .2s cubic-bezier(.22,.8,.28,1) both;
}
.activity-application-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 17px 18px 17px 20px;
  border-bottom: 1px solid color-mix(in srgb, var(--ng-accent, #6c4cff) 18%, var(--ng-border, #dce6f5));
  background: linear-gradient(135deg, color-mix(in srgb, var(--ng-accent, #6c4cff) 12%, #fff), color-mix(in srgb, var(--ng-accent-2, #ff784c) 8%, #fff));
}
.activity-application-title { min-width: 0; }
.activity-application-title strong,
.activity-application-title span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-application-title strong { font-size: 18px; line-height: 1.25; }
.activity-application-title span { margin-top: 5px; color: var(--ng-muted, #687894); font-size: 12px; line-height: 1.4; }
.activity-application-close {
  display: grid;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  place-items: center;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--ng-accent, #6c4cff) 20%, var(--ng-border, #dce6f5));
  border-radius: 13px;
  color: var(--ng-text, #152239);
  background: color-mix(in srgb, var(--ng-panel-solid, #fff) 80%, transparent);
  cursor: pointer;
}
.activity-application-close:hover { border-color: color-mix(in srgb, var(--ng-accent, #6c4cff) 50%, var(--ng-border, #dce6f5)); background: color-mix(in srgb, var(--ng-accent, #6c4cff) 10%, var(--ng-panel-solid, #fff)); }
.activity-application-close:focus-visible { outline: 3px solid color-mix(in srgb, var(--ng-accent, #6c4cff) 24%, transparent); outline-offset: 2px; }
.activity-application-close svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.activity-application-body { min-height: 0; overflow: auto; padding: 20px; overscroll-behavior: contain; }
.activity-application-body .activity-apply-form { padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.activity-application-body .activity-submit-button { width: 100%; margin-top: 2px; }
html[data-theme="dark"] .activity-application-panel { border-color: #34557a; color: #e7efff; background: #0c1a2d; box-shadow: 0 30px 90px rgba(0,0,0,.62), 0 0 0 1px rgba(255,255,255,.04) inset; }
html[data-theme="dark"] .activity-application-head { border-bottom-color: #294666; background: linear-gradient(135deg, color-mix(in srgb, var(--ng-accent, #6c4cff) 18%, #10213a), color-mix(in srgb, var(--ng-accent-2, #ff784c) 10%, #10213a)); }
html[data-theme="dark"] .activity-application-close { border-color: #34557a; color: #e7efff; background: #132943; }
@keyframes activityApplicationEnter { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
@media (max-width: 560px) {
  .activity-application-backdrop { align-items: end; padding: 10px 0 0; background: rgba(3,11,25,.5); -webkit-backdrop-filter: blur(7px); backdrop-filter: blur(7px); }
  .activity-application-panel { width: 100%; max-height: 88vh; max-height: 88dvh; border-radius: 22px 22px 0 0; }
  .activity-application-head { padding: 15px 14px 15px 17px; }
  .activity-application-title strong { font-size: 17px; }
  .activity-application-body { padding: 17px 16px calc(17px + env(safe-area-inset-bottom, 0px)); }
  .activity-application-body .activity-apply-form { gap: 12px; }
  /* iOS Safari 聚焦输入框时会自动放大页面，16px 可避免这一行为 */
  .activity-application-body .activity-apply-form :is(input, select, textarea) {
    font-size: 16px !important;
    line-height: 1.5;
  }
  .activity-application-body .activity-apply-form textarea { min-height: 72px; }
}
@media (prefers-reduced-motion: reduce) { .activity-application-panel { animation: none; } }

/* 面板是唯一的纵向滚动区。这样可避免 iOS Safari 在背景页被锁定时裁掉列表。 */
body.activity-hall-open { overflow: hidden; overscroll-behavior: none; }
body.activity-hall-open :is(.ng-action-hub-toggle,.ng-scroll-top,.theme-mode-toggle,.activity-hall-toggle,.service-float-btn,.service-panel-backdrop,.service-panel) { display: none !important; }
.activity-hall-title,
.activity-card-head > div,
.activity-notice,
.activity-card { min-width: 0; }
.activity-hall-close,
.activity-application-close {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  flex: 0 0 44px;
}
.activity-hall-title strong,
.activity-hall-title span,
.activity-card h3,
.activity-card p,
.activity-notice strong,
.activity-notice span,
.activity-feedback { overflow-wrap: anywhere; }
html[data-ui-theme] body.activity-hall-open .activity-hall-backdrop,
html[data-ui-theme] body.activity-hall-open .activity-application-backdrop {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  box-sizing: border-box;
}
html[data-ui-theme] body.activity-hall-open .activity-hall-panel {
  display: flex !important;
  min-height: 0;
  flex-direction: column;
  overflow: hidden !important;
}
html[data-ui-theme] body.activity-hall-open .activity-hall-head { position: relative; top: auto; flex: 0 0 auto; }
html[data-ui-theme] body.activity-hall-open .activity-hall-body,
html[data-ui-theme] body.activity-hall-open .activity-application-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
}
@media (max-width: 560px) {
  html[data-ui-theme] body.activity-hall-open .activity-hall-panel {
    max-height: calc(100vh - 24px) !important;
    max-height: calc(100dvh - max(12px, env(safe-area-inset-top, 0px)) - max(12px, env(safe-area-inset-bottom, 0px))) !important;
  }
  html[data-ui-theme] body.activity-hall-open .activity-hall-body {
    padding-bottom: calc(22px + env(safe-area-inset-bottom, 0px));
    scroll-padding-bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  }
  .activity-hall-title { overflow: hidden; }
  .activity-hall-title strong,
  .activity-hall-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* 活动列表模板：紧凑双列 / 首条聚焦。由活动后台配置 data-activity-template 触发。 */
.activity-hall-backdrop[data-activity-template="compact"] .activity-card-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.activity-hall-backdrop[data-activity-template="compact"] .activity-card { padding: 18px; }
.activity-hall-backdrop[data-activity-template="compact"] .activity-card p {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.activity-hall-backdrop[data-activity-template="spotlight"] .activity-card:first-child {
  background: linear-gradient(145deg, color-mix(in srgb, var(--ng-panel-solid, #fff) 92%, var(--ng-accent, #2f6bff) 8%), color-mix(in srgb, var(--ng-panel-solid, #fff) 96%, transparent));
  border-color: color-mix(in srgb, var(--ng-accent, #2f6bff) 42%, var(--ng-border, #dce6f5));
  box-shadow: 0 22px 52px color-mix(in srgb, var(--ng-accent, #2f6bff) 18%, transparent);
}
.activity-hall-backdrop[data-activity-template="spotlight"] .activity-card:first-child .activity-apply-button {
  background: linear-gradient(135deg, var(--ng-accent, #2f6bff), var(--ng-accent-2, #6c4cff));
  color: #fff;
}
@media (max-width: 680px) {
  .activity-hall-backdrop[data-activity-template="compact"] .activity-card-list { grid-template-columns: 1fr; }
}
