/* =========================================================
   宿舍群二维码 · 校园青春风
   ========================================================= */
:root {
  --brand:      #5b6cff;
  --brand-deep: #3f4ee0;
  --brand-soft: #eef0ff;
  --accent:     #ffb01f;
  --accent-2:   #ff6b9d;
  --mint:       #2fd4a7;
  --ink:        #1c2033;
  --ink-2:      #5a6079;
  --ink-3:      #9aa0b8;
  --line:       #e8eaf4;
  --card:       #ffffff;
  --radius:     22px;
  --radius-sm:  14px;
  --shadow:     0 18px 44px -18px rgba(43, 52, 122, .28);
  --shadow-sm:  0 8px 22px -12px rgba(43, 52, 122, .26);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* [hidden] 兜底：防止 class 里的 display 覆盖浏览器默认的 display:none */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* 奶白到浅蓝的渐变底，比纯色更有"校园海报"感 */
body {
  min-height: 100vh;
  background:
    linear-gradient(180deg, #eef1ff 0%, #f7f8ff 38%, #fdfbff 70%, #f2fbf8 100%);
}

/* ---------- 背景装饰 ---------- */
.bg-deco { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.blob { position: absolute; border-radius: 50%; filter: blur(58px); opacity: .5; }
.blob-1 { width: 320px; height: 320px; top: -110px; left: -90px;
  background: radial-gradient(circle at 30% 30%, #8f9bff, #5b6cff); }
.blob-2 { width: 270px; height: 270px; top: 110px; right: -120px;
  background: radial-gradient(circle at 30% 30%, #ffd280, #ff9a3d); opacity: .42; }
.blob-3 { width: 300px; height: 300px; bottom: -140px; left: 12%;
  background: radial-gradient(circle at 30% 30%, #7bf0d3, #2fd4a7); opacity: .34; }
.blob-4 { width: 220px; height: 220px; top: 46%; left: -120px;
  background: radial-gradient(circle at 30% 30%, #ffb3cd, #ff6b9d); opacity: .26; }

/* 方格纸纹理：校园笔记本的既视感 */
.grid-paper {
  position: absolute; inset: 0; opacity: .55;
  background-image:
    linear-gradient(rgba(91,108,255,.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(91,108,255,.07) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: linear-gradient(180deg, #000 0%, rgba(0,0,0,.35) 46%, transparent 78%);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, rgba(0,0,0,.35) 46%, transparent 78%);
}

/* 漂浮小图标：给页面一点"活气" */
.floaty {
  position: absolute; font-size: 22px; opacity: .5;
  filter: saturate(.85);
  animation: float 7s ease-in-out infinite;
}
.f-1 { top: 13%; left: 9%;  animation-delay: 0s;   font-size: 24px; }
.f-2 { top: 24%; right: 11%; animation-delay: 1.4s; font-size: 20px; }
.f-3 { top: 62%; left: 7%;  animation-delay: 2.6s; font-size: 26px; opacity: .38; }
.f-4 { top: 76%; right: 9%; animation-delay: 3.4s; font-size: 19px; opacity: .42; }
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50%      { transform: translateY(-12px) rotate(5deg); }
}

/* ---------- Hero ---------- */
.hero { position: relative; z-index: 1; padding: 34px 22px 6px; text-align: center; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.82);
  border: 1px solid rgba(91,108,255,.2);
  color: var(--brand-deep);
  font-size: 12.5px; font-weight: 600;
  padding: 5px 13px; border-radius: 999px;
  backdrop-filter: blur(8px);
  box-shadow: 0 6px 16px -10px rgba(91,108,255,.6);
}
.hero-badge .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--mint);
  box-shadow: 0 0 0 3px rgba(47,212,167,.22);
  animation: breathe 2.4s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { box-shadow: 0 0 0 3px rgba(47,212,167,.22); }
  50%      { box-shadow: 0 0 0 6px rgba(47,212,167,.10); }
}
.hero-title {
  margin: 16px 0 8px; font-size: 30px; line-height: 1.28;
  font-weight: 800; letter-spacing: -.4px;
}
.hero-title .hl {
  position: relative; color: var(--brand);
  background: linear-gradient(180deg, transparent 62%, rgba(255,176,31,.5) 62%);
  padding: 0 2px;
  border-radius: 3px;
}
.hero-sub { margin: 0; color: var(--ink-2); font-size: 14.5px; }

/* Hero 下方三个卖点小标签 */
.hero-tags {
  display: flex; justify-content: center; flex-wrap: wrap;
  gap: 8px; margin-top: 15px;
}
.htag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; font-weight: 600; color: var(--ink-2);
  background: rgba(255,255,255,.86);
  border: 1px solid rgba(232,234,244,.95);
  padding: 5px 11px; border-radius: 999px;
  box-shadow: 0 4px 12px -8px rgba(43,52,122,.5);
}

/* 当前校区标识：让同学一眼确认"我没进错校区" */
.campus-chip {
  display: inline-flex; align-items: center; gap: 6px;
  margin: 14px 0 0;
  padding: 6px 14px; border-radius: 999px;
  font-size: 12.5px; font-weight: 700; color: #16614c;
  background: linear-gradient(135deg, rgba(47,212,167,.18), rgba(91,108,255,.13));
  border: 1px solid rgba(47,212,167,.34);
}
.campus-chip .ico {
  width: 14px; height: 14px; fill: none; stroke: #16614c;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- 容器 ---------- */
.wrap { position: relative; z-index: 1; padding: 18px 16px 40px; max-width: 560px; margin: 0 auto; }

/* ---------- 入口提示页 ---------- */
.gate { padding: 8px 0 0; }
.gate-card {
  position: relative;
  background: var(--card); border-radius: var(--radius);
  padding: 30px 22px 24px; text-align: center;
  box-shadow: var(--shadow); border: 1px solid rgba(255,255,255,.92);
  animation: pop .32s cubic-bezier(.2,.9,.3,1.2);
}
.gate-card::before {
  content: ''; position: absolute; top: 0; left: 22px; right: 22px; height: 4px;
  border-radius: 0 0 6px 6px;
  background: linear-gradient(90deg, var(--brand), var(--accent-2), var(--accent), var(--mint));
}
.gate-emoji { margin: 4px 0 12px; }
.gate-emoji svg { width: 62px; height: 62px; }
.gate-title { margin: 0 0 10px; font-size: 19px; font-weight: 800; letter-spacing: -.2px; }
.gate-desc { margin: 0; font-size: 13.5px; color: var(--ink-2); line-height: 1.75; }

.gate-list {
  list-style: none; margin: 20px 0 0; padding: 0;
  text-align: left; display: flex; flex-direction: column; gap: 10px;
}
.gate-list li {
  display: flex; align-items: flex-start; gap: 9px;
  font-size: 13px; color: var(--ink-2); line-height: 1.6;
  background: #fafbff; border: 1px solid #f0f2fb;
  border-radius: 12px; padding: 10px 13px;
}
.gate-list .gi {
  flex: none; width: 18px; height: 18px; margin-top: 1px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 10.5px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--brand), #8b7bff);
}
.gate-btn { margin-top: 22px; }
.gate-foot {
  margin: 20px 0 0; text-align: center;
  font-size: 11.5px; color: #b9bed2; letter-spacing: .3px;
}

/* ---------- 管理员入口按钮（首页弹层已移除，仅保留按钮对齐）---------- */
.btn-primary {
  background: linear-gradient(135deg, var(--brand), #7b6bff);
  border-color: transparent; color: #fff;
  box-shadow: 0 10px 22px -10px rgba(91,108,255,.9);
}
.btn-primary:active { transform: translateY(1px); }
.btn-primary[disabled] { opacity: .6; }

/* ---------- 三步走 ---------- */
.steps {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; margin: 0 0 16px; padding: 0; list-style: none;
}
.step { display: flex; align-items: center; gap: 6px; }
.step-no {
  width: 20px; height: 20px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--brand), #8b7bff);
  box-shadow: 0 5px 12px -6px rgba(91,108,255,.9);
  flex: none;
}
.step-txt { font-size: 12px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.step-line {
  width: 18px; height: 2px; border-radius: 2px; flex: none;
  background: repeating-linear-gradient(90deg, rgba(91,108,255,.34) 0 4px, transparent 4px 7px);
}

/* ---------- 选择卡片 ---------- */
.selector-card {
  position: relative;
  background: var(--card); border-radius: var(--radius);
  padding: 20px 18px 16px; box-shadow: var(--shadow);
  border: 1px solid rgba(255,255,255,.92);
}
/* 卡片顶部一条彩色小旗，呼应校园风格 */
.selector-card::before {
  content: ''; position: absolute; top: 0; left: 22px; right: 22px; height: 4px;
  border-radius: 0 0 6px 6px;
  background: linear-gradient(90deg, var(--brand), var(--accent-2), var(--accent), var(--mint));
}
.field-label {
  display: flex; align-items: center; gap: 7px;
  font-size: 14px; font-weight: 700; color: var(--ink); margin-bottom: 11px;
  padding-top: 6px;
}
.field-label .ico { width: 17px; height: 17px; fill: none; stroke: var(--brand); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.select-shell { position: relative; }
.select {
  width: 100%; appearance: none; -webkit-appearance: none;
  background: linear-gradient(180deg, #fbfbff, #f4f6ff);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 15px 44px 15px 16px;
  font-size: 16px; font-weight: 600; color: var(--ink);
  font-family: inherit;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.select:focus { outline: none; border-color: var(--brand); background: #fff;
  box-shadow: 0 0 0 4px rgba(91,108,255,.14); }
.select-arrow {
  position: absolute; right: 15px; top: 50%; transform: translateY(-50%);
  pointer-events: none; display: flex;
}
.select-arrow svg { width: 18px; height: 18px; fill: none; stroke: var(--brand); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

.field-hint { margin: 11px 2px 0; font-size: 12.5px; color: var(--ink-3); }

/* ---------- 结果区 ---------- */
.result { margin-top: 18px; }

.state {
  background: var(--card); border-radius: var(--radius);
  padding: 40px 22px; text-align: center; box-shadow: var(--shadow-sm);
  border: 1px solid rgba(255,255,255,.9);
}
.state-emoji { font-size: 40px; line-height: 1; margin-bottom: 12px; }
.state-title { margin: 0 0 5px; font-weight: 700; font-size: 16px; }
.state-desc { margin: 0; color: var(--ink-3); font-size: 13.5px; }

.spinner {
  width: 34px; height: 34px; margin: 0 auto 14px;
  border: 3px solid var(--brand-soft);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.state-loading p { margin: 0; color: var(--ink-2); font-size: 14px; }

.btn-retry {
  margin-top: 16px; padding: 10px 26px; border: 0; border-radius: 999px;
  background: var(--brand); color: #fff; font-size: 14.5px; font-weight: 600;
  font-family: inherit; cursor: pointer; box-shadow: 0 8px 18px -8px rgba(91,108,255,.7);
}
.btn-retry:active { transform: translateY(1px); }

/* ---------- 二维码卡片 ---------- */
.qr-card {
  position: relative;
  background: var(--card); border-radius: var(--radius);
  padding: 22px 18px 18px; box-shadow: var(--shadow);
  border: 1px solid rgba(255,255,255,.92);
  animation: pop .32s cubic-bezier(.2,.9,.3,1.2);
  overflow: hidden;
}
/* 卡片四周淡淡的彩色描边，增加层次 */
.qr-card::after {
  content: ''; position: absolute; inset: 0; border-radius: var(--radius);
  padding: 1.5px; pointer-events: none;
  background: linear-gradient(135deg, rgba(91,108,255,.5), rgba(47,212,167,.34), rgba(255,176,31,.4), rgba(255,107,157,.4));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
}
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.97);} to { opacity:1; transform:none; } }

.qr-head { text-align: center; margin-bottom: 16px; }
.qr-title-wrap { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
.qr-building { margin: 0; font-size: 21px; font-weight: 800; letter-spacing: -.3px; }
.pill {
  font-size: 11.5px; font-weight: 700; color: var(--brand-deep);
  background: var(--brand-soft); padding: 3px 10px; border-radius: 999px;
}
.qr-group { margin: 7px 0 0; font-size: 13.5px; color: var(--ink-2); }

.qr-frame {
  position: relative; width: min(74vw, 268px); aspect-ratio: 1/1;
  margin: 6px auto 0; padding: 12px; background: #fff;
  border-radius: 20px; box-shadow: 0 12px 30px -14px rgba(43,52,122,.35),
              inset 0 0 0 1px var(--line);
}
.qr-img { width: 100%; height: 100%; display: block; border-radius: 12px; object-fit: contain; background: #fff; }
.qr-frame-corner {
  position: absolute; width: 24px; height: 24px; border: 3px solid var(--brand);
  border-radius: 4px;
}
.qr-frame-corner.tl { top: -3px; left: -3px; border-right: 0; border-bottom: 0; border-top-left-radius: 10px; }
.qr-frame-corner.tr { top: -3px; right: -3px; border-left: 0; border-bottom: 0; border-top-right-radius: 10px; }
.qr-frame-corner.bl { bottom: -3px; left: -3px; border-right: 0; border-top: 0; border-bottom-left-radius: 10px; }
.qr-frame-corner.br { bottom: -3px; right: -3px; border-left: 0; border-top: 0; border-bottom-right-radius: 10px; }

.qr-tip {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  margin: 16px 0 0; font-size: 13.5px; font-weight: 600; color: var(--brand-deep);
  background: linear-gradient(90deg, rgba(91,108,255,.09), rgba(47,212,167,.09));
  padding: 10px 14px; border-radius: 12px;
}
.qr-tip .ico { width: 16px; height: 16px; fill: none; stroke: var(--brand-deep); stroke-width: 2; stroke-linecap: round; }
.qr-tips-extra {
  margin: 10px 0 0; text-align: center; font-size: 12.5px; color: var(--ink-3);
  background: #fafbff; border-radius: 10px; padding: 8px 12px;
}
.qr-actions { display: flex; justify-content: center; margin-top: 14px; }
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 11px 22px; border-radius: 999px; border: 1.5px solid var(--line);
  background: #fff; color: var(--ink-2); font-size: 14px; font-weight: 600;
  font-family: inherit; cursor: pointer;
}
.btn:active { transform: translateY(1px); }
.btn .ico { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }

.qr-updated { margin: 12px 0 0; text-align: center; font-size: 11.5px; color: var(--ink-3); }

/* ---------- 页脚 ---------- */
.foot { margin-top: 26px; text-align: center; }
.foot p { margin: 0; font-size: 12px; color: var(--ink-3); }
.foot-sign { margin-top: 8px !important; font-size: 11.5px !important; color: #b9bed2 !important; letter-spacing: .3px; }

/* ---------- 小屏微调 ---------- */
@media (max-width: 370px) {
  .hero-title { font-size: 25px; }
  .qr-frame { width: 70vw; }
  .step-txt { font-size: 11px; }
  .step-line { width: 10px; }
  .htag { font-size: 11px; padding: 4px 9px; }
}
@media (min-width: 640px) {
  .hero { padding-top: 48px; }
  .hero-title { font-size: 34px; }
}

/* 尊重系统"减少动态效果"设置 */
@media (prefers-reduced-motion: reduce) {
  .floaty, .hero-badge .dot { animation: none; }
  .qr-card, .gate-card { animation: none; }
}

