/* mix.css — MIX Studio page. Self-contained, does NOT import style.css. */

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

[hidden] { display: none !important; }

:root { --tab-bar-clearance: calc(64px + env(safe-area-inset-bottom, 0px)); }

@keyframes twinkle {
  0%, 100% { opacity: 0.4; }
  50%       { opacity: 1; }
}

@keyframes ripple-expand {
  0%   { transform: translate(-50%, -50%) scale(0.05); opacity: 0.85; }
  65%  { opacity: 0.45; }
  100% { transform: translate(-50%, -50%) scale(1);    opacity: 0; }
}

/* ---- Page shell ---- */

body {
  margin: 0;
  background: #09090B;
  color: #F4E9D8;
  font-family: -apple-system, 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
}

::-webkit-scrollbar { width: 0; height: 0; }

#mix-root {
  min-height: 100vh;
  min-height: 100dvh;
  background: #09090B;
  display: flex;
  justify-content: center;
}

.mix-shell {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0;
}

@supports (height: 100dvh) {
  .mix-shell { height: 100dvh; min-height: 0; }
}

/* ---- Top bar ---- */

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 4px;
  flex-shrink: 0;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 60px;
}

.back-btn {
  cursor: pointer;
  color: rgba(244, 233, 216, 0.45);
  font-size: 22px;
  line-height: 1;
  user-select: none;
}

.screen-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  color: rgba(244, 233, 216, 0.4);
  text-transform: uppercase;
}

.lang-pill {
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  color: rgba(244, 233, 216, 0.5);
  border: 1px solid rgba(244, 233, 216, 0.15);
  border-radius: 100px;
  padding: 6px 12px;
  min-width: 60px;
  text-align: center;
  user-select: none;
}

/* ---- Screens ---- */

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.content-pad {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0 22px;
}

/* ---- Typography ---- */

.mix-h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.3px;
  margin: 0 0 4px;
}

.mix-sub {
  font-size: 13px;
  color: rgba(244, 233, 216, 0.45);
  margin: 0 0 20px;
  line-height: 1.5;
}

/* ---- Amber pill button ---- */

.btn-amber-pill {
  width: 100%;
  border: none;
  background: #F59E0B;
  color: #1a0f00;
  font-size: 15px;
  font-weight: 700;
  padding: 15px;
  border-radius: 100px;
  cursor: pointer;
  font-family: inherit;
}

.btn-amber-pill:disabled {
  background: rgba(245, 158, 11, 0.25);
  cursor: not-allowed;
}

/* ---- Bottom bar (fixed to bottom of content) ---- */

.bottom-bar {
  flex-shrink: 0;
  padding: 8px 0 calc(8px + var(--tab-bar-clearance));
}

/* ---- Screen 0: Feed / sounds ---- */

.sounds-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 12px;
}

.sounds-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.continue-bar {
  flex-shrink: 0;
  padding: 12px 0 calc(8px + var(--tab-bar-clearance));
}

/* Favorites-only filter pill — same visual language as the Feed's
   .btn-fav-filter (style.css), reimplemented here since mix.css is
   self-contained and does not import style.css. */
.sounds-toolbar {
  flex-shrink: 0;
  display: flex;
  margin: 0 0 14px;
}

.btn-fav-filter {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  color: rgba(244, 233, 216, 0.45);
  border: 1px solid rgba(244, 233, 216, 0.15);
  font-size: 12px;
  padding: 6px 12px;
  min-height: 32px;
  border-radius: 100px;
  cursor: pointer;
  touch-action: manipulation;
  font-family: inherit;
}

.btn-fav-filter:hover { color: #F59E0B; border-color: rgba(245, 158, 11, 0.4); }

.btn-fav-filter.is-active {
  color: #F59E0B;
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.4);
}

/* Sound card */
.sound-card {
  position: relative;
  border-radius: 18px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
}

.sound-card-bg {
  position: absolute;
  inset: 0;
  border-radius: 18px;
  pointer-events: none;
  background: #120f00;
  border: 1.5px solid rgba(244, 233, 216, 0.08);
  transition: background 0.2s, border-color 0.2s;
}

.sound-card.selected .sound-card-bg {
  background: linear-gradient(135deg, #2a1c00, #120f00);
  border-color: #F59E0B;
}

.sound-card-head {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}

.sound-card-title {
  font-size: 14.5px;
  font-weight: 600;
}

.sound-card-meta {
  font-size: 10.5px;
  color: rgba(244, 233, 216, 0.4);
  margin-top: 2px;
}

.sound-card-head-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 4px;
}

.sound-star {
  width: 22px;
  height: 22px;
  padding: 0;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 6px;
  color: rgba(244, 233, 216, 0.35);
  cursor: default;
  touch-action: manipulation;
}

.sound-star.is-active { color: #F59E0B; }

.sound-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1.5px solid rgba(244, 233, 216, 0.25);
  transition: background 0.2s, border-color 0.2s;
}

.sound-card.selected .sound-check {
  background: #F59E0B;
  border-color: #F59E0B;
}

.sound-check-mark {
  color: #1a0f00;
  font-size: 12px;
  font-weight: 700;
  display: none;
}

.sound-card.selected .sound-check-mark {
  display: block;
}

.sound-wave {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 30px;
}

.sound-wave-bar {
  width: 3px;
  border-radius: 2px;
  background: rgba(244, 233, 216, 0.25);
  transition: background 0.2s;
}

.sound-card.selected .sound-wave-bar {
  background: rgba(245, 158, 11, 0.8);
}

/* Empty state */
.mix-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  color: rgba(244, 233, 216, 0.45);
  font-size: 14px;
  line-height: 1.6;
}

.mix-empty a {
  color: #F59E0B;
  text-decoration: none;
  margin-top: 12px;
  display: block;
}

/* ---- Screen 1: Texture ---- */

.tex-rows {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 16px;
}

.tex-row-label {
  font-size: 13.5px;
  font-weight: 600;
  margin-bottom: 8px;
}

.tex-preset-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.tex-chip {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 6px;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s;
}

.tex-chip-bg {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  background: #120f00;
  border: 1.5px solid rgba(244, 233, 216, 0.08);
  pointer-events: none;
  transition: background 0.2s, border-color 0.2s;
}

.tex-chip.picked .tex-chip-bg {
  background: linear-gradient(135deg, #2a1c00, #120f00);
  border-color: #F59E0B;
}

.tex-icon-tile {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: rgba(244, 233, 216, 0.7);
  transition: color 0.2s;
}

.tex-chip.picked .tex-icon-tile {
  color: #F59E0B;
}

.tex-chip-name {
  position: relative;
  font-size: 11px;
  font-weight: 500;
  color: rgba(244, 233, 216, 0.6);
  text-align: center;
  transition: color 0.2s, font-weight 0.2s;
}

.tex-chip.picked .tex-chip-name {
  font-weight: 700;
  color: #F59E0B;
}

/* ---- Screen 2: Mood ---- */

.mood-scroll {
  flex: 1;
  overflow-y: auto;
}

.mood-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 22px;
}

.mood-card {
  position: relative;
  aspect-ratio: 1 / 0.92;
  border-radius: 22px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  box-shadow: none;
  filter: brightness(0.82);
  transition: all 0.25s;
}

.mood-card.picked {
  filter: brightness(1.15);
}

.mood-card-inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.mood-icon {
  font-size: 30px;
}

.mood-name {
  font-size: 13px;
  font-weight: 600;
  color: #F4E9D8;
  text-align: center;
  padding: 0 8px;
  transition: color 0.2s, font-weight 0.2s;
}

.mood-card.picked .mood-name {
  font-weight: 700;
}

.mood-desc {
  font-size: 10px;
  color: rgba(244, 233, 216, 0.5);
  text-align: center;
  padding: 0 12px;
  line-height: 1.4;
}

.mood-check-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1a0f00;
  font-size: 12px;
  font-weight: 700;
  z-index: 2;
}

/* Music toggle row */
.music-toggle-row {
  border-radius: 20px;
  background: #120f00;
  border: 1px solid rgba(244, 233, 216, 0.08);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.music-switch {
  width: 52px;
  height: 30px;
  border-radius: 100px;
  background: rgba(244, 233, 216, 0.15);
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s;
}

.music-switch.on {
  background: #F59E0B;
}

.music-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #555;
  transition: left 0.2s, background 0.2s;
}

.music-switch.on .music-knob {
  left: 24px;
  background: #1a0f00;
}

.music-text-label {
  font-size: 13px;
  font-weight: 600;
}

.music-text-desc {
  font-size: 10.5px;
  color: rgba(244, 233, 216, 0.4);
  margin-top: 3px;
  line-height: 1.5;
}

/* Mix button on screen 2 */
#mix-btn {
  font-size: 16px;
  padding: 16px;
  letter-spacing: 0.5px;
}

/* ---- Screen 3: Generating ---- */

.screen-gen {
  align-items: center;
  justify-content: center;
  gap: 28px;
  position: relative;
  overflow: hidden;
  padding-bottom: var(--tab-bar-clearance);
}

.ripple-stage {
  position: relative;
  width: 300px;
  height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  mix-blend-mode: screen;
  flex-shrink: 0;
}

.ripple-ring {
  position: absolute;
  border-radius: 50%;
  opacity: 0;
  /* left/top/size/color set inline */
}

.gen-text {
  text-align: center;
}

.gen-line {
  font-size: 15px;
  font-weight: 600;
}

.gen-sub {
  font-size: 11px;
  color: rgba(244, 233, 216, 0.35);
  margin-top: 8px;
}

/* ---- Screen 4: Result ---- */

.result-eyebrow {
  font-size: 11px;
  color: rgba(244, 233, 216, 0.4);
  letter-spacing: 1px;
  margin-bottom: 6px;
}

.result-meta-sub {
  margin-bottom: 18px;
}

.result-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: var(--tab-bar-clearance);
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: start;
}

/* Artwork card */
.artwork-card {
  border-radius: 22px;
  overflow: hidden;
  padding: 20px;
  position: relative;
}

.artwork-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 80% 0%, rgba(0,0,0,0.25), transparent 60%);
}

.artwork-inner {
  position: relative;
  z-index: 1;
}

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

.artwork-brand {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  color: rgba(244, 233, 216, 0.7);
}

.artwork-icon {
  font-size: 20px;
}

.artwork-wave {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 52px;
  margin-bottom: 16px;
}

.artwork-wave-bar {
  width: 3px;
  border-radius: 2px;
  background: rgba(244, 233, 216, 0.85);
}

.artwork-title {
  font-size: 16px;
  font-weight: 700;
}

.artwork-dur {
  font-size: 11px;
  color: rgba(244, 233, 216, 0.55);
  margin-top: 3px;
}

/* Result controls */
.result-controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.playback-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.play-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #F59E0B;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  color: #1a0f00;
  font-size: 16px;
  font-family: inherit;
}

.loop-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid rgba(244, 233, 216, 0.2);
  color: rgba(244, 233, 216, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  font-family: inherit;
}

.loop-btn:hover { color: #F59E0B; border-color: rgba(245, 158, 11, 0.4); }

.loop-btn.is-active {
  color: #F59E0B;
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.4);
  box-shadow: inset 0 0 12px rgba(245, 158, 11, 0.15);
}

.progress-bars {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 1.5px;
  height: 28px;
}

.progress-bar {
  width: 2.5px;
  border-radius: 1.5px;
  background: rgba(244, 233, 216, 0.2);
  transition: background 0.05s;
}

.share-row {
  display: flex;
  gap: 10px;
}

.btn-outline-pill {
  flex: 1;
  border: 1px solid rgba(244, 233, 216, 0.2);
  background: transparent;
  color: #F4E9D8;
  font-size: 14px;
  font-weight: 600;
  padding: 14px;
  border-radius: 100px;
  cursor: pointer;
  font-family: inherit;
}

.result-post-btn {
  flex: 1.4;
  font-size: 14px;
  padding: 14px;
  width: auto;
}

.new-mix-btn {
  text-align: center;
  font-size: 12px;
  color: rgba(244, 233, 216, 0.4);
  cursor: pointer;
  padding-top: 4px;
  user-select: none;
}

/* ---- Bottom tab bar ---- */

.tab-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 200;
  display: flex;
  background: rgba(9, 9, 11, 0.92);
  border-top: 1px solid #18181B;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.tab-item {
  flex: 1; min-height: 56px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
  color: rgba(244, 233, 216, 0.45);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.tab-item.is-active { color: #F59E0B; }
.tab-item:active { opacity: 0.7; }

/* ---- Desktop ≥880px ---- */

@media (min-width: 880px) {
  .mix-shell {
    max-width: 1080px;
    padding: 28px 40px 40px;
  }

  .top-bar {
    padding: 4px 0 8px;
  }

  .content-pad {
    padding: 0;
  }

  .mix-h1 {
    font-size: 32px;
  }

  .sounds-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }

  .mood-grid {
    grid-template-columns: repeat(4, 1fr);
  }

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