:root {
  --paper: #fff9f1;
  --ink: #352722;
  --muted: #806c61;
  --rose: #cf6f82;
  --rose-dark: #a95061;
  --mint: #7aa99a;
  --sun: #f0b45f;
  --calendar-orange: #ef860f;
  --line: rgba(83, 55, 44, 0.14);
  --shadow: 0 22px 60px rgba(66, 38, 31, 0.18);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Noto Serif SC", "Microsoft YaHei", serif;
  background:
    radial-gradient(circle at 10% 10%, rgba(240, 180, 95, 0.25), transparent 26rem),
    linear-gradient(135deg, #fff8ed 0%, #ffecef 48%, #edf6f2 100%);
}

body.lightbox-open {
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

.lock-screen {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1fr);
  gap: clamp(1.5rem, 5vw, 5rem);
  align-items: center;
  width: min(1120px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 36px 0;
}

.lock-panel {
  padding: clamp(1.5rem, 4vw, 3.2rem);
  background: rgba(255, 249, 241, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.eyebrow {
  margin: 0 0 0.7rem;
  color: var(--rose-dark);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 1rem;
  font-family: "ZCOOL XiaoWei", "Noto Serif SC", serif;
  font-size: clamp(2.3rem, 7vw, 4.9rem);
  line-height: 1.05;
  font-weight: 400;
}

.intro,
.hero p {
  color: var(--muted);
  line-height: 1.8;
}

.password-form {
  margin-top: 2rem;
}

.password-form label,
.form-grid label {
  display: grid;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.password-row {
  display: flex;
  gap: 0.75rem;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.86rem 0.95rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.76);
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
.memory-photo-button:focus-visible,
.lightbox-close:focus-visible {
  border-color: rgba(207, 111, 130, 0.65);
  box-shadow: 0 0 0 4px rgba(207, 111, 130, 0.12);
}

.password-row button,
.form-actions button {
  flex: 0 0 auto;
  border-radius: 8px;
  padding: 0 1.35rem;
  color: #fff;
  background: var(--rose-dark);
  box-shadow: 0 12px 24px rgba(169, 80, 97, 0.24);
}

.form-error,
#saveStatus {
  min-height: 1.5rem;
  margin: 0.6rem 0 0;
  color: var(--rose-dark);
  font-size: 0.88rem;
}

.lock-photo {
  position: relative;
  min-height: 520px;
}

.polaroid {
  position: absolute;
  width: min(78%, 360px);
  padding: 14px 14px 54px;
  border-radius: 6px;
  background: #fffdf8;
  box-shadow: 0 20px 44px rgba(70, 42, 34, 0.22);
}

.polaroid span {
  display: block;
  aspect-ratio: 4 / 5;
  border-radius: 4px;
  background:
    linear-gradient(155deg, rgba(255, 255, 255, 0.24), transparent 45%),
    url("./assets/lock-photo.jpg") center/cover no-repeat;
  filter: saturate(1.03) contrast(1.02);
}

.polaroid small {
  position: absolute;
  right: 22px;
  bottom: 18px;
  color: var(--muted);
}

.p1 {
  left: 4%;
  top: 8%;
  transform: rotate(-7deg);
  z-index: 1;
}

.p2 {
  right: 2%;
  bottom: 4%;
  transform: rotate(8deg);
  z-index: 2;
}

.p1 span {
  background-image:
    linear-gradient(155deg, rgba(255, 255, 255, 0.24), transparent 45%),
    url("./assets/lock-photo.jpg");
  background-position: 42% 28%;
}

.p2 span {
  background-image:
    linear-gradient(155deg, rgba(255, 255, 255, 0.24), transparent 45%),
    url("./assets/lock-photo-2.jpg");
  background-position: 52% 30%;
}

.album-app {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 70px;
}

.love-counter {
  width: min(520px, 100%);
  margin: 0.25rem auto 1.5rem;
  overflow: hidden;
  border: 1px solid rgba(205, 118, 24, 0.2);
  border-radius: 26px;
  background: #fffefb;
  box-shadow: 0 24px 50px rgba(66, 38, 31, 0.16);
}

.counter-header {
  padding: 1.1rem 1.5rem;
  color: #fff;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.08em;
  background: linear-gradient(180deg, #ff931c 0%, var(--calendar-orange) 100%);
}

.counter-body {
  display: grid;
  place-items: center;
  min-height: 260px;
  padding: 1.5rem 1rem;
  background: linear-gradient(180deg, #ffffff 0%, #fff9f1 100%);
}

.counter-body strong {
  font-family: "ZCOOL XiaoWei", "Noto Serif SC", serif;
  font-size: clamp(5.8rem, 18vw, 10rem);
  line-height: 1;
  font-weight: 400;
  color: #1f1f1f;
}

.counter-footer {
  display: flex;
  justify-content: center;
  gap: 0.35rem;
  padding: 1.1rem 1.5rem 1.35rem;
  border-top: 1px dashed rgba(83, 55, 44, 0.12);
  color: #8b827c;
  font-size: clamp(0.98rem, 2vw, 1.2rem);
  background: #fffdf9;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 22px 0 22px;
}

.hero h1 {
  max-width: 820px;
  margin-bottom: 0.7rem;
}

.ghost-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.72rem 1rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.52);
}

.composer,
.toolbar,
.empty-state {
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  background: rgba(255, 249, 241, 0.74);
  box-shadow: 0 18px 50px rgba(66, 38, 31, 0.12);
  backdrop-filter: blur(16px);
}

.composer form {
  display: grid;
  grid-template-columns: minmax(240px, 340px) 1fr;
  gap: 1.25rem;
  padding: 1rem;
}

.upload-box {
  position: relative;
  min-height: 360px;
  overflow: hidden;
  border: 1px dashed rgba(169, 80, 97, 0.34);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.5);
}

.upload-box input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.upload-box label {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 0.55rem;
  width: 100%;
  height: 100%;
  min-height: 360px;
  padding: 1rem;
  text-align: center;
  cursor: pointer;
}

.upload-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  background: var(--mint);
}

.upload-box small {
  color: var(--muted);
}

.upload-box img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.wide {
  grid-column: 1 / -1;
}

.form-actions {
  grid-column: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.action-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.75rem;
}

.action-buttons .ghost-button {
  box-shadow: none;
}

.storage-panel {
  display: grid;
  gap: 0.65rem;
  margin: 1.25rem 0 0;
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.72);
  box-shadow: 0 16px 40px rgba(66, 38, 31, 0.1);
  backdrop-filter: blur(16px);
}

.storage-panel div:first-child {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  color: var(--muted);
}

.storage-panel strong {
  color: var(--rose-dark);
}

.storage-meter {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(128, 108, 97, 0.16);
}

.storage-meter span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--mint), var(--sun), var(--rose));
  transition: width 0.25s ease;
}

.storage-panel p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.7;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 1.25rem 0;
  padding: 0.85rem 1rem;
}

.toolbar span {
  color: var(--rose-dark);
  font-size: 1.35rem;
  font-weight: 700;
}

.toolbar small {
  color: var(--muted);
}

.memory-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.memory-card {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.86);
  box-shadow: 0 16px 34px rgba(66, 38, 31, 0.12);
}

.memory-photo-button {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  overflow: hidden;
  color: inherit;
  background: #f5eadf;
}

.memory-photo-button img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #f5eadf;
  transition: transform 0.28s ease;
}

.memory-photo-button:hover img {
  transform: scale(1.04);
}

.memory-photo-hint {
  position: absolute;
  right: 0.85rem;
  bottom: 0.85rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  color: #fff;
  font-size: 0.8rem;
  background: rgba(21, 18, 17, 0.55);
  backdrop-filter: blur(8px);
}

.memory-body {
  padding: 1rem;
}

.memory-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.memory-card h2 {
  margin-bottom: 0.55rem;
  font-size: 1.16rem;
}

.memory-card p {
  margin-bottom: 0;
  color: #5d4a42;
  line-height: 1.75;
  white-space: pre-wrap;
}

.card-actions {
  display: flex;
  gap: 0.55rem;
  margin-top: 1rem;
}

.card-actions button {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.45rem 0.7rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.62);
}

.card-actions button:last-child {
  color: var(--rose-dark);
}

.empty-state {
  grid-column: 1 / -1;
  padding: 2rem;
  text-align: center;
}

.empty-state p {
  margin-bottom: 0;
  color: var(--muted);
}

.photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 99;
  display: grid;
  place-items: center;
  padding: clamp(1rem, 4vw, 2rem);
  background: rgba(18, 12, 10, 0.82);
  animation: fadeIn 0.2s ease;
}

.photo-lightbox img {
  max-width: min(92vw, 1200px);
  max-height: 86vh;
  border-radius: 18px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.35);
  animation: zoomIn 0.22s ease;
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  color: #fff;
  font-size: 1.8rem;
  line-height: 1;
  background: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(10px);
}

@media (max-width: 860px) {
  .lock-screen,
  .composer form {
    grid-template-columns: 1fr;
  }

  .lock-photo {
    display: none;
  }

  .hero {
    display: grid;
  }

  .form-actions {
    grid-column: 1;
  }

  .memory-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .password-row,
  .form-actions,
  .action-buttons {
    display: grid;
  }

  .password-row button,
  .form-actions button {
    min-height: 48px;
  }

  .form-grid,
  .memory-grid {
    grid-template-columns: 1fr;
  }

  .upload-box,
  .upload-box label {
    min-height: 280px;
  }

  .love-counter {
    border-radius: 20px;
  }

  .counter-header {
    padding: 1rem;
    font-size: 1.3rem;
  }

  .counter-body {
    min-height: 210px;
    padding: 1rem;
  }

  .counter-footer {
    flex-wrap: wrap;
    padding: 1rem;
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes zoomIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes zoomIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}


