﻿:root {
  color-scheme: light;
  --bg: #f4f6fa;
  --bg-2: #e8ecf3;
  --ink: #1e2433;
  --muted: #6b7385;
  --line: rgba(40, 50, 70, 0.1);
  --card: rgba(255, 255, 255, 0.72);
  --shadow: 0 30px 80px rgba(30, 45, 80, 0.18);
  --soft-shadow: 0 20px 50px rgba(30, 45, 80, 0.13);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --teal: #0d9488;
  --teal-light: #14b8a6;
  --amber: #d97706;
  --amber-light: #f59e0b;
  --rose: #dc2626;
  --rose-light: #ef4444;
  --indigo: #4f46e5;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: "Noto Serif SC", "Songti SC", "Microsoft YaHei UI", "Microsoft YaHei", serif;
  background:
    radial-gradient(circle at 16% 8%, rgba(255, 255, 255, 0.9) 0, transparent 32rem),
    radial-gradient(circle at 88% 14%, rgba(179, 199, 236, 0.5) 0, transparent 28rem),
    radial-gradient(circle at 50% 92%, rgba(196, 181, 253, 0.3) 0, transparent 36rem),
    linear-gradient(160deg, var(--bg) 0%, var(--bg-2) 100%);
  overflow-x: hidden;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  opacity: 0.4;
  background-image:
    linear-gradient(rgba(79, 70, 229, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79, 70, 229, 0.04) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: radial-gradient(circle at center, black, transparent 75%);
}

/* --- 飘落雪花层 --- */
.petal-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.snowflake {
  position: absolute;
  top: -40px;
  opacity: 0;
  color: rgba(120, 130, 160, 0.4);
  animation: snowFall linear infinite;
}

@keyframes snowFall {
  0% {
    transform: translateY(-40px) rotate(0deg) scale(1);
    opacity: 0;
  }
  8% {
    opacity: 0.55;
  }
  50% {
    transform: translateY(50vh) translateX(25px) rotate(180deg) scale(0.9);
    opacity: 0.4;
  }
  92% {
    opacity: 0.2;
  }
  100% {
    transform: translateY(105vh) translateX(-15px) rotate(360deg) scale(0.7);
    opacity: 0;
  }
}

button,
input {
  font: inherit;
}

.page-shell {
  position: relative;
  z-index: 1;
  width: min(1060px, calc(100% - 32px));
  margin: 0 auto;
  padding: 44px 0 56px;
}

.auth-view {
  display: grid;
  min-height: calc(100vh - 100px);
  place-items: center;
}

.auth-card {
  width: min(430px, 100%);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
  animation: cardIn 600ms cubic-bezier(0.2, 0.78, 0.22, 1);
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--indigo);
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4.5vw, 3.35rem);
  font-weight: 680;
  letter-spacing: -0.07em;
  background: linear-gradient(135deg, var(--ink), var(--teal) 55%, var(--indigo));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-card h1 {
  margin-bottom: 26px;
  font-size: 2.25rem;
  letter-spacing: -0.05em;
}

.password-field {
  display: grid;
  gap: 10px;
}

.password-field span {
  color: var(--muted);
  font-size: 0.9rem;
}

.password-field input {
  width: 100%;
  padding: 15px 16px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  outline: none;
  background: rgba(255, 255, 255, 0.82);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.password-field input::placeholder {
  color: rgba(107, 115, 133, 0.5);
}

.password-field input:focus {
  border-color: rgba(13, 148, 136, 0.55);
  box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.12);
}

.primary-button,
.quota-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 18px;
  color: #fff;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  background: linear-gradient(135deg, var(--indigo), var(--teal));
  box-shadow: 0 13px 28px rgba(13, 148, 136, 0.25);
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.primary-button {
  width: 100%;
  margin-top: 18px;
}

.primary-button:hover:not(:disabled),
.quota-button:hover:not(:disabled) {
  filter: brightness(1.06);
  transform: translateY(-1px);
  box-shadow: 0 17px 32px rgba(13, 148, 136, 0.3);
}

.primary-button:disabled,
.quota-button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.2);
  opacity: 0.66;
  transform: none;
}

.quota-button--cooldown {
  color: var(--muted);
  background: rgba(120, 130, 160, 0.14);
  box-shadow: none;
  filter: grayscale(0.45);
  opacity: 0.68;
}

.form-error {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--rose);
  font-size: 0.9rem;
}

.dashboard-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 26px;
}

.dashboard-title-group {
  animation: cardIn 600ms cubic-bezier(0.2, 0.78, 0.22, 1);
}

.signature {
  margin-top: 4px;
  padding: 6px 14px;
  color: var(--indigo);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  border: 1px solid rgba(79, 70, 229, 0.22);
  border-radius: 999px;
  background: rgba(79, 70, 229, 0.06);
  white-space: nowrap;
  animation: cardIn 600ms cubic-bezier(0.2, 0.78, 0.22, 1) 100ms backwards;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.account-card {
  position: relative;
  overflow: hidden;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--card);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(16px);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
  animation: cardIn 520ms cubic-bezier(0.2, 0.78, 0.22, 1) backwards;
}

.account-card:hover {
  border-color: rgba(13, 148, 136, 0.22);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.account-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.account-card h2 {
  margin: 0 0 5px;
  font-size: 1.36rem;
  font-weight: 680;
  letter-spacing: -0.035em;
  color: #1a2030;
}

.account-card p {
  margin: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
  font-size: 0.95rem;
}

.status-dot {
  width: 11px;
  height: 11px;
  flex: 0 0 auto;
  margin-top: 6px;
  border-radius: 50%;
  transition: background 300ms ease, box-shadow 300ms ease;
}

.status-dot--idle {
  background: #c0c6d4;
  box-shadow: 0 0 0 5px rgba(192, 198, 212, 0.18);
}

.status-dot--low {
  background: #10b981;
  box-shadow: 0 0 0 5px rgba(16, 185, 129, 0.16);
}

.status-dot--medium {
  background: #f59e0b;
  box-shadow: 0 0 0 5px rgba(245, 158, 11, 0.16);
}

.status-dot--high {
  background: #f43f5e;
  box-shadow: 0 0 0 5px rgba(244, 63, 94, 0.16);
}

.status-dot--failed {
  background: #f43f5e;
  box-shadow: 0 0 0 5px rgba(244, 63, 94, 0.16);
}

.quota-panel {
  position: relative;
  overflow: hidden;
  min-height: 228px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.48);
}

.quota-list {
  display: grid;
  gap: 18px;
}

.quota-row__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.quota-row__label {
  color: #3d4555;
  font-weight: 700;
}

.quota-row__remaining {
  font-weight: 700;
  transition: color 300ms ease;
}

.quota-row__remaining--low {
  color: #059669;
}

.quota-row__remaining--medium {
  color: #d97706;
}

.quota-row__remaining--high {
  color: #e11d48;
}

.quota-row__time {
  margin-bottom: 3px;
  color: #454d5e;
  font-size: 0.94rem;
}

.quota-row__date {
  margin-bottom: 9px;
  color: #949aab;
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 0.76rem;
}

.progress-track {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(40, 50, 70, 0.07);
  box-shadow: inset 0 1px 3px rgba(40, 50, 70, 0.08);
}

.progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  min-width: 6px;
  border-radius: inherit;
  animation: growBar 680ms cubic-bezier(0.2, 0.78, 0.22, 1);
}

.progress-fill::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.38), rgba(255, 255, 255, 0));
}

.progress-fill--low {
  background: linear-gradient(90deg, #10b981, #34d399);
}

.progress-fill--medium {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.progress-fill--high {
  background: linear-gradient(90deg, #f43f5e, #fb7185);
}

.quota-row--placeholder {
  opacity: 0.8;
}

.placeholder-line,
.placeholder-chip,
.progress-track--empty span {
  display: block;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(120, 130, 160, 0.16), rgba(255, 255, 255, 0.6), rgba(120, 130, 160, 0.16));
  background-size: 220% 100%;
  animation: shimmer 2.4s ease-in-out infinite alternate;
}

.placeholder-chip {
  width: 76px;
  height: 18px;
}

.placeholder-line {
  height: 15px;
  margin-bottom: 8px;
}

.placeholder-line--wide {
  width: 64%;
}

.placeholder-line--short {
  width: 42%;
}

.progress-track--empty span {
  width: 76%;
  height: 100%;
}

.quota-veil {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(50, 60, 80, 0.62);
  font-size: 0.93rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: rgba(244, 246, 250, 0.46);
  backdrop-filter: blur(7px) saturate(1.15);
}

.quota-veil span {
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.48);
}

.quota-veil--loading {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
}

.quota-veil--loading span:last-child {
  padding: 0;
  border: 0;
  background: transparent;
}

.quota-button {
  width: 100%;
  margin-top: 16px;
}

.account-card--success .quota-button {
  color: var(--teal);
  background: rgba(13, 148, 136, 0.1);
  box-shadow: none;
}

.account-card--failed .quota-button {
  color: var(--rose);
  background: rgba(220, 38, 38, 0.08);
  box-shadow: none;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.toast-root {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 30;
  display: grid;
  gap: 10px;
  width: min(320px, calc(100vw - 32px));
}

.toast {
  padding: 13px 15px;
  color: #991b1b;
  border: 1px solid rgba(220, 38, 38, 0.22);
  border-radius: 18px;
  background: rgba(255, 247, 245, 0.9);
  box-shadow: 0 18px 42px rgba(84, 54, 42, 0.16);
  backdrop-filter: blur(12px);
  animation: toastIn 220ms ease-out;
}

.toast--leaving {
  animation: toastOut 180ms ease-in forwards;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes shimmer {
  from {
    background-position: 120% 0;
  }
  to {
    background-position: -120% 0;
  }
}

@keyframes growBar {
  from {
    transform: scaleX(0);
    transform-origin: left;
  }
  to {
    transform: scaleX(1);
    transform-origin: left;
  }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(-6px);
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100% - 22px, 560px);
    padding-top: 24px;
  }

  .cards-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-header {
    flex-direction: column;
    gap: 8px;
  }

  .auth-card,
  .account-card {
    border-radius: 24px;
  }

  .auth-card {
    padding: 26px;
  }

  .quota-panel {
    min-height: 220px;
  }

  .toast-root {
    top: 12px;
    right: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }

  .petal-layer {
    display: none;
  }
}
