*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --cream: #faf9f7;
  --white: #ffffff;
  --gold: #c1603a;
  --gold-hover: #a34e2e;
  --dark: #2c2c2c;
  --mid: #777;
  --light: #e0dbd4;
  --error: #b94040;
  --success: #4a7c59;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--white);
  color: var(--dark);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0;
  padding-bottom: 130px;
  scrollbar-gutter: stable;
}

body.has-fixed-banner {
  padding-top: 165px;
}

/* ---- Footer nav ---- */
#site-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  background: var(--white);
  border-top: 1px solid var(--light);
  z-index: 100;
}

.footer-nav-row {
  display: flex;
  width: 100%;
}

.footer-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 0.25rem;
  text-decoration: none;
  color: var(--mid);
  gap: 0.2rem;
  transition: color 0.15s;
}

.footer-item.active {
  color: var(--gold);
}

.footer-item:hover {
  color: var(--gold);
}

.footer-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.footer-label {
  font-size: 0.65rem;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

#wedding-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--gold);
  color: #fff;
  text-align: center;
  padding: 0.75rem 1.5rem calc(0.75rem + 57px);
  font-family: 'Times New Roman', Times;
  font-size: 1.95rem;
  font-weight: 400;
  font-style: normal;
  letter-spacing: 0.06em;
}

/* ---- Index page hero ---- */

#hero-banner {
  position: relative;
  background: var(--gold);
  color: #fff;
  text-align: center;
  padding: 0.75rem 1.5rem calc(0.75rem + 68px);
  font-family: 'Times New Roman', Times;
  font-size: 1.95rem;
  font-weight: 400;
  font-style: normal;
  letter-spacing: 0.06em;
}

#hero-photo-wrap {
  display: flex;
  justify-content: center;
  margin-top: -68px;
  position: relative;
  z-index: 1;
  pointer-events: none;
}

#hero-photo {
  width: 135px;
  height: 135px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--white);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

#hero-names {
  font-family: 'Times New Roman', Times;
  font-size: 1.95rem;
  font-style: normal;
  font-weight: 400;
  color: var(--dark);
  letter-spacing: 0.04em;
  text-align: center;
  margin: 0.75rem 0 0;
}

.hero-divider {
  border: none;
  border-top: 1px solid var(--light);
  margin: 0.75rem 0 0;
}

/* ---- Fixed banner (all pages except index) ---- */

#banner-logout {
  position: absolute;
  right: 1rem;
  bottom: 0.5rem;
  background: none;
  border: none;
  color: #fff;
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
  text-decoration: none;
}

#hero-banner #banner-logout {
  bottom: 0.5rem;
}

#banner-logout:hover {
  text-decoration: underline;
}

#wedding-photo {
  position: absolute;
  bottom: -57px;
  left: 50%;
  transform: translateX(-50%);
  width: 114px;
  height: 114px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--white);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

/* ---- Typography ---- */

h1 {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 2.25rem;
  font-weight: 400;
  letter-spacing: 0.03em;
  line-height: 1.2;
}

h2 {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.5rem;
  font-weight: 400;
}

.subtitle {
  font-family: Georgia, 'Times New Roman', serif;
  font-style: normal;
  color: var(--mid);
  margin-top: 1.3rem;
  font-size: 1rem;
}

/* ---- Layout ---- */

.screen {
  width: 100%;
}

.card {
  width: 100%;
  padding: 2rem 1.5rem;
  text-align: center;
}

#upload-screen .card {
  padding-top: 3.5rem;
}

/* ---- Login form ---- */

.lead {
  color: var(--mid);
  font-size: 0.95rem;
  margin-top: 1rem;
  line-height: 1.5;
}

#login-form {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
}

input[type='password'] {
  border: 1px solid var(--light);
  border-radius: 5px;
  padding: 0.8rem 1rem;
  font-size: 1rem;
  font-family: inherit;
  text-align: center;
  letter-spacing: 0.12em;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}

input[type='password']:focus {
  border-color: var(--gold);
}

/* ---- Buttons ---- */

.btn,
button[type='submit'] {
  background: var(--gold);
  color: var(--white);
  border: none;
  border-radius: 5px;
  padding: 0.8rem 1.5rem;
  font-size: 0.9rem;
  font-family: inherit;
  letter-spacing: 0.07em;
  cursor: pointer;
  transition: background 0.2s;
  text-decoration: none;
  display: inline-block;
}

.btn:hover,
button[type='submit']:hover {
  background: var(--gold-hover);
}

.btn-outline {
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--gold);
}

.btn-outline:hover {
  background: var(--gold);
  color: var(--white);
  -webkit-text-fill-color: var(--white);
}

#view-entries-link:hover [data-i18n] {
  background: linear-gradient(90deg, #ff0000, #ff8800, #ffee00, #00cc00, #0088ff, #8800ff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.btn:active,
button[type='submit']:active {
  background: var(--gold-hover);
}

.btn-outline:active {
  background: var(--gold);
  color: var(--white);
}

.file-label:active {
  background: var(--gold-hover);
}

.btn-ghost {
  background: none;
  border: none;
  color: var(--mid);
  font-size: 0.85rem;
  cursor: pointer;
  font-family: inherit;
  padding: 0.75rem 1rem;
  transition: color 0.2s;
}

.btn-ghost:hover {
  color: var(--dark);
}

/* ---- Messages ---- */

.error-msg {
  color: var(--error);
  font-size: 0.875rem;
}

.hidden {
  display: none !important;
}

/* ---- Uploader name ---- */

.uploader-name-wrap {
  margin-top: 1.75rem;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

.uploader-name-wrap input[type='text'] {
  width: 100%;
  border: 1px solid var(--light);
  border-radius: 5px;
  padding: 0.7rem 1rem;
  font-size: 0.95rem;
  font-family: inherit;
  text-align: center;
  outline: none;
  transition: border-color 0.2s;
  background: var(--cream);
  color: var(--dark);
}

.uploader-name-wrap input[type='text']:focus {
  border-color: var(--gold);
  background: var(--white);
}

/* ---- Drop zone ---- */

#drop-zone {
  margin: 2rem auto 0;
  max-width: 480px;
  border: 2px dashed var(--light);
  border-radius: 8px;
  padding: 2.5rem 1.5rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  user-select: none;
}

#drop-zone.drag-over {
  border-color: var(--gold);
  background: #fdf7f0;
}

.drop-icon {
  font-size: 2.25rem;
  margin-bottom: 0.75rem;
  pointer-events: none;
}

.drop-text {
  font-size: 1rem;
  pointer-events: none;
}

.drop-or {
  color: var(--mid);
  font-size: 0.85rem;
  margin: 0.6rem 0;
  pointer-events: none;
}

.file-label {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  background: var(--gold);
  color: var(--white);
  border-radius: 5px;
  padding: 0.65rem 1.25rem;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s;
}

.file-label-hint {
  font-size: 0.7rem;
  opacity: 0.85;
  margin-top: 0.2rem;
}

.file-label:hover {
  background: var(--gold-hover);
}

.file-label input {
  display: none;
}

.drop-hint {
  font-size: 0.78rem;
  color: var(--mid);
  margin-top: 0.75rem;
  pointer-events: none;
}

/* ---- Upload queue ---- */

#upload-queue {
  margin: 1.5rem auto 0;
  max-width: 480px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-align: left;
  max-height: 260px;
  overflow-y: auto;
}

.upload-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  padding: 0.5rem 0.75rem;
  background: var(--cream);
  border-radius: 5px;
}

.upload-item .name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-item .status {
  flex-shrink: 0;
  font-size: 0.8rem;
  color: var(--mid);
}

.upload-item.success .status {
  color: var(--success);
}

.upload-item.error .status {
  color: var(--error);
}

/* ---- Upload footer ---- */

.upload-footer {
  margin: 1.75rem auto 0;
  max-width: 480px;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

/* ---- Gallery ---- */

.gallery-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
}

.gallery-header h1 {
  font-size: 1.75rem;
}

.gallery-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

#server-status {
  color: var(--mid);
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
  text-align: left;
}

#photo-count {
  color: var(--mid);
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
  text-align: left;
}

#photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.6rem;
  text-align: left;
}

/* photo-item wraps the thumbnail + optional caption */
.photo-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.photo-thumb {
  aspect-ratio: 1;
  background: var(--cream);
  border-radius: 5px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
}

.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.2s;
}

.photo-thumb:hover img {
  opacity: 0.88;
}

.photo-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.video-play-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: white;
  text-shadow: 0 0 6px rgba(0,0,0,0.7);
  pointer-events: none;
}

.photo-caption {
  font-size: 0.72rem;
  color: var(--mid);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 0.15rem;
}

.photo-thumb.selected {
  outline: 3px solid var(--gold);
  outline-offset: -3px;
}

.photo-thumb.selected::after {
  content: '✓';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  background: var(--gold);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  pointer-events: none;
}

.photo-thumb.no-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 1px solid var(--light);
  cursor: default;
  font-size: 0.78rem;
  color: var(--mid);
  padding: 0.5rem;
  text-align: center;
}

.photo-thumb.no-preview .icon {
  font-size: 1.5rem;
}

/* ---- Lightbox ---- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
}

.modal-box {
  background: #fff;
  border-radius: 12px;
  padding: 1.75rem;
  width: 100%;
  max-width: 420px;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
}

.modal-box h2 {
  margin: 0 0 1.25rem;
  font-size: 1.1rem;
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--mid);
  line-height: 1;
}

.scoreboard-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--light);
}

.scoreboard-row:last-child { border-bottom: none; }

.scoreboard-rank {
  min-width: 1.8rem;
  font-size: 0.85rem;
  color: var(--mid);
  font-weight: 600;
}

.scoreboard-name {
  flex: 1;
  font-size: 0.95rem;
}

.scoreboard-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.1rem;
}

.scoreboard-count {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--success);
}

.scoreboard-last {
  font-size: 0.75rem;
  color: var(--mid);
}

#lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  cursor: zoom-out;
  padding: 1rem;
}

#lightbox img {
  max-width: 95vw;
  max-height: 95vh;
  object-fit: contain;
  border-radius: 3px;
}

#lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
  opacity: 0.8;
  background: none;
  border: none;
  font-family: inherit;
}

#lightbox-close:hover {
  opacity: 1;
}

#lightbox-media {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 95vw;
  max-height: 95vh;
  cursor: default;
}

#lightbox-media img {
  max-width: 95vw;
  max-height: 95vh;
  object-fit: contain;
  border-radius: 3px;
}

#lightbox-media video {
  max-width: 95vw;
  max-height: 95vh;
}

#lightbox-prev,
#lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #fff;
  font-size: 3rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.7;
  padding: 0 0.75rem;
  user-select: none;
}

#lightbox-prev { left: 0.5rem; }
#lightbox-next { right: 0.5rem; }

#lightbox-prev:hover,
#lightbox-next:hover {
  opacity: 1;
}

/* ---- Upload footer links ---- */

.footer-links {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

#admin-link a,
#guestbook-link {
  color: var(--gold);
  text-decoration: none;
  font-size: 0.875rem;
}

#admin-link a:hover,
#guestbook-link:hover {
  text-decoration: underline;
}

/* ---- Guestbook form inputs ---- */

.gb-input {
  width: 100%;
  border: 1px solid var(--light);
  border-radius: 5px;
  padding: 0.7rem 1rem;
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--cream);
  color: var(--dark);
  outline: none;
  transition: border-color 0.2s;
}

.gb-input:focus {
  border-color: var(--gold);
  background: var(--white);
}

.gb-textarea {
  resize: vertical;
  min-height: 100px;
}

/* ---- Voice recorder ---- */

.recording-indicator {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1rem;
  color: var(--error);
  font-variant-numeric: tabular-nums;
}

.recording-dot {
  width: 12px;
  height: 12px;
  background: var(--error);
  border-radius: 50%;
  flex-shrink: 0;
  animation: pulse-dot 1s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.25; }
}

/* ---- Guestbook entry cards ---- */

.gb-entry {
  border: 1px solid var(--light);
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1rem;
  text-align: left;
}

.gb-entry-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.gb-entry-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.gb-entry-time {
  font-size: 0.78rem;
  color: var(--mid);
  flex-shrink: 0;
}

.gb-entry-message {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--dark);
  white-space: pre-wrap;
  margin: 0;
}

/* ---- Admin health cards ---- */

.health-card {
  background: var(--white);
  border: 1px solid var(--light);
  border-radius: 8px;
  padding: 1rem 1.25rem;
}

.health-label {
  font-size: 0.75rem;
  color: var(--mid);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.3rem;
}

.health-value {
  font-size: 1.4rem;
  font-family: Georgia, serif;
  color: var(--dark);
}

/* ---- Photo tasks ---- */

.task-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border: 1px solid var(--light);
  border-radius: 8px;
  margin-bottom: 0.75rem;
  gap: 1rem;
}

.task-item.task-todo {
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.task-item.task-todo:hover {
  border-color: var(--gold);
  background: #fdf7f0;
}

.task-item.task-done {
  opacity: 0.65;
}

.task-num {
  flex-shrink: 0;
  font-size: 0.85rem;
  color: var(--mid);
  min-width: 1.6rem;
}

.task-text-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.task-label {
  font-size: 0.95rem;
  color: var(--dark);
}

.task-solved-by {
  font-size: 0.75rem;
  color: var(--mid);
}

.task-badge {
  flex-shrink: 0;
  font-size: 0.85rem;
  font-weight: 600;
}

.task-item.task-done .task-badge {
  color: var(--success);
}

.task-item.task-todo .task-badge {
  color: var(--gold);
}

.task-item.task-solved {
  cursor: pointer;
  border-color: var(--success);
  background: #f0faf4;
  transition: border-color 0.2s, background 0.2s;
}

.task-item.task-solved:hover {
  background: #e3f5ea;
}

.task-item.task-solved .task-badge {
  color: var(--success);
}

.task-manage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border: 1px solid var(--light);
  border-radius: 6px;
  margin-bottom: 0.5rem;
  gap: 1rem;
}

.task-manage-title {
  font-size: 0.9rem;
  color: var(--dark);
  flex: 1;
}

.task-manage-title .done-badge {
  color: var(--success);
  font-size: 0.8rem;
  margin-left: 0.5rem;
}

/* ---- Language switcher ---- */

.lang-switcher {
  display: none;
  align-items: center;
  gap: 0.1rem;
}

#wedding-banner .lang-switcher,
#hero-banner .lang-switcher {
  display: flex;
}

#wedding-banner .lang-switcher,
#hero-banner .lang-switcher {
  position: absolute;
  left: 1rem;
  bottom: 0.5rem;
}

#wedding-banner .lang-switcher .lang-btn,
#hero-banner .lang-switcher .lang-btn {
  color: rgba(255, 255, 255, 0.8);
  padding: 0.2rem 0.35rem;
}

#wedding-banner .lang-switcher .lang-btn:hover,
#hero-banner .lang-switcher .lang-btn:hover {
  color: #fff;
}

#wedding-banner .lang-switcher span,
#hero-banner .lang-switcher span {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.8rem;
  line-height: 1;
  pointer-events: none;
}

.lang-switcher span {
  color: var(--mid);
  font-size: 0.8rem;
  line-height: 1;
  pointer-events: none;
}

.lang-btn {
  font-size: 0.8rem;
  padding: 0.25rem 0.5rem;
}

/* ---- Responsive ---- */

@media (max-width: 520px) {
  h1 {
    font-size: 1.75rem;
  }

  /* Larger tap target for the file picker button */
  .file-label {
    padding: 0.9rem 1.75rem;
    font-size: 1rem;
  }

  #photo-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }

  .gallery-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}
