/* ── Reset & base ─────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --cream:   #fdf8f3;
  --gold:    #c9a96e;
  --gold-dk: #a8834a;
  --dark:    #2c2416;
  --gray:    #8a7d6b;
  --light:   #f0e8dd;
  --white:   #ffffff;
  --radius:  12px;
  --shadow:  0 4px 20px rgba(44,36,22,.12);
}

html, body {
  height: 100%;
  background: var(--cream);
  font-family: 'Inter', sans-serif;
  color: var(--dark);
  overscroll-behavior: none;
}

/* ── Screens ──────────────────────────────────── */
.screen { display: none; min-height: 100vh; }
.screen.active { display: flex; flex-direction: column; }

/* ── Loading ──────────────────────────────────── */
#screen-loading {
  align-items: center;
  justify-content: center;
}
.loading-spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--light);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Not found ────────────────────────────────── */
#screen-notfound, .center-content {
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  gap: 1rem;
}

/* ── Name screen ──────────────────────────────── */
#screen-name {
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--cream) 0%, var(--light) 100%);
  padding: 2rem;
}

.name-card {
  background: var(--white);
  border-radius: 20px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.couple-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2rem;
  font-weight: 300;
  color: var(--dark);
  line-height: 1.2;
}

.cover-message {
  color: var(--gray);
  font-size: .9rem;
  line-height: 1.5;
}

/* ── Prize card ───────────────────────────────── */
.prize-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: linear-gradient(135deg, #fdf3e0 0%, #fae8c0 100%);
  border: 1.5px solid var(--gold);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  text-align: left;
  width: 100%;
}
.prize-card.hidden { display: none; }

.prize-icon {
  font-size: 2rem;
  flex-shrink: 0;
}

.prize-text {
  display: flex;
  flex-direction: column;
  gap: .2rem;
}

.prize-label {
  font-size: .7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--gold-dk);
}

.prize-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--dark);
  line-height: 1.2;
}

.prize-desc {
  font-size: .8rem;
  color: var(--gray);
  line-height: 1.4;
}

/* ── Input group ──────────────────────────────── */
.input-group {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

input[type="text"] {
  width: 100%;
  padding: .75rem 1rem;
  border: 1.5px solid var(--light);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  color: var(--dark);
  background: var(--cream);
  outline: none;
  transition: border-color .2s;
}
input[type="text"]:focus { border-color: var(--gold); }

/* ── Buttons ──────────────────────────────────── */
.btn-primary {
  width: 100%;
  padding: .85rem 1.5rem;
  background: var(--gold);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: background .2s;
}
.btn-primary:hover { background: var(--gold-dk); }
.btn-primary:disabled { background: var(--light); color: var(--gray); cursor: not-allowed; }

.btn-secondary {
  padding: .5rem 1rem;
  background: transparent;
  color: var(--gold);
  border: 1.5px solid var(--gold);
  border-radius: var(--radius);
  font-size: .85rem;
  font-family: inherit;
  cursor: pointer;
}

/* ── Header ───────────────────────────────────── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(253,248,243,.95);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .9rem 1rem;
  border-bottom: 1px solid var(--light);
}

.header-couple {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.3rem;
  font-weight: 400;
  color: var(--dark);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.btn-tab {
  padding: .4rem .9rem;
  background: transparent;
  border: 1.5px solid var(--light);
  border-radius: 20px;
  font-size: .8rem;
  font-family: inherit;
  color: var(--gray);
  cursor: pointer;
  transition: all .2s;
}
.btn-tab.active {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--white);
}

.btn-upload-fab {
  width: 42px; height: 42px;
  background: var(--gold);
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 3px 12px rgba(201,169,110,.4);
  transition: transform .15s;
}
.btn-upload-fab:active { transform: scale(.93); }
.btn-upload-fab svg { width: 20px; height: 20px; color: var(--white); stroke: var(--white); }

/* ── Gallery ──────────────────────────────────── */
#screen-gallery { background: var(--cream); }

.gallery-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray);
  font-size: .95rem;
}
.gallery-empty.hidden { display: none; }

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 3px;
  padding: 3px;
}

@media (min-width: 480px) {
  .gallery-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 768px) {
  .gallery-grid { grid-template-columns: repeat(4, 1fr); }
}

.gallery-item {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  cursor: pointer;
  background: var(--light);
}

.gallery-item img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .3s;
}
.gallery-item:hover img { transform: scale(1.04); }

.gallery-item-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: .4rem .5rem;
  background: linear-gradient(transparent, rgba(0,0,0,.5));
  display: flex;
  align-items: center;
  justify-content: space-between;
  opacity: 0;
  transition: opacity .2s;
}
.gallery-item:hover .gallery-item-overlay,
.gallery-item:focus .gallery-item-overlay { opacity: 1; }

.gallery-item-name {
  color: white;
  font-size: .7rem;
  text-shadow: 0 1px 3px rgba(0,0,0,.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 70%;
}

.gallery-item-likes {
  color: white;
  font-size: .75rem;
  display: flex;
  align-items: center;
  gap: 3px;
}

.winner-ribbon {
  position: absolute;
  top: 6px; right: 6px;
  background: var(--gold);
  color: white;
  font-size: .65rem;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 500;
}

/* ── Modals ───────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
}
.modal.hidden { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(2px);
}

.modal-content {
  position: relative;
  background: var(--white);
  border-radius: 20px 20px 0 0;
  padding: 1.5rem 1.5rem 2rem;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-close {
  position: absolute;
  top: 1rem; right: 1rem;
  background: var(--light);
  border: none;
  border-radius: 50%;
  width: 32px; height: 32px;
  cursor: pointer;
  font-size: .85rem;
  color: var(--gray);
}

.modal-content h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.4rem;
  font-weight: 400;
}

/* Drop zone */
.drop-zone {
  border: 2px dashed var(--light);
  border-radius: var(--radius);
  padding: 2.5rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
  color: var(--gray);
}
.drop-zone:hover { border-color: var(--gold); }
.drop-zone svg { width: 40px; height: 40px; opacity: .5; }
.drop-zone p { font-size: .9rem; }
.file-input-hidden { display: none; }

.preview-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
}
.preview-container.hidden { display: none; }
.preview-container img {
  width: 100%;
  max-height: 240px;
  object-fit: contain;
  border-radius: var(--radius);
  background: var(--light);
}

.upload-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.upload-footer .btn-primary { width: auto; padding: .75rem 1.5rem; }
.upload-name { font-size: .82rem; color: var(--gray); }

.upload-progress { display: flex; flex-direction: column; gap: .5rem; }
.upload-progress.hidden { display: none; }
.progress-bar { height: 4px; background: var(--light); border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--gold); width: 0; transition: width .3s; }
#progress-text { font-size: .82rem; color: var(--gray); text-align: center; }

/* Modal foto ampliada */
#modal-photo {
  align-items: center;
  justify-content: center;
}
.modal-photo-content {
  position: relative;
  max-width: 95vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
}
.modal-photo-content img {
  max-width: 95vw;
  max-height: 75vh;
  border-radius: var(--radius);
  object-fit: contain;
}
.modal-photo-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0 .5rem;
  color: white;
  font-size: .9rem;
}
.btn-like {
  background: rgba(255,255,255,.2);
  border: 1.5px solid rgba(255,255,255,.5);
  border-radius: 20px;
  padding: .4rem .9rem;
  color: white;
  font-size: .9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: .4rem;
  transition: background .2s;
}
.btn-like.liked { background: rgba(255,80,80,.5); border-color: rgba(255,80,80,.7); }
.btn-like.liked .heart-icon::before { content: '♥'; }

.winner-badge {
  background: var(--gold);
  color: white;
  padding: .35rem 1rem;
  border-radius: 20px;
  font-size: .85rem;
  font-weight: 500;
}
.winner-badge.hidden { display: none; }

.hidden { display: none !important; }
