/* Legacy fallback CSS for /studio on old devices that don't support
   Tailwind v4's @layer, @property, oklch(), lab(), color-mix(), etc.
   Only covers critical structure — modern browsers still get full Tailwind. */

/* ---- page shell (global — needed on all devices) ---- */
.legacy-studio-root {
  min-height: 100vh;
  min-height: 100dvh;
  background: #090d19;
  color: #e2e8f0;
  padding: 8px;
  overflow-x: hidden;
}

.legacy-studio-phone {
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 390px;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #090d19;
  overflow-y: auto;
  overflow-x: hidden;
}

@media (min-width: 768px) {
  .legacy-studio-phone {
    height: 100vh;
    height: 100dvh;
    max-width: none;
    border-radius: 0;
    border: none;
  }
}

/* ---- left pane ---- */
.legacy-studio-left {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

@media (min-width: 768px) {
  .legacy-studio-left {
    overflow-y: auto;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    padding: 16px;
  }
}

/* ---- right pane (preview) ---- */
.legacy-studio-right {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  background: #090d19;
}

@media (min-width: 768px) {
  .legacy-studio-right {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
    background: #090d19;
  }
}

/* ---- preview: 9:16 stage + iframe (global — needed on old devices) ---- */
.legacy-preview-stage {
  position: relative;
  width: 100%;
  max-width: 390px;
  margin: 0 auto;
  background: #05070d;
  overflow: hidden;
  padding-bottom: 177.777%;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  backface-visibility: hidden;
}

.legacy-preview-iframe {
  position: absolute !important;
  top: 0;
  left: 0;
  width: 100% !important;
  height: 100% !important;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  background: #05070d;
  border: 0;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* ---- mobile-only fallbacks: limit to max-width:767px so desktop Tailwind is not overridden ---- */
@media (max-width: 767px) {

/* === aggressive reset: kill iOS system button styles === */
.legacy-studio-root button,
.legacy-studio-root input,
.legacy-studio-root textarea,
.legacy-studio-root select {
  -webkit-appearance: none !important;
  appearance: none !important;
  background-image: none !important;
  box-shadow: none !important;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Arial, sans-serif;
}

.legacy-studio-root button svg,
.legacy-studio-phone button svg {
  width: 14px !important;
  height: 14px !important;
  flex-shrink: 0;
}

/* ---- tab bar ---- */
.legacy-studio-tabs {
  display: flex;
  flex-shrink: 0;
  gap: 4px;
  padding: 8px 8px 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.legacy-studio-tab {
  display: inline-flex !important;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  padding: 6px 12px !important;
  border: none !important;
  border-radius: 999px !important;
  background: rgba(255, 255, 255, 0.06) !important;
  color: rgba(255, 255, 255, 0.5) !important;
  font-size: 12px !important;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.legacy-studio-tab[data-state="active"],
.legacy-studio-tab[data-active] {
  background: #fff !important;
  color: #090d19 !important;
}

/* ---- onboarding idea panel ---- */
.legacy-idea-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 16px;
}

.legacy-idea-textarea {
  width: 100% !important;
  min-height: 120px !important;
  padding: 12px !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 12px !important;
  background: rgba(255, 255, 255, 0.04) !important;
  color: #e2e8f0 !important;
  font-size: 14px !important;
  line-height: 1.6;
  resize: vertical;
  outline: none;
}

.legacy-idea-textarea::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

/* ---- primary button ---- */
.legacy-primary-button {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px !important;
  border: none !important;
  border-radius: 10px !important;
  background: #6366f1 !important;
  color: #fff !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  cursor: pointer;
  white-space: nowrap;
}

.legacy-primary-button:active {
  background: #4f46e5 !important;
}

/* ---- ghost / outline button ---- */
.legacy-ghost-button {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 14px !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  border-radius: 8px !important;
  background: transparent !important;
  color: rgba(255, 255, 255, 0.7) !important;
  font-size: 12px !important;
  cursor: pointer;
}

.legacy-ghost-button:active {
  background: rgba(255, 255, 255, 0.06) !important;
}

/* ---- style / bgm select chips ---- */
.legacy-studio-root button.legacy-select-chip {
  display: inline-flex !important;
  align-items: center;
  gap: 3px;
  padding: 5px 10px !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: 8px !important;
  background: transparent !important;
  color: rgba(255, 255, 255, 0.6) !important;
  font-size: 12px !important;
  cursor: pointer;
}

.legacy-studio-root button.legacy-select-chip[aria-pressed="true"],
.legacy-studio-root button.legacy-select-chip.selected {
  border-color: #6366f1 !important;
  background: rgba(99, 102, 241, 0.15) !important;
  color: #a5b4fc !important;
}

/* ---- publish status card ---- */
.legacy-publish-card {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
}

/* ---- generic button fallback (non-legacy buttons inside studio) ---- */
.legacy-studio-root button {
  background: rgba(255, 255, 255, 0.06) !important;
  color: rgba(255, 255, 255, 0.7) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: 8px !important;
  font-size: 13px !important;
  cursor: pointer;
}

.legacy-studio-root a:not([class]) {
  color: #a5b4fc;
}

} /* end @media (max-width: 767px) */
