.gallery-header-bar {
  min-block-size: 68px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 8px max(clamp(20px, 5vw, 72px), calc((100vw - 1200px) / 2));
  border-block-end: 1px solid #e2e6df;
  background: #f9faf7;
}
.brand { width: fit-content; color: var(--ink); text-decoration: none; letter-spacing: .035em; }
.brand-mark { color: #f0f4ed; background: #284d41; }
.gallery-header-bar #account-menu, .gallery-header-bar #portal-login {
  justify-self: end;
  margin: 0;
  padding-block-start: 0;
  border-block-start: 0;
}
.gallery-header-bar #account-menu span { font-size: .875rem; }
.gallery-nav { display: flex; align-items: center; gap: 5px; }
.gallery-nav a {
  min-block-size: 42px;
  display: grid;
  place-content: center;
  min-inline-size: 62px;
  padding-inline: 12px;
  border-radius: 999px;
  color: var(--muted);
  font-size: .9rem;
  font-weight: 600;
  text-decoration: none;
  transition: background .18s, color .18s;
}
.gallery-nav a[aria-current="page"] { color: var(--accent-dark); background: #e6ede6; }
.gallery-nav a:hover, .button.quiet:hover:not(:disabled) { color: var(--ink); background: #e9ede7; }

.workspace { padding-inline: clamp(20px, 4.8vw, 68px); }
.portal { max-inline-size: 1280px; padding-block: clamp(29px, 4.1vw, 60px) 68px; }
.portal h1, .creation-title h1 {
  color: #202923;
  font-size: clamp(2.25rem, 5.2vw, 4.4rem);
  font-weight: 720;
  line-height: 1.12;
  letter-spacing: -.065em;
  margin: 0;
}
.portal .destination-title { margin-block-end: 18px; }
.portal .destination-title h1 { font-size: clamp(2.25rem, 5vw, 3.7rem); }
.portal-note { color: var(--muted); }
.portal-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.button { min-block-size: 42px; border-radius: 999px; }
.button.quiet { color: var(--accent-dark); background: transparent; border-color: transparent; }
.button.secondary:not(:disabled) { background: #f6f8f4; border-color: #dce4db; color: var(--ink); }
.button.secondary:hover:not(:disabled) { background: #eaf0e9; border-color: #d1ded2; }
.exhibition-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.16fr);
  min-block-size: 365px;
  overflow: hidden;
  border-radius: 27px;
  background: #e9eee6;
}
.exhibition-copy {
  align-self: center;
  padding: clamp(28px, 5.2vw, 76px);
}
.exhibition-copy p {
  margin-block: 18px 26px;
  color: #46584c;
  font-size: clamp(.95rem, 1.45vw, 1.13rem);
  line-height: 1.6;
}
.exhibition-art { position: relative; min-block-size: 100%; overflow: hidden; background: #c6d5ca; }
.exhibition-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.exhibition-caption {
  position: absolute;
  inset: auto auto 15px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 13px;
  border-radius: 11px;
  background: rgb(24 43 33 / 80%);
  color: white;
  font-size: .8rem;
}
.gallery-controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: flex-start; margin-block: 33px 14px; }
.gallery-controls h2 { margin-inline-end: auto; font-size: clamp(1.25rem, 2.3vw, 1.56rem); }
.segmented { display: inline-flex; background: #e9ede7; padding: 3px; border-radius: 999px; }
.segmented .button { min-block-size: 34px; padding: 5px 12px; color: var(--muted); }
.segmented .button[aria-pressed="true"] {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 1px 3px #25372d1c;
}
#home-status, #mine-status, #square-status {
  padding: 18px 0;
  color: var(--muted);
  border-block-start: 1px solid var(--line);
}
#home-status:empty, #home-list:empty, #square-status:empty, #mine-status:empty { display: none; }
#square { margin-block-start: 45px; }
#welcome[hidden] + #square { margin-block-start: 0; }
#square-filters { margin-block: 21px 18px; }
#square-filters select {
  width: auto;
  max-width: 100%;
  min-height: 42px;
  border-radius: 999px;
  color: var(--ink);
}
.square-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(12px, 2.2vw, 25px); }
.square-card, .mine-task {
  display: block;
  color: var(--ink);
  text-decoration: none;
  overflow: hidden;
}
.square-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 15px;
  background: var(--accent-soft);
}
.square-caption {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 3px 9px;
  padding-block: 11px 14px;
}
.square-caption strong, .mine-task-detail strong { font-weight: 650; overflow-wrap: anywhere; }
.square-caption small { grid-column: 1; }
.square-caption small, .mine-task-detail small { color: var(--muted); }
.square-use { grid-column: 2; grid-row: 1; color: var(--accent-dark); font-size: .75rem; white-space: nowrap; }
.square-card:hover strong, .mine-task:hover strong { color: var(--accent-dark); text-decoration: underline; text-underline-offset: 3px; }
.mine-list { margin: 0; padding: 0; list-style: none; }
.mine-task {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-block-size: 69px;
  padding: 12px 0;
  border-block-end: 1px solid var(--line);
}
.mine-task-detail { display: grid; gap: 4px; min-inline-size: 0; }
.mine-task .status-chip { flex: 0 0 auto; font-weight: 600; }
.work-gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.work-gallery .mine-task { display: grid; align-content: start; justify-content: stretch; padding: 0 0 14px; }
.work-gallery .status-chip { justify-self: start; }
.work-cover { display: none; }
.work-gallery .work-cover {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 15px;
  background: #e9eee7;
  color: #425848;
}
.work-cover img { width: 100%; height: 100%; object-fit: cover; }

.create-page .workspace { max-inline-size: 1060px; padding-block: clamp(28px, 4vw, 55px) 56px; }
.creation-title { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-block-end: 24px; }
.creation-title h1 { font-size: clamp(2.1rem, 4.8vw, 3.45rem); }
.creation-title-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.create-page .compose-panel, .create-page .results-panel {
  padding: clamp(17px, 3vw, 33px);
  border-radius: 22px;
  border-color: #e4e8e2;
  box-shadow: 0 2px 10px #213b2a05;
}
.create-page .compose-header { margin-block-end: 12px; }
.create-page .editor { border-radius: 13px; background: #f4f6f2; }
.create-page #script {
  min-block-size: clamp(245px, 39vh, 455px);
  padding: 18px 19px 36px;
  line-height: 1.8;
  border: 1px solid transparent;
  border-radius: inherit;
  background: transparent;
  color: var(--ink);
}
.create-page #script:focus { background: #fcfdfa; border-color: #aabfb0; }
.create-page .script-count { color: var(--muted); background: transparent; }
.create-page .generation-options { margin-block-start: 18px; align-items: flex-end; gap: 12px; }
.create-page .generation-options label, .create-page .style-control { flex: 0 1 auto; color: var(--muted); }
.create-page .generation-options select, .create-page .style-control button {
  min-block-size: 42px;
  padding-block: 7px;
  border-radius: 10px;
}
.create-page .style-control button { display: flex; margin-block-start: 5px; }
.create-page .generate-action { margin-inline-start: auto; }
.create-page .progress-panel {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px 13px;
  align-items: start;
  padding: 12px 0 16px;
}
.progress-panel > .section-header { margin: 0; }
.progress-panel .task-details { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; }
.progress-panel :is(.task-provider,.task-count) { font-size: .8125rem; font-weight: 500; }
.progress-panel .task-note, .progress-panel #poll-message, .progress-panel .timeline-section { grid-column: 1 / -1; }
.progress-panel .task-note { flex-basis: 100%; }
.progress-panel .timeline-section { margin-block: 0; padding: 0; border: 0; }
.progress-panel .provider { justify-content: flex-start; margin-block: 7px; }
.style-settings { inline-size: min(calc(100% - 28px), 815px); border-radius: 22px; }
.login-page { background: radial-gradient(ellipse at 50% 0, #e4ede3, transparent 70%), #f6f7f4; }
.login-panel { padding: clamp(23px, 5vw, 39px); border-radius: 23px; box-shadow: 0 24px 68px #253d2e0c; }
.login-panel h1 { margin-block: 16px 22px; font-size: 1.85rem; }
.login-panel #account-form > .button { width: 100%; margin-block: 4px; }
.login-panel input { min-height: 46px; border-radius: 10px; background: #f6f8f4; }
#auth-message:empty { display: none; }
.science-reader-open > .gallery-header-bar { display: none; }

@media (max-width: 900px) {
  .square-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .work-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .exhibition-hero { min-block-size: 325px; }
}
@media (max-width: 620px) {
  .gallery-workspace { padding-block-end: calc(68px + env(safe-area-inset-bottom)); }
  .gallery-header-bar { grid-template-columns: auto minmax(0, 1fr); min-block-size: 56px; gap: 10px; padding-inline: 20px; }
  .gallery-nav {
    position: fixed;
    z-index: 5;
    inset: auto 12px max(10px, env(safe-area-inset-bottom)) 12px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 3px;
    padding: 5px;
    border: 1px solid #dfe6dd;
    border-radius: 999px;
    background: #fcfdf9;
    box-shadow: 0 5px 21px #213b2927;
  }
  .gallery-nav a { min-inline-size: 0; padding-inline: 5px; }
  @supports (backdrop-filter: blur(16px)) {
    .gallery-nav { background: rgb(252 253 249 / 91%); backdrop-filter: blur(16px); }
  }
  .portal { padding-block-start: 22px; }
  .exhibition-hero { grid-template-columns: 1fr; min-block-size: 0; border-radius: 21px; }
  .exhibition-copy { padding: 28px 22px 24px; }
  .exhibition-copy p { margin-block: 12px 20px; }
  .exhibition-art { min-block-size: 0; aspect-ratio: 16 / 9; }
  .gallery-controls { gap: 8px; margin-block-start: 26px; }
  .gallery-controls h2 { flex-basis: 100%; }
  .square-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .square-caption { display: flex; flex-direction: column; padding-block: 7px 12px; }
  .square-use { font-size: .72rem; }
  .create-page #script { min-block-size: clamp(215px, 31vh, 300px); }
  .create-page .generation-options .option-field { flex: 1 1 calc(50% - 12px); min-inline-size: 0; }
  .create-page .generation-options select, .create-page .style-control button { width: 100%; }
  .create-page .generate-action { flex: 1 1 100%; margin-inline-start: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .gallery-nav a { transition: none; }
}

.progress-panel .task-count-row:has(.task-count:empty) { display: none; }
.creation-review .science-article { max-block-size: none; overflow: visible; border: 0; background: transparent; }
.creation-review .science-paragraph { padding-inline: 0; border-block-end: 1px solid var(--line); }
.creation-review .science-plan-card { border-inline-start-width: 1px; border-radius: 14px; margin-block-start: 14px; padding: clamp(9px, 2.5vw, 16px); }
.creation-review .science-article-direction > summary { font-size: .875rem; color: var(--accent-dark); }
.creation-review .science-article-direction textarea { margin-block-start: 8px; }
.sample-figure { display: grid; margin-block: 10px 19px; }
.sample-figure img { inline-size: 100%; max-block-size: clamp(240px, 60vh, 560px); border-radius: 14px; background: var(--soft); }
.sample-figure figcaption { padding-block: 4px; }
.reader-link { margin-block-end: 7px; }
