/* ============ 基础 ============ */
:root {
  --bg1: #f5f3f1;
  --bg2: #e7e5e4;
  --navy: #3c4266;
  --navy-2: #313757;
  --red: #cf3a45;
  --track: #e3dfdb;
  --cyan: #8ed9ea;
  --badge: #f4e2b2;
  --badge-ink: #6d5b39;
  --ink: #96969a;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", Arial, sans-serif;
  background: linear-gradient(180deg, var(--bg1) 0%, var(--bg2) 100%);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

/* 非 Safari 访客：显示拦截提示页 */
body.denied {
  background: linear-gradient(165deg, #f5f3f1 0%, #e7e5e4 100%);
}

/* ============ 布局 ============ */
.loader {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    max(16px, env(safe-area-inset-top))
    16px
    calc(28px + env(safe-area-inset-bottom));
  /* 默认隐藏，JS 门禁放行（body.ok）后才显示，消除刷新闪现 */
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

body.ok .loader {
  opacity: 1;
  visibility: visible;
}

.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(30px, 7.5vh, 60px);
}

/* ============ 圆环 + 表盘 ============ */
.ring-wrap {
  position: relative;
  width: min(74vw, 300px);
  aspect-ratio: 1 / 1;
}

.ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-track {
  fill: none;
  stroke: var(--track);
  stroke-width: 5;
}

.ring-bar {
  fill: none;
  stroke: var(--red);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 791.68;
  stroke-dashoffset: 791.68;
  transition: stroke-dashoffset 0.35s ease-out;
}

.dial {
  position: absolute;
  inset: 11%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #48507b 0%, var(--navy) 55%, var(--navy-2) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 20px 44px -20px rgba(38, 42, 78, 0.6);
  animation: breathe 3.2s ease-in-out infinite;
}

.pct {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  color: #fff;
  font-size: clamp(58px, 18vw, 78px);
  line-height: 1;
  letter-spacing: -0.02em;
}

.pct i {
  font-style: normal;
  font-size: 0.42em;
  vertical-align: 0.85em;
  margin-left: 3px;
}

.tag {
  margin-top: clamp(8px, 2.5vw, 12px);
  color: var(--cyan);
  font-size: clamp(12px, 3.4vw, 15px);
  font-weight: 600;
  letter-spacing: 0.32em;
  text-indent: 0.32em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* ============ 笑脸徽章（跟随进度弧末端） ============ */
.badge {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 19%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: var(--badge);
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 14px -6px rgba(0, 0, 0, 0.28);
  z-index: 1;
}

.badge svg {
  width: 72%;
  height: 72%;
  animation: pulse 2.6s ease-in-out infinite;
}

.sm-eye { fill: var(--badge-ink); }

.sm-mouth {
  fill: none;
  stroke: var(--badge-ink);
  stroke-width: 3.2;
  stroke-linecap: round;
}

/* ============ 底部文案 ============ */
.foot {
  color: var(--ink);
  font-size: clamp(11px, 3vw, 13px);
  font-weight: 500;
  letter-spacing: 0.28em;
  text-indent: 0.28em;
  text-transform: uppercase;
  white-space: nowrap;
  animation: blink 1.8s ease-in-out infinite;
}

/* ============ 动画 ============ */
@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(0.985); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

@keyframes blink {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* ============ 拦截提示页（非 Safari） ============ */
.gate {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    max(24px, env(safe-area-inset-top))
    20px
    calc(24px + env(safe-area-inset-bottom));
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  overflow-y: auto;
}

body.denied .gate {
  opacity: 1;
  visibility: visible;
}

.gate-card {
  width: 100%;
  max-width: 360px;
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(60, 66, 102, 0.18);
  border-radius: 24px;
  padding: clamp(24px, 6vw, 36px) clamp(20px, 5vw, 28px);
  box-shadow: 0 24px 60px -28px rgba(38, 42, 78, 0.45);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.gate-logo {
  width: clamp(64px, 18vw, 84px);
  height: clamp(64px, 18vw, 84px);
  margin-bottom: clamp(14px, 3.5vw, 20px);
  filter: drop-shadow(0 6px 12px rgba(60, 66, 102, 0.25));
}

.gate-title {
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: clamp(22px, 6vw, 28px);
  font-weight: 700;
  color: #3c4266;
  line-height: 1.3;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}

.gate-sub {
  font-size: clamp(13px, 3.4vw, 14px);
  color: #7d8298;
  letter-spacing: 0.04em;
  margin-bottom: clamp(18px, 4.5vw, 24px);
}

.gate-list {
  list-style: none;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: clamp(14px, 4vw, 18px) clamp(14px, 4vw, 20px);
  margin-bottom: clamp(16px, 4vw, 22px);
  background: linear-gradient(180deg, rgba(60, 66, 102, 0.05), rgba(60, 66, 102, 0.02));
  border-radius: 14px;
  border: 1px solid rgba(60, 66, 102, 0.1);
}

.gate-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: clamp(14px, 3.8vw, 15px);
  font-weight: 500;
  color: #4a5070;
  letter-spacing: 0.02em;
}

.gate-list .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #cf3a45;
  flex-shrink: 0;
}

.gate-foot {
  font-size: clamp(11px, 3vw, 12px);
  color: #9a9daa;
  letter-spacing: 0.06em;
  line-height: 1.6;
}
