﻿:root {
  color-scheme: light;
  --bg: #fff4f7;
  --ink: #2b1f27;
  --muted: #7a6271;
  --accent: #ff7aa2;
  --accent-2: #7ed6c6;
  --card: #fff9f5;
  --shadow: rgba(43, 31, 39, 0.14);
  --ring: rgba(255, 122, 162, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Palatino Linotype", "Book Antiqua", "Garamond", serif;
  background:
    radial-gradient(1200px 600px at 10% 10%, #fff, transparent 70%),
    radial-gradient(900px 500px at 90% 0%, #ffe1ed, transparent 60%),
    linear-gradient(160deg, #fff4f7 0%, #ffe9f1 40%, #f7f5ff 100%);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 18px 56px;
  position: relative;
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  width: 320px;
  height: 320px;
  border-radius: 48% 52% 60% 40% / 42% 38% 62% 58%;
  filter: blur(2px);
  z-index: -1;
  opacity: 0.55;
}

body::before {
  top: -120px;
  right: -80px;
  background: radial-gradient(circle, #ffd4e4 0%, transparent 70%);
}

body::after {
  bottom: -140px;
  left: -60px;
  background: radial-gradient(circle, #c9f3ea 0%, transparent 70%);
}

.stage {
  width: min(1080px, 100%);
  display: grid;
  gap: 28px;
}

header {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: flex-end;
  justify-content: space-between;
}

.title {
  display: grid;
  gap: 6px;
}

.title h1 {
  margin: 0;
  font-size: clamp(32px, 4vw, 52px);
  letter-spacing: 0.02em;
  font-family: "Bodoni MT", "Didot", "Garamond", serif;
}

.title p {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.badge {
  padding: 8px 14px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid rgba(43, 31, 39, 0.08);
  box-shadow: 0 8px 18px var(--shadow);
  font-size: 0.95rem;
}

.panel {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 24px;
}

.card {
  background: var(--card);
  border-radius: 26px;
  padding: 26px;
  box-shadow: 0 20px 50px var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.7);
  position: relative;
  overflow: hidden;
}

.card::after {
  content: "";
  position: absolute;
  inset: auto -80px -80px auto;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, rgba(255, 122, 162, 0.16), transparent 70%);
  pointer-events: none;
}

.draw-area {
  display: grid;
  gap: 22px;
}

.balls {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  min-height: 80px;
}

.ball {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  font-weight: 700;
  color: #fff;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.4),
    0 12px 24px rgba(43, 31, 39, 0.25);
  transform: translateY(14px) scale(0.95);
  opacity: 0;
  animation: pop 0.55s ease forwards;
}

.ball:nth-child(1) {
  animation-delay: 0.05s;
}
.ball:nth-child(2) {
  animation-delay: 0.14s;
}
.ball:nth-child(3) {
  animation-delay: 0.23s;
}
.ball:nth-child(4) {
  animation-delay: 0.32s;
}
.ball:nth-child(5) {
  animation-delay: 0.41s;
}
.ball:nth-child(6) {
  animation-delay: 0.5s;
}

@keyframes pop {
  0% {
    transform: translateY(18px) scale(0.9);
    opacity: 0;
  }
  60% {
    transform: translateY(-6px) scale(1.03);
    opacity: 1;
  }
  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.ball.low {
  background: linear-gradient(145deg, #ffb5cc, #ff7aa2);
}
.ball.mid {
  background: linear-gradient(145deg, #7ed6c6, #40bba6);
}
.ball.high {
  background: linear-gradient(145deg, #8a7bff, #5a4ed4);
}
.ball.top {
  background: linear-gradient(145deg, #ff9b6a, #f46e48);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

button {
  border: none;
  border-radius: 999px;
  padding: 12px 20px;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

button:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 2px;
}

.primary {
  background: linear-gradient(135deg, #ff7aa2, #ffb4c9);
  color: #fff;
  box-shadow: 0 12px 22px rgba(255, 122, 162, 0.35);
}

.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 26px rgba(255, 122, 162, 0.45);
}

.ghost {
  background: #fff;
  color: var(--ink);
  border: 1px solid rgba(43, 31, 39, 0.12);
}

.ghost:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 18px rgba(43, 31, 39, 0.12);
}

.meta {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.95rem;
}

.meta span {
  display: flex;
  gap: 6px;
  align-items: center;
}

.history {
  display: grid;
  gap: 12px;
}

.history h2,
.wish h2 {
  margin: 0;
  font-size: 1.25rem;
  font-family: "Bodoni MT", "Didot", "Garamond", serif;
}

.history-list {
  display: grid;
  gap: 10px;
  max-height: 320px;
  overflow: auto;
  padding-right: 8px;
}

.history-item {
  background: #fff;
  border-radius: 16px;
  padding: 12px 16px;
  display: grid;
  gap: 8px;
  border: 1px solid rgba(43, 31, 39, 0.08);
}

.history-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.history-item span {
  color: var(--muted);
  font-size: 0.9rem;
}

.history-numbers {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.history-text {
  font-size: 0.92rem;
  color: var(--muted);
  letter-spacing: 0.03em;
}

.history-ball {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.95rem;
  color: #fff;
  font-weight: 600;
}

.note {
  color: var(--muted);
  font-size: 0.9rem;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.stat {
  background: #fff;
  border-radius: 16px;
  padding: 12px 14px;
  border: 1px solid rgba(43, 31, 39, 0.08);
  display: grid;
  gap: 4px;
}

.stat strong {
  font-size: 1.1rem;
}

.wish {
  display: grid;
  gap: 12px;
  text-align: center;
}

.wish-text {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

.footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.fade-in {
  opacity: 0;
  transform: translateY(12px);
  animation: fade 0.6s ease forwards;
}

.fade-in.delay {
  animation-delay: 0.2s;
}

@keyframes fade {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 920px) {
  .panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .ball {
    width: 52px;
    height: 52px;
  }

  .history-list {
    max-height: none;
  }

  .stat-grid {
    grid-template-columns: 1fr;
  }
}
