:root {
  --bg: #050507;
  --soft: rgba(255,255,255,0.08);
  --text: #f8f2ea;
  --muted: rgba(248,242,234,0.72);
  --line: rgba(255,255,255,0.14);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(circle at 30% 15%, #241814 0%, #08080b 35%, #020203 100%);
  color: var(--text);
  font-family: ui-serif, Georgia, Cambria, "Times New Roman", serif;
}

button, input {
  font: inherit;
}

.screen {
  min-height: 100vh;
  min-height: 100svh;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.screen.active { display: flex; }

.glass {
  width: min(92vw, 460px);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(145deg, rgba(255,255,255,0.10), rgba(255,255,255,0.04));
  backdrop-filter: blur(18px);
  box-shadow: 0 30px 120px rgba(0,0,0,.55);
  text-align: center;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: .22em;
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 14px;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

h1 {
  font-size: clamp(44px, 10vw, 84px);
  line-height: .92;
  margin: 0;
  letter-spacing: -0.06em;
}

h2 {
  font-size: clamp(36px, 7vw, 70px);
  letter-spacing: -0.05em;
  margin: 0 0 28px;
  text-align: center;
}

.subtitle, .muted {
  color: var(--muted);
  font-size: 18px;
  line-height: 1.45;
}

.hero {
  text-align: center;
  transform: translateY(-2vh);
}

.hero .subtitle {
  margin: 20px 0 38px;
  font-size: clamp(20px, 4vw, 28px);
}

.password-form {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(0,0,0,.34);
  color: var(--text);
  padding: 15px 18px;
  outline: none;
  text-align: center;
}

button, .primary-link {
  border: 0;
  border-radius: 999px;
  background: rgba(255,255,255,0.92);
  color: #111;
  padding: 14px 22px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.primary {
  min-width: 160px;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: .02em;
}

.error {
  min-height: 20px;
  color: #ffb4b4;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}

.hub {
  width: min(100%, 980px);
}

.tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.tile {
  min-height: 210px;
  padding: 28px;
  border-radius: 30px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.07);
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-start;
  text-align: left;
}

.tile span { font-size: 28px; }
.tile strong { font-size: 26px; letter-spacing: -0.04em; }
.tile small { color: var(--muted); font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.tile.disabled { opacity: .45; cursor: not-allowed; }

.slideshow-screen {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #000;
  padding: 0;
}

#slideImage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0;
  transform: scale(1.035);
  transition: opacity .55s ease, transform 2.8s ease;
  filter: saturate(1.04) contrast(1.02);
}

#slideImage.show {
  opacity: 1;
  transform: scale(1.075);
}

.slideshow-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, rgba(0,0,0,.45), transparent 28%, transparent 58%, rgba(0,0,0,.7)),
    radial-gradient(circle at center, transparent 42%, rgba(0,0,0,.26));
  pointer-events: none;
}

.caption {
  position: absolute;
  left: 50%;
  bottom: 92px;
  transform: translateX(-50%);
  width: min(86vw, 720px);
  text-align: center;
  font-size: clamp(18px, 3.5vw, 34px);
  line-height: 1.15;
  z-index: 4;
  text-shadow: 0 2px 22px rgba(0,0,0,.8);
  opacity: 0;
  transition: opacity .4s ease;
}

.caption.visible { opacity: 1; }

.cue {
  position: absolute;
  top: 52px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(0,0,0,.36);
  border: 1px solid var(--line);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: rgba(255,255,255,.84);
  font-size: 14px;
  backdrop-filter: blur(10px);
  animation: cueFade 5s forwards;
}

@keyframes cueFade {
  0%, 72% { opacity: 1; }
  100% { opacity: 0; pointer-events: none; }
}

.topbar, .controls {
  position: absolute;
  z-index: 7;
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar {
  top: max(18px, env(safe-area-inset-top));
  right: 18px;
  left: 18px;
  justify-content: space-between;
}

.controls {
  left: 50%;
  bottom: max(22px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
}

.icon-btn, .save-btn {
  background: rgba(0,0,0,.34);
  color: white;
  border: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.icon-btn {
  width: 46px;
  height: 46px;
  padding: 0;
  font-size: 24px;
}

.save-btn {
  white-space: nowrap;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgba(255,255,255,.16);
  z-index: 8;
}

.progress span {
  display: block;
  height: 100%;
  width: 0;
  background: rgba(255,255,255,.8);
}

.progress.run span {
  animation: progress var(--duration, 2600ms) linear forwards;
}

@keyframes progress { to { width: 100%; } }

.save-dialog {
  width: min(92vw, 430px);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(12,12,15,.94);
  color: var(--text);
  padding: 26px;
  box-shadow: 0 20px 80px rgba(0,0,0,.6);
  z-index: 20;
}

.save-dialog::backdrop { background: rgba(0,0,0,.55); backdrop-filter: blur(5px); }

.save-dialog h3 {
  margin: 0 0 6px;
  font-size: 28px;
}

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

.dialog-actions {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.dialog-actions button {
  background: rgba(255,255,255,.1);
  color: var(--text);
  border: 1px solid var(--line);
}

.collection-links {
  max-height: 220px;
  overflow: auto;
  display: grid;
  gap: 8px;
  margin-top: 14px;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.collection-links a {
  color: var(--text);
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
}

@media (max-width: 760px) {
  .tiles { grid-template-columns: 1fr; }
  .tile { min-height: 150px; }
  .controls { width: calc(100vw - 24px); justify-content: center; }
  .save-btn { padding-inline: 16px; font-size: 14px; }
}
