@font-face {
  font-family: "IdVaultSilkscreen";
  src: url("assets/fonts/Silkscreen-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IdVaultPixelify";
  src: url("assets/fonts/PixelifySans-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IdVaultPixelify";
  src: url("assets/fonts/PixelifySans-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IdVaultPixelify";
  src: url("assets/fonts/PixelifySans-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --amber: #f1a544;
  --red: #d94325;
  --steel: #7f9296;
  --panel: rgba(12, 10, 8, 0.78);
  --panel-solid: #14110d;
  --edge: #6b4a2e;
  --text: #f6f0df;
  --muted: #b8a58b;
  --pixel-font: "IdVaultPixelify", "Fixedsys Excelsior", "Perfect DOS VGA 437", "PxPlus IBM VGA8", "Small Fonts", "Terminal", "MS Gothic", "Lucida Console", monospace;
  --display-font: "IdVaultSilkscreen", "IdVaultPixelify", "Lucida Console", monospace;
  --pixel-shadow:
    1px 0 0 #000,
    0 1px 0 #000,
    2px 0 0 #000,
    0 2px 0 #000,
    2px 2px 0 #000,
    3px 3px 0 rgba(0, 0, 0, 0.9);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  overflow-x: hidden;
  background:
    linear-gradient(rgba(5, 4, 3, 0.2), rgba(5, 4, 3, 0.62)),
    url("assets/id-wall.png") center / cover fixed;
  color: var(--text);
  font-family: var(--pixel-font);
  font-smooth: never;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: geometricPrecision;
  image-rendering: pixelated;
}

button,
textarea,
input {
  font: inherit;
}

button,
.brand,
h1,
h2,
h3,
.eyebrow,
.status-chip,
.caption-input,
.typed-caption,
.empty-state {
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: 900;
}

.scanlines {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.04) 0,
    rgba(255, 255, 255, 0.04) 1px,
    transparent 1px,
    transparent 4px
  );
  mix-blend-mode: overlay;
}

.vault-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 18px;
  width: min(1500px, calc(100% - 28px));
  min-height: calc(100vh - 28px);
  margin: 14px auto;
}

.section-rail,
.vault-stage {
  border: 2px solid #21150d;
  outline: 2px solid rgba(226, 139, 48, 0.34);
  background: rgba(12, 10, 8, 0.58);
  box-shadow:
    0 0 0 4px rgba(0, 0, 0, 0.38),
    0 18px 45px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(1px);
}

.section-rail {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 14px;
}

.brand {
  padding-bottom: 12px;
  border-bottom: 2px solid rgba(241, 165, 68, 0.35);
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 32px;
  margin-bottom: 8px;
  border: 2px solid var(--amber);
  color: #111;
  background: var(--amber);
  font-weight: 900;
  letter-spacing: 0;
  box-shadow: 4px 4px 0 #38180f;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 19px;
  line-height: 1.05;
  color: #fff;
  text-shadow: none;
}

.section-list {
  display: grid;
  gap: 10px;
}

.section-entry {
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
  position: relative;
}

body.admin-mode .section-entry {
  grid-template-columns: minmax(0, 1fr) 30px;
  align-items: stretch;
}

.section-button {
  display: grid;
  grid-template-columns: 16px 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 9px 10px;
  border: 2px solid rgba(151, 112, 74, 0.82);
  color: var(--text);
  background: rgba(0, 0, 0, 0.42);
  text-align: left;
  cursor: pointer;
  text-shadow: none;
}

.section-button:hover,
.section-button.active,
.section-entry.drag-over .section-button,
.section-button.drag-over {
  border-color: var(--amber);
  background: rgba(70, 40, 18, 0.82);
}

.section-entry.drag-over .section-button {
  color: #fff;
  background: rgba(130, 70, 24, 0.92);
  box-shadow:
    inset 0 0 0 2px rgba(255, 218, 125, 0.34),
    0 0 0 3px rgba(241, 165, 68, 0.58),
    0 0 24px rgba(241, 165, 68, 0.82);
}

.section-button.active {
  box-shadow: inset 4px 0 0 var(--red);
}

.section-entry.active .section-button {
  box-shadow: inset 4px 0 0 var(--red);
}

.section-controls {
  display: none;
  grid-template-rows: 1fr 1fr;
  gap: 4px;
}

body.admin-mode .section-controls.admin-only {
  display: grid !important;
}

.section-move {
  min-height: 0;
  border: 2px solid rgba(241, 165, 68, 0.56);
  color: #fff;
  background: rgba(0, 0, 0, 0.64);
  cursor: pointer;
  font-size: 10px;
  line-height: 1;
}

.section-move:hover {
  color: #111;
  background: var(--amber);
}

.section-dot {
  width: 10px;
  height: 10px;
  background: var(--red);
  box-shadow: 0 0 8px var(--red);
}

.section-name {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 11px;
}

.section-total {
  color: var(--amber);
  font-size: 11px;
}

.admin-button {
  min-height: 42px;
  border: 2px solid rgba(127, 146, 150, 0.8);
  color: #fff;
  background: rgba(4, 11, 13, 0.82);
  cursor: pointer;
  text-shadow: none;
}

.admin-button.is-admin {
  border-color: var(--amber);
  color: #111;
  background: var(--amber);
  box-shadow: 4px 4px 0 #331306;
}

.logout-button {
  min-height: 38px;
  border: 2px solid rgba(158, 23, 16, 0.9);
  color: #fff;
  background: rgba(80, 12, 8, 0.78);
  cursor: pointer;
}

.section-create {
  display: grid;
  grid-template-columns: 1fr 42px;
  gap: 6px;
  padding-top: 4px;
}

.section-create input,
.section-create button {
  min-height: 36px;
  border: 2px solid rgba(241, 165, 68, 0.66);
  color: #fff;
  background: rgba(0, 0, 0, 0.64);
  font-size: 11px;
}

.section-create input {
  min-width: 0;
  padding: 0 8px;
}

.section-create button {
  color: #111;
  background: var(--amber);
  cursor: pointer;
}

.paste-button {
  min-height: 42px;
  border: 2px solid rgba(241, 165, 68, 0.82);
  color: #111;
  background: var(--amber);
  cursor: pointer;
}

.admin-login {
  display: grid;
  grid-template-columns: 1fr 44px;
  gap: 6px;
}

.admin-login[hidden] {
  display: none;
}

.admin-login input,
.admin-login button {
  min-height: 36px;
  border: 2px solid rgba(241, 165, 68, 0.72);
  color: #fff;
  background: rgba(0, 0, 0, 0.72);
  font-size: 11px;
  text-shadow: var(--pixel-shadow);
}

.admin-login input {
  min-width: 0;
  padding: 0 8px;
}

.admin-login button {
  cursor: pointer;
}

.admin-login.denied {
  animation: access-denied 160ms steps(2) 2;
}

.admin-only {
  display: none !important;
}

body.admin-mode .admin-only {
  display: grid !important;
}

body.admin-mode .caption-input.admin-only,
body.admin-mode .caption-edit.admin-only {
  display: block !important;
}

body.admin-mode .delete-button.admin-only {
  display: block !important;
}

.upload-pad {
  display: grid;
  place-items: center;
  gap: 4px;
  min-height: 104px;
  margin-top: auto;
  border: 2px dashed rgba(241, 165, 68, 0.8);
  color: var(--text);
  background: rgba(0, 0, 0, 0.36);
  cursor: pointer;
}

.upload-pad.drag-over {
  border-color: #fff;
  background: rgba(217, 67, 37, 0.42);
}

.upload-pad span {
  font-size: 13px;
}

.upload-pad small,
.save-note,
.eyebrow,
.status-chip small,
.empty-state span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.save-note {
  padding-top: 10px;
  border-top: 2px solid rgba(241, 165, 68, 0.22);
}

.vault-stage {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
}

.stage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-bottom: 2px solid rgba(241, 165, 68, 0.32);
  background: rgba(0, 0, 0, 0.16);
}

.eyebrow {
  margin-bottom: 7px;
  color: var(--amber);
}

h2 {
  font-size: clamp(24px, 3vw, 38px);
  line-height: 0.95;
  color: #fff;
  text-shadow: none;
}

.status-chip {
  display: grid;
  place-items: center;
  min-width: 78px;
  min-height: 58px;
  border: 2px solid var(--steel);
  background: rgba(0, 0, 0, 0.45);
}

.status-chip span {
  color: var(--amber);
  font-size: 24px;
  line-height: 1;
}

.drop-zone {
  position: relative;
  min-height: 460px;
  padding: 18px;
  background: rgba(0, 0, 0, 0.08);
}

.drop-zone.drag-over {
  background: rgba(94, 55, 21, 0.22);
  box-shadow: inset 0 0 0 4px rgba(241, 165, 68, 0.5);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 220px));
  gap: 20px;
  align-items: start;
}

.vault-card {
  border: 2px solid #0c0805;
  background: #070503;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.06),
    7px 7px 0 rgba(0, 0, 0, 0.68);
  cursor: pointer;
  transform: translateZ(0);
  transition: transform 120ms steps(2), box-shadow 120ms steps(2), border-color 120ms steps(2);
}

.vault-card:hover {
  border-color: var(--amber);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.08),
    9px 9px 0 rgba(0, 0, 0, 0.78);
  transform: translate(-2px, -2px);
}

body.admin-mode .vault-card {
  cursor: grab;
}

.vault-card.dragging {
  opacity: 0.5;
}

.card-image-shell {
  position: relative;
  aspect-ratio: 4 / 3;
  border-bottom: 2px solid #0c0805;
  background: #050403;
}

.card-image-shell img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: auto;
}

.delete-button {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border: 2px solid #220b06;
  color: #fff;
  background: rgba(158, 23, 16, 0.9);
  cursor: pointer;
}

.caption-input {
  display: block;
  width: 100%;
  min-height: 56px;
  resize: vertical;
  border: 0;
  border-top: 2px solid rgba(241, 165, 68, 0.24);
  color: #fff;
  background: rgba(0, 0, 0, 0.58);
  padding: 10px;
  font-size: 11px;
  line-height: 1.45;
  text-transform: none;
  font-weight: 700;
}

.caption-input:focus {
  outline: 2px solid var(--amber);
  outline-offset: -2px;
}

.caption-edit {
  width: 100%;
  min-height: 38px;
  border: 0;
  border-top: 2px solid rgba(241, 165, 68, 0.24);
  color: #fff;
  background: rgba(0, 0, 0, 0.58);
  padding: 10px;
  font-size: 11px;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-state {
  position: absolute;
  inset: 18px;
  display: grid;
  place-content: center;
  gap: 10px;
  border: 2px dashed rgba(241, 165, 68, 0.42);
  color: #fff;
  text-align: center;
  pointer-events: none;
}

.empty-state strong {
  color: var(--amber);
  font-size: 17px;
  text-shadow: none;
}

.empty-state.hidden {
  display: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.lore-overlay,
.image-overlay,
.caption-overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at 50% 35%, rgba(241, 165, 68, 0.16), transparent 36%),
    rgba(0, 0, 0, 0.72);
  perspective: 900px;
}

.image-overlay {
  padding: 54px;
  overflow: hidden;
  align-items: center;
  justify-items: center;
}

.lore-overlay[hidden],
.image-overlay[hidden],
.caption-overlay[hidden] {
  display: none;
}

.lore-panel {
  --tilt-x: 4deg;
  --tilt-y: -5deg;
  --tilt-z: 0.5deg;
  --panel-scale: 1;
  width: min(1080px, 95vw);
  border: 3px solid #6b4a2e;
  background: #1d140d;
  overflow: hidden;
  transform: rotateX(var(--tilt-x)) rotateY(var(--tilt-y)) rotateZ(var(--tilt-z)) scale(var(--panel-scale));
  transform-origin: 50% 65%;
  box-shadow:
    0 0 0 4px rgba(0, 0, 0, 0.7),
    0 22px 44px rgba(0, 0, 0, 0.72);
  animation: panel-pop 520ms cubic-bezier(0.16, 1, 0.3, 1);
  transition: transform 140ms cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform, opacity;
}

.lore-screen {
  position: relative;
  display: grid;
  grid-template-columns: minmax(360px, 1.15fr) minmax(260px, 0.85fr);
  grid-template-areas:
    "meta meta"
    "title title"
    "image text";
  gap: 16px 24px;
  min-height: min(720px, 84vh);
  max-height: 84vh;
  padding: 26px;
  border: 2px solid rgba(241, 165, 68, 0.5);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.1), transparent 20%),
    repeating-linear-gradient(to bottom, rgba(255, 255, 255, 0.04) 0, rgba(255, 255, 255, 0.04) 2px, transparent 2px, transparent 6px),
    #080604;
}

.lore-screen .eyebrow {
  grid-area: meta;
}

.lore-image-shell {
  grid-area: image;
  width: 100%;
  min-height: min(480px, 58vh);
  aspect-ratio: 4 / 3;
  margin: 0;
  border: 3px solid #0b0704;
  background: #020201;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.08),
    7px 7px 0 rgba(0, 0, 0, 0.7);
  transform: rotateZ(-1.5deg);
}

.lore-image-shell img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: auto;
}

.lore-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border: 2px solid #240a04;
  color: #fff;
  background: #9e1710;
  cursor: pointer;
}

h3 {
  grid-area: title;
  margin: 8px 42px 22px 0;
  color: #fff;
  font-size: clamp(20px, 5vw, 34px);
  line-height: 1.05;
  text-shadow: none;
}

.pixel-render {
  --px: 3px;
  --gap: 0px;
  display: inline-flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: calc(var(--px) * 1.4);
  max-width: 100%;
  vertical-align: middle;
  filter:
    drop-shadow(calc(var(--px) * -0.7) calc(var(--px) * 0.45) 0 #2dd6ff)
    drop-shadow(calc(var(--px) * 0.7) calc(var(--px) * -0.45) 0 #ff4b35)
    drop-shadow(calc(var(--px) * 0.9) calc(var(--px) * 0.9) 0 #050505);
}

h1.pixel-text,
h2.pixel-text,
h3.pixel-text,
.section-name.pixel-text,
.admin-button.pixel-text,
.upload-pad span.pixel-text,
.empty-state strong.pixel-text {
  display: inline-block;
  color: #fff;
  font-family: var(--display-font);
  font-weight: 400;
  letter-spacing: 1px;
  line-height: 1.05;
  text-shadow: none;
}

.pixel-small {
  font-size: 10px;
}

.pixel-medium {
  font-size: clamp(14px, 1.8vw, 20px);
}

.pixel-large {
  font-size: clamp(22px, 2.7vw, 36px);
}

.pixel-render.small {
  --px: 2px;
}

.pixel-render.medium {
  --px: 3px;
}

.pixel-render.large {
  --px: 4px;
}

.pixel-word {
  display: inline-flex;
  gap: calc(var(--px) * 1.15);
  margin-right: calc(var(--px) * 2);
}

.pixel-letter {
  display: grid;
  grid-template-columns: repeat(5, var(--px));
  grid-template-rows: repeat(7, var(--px));
  gap: var(--gap);
}

.pixel-letter.wide {
  grid-template-columns: repeat(6, var(--px));
}

.pixel-bit {
  width: var(--px);
  height: var(--px);
}

.pixel-bit.on {
  background: #fff;
}

.section-button .pixel-render {
  --px: 2px;
}

.admin-button .pixel-render,
.upload-pad .pixel-render,
.empty-state .pixel-render {
  --px: 3px;
  justify-content: center;
}

h1 .pixel-render {
  --px: 3px;
}

h2 .pixel-render {
  --px: clamp(3px, 0.45vw, 5px);
}

h3 .pixel-render {
  --px: clamp(3px, 0.6vw, 5px);
}

.typed-caption {
  grid-area: text;
  min-height: 120px;
  max-width: 100%;
  max-height: min(430px, 52vh);
  overflow: auto;
  overflow-wrap: anywhere;
  word-break: break-word;
  align-self: start;
  color: #fff;
  font-size: clamp(13px, 2.4vw, 18px);
  line-height: 1.7;
  text-shadow: var(--pixel-shadow);
  white-space: pre-wrap;
}

.typed-caption::after {
  content: "";
  display: inline-block;
  width: 10px;
  height: 1em;
  margin-left: 5px;
  background: var(--amber);
  vertical-align: -0.15em;
  animation: cursor-blink 700ms steps(1) infinite;
}

@keyframes cursor-blink {
  50% {
    opacity: 0;
  }
}

@keyframes panel-pop {
  from {
    opacity: 0;
    transform: rotateX(22deg) rotateY(-26deg) rotateZ(3deg) translate3d(0, 34px, -120px) scale(0.88);
  }

  62% {
    opacity: 1;
    transform: rotateX(4deg) rotateY(-7deg) rotateZ(0.4deg) translate3d(0, -5px, 18px) scale(1.02);
  }

  to {
    opacity: 1;
    transform: rotateX(var(--tilt-x)) rotateY(var(--tilt-y)) rotateZ(var(--tilt-z)) scale(var(--panel-scale));
  }
}

@keyframes access-denied {
  50% {
    transform: translateX(5px);
    filter: saturate(2);
  }
}

@media (max-width: 760px) {
  body {
    background-attachment: scroll;
  }

  .vault-shell {
    grid-template-columns: 1fr;
    width: min(100% - 18px, 640px);
    margin: 9px auto;
  }

  .section-rail {
    position: sticky;
    top: 0;
    z-index: 3;
  }

  .section-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .upload-pad {
    min-height: 70px;
  }

  .stage-header {
    align-items: flex-start;
  }

  .gallery-grid {
    grid-template-columns: 1fr;
  }

  .lore-screen {
    grid-template-columns: 1fr;
    grid-template-areas:
      "meta"
      "title"
      "image"
      "text";
  }

  .lore-image-shell {
    min-height: min(360px, 48vh);
  }
}

.image-panel {
  --tilt-x: 0deg;
  --tilt-y: 0deg;
  --tilt-z: 0deg;
  --panel-scale: 1;
  --viewer-width: min(760px, calc(100vw - 132px));
  --viewer-height: min(520px, calc(100vh - 132px));
  position: relative;
  display: grid;
  place-items: center;
  width: min(var(--viewer-width), calc(100vw - 96px));
  height: min(var(--viewer-height), calc(100vh - 96px));
  max-width: calc(100vw - 96px);
  max-height: calc(100vh - 96px);
  overflow: hidden;
  padding: 14px;
  border: 3px solid #6b4a2e;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.1), transparent 18%),
    rgba(8, 6, 4, 0.94);
  box-shadow:
    0 0 0 4px rgba(99, 59, 28, 0.72),
    0 22px 44px rgba(0, 0, 0, 0.72);
  transform: rotateX(var(--tilt-x)) rotateY(var(--tilt-y)) rotateZ(var(--tilt-z)) scale(var(--panel-scale));
  transform-origin: 50% 58%;
  transition: transform 140ms cubic-bezier(0.16, 1, 0.3, 1);
  animation: image-pop 420ms cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform, opacity;
}

.image-panel img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #020201;
  border: 2px solid #0b0704;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.08),
    0 0 24px rgba(0, 0, 0, 0.72);
}

.image-close {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 1;
  width: 34px;
  height: 34px;
  border: 2px solid #240a04;
  color: #fff;
  background: #9e1710;
  cursor: pointer;
}

@keyframes image-pop {
  from {
    opacity: 0;
    transform: rotateX(5deg) rotateY(-6deg) rotateZ(0.5deg) translate3d(0, 16px, -60px) scale(0.94);
  }

  70% {
    opacity: 1;
    transform: rotateX(0.4deg) rotateY(-0.7deg) rotateZ(0deg) translate3d(0, -2px, 8px) scale(1.006);
  }
}

.caption-panel {
  position: relative;
  width: min(880px, calc(100vw - 72px));
  max-height: calc(100vh - 72px);
  overflow: hidden;
  padding: 24px;
  border: 3px solid #090604;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.09), transparent 18%),
    repeating-linear-gradient(to bottom, rgba(255, 255, 255, 0.035) 0, rgba(255, 255, 255, 0.035) 2px, transparent 2px, transparent 6px),
    rgba(8, 6, 4, 0.96);
  box-shadow:
    12px 12px 0 #000,
    22px 24px 0 rgba(82, 35, 15, 0.72),
    -5px -5px 0 rgba(241, 165, 68, 0.42);
  animation: image-pop 360ms cubic-bezier(0.16, 1, 0.3, 1);
}

.caption-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border: 2px solid #240a04;
  color: #fff;
  background: #9e1710;
  cursor: pointer;
}

.caption-editor-layout {
  display: grid;
  grid-template-columns: minmax(240px, 0.8fr) minmax(280px, 1fr);
  gap: 18px;
  align-items: stretch;
}

.caption-editor-layout img {
  display: block;
  width: 100%;
  max-height: min(420px, 56vh);
  object-fit: contain;
  border: 3px solid #0b0704;
  background: #020201;
}

.caption-form {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 12px;
  min-height: min(420px, 56vh);
}

.caption-form textarea {
  width: 100%;
  min-height: 220px;
  resize: none;
  overflow: auto;
  border: 2px solid rgba(241, 165, 68, 0.55);
  color: #fff;
  background: rgba(0, 0, 0, 0.62);
  padding: 12px;
  font: inherit;
  line-height: 1.45;
}

.caption-form button {
  min-height: 42px;
  border: 2px solid var(--amber);
  color: #111;
  background: var(--amber);
  cursor: pointer;
}

@media (max-width: 760px) {
  .caption-editor-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-height: 760px) {
  .image-panel {
    --viewer-width: min(720px, calc(100vw - 112px));
    --viewer-height: min(460px, calc(100vh - 112px));
    max-height: calc(100vh - 78px);
  }
}

@media (max-width: 760px) {
  .image-overlay {
    padding: 30px;
  }

  .image-panel {
    --viewer-width: calc(100vw - 60px);
    --viewer-height: calc(100vh - 72px);
  }
}
