:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --text: #1f2330;
  --text-muted: #5b6275;
  --border: #e6e9f0;
  --primary: #d22c2c;
  --primary-dark: #a82020;
  --accent: #ffc83d;

  --ball-yellow: #fbc400;
  --ball-blue: #69c8f2;
  --ball-red: #ff7272;
  --ball-gray: #aaaaaa;
  --ball-green: #b0d840;

  --shadow-sm: 0 2px 6px rgba(20, 24, 40, 0.06);
  --shadow-md: 0 8px 24px rgba(20, 24, 40, 0.08);
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

.nav {
  display: flex;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.nav-link {
  flex: 1;
  text-align: center;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 8px;
  transition: background .15s, color .15s;
}

.nav-link:hover { color: var(--text); background: #f7f8fb; }

.nav-link.active {
  background: var(--primary);
  color: #fff;
}

.hero {
  text-align: center;
  margin-bottom: 28px;
}

.badge {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 12px;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -0.5px;
}

.subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.6;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.input-card { margin-bottom: 20px; }

.field { margin-bottom: 16px; }
.field:last-of-type { margin-bottom: 18px; }

.label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text);
}

input[type="text"],
input[type="date"] {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-family: inherit;
  outline: none;
  transition: border-color .15s;
}

input[type="text"]:focus,
input[type="date"]:focus { border-color: var(--primary); }

.gender-group {
  display: flex;
  gap: 8px;
}

.gender-option {
  flex: 1;
  position: relative;
  cursor: pointer;
}

.gender-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.gender-option span {
  display: block;
  text-align: center;
  padding: 11px 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all .15s;
}

.gender-option:hover span { border-color: #d0d4de; }

.gender-option input[type="radio"]:checked + span {
  border-color: var(--primary);
  background: #fff5f5;
  color: var(--primary);
}

.gender-option input[type="radio"]:focus-visible + span {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.primary-btn {
  padding: 13px 22px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, transform .05s;
}

.primary-btn.full { width: 100%; }

.action-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ghost-btn.full { width: 100%; }

.section-title {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

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

.chip {
  padding: 8px 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
}

.chip:hover {
  background: #fff5f5;
  border-color: var(--primary);
  color: var(--primary);
}

.link-card { margin-top: 16px; }

.link-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.link-list li + li { margin-top: 8px; }

.link-list a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  transition: background .15s, border-color .15s;
}

.link-list a:hover {
  background: #f7f8fb;
  border-color: #d0d4de;
}

.link-list strong {
  font-size: 14px;
  font-weight: 700;
}

.link-list span {
  font-size: 12px;
  color: var(--text-muted);
}

.primary-btn:hover { background: var(--primary-dark); }
.primary-btn:active { transform: translateY(1px); }
.primary-btn:disabled { background: #ccc; cursor: not-allowed; }

.hint {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.result { display: block; }

.fortune-card {
  margin-bottom: 18px;
  background: linear-gradient(135deg, #fff7e6 0%, #fffaf0 100%);
  border-color: #f4dfa6;
}

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

.fortune-label {
  display: inline-block;
  background: var(--accent);
  color: #5a3d00;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
}

.fortune-date {
  font-size: 13px;
  color: var(--text-muted);
}

.fortune-message {
  margin: 6px 0 16px;
  font-size: 16px;
  line-height: 1.6;
  font-weight: 500;
}

.fortune-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding-top: 14px;
  border-top: 1px dashed #e8d8a8;
}

.fortune-meta > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.fortune-meta span {
  font-size: 12px;
  color: var(--text-muted);
}

.fortune-meta strong {
  font-size: 14px;
  font-weight: 700;
}

.sets {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
}

.set-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  box-shadow: var(--shadow-sm);
  animation: slideUp .35s ease both;
}

.set-row .set-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 28px;
}

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

.ball {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  text-shadow: 0 1px 1px rgba(0,0,0,0.15);
  box-shadow:
    inset -2px -3px 4px rgba(0,0,0,0.18),
    inset 2px 2px 4px rgba(255,255,255,0.35),
    0 2px 4px rgba(0,0,0,0.1);
  animation: pop .3s ease both;
}

.ball.c1 { background: var(--ball-yellow); color: #6b4d00; text-shadow: none; }
.ball.c2 { background: var(--ball-blue); }
.ball.c3 { background: var(--ball-red); }
.ball.c4 { background: var(--ball-gray); }
.ball.c5 { background: var(--ball-green); color: #2d4500; text-shadow: none; }

.actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.ghost-btn {
  padding: 10px 18px;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, border-color .15s;
}

.ghost-btn:hover { background: #f7f8fb; border-color: #d0d4de; }

.footer {
  margin-top: 28px;
  text-align: center;
}

.footer p {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
}

.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(31, 35, 48, 0.92);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 100;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@keyframes pop {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

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

@media (max-width: 480px) {
  .hero h1 { font-size: 22px; }
  .ball { width: 34px; height: 34px; font-size: 14px; }
  .set-row { padding: 12px 14px; gap: 10px; }
  .fortune-meta { grid-template-columns: 1fr; gap: 6px; }
  .fortune-meta > div { flex-direction: row; justify-content: space-between; }
}
