/* ============================================
   NocturneSuite Taste Sampler — Styles
   Dark nocturnal theme · Mobile-first
   ============================================ */

:root {
  --bg-deep: #06060f;
  --bg-primary: #0a0a1a;
  --bg-card: #111128;
  --bg-card-hover: #1a1a3e;
  --bg-selected: #1e1a4a;
  --border-subtle: rgba(120, 100, 255, 0.12);
  --border-glow: rgba(120, 100, 255, 0.35);
  --text-primary: #f0eef6;
  --text-secondary: #9892b0;
  --text-muted: #5e5878;
  --accent-purple: #7c6aff;
  --accent-violet: #9d7fff;
  --accent-cyan: #00e5d0;
  --accent-pink: #ff6bb0;
  --accent-amber: #ffc857;
  --gradient-main: linear-gradient(135deg, #7c6aff 0%, #9d7fff 50%, #00e5d0 100%);
  --gradient-card: linear-gradient(145deg, rgba(124, 106, 255, 0.08) 0%, rgba(0, 229, 208, 0.05) 100%);
  --shadow-glow: 0 0 30px rgba(124, 106, 255, 0.2);
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --transition-fast: 0.15s ease;
  --transition-med: 0.3s ease;
  --transition-slow: 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-main);
  background: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Background Canvas ── */
.bg-canvas {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  z-index: 0; pointer-events: none;
  opacity: 0.4;
}

/* ── App Container ── */
.sampler-app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ── */
.sampler-header {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  background: rgba(10, 10, 26, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
}

.logo-wrap {
  display: flex; align-items: center; gap: 8px;
}

.logo-mark {
  font-size: 22px;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-text {
  font-size: 15px; font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.step-indicator {
  display: flex; gap: 8px; align-items: center;
}

.step-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: all var(--transition-med);
}

.step-dot.active {
  width: 28px; border-radius: 4px;
  background: var(--gradient-main);
  box-shadow: 0 0 12px rgba(124, 106, 255, 0.4);
}

/* ── Phases ── */
.phase {
  display: flex;
  flex: 1;
  animation: fadeSlideIn 0.6s var(--transition-slow) both;
}

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

.phase-content, .analyze-content, .reveal-content, .share-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 24px 20px 40px;
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
}

/* ── Phase 1: Selection ── */
.phase-title {
  font-size: clamp(24px, 5vw, 36px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 8px;
}

.phase-subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 28px;
  line-height: 1.5;
}

/* ── Tile Grid ── */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  flex: 1;
  align-content: start;
}

.tile {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all var(--transition-med);
  background: var(--bg-card);
}

.tile::before {
  content: '';
  position: absolute; inset: 0;
  background: var(--gradient-card);
  opacity: 0;
  transition: opacity var(--transition-med);
  z-index: 1;
}

.tile:hover::before, .tile:active::before { opacity: 1; }

.tile.selected {
  border-color: var(--accent-purple);
  background: var(--bg-selected);
  box-shadow: var(--shadow-glow);
}

.tile.selected::after {
  content: '✓';
  position: absolute;
  top: 8px; right: 8px;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--accent-purple);
  color: white;
  font-size: 14px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  z-index: 3;
  box-shadow: 0 2px 8px rgba(124, 106, 255, 0.5);
}

.tile-thumb {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}

.tile-placeholder {
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 8px;
  padding: 12px;
}

.tile-icon {
  font-size: 32px;
  filter: grayscale(0.3);
}

.tile-label {
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  color: var(--text-secondary);
  line-height: 1.2;
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}

.tile-overlay {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 32px 8px 8px;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  z-index: 2;
}

/* ── Selection Bar ── */
.selection-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 0 0;
  margin-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

.selection-count {
  font-size: 14px; font-weight: 500;
  color: var(--text-secondary);
}

.selection-count span {
  color: var(--accent-purple);
  font-weight: 700;
}

/* ── Buttons ── */
.btn-primary {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 28px;
  border: none; border-radius: var(--radius-lg);
  background: var(--gradient-main);
  color: white;
  font-family: var(--font-main);
  font-size: 15px; font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-med);
  box-shadow: 0 4px 20px rgba(124, 106, 255, 0.3);
  letter-spacing: -0.01em;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(124, 106, 255, 0.45);
}

.btn-primary:active:not(:disabled) { transform: translateY(0); }

.btn-primary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

.btn-icon {
  font-size: 18px;
  transition: transform var(--transition-med);
}

.btn-primary:hover:not(:disabled) .btn-icon { transform: translateX(3px); }

.btn-ghost {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 12px 24px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-main);
  font-size: 14px; font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-med);
}

.btn-ghost:hover {
  border-color: var(--border-glow);
  color: var(--text-primary);
}

/* ── Phase 2: Analysis ── */
.analyze-content {
  align-items: center; justify-content: center;
  text-align: center;
}

.analyze-ring-wrap {
  position: relative;
  width: 120px; height: 120px;
  margin-bottom: 32px;
}

.analyze-ring { width: 100%; height: 100%; }

.ring-bg {
  fill: none;
  stroke: var(--border-subtle);
  stroke-width: 4;
}

.ring-progress {
  fill: none;
  stroke: url(#gradientStroke);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 326.73;
  stroke-dashoffset: 326.73;
  transform: rotate(-90deg);
  transform-origin: center;
  transition: stroke-dashoffset 1.5s ease-in-out;
}

.analyze-glow {
  position: absolute; inset: -20px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(124, 106, 255, 0.15) 0%, transparent 70%);
  animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.1); }
}

.analyze-title {
  font-size: 22px; font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.analyze-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.analyze-tags {
  display: flex; flex-wrap: wrap; gap: 8px;
  justify-content: center;
}

.analyze-tag {
  padding: 6px 14px;
  border-radius: 20px;
  background: rgba(124, 106, 255, 0.1);
  border: 1px solid var(--border-subtle);
  font-size: 12px; font-weight: 500;
  color: var(--accent-violet);
  animation: tagAppear 0.4s ease both;
}

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

/* ── Phase 3: Reveal ── */
.reveal-content { text-align: center; }

.reveal-badge {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 20px;
  background: rgba(124, 106, 255, 0.12);
  border: 1px solid var(--border-glow);
  font-size: 13px; font-weight: 600;
  color: var(--accent-violet);
  margin-bottom: 20px;
}

.profile-name {
  font-size: clamp(28px, 6vw, 44px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 12px;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.profile-desc {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 24px;
  max-width: 480px;
  margin-left: auto; margin-right: auto;
}

.profile-stats {
  display: flex; flex-wrap: wrap; gap: 8px;
  justify-content: center;
  margin-bottom: 28px;
}

.stat-pill {
  padding: 6px 14px;
  border-radius: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  font-size: 12px; font-weight: 600;
  color: var(--text-secondary);
}

.stat-pill strong { color: var(--accent-cyan); }

.reveal-tiles {
  display: flex; gap: 10px;
  justify-content: center;
  margin-bottom: 28px;
}

.reveal-tile-mini {
  width: 56px; height: 56px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 2px solid var(--accent-purple);
  background: var(--bg-card);
}

.reveal-tile-mini .tile-placeholder {
  font-size: 10px;
}

.reveal-tile-mini .tile-icon { font-size: 20px; }
.reveal-tile-mini .tile-label { display: none; }

.reveal-actions { margin-top: auto; }

/* ── Phase 4: Share ── */
.share-content { text-align: center; }

.share-title {
  font-size: clamp(20px, 4vw, 28px);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.share-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 28px;
}

/* ── Email Gate ── */
.email-gate {
  display: flex; flex-direction: column;
  gap: 20px;
  margin-bottom: 32px;
}

.taste-card-preview {
  perspective: 800px;
}

.card-face {
  width: 100%; max-width: 340px;
  margin: 0 auto;
  aspect-ratio: 3/4;
  border-radius: var(--radius-xl);
  background: linear-gradient(160deg, #0f0a2a 0%, #1a0f3c 40%, #0d1a3c 100%);
  border: 1px solid var(--border-glow);
  box-shadow: var(--shadow-glow), var(--shadow-card);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.card-face::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 30% 20%, rgba(124, 106, 255, 0.12) 0%, transparent 60%);
  pointer-events: none;
}

.card-face::after {
  content: '';
  position: absolute; top: -50%; right: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(circle, rgba(0, 229, 208, 0.06) 0%, transparent 50%);
  pointer-events: none;
}

.card-logo {
  font-size: 14px; font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: auto;
  position: relative; z-index: 1;
}

.card-profile-name {
  font-size: clamp(20px, 5vw, 28px);
  font-weight: 800;
  letter-spacing: -0.03em;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  position: relative; z-index: 1;
}

.card-traits {
  display: flex; flex-wrap: wrap; gap: 6px;
  justify-content: center;
  margin-top: 16px;
  position: relative; z-index: 1;
}

.card-trait {
  padding: 4px 10px;
  border-radius: 12px;
  background: rgba(124, 106, 255, 0.12);
  border: 1px solid rgba(124, 106, 255, 0.2);
  font-size: 10px; font-weight: 600;
  color: var(--accent-violet);
}

.card-footer {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: auto;
  position: relative; z-index: 1;
}

.gate-form {
  display: flex; flex-direction: column;
  align-items: center;
  gap: 12px;
}

.gate-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.email-form {
  display: flex; gap: 10px;
  width: 100%; max-width: 380px;
}

.email-form input {
  flex: 1;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition-med);
}

.email-form input:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(124, 106, 255, 0.15);
}

.email-form input::placeholder { color: var(--text-muted); }

.gate-error {
  font-size: 13px;
  color: var(--accent-pink);
  text-align: center;
}

/* ── Share Section ── */
.share-section {
  margin-bottom: 24px;
}

.share-heading {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 14px;
}

.share-buttons {
  display: flex; gap: 10px;
  justify-content: center; flex-wrap: wrap;
}

.btn-share {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 14px; font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-med);
  text-decoration: none;
}

.btn-share:hover {
  border-color: var(--border-glow);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.btn-share-x:hover { border-color: rgba(255,255,255,0.3); }
.btn-share-discord:hover { border-color: rgba(88, 101, 242, 0.5); }

.share-actions {
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  padding: 12px 24px;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  box-shadow: var(--shadow-glow);
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; font-weight: 600;
  color: var(--text-primary);
  z-index: 100;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.toast.visible {
  transform: translateX(-50%) translateY(0);
}

.toast-icon {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--accent-cyan);
  color: var(--bg-deep);
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ── Responsive ── */
@media (min-width: 480px) {
  .tile-grid { gap: 14px; }
  .tile-label { font-size: 12px; }
}

@media (min-width: 768px) {
  .tile-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    max-width: 520px;
    margin: 0 auto;
  }
  .tile-label { font-size: 13px; }
  .phase-content, .analyze-content, .reveal-content, .share-content {
    padding: 32px 24px 48px;
  }
  .email-form {
    flex-direction: row;
  }
}

@media (min-width: 1024px) {
  .tile-grid { max-width: 600px; }
  .tile { border-radius: var(--radius-lg); }
}
