

:root {
  --bg-deep: #0f0824;
  --bg-mid: #1c1046;
  --bg-panel: rgba(28, 16, 70, 0.85);
  --neon-purple: #a855f7;
  --neon-pink: #ec4899;
  --neon-cyan: #22d3ee;
  --gold: #fbbf24;
  --gold-glow: #fcd34d;
  --text-main: #f8f5ff;
  --text-sub: #b8a8e0;
  --border-neon: rgba(168, 85, 247, 0.5);
  --radius: 18px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", Meiryo, sans-serif;
  background: radial-gradient(ellipse at top, var(--bg-mid), var(--bg-deep) 60%);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
}

.starfield {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.starfield span {
  position: absolute;
  width: 3px;
  height: 3px;
  background: #fff;
  border-radius: 50%;
  opacity: 0;
  animation: twinkle 4s infinite ease-in-out;
  box-shadow: 0 0 6px #fff, 0 0 12px var(--neon-purple);
}
.starfield span:nth-child(1)  { top: 8%;  left: 12%; animation-delay: 0s; }
.starfield span:nth-child(2)  { top: 15%; left: 78%; animation-delay: 0.5s; }
.starfield span:nth-child(3)  { top: 25%; left: 45%; animation-delay: 1.2s; }
.starfield span:nth-child(4)  { top: 35%; left: 88%; animation-delay: 1.8s; }
.starfield span:nth-child(5)  { top: 42%; left: 8%;  animation-delay: 2.3s; }
.starfield span:nth-child(6)  { top: 55%; left: 60%; animation-delay: 2.8s; }
.starfield span:nth-child(7)  { top: 62%; left: 22%; animation-delay: 0.3s; }
.starfield span:nth-child(8)  { top: 70%; left: 92%; animation-delay: 1.5s; }
.starfield span:nth-child(9)  { top: 78%; left: 35%; animation-delay: 2.0s; }
.starfield span:nth-child(10) { top: 85%; left: 70%; animation-delay: 0.8s; }
.starfield span:nth-child(11) { top: 12%; left: 32%; animation-delay: 3.0s; }
.starfield span:nth-child(12) { top: 48%; left: 50%; animation-delay: 3.5s; }
.starfield span:nth-child(13) { top: 22%; left: 65%; animation-delay: 1.0s; }
.starfield span:nth-child(14) { top: 88%; left: 15%; animation-delay: 2.5s; }
.starfield span:nth-child(15) { top: 5%;  left: 55%; animation-delay: 3.2s; }

@keyframes twinkle {
  0%, 100% { opacity: 0; transform: scale(0.6); }
  50%      { opacity: 1; transform: scale(1.2); }
}

.app-header {
  background: linear-gradient(180deg, rgba(28, 16, 70, 0.9), rgba(15, 8, 36, 0.9));
  border-bottom: 2px solid var(--neon-purple);
  padding: 18px 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  position: relative;
  z-index: 1;
  box-shadow: 0 0 30px rgba(168, 85, 247, 0.4);
}

.logo-mark {
  font-size: 2.4rem;
  filter: drop-shadow(0 0 8px var(--gold-glow));
  animation: coin-spin 3s infinite ease-in-out;
}
@keyframes coin-spin {
  0%, 100% { transform: rotateY(0deg); }
  50%      { transform: rotateY(180deg); }
}

.header-text { display: flex; flex-direction: column; }

.app-title {
  font-size: 1.9rem;
  font-weight: 900;
  color: var(--text-main);
  letter-spacing: 0.04em;
  text-shadow: 0 0 12px var(--neon-purple), 0 0 24px var(--neon-purple);
  line-height: 1;
}
.title-accent {
  background: linear-gradient(90deg, var(--gold), var(--neon-pink), var(--gold));
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shine 3s linear infinite;
}
@keyframes shine {
  to { background-position: 200% center; }
}

.app-tagline {
  font-size: 0.85rem;
  color: var(--text-sub);
  margin-top: 4px;
  letter-spacing: 0.05em;
}

.flow-container {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(280px, 1fr));
  gap: 20px;
  padding: 28px 24px;
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
  align-items: start;
  position: relative;
  z-index: 1;
}

.panel {
  background: var(--bg-panel);
  border-radius: var(--radius);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  position: relative;
  backdrop-filter: blur(8px);
  border: 2px solid transparent;
  transition: transform 0.3s, box-shadow 0.3s;
}
.panel:hover { transform: translateY(-3px); }

.panel-step1 {
  border-color: var(--neon-purple);
  box-shadow: 0 0 25px rgba(168, 85, 247, 0.3), inset 0 0 20px rgba(168, 85, 247, 0.1);
}
.panel-step2 {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 25px rgba(34, 211, 238, 0.3), inset 0 0 20px rgba(34, 211, 238, 0.1);
}
.panel-step3 {
  border-color: var(--gold);
  box-shadow: 0 0 25px rgba(251, 191, 36, 0.4), inset 0 0 20px rgba(251, 191, 36, 0.1);
}

.step-badge {
  position: absolute;
  top: -14px;
  left: 20px;
  background: linear-gradient(135deg, var(--neon-purple), var(--neon-pink));
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 5px 14px;
  border-radius: 20px;
  letter-spacing: 0.1em;
  box-shadow: 0 3px 10px rgba(168, 85, 247, 0.6);
}
.badge-cyan {
  background: linear-gradient(135deg, var(--neon-cyan), #0891b2);
  box-shadow: 0 3px 10px rgba(34, 211, 238, 0.6);
}
.badge-gold {
  background: linear-gradient(135deg, var(--gold), #ea580c);
  box-shadow: 0 3px 10px rgba(251, 191, 36, 0.6);
  color: #1a0a30;
}

.panel-title {
  font-size: 1.15rem;
  font-weight: 800;
  text-align: center;
  letter-spacing: 0.02em;
}

.panel-hint {
  font-size: 0.85rem;
  color: var(--text-sub);
  text-align: center;
}

.panel-step2.is-waiting .roulette-wrap,
.panel-step2.is-waiting #btn-spin-sub {
  opacity: 0.3;
  filter: grayscale(0.8);
  pointer-events: none;
}

.roulette-wrap {
  position: relative;
  width: min(280px, 80vw);
  transition: opacity 0.4s, filter 0.4s;
}

.wheel-glow {
  position: absolute;
  inset: -20px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.4), transparent 70%);
  animation: pulse-glow 2s infinite ease-in-out;
  z-index: 0;
}
.glow-cyan {
  background: radial-gradient(circle, rgba(34, 211, 238, 0.4), transparent 70%);
}
@keyframes pulse-glow {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.05); }
}

.roulette-wheel {
  width: 100%;
  height: auto;
  display: block;
  transform: rotate(0deg);
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.5));
}

.roulette-pointer {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 15px solid transparent;
  border-right: 15px solid transparent;
  border-top: 26px solid var(--gold);
  z-index: 3;
  filter: drop-shadow(0 0 8px var(--gold-glow));
}
.pointer-cyan { border-top-color: var(--neon-cyan); filter: drop-shadow(0 0 8px var(--neon-cyan)); }

.btn {
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 800;
  border: none;
  border-radius: 12px;
  padding: 14px 34px;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.15s, filter 0.15s;
  text-align: center;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #fff;
  letter-spacing: 0.05em;
  position: relative;
  overflow: hidden;
}
.btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: btn-shine 3s infinite;
}
@keyframes btn-shine {
  to { left: 100%; }
}
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn:disabled::before { animation: none; }
.btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

.btn-icon { font-size: 1.2rem; }

.btn-primary {
  background: linear-gradient(135deg, var(--neon-pink), var(--neon-purple));
  box-shadow: 0 4px 0 #6d28d9, 0 0 20px rgba(236, 72, 153, 0.6);
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.15); }

.btn-secondary {
  background: linear-gradient(135deg, var(--neon-cyan), #0891b2);
  box-shadow: 0 4px 0 #0e7490, 0 0 20px rgba(34, 211, 238, 0.6);
}
.btn-secondary:hover:not(:disabled) { filter: brightness(1.15); }

.btn-link {
  background: linear-gradient(135deg, var(--gold), #f97316);
  box-shadow: 0 4px 0 #c2410c, 0 0 20px rgba(251, 191, 36, 0.6);
  color: #1a0a30;
  width: 100%;
  margin-top: 12px;
}
.btn-link:hover { filter: brightness(1.1); }

.result-label {
  font-weight: 800;
  font-size: 1.15rem;
  min-height: 1.4em;
  text-align: center;
  text-shadow: 0 0 10px currentColor;
}
.panel-step1 .result-label { color: var(--neon-pink); }
.panel-step2 .result-label { color: var(--neon-cyan); }

.recipe-card {
  position: relative;
  width: 100%;
  border: 2px solid var(--gold);
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(180deg, #fffdf5, #fff8e1);
  color: #1a0a30;
  animation: pop-in 0.5s cubic-bezier(0.2, 1.4, 0.4, 1);
  box-shadow: 0 0 30px rgba(251, 191, 36, 0.5);
}

@keyframes pop-in {
  0%   { transform: scale(0.7) rotate(-8deg); opacity: 0; }
  60%  { transform: scale(1.08) rotate(2deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.stamp {
  position: absolute;
  top: 12px;
  right: 12px;
  background: linear-gradient(135deg, var(--neon-pink), var(--neon-purple));
  color: #fff;
  font-weight: 900;
  font-size: 0.85rem;
  padding: 12px 10px;
  border-radius: 50%;
  transform: rotate(15deg);
  z-index: 2;
  box-shadow: 0 4px 12px rgba(236, 72, 153, 0.6);
  border: 2px solid #fff;
  animation: stamp-pop 0.6s ease-out;
}
@keyframes stamp-pop {
  0%   { transform: scale(0) rotate(180deg); }
  60%  { transform: scale(1.3) rotate(0deg); }
  100% { transform: scale(1) rotate(15deg); }
}

.recipe-img {
  width: 100%;
  height: 190px;
  object-fit: cover;
  display: block;
  background: #eee;
}

.recipe-body { padding: 16px; }

.recipe-title {
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 8px;
  color: #3a1e5c;
}

.recipe-meta {
  font-size: 0.85rem;
  color: #d97706;
  font-weight: 700;
  display: flex;
  gap: 14px;
  margin-bottom: 10px;
}

.recipe-materials-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #6b21a8;
  margin-bottom: 2px;
}

.recipe-materials {
  font-size: 0.85rem;
  line-height: 1.5;
  margin-bottom: 10px;
  color: #4a3560;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.recipe-desc {
  font-size: 0.82rem;
  color: #6b5b7a;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.recipe-status {
  color: var(--text-sub);
  font-size: 0.95rem;
  text-align: center;
  line-height: 1.8;
  padding: 30px 10px;
}
.recipe-status.is-error {
  color: var(--neon-pink);
  font-weight: 700;
  text-shadow: 0 0 10px var(--neon-pink);
}

.hidden { display: none !important; }

.app-footer {
  background: rgba(15, 8, 36, 0.9);
  border-top: 1px solid var(--border-neon);
  padding: 16px 24px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-sub);
  position: relative;
  z-index: 1;
  line-height: 1.6;
}
.disclaimer { margin-bottom: 6px; }
.disclaimer strong { color: var(--gold); }
.credit-link {
  color: var(--neon-cyan);
  text-decoration: none;
  display: inline-block;
  margin-top: 6px;
}
.credit-link:hover { text-shadow: 0 0 8px var(--neon-cyan); }

@media (max-width: 980px) {
  .flow-container { grid-template-columns: 1fr; max-width: 560px; }
  .app-title { font-size: 1.5rem; }
  .logo-mark { font-size: 2rem; }
}

@media (prefers-reduced-motion: reduce) {
  .roulette-wheel,
  .starfield span,
  .logo-mark,
  .title-accent,
  .wheel-glow,
  .btn::before,
  .recipe-card,
  .stamp {
    animation: none !important;
    transition: none !important;
  }
}