:root {
  color-scheme: light;
  --page-bg: #fff6cf;
  --card-bg: rgba(255, 255, 255, 0.94);
  --sky: #7dd3fc;
  --blue: #38bdf8;
  --blue-dark: #0284c7;
  --pink: #fb7185;
  --mint: #34d399;
  --yellow: #facc15;
  --purple: #a78bfa;
  --ink: #334155;
  --muted: #64748b;
  --shadow: 0 22px 46px rgba(56, 189, 248, 0.18), 0 12px 28px rgba(251, 113, 133, 0.12);
  --radius: 28px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 12% 18%, rgba(125, 211, 252, 0.45) 0 78px, transparent 80px),
    radial-gradient(circle at 88% 16%, rgba(251, 113, 133, 0.34) 0 70px, transparent 72px),
    radial-gradient(circle at 20% 86%, rgba(52, 211, 153, 0.32) 0 88px, transparent 90px),
    linear-gradient(180deg, #f0fbff 0%, var(--page-bg) 58%, #fff1f2 100%);
  color: var(--ink);
  font-family:
    "Comic Sans MS", "Chalkboard SE", "Marker Felt", ui-rounded, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
input,
textarea,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  align-content: center;
  padding: clamp(18px, 4vh, 44px) clamp(16px, 5vw, 72px);
  position: relative;
  overflow: hidden;
}

.app-shell::before,
.app-shell::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(250, 204, 21, 0.78) 0 3px, transparent 4px),
    radial-gradient(circle, rgba(56, 189, 248, 0.48) 0 2px, transparent 3px),
    radial-gradient(circle, rgba(251, 113, 133, 0.44) 0 2px, transparent 3px);
  background-position:
    8% 24%,
    84% 35%,
    48% 82%;
  background-size:
    180px 180px,
    230px 230px,
    160px 160px;
  opacity: 0.58;
}

.dashboard {
  width: min(100%, 1040px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(22px, 5vw, 64px);
  align-items: stretch;
  position: relative;
  z-index: 1;
}

.check-card {
  min-width: 0;
  min-height: 560px;
  padding: clamp(28px, 4vw, 42px);
  border-radius: var(--radius);
  background: var(--card-bg);
  border: 4px solid rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-rows: auto auto auto auto auto;
  justify-items: center;
  align-content: center;
  gap: 14px;
  position: relative;
  overflow: hidden;
}

.check-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 12px;
  background: linear-gradient(90deg, var(--blue), var(--yellow), var(--pink), var(--mint));
}

.total-score {
  color: var(--blue-dark);
  font-size: clamp(44px, 5vw, 60px);
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0;
  text-shadow: 0 4px 0 rgba(125, 211, 252, 0.24);
  margin: 4px 0 2px;
}

.portrait-frame {
  width: min(100%, 360px);
  aspect-ratio: 16 / 10;
  border-radius: 22px;
  overflow: hidden;
  background: #f0f2f5;
  border: 5px solid #ffffff;
  box-shadow: 0 14px 26px rgba(15, 23, 42, 0.1);
  display: grid;
  place-items: center;
}

.portrait-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

[data-person-card="apple"] .portrait-frame {
  background: #f0f2f5;
}

[data-person-card="apple"] .portrait-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
  box-shadow: none;
}

.check-card h2 {
  margin: 6px 0 -2px;
  color: #0ea5e9;
  font-size: clamp(22px, 2.6vw, 28px);
  line-height: 1.2;
  font-weight: 900;
  letter-spacing: 0;
}

.month-score {
  min-height: 68px;
  color: #26334d;
  font-size: clamp(60px, 8vw, 76px);
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0;
  display: grid;
  place-items: center;
  text-shadow: 0 5px 0 rgba(250, 204, 21, 0.2);
}

.check-button {
  min-width: 108px;
  min-height: 56px;
  border: 0;
  border-radius: 999px;
  padding: 0 32px;
  background: linear-gradient(180deg, #ff8aa1, #fb7185);
  color: #ffffff;
  box-shadow: 0 12px 0 #f43f5e, 0 20px 26px rgba(251, 113, 133, 0.22);
  cursor: pointer;
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease,
    opacity 160ms ease;
}

.check-button:hover:not(:disabled) {
  transform: translateY(-3px) rotate(-1deg);
  box-shadow: 0 15px 0 #f43f5e, 0 24px 28px rgba(251, 113, 133, 0.26);
}

.check-button:active:not(:disabled) {
  transform: translateY(5px);
  box-shadow: 0 6px 0 #f43f5e, 0 12px 18px rgba(251, 113, 133, 0.2);
}

.check-button:disabled {
  min-width: 138px;
  background: linear-gradient(180deg, #dbeafe, #bfdbfe);
  color: #64748b;
  box-shadow: 0 8px 0 #93c5fd;
  cursor: not-allowed;
}

.success-toast {
  position: fixed;
  top: 9vh;
  left: 50%;
  z-index: 30;
  transform: translateX(-50%);
  padding: 18px 30px;
  border-radius: 999px;
  background: linear-gradient(135deg, #38bdf8, #a78bfa 48%, #fb7185);
  color: #ffffff;
  box-shadow: 0 16px 0 rgba(14, 165, 233, 0.22), 0 28px 52px rgba(15, 23, 42, 0.18);
  font-size: clamp(24px, 5vw, 42px);
  font-weight: 900;
  letter-spacing: 0;
  animation: toast-pop 1800ms ease both;
}

#fireworksCanvas {
  position: fixed;
  inset: 0;
  z-index: 20;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 160ms ease;
}

#fireworksCanvas.is-active {
  opacity: 1;
}

@keyframes toast-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -12px) scale(0.95);
  }
  14%,
  78% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -6px) scale(0.98);
  }
}

@media (max-width: 900px) {
  .dashboard {
    width: min(100%, 820px);
    gap: 20px;
  }

  .check-card {
    min-height: 560px;
    padding: 32px 24px;
  }

  .portrait-frame {
    width: min(100%, 300px);
  }
}

@media (max-width: 680px) {
  .app-shell {
    min-height: auto;
    place-items: start center;
    padding: 18px 14px 30px;
  }

  .dashboard {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .check-card {
    min-height: 0;
    padding: 24px 18px 28px;
    gap: 12px;
  }

  .portrait-frame {
    width: min(100%, 330px);
  }

  .month-score {
    min-height: 64px;
  }

  .check-button {
    min-width: 112px;
    min-height: 56px;
  }
}

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