:root {
  --ink: #241610;
  --paper: #f3e6d4;
  --paper-deep: #e7d3b8;
  --enamel: #c41722;
  --enamel-dark: #7d1016;
  --brass: #ead7b8;
  --wall: #1a110f;
  --alert: #ffd7cc;
  color-scheme: dark;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--paper);
  font-family: Literata, Georgia, "Iowan Old Style", serif;
  background:
    radial-gradient(900px 480px at 50% -10%, rgba(255, 214, 170, 0.08), transparent 55%),
    linear-gradient(180deg, #3a2924 0%, var(--wall) 42%, #100c0b 100%);
}

body.page-home {
  background:
    radial-gradient(900px 420px at 50% -8%, rgba(255, 214, 170, 0.09), transparent 58%),
    linear-gradient(180deg, #3a2924 0%, #1a110f 320px, #100c0b 100%);
}

code {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.92em;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  width: min(960px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 0;
}

.brand {
  margin: 0;
  font-family: Staatliches, "Arial Narrow", Impact, sans-serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 1.35rem;
}

.logout-form { margin: 0; }

.logout-form button,
.close,
.download,
.danger,
.renew,
.primary {
  font-family: Staatliches, "Arial Narrow", Impact, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.logout-form button,
.close {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  font-size: 1rem;
  text-decoration: underline;
  text-underline-offset: 0.22em;
}

.hero {
  width: min(1100px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 56px;
  text-align: center;
}

.counter {
  margin: 8px 0 18px;
  font-family: Staatliches, "Arial Narrow", Impact, sans-serif;
  font-size: clamp(2rem, 6vw, 3.1rem);
  letter-spacing: 0.04em;
  line-height: 0.95;
}

.counter-small {
  font-size: 1.7rem;
  text-align: left;
}

.notice,
.alert {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: 6px;
  text-align: left;
}

.notice {
  background: rgba(243, 230, 212, 0.12);
  color: var(--paper);
}

.alert {
  background: #6e2430;
  color: var(--alert);
}

.cabinet {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  margin-inline: auto;
  padding: 22px 18px 20px;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), transparent 26%),
    linear-gradient(165deg, #e4373a 0%, var(--enamel) 38%, var(--enamel-dark) 100%);
  box-shadow:
    0 28px 50px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.screw {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6e8, #c3ae90 42%, #6a5644 74%);
  box-shadow: inset 0 -1px 1px rgba(0, 0, 0, 0.45);
}

.screw::after {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  top: 6px;
  height: 2px;
  background: rgba(50, 32, 22, 0.55);
  transform: rotate(28deg);
}

.screw-tl { top: 10px; left: 10px; }
.screw-tr { top: 10px; right: 10px; }
.screw-bl { bottom: 10px; left: 10px; }
.screw-br { bottom: 10px; right: 10px; }

.bezel {
  width: max-content;
  max-width: 100%;
  padding: 10px;
  border-radius: 6px;
  background: linear-gradient(180deg, #f4e7d2, var(--brass));
  box-shadow: inset 0 0 0 1px rgba(120, 84, 48, 0.35);
}

.glass {
  container-type: inline-size;
  position: relative;
  display: block;
  width: min(720px, calc(100vw - 96px), calc(70vh * var(--ratio, 0.8)));
  aspect-ratio: var(--ratio, 0.8);
  overflow: hidden;
  padding: 0;
  border: 0;
  border-radius: 2px;
  appearance: none;
  touch-action: manipulation;
  background: #211815;
  color: white;
  cursor: pointer;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.65),
    inset 0 0 30px rgba(255, 255, 255, 0.12);
}

.glass[data-state="empty"],
.glass[data-state="open"],
.glass[data-state="breaking"] { cursor: default; }

.glass.is-cracking {
  animation: glass-shake 0.48s ease;
}

.glass:focus-visible,
.primary:focus-visible,
.renew:focus-visible,
.shot:focus-visible,
.danger:focus-visible {
  outline: 3px solid #f6e7c8;
  outline-offset: 3px;
}

.tease {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: blur(12px) saturate(1.28) brightness(1.04);
  transform: none;
  transition: filter 0.7s ease 0.25s;
  pointer-events: none;
  user-select: none;
}

.glass.is-shattered .tease {
  filter: blur(0) saturate(1) brightness(1);
}

.frost {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.4), rgba(232, 238, 242, 0.2));
  transition: opacity 0.55s ease 0.22s;
}

.frost::before,
.frost::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.frost::before {
  opacity: 0.45;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.7'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  mix-blend-mode: multiply;
}

.frost::after {
  background: linear-gradient(115deg, transparent 28%, rgba(255, 255, 255, 0.55) 42%, transparent 52%);
}

.glass.is-shattered .frost { opacity: 0; }

.sign {
  position: relative;
  z-index: 1;
  max-width: 16em;
  padding: 0.75rem 0.7rem 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.38);
  background: rgba(92, 14, 18, 0.28);
  color: rgba(255, 255, 255, 0.95);
  font-family: Staatliches, "Arial Narrow", Impact, sans-serif;
  letter-spacing: 0.08em;
  line-height: 0.88;
  text-transform: uppercase;
  text-shadow: 0 2px 0 rgba(70, 10, 12, 0.25);
  user-select: none;
}

.sign span,
.sign strong {
  display: block;
  font-weight: 400;
}

.sign span { font-size: clamp(1.15rem, 7cqi, 1.7rem); }
.sign strong { margin-top: 0.28rem; font-size: clamp(2.15rem, 16cqi, 3.25rem); }

.cracks {
  position: absolute;
  z-index: 3;
  inset: 0;
  width: 100%;
  height: 100%;
}

.crack,
.crack-shadow {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.crack-shadow { stroke: rgba(20, 28, 34, 0.72); stroke-width: 1.15; }
.crack { stroke: rgba(255, 255, 255, 0.96); stroke-width: 0.55; }

.glass.is-shattered .cracks {
  opacity: 0;
  transition: opacity 0.35s ease 0.45s;
}

.shard-layer {
  position: absolute;
  z-index: 6;
  pointer-events: none;
  overflow: visible;
}

.shard {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.9), rgba(198, 214, 224, 0.62));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.75);
  animation: shard-fly 1.15s cubic-bezier(0.16, 0.72, 0.28, 1) forwards;
}

@keyframes glass-shake {
  0%, 100% { transform: translateX(0); }
  18% { transform: translate(-5px, 1px); }
  36% { transform: translate(5px, -1px); }
  54% { transform: translate(-3px, 1px); }
  72% { transform: translate(3px, 0); }
}

@keyframes shard-fly {
  0% { opacity: 1; transform: translate(0, 0) rotate(0deg); }
  28% { opacity: 1; }
  100% {
    opacity: 0;
    transform: translate(var(--dx), var(--dy)) rotate(var(--rot));
  }
}

.reveal,
.empty-note {
  width: 0;
  min-width: 100%;
  margin: 16px 0 0;
  color: #fff6ea;
  font-size: 1.08rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.renew {
  margin-top: 16px;
  border: 0;
  border-radius: 999px;
  padding: 0.7rem 1.2rem;
  background: var(--brass);
  color: var(--ink);
  font-size: 1.15rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.album {
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.35), transparent 90px),
    var(--paper);
  padding: 42px 16px 72px;
  box-shadow: 0 -18px 40px rgba(0, 0, 0, 0.18);
}

.album-inner { width: min(960px, 100%); margin: 0 auto; }

.album h2,
.panel h2,
.gate h1 {
  font-family: Staatliches, "Arial Narrow", Impact, sans-serif;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.album h2 { margin: 0 0 18px; font-size: 2.4rem; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.shot {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 252, 247, 0.72);
  color: inherit;
  text-align: left;
  cursor: zoom-in;
  box-shadow: 0 8px 18px rgba(70, 40, 20, 0.08);
}

.shot img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 4px;
  background: #d9c7b0;
}

.cap {
  margin: 0;
  white-space: pre-wrap;
  font-size: 0.98rem;
  line-height: 1.35;
}

.gallery-empty,
.muted { margin: 0; color: #6d5648; }

.page-gate {
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

.gate {
  width: min(440px, 100%);
}

.eyebrow {
  margin: 0 0 8px;
  font-family: Staatliches, "Arial Narrow", Impact, sans-serif;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.gate h1 { margin: 0; font-size: 3.2rem; line-height: 0.9; }

.lede { margin: 12px 0 20px; font-size: 1.12rem; }

.stack { display: grid; gap: 14px; }

label {
  display: grid;
  gap: 6px;
  font-size: 0.98rem;
}

input,
textarea {
  width: 100%;
  color-scheme: light;
  color: var(--ink);
  background: #fffaf4;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  padding: 0.75rem 0.8rem;
  font: inherit;
}

.page-admin input,
.page-admin textarea { border-color: #ddc8ae; }

.primary {
  border: 0;
  border-radius: 999px;
  padding: 0.8rem 1.1rem;
  background: var(--enamel);
  color: white;
  font-size: 1.2rem;
}

.text-link { color: var(--paper); }

.workspace {
  width: min(760px, calc(100% - 32px));
  margin: 0 auto;
  padding: 12px 0 64px;
}

.panel {
  margin-top: 18px;
  padding: 18px;
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
}

.panel h2 { margin: 0 0 12px; font-size: 2rem; }

.page-admin .alert,
.page-admin .notice { margin-top: 12px; }

.page-admin .notice {
  background: #efe2d0;
  color: var(--ink);
}

.manage-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.manage-item {
  display: grid;
  grid-template-columns: 84px 1fr auto;
  gap: 12px;
  align-items: center;
}

.manage-item img {
  width: 84px;
  height: 84px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--paper-deep);
}

.status {
  margin: 6px 0 0;
  color: #7a5b48;
  font-family: Staatliches, "Arial Narrow", Impact, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.danger {
  border: 0;
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
  background: transparent;
  color: var(--enamel-dark);
  font-size: 1rem;
}

dialog {
  width: min(920px, calc(100vw - 28px));
  padding: 12px;
  border: 0;
  border-radius: 12px;
  background: #1c1411;
  color: var(--paper);
}

dialog::backdrop { background: rgba(12, 8, 7, 0.78); }

dialog img {
  display: block;
  width: 100%;
  max-height: 72vh;
  object-fit: contain;
  background: #100c0b;
}

#lightboxText {
  margin: 12px 4px 6px;
  white-space: pre-wrap;
  font-size: 1.08rem;
}

.lightbox-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 8px;
}

.lightbox-bar form { margin: 0; }

.download {
  color: inherit;
  font-size: 1rem;
  text-decoration: underline;
  text-underline-offset: 0.22em;
}

@media (max-width: 640px) {
  .manage-item { grid-template-columns: 72px 1fr; }
  .manage-item form { grid-column: 2; }
}

