:root {
  --background: #f7f6f2;
  --surface: #fdfcf9;
  --raised: #f1efea;
  --border: #d8d4cd;
  --edge: #e6e1d9;
  --text: #282335;
  --muted: #625c6a;
  --accent: #514175;
  --accent-soft: #eeeaf6;
  --gallery-gutter: clamp(1.15rem, 2.55vw, 3rem);
}

.gallery-layout { display: block; background: #f7f6f2e9; }
.gallery-frame { width: min(100%, 105rem); margin-inline: auto; padding-inline: var(--gallery-gutter); }
.gallery-header { position: sticky; top: 0; z-index: 8; border-bottom: 1px solid var(--edge); background: #fcfbf8f5; backdrop-filter: blur(14px); }
.gallery-header-inner { display: flex; min-height: 4rem; align-items: center; gap: clamp(1.2rem, 3.2vw, 3.5rem); }
.gallery-brand { display: flex; min-width: 0; flex: 0 0 auto; align-items: center; gap: 0.58rem; }
.gallery-brand h1 { font-size: 1.04rem; font-weight: 760; white-space: nowrap; }
.gallery-mark { display: grid; flex: 0 0 auto; grid-template-columns: repeat(2, 1fr); gap: 0.17rem; width: 1.95rem; aspect-ratio: 1; padding: 0.36rem; border: 1px solid #362b55; border-radius: 0.54rem; background: #382c57; }
.gallery-mark i { border-radius: 0.12rem; background: #f6f0ff; }
.gallery-mark i:nth-child(2) { border-radius: 50%; background: #bfa9ed; }
.gallery-mark i:nth-child(3) { background: #e1d2f8; }
.gallery-mark i:nth-child(4) { border-radius: 50% 50% 0.12rem 0.12rem; background: #aa91db; }
.gallery-main-links { display: flex; flex: 1; align-items: stretch; align-self: stretch; gap: 1.35rem; }
.gallery-main-links :is(button, a) { display: inline-flex; align-items: center; border: 0; border-block: 2px solid transparent; padding: 0 0.2rem; background: none; color: var(--muted); font-size: 0.86rem; font-weight: 630; white-space: nowrap; }
.gallery-main-links :is(button, a):hover, .gallery-main-links [aria-pressed="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.gallery-header-actions { display: flex; margin-inline-start: auto; gap: 0.5rem; }
.gallery-header-actions .button, .gallery-import { min-height: 2.56rem; padding-inline: 0.73rem; border-radius: 0.68rem; font-size: 0.82rem; white-space: nowrap; }
.gallery-cloud { border-color: var(--border); background: #fdfcf9; color: var(--text); }
.gallery-cloud:hover { border-color: #a597b6; }

.gallery-layout .workspace { min-height: calc(100dvh - 4rem); padding: 0 var(--gallery-gutter) 3rem; }
.gallery-toolbar { position: sticky; top: 4rem; z-index: 6; display: flex; min-width: 0; align-items: center; gap: clamp(0.72rem, 2vw, 1.55rem); padding-block: 0.88rem; border-bottom: 1px solid var(--edge); background: #f7f6f2f2; backdrop-filter: blur(10px); }
.gallery-search { flex: 1 1 24rem; width: auto; max-width: none; min-height: 2.72rem; padding-inline: 0.9rem; border-color: var(--edge); border-radius: 0.72rem; }
.gallery-search input { text-overflow: ellipsis; }
.gallery-scope { display: flex; flex: 0 0 auto; width: auto; align-items: center; gap: 0.38rem; }
.gallery-scope .overview-card[data-access] { display: inline-flex; grid-column: auto; width: auto; min-height: 2.54rem; align-items: center; gap: 0.43rem; padding-inline: 0.62rem; border: 1px solid var(--edge); border-radius: 0.63rem; background: var(--surface); color: var(--text); white-space: nowrap; }
.gallery-scope .overview-card::before { width: 0.42rem; aspect-ratio: 1; flex: 0 0 auto; border-radius: 50%; background: var(--tone); content: ""; }
.gallery-scope .overview-card[data-access] .overview-number { margin: 0; color: var(--muted); font-size: 0.68rem; font-weight: 640; }
.gallery-scope .overview-label { color: inherit; font-weight: 620; }
.gallery-scope .overview-card[aria-pressed="true"], .gallery-scope .overview-card:hover { border-color: color-mix(in srgb, var(--tone) 33%, var(--edge)); background: color-mix(in srgb, var(--tone) 9%, var(--surface)); }

.gallery-intro { display: flex; align-items: end; justify-content: space-between; gap: 1rem; padding-block: clamp(1.15rem, 2.35vw, 2.15rem) 1.05rem; }
.gallery-intro h2 { color: #282335; font-size: clamp(1.95rem, 3.05vw, 3rem); line-height: 1.12; font-weight: 790; letter-spacing: -0.055em; }
.gallery-intro p { margin-top: 0.32rem; color: var(--muted); font-size: 0.8rem; }
.gallery-import { align-self: center; min-height: 2.35rem; border-color: var(--border); background: var(--surface); }
.gallery-collections { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); column-gap: clamp(0.65rem, 1.35vw, 1.4rem); row-gap: clamp(1.15rem, 1.95vw, 1.85rem); }
.gallery-topic { display: flex; min-width: 0; flex-direction: column; padding: 0; border: 0; border-radius: 0.65rem; background: none; color: var(--text); text-align: start; }
.gallery-cover { position: relative; isolation: isolate; display: block; width: 100%; aspect-ratio: 8 / 5; overflow: hidden; border-radius: 0.73rem; background: #dad4e7; }
.topic-ai .gallery-cover { background: #3136b2; }
.topic-editing .gallery-cover { background: #b74732; }
.topic-ecommerce .gallery-cover { background: #a9bf5e; }
.topic-packaging .gallery-cover { background: #b8a6d5; }
.topic-modeling .gallery-cover { background: #32265e; }
.topic-operations .gallery-cover { background: #d89b8d; }
.topic-china .gallery-cover { background: #d3e0ef; }
.topic-commerce .gallery-cover { background: #e5bf62; }
.gallery-cover img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 230ms ease; }
.gallery-cover-arrow { position: absolute; inset: auto 0.58rem 0.58rem auto; display: grid; width: 1.95rem; aspect-ratio: 1; place-items: center; border-radius: 50%; background: #fdfcf8ee; color: #392f4e; font-size: 0.95rem; line-height: 1; transition: background 170ms ease, color 170ms ease; }
.gallery-topic:is(:hover,:focus-visible) .gallery-cover img { transform: scale(1.035); }
.gallery-topic:is(:hover,:focus-visible) .gallery-cover-arrow { background: #403059; color: #fff; }
.gallery-card-title { display: flex; width: 100%; align-items: baseline; justify-content: space-between; gap: 0.35rem; margin-top: 0.56rem; }
.gallery-card-title strong { color: var(--text); font-size: 1.04rem; font-weight: 730; }
.gallery-card-title .topic-count { margin: 0; flex: 0 0 auto; color: var(--muted); font-size: 0.73rem; font-weight: 540; white-space: nowrap; }
.gallery-card-description { margin-top: 0.16rem; color: var(--muted); font-size: 0.8rem; }

.gallery-overview { margin-block: 1.6rem 0; border-block-start: 1px solid var(--edge); }
.gallery-overview summary { display: flex; min-height: 3rem; align-items: center; gap: 0.7rem; padding-block: 0.55rem; color: var(--text); font-size: 0.87rem; font-weight: 650; cursor: pointer; list-style: none; }
.gallery-overview summary::-webkit-details-marker { display: none; }
.gallery-overview summary::before { width: 0.42rem; height: 0.42rem; margin-inline: 0.12rem; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(-45deg); content: ""; }
.gallery-overview[open] summary::before { transform: rotate(45deg); }
.gallery-overview .dashboard-date { display: inline; margin-inline-start: auto; padding: 0; border: 0; font-size: 0.74rem; font-weight: 450; }
.gallery-widget-grid { margin-block: 0.35rem 1.35rem; }
.gallery-widget-grid :is(.dash-shortcuts,.dash-pinned,.dash-actions) { grid-column: span 8; }
.gallery-widget-grid :is(.dash-collections,.dash-recent,.dash-distribution) { grid-column: span 8; }
.gallery-layout #resource-panel { scroll-margin-top: 8.8rem; border-radius: 0.85rem; }
.gallery-layout .panel-heading h2 { scroll-margin-top: 8.8rem; }
.gallery-layout .resource-row { background: var(--surface); }
.gallery-layout .resource-row:hover { border-color: #c9bfd6; }

@media (max-width: 75rem) {
  .gallery-collections { grid-template-columns: repeat(3, minmax(0,1fr)); }
}
@media (max-width: 51rem) {
  .gallery-collections { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .gallery-widget-grid :is(.dash-shortcuts,.dash-pinned,.dash-collections,.dash-recent) { grid-column: span 12; }
  .gallery-widget-grid :is(.dash-actions,.dash-distribution) { grid-column: span 24; }
}
@media (max-width: 44rem) {
  :root { --gallery-gutter: 0.87rem; }
  .gallery-header-inner { display: grid; min-height: 0; grid-template-areas: "brand actions" "nav nav"; grid-template-columns: minmax(0,1fr) auto; column-gap: 0.4rem; row-gap: 0; padding-block-start: 0.48rem; }
  .gallery-brand { grid-area: brand; }
  .gallery-brand h1 { font-size: 0.92rem; }
  .gallery-mark { width: 1.67rem; padding: 0.28rem; }
  .gallery-header-actions { grid-area: actions; gap: 0.3rem; }
  .gallery-header-actions .button { min-height: 2.38rem; padding-inline: 0.49rem; font-size: 0.78rem; }
  .gallery-header-actions .icon { width: 0.9rem; }
  .gallery-main-links { grid-area: nav; min-height: 2.35rem; }
  .gallery-toolbar { position: static; flex-direction: column; align-items: stretch; gap: 0.55rem; padding-block: 0.65rem; background: transparent; backdrop-filter: none; }
  .gallery-search { flex-basis: auto; }
  .gallery-search input { font-size: 1rem; }
  .gallery-scope { flex-wrap: wrap; gap: 0.3rem; }
  .gallery-scope .overview-card[data-access] { min-height: 2.3rem; gap: 0.28rem; padding-inline: 0.41rem; }
  .gallery-scope .overview-label { font-size: 0.72rem; }
  .gallery-cover { border-radius: 0.56rem; }
  .gallery-cover-arrow { inset: auto 0.32rem 0.32rem auto; width: 1.55rem; font-size: 0.84rem; }
  .gallery-card-title strong { font-size: 0.88rem; }
  .gallery-card-title .topic-count, .gallery-card-description { font-size: 0.7rem; }
  .gallery-intro { padding-block: 1rem 0.9rem; }
  .gallery-import { font-size: 0.77rem; }
  .gallery-layout #resource-panel, .gallery-layout .panel-heading h2 { scroll-margin-top: 6rem; }
}
@media (max-width: 22rem) {
  .gallery-header-actions .icon { display: none; }
  .gallery-card-title strong { font-size: 0.81rem; }
}
