:root {
  color-scheme: light;
  --ink: #36454f;
  --muted: #708090;
  --line: #d3d3d3;
  --paper: #ffffff;
  --wash: #f6f7f5;
  --sage: #6d8473;
  --sage-dark: #43584b;
  --danger: #9b3f35;
  --shadow: 0 22px 70px rgba(54, 69, 79, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--wash);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: "Source Sans 3", "DejaVu Sans", sans-serif;
  background:
    linear-gradient(90deg, rgba(211, 211, 211, 0.22) 1px, transparent 1px),
    linear-gradient(180deg, rgba(211, 211, 211, 0.18) 1px, transparent 1px),
    var(--wash);
  background-size: 64px 64px;
}

button,
input {
  font: inherit;
}

.locked-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.unlock-panel {
  width: min(440px, 100%);
  padding: 34px;
  border: 1px solid rgba(54, 69, 79, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.kicker {
  margin: 0 0 8px;
  color: var(--sage-dark);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: "Libre Baskerville", "DejaVu Serif", serif;
  font-size: clamp(34px, 6vw, 58px);
  line-height: 1;
  letter-spacing: 0;
}

.unlock-form {
  display: grid;
  gap: 10px;
  margin-top: 34px;
}

.unlock-form label {
  color: var(--muted);
  font-weight: 700;
}

.unlock-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.unlock-row input {
  min-width: 0;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: var(--paper);
}

.unlock-row input:focus {
  border-color: var(--sage);
  outline: 3px solid rgba(109, 132, 115, 0.18);
}

.unlock-row button,
.focus-close {
  height: 46px;
  padding: 0 18px;
  border: 1px solid var(--sage-dark);
  border-radius: 6px;
  color: #fff;
  background: var(--sage-dark);
  cursor: pointer;
}

.unlock-row button:disabled {
  opacity: 0.55;
  cursor: progress;
}

.form-error,
.upload-status {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
  font-size: 14px;
}

.gallery-shell {
  min-height: 100vh;
  padding: 26px clamp(16px, 3vw, 38px) 48px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  padding: 0 0 24px;
  background: linear-gradient(180deg, var(--wash) 76%, rgba(246, 247, 245, 0));
}

.topbar h1 {
  font-size: clamp(30px, 5vw, 52px);
}

.upload-cluster {
  position: relative;
}

.plus-button {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(54, 69, 79, 0.2);
  border-radius: 50%;
  color: var(--paper);
  font-size: 30px;
  line-height: 1;
  background: var(--ink);
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(54, 69, 79, 0.18);
}

.upload-tray {
  position: absolute;
  top: 52px;
  right: 0;
  width: min(310px, calc(100vw - 32px));
  padding: 14px;
  border: 1px solid rgba(54, 69, 79, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.drop-zone {
  display: grid;
  place-items: center;
  min-height: 112px;
  border: 1px dashed rgba(112, 128, 144, 0.55);
  border-radius: 6px;
  color: var(--muted);
  background: #fbfbfa;
  cursor: pointer;
}

.drop-zone strong {
  color: var(--ink);
  font-size: 17px;
}

.drop-zone.is-over {
  border-color: var(--sage);
  background: rgba(109, 132, 115, 0.09);
}

.picker-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

.picker-row label {
  position: relative;
  display: grid;
  place-items: center;
  height: 38px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  font-weight: 700;
  background: var(--paper);
  cursor: pointer;
}

.picker-row input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-status {
  margin-top: 10px;
}

.gallery-wrap {
  position: relative;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(188px, 1fr));
  grid-auto-rows: 8px;
  grid-auto-flow: dense;
  gap: 14px;
}

.tile {
  grid-row: span var(--span);
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  background: #e6e8e4;
  box-shadow: 0 1px 0 rgba(54, 69, 79, 0.08);
  cursor: zoom-in;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    opacity 180ms ease;
}

.tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 40px rgba(54, 69, 79, 0.16);
}

.tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tile-ghost {
  opacity: 0.28;
}

.tile-chosen {
  box-shadow: 0 18px 50px rgba(54, 69, 79, 0.22);
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 48vh;
  color: var(--muted);
  font-size: 17px;
}

.focus-view {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 64px 22px 24px;
  background: rgba(246, 247, 245, 0.96);
}

.focus-view img {
  max-width: min(100%, 1500px);
  max-height: calc(100vh - 104px);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.focus-close {
  position: fixed;
  top: 18px;
  right: 18px;
}

@media (max-width: 640px) {
  .unlock-panel {
    padding: 24px;
  }

  .unlock-row {
    grid-template-columns: 1fr;
  }

  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(138px, 1fr));
    gap: 10px;
  }

  .topbar {
    align-items: center;
  }
}
