/* One button shape everywhere: a pill. Anything you press that is a button, a segment, a tab, a chip or a menu row takes this radius.
   Cards, tiles, swatches, drag handles and accordion headers stay as they are: they are surfaces, not buttons.
   Loaded last on every studio surface so no panel can fall back to a squarer corner. */
:root { --pill: 10px; }   /* rounded rectangles, not full pills (owner, 29 Oct) */

/* shared UI kits */
html:root body:not(#g1):not(#g2):not(#g3) :is(.gs-btn, .gs-icon-btn, .gs-chip, .gs-tab, .gs-tabs-track, .gs-seg, .gs-seg-thumb, .gs-dd-trigger, .gs-menu-item, .gs-dd-option, .g-btn, .g-chip, .g-seg, .g-seg-item, .g-seg-thumb, .ss-word, .ss-change-go) { border-radius: var(--pill) !important; }
html:root body:not(#g1):not(#g2):not(#g3) :is(.gs-rail-btn, .gs-rail-thumb) { border-radius: 14px !important; }
html:root body:not(#g1):not(#g2):not(#g3) .gs-edit-rail { border-radius: 22px !important; }   /* the whole rail is a container, so it is rounded rather than a capsule */
html:root body:not(#g1):not(#g2):not(#g3) :is(.gs-menu-item, .gs-dd-option) { border-radius: 14px !important; }   /* rows inside a menu: rounded rows, not capsules, so the list stays tidy */

/* the editor shell */
html:root body:not(#g1):not(#g2):not(#g3) :is(
  .btn-sk, .btn-primary-sk, .btn-secondary-sk, .btn-xs-compact, .btn-generate-ai-master, #studio-top-export-btn, #studio-nav-projects-btn,
  .sl-save-btn, .sl-ws-btn, .sl-view-btn, .sl-icon-only, .sl-behind-btn, .sl-saved-btn, .settings-icon-btn, .sidebar-collapse-btn,
  .transport-play-btn, .transport-icon-btn, .gradial-speed-pill, .vs-tool-btn, #video-timeline-fit, .vs-timeline-tools-right button,
  .font-cat-pill, .tab-pill-btn, .studio-dropzone-cta-btn, #btn-timeline-add-subtitle, #studio-beta-tag, #studio-active-project-name
) { border-radius: var(--pill) !important; }

/* caption controls */
html:root body:not(#g1):not(#g2):not(#g3) :is(.cs-btn, .cs-dd, .cs-font-btn, .cs-reset, .cs-tabs, .cs-tabs>button, .cs-scope, .cs-scope>button, .cs-seg, .cs-seg>button, .cs-place, .cs-place>button),
html:root body:not(#g1):not(#g2):not(#g3) :is(.cs-tabs, .cs-scope, .cs-seg, .cs-place)>:is(i, b, span, div)[class*=thumb] { border-radius: var(--pill) !important; }

/* the tour */
html:root body:not(#g1):not(#g2):not(#g3) :is(.gt-btn, .gt-skip, .gt-close) { border-radius: var(--pill) !important; }

/* export window */
html:root body:not(#g1):not(#g2):not(#g3) :is(.vx-btn, .vx-chip, .vx-places button, .vx-next, .gradial-export-popup button:not(.vx-card)) { border-radius: var(--pill) !important; }

/* panel controls found in each Edit section */
html:root body:not(#g1):not(#g2):not(#g3) :is(.gs-seg>button, .gs-filter, .gs-dd, .gs-dd>button, .md-filter, .mg-site-go, .ar-power, .ar-x, .cs-swatch-add, .gs-soon-pill) { border-radius: var(--pill) !important; }

/* The Gradian proportions (docs/GRADIAN_PROPORTIONS.md): one ladder of sizes, one shape, one way to pad. */
:root {
  --gp-phi: 1.618034;
  --gp-g8: 28px;    /* small control  */
  --gp-g9: 34px;    /* regular control */
  --gp-g10: 44px;   /* large control: Apple's smallest comfortable tap target */
  --gp-panel: clamp(248px, calc(100vw / 5.4), 336px);   /* a side panel: the width divided by phi^3.5, kept between 248 and 336 */
}
/* regular controls in the editor's top bar: height from the ladder, padding h / phi^2, gap h / phi^3 */
html:root body:not(#g1):not(#g2):not(#g3) :is(#studio-nav-projects-btn, #studio-top-export-btn) {
  --gp-h: var(--gp-g9); min-height: var(--gp-h) !important; padding-inline: calc(var(--gp-h) / 2.618) !important; gap: calc(var(--gp-h) / 4.236) !important;
}
/* the two side panels share one width; a width you drag them to still wins */
@media (min-width: 1201px) {
  html:root body:not(#g1):not(#g2):not(#g3) .app-container #studio-left-panel.sidebar:not(.collapsed),
  html:root body:not(#g1):not(#g2):not(#g3) .app-container #studio-right-panel:not(.collapsed) {
    width: var(--left-panel-w, var(--gp-panel)) !important; min-width: 248px !important; max-width: 420px !important;
  }
  html:root body:not(#g1):not(#g2):not(#g3) .app-container #studio-right-panel:not(.collapsed) { width: var(--right-panel-w, var(--gp-panel)) !important; }
  /* in the video editor the tool rail sits inside the left panel: add its width, so a tool's own content is as wide as the right panel's */
  html:root body.mode-video:not(#g1):not(#g2):not(#g3) .app-container #studio-left-panel.sidebar:not(.collapsed) { width: var(--left-panel-w, calc(var(--gp-panel) + 56px)) !important; }
}

/* switchers: the track and the sliding highlight are both capsules */
html:root body:not(#g1):not(#g2):not(#g3) :is(.gs-seg[role], .gs-seg[role]>.gs-seg-thumb, .gs-seg[role]>button, .sl-seg, .sl-seg-thumb, #template-font-category-pills, #template-font-category-pills .sl-seg-thumb, .cs-tabs-thumb, .cs-scope-thumb, .cs-seg-thumb, .cs-place-thumb) { border-radius: var(--pill) !important; }

/* Icon-only buttons are rounded squares, not circles: text controls are capsules, icon controls sit on the ladder's G4 corner */
html:root body:not(#g1):not(#g2):not(#g3) :is(.sl-save-btn, .sl-ws-btn, .sl-view-btn, .sl-icon-only, .sl-behind-btn, .sl-saved-btn, .settings-icon-btn, .sidebar-collapse-btn, .transport-play-btn, .transport-icon-btn, .vs-tool-btn, .cs-reset, .cs-btn.cs-icon, .gs-icon-btn, .ar-power, .ar-x, .cs-btn.cs-change, .cs-btn.cs-save) { border-radius: 10px !important; }

/* a press gives a little: scale down 3 %, no more */
@media (prefers-reduced-motion: no-preference) {
  html:root body:not(#g1):not(#g2):not(#g3) :is(button, [role=button], [role=tab], [role=radio]):not(:disabled):not([aria-disabled=true]):not(.cu-clip-main):not(.tr-row-main):not(.vc-pick):not(.vc-handle):active { scale: .97; }
}

/* the Edit rail: evenly spaced, one quiet highlight */
html:root body:not(#g1):not(#g2):not(#g3) .gs-edit-rail { --gap: 6px; gap: var(--gap); padding: 10px 5px; }
/* the highlight steps by exactly one button and one gap, and covers exactly a button, so it sits on the icon at every row */
html:root body:not(#g1):not(#g2):not(#g3) .gs-edit-rail > .gs-rail-thumb { left: 5px; right: 5px; top: 10px; transform: translateY(calc(var(--i) * (var(--h) + var(--gap)))); }
html:root body:not(#g1):not(#g2):not(#g3) .gs-edit-rail .gs-rail-btn { min-height: 38px; }

/* switchers with many or long labels: share the width evenly, never run past the panel */
html:root body:not(#g1):not(#g2):not(#g3) :is(.gs-seg, .gs-tabs-track) { width: 100%; box-sizing: border-box; min-width: 0; overflow: hidden; }
html:root body:not(#g1):not(#g2):not(#g3) :is(.gs-seg[data-count="3"], .gs-seg[data-count="4"], .gs-seg[data-count="5"], .gs-seg[data-count="6"])>button,
html:root body:not(#g1):not(#g2):not(#g3) .gs-tabs-track .gs-tab { padding-inline: 6px !important; font-size: 11.5px !important; letter-spacing: -.005em; white-space: nowrap; min-width: 0; flex: 1 1 auto; }

/* Studio refinements (29 Oct): the "Free for now" tag sits in the preview's bottom corner, clear of the sample words at the top;
   the transcript's title and its actions share one row. */
html:root body .gradial-template-card .gp-free-now{top:auto !important;bottom:6px !important;left:6px !important;font-size:10px !important;padding:2px 7px !important;opacity:.92}
html:root body:not(#g1):not(#g2):not(#g3):not(#g4):not(#g5):not(#g6):not(#g7) .section-header.transcript-header{flex-direction:row !important;align-items:center !important;flex-wrap:nowrap !important;gap:8px}
html:root body:not(#g1):not(#g2):not(#g3):not(#g4):not(#g5):not(#g6):not(#g7) .section-header.transcript-header .transcript-actions{margin-left:auto}

/* ---- studio fixes (29 Oct, from the owner's list) ---- */
/* the speed menu opens upward out of the transport bar: the bar may not clip what rises above it */
html:root body #floating-transport-bar { overflow-x: clip !important; overflow-y: visible !important; }
/* the All / Caption / Word switch was squeezed to 8 px and hidden */
html:root body:not(#g1):not(#g2):not(#g3) #cs-pane-style .cs-scope { flex: none !important; min-height: 38px !important; height: auto !important; overflow: visible !important; }
/* timeline tools: plain icon buttons with no dark box around them */
html:root body:not(#g1):not(#g2):not(#g3) :is(#btn-timeline-split, #btn-timeline-delete, #btn-timeline-duplicate) { background: transparent !important; border: 0 !important; box-shadow: none !important; }
html:root body:not(#g1):not(#g2):not(#g3) :is(#btn-timeline-split, #btn-timeline-delete, #btn-timeline-duplicate):hover { background: color-mix(in srgb, var(--t-text, #fff) 9%, transparent) !important; }
html:root body:not(#g1):not(#g2):not(#g3) :has(> #btn-timeline-split) { background: transparent !important; border: 0 !important; box-shadow: none !important; }
/* Add caption: one clear small button */
html:root body:not(#g1):not(#g2):not(#g3) .app-container #btn-timeline-add-subtitle:not(#g4):not(#g5):not(#g6):not(#g7) { height: 30px !important; padding: 0 12px !important; border: 0 !important; border-radius: 10px !important; background: var(--t-text, #f4f4f5) !important; color: var(--t-app, #0b0b0c) !important; box-shadow: none !important; font-weight: 600 !important; gap: 6px; }
html:root body:not(#g1):not(#g2):not(#g3) #btn-timeline-add-subtitle:hover { filter: brightness(1.06); }
html:root body:not(#g1):not(#g2):not(#g3) .app-container #btn-timeline-add-subtitle:not(#g4):not(#g5):not(#g6):not(#g7) * { color: inherit !important; }
/* brand finder: the field is part of the bar, not a dark box inside it */
html:root body:not(#g1):not(#g2):not(#g3) .cs-brand-head input.cs-brand-site { background: transparent !important; border: 0 !important; box-shadow: none !important; height: 100% !important; padding: 0 !important; }
/* captions: the button is the progress. It fills as captions arrive, then shows the result; no separate bar or percentage */
html:root body #subtitles-progress-container :is(.ai-progress-track, #subtitles-progress-pct) { display: none !important; }
html:root body:not(#g1):not(#g2):not(#g3) #btn-generate-subtitles.is-working { position: relative; overflow: hidden; color: var(--t-text, #f4f4f5) !important;
  background: linear-gradient(90deg, color-mix(in srgb, var(--t-text, #fff) 18%, transparent) var(--gen-p, 0%), color-mix(in srgb, var(--t-text, #fff) 7%, transparent) var(--gen-p, 0%)) !important;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--t-text, #fff) 14%, transparent) !important; cursor: progress; transition: background .3s ease; }
html:root body:not(#g1):not(#g2):not(#g3) #btn-generate-subtitles.is-done { background: color-mix(in srgb, #4ade80 18%, var(--t-raised, #18181b)) !important; color: #86efac !important; box-shadow: inset 0 0 0 1px color-mix(in srgb, #4ade80 35%, transparent) !important; }
html:root body:not(#g1):not(#g2):not(#g3) #btn-generate-subtitles.is-failed { background: color-mix(in srgb, #f87171 16%, var(--t-raised, #18181b)) !important; color: #fca5a5 !important; box-shadow: inset 0 0 0 1px color-mix(in srgb, #f87171 35%, transparent) !important; }
#btn-generate-subtitles .gen-spin { width: 15px; height: 15px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: gen-spin .7s linear infinite; flex: none; }
#btn-generate-subtitles .gen-label { display: inline-grid; justify-items: center; line-height: 1.15; }
#btn-generate-subtitles .gen-label small { font-size: 11px; font-weight: 500; opacity: .8; }
#btn-generate-subtitles:is(.is-done, .is-failed) > i { animation: gen-pop .32s cubic-bezier(.2, 0, 0, 1.4) both; }
#btn-generate-subtitles:is(.is-working, .is-done, .is-failed) .gen-label { animation: gen-in .24s cubic-bezier(.2, 0, 0, 1) both; }
@keyframes gen-spin { to { transform: rotate(360deg); } }
@keyframes gen-pop { from { transform: scale(.3); opacity: 0; } }
@keyframes gen-in { from { transform: translateY(4px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { #btn-generate-subtitles .gen-spin { animation-duration: 2s; } #btn-generate-subtitles :is(i, .gen-label) { animation: none !important; } }

/* A tall (vertical) video: the picture in its own tall column, the timeline beside it (video-studio-overhaul.js sets the class
   and --gs-tall-preview). The grey that used to sit either side of a 9:16 picture becomes timeline room. */
html:root body.mode-video.gs-tall-video:not(#g1):not(#g2):not(#g3) #workspace-video-layout .studio-center{flex-direction:row!important;align-items:stretch!important;gap:12px!important;min-height:0!important}
html:root body.mode-video.gs-tall-video:not(#g1):not(#g2):not(#g3) #workspace-video-layout .studio-center>.studio-preview{flex:0 0 var(--gs-tall-preview,380px)!important;width:var(--gs-tall-preview,380px)!important;max-width:50%!important;height:auto!important;min-height:0!important;max-height:none!important;transition:flex-basis .32s cubic-bezier(.2,0,0,1),width .32s cubic-bezier(.2,0,0,1)}
html:root body.mode-video.gs-tall-video:not(#g1):not(#g2):not(#g3) #workspace-video-layout .studio-center>.studio-timeline-deck{flex:1 1 auto!important;height:auto!important;min-height:0!important;max-height:none!important;min-width:0!important;width:auto!important}
html:root body.mode-video.gs-tall-video:not(#g1):not(#g2):not(#g3) #workspace-video-layout .studio-timeline-deck>.video-timeline-resize{display:none!important}
/* the column is narrow: the volume slider gives way (the mute button stays), so the seek bar keeps its length */
html:root body.mode-video.gs-tall-video:not(#g1):not(#g2):not(#g3) .studio-preview #vid-volume-slider{display:inline-block!important;opacity:1!important;width:60px!important}
@media (prefers-reduced-motion:reduce){html:root body.mode-video.gs-tall-video #workspace-video-layout .studio-center>.studio-preview{transition:none}}

/* 29 Oct sweep: Audio list rows read in two clean lines (the name up to two, the category and length on one), the footer message wraps instead of being cut */
html:root body:not(#g1):not(#g2):not(#g3) .al-row { gap: 8px; grid-template-columns: 30px minmax(0, 1fr) 30px; }
html:root body:not(#g1):not(#g2):not(#g3) .al-main strong { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: normal; word-break: normal; hyphens: manual; }
html:root body:not(#g1):not(#g2):not(#g3) .al-meta { display: flex; gap: 6px; min-width: 0; white-space: nowrap; }
html:root body:not(#g1):not(#g2):not(#g3) .al-meta .al-cat { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
html:root body:not(#g1):not(#g2):not(#g3) .al-meta .al-cat:not(:empty) + .al-dur::before { content: "\00b7"; margin-right: 6px; }
html:root body:not(#g1):not(#g2):not(#g3) .al-meta .al-dur { flex: none; }
html:root body:not(#g1):not(#g2):not(#g3) .gs-search input { text-overflow: ellipsis; }
html:root body:not(#g1):not(#g2):not(#g3) .gs-foot .gs-status { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.35; }
/* cards that carry a length (Transitions): the name takes its own line (up to two), the length sits under it, so nothing is cut */
html:root body:not(#g1):not(#g2):not(#g3) .gs-card-name:has(> small) { flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 1px; }
html:root body:not(#g1):not(#g2):not(#g3) .gs-card-name > span { min-width: 0; overflow-wrap: normal; }
html:root body:not(#g1):not(#g2):not(#g3) .gs-card-name > small { white-space: nowrap; }
html:root body:not(#g1):not(#g2):not(#g3) .gs-card-name { min-width: 0; }
/* number boxes beside sliders: one width whatever the unit, and a field you can actually hit */
html:root body:not(#g1):not(#g2):not(#g3) .gs-slider-value { min-height: 28px; min-width: 74px; justify-content: flex-end; box-sizing: border-box; }
html:root body:not(#g1):not(#g2):not(#g3) .gs-slider-value input { width: 42px; height: 28px; }
/* the presets header: the title and its three buttons share the row, and the buttons never get pushed out of it */
html:root body:not(#g1):not(#g2):not(#g3) .forge-view > div:first-child { justify-content: space-between; align-items: center; gap: 8px; min-width: 0; }
html:root body:not(#g1):not(#g2):not(#g3) .forge-view > div:first-child > div:last-child { flex: none; }
html:root body:not(#g1):not(#g2):not(#g3) .forge-view > div:first-child .section-header { min-width: 0; }
/* small controls keep their size but get a hit area of at least 28 px */
html:root body:not(#g1):not(#g2):not(#g3) :is(#studio-beta-tag, #studio-active-project-name, .tl-unlink, .gs-switch, .vc-handle) { position: relative; }
html:root body:not(#g1):not(#g2):not(#g3) :is(#studio-beta-tag, #studio-active-project-name)::after { content: ""; position: absolute; inset: -4px -3px; }
html:root body:not(#g1):not(#g2):not(#g3) .tl-unlink::after { content: ""; position: absolute; inset: -3px -7px; }
html:root body:not(#g1):not(#g2):not(#g3) .gs-switch::before { content: ""; position: absolute; inset: -4px -3px; }
html:root body:not(#g1):not(#g2):not(#g3) .vc-handle::after { content: ""; position: absolute; inset: 0 -8px; }
