:root {
  --primary: #4f8cff;
  --primary-2: #5da9ff;
  --primary-3: #3b82f6;
  --secondary: #ffd54f;
  --secondary-2: #ffc107;
  --secondary-3: #ffca28;
  --bg: #eef4ff;
  --bg-soft: #f5f8ff;
  --bg-lift: #f8fafd;
  --card: rgba(255, 255, 255, 0.72);
  --card-solid: #ffffff;
  --ink: #1e293b;
  --muted: #475569;
  --subtle: #94a3b8;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --line: rgba(79, 140, 255, 0.18);
  --line-strong: rgba(79, 140, 255, 0.36);
  --radius: 20px;
  --radius-lg: 24px;
  --radius-pill: 999px;
  --shadow-high: 22px 22px 52px rgba(99, 130, 179, 0.22), -18px -18px 42px rgba(255, 255, 255, 0.86);
  --shadow-soft: 12px 12px 28px rgba(99, 130, 179, 0.18), -10px -10px 24px rgba(255, 255, 255, 0.78);
  --shadow-pressed: inset 8px 8px 18px rgba(99, 130, 179, 0.18), inset -8px -8px 18px rgba(255, 255, 255, 0.82);
  --shadow-glow: 0 18px 44px rgba(79, 140, 255, 0.28), 0 0 0 1px rgba(255, 255, 255, 0.5) inset;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: Aptos, "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background:
    radial-gradient(circle at 12% 8%, rgba(79, 140, 255, 0.26), transparent 28rem),
    radial-gradient(circle at 78% 16%, rgba(255, 213, 79, 0.2), transparent 26rem),
    radial-gradient(circle at 52% 92%, rgba(93, 169, 255, 0.18), transparent 30rem),
    linear-gradient(145deg, var(--bg-soft), var(--bg));
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  pointer-events: none;
  z-index: 0;
}

body::before {
  inset: 0;
  background-image:
    linear-gradient(rgba(79, 140, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79, 140, 255, 0.07) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(180deg, rgba(30, 41, 59, 0.34), transparent 68%);
}

body::after {
  width: 360px;
  height: 360px;
  right: -120px;
  top: 12%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 213, 79, 0.24), rgba(79, 140, 255, 0.06) 58%, transparent 72%);
  filter: blur(12px);
  animation: orbFloat 12s ease-in-out infinite alternate;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible {
  outline: 4px solid rgba(79, 140, 255, 0.22);
  outline-offset: 4px;
}

.home-shell {
  position: relative;
  z-index: 1;
  display: grid;
  align-content: center;
  gap: 24px;
  width: min(1120px, calc(100% - 32px));
  min-height: 100dvh;
  margin: 0 auto;
  padding: 32px 0;
  animation: pageIn 480ms ease-in-out both;
}

.entry-panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(336px, 424px);
  gap: 48px;
  align-items: center;
  padding: 56px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.78), rgba(238, 244, 255, 0.52));
  box-shadow: var(--shadow-high);
  backdrop-filter: blur(22px) saturate(1.18);
  overflow: hidden;
  transition: transform 280ms ease-in-out, box-shadow 280ms ease-in-out, border-color 280ms ease-in-out;
}

.entry-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.62), transparent 34%),
    radial-gradient(circle at 82% 18%, rgba(255, 213, 79, 0.22), transparent 22rem);
  pointer-events: none;
}

.entry-panel:hover {
  transform: translateY(-8px);
  border-color: rgba(79, 140, 255, 0.34);
  box-shadow: 28px 28px 64px rgba(99, 130, 179, 0.28), -20px -20px 46px rgba(255, 255, 255, 0.9), 0 0 34px rgba(79, 140, 255, 0.12);
}

.entry-copy,
.entry-stack {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.entry-stack {
  display: grid;
  gap: 20px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--primary-3);
  font-size: 0.78rem;
  font-weight: 780;
  letter-spacing: 0.08em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 640px;
  margin-bottom: 16px;
  color: var(--ink);
  font-size: 3.75rem;
  line-height: 1.02;
  letter-spacing: 0;
  text-wrap: balance;
}

.lead {
  max-width: 58ch;
  margin: 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.76;
  text-wrap: pretty;
}

.trust-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

.trust-row span {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: var(--radius-pill);
  color: var(--primary-3);
  background: rgba(255, 255, 255, 0.58);
  box-shadow: var(--shadow-soft);
  font-size: 0.88rem;
  font-weight: 740;
  backdrop-filter: blur(14px);
  animation: riseIn 520ms ease-in-out both;
}

.trust-row span:nth-child(2) {
  animation-delay: 80ms;
}

.trust-row span:nth-child(3) {
  animation-delay: 160ms;
}

.auth-form,
.room-form,
.signed-panel,
.hint-strip div {
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-soft), inset 1px 1px 0 rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(18px) saturate(1.16);
  transition: transform 260ms ease-in-out, box-shadow 260ms ease-in-out, border-color 260ms ease-in-out;
}

.auth-form:hover,
.room-form:hover,
.signed-panel:hover,
.hint-strip div:hover {
  transform: translateY(-6px);
  border-color: rgba(79, 140, 255, 0.3);
  box-shadow: var(--shadow-high), 0 0 28px rgba(79, 140, 255, 0.12);
}

.auth-form,
.room-form {
  display: grid;
  gap: 16px;
  padding: 28px;
  animation: riseIn 560ms ease-in-out both;
  animation-delay: 120ms;
}

.form-heading h2,
.history-heading h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.36rem;
  line-height: 1.2;
}

.entry-field {
  display: grid;
  gap: 8px;
}

.entry-field span,
.signed-panel span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 720;
  transition: color 220ms ease-in-out, transform 220ms ease-in-out;
}

.entry-field:focus-within span {
  color: var(--primary-3);
  transform: translateY(-2px);
}

.entry-field input {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 18px;
  color: var(--ink);
  background: rgba(245, 248, 255, 0.74);
  box-shadow: var(--shadow-pressed);
  outline: none;
  transition: transform 220ms ease-in-out, border-color 220ms ease-in-out, box-shadow 220ms ease-in-out, background 220ms ease-in-out;
}

.entry-field input::placeholder {
  color: var(--subtle);
  transition: opacity 220ms ease-in-out, transform 220ms ease-in-out;
}

.entry-field input:focus::placeholder {
  opacity: 0.62;
  transform: translateX(4px);
}

.entry-field input:hover,
.entry-field input:focus {
  border-color: rgba(79, 140, 255, 0.48);
  background: rgba(255, 255, 255, 0.86);
}

.entry-field input:focus {
  transform: scale(1.01);
  box-shadow: var(--shadow-pressed), 0 0 0 4px rgba(79, 140, 255, 0.14);
}

.entry-field input:user-invalid {
  border-color: rgba(239, 68, 68, 0.48);
  box-shadow: var(--shadow-pressed), 0 0 0 4px rgba(239, 68, 68, 0.12);
}

.entry-field input:user-valid {
  border-color: rgba(34, 197, 94, 0.4);
}

.enter-button,
.clear-history,
.history-item {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-pill);
  transition: transform 220ms ease-in-out, background 220ms ease-in-out, border-color 220ms ease-in-out, box-shadow 220ms ease-in-out;
}

.enter-button::before,
.clear-history::before,
.history-item::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.46), transparent);
  transform: translateX(-120%);
  transition: transform 420ms ease-in-out;
}

.enter-button::after,
.clear-history::after,
.history-item::after {
  content: "";
  position: absolute;
  inset: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.42);
  transform: translate(-50%, -50%);
  opacity: 0;
}

.enter-button:hover::before,
.clear-history:hover::before,
.history-item:hover::before {
  transform: translateX(120%);
}

.enter-button:active::after,
.clear-history:active::after,
.history-item:active::after {
  width: 240px;
  height: 240px;
  opacity: 1;
  transition: width 320ms ease-in-out, height 320ms ease-in-out, opacity 520ms ease-in-out;
}

.enter-button {
  min-height: 52px;
  border: 1px solid rgba(255, 255, 255, 0.54);
  color: #ffffff;
  background: linear-gradient(135deg, var(--primary), #6ba8ff);
  box-shadow: var(--shadow-glow);
  font-weight: 780;
}

.enter-button:hover {
  transform: translateY(-4px) scale(1.03);
  box-shadow: 0 22px 52px rgba(79, 140, 255, 0.34), 0 0 24px rgba(79, 140, 255, 0.28);
}

.enter-button:active,
.clear-history:active,
.history-item:active {
  transform: scale(0.98);
  box-shadow: var(--shadow-pressed);
}

.enter-button:disabled {
  cursor: wait;
  opacity: 0.72;
  transform: none;
  background-size: 220% 100%;
  animation: loadingSheen 1.1s ease-in-out infinite;
}

.room-message {
  min-height: 24px;
  margin: 0;
  color: var(--primary-3);
  font-weight: 680;
}

.signed-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 76px;
  padding: 16px 20px;
  animation: scaleIn 300ms ease-in-out both;
}

.signed-panel div {
  display: grid;
  gap: 4px;
}

.signed-panel strong {
  font-size: 1.05rem;
}

.history-panel {
  display: grid;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.history-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.history-heading h2 {
  font-size: 1.08rem;
}

.clear-history {
  min-height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.76);
  padding: 0 16px;
  color: var(--primary-3);
  background: rgba(255, 255, 255, 0.58);
  box-shadow: var(--shadow-soft);
  font-weight: 740;
}

.clear-history:hover {
  border-color: var(--line-strong);
  transform: translateY(-3px) scale(1.03);
  box-shadow: var(--shadow-high), 0 0 18px rgba(79, 140, 255, 0.16);
}

.clear-history:disabled {
  cursor: default;
  opacity: 0.48;
}

.history-list {
  display: grid;
  gap: 8px;
}

.history-empty {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  min-height: 52px;
  border: 1px solid rgba(255, 255, 255, 0.74);
  padding: 0 16px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.58);
  box-shadow: var(--shadow-soft);
  text-align: left;
  font-weight: 740;
  animation: riseIn 360ms ease-in-out both;
}

.history-item:hover {
  border-color: var(--line-strong);
  transform: translateY(-4px);
  box-shadow: var(--shadow-high), 0 0 18px rgba(79, 140, 255, 0.14);
}

.history-item span {
  color: var(--subtle);
  font-size: 0.82rem;
  font-weight: 680;
  white-space: nowrap;
}

.hint-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.hint-strip div {
  min-height: 108px;
  padding: 24px;
  animation: riseIn 520ms ease-in-out both;
}

.hint-strip div:nth-child(2) {
  animation-delay: 90ms;
}

.hint-strip div:nth-child(3) {
  animation-delay: 180ms;
}

.hint-strip strong {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 1.06rem;
}

.hint-strip span {
  color: var(--muted);
  line-height: 1.55;
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes loadingSheen {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 200% 50%;
  }
}

@keyframes orbFloat {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(-32px, 40px, 0) scale(1.08);
  }
}

@media (max-width: 860px) {
  .entry-panel,
  .hint-strip {
    grid-template-columns: 1fr;
  }

  .entry-panel {
    padding: 32px;
  }

  h1 {
    font-size: 3rem;
  }
}

@media (max-width: 560px) {
  .home-shell {
    width: min(100% - 24px, 1120px);
    padding: 16px 0 24px;
  }

  .entry-panel {
    padding: 24px;
  }

  h1 {
    font-size: 2.45rem;
  }

  .lead {
    font-size: 1rem;
  }

  .signed-panel,
  .history-item {
    align-items: flex-start;
    flex-direction: column;
    padding: 16px;
  }
}

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