/* Meme generator - hero preview + sidebar tabs ([data-meme-generator]) */

.meme-generator-page,
.meme-gallery-view-page {
  /* Editor preview + gallery detail: same max on-screen height for meme images */
  --meme-stage-image-max-height: min(58vh, 560px);
}

.meme-generator-page {
  margin: 0 10px 20px;
  padding: 12.5px;
  max-width: 1480px;
  margin-left: auto;
  margin-right: auto;
  border: 1.5px solid var(--border-color);
  border-radius: 16px;
}

.meme-ux-strong {
  font-weight: 700;
}

.meme-hint--editor-lead {
  font-size: 17px;
  line-height: 1.45;
  font-weight: 600;
  opacity: 0.95;
}

.meme-share-open-btn--large {
  font-size: 17px;
  font-weight: 600;
}

.meme-hint--share-lead {
  font-size: 17px;
  line-height: 1.45;
  margin-bottom: 4.5px;
}

.meme-hint--share-limit {
  font-size: 15px;
  opacity: 0.9;
  margin-top: 0;
  margin-bottom: 10px;
}

.meme-gallery-view-page {
  margin: 0 10px 20px;
  padding: 12.5px;
  max-width: 1480px;
  margin-left: auto;
  margin-right: auto;
}

.meme-gallery-view-title {
  font-size: clamp(22px, 3vw, 28px);
}

.meme-gallery-view-stage {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6.5px;
  margin-bottom: 10px;
}

.meme-gallery-view-nav-cell {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 27.5px;
}

.meme-gallery-view-nav-btn {
  min-width: 27.5px;
  min-height: 27.5px;
  padding: 3.5px 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.meme-gallery-view-nav-btn--disabled {
  opacity: 0.28;
  pointer-events: none;
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.meme-gallery-view-figure {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Same constraints as .meme-preview-img (editor) so detail view matches edit preview */
.meme-gallery-view-img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: var(--meme-stage-image-max-height, min(58vh, 560px));
  object-fit: contain;
  border-radius: 8px;
  margin-left: auto;
  margin-right: auto;
  box-shadow: var(--loo-shadow-md);
}

.meme-gallery-view-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8.5px 12.5px;
  margin-top: 2.5px;
  padding-top: 7.5px;
  border-top: 1px solid var(--border-color);
}

.meme-gallery-view-stat {
  display: inline-flex;
  align-items: center;
  gap: 3.5px;
  font-size: 15px;
  font-weight: 600;
  opacity: 0.92;
}

.meme-gallery-view-stat-label {
  font-weight: 500;
  opacity: 0.8;
  text-transform: lowercase;
}

.meme-gallery-view-votes {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.meme-gallery-vote-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 25px;
}

/* Hover / active chrome (vote, bookmark, detail + grid) */
.meme-gallery-vote-btn:hover:not(:disabled):not(
    .meme-gallery-vote-btn--selected
  ) {
  border-color: color-mix(
    in srgb,
    var(--primary-blue) 40%,
    var(--border-color)
  );
  color: var(--heading-color);
  background: var(--item-hover-bg);
  box-shadow: none;
}

.meme-gallery-vote-btn.meme-gallery-vote-btn--selected {
  border-color: var(--primary-blue);
  color: var(--primary-blue);
  background: color-mix(in srgb, var(--primary-blue) 13%, var(--card-bg));
  box-shadow: none;
}

.meme-gallery-vote-btn.meme-gallery-vote-btn--selected:hover:not(:disabled) {
  border-color: var(--primary-blue);
  background: color-mix(in srgb, var(--primary-blue) 18%, var(--card-bg));
  box-shadow: none;
}

.meme-gallery-bookmark-btn--detail:hover:not(:disabled):not(
    .meme-gallery-bookmark-btn--active
  ) {
  border-color: color-mix(
    in srgb,
    var(--primary-blue) 40%,
    var(--border-color)
  );
  color: var(--heading-color);
  background: var(--item-hover-bg);
  box-shadow: none;
}

.meme-gallery-bookmark-btn--detail.meme-gallery-bookmark-btn--active {
  border-color: var(--primary-blue);
  color: var(--primary-blue);
  background: color-mix(in srgb, var(--primary-blue) 13%, var(--card-bg));
  box-shadow: none;
}

.meme-gallery-bookmark-btn--detail.meme-gallery-bookmark-btn--active:hover:not(
    :disabled
  ) {
  border-color: var(--primary-blue);
  background: color-mix(in srgb, var(--primary-blue) 18%, var(--card-bg));
  box-shadow: none;
}

.meme-gallery-view-stat--uploaded .meme-gallery-view-upload-time {
  font-weight: 600;
  opacity: 0.95;
}

.meme-gallery-vote-login-hint {
  margin: 6.5px 0 0;
  text-align: center;
  font-size: 14px;
  opacity: 0.9;
}

.meme-share-login-banner {
  margin-top: 0;
  margin-bottom: 5px;
}

.meme-generator-layout {
  display: flex;
  flex-direction: column;
  gap: 12.5px;
}

.meme-generator-main {
  min-width: 0;
}

@media (min-width: 960px) {
  .meme-generator-layout {
    flex-direction: row;
    align-items: flex-start;
    gap: 15px;
  }

  .meme-generator-main {
    flex: 1 1 0;
    min-width: 0;
  }

  .meme-generator-sidebar {
    flex: 0 0 min(360px, 34vw);
    max-width: 380px;
    position: sticky;
    top: 10px;
    align-self: flex-start;
    max-height: calc(100vh - 20px);
    overflow-y: auto;
  }
}

.meme-generator-heading {
  margin: 0 0 7.5px;
  font-size: 18px;
}

.meme-generator-heading--sr-focus {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.meme-rail-title {
  margin-bottom: 5px;
  font-size: 16px;
  opacity: 0.92;
}

.meme-rail-title--bold {
  font-weight: 600;
}

.meme-custom-upload-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6.5px;
  margin-bottom: 10px;
}

.meme-gallery-nav {
  text-decoration: none;
}

.meme-custom-upload-hint {
  flex-basis: 100%;
  margin: 0;
}

.meme-upload-template-open-btn {
  margin: 0;
}

.meme-template-search-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 5px 7.5px;
  margin-bottom: 8.5px;
}

.meme-template-search-wrap {
  flex: 1 1 auto;
  min-width: 140px;
  max-width: min(100%, 320px);
  margin-bottom: 0;
}

.meme-template-sort-wrap {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.meme-template-sort-label {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted-text);
}

.meme-template-sort-select {
  min-width: 95px;
  max-width: 100%;
  padding: 3.5px 5px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--input-bg);
  color: inherit;
  font-size: 14px;
}

.meme-template-search-field.search-field {
  max-width: 100%;
  width: 100%;
}

.meme-template-search-field .search-field__input {
  max-width: 100%;
}

.meme-template-modal-pick-label {
  cursor: pointer;
  text-align: center;
  box-sizing: border-box;
}

.meme-template-modal-apply-btn {
  margin-top: 10px;
}

/* Match template-card fix: some `.button` rules override the `hidden` attribute. */
.meme-upload-template-modal button.meme-template-modal-apply-btn[hidden] {
  display: none !important;
}

.meme-caption-field-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  margin-bottom: 3.5px;
}

.meme-caption-field-header label {
  margin-bottom: 0;
  flex: 1;
  min-width: 0;
  font-size: 17px;
}

.meme-caption-remove {
  flex: 0 0 auto;
  margin: 0;
  padding: 1.5px 4.5px;
  min-width: 20px;
  line-height: 1.2;
  font-size: 17px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: var(--primary-blue);
  background: color-mix(in srgb, var(--primary-blue) 10%, transparent);
}

.meme-caption-remove:hover {
  background: color-mix(in srgb, var(--primary-blue) 18%, transparent);
}

.meme-custom-upload-row .meme-publish-layout-wrap {
  margin: 0;
}

.meme-publish-layout-open-btn {
  margin: 0;
}

.meme-add-caption-wrap {
  margin-bottom: 7.5px;
}

.meme-upload-template-modal .meme-template-modal-file-name {
  margin: 5px 0 0;
  word-break: break-all;
}

/* Fallback if base_search_field.css is not loaded on this page */
.meme-template-search-wrap .search-field {
  display: flex;
  line-height: 28px;
  align-items: center;
  position: relative;
  width: 100%;
  --search-height: 40px;
  --search-icon-size: 16px;
}

.meme-template-search-wrap .search-field__input {
  width: 100%;
  height: var(--search-height);
  line-height: var(--search-height);
  padding: 0 16px;
  padding-left: 40px;
  padding-right: 16px;
  border: 2px solid transparent;
  border-radius: 8px;
  outline: none;
  box-sizing: border-box;
  background-color: var(--input-bg);
  color: var(--text-color);
}

.meme-template-search-wrap .search-field__icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-text);
  pointer-events: none;
}

.meme-gallery-search-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6.5px 7.5px;
  margin: 0 0 10px;
  padding: 0 0 2.5px;
}

.meme-gallery-sort-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 5px;
  margin-left: auto;
}

.meme-gallery-sort-label {
  flex: 0 0 auto;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted-text);
}

.meme-gallery-sort-select {
  flex: 0 1 120px;
  min-width: 100px;
  max-width: 180px;
  height: var(--search-height, 40px);
  padding: 0 6.5px;
  border-radius: 8px;
  border: 2px solid var(--border-color);
  background-color: var(--input-bg);
  color: var(--text-color);
  font-size: 15px;
  box-sizing: border-box;
}

.meme-gallery-search-form .meme-gallery-search-field.search-field {
  flex: 1 1 140px;
  min-width: 120px;
  max-width: 280px;
}

/* Same visual baseline as meme-template-search-wrap when base_search_field.css is absent */
.meme-gallery-search-form .search-field {
  display: flex;
  line-height: 28px;
  align-items: center;
  position: relative;
  width: 100%;
  --search-height: 40px;
  --search-icon-size: 16px;
}

.meme-gallery-search-form .search-field__input {
  width: 100%;
  height: var(--search-height);
  line-height: var(--search-height);
  padding: 0 16px;
  padding-left: 40px;
  padding-right: 16px;
  border: 2px solid transparent;
  border-radius: 8px;
  outline: none;
  box-sizing: border-box;
  background-color: var(--input-bg);
  color: var(--text-color);
}

.meme-gallery-search-form .search-field__icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-text);
  pointer-events: none;
}

.meme-gallery-search-submit,
.meme-gallery-search-clear {
  flex: 0 0 auto;
}

.meme-gallery-filter-banner--warn {
  border-color: var(--info-border);
  background: var(--info-bg);
}

.meme-upload-hint--error {
  color: var(--link);
}

.meme-result-actions {
  display: flex;
  flex-direction: column;
  gap: 6.5px;
}

.meme-share-open-btn {
  margin: 0;
}

.meme-share-inline-result {
  margin-top: 3.5px;
  padding-top: 5px;
  border-top: 1px solid var(--border-color);
}

.meme-share-inline-label {
  margin: 0 0 4px;
  font-size: 13px;
}

.meme-share-inline-row {
  margin-top: 0;
}

/* Share dialog: larger than generic preview-modal defaults */
.meme-share-modal.preview-modal .preview-modal-content {
  width: min(360px, 94vw);
  min-width: min(320px, 94vw);
  max-width: min(420px, 96vw);
}

.meme-share-modal.preview-modal .preview-modal-body,
.meme-share-modal .meme-share-modal-body {
  max-width: none;
  width: 100%;
  padding: 13.5px 15px 15px;
  box-sizing: border-box;
}

.meme-share-modal.preview-modal .preview-modal-header {
  padding: 10px 12.5px;
}

.meme-share-modal.preview-modal .preview-modal-title {
  font-size: 17px;
}

.meme-share-modal.preview-modal
  .preview-modal-title.preview-modal-title--meme-share {
  font-size: 20px;
  font-weight: 600;
}

.meme-share-modal-body .meme-hint {
  margin-top: 0;
}

.meme-checkbox-label.meme-share-gallery-opt {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  margin: 7.5px 0 10px;
  cursor: pointer;
  line-height: 1.35;
}

.meme-checkbox-label.meme-share-gallery-opt input {
  margin-top: 2px;
  flex-shrink: 0;
}

.meme-share-link-label {
  display: block;
  margin-top: 7.5px;
  font-weight: 600;
  font-size: 14px;
}

.meme-share-link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: stretch;
  margin-top: 3.5px;
}

.meme-share-modal-body .button-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.meme-share-link-row input {
  flex: 1 1 120px;
  min-width: 0;
}

/* --- Public gallery page --- */
.meme-gallery-page {
  margin: 0 10px 20px;
  padding: 12.5px;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

.meme-gallery-view-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0 0 7.5px;
  margin-bottom: 3.5px;
  border-bottom: 1px solid var(--border-color);
}

.meme-gallery-view-tab {
  display: inline-flex;
  align-items: center;
  padding: 4.5px 9.5px;
  border-radius: 999px;
  font-size: 9.69px;
  font-weight: 600;
  text-decoration: none;
  color: var(--loo-ink-2);
  border: 1px solid var(--border-color);
  background: transparent;
  transition:
    color 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease;
}

.meme-gallery-view-tab:hover {
  color: var(--heading-color);
  border-color: color-mix(
    in srgb,
    var(--primary-blue) 40%,
    var(--border-color)
  );
  background: var(--item-hover-bg);
}

.meme-gallery-view-tab--active {
  color: var(--primary-blue);
  border-color: var(--primary-blue);
  background: color-mix(in srgb, var(--primary-blue) 13%, var(--card-bg));
}

.meme-gallery-filter-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 7.5px;
  padding: 6.5px 7.5px;
  margin: 0 0 7.5px;
  background: var(--card-header-bg);
  border-radius: 8px;
  border: 1px solid var(--border-color);
  font-size: 14px;
  color: var(--text-color);
}

.meme-gallery-filter-banner-text {
  margin: 0;
  flex: 1 1 120px;
}

.meme-gallery-filter-banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.meme-gallery-template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  padding: 3.5px 0 5px;
}

.meme-gallery-template-card {
  display: flex;
  flex-direction: column;
  border-radius: 10px;
  overflow: hidden;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  min-height: 0;
}

.meme-gallery-template-card-visual {
  position: relative;
  display: block;
  text-decoration: none;
  color: inherit;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--tool-canvas);
}

.meme-gallery-template-card-visual img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.meme-gallery-template-card-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 10px 12px 12px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.88), rgba(0, 0, 0, 0.12));
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.meme-gallery-template-card-name {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  color: rgba(255, 255, 255, 0.98);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.65);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.meme-gallery-template-card-count {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.82);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}

.meme-gallery-template-card-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 5.5px 5px 6.5px;
  background: var(--card-header-bg);
}

.meme-gallery-template-card-btn {
  width: 100%;
  justify-content: center;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
}

.meme-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}

.meme-gallery-card {
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  overflow: hidden;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  color: inherit;
  min-height: 0;
  cursor: help;
}

.meme-gallery-card .meme-gallery-card-link,
.meme-gallery-card button {
  cursor: pointer;
}

.meme-gallery-card-link {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  text-decoration: none;
  color: inherit;
}

.meme-gallery-card-link:focus-visible {
  outline: 2px solid var(--primary-blue);
  outline-offset: -2px;
}

.meme-gallery-card-thumb {
  display: block;
  flex: 0 0 auto;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--tool-canvas);
}

.meme-gallery-card-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.meme-gallery-page .meme-gallery-card .meme-gallery-card-title {
  flex: 0 0 auto;
  flex-shrink: 0;
  display: block;
  box-sizing: border-box;
  min-height: 22.5px;
  padding: 4.5px 5.5px 5.5px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: var(--card-bg);
  color: var(--heading-color);
}

/* Gallery grid: unified stat strip (icons + counts; vote/bookmark stay real buttons) */
.meme-gallery-grid .meme-gallery-card-meta {
  --meme-gallery-strip-fg: var(--loo-ink-2);
  --meme-gallery-strip-fg-muted: var(--muted-text);
  gap: 4.5px 6.5px;
  padding: 4px 5px 4.5px;
  color: var(--meme-gallery-strip-fg);
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}

.meme-gallery-grid .meme-gallery-card-stat--views {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  white-space: nowrap;
  gap: 2.8px;
  color: var(--meme-gallery-strip-fg);
}

.meme-gallery-grid .meme-gallery-card-stat--views i {
  opacity: 1;
  color: var(--meme-gallery-strip-fg-muted);
}

.meme-gallery-grid .meme-gallery-card-stat--views [data-meme-card-views] {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--meme-gallery-strip-fg);
}

.meme-gallery-grid .meme-gallery-card-votes {
  display: inline-flex;
  align-items: center;
  gap: 3.5px;
  flex: 0 0 auto;
}

.meme-gallery-grid .meme-gallery-vote-btn--grid {
  display: inline-flex;
  align-items: center;
  gap: 2.8px;
  min-height: 0;
  min-width: 0;
  margin: 0;
  padding: 1px 2px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--meme-gallery-strip-fg);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  box-shadow: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.meme-gallery-grid .meme-gallery-vote-btn--grid i {
  color: var(--meme-gallery-strip-fg-muted);
  font-size: 11.5px;
}

.meme-gallery-grid
  .meme-gallery-vote-btn--grid:hover:not(:disabled):not(
    .meme-gallery-vote-btn--selected
  ) {
  color: var(--heading-color);
  background: var(--item-hover-bg);
  border-color: transparent;
  box-shadow: none;
}

.meme-gallery-grid
  .meme-gallery-vote-btn--grid:hover:not(:disabled):not(
    .meme-gallery-vote-btn--selected
  )
  i {
  color: var(--heading-color);
}

.meme-gallery-grid .meme-gallery-vote-btn--grid:focus-visible {
  outline: 2px solid var(--primary-blue);
  outline-offset: 2px;
}

.meme-gallery-grid
  .meme-gallery-vote-btn--grid.meme-gallery-vote-btn--selected {
  color: var(--primary-blue);
  background: color-mix(in srgb, var(--primary-blue) 13%, var(--card-bg));
  border-color: transparent;
  box-shadow: none;
}

.meme-gallery-grid
  .meme-gallery-vote-btn--grid.meme-gallery-vote-btn--selected
  i {
  color: var(--primary-blue);
}

.meme-gallery-grid
  .meme-gallery-vote-btn--grid.meme-gallery-vote-btn--selected:hover:not(
    :disabled
  ) {
  background: color-mix(in srgb, var(--primary-blue) 18%, var(--card-bg));
  border-color: transparent;
  box-shadow: none;
}

.meme-gallery-grid .meme-gallery-bookmark-btn--grid {
  min-height: 0;
  min-width: 0;
  margin: 0;
  padding: 1px 2.8px;
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2.5px;
  color: var(--meme-gallery-strip-fg-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  box-shadow: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.meme-gallery-grid
  .meme-gallery-bookmark-btn--grid:hover:not(:disabled):not(
    .meme-gallery-bookmark-btn--active
  ) {
  color: var(--heading-color);
  background: var(--item-hover-bg);
  border-color: transparent;
  box-shadow: none;
}

.meme-gallery-grid .meme-gallery-bookmark-btn--grid:focus-visible {
  outline: 2px solid var(--primary-blue);
  outline-offset: 2px;
}

.meme-gallery-grid
  .meme-gallery-bookmark-btn--grid.meme-gallery-bookmark-btn--active {
  color: var(--primary-blue);
  background: color-mix(in srgb, var(--primary-blue) 13%, var(--card-bg));
  border-color: transparent;
  box-shadow: none;
}

.meme-gallery-grid
  .meme-gallery-bookmark-btn--grid.meme-gallery-bookmark-btn--active:hover:not(
    :disabled
  ) {
  background: color-mix(in srgb, var(--primary-blue) 18%, var(--card-bg));
  border-color: transparent;
  box-shadow: none;
}

.meme-gallery-grid .meme-gallery-bookmark-count {
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  min-width: 1ch;
}

.meme-gallery-bookmark-btn {
  flex: 0 0 auto;
}

.meme-gallery-bookmark-btn--detail {
  font-size: 14px;
  gap: 4px;
  min-height: 25px;
}

.meme-gallery-view-votes
  .meme-gallery-bookmark-btn--detail
  [data-meme-bookmark-count] {
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  min-width: 1ch;
  line-height: 1;
}

.meme-gallery-card-meta {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4.5px 6.5px;
  padding: 3.5px 4.5px 5px;
  font-size: 12px;
  line-height: 1.2;
  background: var(--card-header-bg);
  color: var(--loo-ink-2);
}

.meme-gallery-card-stat {
  display: inline-flex;
  align-items: center;
  gap: 2.5px;
  white-space: nowrap;
}

.meme-gallery-card-stat i {
  opacity: 0.85;
}

.meme-gallery-login-hint {
  margin-top: 7.5px;
  margin-bottom: 0;
}

.meme-gallery-view-votes .meme-gallery-bookmark-btn--detail {
  margin-left: 3.5px;
}

.meme-gallery-use-template {
  margin-top: 12.5px;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
  text-align: center;
}

.meme-gallery-use-template-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4.5px;
}

.meme-gallery-use-template--client-hint .meme-gallery-use-template-btn {
  margin-top: 7.5px;
}

.meme-gallery-use-template--client-hint .meme-gallery-info-callout {
  max-width: none;
  width: 100%;
  box-sizing: border-box;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.meme-gallery-use-template--client-hint .meme-gallery-info-callout__text {
  white-space: nowrap;
  text-wrap: unset;
}

.meme-gallery-action-tooltip {
  display: inline-flex;
  vertical-align: middle;
}

.meme-gallery-info-callout {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 6.5px;
  margin: 0 auto 5px;
  max-width: min(520px, 100%);
  padding: 7.5px 8.5px;
  text-align: left;
  border-radius: 10px;
  border: 1px solid var(--info-border);
  background: var(--info-bg);
  box-shadow: none;
}

.meme-gallery-info-callout__icon {
  flex: 0 0 auto;
  margin-top: 1px;
  font-size: 18px;
  line-height: 1;
  color: var(--primary-blue);
}

.meme-gallery-info-callout__text {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  font-size: 16px;
  line-height: 1.5;
  font-weight: 600;
  color: var(--heading-color);
  text-wrap: pretty;
}

/* --- Hero preview
 * Sizing for template assets (values are responsive - exact px varies by viewport):
 * - Empty state: canvas min-height min(36vh, 300px); with a template loaded, canvas hugs content (:has img-wrap).
 * - Preview <img> max height: --meme-stage-image-max-height (min(58vh, 560px)); gallery detail uses the same.
 * - At ≥960px: main column ≈ (page width − sidebar); page max-width 1480px; sidebar ~min(360px,34vw)
 * Design meme PNGs at a comfortable sharp size (e.g. 800–1200px wide); boxes in manifest use 0–1 coords.
 * --- */

.meme-preview-hero {
  margin-bottom: 10px;
}

.meme-preview-oncanvas-hint {
  margin: 0 0 5px;
  font-size: 14px;
  line-height: 1.35;
  opacity: 0.88;
  max-width: 100%;
  white-space: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.meme-preview-canvas-wrap {
  position: relative;
  border-radius: 10px;
  /* Allow caption chrome (move/rotate) above frames; clip via inner surfaces if needed */
  overflow: visible;
  min-height: min(36vh, 300px);
  display: flex;
  flex-direction: column;
  background-color: var(--tool-canvas);
  background-image: none;
  border: 1px solid var(--border-color);
}

/* Once a template is active, drop forced height so letterboxing matches the image, not a tall slab */
.meme-preview-canvas-wrap:has(.meme-preview-img-wrap:not([hidden])) {
  min-height: 0;
}

.meme-preview-canvas-wrap.is-loading .meme-preview-loading {
  display: flex;
}

.meme-preview-loading {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 2;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 7.5px;
  background: color-mix(in srgb, var(--card-bg) 70%, transparent);
  font-size: 14px;
}

.meme-preview-loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary-blue);
  border-radius: 50%;
  animation: meme-spin 0.75s linear infinite;
}

@keyframes meme-spin {
  to {
    transform: rotate(360deg);
  }
}

.meme-preview-panel--hero {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  padding: 10px 12.5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Empty preview: fill the canvas area so the hint sits visually centered */
.meme-preview-canvas-wrap:not(:has(.meme-preview-img-wrap:not([hidden])))
  .meme-preview-panel--hero {
  min-height: min(32vh, 280px);
}

.meme-preview-placeholder {
  margin: 0;
  text-align: center;
  opacity: 0.92;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.35;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
  padding: 0 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 719px) {
  .meme-preview-placeholder {
    white-space: normal;
    text-overflow: unset;
    font-size: 16px;
  }
}

@media (min-width: 1100px) {
  .meme-preview-placeholder {
    font-size: 22px;
  }
}

.meme-preview-img-wrap {
  position: relative;
  display: block;
  width: fit-content;
  max-width: 100%;
  min-width: 0;
  margin: 0 auto;
  font-size: 0;
  line-height: 0;
}

.meme-preview-img-wrap[hidden] {
  display: none !important;
}

/* Legacy class meme-preview-img-wrap--server-output: editor no longer swaps hero to server
   JPEG; HTML captions must stay visible. Do not hide .meme-preview-box-label here. */

.meme-preview-img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: var(--meme-stage-image-max-height, min(58vh, 560px));
  margin: 0;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: var(--loo-shadow-md);
}

.meme-preview-overlays {
  position: absolute;
  inset: 0;
  /* Above client watermark so caption text is never painted under the wm layer */
  z-index: 3;
  pointer-events: none;
  /* Break font-size:0 / line-height:0 from .meme-preview-img-wrap so labels inherit a real size */
  font-size: 10px;
  line-height: normal;
}

/* Approximates server-drawn watermark on the downloadable PNG (hero preview uses template only). */
.meme-preview-client-wm {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}

.meme-preview-client-wm__slot {
  position: absolute;
  box-sizing: border-box;
  display: flex;
  pointer-events: none;
}

.meme-preview-client-wm__slot--bottom_right {
  align-items: flex-end;
  justify-content: flex-end;
}

.meme-preview-client-wm__slot--bottom_left {
  align-items: flex-end;
  justify-content: flex-start;
}

.meme-preview-client-wm__slot--top_right {
  align-items: flex-start;
  justify-content: flex-end;
}

.meme-preview-client-wm__slot--top_left {
  align-items: flex-start;
  justify-content: flex-start;
}

.meme-preview-client-wm__slot--center_big {
  align-items: center;
  justify-content: center;
}

.meme-preview-client-wm__text {
  pointer-events: none;
  color: #f5f5f5;
  -webkit-text-stroke: 1px #141414;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  opacity: 0.95;
}

.meme-preview-client-wm__slot--center_big .meme-preview-client-wm__text {
  font-family: Impact, Haettenschweiler, 'Arial Narrow Bold', Arial, sans-serif;
}

/* Draggable / resizable caption frame (meme editor) */
.meme-box-frame {
  position: absolute;
  /* Match server: border is inside width/height (norm → px), not extra outside. */
  box-sizing: border-box;
  pointer-events: auto;
  border: 1px dashed rgba(255, 255, 255, 0.95);
  border-radius: 3px;
  touch-action: none;
  z-index: 2;
  cursor: grab;
  /* Dark + light rings so dashed chrome stays readable on busy templates (plaid, etc.) */
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.88),
    0 0 0 2px rgba(255, 255, 255, 0.45),
    0 2px 14px rgba(0, 0, 0, 0.45);
}

.meme-box-frame:active {
  cursor: grabbing;
}

.meme-box-frame.is-active {
  z-index: 4;
  border-color: #ffffff;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.9),
    0 0 0 2px var(--primary-blue),
    0 0 18px color-mix(in srgb, var(--primary-blue) 42%, transparent),
    0 4px 16px rgba(0, 0, 0, 0.35);
}

/* Empty slot: dim caption text only - never fade handles/border (was invisible on plaid) */
.meme-box-frame.meme-box-frame--caption-empty:not(.is-active)
  .meme-preview-box-label {
  opacity: 0.4;
}

/* Only in-flow child is the editor wrap so it can sit centered like .meme-preview-box-label */
.meme-box-frame--inline-edit {
  cursor: default;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
}

.meme-box-frame--inline-edit:active {
  cursor: text;
}

.meme-box-frame--inline-edit .meme-preview-box-label {
  visibility: hidden !important;
}

.meme-inline-caption-editor-wrap {
  flex: 0 1 auto;
  align-self: stretch;
  max-height: 100%;
  min-height: 0;
  z-index: 6;
  position: relative;
}

.meme-inline-caption-editor {
  position: relative;
  z-index: 6;
  box-sizing: border-box;
  display: block;
  width: 100%;
  max-height: 100%;
  min-height: 2lh;
  margin: 0;
  padding: 1.5px 2.5px;
  resize: none;
  border: none;
  border-radius: 2px;
  /* background + text color set in JS from Style (matches preview; avoids inherited dark text on dark bar) */
  background: rgba(0, 0, 0, 0.55);
  color: #f5f5f5;
  -webkit-text-fill-color: #f5f5f5;
  caret-color: #f5f5f5;
  paint-order: stroke fill;
  outline: none;
  touch-action: manipulation;
  cursor: text;
  overflow: auto;
}

.meme-inline-caption-editor:focus {
  box-shadow: inset 0 0 0 2px var(--primary-blue);
}

/* Rotate: top outside frame (clear of center N resize handle) */
.meme-box-frame__rotate {
  position: absolute;
  left: 50%;
  top: -50px;
  width: 30px;
  height: 30px;
  margin-left: -15px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid #fff;
  background: linear-gradient(165deg, #3a2a2c 0%, #1b1110 100%);
  box-shadow:
    0 2px 10px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  cursor: grab;
  line-height: 0;
  display: grid;
  place-items: center;
  color: #ffffff;
  user-select: none;
  pointer-events: auto;
  z-index: 6;
}

.meme-box-frame__btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  pointer-events: none;
}

.meme-box-frame__btn-icon svg {
  display: block;
  width: 15px;
  height: 15px;
  margin: 0;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.65));
}

.meme-box-frame__rotate:hover {
  border-color: var(--primary-blue);
  box-shadow:
    0 2px 12px color-mix(in srgb, var(--primary-blue) 35%, transparent),
    0 2px 10px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.meme-box-frame__rotate:active {
  cursor: grabbing;
  transform: scale(0.96);
}

/* Reset layout: top inside frame - below center N handle */
.meme-box-frame__reset {
  position: absolute;
  left: 50%;
  top: 12px;
  bottom: auto;
  right: auto;
  width: 30px;
  height: 30px;
  margin-left: -15px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid #fff;
  background: linear-gradient(165deg, #3a2a2c 0%, #1b1110 100%);
  box-shadow:
    0 2px 10px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  cursor: pointer;
  line-height: 0;
  display: grid;
  place-items: center;
  color: #ffffff;
  user-select: none;
  pointer-events: auto;
  z-index: 7;
}

.meme-box-frame__reset:hover {
  border-color: var(--primary-blue);
  box-shadow:
    0 2px 12px color-mix(in srgb, var(--primary-blue) 35%, transparent),
    0 2px 10px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.meme-box-frame__reset:active {
  transform: scale(0.96);
}

/* base_tooltip adds .tooltip-wrapper { position: relative; display: inline-block } to these buttons,
 * which breaks left:50% centering. Force the intended box positioning. */
.meme-box-frame .meme-box-frame__rotate.tooltip-wrapper,
.meme-box-frame .meme-box-frame__reset.tooltip-wrapper {
  position: absolute;
  display: grid;
  place-items: center;
  vertical-align: unset;
}

.meme-box-frame .meme-box-frame__rotate.tooltip-wrapper {
  cursor: grab !important;
}

.meme-box-frame .meme-box-frame__rotate.tooltip-wrapper:active {
  cursor: grabbing !important;
}

.meme-box-frame .meme-box-frame__reset.tooltip-wrapper {
  cursor: pointer !important;
}

.meme-box-handle {
  position: absolute;
  width: 11px;
  height: 11px;
  margin: -5.5px;
  box-sizing: border-box;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.88);
  z-index: 5;
  pointer-events: auto;
  touch-action: none;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.95),
    0 1px 5px rgba(0, 0, 0, 0.55);
}

.meme-box-handle--nw {
  top: 0;
  left: 0;
  cursor: nwse-resize;
}

.meme-box-handle--n {
  top: 0;
  left: 50%;
  cursor: ns-resize;
}

.meme-box-handle--ne {
  top: 0;
  right: 0;
  cursor: nesw-resize;
}

.meme-box-handle--e {
  top: 50%;
  right: 0;
  cursor: ew-resize;
}

.meme-box-handle--se {
  bottom: 0;
  right: 0;
  cursor: nwse-resize;
}

.meme-box-handle--s {
  bottom: 0;
  left: 50%;
  cursor: ns-resize;
}

.meme-box-handle--sw {
  bottom: 0;
  left: 0;
  cursor: nesw-resize;
}

.meme-box-handle--w {
  top: 50%;
  left: 0;
  cursor: ew-resize;
}

/* Match server _draw_caption_block_in_rect: block is vertically centered in the box.
 * paint-order: stroke fill draws the outline BEHIND the fill, matching Pillow's
 * stroke rendering on the server (prevents -webkit-text-stroke from eating into fill). */
.meme-preview-box-label {
  position: absolute;
  box-sizing: border-box;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 2px 3px;
  pointer-events: none;
  overflow: hidden;
  font-family: inherit;
  font-size: inherit;
  line-height: 1.15;
  background: transparent;
  border: none;
  border-radius: 2px;
  white-space: pre-wrap;
  word-break: break-word;
  user-select: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  paint-order: stroke fill;
}

.meme-preview-box-label__text {
  display: block;
  white-space: pre-wrap;
  word-break: break-word;
  paint-order: stroke fill;
}

.meme-preview-box-label--align-left {
  text-align: left;
  align-items: stretch;
}

.meme-preview-box-label--align-center {
  text-align: center;
  align-items: stretch;
}

.meme-preview-box-label--align-right {
  text-align: right;
  align-items: stretch;
}

/* --- Template horizontal rail --- */

.meme-template-rail {
  margin-top: 2.5px;
}

.meme-template-grid--horizontal {
  display: flex;
  flex-wrap: nowrap;
  gap: 6.5px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2.5px 1.25px 7.5px;
  scrollbar-width: thin;
}

.meme-template-grid--horizontal .meme-template-card {
  flex: 0 0 auto;
  width: 118px;
}

.meme-template-grid--horizontal .meme-template-card img {
  aspect-ratio: 4 / 3;
}

.meme-template-top-memes {
  margin-top: 6.5px;
  padding-top: 6.5px;
  border-top: 1px solid var(--border-color);
}

.meme-template-top-memes__heading {
  margin: 0 0 5px;
  font-size: 14px;
  font-weight: 600;
  color: var(--heading-color);
}

.meme-template-top-memes__grid-wrap {
  margin-bottom: 5px;
}

.meme-template-top-memes__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4.5px;
}

@media (min-width: 520px) {
  .meme-template-top-memes__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 900px) {
  .meme-template-top-memes__grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

.meme-template-top-memes__card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 3.5px;
  min-width: 0;
  padding: 3.5px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease;
}

.meme-template-top-memes__card:hover {
  border-color: color-mix(in srgb, var(--primary-blue) 45%, transparent);
}

.meme-template-top-memes__thumb {
  flex: 0 0 auto;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 6px;
  overflow: hidden;
  background: var(--tool-canvas);
}

.meme-template-top-memes__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.meme-template-top-memes__card-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.meme-template-top-memes__title {
  font-size: 12px;
  font-weight: 600;
  color: var(--heading-color);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meme-template-top-memes__views {
  font-size: 11px;
  color: var(--loo-ink-2);
}

.meme-template-top-memes__see-all {
  width: 100%;
  justify-content: center;
  margin-top: 1.5px;
}

.meme-template-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 0;
  margin: 0;
  background: var(--card-bg);
  cursor: pointer;
  text-align: left;
  overflow: hidden;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

/* base_tooltip adds .tooltip-wrapper (inline-block); keep rail card layout */
.meme-template-card.tooltip-wrapper {
  display: flex !important;
  flex-direction: column;
  align-items: stretch;
  vertical-align: unset;
}

/* `hidden` must win over `display: flex` (template search filter). */
.meme-template-card[hidden] {
  display: none !important;
}

.meme-template-card:hover {
  border-color: color-mix(
    in srgb,
    var(--primary-blue) 40%,
    var(--border-color)
  );
}

.meme-template-card.is-selected {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 1px var(--primary-blue);
}

.meme-template-card img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
}

.meme-template-card .meme-template-name {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  padding: 4px 4.5px 5px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--heading-color);
  word-break: break-word;
  overflow-wrap: anywhere;
  hyphens: auto;
  flex: 0 0 auto;
  min-height: 35px;
}

.meme-loading {
  flex: 1 1 auto;
  margin: 0;
  padding: 5px;
  opacity: 0.85;
  font-size: 14px;
}

/* --- Sidebar tabs --- */

.meme-tab-bar {
  display: flex;
  gap: 2.5px;
  margin-bottom: 10px;
  padding: 2px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--tool-canvas);
}

.meme-tab {
  flex: 1;
  margin: 0;
  padding: 5px 3.5px;
  font-size: 7.8px;
  line-height: 1.2;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: transparent;
  color: inherit;
  opacity: 0.75;
  transition:
    background 0.15s ease,
    opacity 0.15s ease;
}

@media (min-width: 400px) {
  .meme-tab {
    font-size: 8.5px;
    padding: 5.5px 5px;
  }
}

.meme-tab:hover {
  opacity: 1;
}

.meme-tab.is-active {
  opacity: 1;
  background: var(--card-bg);
  box-shadow: none;
}

.meme-tab-panel {
  padding-bottom: 5px;
}

.meme-tab-panel[hidden] {
  display: none !important;
}

.meme-hint {
  margin: 0 0 8.5px;
  font-size: 17px;
  opacity: 0.88;
  line-height: 1.4;
}

.meme-caption-form .form-group {
  margin-bottom: 8.5px;
}

.meme-caption-form label {
  display: block;
  margin-bottom: 3.5px;
  font-size: 17px;
}

.meme-caption-form input[type='text'],
.meme-caption-form textarea.meme-caption-field {
  width: 100%;
  box-sizing: border-box;
}

.meme-caption-form textarea.meme-caption-field {
  min-height: 30px;
  max-height: 120px;
  resize: none;
  overflow: hidden;
  line-height: 1.4;
  font-size: 17px;
}

.meme-select-prompt {
  opacity: 0.95;
  margin: 0 0 8.5px;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.4;
}

.meme-editor-export {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
}

.meme-panel-subheading {
  margin: 0 0 6.5px;
  font-size: 17px;
  font-weight: 600;
}

/* Style tab: label row + per-feature default reset (undo) */
.meme-text-style .meme-style-field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.meme-text-style .meme-style-field-head label {
  margin-bottom: 0;
  flex: 1;
  min-width: 0;
}

.meme-style-field-head--shadow .meme-style-shadow-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.meme-style-field-head--shadow .meme-style-shadow-toggle label {
  margin-bottom: 0;
}

.meme-style-reset-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  min-width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--loo-ink-2);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  box-sizing: border-box;
}

.meme-style-reset-btn:hover {
  border-color: color-mix(in srgb, var(--primary-blue) 40%, transparent);
  color: var(--heading-color);
  background: var(--item-hover-bg);
}

.meme-style-reset-btn:focus-visible {
  outline: 2px solid var(--primary-blue);
  outline-offset: 2px;
}

.meme-advanced-style {
  margin-top: 5px;
  padding: 6px 7.5px;
  border-radius: 8px;
  background: var(--card-header-bg);
  border: 1px solid var(--border-color);
}

.meme-advanced-style summary {
  cursor: pointer;
  font-size: 17px;
  font-weight: 600;
  padding: 2px 0;
}

.meme-advanced-style-body {
  margin-top: 6.5px;
  padding-top: 3.5px;
  border-top: 1px solid var(--border-color);
  font-size: 17px;
}

.meme-watermark-row {
  margin-top: 2.5px;
}

.meme-checkbox-label {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  font-size: 17px;
}

.meme-result {
  margin-top: 10px;
  padding: 8.5px;
  border-radius: 8px;
  background: var(--card-header-bg);
}

.meme-result-title {
  margin: 0 0 3.5px;
  font-size: 10px;
}

.meme-result-actions {
  margin-top: 6.5px;
}

.meme-error {
  color: var(--link);
  margin: 7.5px 0 0;
  font-size: 17px;
}
