* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f4f5f7;
  color: #1f2937;
}

.app {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 18px 14px 42px;
}

.hero {
  background: linear-gradient(135deg, #111827, #374151);
  color: #ffffff;
  border-radius: 22px;
  padding: 28px 20px;
  margin-bottom: 14px;
}

.brand {
  font-size: 14px;
  letter-spacing: 1.6px;
  opacity: 0.78;
  margin-bottom: 10px;
  font-weight: 700;
}

.hero h1 {
  margin: 0 0 10px;
  font-size: 28px;
  line-height: 1.2;
}

.hero p {
  margin: 0;
  line-height: 1.55;
  opacity: 0.92;
}

.product-card,
.progress-card,
.check-card,
.video-card,
.result-box {
  background: #ffffff;
  border-radius: 20px;
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.07);
}

.product-card h2 {
  margin: 0 0 6px;
  font-size: 20px;
}

.product-card p {
  margin: 0;
  color: #6b7280;
  line-height: 1.45;
}

.progress-card {
  color: #4b5563;
  font-weight: 700;
}

.progress-bar {
  height: 10px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 10px;
}

#progressFill {
  height: 100%;
  width: 0%;
  background: #111827;
  border-radius: 999px;
  transition: width 0.25s ease;
}

.part-label,
.video-label {
  color: #6b7280;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 8px;
}

.part-img {
  width: 100%;
  height: 520px;
  max-height: 520px;
  border-radius: 18px;
  object-fit: contain;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  margin-bottom: 16px;
  display: block;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.part-img.loaded {
  opacity: 1;
}

.check-card h2 {
  display: none;
}

.video-card h2,
.result-box h2 {
  margin: 0 0 10px;
  font-size: 24px;
}

.video-card p,
.result-box p {
  line-height: 1.55;
}

.expected {
  font-size: 19px;
  margin: 8px 0 18px;
  background: #f9fafb;
  border-radius: 14px;
  padding: 12px;
}

.question {
  font-weight: 800;
  font-size: 18px;
  margin-bottom: 12px;
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.yes-btn,
.no-btn,
.next-btn,
.back-btn,
.copy-btn,
.email-btn,
.restart-btn,
.stuck-btn,
.secondary-btn {
  border: none;
  border-radius: 15px;
  padding: 15px 16px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}

.yes-btn {
  background: #059669;
  color: #ffffff;
}

.no-btn {
  background: #f59e0b;
  color: #111827;
}

.next-btn {
  width: 100%;
  background: #111827;
  color: #ffffff;
  margin-top: 12px;
}

.stuck-btn {
  display: block;
  width: 100%;
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fed7aa;
  margin-top: 10px;
}

.secondary-btn,
.back-btn,
.restart-btn {
  width: 100%;
  background: #e5e7eb;
  color: #111827;
  margin-top: 10px;
}

.copy-btn {
  width: 100%;
  background: #2563eb;
  color: #ffffff;
  margin-top: 12px;
}

.email-btn {
  display: block;
  width: 100%;
  text-align: center;
  text-decoration: none;
  background: #111827;
  color: #ffffff;
  margin-top: 12px;
}

.qty-box {
  background: #f9fafb;
  border-radius: 16px;
  padding: 14px;
  margin-top: 8px;
}

.qty-box label {
  display: block;
  margin-bottom: 8px;
  font-weight: 800;
}

.qty-input {
  width: 100%;
  height: 50px;
  border: 1px solid #d1d5db;
  border-radius: 15px;
  font-size: 18px;
  padding: 0 14px;
}

.video-box {
  width: 100%;
  background: #111827;
  border-radius: 18px;
  overflow: hidden;
  margin: 14px 0;
}

.video-box video,
.video-box iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  display: block;
  background: #000000;
}

.reminder-box {
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  color: #312e81;
  border-radius: 16px;
  padding: 14px;
  line-height: 1.55;
  margin: 12px 0;
  font-weight: 700;
}

.error {
  color: #dc2626;
  font-size: 14px;
  margin-top: 8px;
  font-weight: 700;
}

.success {
  border: 2px solid #10b981;
}

.warning {
  border: 2px solid #f59e0b;
}

.issue-list {
  padding-left: 20px;
  line-height: 1.8;
}

.customer-service {
  background: #f9fafb;
  border-radius: 16px;
  padding: 14px;
  margin-top: 12px;
  color: #374151;
  line-height: 1.5;
}

.summary-box {
  white-space: pre-wrap;
  background: #111827;
  color: #ffffff;
  border-radius: 16px;
  padding: 14px;
  line-height: 1.6;
  overflow-wrap: break-word;
  margin-top: 12px;
}


.support-panel {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 14px;
  margin-top: 10px;
  line-height: 1.55;
  color: #374151;
}

.support-panel h3 {
  margin: 0 0 8px;
  font-size: 18px;
  color: #111827;
}

.support-panel ul {
  margin: 8px 0;
  padding-left: 20px;
}

.support-panel .email-text {
  font-weight: 800;
  color: #111827;
  word-break: break-all;
}

.support-note {
  color: #6b7280;
  font-size: 14px;
  margin-top: 8px;
}

.hidden {
  display: none;
}

@media (max-width: 520px) {
  .hero h1 {
    font-size: 24px;
  }

  .action-row {
    grid-template-columns: 1fr;
  }

  .video-card h2 {
    font-size: 22px;
  }
}


.support-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px 14px;
  background: #f4f5f7;
}

.support-card {
  width: 100%;
  max-width: 680px;
  background: #ffffff;
  border-radius: 24px;
  padding: 24px 20px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.10);
  text-align: center;
}

.support-logo {
  color: #6b7280;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 1.6px;
  margin-bottom: 12px;
}

.support-card h1 {
  margin: 0 0 14px;
  font-size: 28px;
  color: #111827;
}

.support-card p {
  line-height: 1.65;
  color: #374151;
  margin: 10px 0;
}

.support-contact {
  background: #f9fafb;
  border-radius: 18px;
  padding: 16px;
  margin: 18px 0;
}

.support-email {
  font-size: 20px;
  font-weight: 900;
  color: #111827;
  word-break: break-all;
  margin-top: 8px;
}

.support-list {
  text-align: left;
  display: inline-block;
  margin: 10px auto;
  line-height: 1.8;
  color: #374151;
}

.current-step-box {
  background: #eef2ff;
  color: #312e81;
  border: 1px solid #c7d2fe;
  border-radius: 18px;
  padding: 14px;
  margin: 18px 0;
  font-weight: 800;
}

.copy-email-btn,
.return-btn {
  width: 100%;
  border: none;
  border-radius: 15px;
  padding: 15px 16px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  margin-top: 10px;
}

.copy-email-btn {
  background: #111827;
  color: #ffffff;
}

.return-btn {
  background: #e5e7eb;
  color: #111827;
}

.copy-success {
  color: #059669;
  font-weight: 800;
  margin-top: 10px;
}


.video-sub-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 10px;
}

.video-sub-actions .stuck-btn,
.video-sub-actions .secondary-btn {
  width: 100%;
  margin-top: 0;
}

@media (max-width: 520px) {
  .video-sub-actions {
    grid-template-columns: 1fr;
  }
}


.language-card {
  background: #ffffff;
  border-radius: 20px;
  padding: 14px 18px;
  margin-bottom: 14px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.07);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.language-card label {
  font-weight: 800;
  color: #374151;
}

.language-card select {
  border: 1px solid #d1d5db;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 15px;
  background: #ffffff;
}

.version-text {
  font-size: 12px;
  color: #9ca3af;
  margin-top: 6px !important;
}

.video-sub-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 10px;
}

.video-sub-actions .stuck-btn,
.video-sub-actions .secondary-btn {
  width: 100%;
  margin-top: 0;
}

@media (max-width: 520px) {
  .language-card {
    align-items: stretch;
    flex-direction: column;
  }

  .video-sub-actions {
    grid-template-columns: 1fr;
  }
}


.image-frame {
  width: 100%;
  height: 520px;
  border-radius: 18px;
  background: linear-gradient(180deg, #f3f4f6 0%, #eef2f7 100%);
  border: 1px solid #e5e7eb;
  margin-bottom: 16px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-frame .part-img {
  margin-bottom: 0;
  border: none;
  border-radius: 0;
  background: transparent;
}

@media (max-width: 520px) {
  .image-frame,
  .part-img {
    height: 420px;
    max-height: 420px;
  }
}

/* ===== V3 real function patch: stable layout + quick navigation + admin ===== */
.language-card.hidden { display: none; }
.stable-copy {
  min-height: 52px;
  line-height: 1.55;
  overflow-wrap: break-word;
}
.video-card h2 {
  min-height: 34px;
}
.video-box {
  min-height: 220px;
}
.quick-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
}
.mini-nav-btn {
  border: 1px solid #d1d5db;
  border-radius: 12px;
  padding: 11px 10px;
  background: #f9fafb;
  color: #374151;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}
.confidence-btn {
  background: #eef2ff;
  color: #312e81;
  border: 1px solid #c7d2fe;
}
.admin-app {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 18px 14px 42px;
}
.admin-card {
  background: #fff;
  border-radius: 20px;
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.07);
}
.admin-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.metric-box {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 14px;
}
.metric-box strong {
  display: block;
  font-size: 24px;
  margin-top: 6px;
}
.admin-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.admin-table-wrap {
  overflow-x: auto;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.admin-table th,
.admin-table td {
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  padding: 10px 8px;
  vertical-align: top;
}
.admin-table th {
  background: #f9fafb;
  font-weight: 900;
}
.admin-note {
  color: #6b7280;
  line-height: 1.55;
}
@media (max-width: 720px) {
  .quick-nav,
  .admin-grid { grid-template-columns: 1fr; }
}

.video-sub-actions.single-action {
  grid-template-columns: 1fr;
}
.quick-nav-single {
  grid-template-columns: 1fr;
}

.welcome-card {
  background: #ffffff;
  border-radius: 20px;
  padding: 22px 18px;
  margin-bottom: 14px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.07);
}

.welcome-product-image {
  display: block;
  width: min(100%, 680px);
  max-height: 420px;
  object-fit: contain;
  margin: 20px auto;
  border-radius: 16px;
  background: #f8fafc;
}

.welcome-brand {
  font-size: 14px;
  letter-spacing: 1.6px;
  color: #6b7280;
  font-weight: 800;
  margin-bottom: 10px;
}

.welcome-card h2 {
  margin: 0 0 12px;
  font-size: 24px;
  line-height: 1.25;
}

.welcome-card p {
  margin: 0 0 12px;
  color: #4b5563;
  line-height: 1.6;
}

.welcome-email {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 14px;
  margin: 16px 0;
}

.welcome-email span {
  display: block;
  color: #6b7280;
  font-size: 13px;
  margin-bottom: 6px;
}

.welcome-email strong {
  display: block;
  font-size: 16px;
  word-break: break-all;
}

/* V3.4 All Parts Page */
.all-parts-page {
  border: 1px solid #e5e7eb;
}
.all-parts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0 18px;
}
.all-part-item {
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  background: #ffffff;
  overflow: hidden;
}
.all-part-img-wrap {
  background: #f3f4f6;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
}
.all-part-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.all-part-info {
  padding: 12px;
  display: grid;
  gap: 4px;
}
.all-part-info strong {
  font-size: 15px;
}
.all-part-info span {
  color: #374151;
  font-weight: 700;
}
.all-part-info em {
  color: #6b7280;
  font-style: normal;
  font-size: 13px;
}
@media (max-width: 720px) {
  .all-parts-grid {
    grid-template-columns: 1fr;
  }
}

/* V3.5 all-parts single image */
.all-parts-single-image {
  width: 100%;
  margin: 14px 0 18px;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: #f8fafc;
  overflow: hidden;
}
.all-parts-single-image img {
  display: block;
  width: 100%;
  height: auto;
}
.image-missing-note {
  padding: 28px 16px;
  color: #64748b;
  text-align: center;
  font-size: 14px;
}

/* V4 media-first interface */
:root {
  --ink: #13231b;
  --muted: #68736d;
  --brand: #166534;
  --brand-bright: #22c55e;
  --surface: #ffffff;
  --line: #dfe6e1;
  --soft: #edf3ef;
}

body {
  background:
    radial-gradient(circle at 15% -10%, rgba(34, 197, 94, 0.11), transparent 34rem),
    #f2f5f3;
  color: var(--ink);
}

.app {
  max-width: 1080px;
  padding: 12px 16px 32px;
}

.hero {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 22px;
  align-items: center;
  border-radius: 16px;
  padding: 15px 18px;
  margin-bottom: 10px;
  background: linear-gradient(115deg, #10281b, #1c4a31);
}

.brand {
  grid-row: 1 / 3;
  margin: 0;
  color: #8cf2ad;
}

.hero h1 {
  margin: 0;
  font-size: 21px;
}

.hero p {
  font-size: 13px;
  line-height: 1.4;
}

.product-card,
.progress-card,
.check-card,
.video-card,
.result-box,
.welcome-card {
  border: 1px solid rgba(205, 216, 209, 0.82);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(25, 48, 34, 0.065);
}

.product-card {
  padding: 12px 16px;
  margin-bottom: 8px;
}

.product-card h2 {
  font-size: 17px;
}

.product-card p {
  font-size: 13px;
}

.progress-card {
  display: grid;
  grid-template-columns: max-content 1fr;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  margin-bottom: 10px;
  font-size: 13px;
}

.progress-bar {
  margin: 0;
  height: 6px;
}

#progressFill {
  background: linear-gradient(90deg, var(--brand), var(--brand-bright));
}

.image-frame {
  height: clamp(430px, 64vh, 680px);
  border-radius: 12px;
  background: #f4f7f5;
}

.part-img {
  height: 100%;
  max-height: none;
}

.yes-btn,
.next-btn {
  background: var(--brand);
}

.yes-btn,
.no-btn,
.next-btn,
.back-btn,
.stuck-btn,
.secondary-btn {
  min-height: 48px;
  border-radius: 12px;
}

body.video-mode .hero,
body.video-mode .product-card {
  display: none;
}

body.video-mode .app {
  max-width: 1320px;
  padding-top: 8px;
}

body.video-mode .progress-card {
  margin-bottom: 8px;
}

body.video-mode .video-card {
  padding: 0;
  overflow: hidden;
  background: #fff;
}

.video-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  min-height: min(720px, calc(100vh - 88px));
  background: #fff;
}

.video-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 480px;
  overflow: hidden;
  background: #050806;
}

.video-stage video {
  display: block;
  width: 100%;
  height: 100%;
  max-height: calc(100vh - 88px);
  object-fit: contain;
  background: #000;
}

.video-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 24px 20px 18px;
  overflow-y: auto;
  border-left: 1px solid var(--line);
}

.video-step-heading h2 {
  min-height: 0;
  margin: 5px 0 9px;
  font-size: clamp(20px, 2vw, 28px);
  line-height: 1.18;
}

.video-step-heading .stable-copy {
  min-height: 0;
  margin: 0;
  color: var(--muted);
}

.video-label {
  margin: 0;
  color: var(--brand);
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.video-actions {
  margin-top: auto;
  padding-top: 16px;
}

.video-actions .secondary-btn,
.video-actions .stuck-btn {
  margin-top: 8px;
}

.stage-nav,
.expand-video-btn {
  position: absolute;
  z-index: 4;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  background: rgba(10, 18, 13, 0.78);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(10px);
  cursor: pointer;
}

.expand-video-btn {
  top: 14px;
  right: 14px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 22px;
}

.stage-nav {
  top: 50%;
  transform: translateY(-50%);
  min-height: 58px;
  border-radius: 999px;
}

.stage-back {
  left: 14px;
  width: 48px;
  font-size: 38px;
}

.stage-next {
  right: 14px;
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: min(250px, 42%);
  padding: 10px 14px 10px 16px;
  text-align: left;
  font-size: 13px;
  font-weight: 800;
}

.stage-next b {
  flex: 0 0 auto;
  font-size: 30px;
  line-height: 1;
}

.stage-next.ready {
  border-color: #8cf2ad;
  background: rgba(22, 101, 52, 0.95);
  animation: next-ready 1.1s ease 2;
}

@keyframes next-ready {
  50% { transform: translateY(-50%) scale(1.04); }
}

.video-workspace:fullscreen,
.video-workspace.theater-view {
  width: 100vw;
  height: 100vh;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 28vw);
  background: #050806;
}

.video-workspace:fullscreen .video-stage,
.video-workspace:fullscreen video,
.video-workspace.theater-view .video-stage,
.video-workspace.theater-view video {
  height: 100vh;
  max-height: none;
}

.video-workspace:fullscreen .video-details,
.video-workspace.theater-view .video-details {
  color: #f7faf8;
  background: #101712;
  border-color: #27332b;
}

@media (max-width: 760px) and (orientation: portrait) {
  .app {
    padding: 8px 8px 24px;
  }

  .hero {
    display: block;
    padding: 14px;
  }

  .brand {
    margin-bottom: 5px;
  }

  .hero p {
    display: none;
  }

  .progress-card {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .video-workspace {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .video-stage {
    min-height: 0;
    aspect-ratio: 16 / 10;
  }

  .video-stage video {
    height: 100%;
  }

  .video-details {
    padding: 16px 14px;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .stage-next span {
    display: none;
  }

  .stage-next {
    width: 50px;
    padding: 8px 11px;
  }

  .image-frame,
  .part-img {
    height: min(55vh, 520px);
    max-height: none;
  }
}

@media (orientation: landscape) and (max-height: 650px) {
  body.video-mode {
    overflow: hidden;
    background: #050806;
  }

  body.video-mode .progress-card {
    display: none;
  }

  body.video-mode .app {
    height: 100vh;
    padding: 0;
  }

  body.video-mode .video-card {
    position: fixed;
    inset: 0;
    z-index: 20;
    margin: 0;
    border: 0;
    border-radius: 0;
  }

  .video-workspace {
    grid-template-columns: minmax(0, 1fr) minmax(240px, 30vw);
    width: 100vw;
    height: 100vh;
    min-height: 0;
  }

  .video-stage,
  .video-stage video {
    height: 100vh;
    min-height: 0;
    max-height: none;
  }

  .video-details {
    padding: 14px 13px;
    background: #fff;
  }

  .video-step-heading h2 {
    font-size: 19px;
  }

  .video-step-heading .stable-copy,
  .reminder-box {
    font-size: 12px;
  }

  .quick-nav {
    display: none;
  }
}


/* V4.1 local integration */
:root{--maginels-accent:#111827;}
#progressFill,.next-btn,.email-btn{background:var(--maginels-accent)!important;}
.media-test-placeholder{min-height:320px;width:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;background:#f3f4f6;color:#6b7280;font-size:26px;font-weight:800;border-radius:18px;border:2px dashed #d1d5db;}
.media-test-placeholder span{font-size:14px;font-weight:600;margin-top:10px;color:#9ca3af;letter-spacing:.5px;}
