:root {
  --bg: #0b1016;
  --bg-deep: #080c11;
  --card: #151c25;
  --card-border: #1f2a36;
  --text: #e9edf3;
  --muted: #8d97a6;
  --accent: #ff3b3b;
  --accent-dark: #c82034;
  --accent-soft: rgba(255, 59, 59, 0.15);
  --glow: rgba(255, 74, 74, 0.3);
  --shadow: 0 30px 70px rgba(3, 6, 12, 0.55);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Zen Kaku Gothic New", "Hiragino Kaku Gothic ProN", "Meiryo",
    sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top, #1e2a37 0%, transparent 55%),
    radial-gradient(circle at 10% 30%, rgba(255, 59, 59, 0.18), transparent 60%),
    linear-gradient(135deg, var(--bg), var(--bg-deep));
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(
      circle at 20% 20%,
      rgba(255, 255, 255, 0.08),
      transparent 40%
    ),
    repeating-linear-gradient(
      120deg,
      rgba(255, 255, 255, 0.05),
      rgba(255, 255, 255, 0.05) 1px,
      transparent 1px,
      transparent 12px
    );
  opacity: 0.25;
  pointer-events: none;
  z-index: 0;
}

.wrap {
  position: relative;
  z-index: 1;
  max-width: 980px;
  margin: 0 auto;
  padding: 72px 20px 90px;
}

.hero {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  animation: fadeIn 0.8s ease forwards;
}

.hero-tag {
  font-size: 12px;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: rgba(255, 59, 59, 0.12);
}

.hero h1 {
  font-family: "Bebas Neue", "Oswald", sans-serif;
  font-size: clamp(48px, 9vw, 104px);
  letter-spacing: 0.18em;
  margin: 0;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

.btn {
  cursor: pointer;
  border: none;
  padding: 14px 28px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.08em;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.btn.primary {
  background: linear-gradient(120deg, var(--accent), var(--accent-dark));
  color: #fff;
  box-shadow: 0 14px 40px var(--glow);
}

.btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 45px rgba(255, 72, 72, 0.45);
}

.btn.secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn.ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.btn.ghost:hover,
.btn.secondary:hover {
  transform: translateY(-2px);
}

.is-hidden {
  display: none !important;
}

.result {
  display: none;
  margin-top: 36px;
}

.result.is-visible {
  display: block;
  animation: fadeUp 0.6s ease forwards;
}

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: rgba(8, 12, 18, 0.6);
  border-radius: 24px;
  padding: 24px 28px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
}

.fortune-area {
  display: flex;
  align-items: center;
  gap: 24px;
}

.fortune-badge {
  width: 120px;
  height: 120px;
  border-radius: 999px;
  border: 4px solid var(--accent);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-size: 28px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.05);
  text-shadow: 0 0 15px rgba(255, 59, 59, 0.3);
}

.pani-img,
.pani-label {
  display: none;
}

.fortune-area.is-pani .fortune-badge {
  display: none;
}

.fortune-area.is-pani .pani-img,
.fortune-area.is-pani .pani-label {
  display: block;
}

.pani-img {
  width: min(220px, 50vw);
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.5));
}

.pani-label {
  font-size: 22px;
  letter-spacing: 0.2em;
  color: var(--accent);
  text-align: center;
}

.total {
  text-align: right;
}

.total-label {
  display: block;
  font-size: 14px;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.total-value {
  font-size: 38px;
  font-weight: 700;
  color: #fff;
}

.result-grid {
  margin-top: 26px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

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

.result-card h2 {
  margin: 0 0 10px;
  font-size: 18px;
  letter-spacing: 0.1em;
}

.stars {
  display: flex;
  gap: 6px;
  font-size: 22px;
  margin-bottom: 8px;
}

.star {
  line-height: 1;
}

.star.filled {
  color: var(--accent);
  text-shadow: 0 0 12px rgba(255, 59, 59, 0.35);
}

.star.empty {
  color: #4a5867;
}

.comment {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.actions {
  margin-top: 26px;
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

body.result-mode .wrap {
  min-height: 100vh;
  padding: 24px 18px 28px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

body.result-mode .hero {
  display: none;
}

body.result-mode .result {
  margin-top: 0;
}

body.result-mode .result.is-visible {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

body.result-mode .result-head {
  padding: clamp(16px, 2vw, 22px);
  gap: 16px;
  flex-wrap: wrap;
}

body.result-mode .fortune-area {
  gap: 16px;
}

body.result-mode .fortune-badge {
  width: clamp(82px, 18vw, 110px);
  height: clamp(82px, 18vw, 110px);
  font-size: clamp(20px, 4vw, 26px);
  border-width: 3px;
}

body.result-mode .pani-img {
  width: min(180px, 40vw);
}

body.result-mode .total-value {
  font-size: clamp(28px, 5vw, 36px);
}

body.result-mode .result-grid {
  margin-top: 0;
  gap: 12px;
}

body.result-mode .result-card {
  padding: 14px 16px;
  border-radius: 16px;
}

body.result-mode .result-card h2 {
  font-size: 15px;
  margin-bottom: 6px;
}

body.result-mode .stars {
  font-size: 18px;
  margin-bottom: 6px;
}

body.result-mode .comment {
  font-size: 12px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

body.result-mode .actions {
  margin-top: 8px;
  gap: 10px;
}

body.result-mode .btn {
  padding: 10px 20px;
  font-size: 14px;
}

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

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

@media (max-width: 720px) {
  .wrap {
    padding: 56px 18px 70px;
  }

  .result-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .fortune-area {
    width: 100%;
    justify-content: space-between;
  }

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

  .total {
    width: 100%;
    text-align: left;
  }

  .pani-img {
    width: min(200px, 70vw);
  }

  body.result-mode .result-head {
    flex-direction: row;
    align-items: center;
  }

  body.result-mode .fortune-area {
    width: auto;
    justify-content: flex-start;
  }

  body.result-mode .total {
    width: auto;
    text-align: right;
  }

  body.result-mode .result-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-height: 680px) {
  body.result-mode .wrap {
    padding: 16px 14px 18px;
  }

  body.result-mode .result-head {
    padding: 14px 14px;
  }

  body.result-mode .result-card {
    padding: 12px 12px;
  }

  body.result-mode .comment {
    -webkit-line-clamp: 1;
  }

  body.result-mode .btn {
    padding: 8px 16px;
    font-size: 13px;
  }
}
