- { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

body {
  background: #0b0d13;
  color: #f1f5f9;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Inter, sans-serif;
  min-height: 100vh;
}

.hidden { display: none !important; }

.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: #131722;
  border: 1px solid #23293a;
  border-radius: 20px;
  padding: 26px 22px;
  text-align: center;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  padding: 6px 14px;
  border-radius: 99px;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 14px;
  border: 1px solid rgba(99, 102, 241, 0.35);
}

.brand-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.auth-card h1 { font-size: 22px; margin-bottom: 6px; }
.subtitle { color: #94a3b8; font-size: 13px; margin-bottom: 16px; }

.lang-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}

.lang-chip {
  background: #0b0d13;
  border: 1px solid #262e42;
  color: #cbd5e1;
  border-radius: 10px;
  padding: 9px 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 6px;
}

.lang-chip:hover { border-color: #6366f1; }
.lang-chip.active {
  background: rgba(99, 102, 241, 0.2);
  border-color: #6366f1;
  color: #ffffff;
  box-shadow: 0 0 0 1px #6366f1;
}

input, textarea, select {
  width: 100%;
  background: #0b0d13;
  border: 1px solid #2a3142;
  border-radius: 11px;
  color: #f8fafc;
  padding: 12px 14px;
  font-size: 15px;
  margin-bottom: 12px;
  font-family: inherit;
  box-sizing: border-box;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: #6366f1;
}

.btn {
  border: none;
  border-radius: 11px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-sizing: border-box;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, #4f46e5, #6366f1); color: #fff; }
.btn-secondary { background: #1e2433; color: #e2e8f0; border: 1px solid #2e374d; }

.btn-google {
  width: 100%;
  background: #ffffff;
  color: #0f172a;
}

.btn-small { padding: 7px 12px; font-size: 13px; background: #1e2433; color: #e2e8f0; text-decoration: none; border-radius: 8px; }
.btn-insta { background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%); color: #fff; border: none; }
.btn-icon { background: transparent; border: 1px solid #2a3142; color: #94a3b8; padding: 6px 10px; border-radius: 8px; cursor: pointer; }

.auth-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.divider { margin: 14px 0; color: #64748b; font-size: 13px; }
.error-msg { color: #f87171; font-size: 13px; margin-top: 12px; }
.legal-links { margin-top: 16px; font-size: 12px; color: #64748b; line-height: 1.5; }
.legal-links a { color: #818cf8; text-decoration: none; }

.app-wrapper { display: flex; flex-direction: column; min-height: 100vh; }

.sticky-top-shell {
  position: sticky;
  top: 0;
  z-index: 120;
  background: #131722;
  border-bottom: 1px solid #23293a;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: #131722;
  flex-wrap: wrap;
  gap: 8px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 17px;
  color: #f8fafc;
  cursor: pointer;
  user-select: none;
}

.logo:active { opacity: 0.8; }

.tier-sub { font-size: 11px; font-weight: 600; color: #818cf8; }

.logo-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid #6366f1;
}

.user-controls { display: flex; align-items: center; gap: 6px; }

.lang-mini-select {
  width: auto;
  margin-bottom: 0;
  padding: 5px 7px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 8px;
  background: #0b0d13;
  color: #cbd5e1;
}

.token-pill {
  background: rgba(99, 102, 241, 0.2);
  border: 1px solid #6366f1;
  color: #e0e7ff;
  padding: 6px 11px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.user-name { font-size: 12px; color: #94a3b8; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tabs {
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  padding: 0 14px 10px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  box-sizing: border-box;
}

.tab-btn {
  background: #0b0d13;
  border: 1px solid #23293a;
  color: #94a3b8;
  padding: 10px 6px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tab-btn.active { background: #1e2436; border-color: #6366f1; color: #fff; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.workspace { max-width: 860px; width: 100%; margin: 14px auto; padding: 0 14px; flex: 1; box-sizing: border-box; }

.card, .result-card {
  background: #131722;
  border: 1px solid #23293a;
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 16px;
  box-sizing: border-box;
}

.fullscreen-editor-overlay {
  position: fixed;
  inset: 0;
  z-index: 250;
  background: #0b0d13;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}

.editor-overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  background: #131722;
  border-bottom: 1px solid #23293a;
  flex-shrink: 0;
}

.editor-overlay-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.editor-canvas-stage {
  flex: 1;
  min-height: 0;
  background: #0b0d13;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  user-select: none;
  -webkit-user-select: none;
}

.editor-bottom-dock {
  flex-shrink: 0;
  background: #131722;
  border-top: 1px solid #23293a;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  max-height: 46dvh;
  overflow-y: auto;
}

label { display: block; font-size: 14px; color: #cbd5e1; margin-bottom: 10px; font-weight: 600; }

.styles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.style-card {
  background: #0b0d13;
  border: 1.5px solid #23293a;
  border-radius: 12px;
  padding: 10px 6px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
}

.style-card.active {
  border-color: #6366f1;
  background: rgba(99, 102, 241, 0.15);
}

.style-icon { font-size: 22px; margin-bottom: 4px; }
.style-name { font-size: 13px; font-weight: 700; color: #f1f5f9; margin-bottom: 4px; }
.style-price { font-size: 11px; color: #a5b4fc; font-weight: 600; }

.prompt-wrap {
  position: relative;
  margin-bottom: 12px;
}

.prompt-wrap textarea {
  margin-bottom: 0;
  padding-right: 46px;
}

.mic-btn {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid #2e374d;
  background: #1e2433;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.mic-btn:hover {
  border-color: #6366f1;
  background: #252d42;
}

.mic-btn.voice-input-btn {
  border-color: rgba(99, 102, 241, 0.55);
  background: rgba(99, 102, 241, 0.18);
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.25);
}

.mic-btn.recording,
.mic-btn.is-listening {
  background: #ef4444;
  border-color: #f87171;
  animation: pulse 1.2s infinite;
}

.mic-btn.is-unsupported {
  opacity: 0.45;
  cursor: not-allowed;
}

.pro-locked-item {
  opacity: 0.65;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6); }
  70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.controls-row { display: flex; gap: 10px; flex-wrap: wrap; }
.controls-row select { flex: 1; min-width: 140px; margin-bottom: 0; }
.controls-row .btn { flex: 1; min-width: 180px; }

.result-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-weight: 600; flex-wrap: wrap; gap: 8px; }
.action-group { display: flex; gap: 8px; }
.editable-output { line-height: 1.55; margin-bottom: 0; }
.preview-img { width: 100%; max-height: 480px; object-fit: contain; border-radius: 12px; background: #0b0d13; cursor: pointer; }

.editor-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 14px;
}

.format-tools, .export-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.fmt-btn {
  width: 32px;
  height: 32px;
  background: #0b0d13;
  border: 1px solid #2a3142;
  color: #f1f5f9;
  border-radius: 8px;
  cursor: pointer;
}

.mini-select {
  width: auto;
  margin-bottom: 0;
  padding: 6px 10px;
  font-size: 13px;
}

.slides-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.slide-card {
  background: #131722;
  border: 1px solid #2a3142;
  border-radius: 14px;
  padding: 18px;
  transition: all 0.2s;
}

.slide-card.theme-light {
  background: #ffffff;
  color: #0f172a;
  border-color: #cbd5e1;
}

.slide-card.theme-royal {
  background: linear-gradient(135deg, #1e1b4b, #312e81);
  color: #f8fafc;
  border-color: #4f46e5;
}

.slide-num { font-size: 11px; color: #818cf8; font-weight: 800; margin-bottom: 6px; letter-spacing: 0.05em; }
.slide-card.theme-light .slide-num { color: #4f46e5; }

.slide-title-edit {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 10px;
  outline: none;
  border-bottom: 1px dashed rgba(129, 140, 248, 0.35);
  padding-bottom: 4px;
}

.slide-body-edit {
  font-size: 14px;
  line-height: 1.55;
  outline: none;
  min-height: 70px;
}

.toast {
  position: fixed; bottom: 20px; right: 20px; left: 20px; max-width: 400px; margin: 0 auto;
  background: #1e293b; border: 1px solid #6366f1; color: #fff; text-align: center;
  padding: 12px 16px; border-radius: 12px; font-size: 14px; z-index: 350;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.app-footer {
  padding: 10px 16px;
  border-top: 1px solid #23293a;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: #64748b;
  font-size: 10.5px;
  line-height: 1.3;
}

.footer-col-left,
.footer-col-right {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
}

.footer-col-left {
  align-items: flex-start;
  text-align: left;
}

.footer-col-right {
  align-items: flex-end;
  text-align: right;
}

.footer-company {
  font-weight: 600;
  color: #94a3b8;
}

.footer-email,
.footer-col-right a {
  color: #818cf8;
  text-decoration: none;
  white-space: nowrap;
}

.modal {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.78);
  display: flex; align-items: center; justify-content: center; padding: 14px; z-index: 300;
  overflow-y: auto;
}

.modal-card {
  background: #131722; border: 1px solid #2a3142; border-radius: 18px;
  max-width: 740px; width: 100%; padding: 22px; max-height: 92vh; overflow-y: auto;
}

.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.plans-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 12px; margin: 16px 0; }

.plan-item {
  background: #0b0d13; border: 1px solid #23293a; border-radius: 14px;
  padding: 16px 12px; text-align: center; position: relative;
  display: flex; flex-direction: column; justify-content: space-between;
}

.plan-item.popular { border-color: #6366f1; }
.plan-item.pro { border-color: #f59e0b; background: linear-gradient(180deg, rgba(245, 158, 11, 0.08), #0b0d13); }

.plan-item .badge {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  background: #6366f1; color: #fff; font-size: 10px; font-weight: 700; padding: 2px 9px; border-radius: 99px; white-space: nowrap;
}

.plan-item .pro-badge { background: #d97706; }
.plan-name { font-size: 14px; font-weight: 700; color: #e2e8f0; margin-top: 4px; }
.plan-tokens { font-size: 20px; font-weight: 800; color: #818cf8; margin: 6px 0 2px; }
.plan-item.pro .plan-tokens { color: #fbbf24; }
.plan-price { font-size: 15px; font-weight: 700; color: #f8fafc; margin-bottom: 6px; }
.plan-rates { font-size: 11px; color: #94a3b8; margin-bottom: 12px; line-height: 1.4; }
.plan-item .btn { width: 100%; padding: 9px 10px; font-size: 13px; }
.payment-note { font-size: 12px; color: #94a3b8; text-align: center; line-height: 1.5; }

#slidesResultBox {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

#slidesResultBox img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: 220px;
  object-fit: cover;
  object-position: center;
  border-radius: 10px;
  margin-top: 10px;
}