/* 实验室功能平台 · 访客端
   设计取向：精密仪器 / 准入闸门。深墨底 + 暖白字 + 单一琥珀信号色。 */

@font-face {
  font-family: "Fraunces";
  src: url("/assets/fonts/fraunces-latin-300_900.woff2") format("woff2-variations");
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/assets/fonts/plex-mono-latin-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/assets/fonts/plex-mono-latin-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/assets/fonts/plex-mono-latin-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink-0: #08090a;
  --ink-1: #0d0e10;
  --ink-2: #14161a;
  --ink-3: #1b1e22;

  --paper: #f4f1ea;
  --paper-dim: #a8a59d;
  --paper-faint: #6d6b65;

  --line: rgba(244, 241, 234, 0.09);
  --line-strong: rgba(244, 241, 234, 0.18);

  --signal: #ff6a1a;
  --signal-soft: rgba(255, 106, 26, 0.14);
  --ok: #56dfc2;
  --bad: #ff5f56;
  --warn: #ffc24b;

  --font-display: "Fraunces", "Songti SC", "Noto Serif SC", "Source Han Serif SC", "SimSun", serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --font-ui: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --shell: min(1160px, calc(100vw - 48px));
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--ink-0);
  color: var(--paper);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.7;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  color: var(--paper);
  background: var(--ink-2);
  border: 1px solid var(--line);
  padding: 0.1em 0.42em;
  border-radius: 3px;
}

button {
  font-family: inherit;
  cursor: pointer;
}

::selection {
  background: var(--signal);
  color: #100701;
}

/* 氛围层 */

.atmosphere {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.atmosphere__grid {
  position: absolute;
  inset: -2px;
  background-image:
    linear-gradient(to right, var(--line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--line) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 34%, #000 10%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 34%, #000 10%, transparent 78%);
  opacity: 0.75;
}

.atmosphere__glow {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(760px 420px at 22% 8%, rgba(255, 106, 26, 0.09), transparent 62%),
    radial-gradient(620px 520px at 88% 92%, rgba(86, 223, 194, 0.055), transparent 66%),
    radial-gradient(1200px 800px at 50% 50%, rgba(20, 22, 26, 0.55), var(--ink-0) 78%);
}

.atmosphere__scan {
  position: absolute;
  left: 0;
  right: 0;
  height: 34vh;
  background: linear-gradient(
    to bottom,
    transparent,
    rgba(255, 106, 26, 0.045) 48%,
    rgba(255, 106, 26, 0.075) 52%,
    transparent
  );
  animation: scan 14s linear infinite;
  opacity: 0.85;
}

@keyframes scan {
  0% {
    transform: translateY(-40vh);
  }
  100% {
    transform: translateY(130vh);
  }
}

.atmosphere__grain {
  position: absolute;
  inset: 0;
  opacity: 0.34;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
}

/* 布局壳 */

.shell {
  position: relative;
  z-index: 1;
  width: var(--shell);
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 28px 0 26px;
}

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 13px;
}

.wordmark__mark {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  position: relative;
  background: linear-gradient(150deg, var(--ink-3), var(--ink-1));
  flex: none;
}

.wordmark__mark::before {
  content: "";
  position: absolute;
  inset: 7px 8px;
  border-left: 2px solid var(--signal);
  border-right: 2px solid var(--signal);
  border-bottom: 2px solid var(--signal);
  border-radius: 0 0 5px 5px;
}

.wordmark__mark::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 5px;
  width: 2px;
  height: 8px;
  transform: translateX(-50%);
  background: var(--signal);
  opacity: 0.65;
}

.wordmark__text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.wordmark__text strong {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.02em;
}

.wordmark__text em {
  font-family: var(--font-mono);
  font-style: normal;
  font-size: 9.5px;
  letter-spacing: 0.3em;
  color: var(--paper-faint);
  text-transform: uppercase;
}

.masthead__meta {
  display: flex;
  align-items: center;
  gap: 16px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--paper-dim);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
  background: rgba(20, 22, 26, 0.6);
}

.pill .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(86, 223, 194, 0.16);
  animation: pulse 2.6s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

.masthead__time {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.12em;
  color: var(--paper-faint);
  font-variant-numeric: tabular-nums;
}

.stage {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 52px 0 56px;
}

.view {
  width: 100%;
  animation: viewIn 0.5s var(--ease-out) both;
}

.view[hidden] {
  display: none;
}

@keyframes viewIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* 文字与标题 */

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--paper-faint);
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 22px;
}

.eyebrow span {
  color: var(--signal);
  font-weight: 600;
}

.eyebrow--center {
  justify-content: center;
}

.eyebrow--ok {
  color: var(--ok);
}

.eyebrow--ok span {
  color: var(--ok);
}

.display {
  font-family: var(--font-display);
  font-weight: 380;
  font-size: clamp(38px, 6.4vw, 74px);
  line-height: 1.06;
  letter-spacing: -0.018em;
  margin: 0;
}

.display .line {
  display: block;
  animation: lineIn 0.72s var(--ease-out) both;
}

.display .line:nth-child(1) {
  animation-delay: 0.06s;
}

.display .line:nth-child(2) {
  animation-delay: 0.16s;
}

.display .line:nth-child(2)::after {
  content: "";
}

@keyframes lineIn {
  from {
    opacity: 0;
    transform: translateY(0.42em);
    filter: blur(8px);
  }
  to {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

.display--sm {
  font-size: clamp(26px, 3.4vw, 40px);
}

.lede {
  max-width: 46ch;
  margin: 22px 0 0;
  color: var(--paper-dim);
  font-size: 14.5px;
  line-height: 1.85;
  animation: lineIn 0.6s var(--ease-out) 0.24s both;
}

.lede--center {
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

/* 邀请码输入 */

.code-form {
  margin-top: 40px;
  animation: lineIn 0.6s var(--ease-out) 0.32s both;
}

.code-input {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.slot {
  position: relative;
  width: clamp(56px, 11vw, 78px);
  height: clamp(68px, 13vw, 92px);
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: linear-gradient(168deg, rgba(27, 30, 34, 0.9), rgba(13, 14, 16, 0.92));
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.18s var(--ease), box-shadow 0.24s var(--ease),
    transform 0.24s var(--ease), background 0.24s var(--ease);
  overflow: hidden;
}

.slot::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 0;
  height: 1px;
  background: var(--signal);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s var(--ease-out);
}

.slot:focus-within {
  border-color: rgba(255, 106, 26, 0.55);
  box-shadow: 0 0 0 1px rgba(255, 106, 26, 0.28), 0 14px 30px -18px rgba(255, 106, 26, 0.9);
  transform: translateY(-2px);
}

.slot:focus-within::after {
  transform: scaleX(1);
}

.slot.is-filled {
  border-color: rgba(244, 241, 234, 0.3);
  background: linear-gradient(168deg, rgba(38, 41, 46, 0.95), rgba(18, 20, 23, 0.95));
}

.slot input {
  width: 100%;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: clamp(24px, 4.4vw, 34px);
  font-weight: 500;
  text-align: center;
  text-transform: uppercase;
  caret-color: var(--signal);
  padding: 0 0 8px;
}

.slot__index {
  position: absolute;
  bottom: 7px;
  left: 0;
  right: 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--paper-faint);
  pointer-events: none;
}

.code-hint {
  margin: 14px 0 0;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  color: var(--paper-faint);
}

.code-input.is-invalid .slot {
  border-color: rgba(255, 95, 86, 0.5);
}

.code-input.is-shaking {
  animation: shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes shake {
  10%,
  90% {
    transform: translateX(-3px);
  }
  20%,
  80% {
    transform: translateX(5px);
  }
  30%,
  50%,
  70% {
    transform: translateX(-8px);
  }
  40%,
  60% {
    transform: translateX(8px);
  }
}

/* 提示条 */

.notice {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin-top: 22px;
  padding: 13px 16px;
  border: 1px solid var(--line-strong);
  border-left-width: 2px;
  border-radius: 4px;
  background: rgba(20, 22, 26, 0.7);
  font-size: 13.5px;
}

.notice[hidden] {
  display: none;
}

.notice--error {
  border-left-color: var(--bad);
  animation: noticeIn 0.32s var(--ease-out) both;
}

.notice--error .notice__icon {
  color: var(--bad);
  border-color: rgba(255, 95, 86, 0.4);
}

.notice__icon {
  flex: none;
  width: 19px;
  height: 19px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1;
  margin-top: 3px;
}

.notice__text {
  color: var(--paper);
}

@keyframes noticeIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* 按钮 */

.actions {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 30px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 13px 22px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: transform 0.18s var(--ease), background 0.2s var(--ease),
    border-color 0.2s var(--ease), opacity 0.2s var(--ease), box-shadow 0.24s var(--ease);
}

.btn svg {
  width: 17px;
  height: 17px;
  transition: transform 0.24s var(--ease);
}

.btn--primary {
  background: var(--signal);
  color: #180a01;
  box-shadow: 0 16px 34px -22px rgba(255, 106, 26, 0.95);
}

.btn--primary:hover:not(:disabled) {
  background: #ff7d35;
  transform: translateY(-1px);
}

.btn--primary:hover:not(:disabled) svg {
  transform: translateX(4px);
}

.btn--primary:disabled {
  background: var(--ink-3);
  color: var(--paper-faint);
  box-shadow: none;
  cursor: not-allowed;
}

.btn--ghost {
  border-color: var(--line-strong);
  color: var(--paper-dim);
  background: transparent;
}

.btn--ghost:hover {
  color: var(--paper);
  border-color: rgba(244, 241, 234, 0.35);
}

.actions__meta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--paper-faint);
}

/* 验证中 */

.view--verifying {
  text-align: center;
  max-width: 560px;
  margin: 0 auto;
}

.loader {
  position: relative;
  width: 168px;
  height: 168px;
  margin: 0 auto 34px;
}

.loader svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.loader__track {
  fill: none;
  stroke: var(--line);
  stroke-width: 1;
}

.loader__arc {
  fill: none;
  stroke: var(--signal);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 326;
  stroke-dashoffset: 240;
  animation: spin 1.5s var(--ease) infinite;
  transform-origin: 60px 60px;
}

@keyframes spin {
  0% {
    stroke-dashoffset: 300;
    transform: rotate(0deg);
  }
  50% {
    stroke-dashoffset: 60;
  }
  100% {
    stroke-dashoffset: 300;
    transform: rotate(360deg);
  }
}

.loader__code {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 20px;
  letter-spacing: 0.24em;
  color: var(--paper);
}

/* 验证通过 */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* 只留一行识别符，把版面让给嵌入式内容 */
.session-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--line);
  animation: lineIn 0.5s var(--ease-out) both;
}

.session-bar__label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--paper-faint);
}

.session-bar__code {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.22em;
  color: var(--paper);
  user-select: all;
}

.session-bar__spacer {
  flex: 1 1 auto;
}

.session-bar__note {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--warn);
  font-variant-numeric: tabular-nums;
}

.session-bar__note[hidden] {
  display: none;
}

.session-bar__exit {
  padding: 2px 0;
  border: 0;
  border-bottom: 1px solid transparent;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--paper-faint);
  cursor: pointer;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.session-bar__exit:hover {
  color: var(--paper-dim);
  border-bottom-color: var(--line-strong);
}

.content-slot {
  margin-top: 18px;
}

/* 载入中：一条极简扫描线，替换原来的占位卡片 */
.content-loading {
  position: relative;
  height: 2px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.content-loading i {
  position: absolute;
  inset: 0;
  width: 38%;
  border-radius: 999px;
  background: var(--signal);
  animation: loadingSweep 1.15s var(--ease) infinite;
}

@keyframes loadingSweep {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(280%);
  }
}

/* 邀请码未绑定内容时的极简提示 */
.content-empty {
  margin: 0;
  padding: 24px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--paper-dim);
  font-size: 14px;
}


/* 页脚 */

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--paper-faint);
}

.footer__left,
.footer__right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.footer a:hover {
  color: var(--paper);
}

.footer__sep {
  opacity: 0.5;
}

.footer__label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--paper-faint);
}

.footer__value {
  color: var(--paper-dim);
}

.footer__icp {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--paper-dim);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 11px;
}

/* 其他 */

.noscript {
  position: fixed;
  inset: auto 0 0 0;
  background: var(--bad);
  color: #fff;
  padding: 14px 20px;
  text-align: center;
  z-index: 9;
}

.noscript p {
  margin: 0;
  font-size: 13px;
}

/* 响应式 */

@media (max-width: 860px) {
  :root {
    --shell: calc(100vw - 36px);
  }

  .stage {
    padding: 34px 0 40px;
  }

  .granted-head {
    align-items: flex-start;
  }

  .footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }
}

@media (max-width: 520px) {
  .code-input {
    gap: 8px;
  }

  .slot {
    width: calc((100% - 32px) / 5);
    height: 66px;
  }

  .slot input {
    font-size: 22px;
  }

  .masthead__time {
    display: none;
  }

  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .btn--primary {
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .atmosphere__scan {
    display: none;
  }
}
