* { box-sizing: border-box; }

:root {
  --bg: #0a0a1a;
  --panel: #121225;
  --panel-2: #1d1635;
  --text: #f0e6d2;
  --muted: #c5b8dd;
  --accent: #8b5cf6;
  --accent-dark: #4c1d95;
  --accent-hover: #6d28d9;
  --border: #312e52;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top, rgba(139,92,246,0.18), transparent 24%),
    linear-gradient(180deg, #090914 0%, #0f1024 100%);
  color: var(--text);
  font-family: "Hiragino Sans", "Yu Gothic", sans-serif;
}

.app-shell { width: min(100%, 480px); margin: 0 auto; padding: 18px 14px 28px; }
.hero { text-align: center; margin-bottom: 14px; }
.hero-kicker, .hero-sub, .hint, .hint-inline, .status-subtext, #charCount, #selectedGenreLabel, .footer-note { color: var(--muted); }
.hero h1 { margin: 8px 0 6px; font-size: 1.95rem; font-family: "Hiragino Mincho ProN", "Yu Mincho", serif; text-shadow: 0 0 18px rgba(139,92,246,.25); }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 18px; padding: 14px; margin-bottom: 12px; box-shadow: 0 10px 24px rgba(0,0,0,.28); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.section-head h2, .section-head label { margin: 0; font-size: 1rem; font-weight: 700; }
textarea { width: 100%; min-height: 132px; resize: vertical; border-radius: 14px; border: 1px solid var(--border); background: #111222; padding: 12px 14px; color: var(--text); font-size: 1rem; line-height: 1.6; }
textarea:focus { outline: 2px solid rgba(139,92,246,.18); border-color: var(--accent); }
.dpad-wrap { width: 260px; height: 260px; margin: 4px auto 0; position: relative; }
.dpad-btn, .dpad-center { position: absolute; border-radius: 999px; }
.dpad-btn { width: 88px; height: 88px; border: 1px solid var(--border); background: var(--panel-2); color: var(--text); font-size: 1.2rem; font-weight: 700; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; box-shadow: 0 8px 18px rgba(0,0,0,.35); }
.dpad-btn span { font-size: .84rem; }
.dpad-btn.active { background: var(--accent); color: #f8f3ff; border-color: transparent; box-shadow: 0 0 20px rgba(139,92,246,.32); }
.dpad-btn.up { top: 0; left: 50%; transform: translateX(-50%); }
.dpad-btn.down { bottom: 0; left: 50%; transform: translateX(-50%); }
.dpad-btn.left { left: 0; top: 50%; transform: translateY(-50%); }
.dpad-btn.right { right: 0; top: 50%; transform: translateY(-50%); }
.dpad-center { width: 102px; height: 102px; left: 50%; top: 50%; transform: translate(-50%, -50%); background: #101225; border: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 8px; }
.genre-chip-label { font-size: .7rem; color: var(--muted); }
#selectedMoodLabel { font-weight: 700; font-size: .88rem; }
.genre-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.genre-btn, .player-actions button, .download-link, .generate-btn { border-radius: 14px; font-weight: 700; }
.genre-btn { min-height: 46px; border: 1px solid var(--border); background: var(--panel-2); color: var(--text); }
.genre-btn.active { background: var(--accent); color: #f8f3ff; border-color: transparent; }
.preview-card pre { margin: 0; white-space: pre-wrap; word-break: break-word; font-size: .84rem; line-height: 1.5; background: #111225; border: 1px solid var(--border); border-radius: 12px; padding: 12px; color: var(--text); }
.generate-btn { width: 100%; border: none; background: linear-gradient(180deg, var(--accent-dark), var(--accent-hover)); color: #f8f3ff; padding: 16px; font-size: 1.08rem; box-shadow: 0 12px 24px rgba(76,29,149,.32); margin-bottom: 12px; }
.generate-btn:disabled { opacity: .6; }
.hidden { display: none; }
.status-card { text-align: center; }
.loading-orb { width: 42px; height: 42px; border-radius: 999px; margin: 0 auto 10px; border: 4px solid rgba(139,92,246,.14); border-top-color: var(--accent); animation: spin 1s linear infinite; }
.progress-track { height: 10px; background: rgba(255,255,255,.08); border-radius: 999px; overflow: hidden; margin-top: 12px; }
#progressBar { height: 100%; width: 6%; background: linear-gradient(90deg, var(--accent), var(--accent-hover)); transition: width .5s ease; }
audio { width: 100%; margin: 8px 0 12px; }
.player-actions { display: flex; gap: 8px; }
.player-actions button, .download-link { flex: 1; min-height: 44px; border: 1px solid var(--border); background: var(--panel-2); color: var(--text); text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.download-link { flex: 0 0 auto; padding: 0 14px; }
.footer-note { text-align: center; font-size: .82rem; padding-top: 4px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 380px) {
  .app-shell { padding-inline: 10px; }
  .dpad-wrap { width: 236px; height: 236px; }
  .dpad-btn { width: 80px; height: 80px; }
  .dpad-center { width: 92px; height: 92px; }
}
