.image-bed-main,
.settings-main {
  display: grid;
  gap: clamp(0.8rem, 1.6vw, 1.2rem);
  grid-template-rows: auto minmax(0, 1fr);
  min-height: min(46rem, calc(100dvh - 8.2rem));
}

.image-bed-hero {
  align-items: end;
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1fr) auto;
}

.image-bed-kicker {
  color: var(--primary-2);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  margin: 0;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(2.6rem, 5.2vw, 4.8rem);
  letter-spacing: 0;
  line-height: 0.9;
  margin: 0;
}

.image-bed-mascot {
  aspect-ratio: 1;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  height: clamp(5rem, 8.5vw, 7.1rem);
  object-fit: contain;
  width: clamp(5rem, 10vw, 8rem);
}

.image-bed-console {
  align-items: stretch;
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  min-height: 0;
}

.image-upload-panel,
.image-gallery-panel,
.not-found-panel,
.settings-card,
.admin-locked-note {
  background: var(--panel);
  border: 1px solid rgb(44 41 35 / 13%);
  border-radius: 12px;
  box-shadow: var(--shadow);
  color: var(--ink);
  padding: clamp(1rem, 2vw, 1.25rem);
}

.image-upload-panel {
  align-content: start;
  display: grid;
  gap: 0.72rem;
}

.image-gallery-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
}

.image-drop-zone {
  align-items: center;
  background:
    linear-gradient(135deg, rgb(240 93 79 / 10%), transparent 42%),
    linear-gradient(180deg, #fffaf1, #f1e8d9);
  border: 1px dashed color-mix(in srgb, var(--primary) 52%, var(--line));
  border-radius: 12px;
  color: var(--ink);
  cursor: pointer;
  display: grid;
  gap: 0.7rem;
  justify-items: center;
  min-height: clamp(8.6rem, 19vh, 11.8rem);
  padding: 1rem;
  text-align: center;
}

.image-drop-zone:hover {
  border-color: var(--primary-2);
}

.image-drop-zone.is-dragging,
.image-drop-zone.has-files {
  background:
    linear-gradient(135deg, rgb(22 89 74 / 14%), transparent 44%),
    linear-gradient(180deg, #fff7e8, #eadcc8);
  border-color: var(--primary);
  box-shadow: inset 0 0 0 2px rgb(22 89 74 / 14%);
}

.image-drop-zone input {
  height: 1px;
  opacity: 0;
  overflow: hidden;
  position: absolute;
  width: 1px;
}

.drop-icon {
  align-items: center;
  background: #171716;
  border: 1px solid rgb(44 41 35 / 14%);
  border-radius: 50%;
  color: #ffe7b2;
  display: inline-flex;
  height: 4.3rem;
  justify-content: center;
  width: 4.3rem;
}

.drop-icon svg {
  height: 2.15rem;
  width: 2.15rem;
}

.selected-files {
  background: rgb(255 250 241 / 70%);
  border: 1px solid rgb(44 41 35 / 12%);
  border-radius: 10px;
  display: grid;
  gap: 0.45rem;
  padding: 0.65rem;
}

.selected-files[hidden] {
  display: none;
}

.selected-files strong {
  font-size: 0.86rem;
}

.selected-files ul {
  display: grid;
  gap: 0.35rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.selected-files li {
  align-items: center;
  display: grid;
  gap: 0.5rem;
  grid-template-columns: minmax(0, 1fr) auto;
}

.selected-files li span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-files small {
  color: var(--muted);
  font-size: 0.76rem;
}

.selected-files li.is-invalid span,
.selected-files li.is-invalid small {
  color: var(--danger);
}

.image-field {
  display: grid;
  gap: 0.35rem;
}

.image-field span {
  color: var(--muted);
}

.image-status {
  color: var(--muted);
  margin: 0;
  min-height: 1.25rem;
}

.image-field span {
  font-size: 0.84rem;
  font-weight: 820;
}

.image-field input,
.image-field select {
  background: #fffaf1;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  font: inherit;
  min-height: 2.65rem;
  padding: 0.56rem 0.72rem;
}

.image-status[data-image-status] {
  align-items: center;
  background: #171716;
  border: 2px solid rgb(255 250 241 / 92%);
  border-radius: 999px;
  bottom: calc(4rem + env(safe-area-inset-bottom));
  box-shadow: 5px 5px 0 rgb(23 23 22 / 26%);
  color: #fffaf1;
  display: flex;
  font-size: 0.9rem;
  font-weight: 820;
  gap: 0.45rem;
  left: auto;
  margin: 0;
  max-width: min(28rem, calc(100vw - 2rem));
  min-height: 0;
  opacity: 0;
  padding: 0.75rem 0.95rem;
  pointer-events: none;
  position: fixed;
  right: max(1.2rem, env(safe-area-inset-right));
  transform: translateY(0.55rem);
  transition: opacity 160ms ease, transform 160ms ease;
  z-index: 130;
}

body.is-consent-blocked .image-status[data-image-status] {
  display: none;
}

.image-status[data-image-status].is-visible {
  opacity: 1;
  transform: translateY(0);
}

.image-status[data-image-status].is-error {
  background: var(--danger);
  color: #fffaf1;
}

.upload-results {
  border-top: 1px solid rgb(44 41 35 / 11%);
  display: grid;
  gap: 0.6rem;
  padding-top: 0.75rem;
}

.upload-results[hidden],
.admin-dialog-backdrop[hidden],
.consent-dialog-backdrop[hidden],
[data-admin-private][hidden],
.admin-locked-note[hidden] {
  display: none;
}

.section-heading {
  align-items: center;
  border-bottom: 1px solid rgb(44 41 35 / 11%);
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.35rem;
  padding-bottom: 0.5rem;
}

.upload-results h2,
.section-heading h2,
.settings-card h2 {
  font-size: 1.08rem;
  line-height: 1.2;
  margin: 0;
}

.upload-dialog-backdrop {
  align-items: center;
  background: rgb(23 23 22 / 42%);
  display: grid;
  inset: 0;
  justify-items: center;
  padding: 1rem;
  position: fixed;
  z-index: 45;
}

.upload-dialog-backdrop[hidden] {
  display: none;
}

.upload-dialog {
  background: var(--panel-solid);
  border: 2px solid var(--ink);
  border-radius: 8px;
  box-shadow: 8px 8px 0 rgb(23 23 22 / 72%);
  display: grid;
  gap: 0.9rem;
  grid-template-columns: auto minmax(0, 1fr);
  max-height: min(78dvh, 42rem);
  overflow: auto;
  padding: 1rem;
  width: min(100%, 520px);
}

.upload-dialog h2,
.upload-dialog p {
  margin: 0;
}

.upload-dialog p {
  color: var(--muted);
}

.upload-dialog-icon {
  align-self: start;
  background: var(--ink);
  border-radius: 50%;
  height: 2.4rem;
  position: relative;
  width: 2.4rem;
}

.upload-dialog-icon::after {
  border: 3px solid rgb(255 231 178 / 35%);
  border-top-color: #ffe7b2;
  border-radius: 50%;
  content: "";
  inset: 0.45rem;
  position: absolute;
}

.upload-dialog-icon.is-spinning::after {
  animation: image-upload-spin 0.8s linear infinite;
}

.upload-dialog-backdrop[data-state="done"] .upload-dialog-icon::after {
  animation: none;
  border: 0;
  color: #ffe7b2;
  content: "✓";
  font-size: 1.35rem;
  font-weight: 900;
  inset: 0;
  line-height: 2.4rem;
  text-align: center;
}

.upload-dialog-backdrop[data-state="error"] .upload-dialog-icon {
  background: var(--danger);
}

.upload-dialog-backdrop[data-state="error"] .upload-dialog-icon::after {
  animation: none;
  border: 0;
  color: #fff;
  content: "!";
  font-size: 1.35rem;
  font-weight: 900;
  inset: 0;
  line-height: 2.4rem;
  text-align: center;
}

.upload-dialog-results {
  display: grid;
  gap: 0.55rem;
  grid-column: 1 / -1;
}

.upload-dialog-results[hidden] {
  display: none;
}

.upload-dialog > button {
  grid-column: 1 / -1;
  justify-self: end;
}

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

.image-gallery-grid {
  align-content: start;
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  min-height: 0;
  overflow: auto;
}

.image-gallery-grid-public {
  overflow: visible;
}

.gallery-more {
  display: flex;
  justify-content: center;
  margin-top: 1rem;
}

.gallery-more[hidden] {
  display: none;
}

.gallery-more-button {
  background: #171716;
  border: 2px solid #171716;
  border-radius: 999px;
  box-shadow: 4px 4px 0 rgb(23 23 22 / 24%);
  color: #fffaf1;
  cursor: pointer;
  font: inherit;
  font-weight: 850;
  padding: 0.68rem 1.1rem;
}

.gallery-more-button:hover {
  background: var(--primary);
  border-color: var(--primary);
}

.gallery-more-button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.empty {
  color: var(--muted);
  margin: 0;
}

.image-tile,
.upload-result,
.token-result,
.token-item,
.admin-image-item {
  background: #fffaf1;
  border: 1px solid rgb(44 41 35 / 11%);
  border-radius: 10px;
  display: grid;
  gap: 0.5rem;
  overflow: hidden;
  padding: 0.62rem;
}

.image-tile-preview,
.admin-image-thumb {
  aspect-ratio: 4 / 3;
  background: var(--panel-soft);
  border-radius: 8px;
  display: block;
  overflow: hidden;
}

.admin-image-thumb {
  aspect-ratio: 1;
}

.image-tile-preview img,
.admin-image-thumb img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.image-tile-body {
  display: grid;
  gap: 0.4rem;
}

.image-tile h3,
.image-tile p,
.settings-card p,
.token-result p,
.admin-image-item h3,
.admin-image-item p {
  margin: 0;
}

.image-tile h3,
.admin-image-item h3 {
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

.image-tile p,
.settings-card p,
.token-item span,
.admin-image-item p {
  color: var(--muted);
  font-size: 0.82rem;
}

.image-tile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.image-tile-actions button,
.token-item button {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 780;
  padding: 0.32rem 0.58rem;
}

.image-tile-actions button:hover,
.token-item button:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff7e8;
}

.upload-result code,
.token-result code,
.token-item code {
  color: var(--violet);
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.settings-main {
  max-width: 1080px;
  min-height: calc(100dvh - 8.2rem);
}

.settings-panel {
  display: grid;
  gap: 1rem;
}

.settings-heading {
  display: grid;
  gap: 0.3rem;
}

.settings-heading h1 {
  font-size: clamp(2.4rem, 5vw, 4.4rem);
}

.settings-card {
  display: grid;
  gap: 0.85rem;
}

.settings-row {
  align-items: center;
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1fr) auto;
}

.settings-switch {
  align-items: center;
  display: inline-flex;
  gap: 0.45rem;
  font-weight: 850;
  white-space: nowrap;
}

.settings-switch input {
  height: 1.1rem;
  width: 1.1rem;
}

.token-list,
.admin-image-list {
  display: grid;
  gap: 0.65rem;
}

.token-item {
  align-items: center;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 0.8rem 0.9rem;
}

.token-main {
  display: grid;
  gap: 0.22rem;
  min-width: 0;
}

.token-main code {
  color: var(--violet);
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.token-main span {
  color: var(--muted);
  font-size: 0.8rem;
}

.token-item .image-tile-actions {
  justify-content: flex-end;
}

.token-result {
  border-color: rgb(108 91 214 / 28%);
}

.token-result .image-tile-actions {
  justify-content: flex-start;
}

.admin-locked-note {
  border-style: dashed;
  color: var(--muted);
}

.admin-image-item {
  align-items: center;
  grid-template-columns: 4.5rem minmax(0, 1fr) auto;
}

.admin-dialog-backdrop {
  align-items: center;
  background: rgb(23 23 22 / 42%);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 1rem;
  position: fixed;
  z-index: 30;
}

.consent-dialog-backdrop {
  align-items: end;
  background:
    linear-gradient(90deg, rgb(44 41 35 / 7%) 1px, transparent 1px),
    linear-gradient(rgb(44 41 35 / 7%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(240 93 79 / 10%) 0 2px, transparent 2px 100%),
    rgb(247 241 230 / 54%);
  background-size: 28px 28px, 28px 28px, 100% 100%;
  backdrop-filter: blur(2px);
  display: grid;
  inset: 0;
  justify-items: center;
  padding: 0.95rem clamp(1rem, 4vw, 2rem);
  pointer-events: auto;
  position: fixed;
  z-index: 40;
}

.admin-dialog,
.consent-dialog {
  background: var(--panel-solid);
  border: 2px solid rgb(44 41 35 / 18%);
  border-radius: 12px;
  box-shadow: 0 24px 70px rgb(28 22 14 / 24%);
  display: grid;
  gap: 0.85rem;
  padding: 1.05rem;
  width: min(100%, 420px);
}

.consent-dialog {
  align-items: start;
  border: 2px solid var(--ink);
  border-radius: 3px;
  box-shadow: 10px 10px 0 rgb(23 23 22 / 78%);
  gap: 0.8rem clamp(1rem, 2.2vw, 1.8rem);
  grid-template-columns: minmax(8rem, 0.7fr) minmax(20rem, 1.55fr) minmax(26rem, 1.45fr);
  padding: 1rem 1.15rem;
  pointer-events: auto;
  width: min(calc(100vw - 3rem), 1260px);
}

.admin-dialog h2,
.admin-dialog p,
.consent-dialog h2,
.consent-dialog p {
  margin: 0;
}

.admin-dialog p,
.consent-dialog p {
  color: var(--muted);
  font-size: 0.92rem;
}

.consent-title h2 {
  font-size: 1.05rem;
  font-weight: 900;
}

.consent-copy {
  line-height: 1.42;
}

.consent-options {
  display: grid;
  gap: 0.45rem 0.8rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-width: 0;
}

.consent-options label {
  align-items: center;
  color: var(--ink);
  display: inline-flex;
  font-size: 0.98rem;
  font-weight: 780;
  gap: 0.45rem;
  min-height: 1.8rem;
}

.consent-options input {
  accent-color: var(--primary);
  height: 0.95rem;
  width: 0.95rem;
}

.consent-actions {
  align-items: center;
  display: flex;
  flex-wrap: nowrap;
  gap: 0.5rem;
  grid-column: 3;
  justify-content: flex-end;
  min-width: 0;
}

.consent-actions button,
.admin-dialog-actions button {
  min-height: 2.35rem;
}

.consent-actions button {
  background: #1768c9;
  border: 2px solid #0b1720;
  border-radius: 4px;
  box-shadow: 2px 2px 0 rgb(23 23 22 / 78%);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 850;
  padding: 0.45rem 0.75rem;
  white-space: nowrap;
}

.consent-actions button:hover {
  transform: translate(-1px, -1px);
}

.consent-actions button[data-consent-necessary] {
  background: var(--ink);
}

.consent-actions button[data-consent-close] {
  background: var(--panel-solid);
  color: var(--ink);
}

.admin-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: end;
}

@media (max-width: 820px) {
  .image-bed-main,
  .image-bed-console,
  .image-bed-hero,
  .settings-row,
  .token-item,
  .admin-image-item {
    grid-template-columns: 1fr;
  }

  .image-bed-mascot {
    grid-row: 1;
  }

  .image-bed-main,
  .settings-main {
    min-height: 0;
  }

  .consent-actions {
    grid-column: auto;
    justify-content: flex-start;
  }

  .consent-options {
    grid-template-columns: 1fr;
  }

  .consent-dialog {
    grid-template-columns: 1fr;
    max-height: calc(100dvh - 2rem);
    overflow: auto;
    width: min(calc(100vw - 1.2rem), 38rem);
  }
}

@media (min-width: 821px) and (max-width: 1120px) {
  .consent-dialog {
    grid-template-columns: minmax(7rem, 0.7fr) minmax(18rem, 1fr);
  }

  .consent-options,
  .consent-actions {
    grid-column: 2;
  }

  .consent-actions {
    justify-content: flex-start;
  }

  .token-item .image-tile-actions {
    justify-content: flex-start;
  }
}

/* Public image-bed surfaces */
.image-home-main,
.upload-main {
  display: grid;
  gap: clamp(1rem, 2vw, 1.4rem);
  max-width: 1440px;
}

.image-home-hero,
.upload-hero {
  align-items: center;
  border-bottom: 2px solid rgb(23 23 22 / 12%);
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1fr) auto;
  padding-bottom: clamp(0.8rem, 2vw, 1.2rem);
}

.image-public-shell,
.upload-shell {
  background:
    linear-gradient(180deg, rgb(255 252 246 / 92%), rgb(255 250 241 / 80%)),
    radial-gradient(circle at 88% 0%, rgb(224 167 47 / 13%), transparent 22rem);
  border: 2px solid rgb(23 23 22 / 80%);
  border-radius: 8px;
  box-shadow: 8px 8px 0 rgb(23 23 22 / 28%);
  display: grid;
  gap: 1rem;
  padding: clamp(1rem, 2vw, 1.25rem);
}

.image-public-shell {
  gap: 0.55rem;
  min-height: clamp(16rem, 42vh, 28rem);
}

.upload-shell {
  align-items: start;
  justify-content: center;
  grid-template-columns: minmax(18rem, 34rem);
}

.image-gallery-grid-public {
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}

.image-tile {
  background: #fffaf1;
  border: 2px solid rgb(23 23 22 / 14%);
  border-radius: 8px;
  box-shadow: 4px 4px 0 rgb(23 23 22 / 10%);
  padding: 0;
}

.image-tile-preview {
  border-radius: 6px 6px 0 0;
}

.image-tile-body {
  padding: 0.72rem;
}

.image-tile h3 {
  font-size: 1rem;
  line-height: 1.28;
}

@media (max-width: 920px) {
  .image-home-hero,
  .upload-hero,
  .upload-shell {
    grid-template-columns: 1fr;
  }

  .image-bed-mascot {
    grid-row: 1;
  }
}

.content-page-main {
  max-width: 920px;
}

.content-page {
  background: var(--panel);
  border: 2px solid rgb(23 23 22 / 78%);
  border-radius: 8px;
  box-shadow: 8px 8px 0 rgb(23 23 22 / 24%);
  display: grid;
  gap: 1rem;
  padding: clamp(1.1rem, 3vw, 1.8rem);
}

.content-page header {
  border-bottom: 2px solid rgb(23 23 22 / 12%);
  padding-bottom: 0.8rem;
}

.content-page-body {
  color: var(--ink);
  display: grid;
  gap: 0.8rem;
}

.content-page-body p,
.content-page-body ul {
  margin: 0;
}
