/* ══════════════════════════════════════════
   碰一碰系统 — 主样式表
   移动优先，CSS 变量管理主题色
   ══════════════════════════════════════════ */

:root {
  --color-primary: #2563eb;
  --color-primary-dark: #1d4ed8;
  --color-bg-start: #1e3a5f;
  --color-bg-end: #1d4ed8;
  --color-surface: rgba(255, 255, 255, 0.1);
  --color-surface-hover: rgba(255, 255, 255, 0.18);
  --color-border: rgba(255, 255, 255, 0.15);
  --color-text: #fff;
  --color-text-secondary: rgba(255, 255, 255, 0.55);
  --color-text-muted: rgba(255, 255, 255, 0.25);
  --color-reward-bg: rgba(255, 255, 255, 0.08);
  --color-reward-border: rgba(255, 255, 255, 0.25);
  --color-warning: #f59e0b;
  --radius-card: 16px;
  --radius-modal: 20px;
  --radius-btn: 30px;
  --shadow-btn: 0 4px 15px;
  --font-stack: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Arial, sans-serif;
}

/* ═══════════════ Reset & Base ═══════════════ */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-stack);
  background: linear-gradient(135deg, var(--color-bg-start) 0%, var(--color-primary) 50%, var(--color-primary-dark) 100%);
  min-height: 100vh;
  color: var(--color-text);
  padding-bottom: 40px;
  -webkit-font-smoothing: antialiased;
}

/* ═══════════════ Loading Screen ═══════════════ */
#loading-screen {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, var(--color-bg-start) 0%, var(--color-primary) 50%, var(--color-primary-dark) 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  transition: opacity 0.5s ease;
}

#loading-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ═══════════════ Header ═══════════════ */
.header {
  padding: 50px 20px 24px;
  text-align: center;
}

.header-logo {
  width: 72px;
  height: 72px;
  background: var(--color-surface);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  margin: 0 auto 12px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.header h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 1px;
}

.header p {
  font-size: 13px;
  opacity: 0.7;
  margin-top: 6px;
  line-height: 1.5;
}

/* ═══════════════ Banner ═══════════════ */
.banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--color-surface);
  margin: 0 16px 20px;
  padding: 12px;
  border-radius: 12px;
  font-size: 14px;
  border: 1px solid var(--color-border);
}

.banner .tag {
  background: var(--color-warning);
  color: #000;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  flex-shrink: 0;
}

/* ═══════════════ Main Container ═══════════════ */
.container {
  padding: 0 16px;
  max-width: 420px;
  margin: 0 auto;
}

/* ═══════════════ Action Card ═══════════════ */
.action-card {
  background: var(--color-surface);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: 16px 18px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
  position: relative;
  user-select: none;
}

.action-card:active {
  transform: scale(0.97);
  background: var(--color-surface-hover);
}

/* 两步流程的"已就绪"状态 */
.action-card--ready {
  background: rgba(16, 185, 129, 0.18) !important;
  border-color: rgba(16, 185, 129, 0.5) !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
  animation: pulseReady 1.5s ease-in-out infinite;
}
@keyframes pulseReady {
  0%, 100% { box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2); }
  50% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0.3); }
}

.action-card .arrow {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  opacity: 0.35;
}

.action-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.action-info {
  flex: 1;
  min-width: 0;
}

.action-info h3 {
  font-size: 16px;
  font-weight: 600;
}

.action-info p {
  font-size: 12px;
  opacity: 0.55;
  margin-top: 2px;
}

/* ═══════════════ Card Extras ═══════════════ */
.save-hint {
  margin-top: 6px;
  font-size: 11px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.save-hint span {
  background: rgba(255, 255, 255, 0.15);
  padding: 4px 10px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}

.save-hint span:active {
  background: rgba(255, 255, 255, 0.25);
}

/* WiFi specific */
.wifi-detail {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 6px;
}

.wifi-detail div {
  font-size: 14px;
  margin-bottom: 4px;
}

.wifi-detail div:last-child {
  margin-bottom: 0;
}

.wifi-detail span {
  opacity: 0.6;
}

.wifi-detail strong {
  font-family: "SF Mono", "Courier New", monospace;
  letter-spacing: 1px;
}

/* ═══════════════ Reward Notice ═══════════════ */
.reward {
  margin-top: 24px;
  padding: 14px 18px;
  background: var(--color-reward-bg);
  border: 1px dashed var(--color-reward-border);
  border-radius: 12px;
  text-align: center;
  font-size: 14px;
  line-height: 1.6;
}

/* ═══════════════ Footer ═══════════════ */
.footer {
  text-align: center;
  padding: 24px 20px 16px;
  font-size: 11px;
  opacity: 0.25;
}

/* ═══════════════ Error State ═══════════════ */
.error-state {
  text-align: center;
  padding: 40px;
  opacity: 0.6;
}

.error-state .retry-btn {
  margin-top: 16px;
  background: var(--color-surface);
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
}

/* ═══════════════ Modal ═══════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: #fff;
  color: #333;
  border-radius: var(--radius-modal);
  padding: 28px 22px 22px;
  max-width: 340px;
  width: 100%;
  text-align: center;
  animation: modalIn 0.3s ease;
  max-height: 90vh;
  overflow-y: auto;
}

@keyframes modalIn {
  from { transform: scale(0.9); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.modal-icon {
  font-size: 44px;
  margin-bottom: 12px;
}

.modal-box h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
  color: #222;
}

.modal-box .modal-body {
  font-size: 14px;
  color: #666;
  line-height: 1.7;
  white-space: pre-line;
  margin-bottom: 16px;
}

.modal-box .modal-steps {
  text-align: left;
  background: #f5f7fa;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 13px;
  color: #555;
  line-height: 1.8;
}

.modal-box .modal-steps .step-num {
  display: inline-block;
  width: 20px;
  height: 20px;
  background: var(--color-primary);
  color: #fff;
  border-radius: 50%;
  text-align: center;
  line-height: 20px;
  font-size: 11px;
  font-weight: 700;
  margin-right: 6px;
}

/* ═══════════════ Modal Buttons ═══════════════ */
.modal-box .btn-jump {
  display: block;
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-btn);
  font-size: 17px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  color: #fff;
  box-shadow: var(--shadow-btn) rgba(0, 0, 0, 0.2);
  transition: transform 0.1s ease;
  -webkit-appearance: none;
}

.modal-box .btn-jump:active {
  transform: scale(0.96);
}

.modal-box .btn-close {
  display: inline-block;
  margin-top: 12px;
  padding: 8px 24px;
  background: transparent;
  color: #999;
  border: none;
  font-size: 14px;
  cursor: pointer;
}

/* ═══════════════ Media Preview in Modal ═══════════════ */
.modal-media-preview {
  margin: 12px 0;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}

.modal-media-preview img {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  display: block;
  border-radius: 10px;
}

.modal-media-preview .save-overlay {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  pointer-events: none;
}

.modal-media-preview video {
  width: 100%;
  max-height: 200px;
  display: block;
  border-radius: 10px;
}

/* ═══════════════ Download Progress ═══════════════ */
.download-progress {
  margin: 12px 0;
  background: #e5e7eb;
  border-radius: 10px;
  height: 6px;
  overflow: hidden;
}

.download-progress .bar {
  height: 100%;
  background: var(--color-primary);
  border-radius: 10px;
  transition: width 0.3s ease;
  width: 0;
}

.download-status {
  font-size: 12px;
  color: #999;
  margin-bottom: 8px;
}

/* ═══════════════ QR Modal ═══════════════ */
.qr-preview {
  background: #fff;
  border-radius: 12px;
  padding: 12px;
  margin: 16px 0;
  display: inline-block;
}

.qr-preview img {
  width: 180px;
  height: 180px;
  display: block;
}

/* ═══════════════ Toast ═══════════════ */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-120px);
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  padding: 10px 20px;
  border-radius: 25px;
  font-size: 14px;
  z-index: 1100;
  transition: transform 0.3s ease;
  pointer-events: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* ═══════════════ Copy Hint Badge ═══════════════ */
.copy-badge {
  display: inline-block;
  background: #10b981;
  color: #fff;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 6px;
  animation: fadeInOut 1.5s ease forwards;
}

@keyframes fadeInOut {
  0%   { opacity: 0; transform: translateY(4px); }
  20%  { opacity: 1; transform: translateY(0); }
  80%  { opacity: 1; }
  100% { opacity: 0; }
}
