/* CLAUDE 10-09: the Editor tab's home on a phone and the Add media picker (phoneed.js; the owner, 10-09, CapCut 9 on an
   iPhone). Everything is inside the phone query (below 768 px): above it #phEd and the dialogs are never shown and the
   desktop Video Editor page is exactly as it was. Our own artwork and tokens: dark surfaces, one green accent. */

.ph-ed,
dialog.ph-full {
  display: none;
}

@media (max-width: 767.98px) {
  .ph-ed {
    display: block;
    padding: 4px 0 8px;
  }
  /* the desktop start cards, projects, tools, presets and shortcut list are the desktop page's; the templates gallery stays */
  .ed-home > :is(.ed-hero, .ed-section-head, #edProjects, #edTools, .db-note) {
    display: none;
  }
  body.ph-modal #home {
    overflow: hidden; /* iOS scrolls the page behind a modal otherwise */
  }
  .ph-ed :is(button):focus-visible,
  dialog.ph-full :is(button, input, summary):focus-visible,
  dialog.ph-full .pv-track:focus-visible {
    outline: 2px solid var(--c-focus);
    outline-offset: 2px;
  }

  /* ----- hero ----- */
  .ph-hero {
    position: relative;
    isolation: isolate;
    min-height: 184px;
    aspect-ratio: 16 / 10;
    max-height: 260px;
    border: 1px solid var(--c-line-strong);
    border-radius: var(--r-xl);
    overflow: hidden;
    background: var(--c-canvas);
  }
  .ph-slide {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-start;
    gap: 6px;
    width: 100%;
    margin: 0;
    padding: 18px 16px 18px 18px;
    border: 0;
    border-radius: 0;
    text-align: left;
    color: #fff;
    opacity: 0;
    visibility: hidden;
    transition:
      opacity var(--d-sheet) ease,
      visibility 0s linear var(--d-sheet);
    -webkit-tap-highlight-color: transparent;
  }
  .ph-slide.on {
    opacity: 1;
    visibility: visible;
    transition: opacity var(--d-sheet) ease;
  }
  /* CLAUDE 10-12 Graphite: the slides are graphite with a soft warm-white light, not green washes */
  .ph-slide.s-clip {
    background:
      radial-gradient(120% 90% at 85% 8%, rgba(242, 240, 235, 0.16), transparent 60%),
      linear-gradient(160deg, #1c1c1f, #0e0e10);
  }
  .ph-slide.s-captions {
    background:
      radial-gradient(110% 90% at 12% 0%, rgba(242, 240, 235, 0.14), transparent 55%),
      linear-gradient(200deg, #1c1c1f, #0e0e10);
  }
  .ph-slide.s-voice {
    background:
      radial-gradient(100% 100% at 82% 100%, rgba(242, 240, 235, 0.13), transparent 60%),
      linear-gradient(135deg, #1c1c1f, #0e0e10);
  }
  .ph-art {
    position: absolute;
    top: 16px;
    right: 58px;
    width: 38%;
    max-width: 160px;
    pointer-events: none;
  }
  .ph-art svg {
    display: block;
    width: 100%;
    height: auto;
  }
  .ph-chip {
    padding: 3px 9px;
    border-radius: var(--r-pill);
    background: rgba(255, 255, 255, 0.08);
    color: var(--c-fg-2);
    font-size: var(--t-meta);
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
  }
  .ph-slide b {
    max-width: 70%;
    font-size: var(--t-page);
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -0.01em;
  }
  .ph-slide b span {
    color: var(--c-fg);
  }
  .ph-slide small {
    max-width: 58%; /* the slide dots sit at the right of this line */
    color: var(--c-fg-2);
    font-size: var(--t-body);
    line-height: 1.35;
  }
  .ph-find {
    position: absolute;
    z-index: 2;
    top: 8px;
    right: 8px;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55); /* 10-12: solid, no backdrop blur (a costly repaint over the playing video) */
    color: #fff;
  }
  .ph-i {
    width: 22px;
    height: 22px;
  }
  .ph-i.big {
    width: 32px;
    height: 32px;
    color: var(--c-fg);
  }
  .ph-dots {
    position: absolute;
    z-index: 2;
    right: 4px;
    bottom: 2px;
    display: flex;
  }
  #phHero .ph-dots button {
    display: grid;
    place-items: center;
    width: 36px;
    min-width: 44px;
    padding: 0;
    border: 0;
    background: transparent;
  }
  .ph-dots i {
    width: 8px;
    height: 8px;
    border-radius: var(--r-xs);
    background: rgba(255, 255, 255, 0.4);
    /* design polish B3b: the open dot stretches to a bar by scale (it used to animate `width`, which lays the row out on
       every frame); its cell is 44 px wide, so 8 to 22 px stays inside it */
    transition:
      scale var(--d-panel) var(--ease-out),
      background-color var(--d-panel) ease;
  }
  .ph-dots [aria-current] i {
    scale: 2.75 1;
    background: var(--c-fg);
  }

  /* ----- New video / Edit photo ----- */
  .ph-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 14px;
  }
  /* #phEd / #phPick in front of what sets a size over 44 px: phone.css's 44 px rule for buttons has an id in it */
  #phEd button.ph-card {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-start;
    gap: 2px;
    min-height: 140px;
    padding: 14px;
    border: 0;
    border-radius: var(--r-lg);
    background: var(--c-surface);
    color: var(--c-fg);
    text-align: left;
    -webkit-tap-highlight-color: transparent;
  }
  /* design polish B3b: a card and a tool are buttons, so the shared press (motion.css P1) is on them; a project's whole
     button stays still and its picture takes the press, as before */
  .ph-proj:not(:disabled):active {
    scale: none;
  }
  .ph-proj:active .ph-th {
    scale: var(--press-lg);
  }
  .ph-card b {
    font-size: var(--t-title);
    font-weight: 600;
  }
  .ph-card small {
    min-height: 2.6em; /* two lines in both cards, so the two titles sit on one line */
    color: var(--c-fg-3);
    font-size: var(--t-label);
    line-height: 1.3;
  }
  .ph-card-ico {
    position: absolute;
    top: 12px;
    left: 14px;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: var(--r-md);
    background: rgba(255, 255, 255, 0.07);
    color: var(--c-fg);
  }
  .ph-card-ico svg {
    width: 24px;
    height: 24px;
  }
  /* CLAUDE 10-12 Graphite: New video is the screen's one primary: a quiet card whose ＋ is the off-white mark */
  #phEd button.ph-new {
    border-color: transparent;
    background: var(--c-surface);
    color: var(--c-fg);
  }
  .ph-new small {
    color: var(--c-fg-3);
  }
  .ph-new .ph-card-ico {
    background: var(--c-primary);
    color: var(--c-primary-ink);
  }

  /* ----- headings, recent projects, tools ----- */
  .ph-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 24px 2px 10px;
  }
  .ph-head h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 650;
    letter-spacing: -0.2px;
  }
  .ph-head:focus,
  #edTemplates:focus {
    outline: none;
  }
  #edTemplates {
    margin-top: 24px;
  }
  .ph-recent {
    display: flex;
    gap: 10px;
    margin: 0 -16px;
    padding: 0 16px 4px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scroll-padding: 0 16px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .ph-recent::-webkit-scrollbar {
    display: none;
  }
  .ph-proj {
    flex: none;
    display: block;
    width: 112px;
    padding: 0;
    border: 0;
    background: none;
    color: #f3f3f3;
    text-align: left;
    scroll-snap-align: start;
    -webkit-tap-highlight-color: transparent;
  }
  .ph-th {
    position: relative;
    display: block;
    width: 112px;
    height: 112px;
    border: 1px solid var(--c-line-strong);
    border-radius: var(--r-lg);
    overflow: hidden;
    background: var(--c-raised);
    transition: scale 220ms var(--ease-spring);
  }
  .ph-th img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  .ph-th i {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: rgba(242, 240, 235, 0.4);
    font-size: 30px;
    font-style: normal;
    font-weight: 700;
  }
  .ph-th img + i {
    display: none;
  }
  .ph-proj b {
    display: block;
    margin-top: 6px;
    overflow: hidden;
    font-size: 13px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .ph-proj small {
    display: block;
    color: var(--c-fg-2);
    font-size: 12px;
  }
  .ph-all .ph-th {
    display: grid;
    place-items: center;
    border-style: dashed;
    border-color: var(--c-line-strong);
    color: var(--c-fg-2);
  }
  .ph-all .ph-th svg {
    width: 30px;
    height: 30px;
  }
  .ph-empty {
    width: 100%;
    margin: 0;
    padding: 18px 16px;
    border: 1px dashed var(--c-line-strong);
    border-radius: var(--r-lg);
    color: var(--c-fg-2);
    font-size: 14px;
    line-height: 1.45;
  }
  .ph-tools {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }
  #phEd button.ph-tool {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 96px;
    padding: 12px 6px;
    border: 1px solid #28282c;
    border-radius: var(--r-xl);
    background: var(--c-raised);
    color: var(--c-fg);
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    -webkit-tap-highlight-color: transparent;
  }
  #phEd .ph-tool:active {
    background: var(--c-raised);
  }
  .ph-ti {
    width: 28px;
    height: 28px;
    color: var(--c-fg);
  }

  /* ----- full-screen dialogs ----- */
  dialog.ph-full {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    overflow: hidden;
    background: #0b0d0b;
    color: #f3f3f3;
  }
  dialog.ph-full[open] {
    display: flex;
    flex-direction: column;
    animation: ph-up var(--d-sheet) var(--ease-sheet);
  }
  /* design polish B3b: out is an ease-out (the old ease-in started slowly at the moment the finger is watching) */
  dialog.ph-full.closing {
    animation: ph-down var(--d-sheet-out) var(--ease-out) forwards;
  }
  dialog.ph-full::backdrop {
    background: #000;
  }
  @keyframes ph-up {
    from {
      transform: translateY(100%);
    }
  }
  @keyframes ph-down {
    to {
      transform: translateY(100%);
    }
  }
  dialog.ph-full [hidden] {
    display: none !important;
  }
  .pk-main {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
  }
  .pk-top {
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    align-items: center;
    gap: 4px;
    min-height: 56px;
    padding: max(6px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) 4px
      max(8px, env(safe-area-inset-left));
  }
  .pk-top h2 {
    margin: 0;
    overflow: hidden;
    font-size: 17px;
    font-weight: 650;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .pk-x {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #fff;
  }
  .pk-x:active {
    background: rgba(255, 255, 255, 0.1);
  }
  .pk-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .pk-why {
    margin: 0 16px 6px;
    padding: 10px 12px;
    border-radius: var(--r-md);
    background: rgba(255, 255, 255, 0.05);
    color: var(--c-fg-2);
    font-size: 13.5px;
    line-height: 1.4;
  }
  .pk-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 4px 12px 8px;
  }
  #phPick .pk-tabs button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 56px;
    padding: 6px 4px;
    border: 1px solid transparent;
    border-radius: var(--r-lg);
    background: var(--c-raised);
    color: var(--c-fg-2);
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.15;
  }
  .pk-tabs button .ph-i {
    width: 20px;
    height: 20px;
  }
  .pk-tabs button[aria-selected='true'] {
    border-color: transparent;
    background: rgba(255, 255, 255, 0.08);
    color: var(--c-fg);
  }
  /* the Library tab carries the Premium pill on the free plan (stock videos are a Premium feature: pro.js, editor.css) */
  .pro-free #phPick .pk-tabs button[data-pro] {
    position: relative;
  }
  .pro-free #phPick .pk-tabs button[data-pro]::after {
    position: absolute;
    top: -6px;
    right: 6px;
    margin: 0;
  }
  .pk-subs {
    display: flex;
    gap: 4px;
    padding: 0 12px;
    border-bottom: 1px solid var(--c-line);
  }
  .pk-subs button {
    padding: 0 14px;
    border: 0;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    background: transparent;
    color: var(--c-fg-2);
    font-size: 14.5px;
    font-weight: 650;
  }
  .pk-subs button[aria-selected='true'] {
    border-bottom-color: var(--c-fg);
    color: var(--c-fg);
  }
  .pk-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 8px 0 16px;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  .pk-find {
    padding: 4px 12px 8px;
  }
  .pk-find input,
  .pk-search input {
    box-sizing: border-box;
    width: 100%;
    min-height: 44px;
    padding: 0 16px;
    border: 1px solid var(--c-line-strong);
    border-radius: var(--r-xl);
    background: var(--c-raised);
    color: #f3f3f3;
  }
  .pk-search {
    padding: 4px 12px 6px;
  }
  .pj-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px 10px;
    padding: 4px 16px 24px;
  }
  .pj-grid .ph-proj,
  .pj-grid .ph-th {
    width: 100%;
  }
  .pj-grid .ph-th {
    height: auto;
    aspect-ratio: 1;
  }
  .pj-grid .ph-empty {
    grid-column: 1 / -1;
  }

  /* the phone pane */
  .pk-big {
    display: flex;
    align-items: center;
    gap: 14px;
    width: calc(100% - 24px);
    margin: 8px 12px 12px;
    padding: 18px 16px;
    border: 1.5px dashed var(--c-line-strong);
    border-radius: var(--r-xl);
    background: var(--c-surface);
    color: #f3f3f3;
    text-align: left;
  }
  .pk-big span {
    display: grid;
    gap: 3px;
  }
  .pk-big b {
    font-size: 17px;
    font-weight: 700;
  }
  /* CLAUDE 10-16: once something is picked the card is a slim "Choose more" row above the picks */
  .pk-big.slim {
    margin-bottom: 8px;
    padding: 12px 16px;
    border-style: solid;
  }
  .pk-big.slim b {
    font-size: 15px;
    font-weight: 600;
  }

  /* the grids and their tiles */
  .pk-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
  }
  .pk-tile {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    background: var(--c-surface);
    content-visibility: auto;
    contain-intrinsic-size: auto 120px;
  }
  .pk-open {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    -webkit-tap-highlight-color: transparent;
  }
  .pk-open img,
  .pk-open video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
  }
  .pk-open::after {
    content: '';
    position: absolute;
    inset: auto 0 0;
    height: 38px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
    pointer-events: none;
  }
  .pk-dur {
    position: absolute;
    z-index: 1;
    right: 6px;
    bottom: 5px;
    color: #fff;
    font-size: 11.5px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 1px 3px #000;
  }
  .pk-tile.picked .pk-open::before {
    content: '';
    position: absolute;
    z-index: 1;
    inset: 0;
    box-shadow: inset 0 0 0 2px var(--c-fg);
    pointer-events: none;
  }
  .pk-tile.trimmed::after {
    content: 'Trimmed';
    position: absolute;
    z-index: 1;
    left: 6px;
    bottom: 5px;
    padding: 2px 6px;
    border-radius: var(--r-sm);
    background: rgba(0, 0, 0, 0.65);
    color: var(--c-fg);
    font-size: var(--t-meta);
    font-weight: 500;
    pointer-events: none;
  }
  .pk-sel {
    position: absolute;
    z-index: 2;
    top: 0;
    right: 0;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    -webkit-tap-highlight-color: transparent;
  }
  .pk-sel i {
    position: absolute;
    top: 8px;
    right: 8px;
    box-sizing: border-box;
    width: 24px;
    height: 24px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.35);
    color: #061000;
    font-size: 13px;
    font-style: normal;
    font-weight: 800;
    line-height: 20px;
    text-align: center;
    transition:
      background-color var(--d-press) ease,
      scale 220ms var(--ease-spring);
  }
  .pk-tile.picked .pk-sel i,
  .pk-sel.picked i {
    border-color: var(--c-fg);
    background: var(--c-fg);
  }
  .pk-sel:active i {
    scale: 0.9;
  }
  .pk-tile.picked .pk-sel i:empty::before,
  .pk-sel.picked i:empty::before {
    content: '✓';
  }
  .pk-skel {
    background: var(--c-raised);
    animation: pk-pulse 1.4s ease-in-out infinite; /* CLAUDE 10-11: opacity (composited), not a repainted gradient */
  }
  @keyframes pk-pulse {
    50% {
      opacity: 0.55;
    }
  }
  /* CLAUDE 10-12: a picked phone video while its poster is read, and one this browser cannot show (phoneed.js tileFor) */
  .pk-load,
  .pk-novid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: var(--c-raised);
    color: var(--c-fg-2);
    font-size: 12px;
    font-weight: 600;
    pointer-events: none;
  }
  .pk-load {
    animation: pk-pulse 1.4s ease-in-out infinite;
  }
  .pk-load .pk-spin {
    width: 22px;
    height: 22px;
    border-width: 2.5px;
  }
  .pk-novid .ph-i {
    width: 26px;
    height: 26px;
  }
  .pk-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 44px 28px;
    color: var(--c-fg-2);
    font-size: 14px;
    line-height: 1.45;
    text-align: center;
  }
  .pk-empty b {
    color: #f3f3f3;
    font-size: 16px;
  }
  .pk-empty p {
    margin: 0;
  }
  .pk-empty button,
  .pk-more {
    padding: 0 22px;
    border: 0;
    border-radius: var(--r-xl);
    background: rgba(255, 255, 255, 0.07);
    color: var(--c-fg);
    font-weight: 500;
  }
  .pk-more {
    display: block;
    width: calc(100% - 24px);
    margin: 14px 12px 4px;
  }
  .pk-chips {
    display: flex;
    gap: 8px;
    padding: 2px 12px 10px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .pk-chips::-webkit-scrollbar {
    display: none;
  }
  .pk-chip {
    flex: none;
    padding: 0 16px;
    border: 1px solid var(--c-line-strong);
    border-radius: var(--r-xl);
    background: var(--c-raised);
    color: var(--c-fg-2);
    font-size: 13.5px;
    font-weight: 600;
  }
  .pk-chip[aria-pressed='true'] {
    border-color: transparent;
    background: rgba(255, 255, 255, 0.1);
    color: var(--c-fg);
  }
  .pk-credit {
    margin: 14px 16px 0;
    color: var(--c-fg-3);
    font-size: 12px;
    line-height: 1.4;
  }

  .pk-msg {
    margin: 0;
    padding: 10px 16px;
    background: var(--c-raised);
    color: var(--c-fg-2);
    font-size: 13.5px;
    line-height: 1.4;
  }
  .pk-msg.bad {
    background: #2a1717;
    color: #ffb4b4;
  }

  /* the footer: what is picked and the Add button */
  .pk-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px max(16px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom))
      max(16px, env(safe-area-inset-left));
    border-top: 1px solid var(--c-line);
    background: #0e110e;
  }
  .pk-sum {
    min-width: 0;
    color: var(--c-fg-2);
    font-size: 13.5px;
    line-height: 1.3;
  }
  .pk-sum.bad {
    color: #ff9a9a;
  }
  dialog.ph-full .pk-add {
    flex: none;
    height: 48px;
    padding: 0 30px;
    border: 0;
    border-radius: var(--r-xl);
    background: #28282c;
    color: var(--c-fg-3);
    font-size: 16px;
    font-weight: 750;
  }
  dialog.ph-full .pk-add.on {
    background: var(--c-primary);
    color: var(--c-primary-ink);
  }
  dialog.ph-full .pk-add.done {
    background: transparent;
    box-shadow: inset 0 0 0 2px var(--c-fg);
    color: var(--c-fg);
  }

  /* ----- the layers over the picker: preview and progress ----- */
  .pk-prev,
  .pk-work {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    flex-direction: column;
    background: #0b0d0b;
  }
  .pk-prev {
    animation: ph-fade var(--d-ui) var(--ease-out);
  }
  @keyframes ph-fade {
    from {
      opacity: 0;
    }
  }
  .pv-stage {
    position: relative;
    display: grid;
    flex: 1;
    min-height: 0;
    place-items: center;
    background: #000;
  }
  .pv-stage video,
  .pv-stage > img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
  }
  .pv-tap {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 0;
    background: transparent;
  }
  .pv-nopv {
    position: absolute;
    right: 16px;
    bottom: 12px;
    left: 16px;
    margin: 0;
    color: var(--c-fg-2);
    font-size: 13px;
    text-align: center;
  }
  .pv-sel {
    position: relative;
    justify-self: end;
  }
  .pv-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    /* room right of the bar for the end handle's 44 px grab area */
    padding: 12px max(48px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
  }
  .pv-play {
    flex: none;
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--c-overlay);
    color: #fff;
  }
  .pv-track {
    position: relative;
    flex: 1;
    height: 52px;
    margin: 0 0 0 6px;
    border-radius: var(--r-md);
    background: var(--c-raised);
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
  }
  .pv-clip {
    position: absolute;
    inset: 0;
    overflow: hidden;
    border-radius: var(--r-md);
  }
  .pv-strip {
    position: absolute;
    inset: 0;
    background: center / 100% 100% no-repeat;
  }
  .pv-kept {
    position: absolute;
    top: 0;
    bottom: 0;
    box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.62);
  }
  .pv-track.trimming .pv-kept {
    border-block: 3px solid var(--c-fg);
  }
  .pv-h {
    position: absolute;
    top: -4px;
    bottom: -4px;
    display: none;
    width: 44px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
  }
  .pv-track.trimming .pv-h {
    display: block;
  }
  .pv-ha {
    transform: translateX(-100%);
  }
  dialog.ph-full .pv-h:focus-visible {
    outline: none; /* the whole 44 px box is the grab area: the ring goes on the visible bar instead */
  }
  .pv-h:focus-visible::before {
    box-shadow: 0 0 0 3px #fff;
  }
  .pv-h::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 16px;
    background: var(--c-fg);
  }
  .pv-ha::before {
    right: 0;
    border-radius: var(--r-sm) 0 0 var(--r-sm);
  }
  .pv-hb::before {
    left: 0;
    border-radius: 0 var(--r-sm) var(--r-sm) 0;
  }
  .pv-h::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 3px;
    height: 18px;
    margin-top: -9px;
    border-radius: 2px;
    background: #061000;
  }
  .pv-ha::after {
    right: 6.5px;
  }
  .pv-hb::after {
    left: 6.5px;
  }
  .pv-head {
    position: absolute;
    top: -6px;
    bottom: -6px;
    width: 3px;
    margin-left: -1.5px;
    border-radius: 2px;
    background: #fff;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5);
    pointer-events: none;
  }
  .pv-meta {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 8px max(18px, env(safe-area-inset-right)) 0 max(18px, env(safe-area-inset-left));
    color: var(--c-fg-2);
    font-size: 12.5px;
  }
  .pv-meta p {
    margin: 0;
  }
  .pv-meta .pv-time {
    flex: none;
    color: var(--c-fg-2);
    font-family: inherit;
    font-size: 12.5px;
    font-variant-numeric: tabular-nums;
  }
  .pv-photo {
    padding: 14px 20px 0;
  }
  .pv-photo label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
  }
  .pv-photo input {
    width: 100%;
    accent-color: var(--c-fg);
  }
  .pv-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px max(16px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom))
      max(16px, env(safe-area-inset-left));
  }
  .pv-foot .pk-add {
    margin-left: auto;
  }
  .pv-trim {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 48px;
    padding: 0 20px;
    border: 1px solid var(--c-line-strong);
    border-radius: var(--r-xl);
    background: var(--c-raised);
    color: #f3f3f3;
    font-size: 15px;
    font-weight: 650;
  }
  .pv-trim[aria-pressed='true'] {
    border-color: var(--c-fg);
    background: rgba(255, 255, 255, 0.1);
    color: var(--c-fg);
  }
  .pk-work {
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(11, 13, 11, 0.96);
  }
  .pk-work-card {
    display: grid;
    gap: 12px;
    justify-items: center;
    width: 100%;
    max-width: 340px;
    text-align: center;
  }
  .pk-work-card b {
    font-size: 18px;
  }
  .pk-work-card small {
    min-height: 2.6em;
    color: var(--c-fg-2);
    font-size: 14px;
    line-height: 1.4;
  }
  .pk-work.bad small {
    color: #ffb4b4;
  }
  .pk-work progress {
    overflow: hidden;
    width: 100%;
    height: 4px;
    border: 0;
    border-radius: var(--r-pill);
    background: var(--c-line-strong); /* CLAUDE 10-11: the desktop upload card's bar (style.css .upl-bar) */
    accent-color: var(--c-fg);
    appearance: none;
  }
  .pk-work progress::-webkit-progress-bar {
    background: var(--c-line-strong);
  }
  .pk-work progress::-webkit-progress-value {
    background: var(--c-fg);
  }
  .pk-work progress::-moz-progress-bar {
    background: var(--c-fg);
  }
  .pk-spin {
    width: 34px;
    height: 34px;
    border: 3px solid var(--c-line-strong);
    border-top-color: var(--c-fg);
    border-radius: 50%;
    animation: pk-turn 0.9s linear infinite;
  }
  @keyframes pk-turn {
    to {
      transform: rotate(360deg);
    }
  }
  .pk-work-btns button {
    padding: 0 22px;
    border: 0;
    border-radius: var(--r-xl);
    background: transparent;
    color: var(--c-fg);
    font-weight: 500;
  }
  .pk-work-btns .primary {
    background: var(--c-primary);
    color: var(--c-primary-ink);
  }

  /* style.css gives every button a grey :hover, which on a phone sticks after a tap and wipes a gradient or a photo's
     overlay: these keep their own look when hovered */
  :is(#phEd, dialog.ph-full)
    :is(.ph-proj, .ph-dots button, .pk-x, .pk-subs button, .pk-open, .pk-sel, .pv-tap, .pv-h):hover {
    background: transparent;
  }
  /* the same look as the resting state: a tap leaves :hover stuck on a phone */
  #phEd .ph-slide.s-clip:hover {
    background:
      radial-gradient(120% 90% at 85% 8%, rgba(242, 240, 235, 0.16), transparent 60%),
      linear-gradient(160deg, #1c1c1f, #0e0e10);
  }
  #phEd .ph-slide.s-captions:hover {
    background:
      radial-gradient(110% 90% at 12% 0%, rgba(242, 240, 235, 0.14), transparent 55%),
      linear-gradient(200deg, #1c1c1f, #0e0e10);
  }
  #phEd .ph-slide.s-voice:hover {
    background:
      radial-gradient(100% 100% at 82% 100%, rgba(242, 240, 235, 0.13), transparent 60%),
      linear-gradient(135deg, #1c1c1f, #0e0e10);
  }
  #phEd .ph-find:hover {
    background: rgba(0, 0, 0, 0.42);
  }
  #phEd .ph-card:hover,
  #phEd .ph-tool:hover,
  #phPick .pk-tabs button:hover,
  .pk-chip:hover {
    background: var(--c-raised);
  }
  #phEd button.ph-new:hover {
    background: var(--c-surface);
  }
  #phPick .pk-tabs button[aria-selected='true']:hover {
    background: rgba(255, 255, 255, 0.08);
  }
  .pk-chip[aria-pressed='true']:hover,
  .pv-trim[aria-pressed='true']:hover {
    background: rgba(255, 255, 255, 0.1);
  }
  .pk-big:hover {
    background: var(--c-surface);
  }
  .pk-empty button:hover,
  .pk-more:hover,
  .pv-trim:hover,
  .pk-work-btns button:hover {
    background: var(--c-raised);
  }
  .pv-play:hover {
    background: var(--c-overlay);
  }
  dialog.ph-full .pk-add:hover {
    background: var(--c-overlay);
  }
  dialog.ph-full .pk-add.on:hover,
  .pk-work-btns .primary:hover {
    background: var(--c-primary);
  }
  dialog.ph-full .pk-add.done:hover {
    background: transparent;
  }

  /* the recorder */
  .rc-body {
    padding: 4px 16px 16px;
  }
  .rc-done {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px max(12px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--c-line);
    background: var(--c-canvas);
    color: var(--c-fg-2);
    font-size: 14px;
  }
}

/* calm, not dead (design polish 3.5): the full-screen picker fades instead of sliding; the hero still cross-fades and the
   dots still change colour; nothing scales or stretches; a spinner keeps turning, slowly (a frozen one reads as a hang) */
@media (max-width: 767.98px) and (prefers-reduced-motion: reduce) {
  dialog.ph-full[open] {
    animation: ph-fade var(--d-ui) ease;
  }
  dialog.ph-full.closing,
  .pk-skel,
  .pk-load {
    animation: none;
  }
  .ph-th,
  .ph-dots i,
  .pk-sel i {
    transition: background-color var(--d-panel) ease;
  }
  .ph-dots [aria-current] i,
  .pk-sel:active i {
    scale: none;
  }
  .pk-spin {
    animation: pk-turn 2.4s linear infinite;
    border-top-color: var(--c-fg);
    border-right-color: var(--c-fg);
  }
}
