* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --bg: #fdfbf7;
  --card: rgba(255, 255, 255, 0.85);
  --text: #1a1c1e;
  --muted: #626569;
  --border: rgba(11, 42, 111, 0.08);
  --blue: #0b2a6f;
  --blue2: #1e4bb5;
  --gold: #c5a059;
  --gold2: #e2c28a;
  --shadow: 0 12px 34px rgba(11, 42, 111, 0.06);
  --radius: 24px;
  --safe-area-top: env(safe-area-inset-top);
  --safe-area-bottom: env(safe-area-inset-bottom);
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: 
    radial-gradient(circle at 0% 0%, rgba(197, 160, 89, 0.1) 0%, transparent 40%),
    radial-gradient(circle at 100% 100%, rgba(30, 75, 181, 0.08) 0%, transparent 40%),
    var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 600px;
  margin: 0 auto;
  padding: calc(20px + var(--safe-area-top)) 20px calc(110px + var(--safe-area-bottom));
}

.header {
  padding: 20px 0 30px;
  text-align: center;
}

.badge {
  display: inline-flex;
  padding: 6px 14px;
  border-radius: 100px;
  background: rgba(197, 160, 89, 0.12);
  color: var(--gold);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.title {
  margin: 0;
  font-family: 'Playfair Display', serif;
  font-size: 42px;
  font-weight: 700;
  color: var(--blue);
  line-height: 1.1;
}

.subtitle {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
  max-width: 300px;
  margin-left: auto;
  margin-right: auto;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-top: 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: fadeIn 0.4s ease-out both;
}

.card.small {
  padding: 16px 20px;
}

.sectionTitle {
  margin: 0 0 16px;
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  color: var(--blue);
}

.field {
  margin-top: 16px;
}

.label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
  margin-left: 4px;
}

.input {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid rgba(11, 42, 111, 0.1);
  border-radius: 16px;
  outline: none;
  font-size: 16px;
  background: rgba(255, 255, 255, 0.8);
  transition: all 0.2s ease;
  font-family: inherit;
}

.input:focus {
  border-color: var(--blue2);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(30, 75, 181, 0.1);
}

.actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 480px) {
  .actions {
    grid-template-columns: 1fr 1fr;
  }
}

.button {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(11, 42, 111, 0.1);
  background: #fff;
  color: var(--blue);
  padding: 14px 20px;
  border-radius: 16px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
}

.button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(11, 42, 111, 0.1);
}

.buttonSmall {
  padding: 8px 16px;
  font-size: 13px;
  border-radius: 12px;
}

.hidden {
  display: none !important;
}

.progressWrap {
  margin-top: 12px;
  width: 100%;
  height: 6px;
  border-radius: 100px;
  background: rgba(11, 42, 111, 0.05);
  overflow: hidden;
}

.progressBar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold), var(--blue2));
  transition: width 0.3s ease;
}

.fineprint {
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
}

.savedRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 16px;
  background: rgba(197, 160, 89, 0.08);
  border: 1px solid rgba(197, 160, 89, 0.2);
}

.savedText {
  font-size: 15px;
  color: var(--blue);
  font-weight: 600;
}

.topRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.galleryHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.galleryGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}

@media (max-width: 400px) {
  .galleryGrid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
}

.mediaCard {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  background: #fff;
  box-shadow: var(--shadow);
  transition: transform 0.3s ease;
  aspect-ratio: 4/5;
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.4s ease-out both;
}

.mediaTop {
  flex: 1;
  width: 100%;
  position: relative;
  overflow: hidden;
  background: #f0f0f0;
}

.media {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.mediaMeta {
  padding: 12px;
  background: #fff;
}

.mediaWho {
  font-weight: 700;
  color: var(--blue);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mediaWhen {
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
}

.deleteBtn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 59, 48, 0.9);
  color: #fff;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 5;
  box-shadow: 0 4px 10px rgba(255, 59, 48, 0.3);
  transition: all 0.2s ease;
  padding: 0;
}

.empty {
  grid-column: 1 / -1;
  padding: 40px 20px;
  text-align: center;
  border-radius: 20px;
  border: 2px dashed rgba(11, 42, 111, 0.1);
  color: var(--muted);
  font-size: 14px;
}

/* Welcome Card */
.welcomeCard {
  text-align: center;
  padding: 30px 20px;
}

.welcomeIcon {
  font-size: 40px;
  color: #ff4d6d;
  margin-bottom: 15px;
  animation: heartBeat 2s infinite;
}

@keyframes heartBeat {
  0% { transform: scale(1); }
  14% { transform: scale(1.1); }
  28% { transform: scale(1); }
  42% { transform: scale(1.1); }
  70% { transform: scale(1); }
}

/* Floating Action Button (FAB) Menu */
.fab-container {
  position: fixed;
  bottom: 30px;
  right: 25px;
  z-index: 2000;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 15px;
}

.fab-main {
  width: 65px;
  height: 65px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue2), var(--blue));
  color: #fff;
  border: none;
  box-shadow: 0 8px 25px rgba(11, 42, 111, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 2002;
}

.fab-main:active {
  transform: scale(0.9);
}

.fab-container.active .fab-main {
  transform: rotate(135deg);
  background: var(--text);
}

.fab-menu {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 15px;
  visibility: hidden;
  pointer-events: none;
  position: relative;
  z-index: 2001;
}

.fab-container.active .fab-menu {
  visibility: visible;
  pointer-events: auto;
}

.fab-item {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: #fff;
  color: var(--blue);
  border: 1px solid var(--border);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  transform: scale(0) translateY(20px);
  opacity: 0;
  text-decoration: none;
  position: relative;
  z-index: 2001;
}

.fab-item.active {
  background: var(--blue2);
  color: #fff;
  border-color: var(--blue2);
}

.fab-container.active .fab-item {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* Staggered animation for menu items */
.fab-container.active .fab-item:nth-child(1) { transition-delay: 0.05s; }
.fab-container.active .fab-item:nth-child(2) { transition-delay: 0.1s; }
.fab-container.active .fab-item:nth-child(3) { transition-delay: 0.15s; }
.fab-container.active .fab-item:nth-child(4) { transition-delay: 0.2s; }

.fab-label {
  position: absolute;
  right: 65px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(10px);
  transition: all 0.3s ease;
  pointer-events: none;
}

.fab-item:hover .fab-label {
  opacity: 1;
  transform: translateX(0);
}

/* Pulse animation for the main button */
@keyframes fabPulse {
  0% { box-shadow: 0 8px 25px rgba(11, 42, 111, 0.4); }
  50% { box-shadow: 0 8px 35px rgba(11, 42, 111, 0.6); }
  100% { box-shadow: 0 8px 25px rgba(11, 42, 111, 0.4); }
}

.fab-container:not(.active) .fab-main {
  animation: fabPulse 2s infinite;
}

/* Action Sheets */
.actionSheet {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2100;
  display: flex;
  align-items: flex-end;
  visibility: hidden;
  transition: visibility 0.3s;
}

.actionSheet:not(.hidden) {
  visibility: visible;
}

.sheetOverlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.actionSheet:not(.hidden) .sheetOverlay {
  opacity: 1;
}

.sheetContent {
  position: relative;
  width: 100%;
  background: #fff;
  border-radius: 30px 30px 0 0;
  padding: 20px 20px calc(30px + var(--safe-area-bottom));
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.1);
}

.actionSheet:not(.hidden) .sheetContent {
  transform: translateY(0);
}

.sheetHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 25px;
}

.sheetHeader h3 {
  margin: 0;
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  color: var(--blue);
}

.closeSheet {
  background: rgba(11, 42, 111, 0.05);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--blue);
  cursor: pointer;
}

.sheetActions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.sheetBtn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  background: #f8f9fa;
  border: 1px solid rgba(11, 42, 111, 0.05);
  padding: 20px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sheetBtnIcon {
  width: 50px;
  height: 50px;
  background: #fff;
  border-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--blue2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* Install Banner */
.installBanner {
  position: fixed;
  top: 15px;
  left: 15px;
  right: 15px;
  background: #fff;
  padding: 12px 16px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 4000;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(11, 42, 111, 0.08);
  animation: slideDown 0.5s cubic-bezier(0.18, 0.89, 0.32, 1.28) both;
}

.installIcon {
  width: 40px;
  height: 40px;
  background: rgba(30, 75, 181, 0.1);
  color: var(--blue2);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.installText {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.installText strong {
  font-size: 14px;
  color: var(--text);
}

.installText span {
  font-size: 11px;
  color: var(--muted);
}

.installActions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.closeInstall {
  background: rgba(11, 42, 111, 0.05);
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 20px;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: 2px;
  transition: all 0.2s ease;
}

.closeInstall:active {
  background: rgba(11, 42, 111, 0.1);
  transform: scale(0.9);
}

/* Global Status Overlay */
.globalStatus {
  position: fixed;
  top: 80px; /* Adjusted to not overlap with install banner */
  left: 20px;
  right: 20px;
  z-index: 3000;
  display: flex;
  justify-content: center;
  pointer-events: none;
  animation: slideDown 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28) both;
}

@keyframes slideDown {
  from { transform: translateY(-100px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.statusCard {
  background: #fff;
  padding: 16px 20px;
  border-radius: 20px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(11, 42, 111, 0.1);
  min-width: 250px;
  pointer-events: auto;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
