* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: #f3f4f6;
  color: #1f2937;
}
.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: #fff;
  padding-bottom: 78px;
}
.topbar {
  background: #324c6d;
  color: #fff;
  font-weight: 700;
  text-align: center;
  padding: 14px 12px;
}
.tab { display: none; padding: 12px; }
.tab.active { display: block; }
.notice {
  background: #f8fafc;
  border-radius: 10px;
  padding: 10px;
  line-height: 1.6;
  margin-bottom: 10px;
}
.ad-card {
  background: #eef2ff;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 10px;
}
.ad-tag {
  font-size: 12px;
  color: #6b7280;
  padding: 6px 8px;
}
.ad-body {
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #374151;
}
.input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.input-row input {
  flex: 1;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 10px;
}
.input-row button {
  min-width: 70px;
  border: none;
  border-radius: 8px;
  background: #324c6d;
  color: #fff;
}
.action-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}
.action {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  padding: 10px 6px;
  font-size: 16px;
}
.loading { color: #2563eb; margin-bottom: 8px; }
.error {
  background: #fee2e2;
  color: #b91c1c;
  padding: 8px;
  border-radius: 8px;
  margin-bottom: 8px;
}
.hidden { display: none !important; }
.result {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px;
}
.preview-video {
  width: 100%;
  border-radius: 8px;
  background: #000;
}
.result-title {
  font-weight: 700;
  margin-bottom: 8px;
}
.copy-block { margin-top: 10px; }
.copy-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.tiny-btn {
  border: 1px solid #cbd5e1;
  background: #fff;
  border-radius: 6px;
  padding: 4px 8px;
}
.copy-block textarea {
  width: 100%;
  min-height: 90px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 8px;
  resize: vertical;
}
.meta {
  margin-top: 8px;
  color: #6b7280;
  font-size: 13px;
}
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.gallery-item {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
}
.gallery-item img {
  width: 100%;
  display: block;
  aspect-ratio: 1/1;
  object-fit: cover;
}
.gallery-item a {
  display: block;
  text-align: center;
  padding: 8px;
  color: #2563eb;
  text-decoration: none;
}
.points-header {
  background: #324c6d;
  color: #fff;
  border-radius: 12px;
  padding: 14px;
}
.points-num { font-size: 28px; font-weight: 700; }
.points-tip { margin-top: 8px; opacity: .9; }
.sign-card {
  margin-top: 10px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px;
}
.sign-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin: 10px 0;
}
.day {
  text-align: center;
  background: #f3f4f6;
  border-radius: 8px;
  padding: 8px 2px;
  font-size: 12px;
}
.day.done { background: #bbf7d0; color: #166534; font-weight: 700; }
.sign-btn {
  width: 100%;
  border: none;
  border-radius: 999px;
  background: #22c55e;
  color: #fff;
  padding: 10px;
  font-size: 18px;
}

.sign-ad-slot {
  margin-bottom: 10px;
  color: #0f2742;
  font-size: 16px;
}

.points-actions {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.points-btn {
  width: 100%;
  border: none;
  border-radius: 999px;
  background: #22c55e;
  color: #fff;
  padding: 10px;
  font-size: 18px;
}

.points-btn:disabled {
  opacity: 0.7;
}

.invite-code-text {
  font-size: 13px;
  color: #6b7280;
  word-break: break-all;
  padding: 0 4px;
}

.rules {
  margin-top: 10px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px;
}
.rules ol { padding-left: 20px; line-height: 1.8; }
.history-title {
  text-align: center;
  color: #ef4444;
  margin: 8px 0 12px;
}
.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.history-item {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}
.clear-btn {
  width: 100%;
  margin-top: 10px;
  border: none;
  background: #ef4444;
  color: #fff;
  border-radius: 8px;
  padding: 10px;
}
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0 auto;
  max-width: 480px;
  background: #fff;
  border-top: 1px solid #e5e7eb;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}
.nav-item {
  border: none;
  background: transparent;
  padding: 12px 0;
  font-size: 16px;
  color: #6b7280;
}
.nav-item.active { color: #ef4444; font-weight: 700; }
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-content {
  width: 100%;
  max-width: 340px;
  background: #fff;
  border-radius: 12px;
  padding: 14px;
}
.ad-fake {
  margin: 10px 0;
  height: 120px;
  border-radius: 10px;
  background: #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
}
#adCloseBtn {
  width: 100%;
  border: none;
  border-radius: 8px;
  padding: 10px;
  background: #324c6d;
  color: #fff;
}

.admin-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
}

.admin-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.admin-actions {
  margin-bottom: 10px;
}

.admin-btn {
  width: 100%;
  border: none;
  border-radius: 8px;
  background: #324c6d;
  color: #fff;
  padding: 10px;
}

.admin-form-block {
  margin: 12px 0;
  padding: 10px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f9fafb;
}

.admin-form-block h4 {
  margin: 0 0 10px;
}

.admin-switch-row {
  margin: 8px 0 10px;
  color: #374151;
}

.admin-select {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.admin-sub-block {
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 8px;
  background: #fff;
}
