/* Caption editor: the Styles panel (Save Style, tabs, style tiles, saved styles), the Animate tiles and the font list. */
.ed-save-style {
    display: flex; align-items: center; gap: 8px; width: calc(100% - 28px); min-height: var(--ed-hit); margin: 12px 14px 0;
    padding: 0 12px; border: 1px solid var(--ed-line); border-radius: var(--ed-radius); background: var(--ed-card);
    color: var(--ed-ink); font-weight: 600;
}
.ed-save-style:hover { background: var(--ed-field); }
.ed-save-style span { flex: 1; text-align: left; }
.ed-save-style .ed-ic:last-child { color: var(--ed-upgrade); }

.ed-style-tabs { display: flex; gap: 4px; margin: 10px 14px 4px; padding: 3px; border-radius: 10px; background: var(--ed-card); }
.ed-style-tabs [role=tab] {
    flex: 1; min-height: var(--ed-hit); padding: 0 6px; border: 0; border-radius: 8px;
    background: none; color: var(--ed-dim); font-weight: 600;
}
.ed-style-tabs [role=tab][aria-selected=true] { background: var(--ed-field); color: var(--ed-ink); }
/* The Hebrew and Arabic tab's short label takes only its own width, so the other names keep theirs. */
.ed-style-tabs [data-tab=rtl] {
    display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; gap: 5px;
    min-width: var(--ed-hit); padding: 0 10px; white-space: nowrap;
}
.ed-styles-note { margin: 8px 14px 0; color: var(--ed-upgrade); }

.ed-presets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 10px 14px 18px; }
.ed-presets[hidden] { display: none; }
.ed-preset {
    position: relative; display: block; width: 100%; padding: 0; aspect-ratio: 27 / 16; min-height: 44px;
    border: 2px solid transparent; border-radius: 10px; background: #2f2f37; overflow: hidden;
    transition: transform .12s, border-color .12s;
}
.ed-preset[hidden] { display: none; }
.ed-preset:hover { transform: scale(1.03); border-color: #4a4a55; }
.ed-preset[aria-pressed=true] { border-color: var(--ed-accent); }
.ed-preset:focus-visible { outline: 2px solid var(--ed-focus); outline-offset: 2px; }
.ed-preset canvas { display: block; width: 100%; height: 100%; }

.ed-saved { position: relative; }
.ed-saved-remove {
    position: absolute; top: 2px; right: 2px; display: grid; place-items: center; width: 24px; height: 24px; padding: 0;
    border: 0; border-radius: 50%; background: rgba(0, 0, 0, .65); color: #fff;
}
.ed-saved-remove .ed-ic { width: 13px; height: 13px; }

.ed-upsell { display: grid; gap: 8px; margin: 12px 14px; padding: 16px; border: 1px solid var(--ed-line); border-radius: 12px; background: var(--ed-card); }
.ed-upsell[hidden] { display: none; }
.ed-upsell strong { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.ed-upsell p { margin: 0; color: var(--ed-dim); }
.ed-upsell .ed-primary { justify-self: start; text-decoration: none; }

/* Animate: icon tiles, three to a row, with the chosen animation's settings under its group. The chosen tile is blue. */
.ed-anim-title { margin: 16px 14px 0; color: var(--ed-ink); font-size: 13px; font-weight: 700; }
.ed-anims { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 8px 14px 4px; }
.ed-anim {
    display: grid; justify-items: center; align-content: center; gap: 5px; min-height: 62px; padding: 6px 4px;
    border: 1px solid var(--ed-line); border-radius: 10px; background: var(--ed-card); color: var(--ed-dim);
    font-size: 12.5px; font-weight: 400; text-align: center;
}
.ed-anim .ed-ic { width: 20px; height: 20px; }
.ed-anim:hover { background: var(--ed-field); color: var(--ed-ink); }
.ed-anim[aria-pressed=true] { border-color: #3b82f6; background: rgba(59, 130, 246, .14); color: #60a5fa; }
.ed-anim:focus-visible { outline: 2px solid var(--ed-focus); outline-offset: 2px; }
.ed-anim-controls { padding: 8px 14px 0; }
.ed-anim-controls:not(:has(.ed-card:not([hidden]))) { display: none; }
.ed-color-clear { padding: 0; }
.ed-color-clear .ed-color-chip { background: repeating-conic-gradient(#8a8a8a 0 25%, #e5e5e5 0 50%) 50% / 10px 10px; }
.ed-color-clear.is-on { border-color: #3b82f6; }

/* A font button and the list it opens: each name in its own font. */
.ed-font-btn { display: flex; align-items: center; justify-content: space-between; gap: 6px; width: 100%; color: var(--ed-ink); text-align: left; }
.ed-font-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 15px; }
.ed-font-btn .ed-ic { flex: none; width: 14px; height: 14px; color: var(--ed-dim); }
.ed-tb-font.ed-font-btn { width: 130px; }
.ed-font-menu {
    position: fixed; z-index: 60; overflow-y: auto; padding: 6px; background: #242424; outline: none;
    border: 1px solid var(--ed-line); border-radius: 10px; box-shadow: 0 12px 32px rgba(0, 0, 0, .45);
}
.ed-font-menu[hidden] { display: none; }
.ed-font-menu [role=option] {
    display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 38px; padding: 0 10px;
    border-radius: 6px; color: var(--ed-ink); font-size: 17px; cursor: pointer; white-space: nowrap; touch-action: manipulation;
}
.ed-font-menu [role=option]:hover, .ed-font-menu [role=option].is-active { background: var(--ed-field); }
.ed-font-menu [role=option][aria-selected=true] { color: #c7c6ff; box-shadow: inset 3px 0 0 var(--ed-accent); }
.ed-font-tag {
    flex: none; padding: 1px 6px; border-radius: 4px; background: var(--ed-card); color: var(--ed-dim);
    font: 600 11px/1.5 system-ui, sans-serif;
}

@media (pointer: coarse) {
    .ed-font-menu [role=option] { min-height: 44px; }
    .ed-saved-remove { top: 0; right: 0; width: 44px; height: 44px; background: none; }
    .ed-saved-remove .ed-ic { width: 24px; height: 24px; padding: 5px; border-radius: 50%; background: rgba(0, 0, 0, .65); }
    .ed-font-name { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
    .ed-preset { transition: none; }
    .ed-preset:hover { transform: none; }
}

/* AI Enhance: Auto Emoji, the rows that come later, each row's emoji button and the emoji picker. */
.ed-soon-list { padding-top: 0; }
.ed-soon {
    display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 52px; padding: 0 12px;
    border: 1px solid var(--ed-line); border-radius: 10px; background: var(--ed-card); color: var(--ed-faint); font-weight: 600; font-size: 13px;
}
.ed-soon-badge { padding: 2px 8px; border-radius: 20px; background: var(--ed-field); color: var(--ed-dim); font-size: 10.5px; letter-spacing: .04em; text-transform: uppercase; }
/* The row's emoji sits right of its text, clear of the merge and add buttons on the row's top edge. */
.ed-row-body { display: flex; align-items: center; gap: 8px; }
.ed-row-body .ed-text { flex: 1; min-width: 0; }
.ed-row-emoji {
    display: none; flex: none; place-items: center; width: 36px; height: 36px; padding: 0; border: 1px solid var(--ed-line);
    border-radius: 8px; background: var(--ed-field); color: var(--ed-ink); font-size: 22px; line-height: 1;
}
.shows-emoji .ed-row-emoji { display: grid; }
/* With the times hidden the options button floats on the row's corner; the emoji button needs it back in the head. */
.hide-times.shows-emoji .ed-row-head { position: static; min-height: 30px; }
.ed-row-emoji:hover { border-color: #555; }
.ed-row-emoji.is-empty { border-style: dashed; background: none; color: var(--ed-faint); font-size: 18px; }
.ed-emoji-picker:focus { outline: none; }
.ed-emoji-picker {
    position: fixed; z-index: 60; display: grid; grid-template-rows: auto auto 1fr auto; gap: 6px; padding: 8px;
    border: 1px solid var(--ed-line); border-radius: 12px; background: #242424; box-shadow: 0 12px 32px rgba(0, 0, 0, .45);
}
.ed-emoji-picker[hidden] { display: none; }
.ed-emoji-search { width: 100%; }
.ed-emoji-groups { display: flex; justify-content: space-between; padding: 3px; overflow-x: auto; scrollbar-width: none; }
.ed-emoji-groups button { flex: 1 1 0; min-width: 0; height: 32px; padding: 0; border: 0; border-radius: 6px; background: none; font-size: 18px; }
.ed-emoji-groups button:hover, .ed-emoji:hover { background: var(--ed-field); }
.ed-emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); align-content: start; min-height: 0; padding: 3px; overflow-y: auto; }
.ed-emoji { height: 38px; padding: 0; border: 0; border-radius: 6px; background: none; font-size: 24px; line-height: 1; }
.ed-emoji-head { grid-column: 1 / -1; margin: 8px 2px 2px; color: var(--ed-dim); font-size: 12px; font-weight: 600; }
.ed-emoji-none { grid-column: 1 / -1; margin: 12px 4px; color: var(--ed-dim); }
.ed-emoji-remove { min-height: 36px; border: 1px solid var(--ed-line); border-radius: var(--ed-radius); background: var(--ed-card); color: var(--ed-ink); }
.ed-emoji-remove[hidden] { display: none; }

@media (pointer: coarse) {
    .ed-emoji, .ed-emoji-groups button { min-height: 44px; }
    .ed-emoji-groups button { flex: none; min-width: 44px; }
    .ed-row-emoji { width: 44px; height: 44px; }
    .hide-times.shows-emoji .ed-row-head { min-height: 44px; }
    .ed-emoji-grid { grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); }
    .ed-emoji-remove { min-height: 44px; }
}
