/* Functional polish. Existing materials, typography and motion stay in control. */
.sr-only{position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;clip-path:inset(50%);white-space:nowrap;overflow:hidden}
.startup-skeleton{display:grid;gap:12px;width:min(300px,75vw);margin:24px auto 0}.startup-skeleton span{height:12px;border-radius:6px;background:var(--panel-2,#202020)}.startup-skeleton span:nth-child(2){width:80%}.startup-skeleton span:last-child{height:62px;margin-top:14px;border-radius:14px}
.polish-skeleton-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:20px;margin-top:24px}.polish-skeleton-tile{aspect-ratio:4/3;border-radius:12px;background:var(--panel-2,#202020)}
.polish-media{position:relative;isolation:isolate;overflow:hidden;background-color:var(--panel,#141414)}
.polish-media-pending,.polish-media-error{min-height:100px}
.polish-media-pending>img[data-polish-image]{opacity:0}
.polish-media>img[data-polish-image]{transition:opacity 180ms ease;display:block}
.polish-media:before{content:"";position:absolute;inset:0;z-index:0;background-image:var(--media-preview);background-size:cover;background-position:center;filter:blur(8px);opacity:0;pointer-events:none}
.polish-media-pending:before{opacity:.8}
.polish-media-pending:after{content:"";position:absolute;inset:0;z-index:1;background:linear-gradient(110deg,transparent 30%,#ffffff09 50%,transparent 70%);animation:polish-loading 1.6s ease-in-out infinite;pointer-events:none}
.polish-media-error:after{content:"Preview unavailable";position:absolute;inset:0;display:grid;place-items:center;padding:12px;color:var(--muted);font-size:12px;background:var(--panel)}
@keyframes polish-loading{from{transform:translateX(-100%)}to{transform:translateX(100%)}}
.toast{display:flex;align-items:center;gap:16px;max-width:min(480px,calc(100vw - 32px));bottom:calc(20px + env(safe-area-inset-bottom,0px))}
.toast.show{pointer-events:auto}
.toast button{min-height:44px;padding:8px 10px;border:0;border-radius:7px;background:#ffffff10;color:var(--text);font:inherit;font-weight:500;cursor:pointer;touch-action:manipulation}
.toast button:focus-visible{outline:2px solid var(--text);outline-offset:2px}.toast button:disabled{opacity:.5}
.ws-dialog{max-height:calc(100dvh - 32px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px));overscroll-behavior:contain}
.ws-dialog>header{position:relative}
.ws-dialog :is(button,a,summary){touch-action:manipulation}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  :is(button, [role="button"], a[href], summary):not(:disabled, [aria-disabled="true"]) {
    transition: translate 160ms var(--studio-ease, ease-out), scale 160ms var(--studio-ease, ease-out),
      rotate 160ms var(--studio-ease, ease-out), transform 160ms var(--studio-ease, ease-out),
      background-color 160ms ease, border-color 160ms ease, color 160ms ease;
  }

  :is(button, [role="button"], a[href], summary):not(:disabled, [aria-disabled="true"]):hover {
    translate: 0 -1px;
    scale: 1.015;
    rotate: -.35deg;
  }

  :is(button, [role="button"], a[href], summary):not(:disabled, [aria-disabled="true"]):active {
    translate: 0 0;
    scale: .985;
    rotate: 0deg;
  }

  /* Content controls should stay aligned; give smaller actions color feedback. */
  :where(.main, .mk-landing, dialog) :is(button, [role="button"], a[href], summary):not(:disabled, [aria-disabled="true"]):hover {
    translate: none;
    scale: none;
    rotate: none;
  }

  :where(.main, dialog.ws-dialog) :is(.ws-button, .plan-button):not(:disabled, [aria-disabled="true"]):hover {
    translate: 0 -1px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  :where(.main, dialog.ws-dialog) :is(.ws-button, .plan-button):not(:disabled, [aria-disabled="true"]):active {
    translate: none;
    scale: .985;
  }

  .ws-dialog[open] {
    animation: polish-dialog-in 190ms var(--studio-ease, ease-out);
  }

  .ws-dialog[open]::backdrop {
    animation: polish-fade-in 160ms ease-out;
  }

  :is(.credits-history, .as-disclosure, .as-cancel-review)[open] > :not(summary),
  .mk-faq details[open] > .mk-faq-answer {
    animation: polish-disclosure-in 170ms var(--studio-ease, ease-out);
  }
}

@keyframes polish-dialog-in {
  from { opacity: 0; scale: .985; }
  to { opacity: 1; scale: 1; }
}
@keyframes polish-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes polish-disclosure-in {
  from { opacity: 0; translate: 0 -3px; }
  to { opacity: 1; translate: none; }
}

.retention-banner,.retention-notice,.retention-card{--retention-accent:#fda4a4;--retention-border:#b65b5b}
.retention-banner{display:flex;align-items:center;gap:14px;padding:16px 18px;margin:0 0 24px;border:1px solid var(--line-strong);border-radius:12px;background:var(--panel);color:var(--text)}
.retention-banner.is-urgent{border-color:color-mix(in srgb,var(--retention-accent) 30%,var(--line));background:linear-gradient(100deg,color-mix(in srgb,var(--retention-accent) 5%,var(--panel)),var(--panel))}
.retention-banner strong,.retention-notice strong{font-size:13px;font-weight:600}.retention-banner p,.retention-notice p{font-size:13px;line-height:1.5;margin:4px 0 0;color:var(--muted)}
.retention-symbol,.retention-countdown>span,.retention-notice>span,.retention-nav-dot{display:inline-grid;place-items:center;flex:none;width:22px;height:22px;border-radius:50%;font-size:12px;font-weight:600;border:1px solid currentColor;color:var(--muted)}
.is-urgent>.retention-symbol,.retention-countdown,.retention-notice.is-urgent>span{color:var(--retention-accent)}
.retention-banner>.retention-review{margin-left:auto;white-space:nowrap}.retention-banner>.ws-icon{margin-left:auto;flex:none;width:40px;height:40px}.retention-banner:has(.retention-review)>.ws-icon{margin-left:0}
.nav-meta .retention-nav-dot{color:#fda4a4;width:19px;height:19px;font-size:11px}
.retention-card{min-width:0;position:relative;scroll-margin-block:100px}.retention-preview{position:relative;aspect-ratio:16/11;border:1px solid var(--retention-border);border-radius:12px;overflow:hidden;background:var(--bg)}
.lib-page .retention-preview{aspect-ratio:4/5}
.retention-open{display:block;width:100%;height:100%;padding:0;border:0;background:transparent;cursor:pointer}.retention-open :is(video,img){display:block;width:100%;height:100%;object-fit:contain}
.retention-countdown{position:absolute;top:12px;left:12px;display:flex;align-items:center;gap:6px;padding:6px 9px;border:1px solid color-mix(in srgb,var(--retention-accent) 25%,transparent);border-radius:7px;background:rgb(16 16 16 / .94);font-size:12px;pointer-events:none}.retention-countdown>span{width:16px;height:16px;font-size:10px;color:inherit}
.retention-card-actions{position:absolute;bottom:0;left:0;right:0;display:grid;grid-template-columns:1fr 1.15fr;gap:8px;padding:32px 12px 12px;background:linear-gradient(transparent,rgb(0 0 0 / .85));pointer-events:none}
.retention-card-actions .ws-button{pointer-events:auto;display:inline-flex;align-items:center;justify-content:center;gap:7px;min-width:0;min-height:44px;padding:10px 8px;font-size:12px;font-weight:600;border:1px solid var(--line-strong);border-radius:9px;background:linear-gradient(var(--hover),transparent),var(--panel-2);color:var(--text);box-shadow:inset 0 1px rgb(255 255 255 / .1),0 2px 0 var(--bg)}
.retention-card-actions .ws-primary{background:var(--text);color:var(--bg)}.retention-card-actions svg{width:16px;height:16px}
.retention-title{display:block;width:100%;padding:12px 2px;border:0;background:none;color:var(--text);font:inherit;font-size:13px;font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:left;cursor:pointer}
.retention-notice{display:grid;grid-template-columns:22px minmax(0,1fr);gap:8px 10px;padding:14px;border:1px solid var(--line);border-radius:10px}.retention-notice.is-urgent{border-color:color-mix(in srgb,var(--retention-accent) 35%,var(--line))}.retention-notice button{grid-column:2;justify-self:start}
.retention-notice.is-saved>span{border:0;color:var(--text)}.retention-notice.is-saved>span svg{width:20px;height:20px;fill:currentColor}.ws-save.is-saved svg{fill:currentColor}.ws-save,.retention-card-actions .ws-button{white-space:nowrap}
.retention-card:focus-visible,.retention-banner button:focus-visible,.retention-card button:focus-visible{outline:2px solid var(--text);outline-offset:3px}
@media(max-width:720px){.retention-banner{flex-wrap:wrap;gap:10px;padding:14px}.retention-banner>div{flex:1;min-width:180px}.retention-banner>.retention-review{order:3;margin-left:32px}.retention-banner>.ws-icon{align-self:flex-start}.lib-page .lib-item:has(>.retention-card){grid-column:1/-1}.lib-page .retention-preview{aspect-ratio:16/11}.retention-card-actions .ws-button{font-size:12px}}

.ws-dialog.ws-video-dialog {
  width: min(1100px, calc(100vw - 32px));
  padding: clamp(16px, 2.2vw, 28px);
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: var(--panel);
  color: var(--text);
}

.ws-video-dialog > header {
  margin-bottom: 16px;
  padding-bottom: 0;
  border: 0;
}

.ws-video-dialog > header h2 {
  font-size: clamp(18px, 2vw, 23px);
  font-weight: 600;
  letter-spacing: -.025em;
  overflow-wrap: anywhere;
}

.ws-video-dialog > header .ws-icon {
  width: 44px;
  height: 44px;
  flex: none;
  background: transparent;
  border-color: transparent;
}

.ws-video-detail {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
  gap: clamp(18px, 3vw, 32px);
  align-items: start;
}

.ws-video-dialog .ws-video-player {
  min-height: 0;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.ws-video-player video {
  display: block;
  width: 100%;
  max-height: min(70dvh, 680px);
  object-fit: contain;
}

.ws-video-player > p {
  margin: 0;
  padding: 32px 16px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.ws-video-sidebar {
  display: grid;
  gap: 16px;
  min-width: 0;
  padding-top: 4px;
}

.ws-video-meta,
.ws-video-prompt p {
  margin: 0;
  overflow-wrap: anywhere;
}

.ws-video-meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.ws-video-prompt h3 {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
}

.ws-video-prompt p {
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  max-height: 10rem;
  overflow: auto;
}

.ws-video-actions {
  display: grid;
  gap: 8px;
}

.ws-video-primary,
.ws-video-tools {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 8px;
}

.ws-video-primary:empty {
  display: none;
}

.ws-video-dialog .ws-video-sidebar .ws-button {
  min-height: 44px;
  padding-inline: 12px;
  border-radius: 9px;
  border-color: var(--line-strong);
  background: var(--panel-2);
  color: var(--text);
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  min-width: 0;
  background: linear-gradient(var(--hover),transparent),var(--panel-2);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .08),0 2px 0 var(--bg),0 3px 6px rgb(0 0 0 / .2);
  transition: transform 120ms cubic-bezier(.23,1,.32,1);
}

.ws-video-dialog .ws-video-sidebar .ws-primary {
  border-color: var(--text);
  background: var(--text);
  color: var(--bg);
  background: linear-gradient(rgb(255 255 255 / .18),transparent),var(--text);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .8),0 2px 0 var(--muted),0 3px 6px rgb(0 0 0 / .2);
}

.ws-video-primary .ws-button,
.ws-video-tools .ws-button {
  flex: 1 1 auto;
}

.ws-video-dialog .ws-video-sidebar :is(.ws-video-tools .ws-button,.ws-video-trash) {
  border-color: var(--line-strong);
}

.ws-video-tools .ws-button[aria-pressed="true"] svg {
  fill: currentColor;
}

.ws-video-dialog .ws-video-sidebar .ws-video-trash {
  --detail-danger: #fda4a4;
  width: 100%;
  color: var(--detail-danger);
  border-color: color-mix(in srgb,var(--detail-danger) 30%,transparent);
  background: linear-gradient(rgb(255 255 255 / .03),transparent),color-mix(in srgb,var(--detail-danger) 8%,var(--panel));
}
.ws-video-danger {border-top:1px solid var(--line);padding-top:16px;margin-top:4px}
.ws-video-dialog .ws-button svg {width:16px;height:16px;flex:none}
.ws-video-dialog .ws-video-sidebar .ws-button:active {transform:translateY(1px) scale(.98)}
.ws-video-primary > :only-child {grid-column:1/-1}
@media(prefers-reduced-motion:reduce){.ws-video-dialog .ws-video-sidebar .ws-button{transition:none}.ws-video-dialog .ws-video-sidebar .ws-button:active{transform:none}}

.ws-video-more {
  padding-top: 4px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.ws-video-more summary {
  min-height: 44px;
  padding-block: 12px;
  cursor: pointer;
}

.ws-video-more ul {
  padding-inline-start: 20px;
}

.ws-video-more button {
  margin: 4px 4px 0 0;
}

.ws-video-dialog :is(button,summary):focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

@media (hover: hover) {
  .ws-video-dialog > header .ws-icon:hover,
  .ws-video-dialog .ws-video-tools .ws-button:hover {
    background: var(--hover);
  }
}

@media (max-width: 720px) {
  .ws-video-detail {
    grid-template-columns: minmax(0, 1fr);
  }

  .ws-video-dialog .ws-video-player video {
    max-height: 48dvh;
  }
}

:is(.ws-page-head,.ws-project-heading,.credits-page,.account-settings) h1{text-wrap:balance}
:is(.balance-total,.credit-history strong,.subscription-credits strong,.mc-quantity-value,[data-generation-cost]){font-variant-numeric:tabular-nums}
:is(.composer-menu,.mc-popover,.pj-project-menu) :is(button,a):focus-visible{outline:2px solid var(--text);outline-offset:2px}
:is(.ws-button,.ws-icon,.lib-text-action):active{filter:brightness(.9)}
@media(pointer:coarse){.lib-page .ws-star,.ws-dialog .ws-icon,.pj-project-menu summary{min-width:44px;min-height:44px}.composer-menu button,.mc-popover button{min-height:44px}}
@media(max-width:720px){
 .polish-skeleton-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
 .ws-dialog{max-width:calc(100vw - 24px - env(safe-area-inset-left,0px) - env(safe-area-inset-right,0px));padding-bottom:max(20px,env(safe-area-inset-bottom,0px))}
 .ws-dialog>header{touch-action:pan-x;padding-top:14px}
 .ws-dialog>header:before{content:"";position:absolute;top:0;left:calc(50% - 16px);width:32px;height:3px;border-radius:3px;background:var(--line-strong)}
 .lib-page{padding-bottom:calc(32px + env(safe-area-inset-bottom,0px))}
 .toast{left:max(16px,env(safe-area-inset-left,0px));right:max(16px,env(safe-area-inset-right,0px));max-width:none}
}
@media(prefers-reduced-motion:reduce){.polish-media-pending:after{animation:none;background:#ffffff04}.polish-media>img[data-polish-image],.toast{transition:none}}
