/* The camera print and the working controls share the same blue studio. */
.pocket-generator {
  --sky: #a4d4ff;
  --ink: #172e6a;
  --secondary: #304e75;
  --rule: #81a9ca;
  --panel: #fffdf7;
  --focus: #732993;
  --selection: #ffae76;
  --type: "DM Sans", "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  --display: "Archivo Black", "Arial Black", "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--sky);
  font-family: var(--type);
}
.pocket-generator .wrap {
  width: min(1180px, calc(100% - clamp(48px, 10vw, 152px)));
  max-width: none;
}
.pocket-generator .masthead {
  background: transparent;
  border: 0;
}
.masthead .gen-nav {
  display: flex;
  gap: 12px;
  min-height: 84px;
  padding-block: 9px;
  border-bottom: 1px solid #80b1d6;
}
.gen-nav .brand { margin-inline-end: auto; }
.gen-nav .brand img { width: 81px; }
.gen-tools {
  display: flex;
  align-items: stretch;
  padding: 3px;
  gap: 3px;
  max-width: 100%;
  border: 1px solid #93b7dc;
  border-radius: 30px;
  background: #c5e2fc;
}
.gen-tools a {
  display: grid;
  place-content: center;
  min-height: 38px;
  padding: 7px 16px;
  border-radius: 30px;
  color: var(--ink);
  font-size: .88rem;
  line-height: 1.2;
  font-weight: 700;
  text-decoration: none;
  text-align: center;
}
.gen-tools [aria-current="page"] {
  background: var(--ink);
  color: white;
}
.gen-tools a:hover:not([aria-current]) { background: #def0ff; }
.gen-account { position: relative; min-width: 0; }
#account-action, #account-summary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  margin: 0;
  padding: 5px 12px;
  background: transparent;
  color: var(--ink);
  border: 1px solid #749ac0;
  border-radius: 25px;
  font-size: .86rem;
  font-weight: 700;
  cursor: pointer;
}
#account-summary { list-style: none; }
#account-summary::-webkit-details-marker { display: none; }
#account-summary::after {
  content: "";
  width: 6px;
  height: 6px;
  border: solid currentColor;
  border-width: 0 1.5px 1.5px 0;
  transform: translateY(-2px) rotate(45deg);
}
#account-menu[open] #account-summary::after { transform: translateY(1px) rotate(225deg); }
#account-avatar {
  display: grid;
  place-items: center;
  flex: none;
  min-width: 28px;
  height: 28px;
  border-radius: 50%;
  color: var(--ink);
  background: var(--selection);
  font-size: .75rem;
}
#account-name {
  max-width: min(19ch, 21vw);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gen-account-panel {
  position: absolute;
  z-index: 5;
  top: calc(100% + 6px);
  inset-inline-end: 0;
  width: min(17rem, calc(100vw - 36px));
  padding: 16px;
  background: var(--panel);
  border: 1.5px solid var(--ink);
  border-radius: 13px;
  box-shadow: 3px 4px 0 #7399bf;
  line-height: 1.5;
}
.gen-account-panel p { margin-bottom: 8px; overflow-wrap: anywhere; }
#account-identity { font-weight: 700; }
#account-quota { color: var(--secondary); }

.gen-main { padding-block: 29px 35px; }
.gen-steps {
  display: flex;
  align-items: stretch;
  width: min(100%, 460px);
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: #385675;
  font-size: .84rem;
  font-weight: 650;
  line-height: 1.35;
}
.gen-steps li { display: flex; align-items: center; gap: 5px; min-width: 0; }
.gen-steps li:not(:last-child) { flex: 1; }
.gen-steps li:not(:last-child)::after {
  content: "";
  margin-inline-start: 5px;
  height: 1px;
  flex: 1;
  min-width: 7px;
  background: #78a2c5;
}
.gen-steps li[data-complete] { color: var(--ink); }
.gen-steps li[aria-current="step"] { color: var(--ink); font-weight: 800; }
.gen-steps li[aria-current="step"] span {
  text-decoration: underline;
  text-decoration-color: #ee722f;
  text-decoration-thickness: 3px;
  text-underline-offset: 5px;
}
.gen-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
  gap: clamp(30px, 7vw, 105px);
  align-items: center;
  margin-block: 32px;
}
.gen-editor, .gen-step, .gen-media { min-width: 0; }
.gen-stage-title {
  margin: 0;
  font: 900 clamp(3.65rem, 5.35vw, 5.5rem)/1.045 var(--display);
  letter-spacing: -.074em;
  text-wrap: balance;
  color: var(--ink);
}
.gen-stage-title span { display: block; color: #21478c; }
.gen-stage-title:lang(zh), .gen-stage-title:lang(ja) {
  letter-spacing: -.07em;
  word-break: normal;
}
.gen-stage-title:focus:not(:focus-visible) { outline: none; }
.gen-lead, .gen-tip, .gen-consent, .gen-guest-offer {
  max-width: 63ch;
  color: var(--secondary);
  font-size: .94rem;
  line-height: 1.55;
}
.gen-step > .gen-tip, .gen-step > .gen-lead { margin: 12px 0 20px; }
.gen-step > label[for], .gen-history label {
  display: block;
  margin: 0 0 7px;
  padding: 0;
  font-size: .86rem;
  font-weight: 740;
}
.gen-source-mode, #video-url, .template-filters input, .template-filters select,
#email-login input, #history-choice, #order-choice, #result-url {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 8px 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  background-color: var(--panel);
  color: var(--ink);
  border: 1.5px solid var(--ink);
  border-radius: 11px;
  font: inherit;
}
.gen-source-mode, #video-url, .gen-file, .template-picker { max-width: 24rem; }
.gen-source-mode, .template-filters select, #history-choice, #order-choice {
  padding-inline-end: 32px;
  font-weight: 650;
  cursor: pointer;
}
#link-panel, #video-panel, .template-picker { margin-block: 14px 0; }
#link-panel label { margin: 0 0 6px; font-size: .86rem; }
.template-picker { padding: 0; border: 0; min-inline-size: 0; }
.template-picker legend {
  position: absolute;
  width: 1px;
  height: 1px;
  clip-path: inset(50%);
  overflow: hidden;
}
.template-search-tools {
  margin-block: 6px;
  color: var(--secondary);
  font-size: .82rem;
}
.template-search-tools summary {
  display: list-item;
  width: fit-content;
  padding-block: 6px;
  color: var(--secondary);
  font-weight: 650;
  cursor: pointer;
}
.template-search-tools summary:hover { text-decoration: underline; text-underline-offset: .2em; }
.template-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 11px;
  padding-block: 3px 6px;
}
.template-filters label {
  min-width: 0;
  margin: 0;
  color: var(--secondary);
  font-size: .79rem;
  font-weight: 650;
}
.template-filters label:first-child { grid-column: 1 / -1; }
.template-filters input, .template-filters select { margin-top: 4px; font-size: 1rem; }
.template-list { display: flex; flex-wrap: wrap; gap: 8px; }
.template-card {
  display: inline-flex;
  position: relative;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  margin: 0;
  padding: 5px 13px 5px 7px;
  min-height: 40px;
  border: 1px solid #82a5c6;
  border-radius: 24px;
  background: #d4eaff;
  line-height: 1.2;
  cursor: pointer;
}
.template-card:has(:checked) {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
  background: var(--selection);
}
.template-card input, .gen-file input {
  position: absolute;
  width: 1px;
  height: 1px;
  clip-path: inset(50%);
  overflow: hidden;
}
.template-card:has(:focus-visible), .gen-file:has(:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
.template-card img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.template-card strong, .template-card small { display: block; overflow-wrap: anywhere; }
.template-card strong { font-size: .86rem; }
.template-card small { margin-top: 2px; font-size: .7rem; font-weight: 530; color: #304260; }

.gen-file {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  width: 100%;
  margin: 0;
  padding: 18px;
  border: 2px dashed #4779a5;
  border-radius: 14px;
  background: var(--panel);
  cursor: pointer;
}
.gen-file:hover:has(input:enabled) { border-color: var(--ink); background: #f3f9ff; }
.gen-file.is-dragging:has(input:enabled) {
  border: 2px solid var(--ink);
  background: var(--selection);
}
.gen-file-action { display: inline-flex; align-items: center; gap: 9px; }
.gen-file-action > span:first-child {
  display: grid;
  place-items: center;
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #d4eaff;
  font-size: 1rem;
}
.gen-filename, .gen-drop-hint, .gen-spec, .gen-storage-note, .gen-reference {
  color: var(--secondary);
  font-size: .82rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.gen-filename:empty, .gen-spec:empty { display: none; }
.gen-spec { margin-top: 6px; }
#video-panel:not([hidden]) ~ .gen-preview-shortcut { display: none; }
.gen-filename { font-weight: 520; }
.gen-media { width: 100%; display: grid; place-items: center; }
.gen-print {
  width: min(100%, 310px);
  min-width: 0;
  margin: 0;
  padding: 10px 10px 0;
  border: 1px solid #9ca6ad;
  background: var(--panel);
  box-shadow: 5px 6px 0 #5582a65e;
  transform: rotate(2deg);
}
.gen-frame {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: .88;
  min-width: 0;
  overflow: hidden;
  background: #d1e4f1;
}
.gen-frame.is-dragging::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  border: 3px solid var(--ink);
  box-shadow: inset 0 0 0 3px var(--selection);
}
.gen-frame > video, .gen-frame > img, #template-play {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #d1e4f1;
  object-fit: contain;
}
.gen-frame > video:focus-visible, #template-play:focus-visible { outline-offset: -4px; }
#template-play img { display: block; width: 100%; height: 100%; object-fit: contain; }
#template-play span {
  position: absolute;
  inset: auto auto 10px 10px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 13px;
  border-radius: 24px;
  background: var(--ink);
  color: white;
  font-size: .78rem;
  font-weight: 750;
}
#template-play span b { color: #ffb781; font-size: .67rem; }
#template-play:hover span { background: #21478c; }
.gen-print figcaption {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 2px;
  line-height: 1.35;
}
#preview-caption {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  font-size: .89rem;
  font-weight: 740;
  overflow-wrap: anywhere;
}
#preview-meta { flex: none; color: #465974; font-size: .75rem; }
.gen-empty {
  width: min(100%, 28ch);
  padding: 17px;
  color: var(--secondary);
  font-size: .92rem;
  line-height: 1.55;
  text-align: center;
  overflow-wrap: anywhere;
}
.gen-print:has(.gen-empty:not([hidden])) .gen-frame { aspect-ratio: 1.35; }
.gen-frame:has(video:not([hidden])) { background: #1d2d38; }
.gen-frame video:fullscreen { background: #101b29; transform: none; }

.gen-review { max-width: 30rem; margin: 18px 0; }
.gen-review > div {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline;
  gap: 16px;
  padding-block: 9px;
  border-bottom: 1px solid var(--rule);
  font-size: .9rem;
}
.gen-review dt { color: var(--secondary); }
.gen-review dd { margin: 0; text-align: end; font-weight: 720; overflow-wrap: anywhere; }
.gen-policy { display: flex; align-items: baseline; gap: 8px; max-width: 58ch; line-height: 1.45; }
.gen-consent .gen-policy { margin: 10px 0 4px; color: var(--ink); }
.gen-policy input { flex: none; margin: 0; accent-color: var(--ink); }
.gen-consent, .gen-guest-offer { margin-top: 10px; font-size: .86rem; }
.gen-consent p + p { margin-top: 4px; }
.gen-action {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  border-top: 1px solid #739dc5;
  padding-top: 16px;
}
#step-status:not(:empty) { margin: 0 auto 0 0; max-width: 54ch; font-size: .85rem; line-height: 1.4; overflow-wrap: anywhere; }
#step-status:empty { display: none; }
#step-back, .gen-account-action {
  min-height: 44px;
  padding: 8px 13px;
  border: 1px solid #769ab9;
  border-radius: 10px;
  background: var(--panel);
  font: 700 .9rem/1.25 var(--type);
}
#step-back { margin-inline-end: auto; background: transparent; border-color: transparent; }
#step-back:hover { text-decoration: underline; text-underline-offset: .2em; }
#step-next, #generate, .gen-download, .gen-email-submit {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  width: auto;
  max-width: 100%;
  min-height: 46px;
  min-width: 140px;
  margin: 0;
  padding: 10px 19px;
  border: 1px solid var(--ink);
  border-radius: 10px;
  background: var(--ink);
  color: white;
  font: 750 .96rem/1.25 var(--type);
  text-decoration: none;
}
#step-next:hover:enabled, #generate:hover:enabled, .gen-download:hover, .gen-email-submit:hover:enabled {
  background: #28498b;
}
.pocket-generator :disabled { opacity: .65; cursor: default; }
#generate[aria-busy="true"] { cursor: progress; }
#generate[aria-busy="true"] span { display: none; }
.gen-service-note {
  margin-bottom: 14px;
  padding: 9px 13px;
  border-inline-start: 3px solid #a94e26;
  background: #fff0e4;
  color: #4c331f;
  font-size: .9rem;
  line-height: 1.45;
}
.gen-feedback { display: flex; align-items: baseline; flex-wrap: wrap; gap: 3px 14px; }
.gen-feedback .status:not(:empty) { margin-top: 14px; }
.gen-feedback .status.error, #login-status.error { color: #78291c; }
#gen-progress progress { display: block; width: min(100%, 28rem); height: .6rem; margin-top: 10px; accent-color: var(--ink); }
.gen-reference { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 9px; margin-top: 6px; }
.gen-reference code { max-width: 100%; overflow-wrap: anywhere; user-select: all; color: var(--ink); }
.gen-reference button, .pocket-generator .queue-cancel { color: #21478c; }
#gen-result, .gen-billing, .gen-history { border-top: 1px solid var(--rule); margin-top: 22px; padding-top: 17px; }
#gen-result h2, .gen-billing h2 { font-size: clamp(1.4rem, 2.4vw, 2.1rem); letter-spacing: -.045em; }
#result-player {
  display: block;
  width: min(100%, 660px);
  max-height: 70vh;
  margin-block: 14px;
  border: 7px solid var(--panel);
  background: #182844;
  object-fit: contain;
}
.gen-result-actions, .gen-email-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 10px; }
.gen-result-actions > * { max-width: 100%; overflow-wrap: anywhere; }
.gen-result-actions .gen-download { white-space: normal; text-align: center; }
#result-url { max-width: 42rem; margin-top: 10px; }
#new-generation { margin-top: 13px; }
.gen-history label { margin-bottom: 6px; }
#history-choice, #order-choice { max-width: 27rem; }
.billing-packs { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 12px; }
.billing-pack {
  display: grid;
  gap: 2px;
  flex: 0 1 12rem;
  padding: 12px 15px;
  border: 1.5px solid var(--ink);
  border-radius: 11px;
  background: var(--panel);
  text-align: start;
}
.billing-pack span { color: var(--secondary); font-size: .87rem; }
.billing-pack:hover:enabled { background: #ffdbbb; }
#billing-status:not(:empty) { margin-top: 10px; }
.gen-storage-note { margin-top: 18px; max-width: 88ch; }
.pocket-generator .footer { color: var(--secondary); border-color: var(--rule); }

#login-dialog {
  position: fixed;
  inset: 0;
  width: min(25rem, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: clamp(18px, 4vw, 28px);
  overflow-y: auto;
  border: 2px solid var(--ink);
  border-radius: 17px;
  color: var(--ink);
  background: var(--panel);
  box-shadow: 5px 6px 0 #21376c;
}
#login-dialog::backdrop { background: #14234270; }
.gen-login-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.gen-login-head h2 { font-size: 1.6rem; letter-spacing: -.05em; }
#login-close { width: 42px; height: 42px; flex: none; border: 0; background: transparent; font-size: 1.7rem; }
.gen-providers { display: grid; gap: 8px; margin-top: 16px; }
.gen-providers button {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 7px;
}
.gen-social { border: 1px solid var(--rule); background: white; font-weight: 650; }
.gen-google { gap: 10px; border: 1px solid #747775; background: white; color: #1f1f1f; font: 500 14px/20px "Google Sans", Roboto, Arial, sans-serif; }
.gen-google img { object-fit: contain; }
.gen-apple { border: 1px solid black; background: black; }
.gen-apple img { display: block; max-width: 100%; height: auto; }
#email-login { display: grid; gap: 6px; border-top: 1px solid var(--rule); margin-top: 16px; padding-top: 15px; }
#login-providers[hidden] + #email-login { border-top: 0; padding-top: 0; }
#email-login label { margin: 0; font-size: .9rem; }
#login-code-row { display: grid; gap: 5px; margin-top: 8px; }
.gen-email-actions { margin-top: 7px; }
.gen-email-submit { min-width: 0; }
#login-status:not(:empty) { margin-top: 11px; }

@media (max-width: 840px) {
  .pocket-generator .wrap { width: calc(100% - 56px); }
  .gen-workspace { gap: 30px; }
  .gen-stage-title { font-size: clamp(2.85rem, 6.5vw, 3.65rem); }
}
@media (max-width: 650px) {
  .pocket-generator .wrap { width: calc(100% - 36px); }
  .masthead .gen-nav { min-height: 64px; flex-wrap: wrap; gap: 5px 8px; }
  .gen-nav .brand img { width: 62px; }
  .gen-tools { gap: 0; padding: 2px; }
  .gen-tools a { min-height: 36px; padding: 6px 10px; font-size: .79rem; }
  #account-action, #account-summary { min-height: 38px; padding: 5px 9px; font-size: .77rem; }
  #account-name { max-width: 16vw; }
  .gen-account-panel { width: min(17rem, calc(100vw - 36px)); }
  .gen-main { padding-block: 19px 25px; }
  .gen-steps { gap: 7px; font-size: .75rem; }
  .gen-steps li { gap: 4px; }
  .gen-workspace { display: flex; flex-direction: column; align-items: stretch; gap: 20px; margin: 22px 0 0; }
  .gen-stage-title { font-size: clamp(2.1rem, 7.9vw, 3rem); line-height: 1.1; letter-spacing: -.06em; }
  .gen-stage-title span { display: inline; color: var(--ink); }
  .gen-stage-title br { display: none; }
  .gen-step > .gen-tip, .gen-step > .gen-lead { margin: 8px 0 14px; font-size: .89rem; }
  .gen-source-mode, #video-url, .gen-file, .template-picker { max-width: none; }
  .template-card { min-height: 38px; }
  .template-card small {
    position: absolute;
    width: 1px;
    height: 1px;
    clip-path: inset(50%);
    overflow: hidden;
  }
  .gen-file { padding: 14px 16px; }
  .gen-print { width: min(100% - 16px, 254px); padding: 7px 7px 0; transform: rotate(1.3deg); }
  .gen-frame { aspect-ratio: 1; }
  .gen-print figcaption { padding-block: 8px; }
  .gen-print:has(.gen-empty:not([hidden])) .gen-frame { aspect-ratio: 2; }
  .gen-action {
    position: fixed;
    z-index: 4;
    inset: auto 0 0;
    min-height: 65px;
    padding: 8px max(18px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
    border-top: 1px solid #8badcf;
    background: #eef6ff;
  }
  .gen-action:has(#step-status:not(:empty)) { flex-wrap: wrap; row-gap: 3px; }
  #step-status:not(:empty) { flex-basis: 100%; max-width: none; font-size: .8rem; }
  #step-next, #generate { min-width: 106px; min-height: 44px; gap: 8px; padding-inline: 15px; }
  #step-back { min-width: 0; padding-inline: 3px; }
  html:has(.pocket-form:not([hidden])) { scroll-padding-bottom: calc(86px + env(safe-area-inset-bottom)); }
  .pocket-generator:has(.pocket-form:not([hidden])) .footer { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  .pocket-generator:has(.pocket-form:not([hidden]) #step-status:not(:empty)) .footer {
    padding-bottom: calc(145px + env(safe-area-inset-bottom));
  }
  .gen-storage-note { margin-top: 22px; }
}
@media (max-width: 350px) {
  .pocket-generator .wrap { width: calc(100% - 28px); }
  .masthead .gen-nav { gap: 4px; }
  .gen-nav .brand img { width: 52px; }
  .gen-tools a { padding-inline: 7px; }
}
@media (max-width: 500px) {
  /* Keep the account trigger at the right edge, even in longer translations. */
  .masthead .gen-nav {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
  }
  .gen-tools { justify-self: end; min-width: 0; }
  .gen-tools a { min-width: 0; overflow-wrap: anywhere; }
  #account-action { max-width: 24vw; }
}
@media (max-width: 389px) {
  .pocket-generator .gen-nav {
    grid-template-columns: 1fr auto;
    grid-template-areas: "brand account" "tools tools";
  }
  .pocket-generator .gen-tools {
    grid-area: tools;
    justify-self: start;
  }
  .pocket-generator .gen-account { grid-area: account; }
  .pocket-generator .gen-tools a { overflow-wrap: normal; }
  .pocket-generator #account-action { max-width: 50vw; }
}
@media (prefers-reduced-motion: no-preference) {
  .gen-step:not([hidden]) { animation: pocket-stage-in .14s ease-out; }
  @keyframes pocket-stage-in { from { transform: translateY(2px); } to { transform: none; } }
}
