.ehpeek-external-autocomplete {
  max-height: 60dvh !important;
  padding-block: var(--ui-space-sm) !important;
}

.ehpeek-external-autocomplete-item {
  box-sizing: border-box;
  min-height: var(--ui-hit-size-lg);
  padding: 0 var(--ui-space-lg) !important;
  font-size: var(--ui-font-size-lg) !important;
  line-height: inherit !important;
}

.ehpeek-external-autocomplete-text {
  font-size: inherit !important;
  line-height: inherit !important;
}

/* This root mode is the single ownership signal for fitting original pages to the viewport. */
html.ehpeek-fit-to-viewport,
html.ehpeek-fit-to-viewport body {
  min-width: 0 !important;
  max-width: 100% !important;
  overflow-x: hidden !important;
}

html.ehpeek-fit-to-viewport :is(
  .ido,
  .itg,
  .ehpeek-expand-favorites-search
) {
  box-sizing: border-box;
  min-width: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
}

html.ehpeek-fit-to-viewport #rangebar {
  box-sizing: border-box;
  max-width: 100% !important;
}

html.ehpeek-fit-to-viewport .searchnav {
  box-sizing: border-box;
  max-width: 100% !important;
  overflow-x: auto;
}

html.ehpeek-fit-to-viewport > body.ehpeek-touch-gallery-page {
  padding-left: 0 !important;
  padding-right: 0 !important;
}

:where(html.ehpeek-fit-to-viewport)
  body.ehpeek-touch-gallery-page
  :is(.gm, #gdt[class]) {
  box-sizing: border-box !important;
  min-width: 0 !important;
  width: calc(100% - (var(--touch-gallery-gutter) * 2)) !important;
  max-width: none !important;
}

.ehpeek-hide-original-favorites-categories {
  display: none !important;
}

:root .ehpeek-hide-original-node.ehpeek-hide-original-node {
  display: none !important;
}

.ehpeek-scroll-preview-mount {
  position: relative;
  display: block;
  box-sizing: border-box;
  min-width: 0;
  width: 100%;
}

.ehpeek-contain-search-results {
  box-sizing: border-box;
  overflow: visible;
}

.ehpeek-contain-favorites-results {
  box-sizing: border-box;
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

.ehpeek-enable-search-swipe-input {
  overscroll-behavior-x: contain;
  touch-action: pan-y;
}

.ehpeek-enable-search-swipe-input,
.ehpeek-enable-search-swipe-input * {
  user-select: none !important;
  -webkit-user-select: none !important;
}

/* Compact wide Favorites columns while preserving the original table structure. */
.ehpeek-compact-all-favorites-results {
  table-layout: auto !important;
  overflow-x: hidden !important;
}

.ehpeek-compact-all-favorites-results > tbody > tr > .gl2e {
  width: auto !important;
  overflow-wrap: anywhere !important;
}

.ehpeek-compact-all-favorites-results .glink {
  white-space: normal !important;
  overflow-wrap: anywhere !important;
}

.ehpeek-compact-all-favorites-results .gl4e table {
  table-layout: fixed !important;
  width: 100% !important;
  max-width: 100% !important;
}

.ehpeek-compact-all-favorites-results .gl4e td {
  min-width: 0 !important;
  overflow-wrap: anywhere !important;
}

.ehpeek-compact-all-favorites-results .gl4e td.tc {
  width: 4em !important;
  white-space: nowrap !important;
}

.ehpeek-compact-all-favorites-results > tbody > tr > .glfe {
  width: 1% !important;
  white-space: nowrap !important;
}

@media (max-width: 849px) {
  .ehpeek-contain-favorites-results {
    table-layout: auto !important;
  }

  .ehpeek-contain-favorites-results > tbody > tr > .gl2e {
    width: auto !important;
    overflow-wrap: anywhere !important;
  }

  .ehpeek-contain-favorites-results .glink {
    white-space: normal !important;
    overflow-wrap: anywhere !important;
  }

  .ehpeek-contain-favorites-results .gl4e table {
    table-layout: fixed !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .ehpeek-contain-favorites-results .gl4e td {
    min-width: 0 !important;
    overflow-wrap: anywhere !important;
  }

  .ehpeek-contain-favorites-results .gl4e td.tc {
    width: 4em !important;
    white-space: nowrap !important;
  }

  .ehpeek-contain-favorites-results > tbody > tr > .glfe {
    width: 1% !important;
    white-space: nowrap !important;
  }
}

/* Present original Search rows through one shared EhPeek layout state. */
.ehpeek-layout-search-grid {
  display: block !important;
  table-layout: auto !important;
}

.ehpeek-layout-search-grid > tbody {
  display: block !important;
}

.ehpeek-layout-search-grid.ehpeek-search-result-columns > tbody {
  display: grid !important;
  box-sizing: border-box !important;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: stretch;
  min-width: 0 !important;
  width: 100% !important;
  gap: 8px;
}

.ehpeek-layout-search-grid.ehpeek-search-result-columns > tbody > tr {
  box-sizing: border-box !important;
  height: 100%;
  min-width: 0 !important;
  max-width: 100% !important;
}

.ehpeek-layout-search-grid > tbody > tr {
  position: relative !important;
  display: grid !important;
  grid-template-columns: clamp(112px, 34%, 250px) minmax(0, 1fr) !important;
  align-items: center !important;
  column-gap: 0 !important;
  width: 100% !important;
  cursor: pointer !important;
}

.ehpeek-layout-search-grid > tbody > tr:has(> .glfe) {
  grid-template-columns: clamp(112px, 34%, 250px) minmax(0, 1fr) auto !important;
}

.ehpeek-layout-search-grid > tbody > tr.ehpeek-expand-coverless-search-grid {
  grid-template-columns: minmax(0, 1fr) !important;
}

.ehpeek-layout-search-grid > tbody > tr > .gl1e {
  width: auto !important;
}

.ehpeek-layout-search-grid > tbody > tr > .gl2e {
  box-sizing: border-box !important;
  grid-column: auto;
  align-self: stretch !important;
  min-width: 0 !important;
  width: auto !important;
  height: 100% !important;
  padding-left: 0 !important;
}

.ehpeek-layout-search-grid > tbody > tr.ehpeek-expand-coverless-search-grid > .gl2e {
  grid-column: 1 !important;
}

.ehpeek-layout-search-grid > tbody > tr > .glfe {
  width: auto !important;
  margin-left: 6px !important;
}

.ehpeek-layout-search-grid > tbody > tr > .gl1e > div,
.ehpeek-layout-search-grid > tbody > tr > .gl1e img {
  width: 100% !important;
  height: auto !important;
}

.ehpeek-layout-search-grid > tbody > tr.ehpeek-contain-tall-search-grid-cover > .gl1e > div {
  display: flex !important;
  align-items: flex-start !important;
  justify-content: center !important;
  height: min(375px, 55dvh) !important;
}

.ehpeek-layout-search-grid > tbody > tr.ehpeek-contain-tall-search-grid-cover > .gl1e img {
  width: auto !important;
  max-width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
}

.ehpeek-layout-search-grid .gl4e {
  box-sizing: border-box !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  justify-content: flex-start !important;
  gap: var(--ui-space-md) !important;
  min-height: 0 !important;
  width: 100% !important;
  padding-left: 6px !important;
}

.ehpeek-layout-search-grid .gl4e:has(> .ehpeek-read-history-actions) {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr);
}

.ehpeek-layout-search-grid .gl4e > .ehpeek-read-history-actions {
  position: static !important;
  align-self: end;
  justify-self: stretch;
  width: 100% !important;
}

.ehpeek-layout-search-grid .glink {
  min-height: 0 !important;
  height: auto !important;
  overflow: visible !important;
  overflow-wrap: anywhere !important;
  white-space: normal !important;
  word-break: normal !important;
  text-align: left !important;
  font-size: var(--ui-font-size-md) !important;
  font-weight: 700 !important;
  line-height: 1.35 !important;
}

.ehpeek-layout-search-grid .gl3e {
  position: static !important;
  display: grid !important;
  grid-template-columns: max-content max-content minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center !important;
  gap: var(--ui-space-xs) var(--ui-space-sm) !important;
  float: none !important;
  min-height: 0 !important;
  width: 100% !important;
  height: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  font-weight: 600 !important;
}

.ehpeek-layout-search-grid .gl3e > * {
  position: static !important;
  min-width: 0 !important;
  width: auto !important;
  height: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  font-size: var(--ui-font-size-sm) !important;
  font-weight: 600 !important;
  line-height: 1.3 !important;
}

.ehpeek-layout-search-grid .ehpeek-search-meta-category {
  grid-column: 1;
  grid-row: 1;
}

.ehpeek-layout-search-grid .ehpeek-search-meta-pages {
  grid-column: 1;
  grid-row: 2;
  justify-self: center;
  font-variant-numeric: tabular-nums;
  font-weight: 700 !important;
  white-space: nowrap;
}

.ehpeek-layout-search-grid .ehpeek-search-meta-posted {
  position: relative !important;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  left: auto !important;
  grid-column: 2;
  grid-row: 1;
  text-align: center !important;
  white-space: nowrap;
}

.ehpeek-layout-search-grid .ehpeek-search-meta-rating {
  grid-column: 2;
  grid-row: 2;
  justify-self: center;
}

.ehpeek-layout-search-grid .ehpeek-search-meta-uploader {
  grid-column: 3;
  grid-row: 1;
  width: 100% !important;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left !important;
  white-space: nowrap;
}

.ehpeek-layout-search-grid .ehpeek-search-meta-download {
  display: flex !important;
  grid-column: 3;
  grid-row: 2;
  align-items: center !important;
  align-self: center;
  justify-self: start;
  height: 16px !important;
  line-height: 0 !important;
}

.ehpeek-layout-search-grid .ehpeek-search-meta-extra {
  grid-column: 1 / -1;
  justify-self: start;
  text-align: left !important;
}

.ehpeek-layout-search-grid .ehpeek-search-meta-extra:has(> p) {
  display: flex !important;
  align-items: center;
  gap: var(--ui-space-xs);
}

.ehpeek-layout-search-grid .ehpeek-search-meta-extra > p {
  margin: 0 !important;
}

.ehpeek-layout-search-grid .gl3e > .ir {
  width: 80px !important;
  height: 16px !important;
  background-repeat: no-repeat !important;
}

.ehpeek-layout-search-grid .gl3e > .gldown {
  width: auto !important;
  height: auto !important;
}

.ehpeek-layout-search-grid .gl3e > :is(.cn, .cs, [class*="ct"]) {
  box-sizing: border-box !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: max(72px, 6em) !important;
  height: max(32px, 2.2em) !important;
  padding: 0 0.6em !important;
}

.ehpeek-layout-search-grid .ehpeek-stack-search-grid-tags {
  position: static !important;
  flex: 0 0 auto !important;
  min-height: 0 !important;
  width: 100% !important;
  height: auto !important;
  margin: 0 !important;
  padding: 0 !important;
}

.ehpeek-layout-search-grid .ehpeek-stack-search-grid-tags :is(table, tbody, tr) {
  min-height: 0 !important;
  height: auto !important;
  margin: 0 !important;
}

.ehpeek-layout-search-grid .ehpeek-stack-search-grid-tags td {
  min-height: 0 !important;
  height: auto !important;
  vertical-align: top !important;
}

.ehpeek-layout-search-grid .ehpeek-stack-search-grid-tags :is(.gt, .gtl, .gtw, td.tc) {
  font-size: var(--ui-font-size-sm) !important;
  line-height: 1.2 !important;
}

.ehpeek-layout-search-grid.ehpeek-layout-search-grid-lite {
  --ehpeek-lite-cover-width: 23.8095%;
}

.ehpeek-layout-search-grid.ehpeek-layout-search-grid-lite > tbody > tr {
  aspect-ratio: 3 / 1;
  width: min(100%, 1134px) !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  margin-inline: auto !important;
}

.ehpeek-layout-search-grid.ehpeek-layout-search-grid-lite
  > tbody
  > tr:not(.ehpeek-expand-coverless-search-grid) {
  grid-template-columns:
    var(--ehpeek-lite-cover-width)
    minmax(0, 1fr) !important;
}

.ehpeek-layout-search-grid.ehpeek-layout-search-grid-lite
  > tbody
  > tr:has(> .glfe) {
  grid-template-columns:
    var(--ehpeek-lite-cover-width)
    minmax(0, 1fr)
    auto !important;
}

.ehpeek-layout-search-grid.ehpeek-layout-search-grid-lite
  > tbody
  > tr
  > .gl1e {
  box-sizing: border-box !important;
  height: 100% !important;
  overflow: hidden !important;
}

.ehpeek-layout-search-grid.ehpeek-layout-search-grid-lite
  > tbody
  > tr
  > .gl1e
  > div,
.ehpeek-layout-search-grid.ehpeek-layout-search-grid-lite
  > tbody
  > tr
  > .gl1e
  a {
  box-sizing: border-box !important;
  display: flex !important;
  align-items: flex-start !important;
  justify-content: center !important;
  width: 100% !important;
  height: 100% !important;
  overflow: hidden !important;
}

.ehpeek-layout-search-grid.ehpeek-layout-search-grid-lite
  > tbody
  > tr
  > .gl1e
  img {
  top: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  object-position: top center !important;
}

.ehpeek-layout-search-grid-lite .gl4e {
  gap: var(--ui-space-xs) !important;
  height: 100% !important;
  padding-block: var(--ui-space-xs) !important;
}

.ehpeek-layout-search-grid-lite .glink {
  display: -webkit-box !important;
  overflow: hidden !important;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.ehpeek-layout-search-grid-lite .ehpeek-stack-search-grid-tags {
  display: flex !important;
  flex: 1 1 auto !important;
  flex-wrap: wrap;
  align-items: flex-start;
  overflow: hidden !important;
  gap: var(--ui-space-xs) var(--ui-space-sm) !important;
}

.ehpeek-layout-search-grid-lite
  .ehpeek-stack-search-grid-tags:not(
    :has(:is(.gt, .gtl, .gtw)[style*="background"])
  ) {
  display: none !important;
}

.ehpeek-layout-search-grid-lite
  .ehpeek-stack-search-grid-tags
  :is(table, tbody, tr, td) {
  display: contents !important;
}

.ehpeek-layout-search-grid-lite .ehpeek-stack-search-grid-tags .tc,
.ehpeek-layout-search-grid-lite
  .ehpeek-stack-search-grid-tags
  :is(.gt, .gtl, .gtw) {
  display: none !important;
}

.ehpeek-layout-search-grid-lite
  .ehpeek-stack-search-grid-tags
  :is(.gt, .gtl, .gtw)[style*="background"] {
  display: inline-flex !important;
  align-items: center;
}

.ehpeek-layout-search-grid-lite [data-ehpeek-lite-prefix]::before {
  content: attr(data-ehpeek-lite-prefix) ":";
}

.ehpeek-cover-search-grid-row {
  grid-column: 1 / 3;
  grid-row: 1;
}

/* Reading state remains visual and never changes the original title text. */
.ehpeek-prefix-read-history-label::before {
  box-sizing: border-box;
  content: attr(data-ehpeek-history-label);
  display: inline-flex;
  align-items: center;
  margin-right: var(--ui-space-xs);
  padding: 0;
  border: 0;
  border-radius: 0;
  outline: 0;
  background: transparent;
  box-shadow: none;
  color: var(--color-site-accent);
  vertical-align: middle;
  font-weight: 700;
  line-height: 1.3;
}

[data-ehpeek-read-history="visited"] {
  --ehpeek-read-history-tint: color-mix(in srgb, var(--color-site-accent) 6%, transparent);
}

[data-ehpeek-read-history="reading"] {
  --ehpeek-read-history-tint: color-mix(in srgb, var(--color-site-accent) 12%, transparent);
}

tr[data-ehpeek-read-history] > td:not(.glfe),
[data-ehpeek-read-history]:not(tr) {
  box-shadow: inset 0 0 0 9999px var(--ehpeek-read-history-tint) !important;
}

/* Style retained Search controls without replacing their original classes. */
.ehpeek-reset-search-box-layout {
  box-sizing: border-box !important;
  min-width: 0 !important;
  width: 100% !important;
  height: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  text-align: left !important;
  font-size: var(--ui-font-size-md) !important;
}

.ehpeek-stack-search-form {
  display: flex !important;
  flex-direction: column !important;
  gap: var(--ui-space-sm) !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
}

.ehpeek-overlay-search-actions {
  box-sizing: border-box !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) var(--ui-control-size-xl) !important;
  align-items: start !important;
  gap: 0 !important;
  min-width: 0 !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
}

.ehpeek-overlay-search-actions[data-ehpeek-has-clear="true"] {
  grid-template-columns:
    minmax(0, 1fr)
    repeat(2, var(--ui-control-size-xl)) !important;
}

.ehpeek-expand-search-input {
  appearance: none !important;
  box-sizing: border-box !important;
  grid-column: 1 / -1 !important;
  grid-row: 1 !important;
  min-width: 0 !important;
  width: 100% !important;
  height: var(--ui-control-size-xl) !important;
  margin: 0 !important;
  padding:
    0
    calc(var(--ui-control-size-xl) + var(--ui-space-lg))
    0
    var(--ui-space-md) !important;
  border: 1px solid var(--color-site-border) !important;
  border-radius: var(--ui-radius-sm) !important;
  outline: none !important;
  background: var(--color-site-elevated) !important;
  color: var(--color-site-text) !important;
  font-size: var(--ui-font-size-lg) !important;
  line-height: 1.2 !important;
}

.ehpeek-overlay-search-actions[data-ehpeek-has-clear="true"] .ehpeek-expand-search-input {
  padding-right:
    calc((var(--ui-control-size-xl) * 2) + var(--ui-space-lg)) !important;
}

.ehpeek-expand-search-input:focus {
  border-color: var(--color-site-accent) !important;
  background: var(--color-site-elevated) !important;
  box-shadow: 0 0 0 3px var(--color-site-accent-hover) !important;
}

.ehpeek-hide-original-search-action {
  display: none !important;
}

.ehpeek-layout-search-categories {
  width: 100% !important;
  margin: 0 !important;
  border-collapse: collapse !important;
}

.ehpeek-layout-search-categories[aria-hidden="true"] {
  display: none !important;
}

.ehpeek-layout-search-categories > tbody {
  display: grid !important;
  grid-template-columns:
    repeat(
      auto-fit,
      minmax(min(100%, calc(var(--ui-control-size-xl) * 2)), 1fr)
    ) !important;
  gap: var(--ui-space-xs) !important;
}

.ehpeek-layout-search-categories tr {
  display: contents !important;
}

.ehpeek-layout-search-categories td {
  padding: 0 !important;
}

.ehpeek-layout-search-categories [id^="cat_"] {
  box-sizing: border-box !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 0 !important;
  width: 100% !important;
  height: var(--ui-hit-size-sm) !important;
  padding-inline: var(--ui-space-sm) !important;
  border: 1px solid var(--color-site-border) !important;
  border-radius: var(--ui-radius-sm) !important;
  color: #ffffff !important;
  text-align: center !important;
  white-space: nowrap !important;
  font-size: var(--ui-font-size-md) !important;
  font-weight: 700 !important;
  line-height: 1.15 !important;
  box-shadow: 0 2px 6px var(--color-shadow-control) !important;
  cursor: pointer !important;
  user-select: none !important;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 120ms;
}

.ehpeek-layout-search-categories [id^="cat_"]:active {
  opacity: 0.7;
}

.ehpeek-layout-search-categories [id^="cat_"][data-disabled] {
  opacity: 0.4;
}

.ehpeek-wrap-search-options {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap:
    var(--ui-space-xs)
    var(--ui-space-sm) !important;
  width: 100% !important;
  padding: 0 !important;
  font-size: 0 !important;
}

.ehpeek-wrap-search-options > a {
  appearance: none !important;
  display: inline-flex !important;
  align-items: center !important;
  min-height: var(--ui-hit-size-sm) !important;
  padding-inline: var(--ui-space-md) !important;
  border: 0 !important;
  border-radius: var(--ui-radius-sm) !important;
  background: transparent !important;
  color: var(--color-site-accent) !important;
  text-align: left !important;
  text-decoration: none !important;
  font: inherit !important;
  font-size: var(--ui-font-size-md) !important;
  font-weight: 700 !important;
  line-height: 1.2 !important;
  cursor: pointer !important;
  touch-action: manipulation;
}

.ehpeek-wrap-search-options > a:active {
  background: var(--color-site-accent-hover) !important;
}

.ehpeek-expand-search-advanced-options {
  box-sizing: border-box !important;
  width: 100% !important;
  padding: 0 !important;
  color: var(--color-site-text) !important;
}

.ehpeek-reset-search-box-layout .searchadv {
  box-sizing: border-box !important;
  width: 100% !important;
  padding-top: var(--ui-space-sm) !important;
  font-size: var(--ui-font-size-md) !important;
}

.ehpeek-reset-search-box-layout .searchadv > div,
.ehpeek-expand-file-search .searchadv > div {
  flex-wrap: wrap !important;
  justify-content: flex-start !important;
  gap: var(--ui-space-xs) !important;
}

.ehpeek-reset-search-box-layout .searchadv > div > div,
.ehpeek-expand-file-search .searchadv > div > div {
  padding: var(--ui-space-xs) !important;
}

.ehpeek-expand-file-search {
  box-sizing: border-box !important;
  width: 100% !important;
  margin: 0 !important;
  padding: var(--ui-space-sm) !important;
  border: 1px solid var(--color-site-border) !important;
  border-radius: var(--ui-radius-xs) !important;
  background: var(--color-site-elevated) !important;
  color: var(--color-site-text) !important;
  text-align: left !important;
  font-size: var(--ui-font-size-md) !important;
}

.ehpeek-expand-file-search form {
  display: flex !important;
  flex-direction: column !important;
  gap: var(--ui-space-xs) !important;
}

.ehpeek-expand-file-search form > div {
  padding: 0 !important;
}

/* Apply dynamic My Tag colors through variables instead of direct presentation writes. */
.ehpeek-color-my-tag {
  background-color: var(--ehpeek-my-tag-background) !important;
}

.ehpeek-color-my-tag > a {
  color: var(--ehpeek-my-tag-color) !important;
}

.ehpeek-expand-gallery-actions {
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
}

.ehpeek-fit-gallery-cover {
  display: block;
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  margin-inline: auto;
  object-fit: contain;
  object-position: center;
}

/* Hide original GalleryInfo content only while the TouchUI panel owns its host. */
.ehpeek-hide-original-gallery-info > :not([data-ehpeek-anchor="gallery-info"]) {
  display: none !important;
}

.ehpeek-layout-gallery-action,
.ehpeek-layout-top-bar-menu-item {
  box-sizing: border-box !important;
  display: block !important;
  position: static !important;
  float: none !important;
  min-height: var(--ui-hit-size-xl) !important;
  width: 100% !important;
  height: auto !important;
  margin: 0 !important;
  padding: var(--ui-space-md) var(--ui-space-lg) !important;
  border: 0 !important;
  border-bottom: 1px solid var(--color-site-border-subtle) !important;
  background: transparent !important;
  color: var(--color-site-text) !important;
  text-align: left !important;
  text-decoration: none !important;
  white-space: normal !important;
  font-size: var(--ui-font-size-md) !important;
  line-height: 1.2 !important;
}

.ehpeek-hide-original-top-bar {
  display: none !important;
}

.ehpeek-layout-top-bar-menu-item {
  min-height: var(--ui-control-size-lg) !important;
  padding: var(--ui-space-md) !important;
  font-size: var(--ui-font-size-md) !important;
}

.ehpeek-layout-new-tag-form {
  box-sizing: border-box !important;
  display: block !important;
  width: 100% !important;
  height: auto !important;
  padding-top: var(--ui-space-md) !important;
}

.ehpeek-layout-new-tag-form form {
  display: flex !important;
  align-items: center !important;
  gap: var(--ui-space-sm) !important;
  min-width: 0 !important;
  width: 100% !important;
}

.ehpeek-layout-new-tag-form #newtagfield {
  box-sizing: border-box !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
  height: var(--ui-hit-size-md) !important;
  padding-inline: var(--ui-space-md) !important;
  border: 1px solid var(--color-site-border) !important;
  border-radius: var(--ui-radius-xs) !important;
  outline: none !important;
  background: var(--color-site-surface) !important;
  color: var(--color-site-text) !important;
  font: inherit !important;
  font-size: var(--ui-font-size-md) !important;
}

.ehpeek-layout-new-tag-form #newtagfield:focus {
  border-color: var(--color-site-accent) !important;
}

.ehpeek-layout-new-tag-form #newtagbutton {
  box-sizing: border-box !important;
  flex: 0 0 auto !important;
  height: var(--ui-hit-size-md) !important;
  padding-inline: var(--ui-space-lg) !important;
  border: 1px solid var(--color-site-accent) !important;
  border-radius: var(--ui-radius-xs) !important;
  background: var(--color-site-accent) !important;
  color: var(--color-background) !important;
  font: inherit !important;
  font-size: var(--ui-font-size-md) !important;
  font-weight: 700 !important;
  cursor: pointer !important;
}

.ehpeek-layout-gallery-tag-menu {
  box-sizing: border-box !important;
  display: flex !important;
  flex-direction: column !important;
  float: none !important;
  width: 100% !important;
  height: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  font-size: var(--ui-font-size-md) !important;
}

.ehpeek-layout-gallery-tag-menu img {
  display: none !important;
}

.ehpeek-layout-gallery-tag-menu a,
.ehpeek-layout-gallery-tag-menu-item {
  box-sizing: border-box !important;
  display: flex !important;
  align-items: center !important;
  gap: var(--ui-space-md) !important;
  min-height: var(--ui-hit-size-xl) !important;
  width: 100% !important;
  padding: var(--ui-space-md) var(--ui-space-lg) !important;
  border: 0 !important;
  border-bottom: 1px solid var(--color-site-border-subtle) !important;
  background: transparent !important;
  color: var(--color-site-text) !important;
  text-align: left !important;
  text-decoration: none !important;
  font: inherit !important;
  font-size: var(--ui-font-size-md) !important;
  cursor: pointer !important;
}

.ehpeek-enable-touch-comment-score .c5 {
  white-space: nowrap !important;
}

.ehpeek-enable-touch-comment-score .c7[aria-hidden="true"] {
  display: none !important;
}

.ehpeek-enable-touch-comment-score .c7[aria-hidden="false"] {
  display: block !important;
}

.ehpeek-enable-preview-swipe-input {
  touch-action: pan-y;
  user-select: none;
}

.ehpeek-enable-preview-swipe-input img {
  -webkit-user-drag: none;
}

.ehpeek-hide-original-preview-page-bars :is(.ptt, .ptb, .gpc) {
  display: none !important;
}

.ehpeek-touch-gallery-summary-has-cover {
  grid-template-columns:
    minmax(60px, min(38%, 34dvh))
    minmax(0, 1fr);
}

.ehpeek-touch-gallery-primary-actions {
  grid-column: 1 / -1;
}

.ehpeek-touch-gallery-summary-container {
  container-type: inline-size;
}

@container (min-width: 720px) {
  .ehpeek-touch-gallery-summary {
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .ehpeek-touch-gallery-summary-cover {
    grid-row: 1 / 3;
  }

  .ehpeek-touch-gallery-summary-details {
    grid-column: 2;
    grid-row: 1;
  }

  .ehpeek-touch-gallery-primary-actions {
    grid-column: 2;
    grid-row: 2;
    justify-self: end;
    width: min(100%, 90dvh);
  }
}

.ehpeek-touch-search-panel {
  container-type: inline-size;
}

/* The root state scopes original Gallery layout overrides to TouchUI pages. */
.ehpeek-touch-gallery-page {
  --touch-gallery-gutter: clamp(16px, 2.5vw, 36px);
}

html.ehpeek-touch-gallery-page,
body.ehpeek-touch-gallery-page {
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}

html.ehpeek-touch-gallery-page.ehpeek-gallery-wide-layout-root,
body.ehpeek-touch-gallery-page.ehpeek-gallery-wide-layout-root {
  height: 100dvh !important;
  overflow-y: hidden !important;
}

body.ehpeek-touch-gallery-page.ehpeek-gallery-wide-layout-root {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

body.ehpeek-touch-gallery-page {
  box-sizing: border-box;
  background: var(--color-site-page) !important;
  font-size: var(--ui-font-size-sm) !important;
  line-height: 1.35 !important;
}

body.ehpeek-touch-gallery-page #gdt[class] {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  align-items: start;
}

body.ehpeek-touch-gallery-page #gdt.ehpeek-hide-original-node {
  display: none !important;
}

body.ehpeek-touch-gallery-page #gdt :is(.gdtm, .gdtl),
body.ehpeek-touch-gallery-page #gdt > div {
  display: flex !important;
  box-sizing: border-box !important;
  min-width: 0 !important;
  align-items: center !important;
  justify-content: center !important;
  justify-self: center;
}

body.ehpeek-touch-gallery-page #gdt a {
  display: flex !important;
  align-items: center;
  justify-content: center;
}

body.ehpeek-touch-gallery-page #cdiv {
  font-size: var(--ui-font-size-md) !important;
  line-height: 1.5 !important;
}

body.ehpeek-touch-gallery-page #cdiv .c2 {
  display: flex !important;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: flex-end;
  height: auto !important;
}

body.ehpeek-touch-gallery-page #cdiv .c2 > .c3 {
  flex: 1 1 auto;
  order: 1;
  margin-right: auto;
}

body.ehpeek-touch-gallery-page #cdiv .c2 > .c5 {
  order: 2;
  width: auto !important;
  white-space: nowrap;
}

body.ehpeek-touch-gallery-page #cdiv .c2 > .c4 {
  order: 3;
  width: auto !important;
  white-space: nowrap;
}

body.ehpeek-touch-gallery-page #cdiv .c6 {
  font-size: var(--ui-font-size-lg) !important;
  line-height: 1.5 !important;
  overflow-wrap: anywhere;
}

body.ehpeek-touch-gallery-page :is(
  #cdiv .c3,
  #cdiv .c4,
  #cdiv .c5,
  #cdiv .c7,
  #formdiv
) {
  font-size: var(--ui-font-size-sm) !important;
  line-height: 1.4 !important;
}

body.ehpeek-touch-gallery-page #postnewcomment {
  display: flex !important;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--ui-space-md);
  margin: var(--ui-space-lg) 0 !important;
  font-size: 0 !important;
}

body.ehpeek-touch-gallery-page #postnewcomment a {
  display: inline-flex !important;
  min-height: var(--ui-hit-size-sm);
  align-items: center;
  padding: var(--ui-space-md) var(--ui-space-lg);
  border: 1px solid var(--color-site-border);
  border-radius: var(--ui-radius-md);
  background: var(--color-site-elevated);
  color: var(--color-site-accent);
  font-size: var(--ui-font-size-md);
  text-decoration: none;
}

body.ehpeek-touch-gallery-page #cdiv form {
  display: flex !important;
  flex-wrap: wrap;
  gap: var(--ui-space-md);
  align-items: center;
}

body.ehpeek-touch-gallery-page :is(#cdiv textarea, #commenttext) {
  display: block !important;
  box-sizing: border-box !important;
  width: 100% !important;
  min-height: calc(var(--ui-control-size-xl) * 2) !important;
  flex: 1 0 100%;
  padding: var(--ui-space-lg) !important;
  border-radius: var(--ui-radius-md) !important;
  font: inherit !important;
  font-size: var(--ui-font-size-md) !important;
  line-height: 1.5 !important;
}

body.ehpeek-touch-gallery-page #cdiv :is(
  button,
  input[type="button"],
  input[type="submit"],
  input[type="text"],
  select
) {
  box-sizing: border-box !important;
  min-height: var(--ui-hit-size-sm) !important;
  padding: var(--ui-space-md) var(--ui-space-lg) !important;
  border-radius: var(--ui-radius-md) !important;
  font: inherit !important;
  font-size: var(--ui-font-size-md) !important;
}

body.ehpeek-touch-gallery-page #cdiv :is(
  button,
  input[type="button"],
  input[type="submit"]
) {
  flex: 1 1 12em;
  cursor: pointer;
}

body.ehpeek-touch-gallery-page #cdiv input[type="text"] {
  min-width: min(100%, 15em);
}

body.ehpeek-touch-gallery-page .ehpeek-touch-gallery-layout {
  box-sizing: border-box;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: minmax(0, 1fr) auto;
  column-gap: var(--touch-gallery-gutter);
  width: calc(100% - (var(--touch-gallery-gutter) * 2));
  height: calc(100dvh - var(--ui-control-size-xl));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  margin-inline: auto;
  align-items: start;
  overflow: hidden;
}

body.ehpeek-touch-gallery-page :is(
  .ehpeek-touch-gallery-layout-left,
  .ehpeek-touch-gallery-layout-right
) {
  grid-row: 1;
  display: block;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

body.ehpeek-touch-gallery-page
  .ehpeek-touch-gallery-layout-right
  > .ehpeek-scroll-preview-mount {
  min-height: 0;
  height: 100%;
}

body.ehpeek-touch-gallery-page :is(
  .ehpeek-touch-gallery-layout-left,
  .ehpeek-touch-gallery-layout-right
)::-webkit-scrollbar {
  display: none;
}

body.ehpeek-touch-gallery-page .ehpeek-touch-gallery-layout :is(
  .ehpeek-hide-original-gallery-info,
  .gtb,
  .contents,
  .gpc,
  #cdiv,
  .ptt,
  .ptb
) {
  min-width: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
}

body.ehpeek-touch-gallery-page .ehpeek-touch-gallery-layout #gdt[class] {
  min-width: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
}

body.ehpeek-touch-gallery-page
  .ehpeek-touch-gallery-layout-left
  > .ehpeek-hide-original-gallery-info {
  padding-bottom: 0 !important;
}

body.ehpeek-touch-gallery-page
  .ehpeek-touch-gallery-layout-left
  .ehpeek-touch-gallery {
  margin-bottom: 0;
}

body.ehpeek-touch-gallery-page .ehpeek-touch-gallery-layout > .dp {
  box-sizing: border-box;
  grid-row: 2;
  grid-column: 1 / -1;
  min-width: 0;
  width: 100%;
}
