/* ==========================================================================
   拾音档案 · 访问验证（Rhine 终端风格）
   配色取自 RhineLabUI（MIT）：纸色 / 墨色 / 橄榄金 + 橙色节点
   ========================================================================== */

.music-login {
  --ml-paper: #eae5e1;
  --ml-panel: #edebe4;
  --ml-field: #e7e3d9;
  --ml-ink: #080a08;
  --ml-muted: #77756d;
  --ml-line: #aaa59a;
  --ml-accent: #9b7247;
  --ml-orange: #ed821b;
  --ml-danger: #8a2f1f;

  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  min-height: 100svh;
  overflow: hidden;
  /* clip 不会生成滚动容器，避免输入框聚焦时把整页顶偏 */
  overflow: clip;
  background: var(--ml-paper);
  color: var(--ml-ink);
  font-family: 'MiSans', var(--font-geist-sans), 'PingFang SC', 'Microsoft YaHei', sans-serif;
  -webkit-font-smoothing: antialiased;
}

.dark .music-login {
  --ml-paper: #11181b;
  --ml-panel: #202a2f;
  --ml-field: #2a363b;
  --ml-ink: #e0e3dc;
  --ml-muted: #a6b0b1;
  --ml-line: #536166;
  --ml-accent: #c5a16b;
  --ml-orange: #ed821b;
  --ml-danger: #e0836a;
}

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

/* ---------- 背景：方格 + 暗角 + 扫描线 ---------- */
.ml-grid {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image:
    linear-gradient(to right, var(--ml-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--ml-line) 1px, transparent 1px);
  background-size: 72px 72px;
  opacity: 0.16;
  -webkit-mask-image: radial-gradient(ellipse at 45% 45%, #000 10%, transparent 78%);
  mask-image: radial-gradient(ellipse at 45% 45%, #000 10%, transparent 78%);
  pointer-events: none;
}

.ml-vignette {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse at 42% 46%, transparent 30%, var(--ml-paper) 88%),
    linear-gradient(180deg, transparent 70%, color-mix(in srgb, var(--ml-paper) 70%, #000) 100%);
  pointer-events: none;
}

.dark .ml-vignette {
  background:
    radial-gradient(ellipse at 42% 46%, transparent 26%, var(--ml-paper) 86%),
    linear-gradient(180deg, transparent 68%, #000 100%);
}

.ml-scanlines {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: repeating-linear-gradient(
    to bottom,
    color-mix(in srgb, var(--ml-ink) 4%, transparent) 0 1px,
    transparent 1px 3px
  );
  opacity: 0.45;
  pointer-events: none;
}

/* ---------- 扫描环 ---------- */
.ml-ring {
  position: absolute;
  z-index: 0;
  top: 50%;
  right: clamp(-260px, -12vw, -80px);
  width: min(920px, 78vw);
  aspect-ratio: 1;
  transform: translateY(-50%);
  color: var(--ml-line);
  opacity: 0.55;
  pointer-events: none;
}

.ml-ring svg {
  width: 100%;
  height: 100%;
  animation: ml-ring-spin 72s linear infinite;
}

.ml-ring-outer {
  stroke: var(--ml-line);
  stroke-width: 0.7;
  opacity: 0.5;
}

.ml-ring-dashed {
  stroke: var(--ml-line);
  stroke-width: 0.9;
  stroke-dasharray: 2 12;
  opacity: 0.7;
}

.ml-ring-arc {
  stroke: var(--ml-accent);
  stroke-width: 1.6;
  stroke-dasharray: 300 1160;
  stroke-linecap: butt;
  opacity: 0.85;
}

.ml-ring-inner {
  stroke: var(--ml-line);
  stroke-width: 0.7;
  stroke-dasharray: 70 14;
  opacity: 0.45;
}

.ml-ring-dot {
  fill: var(--ml-orange);
}

.ml-ring-dot-alt {
  fill: var(--ml-accent);
}

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

/* ---------- 顶部品牌 ---------- */
.ml-head {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: clamp(20px, 3.4vw, 38px) clamp(20px, 4.6vw, 60px);
  animation: ml-rise 700ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.ml-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.ml-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid var(--ml-line);
  color: var(--ml-ink);
}

.ml-mark svg {
  width: 27px;
  height: 27px;
}

.ml-brand-en {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.2em;
  line-height: 1.1;
}

.ml-brand-cn {
  margin-top: 5px;
  font-size: 10.5px;
  letter-spacing: 0.22em;
  color: var(--ml-muted);
}

.ml-head-meta {
  text-align: right;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 9px;
  letter-spacing: 0.18em;
  line-height: 2;
  color: var(--ml-muted);
}

/* 登录页是整屏终端界面：隐藏全站导航，保留自己的返回入口 */
html:has(.music-login) .site-navbar,
html:has(.music-login) .site-navbar-mobile,
html:has(.music-login) .global-toolbox,
html:has(.music-login) .site-footer {
  display: none !important;
}

.ml-home {
  display: inline-block;
  margin-top: 6px;
  color: var(--ml-ink);
  letter-spacing: 0.14em;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 150ms ease, border-color 150ms ease;
}

.ml-home:hover {
  color: var(--ml-accent);
  border-bottom-color: var(--ml-accent);
}

/* ---------- 主体 ---------- */
.ml-main {
  position: relative;
  z-index: 3;
  display: flex;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
  flex-direction: column;
  justify-content: center;
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: clamp(12px, 3vh, 40px) clamp(20px, 4.6vw, 60px) clamp(28px, 6vh, 64px);
}

.ml-main::-webkit-scrollbar {
  display: none;
}

.ml-kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--ml-muted);
  animation: ml-rise 700ms 80ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.ml-kicker::before {
  content: '';
  width: 7px;
  height: 7px;
  background: var(--ml-orange);
}

.ml-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 396px);
  gap: clamp(32px, 6vw, 96px);
  align-items: end;
  margin-top: clamp(18px, 3vh, 34px);
}

.ml-lead {
  min-width: 0;
  animation: ml-rise 900ms 140ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.ml-title {
  margin: 0;
  font-size: clamp(3.6rem, 11.5vw, 9.4rem);
  font-weight: 800;
  line-height: 0.78;
  letter-spacing: -0.065em;
  white-space: nowrap;
}

.ml-title-dot {
  color: var(--ml-orange);
}

.ml-subtitle {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: clamp(20px, 3.4vh, 34px);
  font-size: clamp(0.95rem, 1.5vw, 1.15rem);
  font-weight: 600;
  letter-spacing: 0.08em;
}

.ml-subtitle span {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 9.5px;
  font-weight: 400;
  letter-spacing: 0.28em;
  color: var(--ml-muted);
}

.ml-status {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 24px;
  margin-top: clamp(18px, 2.6vh, 28px);
  padding-top: 14px;
  border-top: 1px solid var(--ml-line);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(10px, 1.25vw, 12.5px);
  letter-spacing: 0.12em;
  color: var(--ml-ink);
}

.ml-status-bullet {
  color: var(--ml-orange);
  font-size: 10px;
}

.ml-caret {
  display: inline-block;
  width: 2px;
  height: 1.05em;
  background: var(--ml-ink);
  animation: ml-blink 0.85s steps(1) infinite;
}

.is-granted .ml-caret {
  background: var(--ml-accent);
}

@keyframes ml-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

/* ---------- 表单面板 ---------- */
.ml-panel {
  position: relative;
  padding: 24px 24px 22px;
  border: 1px solid var(--ml-line-strong, var(--ml-line));
  background: color-mix(in srgb, var(--ml-panel) 86%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: ml-rise 900ms 220ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.ml-panel::before,
.ml-panel::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  border-color: var(--ml-accent);
  border-style: solid;
  pointer-events: none;
}

.ml-panel::before {
  top: -1px;
  left: -1px;
  border-width: 1px 0 0 1px;
}

.ml-panel::after {
  right: -1px;
  bottom: -1px;
  border-width: 0 1px 1px 0;
}

.is-denied .ml-panel {
  animation: ml-shake 380ms cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

.ml-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--ml-line);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 9px;
  letter-spacing: 0.22em;
  color: var(--ml-muted);
}

.ml-field {
  display: block;
  margin-bottom: 18px;
}

.ml-field-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--ml-muted);
}

.ml-field-top span:last-child {
  font-family: 'MiSans', sans-serif;
  letter-spacing: 0.16em;
  font-size: 10px;
}

.ml-field input {
  width: 100%;
  height: 46px;
  padding: 0 13px;
  border: 1px solid var(--ml-line);
  border-radius: 0;
  background: var(--ml-field);
  color: var(--ml-ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  letter-spacing: 0.06em;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.ml-field input::placeholder {
  color: color-mix(in srgb, var(--ml-muted) 62%, transparent);
}

.ml-field input:focus {
  border-color: var(--ml-accent);
  box-shadow: inset 0 0 0 1px var(--ml-accent);
}

.ml-field input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.ml-submit {
  display: flex;
  width: 100%;
  height: 46px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 4px;
  border: 1px solid var(--ml-ink);
  border-radius: 0;
  background: var(--ml-ink);
  color: var(--ml-paper);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10.5px;
  letter-spacing: 0.24em;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.ml-submit:hover:not(:disabled) {
  border-color: var(--ml-accent);
  background: var(--ml-accent);
  color: #fff;
}

.ml-submit:disabled {
  cursor: wait;
  opacity: 0.62;
}

.is-granted .ml-submit {
  border-color: var(--ml-accent);
  background: var(--ml-accent);
  color: #fff;
  opacity: 1;
}

.ml-hint {
  margin: 14px 0 0;
  font-size: 10px;
  line-height: 1.75;
  letter-spacing: 0.02em;
  color: var(--ml-muted);
}

.ml-error {
  margin: 0 0 14px;
  padding: 9px 11px;
  border: 1px solid color-mix(in srgb, var(--ml-danger) 42%, transparent);
  background: color-mix(in srgb, var(--ml-danger) 7%, transparent);
  color: var(--ml-danger);
  font-size: 11px;
  line-height: 1.6;
  letter-spacing: 0.03em;
}

/* ---------- 封存态 ---------- */
.ml-panel-sealed {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ml-sealed-title {
  margin: 4px 0 0;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.ml-sealed-text {
  margin: 0;
  font-size: 12px;
  line-height: 1.9;
  color: var(--ml-muted);
}

.ml-back {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  padding: 10px 16px;
  border: 1px solid var(--ml-line);
  color: var(--ml-ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-decoration: none;
  transition: border-color 150ms ease, color 150ms ease;
}

.ml-back:hover {
  border-color: var(--ml-accent);
  color: var(--ml-accent);
}

/* ---------- 底栏 ---------- */
.ml-foot {
  position: relative;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 20px;
  padding: 13px clamp(20px, 4.6vw, 60px);
  border-top: 1px solid var(--ml-line);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 8.5px;
  letter-spacing: 0.16em;
  color: var(--ml-muted);
}

.ml-foot > span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.ml-light {
  width: 6px;
  height: 6px;
  background: var(--ml-orange);
  animation: ml-pulse 2.4s ease-in-out infinite;
}

.is-granted .ml-light {
  background: var(--ml-accent);
}

.ml-foot-credit {
  flex: 1;
  justify-content: center;
  text-align: center;
}

.ml-foot-credit a {
  color: var(--ml-ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.ml-foot-credit a:hover {
  color: var(--ml-accent);
}

.ml-foot-sep {
  font-style: normal;
  padding: 0 4px;
}

.ml-clock {
  min-width: 62px;
  font-variant-numeric: tabular-nums;
}

/* ---------- 通过遮罩 ---------- */
.ml-granted {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--ml-paper) 92%, transparent);
  backdrop-filter: blur(2px);
  animation: ml-fade-in 420ms ease both;
}

.ml-granted-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 32px 40px;
  animation: ml-granted-pop 700ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.ml-granted-kicker {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  letter-spacing: 0.34em;
  color: var(--ml-orange);
}

.ml-granted-inner strong {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 800;
  letter-spacing: 0.08em;
}

.ml-granted-sub {
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--ml-muted);
}

/* ---------- 动效 ---------- */
@keyframes ml-rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes ml-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes ml-granted-pop {
  from { opacity: 0; transform: scale(0.96); letter-spacing: 0.02em; }
  to { opacity: 1; transform: scale(1); }
}

@keyframes ml-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.28; }
}

@keyframes ml-shake {
  0%, 100% { transform: translateX(0); }
  18% { transform: translateX(-7px); }
  36% { transform: translateX(6px); }
  54% { transform: translateX(-4px); }
  72% { transform: translateX(3px); }
  88% { transform: translateX(-1px); }
}

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .ml-ring {
    top: 34%;
    right: -42%;
    width: 120vw;
    opacity: 0.36;
  }

  .ml-body {
    grid-template-columns: minmax(0, 1fr);
    gap: 30px;
    align-items: stretch;
  }

  .ml-title {
    font-size: clamp(3.2rem, 18vw, 6rem);
  }

  .ml-head-meta {
    display: none;
  }

  .ml-foot-credit {
    order: 3;
    flex-basis: 100%;
    text-align: left;
    justify-content: flex-start;
  }
}

@media (max-width: 520px) {
  .ml-mark {
    width: 40px;
    height: 40px;
  }

  .ml-brand-en {
    font-size: 12px;
    letter-spacing: 0.16em;
  }

  .ml-panel {
    padding: 20px 18px 18px;
  }

  .ml-status {
    font-size: 10px;
    letter-spacing: 0.06em;
  }
}

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

  .ml-ring svg {
    animation: none;
  }
}


/* ---------- 更丰富的环境动效（Rhine 启动序列之外） ---------- */
.ml-ring-dot-orbit {
  position: absolute;
  inset: 0;
  pointer-events: none;
  animation: ml-orbit 26s linear infinite;
}

.ml-ring-dot-orbit::before,
.ml-ring-dot-orbit::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 4%;
  width: 5px;
  height: 5px;
  margin-left: -2.5px;
  background: var(--ml-orange);
  border-radius: 50%;
  box-shadow: 0 0 12px color-mix(in srgb, var(--ml-orange) 55%, transparent);
}

.ml-ring-dot-orbit::after {
  top: 96%;
  width: 3px;
  height: 3px;
  background: var(--ml-accent);
  box-shadow: none;
}

.ml-sweep {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
}

.ml-sweep::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: -20%;
  height: 26%;
  background: linear-gradient(
    to bottom,
    transparent,
    color-mix(in srgb, var(--ml-accent) 3%, transparent) 50%,
    color-mix(in srgb, var(--ml-accent) 6%, transparent) 100%
  );
  filter: blur(18px);
  animation: ml-sweep 9s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.ml-title {
  position: relative;
  opacity: 0;
  transform: translateY(10px);
  animation: ml-rise 900ms 320ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.ml-notice {
  margin: 0 0 16px;
  padding: 9px 11px;
  border: 1px solid color-mix(in srgb, var(--ml-accent) 36%, transparent);
  background: color-mix(in srgb, var(--ml-accent) 7%, transparent);
  color: var(--ml-accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 9px;
  line-height: 1.7;
  letter-spacing: 0.08em;
}

@keyframes ml-orbit {
  to { transform: rotate(360deg); }
}

@keyframes ml-sweep {
  0% { transform: translateY(0); opacity: 0; }
  8% { opacity: 1; }
  55% { opacity: 0.9; }
  100% { transform: translateY(680%); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .ml-ring-dot-orbit,
  .ml-sweep::before,
  .ml-title {
    animation: none !important;
  }

  .ml-title {
    opacity: 1;
    transform: none;
  }
}


/* ---------- 登录内容整体淡入 / 验证时淡出 ---------- */
.ml-shell {
  position: relative;
  z-index: 3;
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 560ms cubic-bezier(0.16, 1, 0.3, 1),
    transform 680ms cubic-bezier(0.16, 1, 0.3, 1);
}

.music-login.is-ready .ml-shell {
  opacity: 1;
  transform: none;
}

.music-login.is-busy .ml-shell {
  opacity: 0;
  transform: translateY(-8px);
  transition-duration: 320ms;
}

/* 页面切换幕布：铺在启动动画之上，盖住 React 换页的一瞬 */
.route-veil {
  position: fixed;
  inset: 0;
  z-index: 50001;
  background: #eae5e1;
  opacity: 0;
  pointer-events: none;
  transition: opacity 480ms cubic-bezier(0.4, 0, 0.2, 1);
}

.dark .route-veil {
  background: #11181b;
}

.route-veil.is-on {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .ml-shell,
  .route-veil {
    transition: none !important;
  }
}


/* 登录成功后的整页交叉淡化 */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 460ms;
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none !important;
  }
}
