@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display&family=Gaegu:wght@400;700&family=Quicksand:wght@400;600;700&display=swap');

:root {
  color-scheme: light;
  --bg: #fff0f6;
  --bg-deep: #f0f4ff;
  --accent: #ff7eb6;
  --accent-dark: #ff4f99;
  --ink: #2f2332;
  --muted: #6b5b6f;
  --panel: #ffffff;
  --panel-strong: #fff8fd;
  --shadow: 0 20px 50px rgba(98, 61, 105, 0.18);
  --chip-bg: rgba(255, 126, 182, 0.2);
  --chip-ink: #b8336a;
  --pill-bg: rgba(47, 35, 50, 0.08);
  --panel-border: rgba(47, 35, 50, 0.08);
  --result-border: rgba(47, 35, 50, 0.14);
  --glow: rgba(255, 126, 182, 0.4);
}

body[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1b1621;
  --bg-deep: #111018;
  --accent: #ff8fd1;
  --accent-dark: #ffb6e3;
  --ink: #f9f1ff;
  --muted: #c7b8d3;
  --panel: #241b2c;
  --panel-strong: #2c2135;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
  --chip-bg: rgba(255, 143, 209, 0.2);
  --chip-ink: #ffd6ef;
  --pill-bg: rgba(249, 241, 255, 0.14);
  --panel-border: rgba(255, 255, 255, 0.08);
  --result-border: rgba(255, 255, 255, 0.14);
  --glow: rgba(255, 143, 209, 0.35);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Quicksand", "Helvetica Neue", Arial, sans-serif;
  background: radial-gradient(circle at top, #ffe5f0 0%, var(--bg) 38%, var(--bg-deep) 100%);
  color: var(--ink);
  min-height: 100vh;
  transition: background 0.3s ease, color 0.3s ease;
}

body[data-theme="dark"] {
  background: radial-gradient(circle at top, #2d1e33 0%, var(--bg) 35%, var(--bg-deep) 100%);
}

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 56px 24px 64px;
  position: relative;
}

.page::before,
.page::after {
  content: "";
  position: absolute;
  z-index: -1;
  border-radius: 999px;
  filter: blur(0);
}

.page::before {
  width: 340px;
  height: 340px;
  background: rgba(234, 106, 71, 0.25);
  top: -80px;
  left: -120px;
}

.page::after {
  width: 260px;
  height: 260px;
  background: rgba(100, 90, 84, 0.18);
  bottom: 40px;
  right: -120px;
}

body[data-theme="dark"] .page::before {
  background: rgba(255, 122, 90, 0.18);
}

body[data-theme="dark"] .page::after {
  background: rgba(183, 175, 166, 0.16);
}

.hero {
  margin-bottom: 36px;
}

.hero-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.toggle {
  min-width: 120px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.35em;
  font-size: 0.7rem;
  color: var(--muted);
  margin-bottom: 12px;
}

h1 {
  font-family: "DM Serif Display", "Times New Roman", serif;
  font-size: clamp(2.6rem, 6vw, 4.2rem);
  margin-bottom: 12px;
}

.subtitle {
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 480px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.panel {
  background: var(--panel);
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--panel-border);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

h2 {
  font-size: 1.3rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

label {
  display: grid;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--muted);
}

select {
  border-radius: 14px;
  border: 1px solid rgba(35, 31, 32, 0.16);
  padding: 10px 12px;
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--panel-strong);
}

.actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}

button {
  border-radius: 999px;
  padding: 12px 18px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  background: var(--accent);
  color: white;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 12px 28px var(--glow);
}

button:hover {
  transform: translateY(-2px);
}

button.secondary {
  background: #30233b;
  box-shadow: 0 10px 20px rgba(35, 31, 32, 0.2);
}

button.ghost {
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  border: 1px solid rgba(35, 31, 32, 0.1);
}

.result-panel {
  background: var(--panel-strong);
}

.pill {
  background: var(--pill-bg);
  color: var(--ink);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
}

.result {
  padding: 20px;
  border-radius: 20px;
  background: white;
  border: 1px dashed var(--result-border);
  animation: floatIn 0.4s ease;
}

body[data-theme="dark"] .result {
  background: #1a1320;
}

.result.rolling h3 {
  animation: slotShake 0.12s linear infinite;
}

.result.rolling .chip,
.result.rolling .reasons li {
  opacity: 0.4;
}

.result h3 {
  font-size: 1.6rem;
  margin-bottom: 8px;
}

.result p {
  color: var(--muted);
  margin-bottom: 12px;
}

.avatar-wrap {
  width: 160px;
  height: 160px;
  margin: 12px auto 16px;
  border-radius: 24px;
  background: linear-gradient(135deg, #fff1f8, #f1f7ff);
  display: grid;
  place-items: center;
  border: 1px solid rgba(47, 35, 50, 0.08);
  box-shadow: 0 16px 30px rgba(255, 126, 182, 0.22);
}

body[data-theme="dark"] .avatar-wrap {
  background: linear-gradient(135deg, #30203a, #1d1827);
  border-color: rgba(255, 255, 255, 0.08);
}

.avatar {
  width: 120px;
  height: 120px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.chip {
  background: var(--chip-bg);
  color: var(--chip-ink);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  text-transform: capitalize;
}

.mascot {
  margin-top: 22px;
}

.mascot-card {
  width: 150px;
  height: 180px;
  border-radius: 30px;
  background: linear-gradient(135deg, #ffe2f2, #f0f7ff);
  display: grid;
  place-items: center;
  position: relative;
  box-shadow: 0 20px 40px rgba(255, 126, 182, 0.25);
}

body[data-theme="dark"] .mascot-card {
  background: linear-gradient(135deg, #3a243f, #1f1a2b);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.mascot-head {
  width: 86px;
  height: 86px;
  background: #ffe9d6;
  border-radius: 35% 35% 40% 40%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  box-shadow: inset 0 -6px 0 rgba(255, 175, 149, 0.5);
}

.mascot-eye {
  width: 10px;
  height: 16px;
  background: #3a2c35;
  border-radius: 999px;
}

.mascot-smile {
  position: absolute;
  bottom: 18px;
  width: 28px;
  height: 14px;
  border-bottom: 4px solid #d66a7c;
  border-radius: 0 0 24px 24px;
}

.mascot-body {
  width: 110px;
  height: 60px;
  background: #ff9bc8;
  border-radius: 22px;
  position: absolute;
  bottom: 26px;
  box-shadow: inset 0 -8px 0 rgba(255, 122, 182, 0.6);
}

.mascot-heart {
  width: 22px;
  height: 22px;
  background: #ff5fa2;
  position: absolute;
  right: 26px;
  top: 22px;
  transform: rotate(45deg);
  border-radius: 6px;
  box-shadow: -7px 7px 0 #ff5fa2;
}

.mascot-heart::before,
.mascot-heart::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  background: #ff5fa2;
  border-radius: 50%;
}

.mascot-heart::before {
  top: -11px;
  left: 0;
}

.mascot-heart::after {
  left: -11px;
  top: 0;
}

body[data-theme="dark"] .mascot-head {
  background: #f4d9cc;
}

.reasons {
  list-style: none;
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
}

.secondary-panel {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(35, 31, 32, 0.1);
}

.secondary-panel h3 {
  margin-bottom: 10px;
}

.history {
  list-style: none;
  display: grid;
  gap: 6px;
  color: var(--muted);
}

.footer {
  margin-top: 32px;
  color: var(--muted);
  font-size: 0.95rem;
}

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

@keyframes slotShake {
  0% {
    transform: translateY(-2px);
  }
  50% {
    transform: translateY(2px);
  }
  100% {
    transform: translateY(-2px);
  }
}

@media (max-width: 720px) {
  .page {
    padding: 32px 16px 48px;
  }

  .hero-row {
    align-items: flex-start;
  }

  .panel {
    padding: 20px;
  }

  .actions {
    flex-direction: column;
  }

  button {
    width: 100%;
  }
}
