:root {
  --mt-ink: #101a34;
  --mt-muted: #78839d;
  --mt-line: #e8ebf2;
  --mt-panel: rgba(255, 255, 255, .9);
  --mt-pink: #ff3f96;
  --mt-purple: #8837ff;
  color: var(--mt-ink);
  background: #edf3fb;
}

body {
  padding: 16px;
  background:
    radial-gradient(circle at 28% 10%, rgba(255, 224, 243, .72), transparent 29rem),
    radial-gradient(circle at 76% 4%, rgba(210, 226, 255, .82), transparent 34rem),
    #edf3fb;
}

#app-root {
  width: min(1510px, 100%);
  min-height: calc(100vh - 32px);
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.9);
  border-radius: 20px;
  background: rgba(248, 250, 255, .88);
  box-shadow: 0 30px 90px rgba(63, 76, 112, .12);
}

.site-header {
  width: 100%;
  height: 78px;
  padding: 0 44px;
  border-bottom: 1px solid var(--mt-line);
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(20px);
}

.brand { gap: 14px; min-width: 250px; }
.brand > img { width: 94px; height: 50px; object-fit: contain; object-position: center; }
.brand > span { position: relative; display: flex; align-items: baseline; color: var(--mt-ink); font-size: 26px; line-height: 1; letter-spacing: -.06em; }
.brand b { font-weight: 900; }
.brand em { color: var(--mt-pink); font-style: normal; font-weight: 900; }
.brand small { position: absolute; top: 27px; left: 1px; color: #7e89a3; font-size: 12px; font-weight: 500; letter-spacing: 0; white-space: nowrap; }

.site-header nav { display: flex; align-items: center; gap: clamp(28px, 4vw, 52px); }
.site-header nav a { color: var(--mt-ink); font-size: 14px; font-weight: 650; text-decoration: none; }
.site-header nav a:hover { color: var(--mt-pink); }
.profile-menu { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 5px 14px 5px 6px; border: 1px solid var(--mt-line); border-radius: 12px; background: rgba(255,255,255,.76); color: var(--mt-ink); font-family: inherit; cursor: pointer; }
.profile-menu img { width: 36px; height: 36px; object-fit: cover; border-radius: 50%; }
.profile-menu span { font-size: 14px; }
.profile-menu strong { color: var(--mt-pink); }
.profile-menu i { margin-left: 3px; color: #78839d; font-style: normal; }
.mobile-menu { display: none; }

.workflow-bar { min-height: 68px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 50px; border-bottom: 1px solid var(--mt-line); background: rgba(255,255,255,.58); }
.workflow-bar > a { justify-self: start; color: #64708a; font-size: 14px; text-decoration: none; }
.workflow-bar > p { justify-self: end; margin: 0; color: #8791aa; font-size: 13px; }
.workflow-bar ol { display: flex; align-items: center; gap: 26px; margin: 0; padding: 0; list-style: none; }
.workflow-bar li { position: relative; display: flex; align-items: center; gap: 10px; min-width: 136px; color: #7a849c; font-size: 13px; }
.workflow-bar li:not(:last-child)::after { content: ""; position: absolute; left: 112px; width: 68px; height: 1px; background: #cbd3e5; }
.workflow-bar li.active { color: var(--mt-pink); font-weight: 800; }
.workflow-bar li.active::after { background: linear-gradient(90deg, #ff8ec8, #d8bbff); }
.workflow-bar b { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #aeb8cc; color: white; font-size: 12px; }
.workflow-bar .active b { background: linear-gradient(135deg, #ff489a, #e329b9); box-shadow: 0 7px 16px rgba(242,55,158,.24); }

main { width: 100%; margin: 0; }
.result { padding: 16px 24px 26px; }

.creative-presentation,
.creative-presentation.is-combined {
  display: grid;
  grid-template-columns: minmax(0, 1.34fr) minmax(500px, 1fr);
  grid-template-areas:
    "preview cards"
    "preview motion"
    "inspiration render";
  grid-template-rows: auto auto auto;
  align-items: start;
  gap: 14px 18px;
}

.creative-preview-column,
.video-player { display: contents; }

.creative-presentation.is-combined > .creative-products-column { grid-area: cards; margin-top: 0; }
.creative-presentation.is-combined > .preset-section { grid-area: motion; }
.creative-presentation.is-combined > .inspiration-placeholder { grid-area: inspiration; }

.preview-shell {
  grid-area: preview;
  min-height: 566px;
  overflow: hidden;
  border: 0;
  border-radius: 16px;
  background: #090c13;
  box-shadow: 0 18px 50px rgba(27,33,50,.15);
}

.preview-toolbar { position: absolute; z-index: 4; top: 18px; right: 18px; left: 18px; display: flex; align-items: center; justify-content: space-between; pointer-events: none; }
.preview-toolbar > * { pointer-events: auto; }
.preview-toolbar .format-select { width: min(295px, 62%); }
.preview-toolbar .format-select::before { content: "▯"; position: absolute; z-index: 2; top: 50%; left: 18px; color: white; font-size: 22px; transform: translateY(-52%); pointer-events: none; }
.preview-toolbar .format-select::after { right: 17px; width: 8px; height: 8px; border-width: 0 2px 2px 0; }
.preview-toolbar .format-select select { min-height: 46px; padding: 0 42px 0 50px; border-color: rgba(255,255,255,.18); border-radius: 12px; background: rgba(28,31,40,.74); font-size: 13px; backdrop-filter: blur(12px); }
.preview-action { min-width: 114px; min-height: 46px; border: 1px solid rgba(255,255,255,.17); border-radius: 12px; background: rgba(28,31,40,.74); color: white; font-family: inherit; font-size: 13px; font-weight: 750; cursor: pointer; backdrop-filter: blur(12px); }
.preview-action::before { content: "▶"; margin-right: 12px; }
.preview-action:disabled { opacity: .5; }

.preview-canvas { min-height: 566px; padding: 18px; }
.video-player iframe { width: min(100%, calc(530px * var(--preview-ratio))); }

.creative-products-column,
.preset-section,
.inspiration-placeholder {
  border: 1px solid rgba(225,229,239,.88);
  border-radius: 18px;
  background: var(--mt-panel);
  box-shadow: 0 10px 32px rgba(41,53,82,.055);
}

.creative-products-column { grid-area: cards; min-width: 0; padding: 18px 20px 20px; }
.creative-products-column > header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.creative-products-column h2 { margin: 0; font-size: 22px; letter-spacing: -.045em; }
.creative-products-column > header span { color: #7e89a3; font-size: 12px; }

.product-grid-body { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(78px, 1fr); gap: 8px; overflow-x: auto; padding: 2px 1px 6px; scroll-snap-type: x proximity; }
.product-grid-body .editable-card-shell { width: 100%; min-width: 78px; aspect-ratio: .7; border-radius: 10px; scroll-snap-align: start; }
.product-grid-body .hfp-card { border-radius: 10px; box-shadow: none; }
.product-grid-body .hfp-card-copy { display: none; }
.product-grid-body .hfp-card-wash { display: none; }
.product-grid-body .card-order { position: absolute; z-index: 3; left: 7px; bottom: 7px; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 5px; background: rgba(255,255,255,.92); color: #59627a; font-size: 10px; font-weight: 850; box-shadow: 0 3px 8px rgba(12,18,30,.12); }
.product-grid-body .editable-card-shell:first-child { outline: 2px solid var(--mt-pink); outline-offset: -1px; }
.product-grid-body .product-card-actions { width: 72px; gap: 5px; }
.product-grid-body .product-card-actions button { min-width: 70px; min-height: 34px; font-size: 10px; }

.add-card-button { display: grid; grid-template-columns: 1fr; place-items: center; align-content: center; gap: 10px; width: 100%; min-width: 82px; min-height: 100%; padding: 10px; border-radius: 10px; text-align: center; }
.add-card-button > span { width: 34px; height: 34px; border: 1px solid #d5dbea; border-radius: 50%; background: white; color: #63708c; font-size: 22px; box-shadow: none; }
.add-card-button strong { font-size: 11px; }

.preset-section { grid-area: motion; display: block; margin: 0; padding: 18px 20px 20px; }
.motion-heading { display: flex; align-items: start; justify-content: space-between; margin-bottom: 14px; }
.preset-section > .motion-heading > span { display: grid; gap: 3px; color: inherit; font-size: inherit; font-weight: inherit; letter-spacing: normal; text-transform: none; }
.preset-section .motion-heading h3 { margin: 0; font-size: 22px; letter-spacing: -.045em; }
.motion-heading small { color: #7e89a3; font-size: 12px; }
.motion-heading button { border: 0; background: transparent; color: var(--mt-purple); font-family: inherit; font-size: 12px; font-weight: 750; opacity: 1; }

.preset-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.preset-grid button { display: grid; gap: 7px; padding: 4px 4px 9px; border-radius: 11px; text-align: center; }
.preset-grid button.active { border-color: var(--mt-pink); box-shadow: 0 0 0 1px rgba(136,55,255,.5), 0 8px 20px rgba(160,50,212,.1); }
.preset-grid button > span { gap: 2px; }
.preset-grid strong { font-size: 11px; }
.preset-grid small { font-size: 9px; }
.preset-grid i.motion-thumb { position: relative; display: flex; align-items: center; justify-content: center; width: 100%; height: 92px; overflow: hidden; border-radius: 8px; background: linear-gradient(135deg,#4a3a32,#d4b89d); }
.motion-thumb img { position: relative; width: 46%; height: 82%; object-fit: cover; border-radius: 5px; box-shadow: 0 6px 15px rgba(0,0,0,.22); }
.motion-thumb img:first-child { z-index: 2; }
.motion-thumb img + img { margin-left: -14%; transform: scale(.8); }
.motion-thumb.is-curved-focus-carousel img:nth-child(2) { transform: scale(.78) rotate(7deg); }
.motion-thumb.is-curved-focus-carousel img:nth-child(3) { transform: scale(.66) rotate(12deg); }
.motion-thumb.is-vertical-focus-carousel img:nth-child(2),
.motion-thumb.is-vertical-focus-carousel img:nth-child(3) { margin-left: -28%; transform: translateY(27%) scale(.6); }

.carousel-speed-control { grid-template-columns: 1fr auto; gap: 7px 16px; margin-top: 16px; padding-top: 16px; }
.carousel-speed-control > span:first-child { grid-column: 1; }
.carousel-speed-control strong { font-size: 16px; }
.carousel-speed-control small { font-size: 11px; }
.carousel-speed-control output { grid-column: 2; min-width: 110px; color: var(--mt-pink); font-size: 12px; }
.carousel-speed-control input { grid-column: 1 / -1; }
.carousel-speed-limits { grid-column: 1 / -1; margin-top: -5px; }

.inspiration-placeholder { grid-area: inspiration; padding: 18px 20px 20px; }
.inspiration-placeholder header { display: flex; align-items: start; gap: 13px; margin-bottom: 14px; }
.inspiration-placeholder header > span { color: var(--mt-purple); font-size: 25px; }
.inspiration-placeholder h3 { margin: 0 0 3px; font-size: 16px; }
.inspiration-placeholder p { margin: 0; color: #7e89a3; font-size: 11px; }
.inspiration-grid { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); gap: 10px; }
.inspiration-tile { min-width: 0; }
.inspiration-tile img { display: block; width: 100%; aspect-ratio: 1.05; object-fit: cover; border-radius: 8px; }
.inspiration-tile span { display: block; margin-top: 7px; overflow: hidden; color: #303b55; font-size: 9px; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.browse-templates-placeholder { display: grid; place-items: center; align-content: center; min-height: 100%; border: 1px dashed #cbd3e3; border-radius: 9px; color: #303b55; text-align: center; }
.browse-templates-placeholder i { display: grid; place-items: center; width: 32px; height: 32px; margin-bottom: 8px; border: 1px solid #e0e5ef; border-radius: 50%; background: #fbfcff; color: #71809c; font-size: 24px; font-style: normal; }
.browse-templates-placeholder span { font-size: 10px; line-height: 1.3; }

.export-controls { grid-area: render; display: grid; grid-template-columns: 1fr; gap: 8px; padding: 18px 16px 0; border: 0; background: transparent; }
.export-controls button,
.export-controls a { min-height: 68px; border-radius: 14px; font-size: 20px; }
.export-controls .render-button { display: flex; align-items: center; justify-content: center; gap: 15px; background: linear-gradient(100deg,#ff526f,#ed349f 50%,#8738ff); box-shadow: 0 18px 35px rgba(202,51,186,.17); }
.export-controls .render-button > span { font-size: 25px; }
.export-controls .render-button > b { font-size: 28px; font-weight: 400; }
.export-controls > small { color: #7e89a3; font-size: 11px; text-align: center; }
.render-error { grid-area: render; }

#app-root > footer { display: none; }

@media (max-width: 1100px) {
  .creative-presentation,
  .creative-presentation.is-combined { grid-template-columns: minmax(0,1.15fr) minmax(430px,1fr); }
  .site-header { padding: 0 26px; }
  .site-header nav { gap: 22px; }
  .brand { min-width: 220px; }
}

@media (max-width: 900px) {
  body { padding: 0; background: #f7f9fd; }
  #app-root { min-height: 100vh; border: 0; border-radius: 0; box-shadow: none; }
  .site-header { height: 94px; padding: 15px 22px 8px; background: white; }
  .site-header nav, .profile-menu { display: none; }
  .brand { gap: 8px; min-width: 0; }
  .brand > img { width: 94px; height: 56px; }
  .brand > span { font-size: 28px; }
  .brand small { top: 29px; font-size: 11px; }
  .mobile-menu { display: grid; gap: 5px; width: 42px; padding: 8px 5px; border: 0; background: transparent; }
  .mobile-menu i { height: 2px; border-radius: 4px; background: var(--mt-ink); }
  .workflow-bar { min-height: 72px; grid-template-columns: 1fr; padding: 0 28px; background: #fff; }
  .workflow-bar > a, .workflow-bar > p { display: none; }
  .workflow-bar ol { justify-content: space-between; gap: 8px; width: 100%; }
  .workflow-bar li { min-width: 0; gap: 9px; font-size: 13px; }
  .workflow-bar li:not(:last-child)::after { left: calc(100% + 5px); width: clamp(24px,7vw,56px); }
  .workflow-bar b { width: 38px; height: 38px; font-size: 14px; }
  .result { padding: 12px 12px 24px; }
  .creative-presentation,
  .creative-presentation.is-combined {
    grid-template-columns: minmax(0,1fr);
    grid-template-areas: "preview" "cards" "motion" "render";
    gap: 14px;
  }
  .preview-shell { width: 100%; min-height: 520px; margin: 0; border-radius: 22px; }
  .preview-canvas { min-height: 520px; padding: 0; }
  .video-player iframe { width: min(100%, calc(500px * var(--preview-ratio))); }
  .preview-toolbar { top: 14px; right: 14px; left: 14px; }
  .preview-toolbar .format-select { width: min(285px, 64%); }
  .creative-products-column { margin: 0 !important; padding: 18px; }
  .product-grid-body { grid-auto-columns: 96px; }
  .preset-section { padding: 18px; }
  .preset-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .inspiration-placeholder { display: none; }
  .export-controls { padding: 8px 4px 0; }
}

@media (max-width: 520px) {
  .site-header { height: 82px; padding: 10px 16px 4px; }
  .brand > img { width: 74px; height: 48px; }
  .brand > span { font-size: 23px; }
  .brand small { top: 24px; font-size: 9px; }
  .workflow-bar { min-height: 66px; padding: 0 17px; }
  .workflow-bar li { font-size: 11px; }
  .workflow-bar b { width: 34px; height: 34px; }
  .workflow-bar li:not(:last-child)::after { display: none; }
  .result { padding: 10px 8px 20px; }
  .preview-shell, .preview-canvas { min-height: 465px; }
  .video-player iframe { width: min(100%, calc(450px * var(--preview-ratio))); }
  .preview-toolbar { right: 12px; left: 12px; }
  .preview-toolbar .format-select { width: 72%; }
  .preview-toolbar .format-select select { min-height: 48px; padding: 0 28px 0 38px; font-size: 11px; }
  .preview-toolbar .format-select::before { left: 14px; }
  .preview-action { min-width: 88px; min-height: 48px; font-size: 11px; }
  .preview-action::before { margin-right: 7px; }
  .creative-products-column h2,
  .preset-section .motion-heading h3 { font-size: 20px; }
  .product-grid-body { grid-auto-columns: 84px; }
  .preset-grid i.motion-thumb { height: 82px; }
  .preset-grid strong { font-size: 10px; }
  .preset-grid small { min-height: 21px; white-space: normal; line-height: 1.1; }
  .carousel-speed-control strong { font-size: 15px; }
  .export-controls button, .export-controls a { min-height: 70px; font-size: 20px; }
}
