/* 活动入口组件 + 演示承载页 */

.screen-content--activity {
  position: absolute;
  padding-top: 54px;
  padding-bottom: 88px !important;
}

.app-shell--activity {
  position: relative;
  min-height: 100%;
  padding: 12px 14px 24px;
  background: #f2f0ec;
  box-sizing: border-box;
}

.aw-page-header {
  margin-bottom: 14px;
}

.aw-page-title {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text-primary);
}

.aw-page-desc {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--color-text-muted);
}

.aw-placeholder-block {
  padding: 14px;
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.aw-placeholder-line {
  height: 12px;
  border-radius: 6px;
  background: #ebe8e2;
  margin-bottom: 10px;
}

.aw-placeholder-line--short {
  width: 62%;
}

.aw-placeholder-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.aw-placeholder-cards span {
  display: block;
  height: 72px;
  border-radius: 12px;
  background: #f3f0ea;
}

/* —— 活动入口：悬浮主入口 + 上方气泡网格 —— */
.activebox {
  position: absolute;
  right: 10px;
  bottom: calc(82px + 10px);
  z-index: 25;
  width: auto;
  overflow: visible;
  pointer-events: none;
}

/* 大厅：与 .cg-user-panel 右边缘对齐（app-shell 水平 padding 14px） */
.app-shell > .activebox,
.app-shell--activity > .activebox {
  right: 14px;
  bottom: 8px;
  z-index: 6;
}

.activebox .activebox_wrap,
.activebox .activity-main-btn,
.activebox .activity-item,
.activebox .aw-status button {
  pointer-events: auto;
}

.activebox_wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0;
}

/* 气泡面板：锚定主入口上方，右边缘对齐入口并向左展开，不越出右侧 */
.activity-box {
  position: absolute;
  right: 0;
  left: auto;
  bottom: calc(100% + 12px);
  width: 268px;
  max-width: none;
  z-index: 2;
  padding-bottom: 8px;
  transform-origin: bottom right;
  transition: opacity 180ms ease, transform 180ms ease;
  box-sizing: border-box;
}

.activebox:not(.activety_open) .activity-box,
.activity-box[hidden] {
  display: none !important;
}

.activebox.activety_open .activity-box {
  display: block;
  opacity: 1;
  transform: translateY(0);
  animation: aw-bubble-in 180ms ease;
}

@media (prefers-reduced-motion: reduce) {
  .activity-box {
    transition: none;
  }

  .activebox.activety_open .activity-box {
    animation: none;
  }
}

@keyframes aw-bubble-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.activity-bubble {
  position: relative;
  padding: 12px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.14), 0 2px 8px rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(235, 232, 226, 0.9);
  box-sizing: border-box;
}

.activity-bubble-arrow {
  position: absolute;
  right: 26px;
  bottom: 6px;
  width: 12px;
  height: 12px;
  background: #fff;
  border-right: 1px solid rgba(235, 232, 226, 0.9);
  border-bottom: 1px solid rgba(235, 232, 226, 0.9);
  transform: translateY(50%) rotate(45deg);
  box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.05);
  pointer-events: none;
  z-index: 1;
}

.activity-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(44px, 1fr));
  gap: 8px;
}

.activity-grid[hidden] {
  display: none;
}

.activity-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  padding: 4px 2px;
  border: none;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  font-family: var(--font-family-base);
  color: var(--color-text-secondary);
  box-sizing: border-box;
}

.activity-item:focus-visible {
  outline: 2px solid #f97316;
  outline-offset: 1px;
}

.activity-item:active {
  opacity: 0.85;
}

.activity-item-media {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #f7f5f2;
  overflow: hidden;
}

.activity-item-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.activity-item-name {
  max-width: 56px;
  font-size: 10px;
  line-height: 1.2;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-item .aw-item-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 100%;
  height: 100%;
  padding: 4px;
  box-sizing: border-box;
  font-size: 9px;
  font-weight: 700;
  color: #8a847a;
  text-align: center;
  line-height: 1.15;
}

.activity-item .aw-item-fallback i {
  font-size: 14px;
}

/* 主入口：图 +「精彩活动」始终可见 */
.activity-main-btn {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 64px;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: var(--font-family-base);
}

.activity-main-btn:focus-visible {
  outline: 2px solid #f97316;
  outline-offset: 3px;
  border-radius: 12px;
}

.activity-main {
  display: block;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: contain;
  box-shadow: 0 6px 18px rgba(249, 115, 22, 0.35);
}

.activity-main-label {
  display: block;
  max-width: 72px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-text-primary);
  text-align: center;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.85);
}

.aw-status {
  min-height: 72px;
  padding: 10px 8px;
  border-radius: 12px;
  background: #faf9f7;
  text-align: center;
  box-sizing: border-box;
}

.aw-status[hidden] {
  display: none;
}

.aw-status-text {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: #666;
}

.aw-status-retry {
  margin-top: 8px;
  padding: 8px 12px;
  min-height: 44px;
  border: none;
  border-radius: 10px;
  background: #fff1e6;
  color: #c2410c;
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-family-base);
  cursor: pointer;
}

.aw-status-loading {
  width: 100%;
  height: 72px;
  border-radius: 12px;
  background: linear-gradient(90deg, #efebe4 25%, #f7f5f2 50%, #efebe4 75%);
  background-size: 200% 100%;
  animation: aw-shimmer 1.2s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  .aw-status-loading {
    animation: none;
  }
}

@keyframes aw-shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

.aw-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;
}

/* —— 详情面板 —— */
.aw-detail-overlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.35);
  padding-top: 54px;
  padding-bottom: 34px;
  box-sizing: border-box;
}

.aw-detail-overlay[hidden] {
  display: none;
}

.aw-detail-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin: 0 0 54px;
  background: #f2f0ec;
  border-radius: 18px 18px 0 0;
  overflow: hidden;
  animation: aw-detail-in 200ms ease;
}

@media (prefers-reduced-motion: reduce) {
  .aw-detail-panel {
    animation: none;
  }
}

@keyframes aw-detail-in {
  from {
    transform: translateY(16px);
    opacity: 0.6;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.aw-detail-header {
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  height: 48px;
  background: #fff;
  border-bottom: 1px solid #ebe8e2;
}

.aw-detail-back {
  border: none;
  background: none;
  width: 48px;
  height: 48px;
  color: #333;
  cursor: pointer;
  font-size: 15px;
}

.aw-detail-title {
  margin: 0;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
}

.aw-detail-body {
  padding: 16px;
  overflow-y: auto;
}

.aw-detail-media {
  display: flex;
  justify-content: center;
  padding: 12px;
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.aw-detail-media img {
  width: min(280px, 100%);
  height: auto;
  max-height: 280px;
  object-fit: contain;
  border-radius: 12px;
  background: #f7f5f2;
}

.aw-detail-meta {
  margin: 14px 0 8px;
  font-size: 13px;
  color: var(--color-text-secondary);
}

.aw-detail-copy {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--color-text-muted);
}

/* —— 演示工具 —— */
.aw-demo-tools {
  margin-top: 18px;
  padding: 14px;
  border-radius: 16px;
  background: #fff;
  border: 1px dashed #d6d0c6;
  box-shadow: none;
}

.aw-demo-title {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text-primary);
}

.aw-demo-hint {
  margin: 0 0 10px;
  font-size: 11px;
  color: #999;
  line-height: 1.4;
}

.aw-demo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.aw-demo-btn {
  padding: 8px 4px;
  border: 1px solid #ebe8e2;
  border-radius: 10px;
  background: #faf9f7;
  font-size: 11px;
  font-family: var(--font-family-base);
  color: #555;
  cursor: pointer;
}

.aw-demo-btn.is-active {
  border-color: #f97316;
  background: #fff8f2;
  color: #c2410c;
  font-weight: 700;
}

@media (max-width: 360px) {
  .activebox {
    right: 6px;
  }

  .app-shell > .activebox,
  .app-shell--activity > .activebox {
    right: 14px;
    bottom: 6px;
  }

  .activity-box {
    width: 220px;
  }

  .activity-grid {
    grid-template-columns: repeat(3, minmax(44px, 1fr));
  }

  .activity-item-media {
    width: 44px;
    height: 44px;
  }
}

@media (min-width: 361px) and (max-width: 389px) {
  .activity-box {
    width: 240px;
  }
}
