/* App shell + screens */
#app { min-height: 100dvh; display: flex; flex-direction: column; }

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px;
  animation: screen-in var(--dur-med) var(--ease-soft);
}
@keyframes screen-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Welcome / auth */
.auth-wrap {
  width: 100%;
  max-width: 420px;
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}
.auth-logo { width: 190px; height: auto; border-radius: 22%; box-shadow: var(--shadow-lift); }
.auth-title { font-size: 1.6rem; text-align: center; }
.auth-sub { color: var(--text-soft); text-align: center; font-size: 0.98rem; }

.auth-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-soft);
  padding: 28px 24px;
}
.auth-actions { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.auth-switch { text-align: center; font-size: 0.92rem; color: var(--text-soft); }
.auth-switch a { font-weight: 700; }

.form-error {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
  border-radius: var(--radius-s);
  padding: 10px 14px;
  font-size: 0.9rem;
  margin-bottom: 14px;
  display: none;
}
.form-error.show { display: block; }

/* Top bar for authenticated shell (used from Phase 3 onward) */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar img { width: 36px; height: 36px; }
.topbar .spacer { flex: 1; }
.icon-btn {
  background: none;
  border: none;
  color: var(--text-soft);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--dur-fast) var(--ease-soft);
}
.icon-btn:hover { background: var(--bg-soft); }

/* Authenticated shell */
.shell { display: flex; flex-direction: column; min-height: 100dvh; }
.shell-content { flex: 1; padding-bottom: 76px; }
.screen-pad { padding: 16px; max-width: 640px; margin: 0 auto; width: 100%; }

.bottom-nav {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  z-index: 20;
}
.nav-tab {
  flex: 1;
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 0;
  color: var(--text-faint);
  border-radius: var(--radius-s);
  transition: color var(--dur-fast) var(--ease-soft);
}
.nav-tab.active { color: var(--primary); }
.nav-icon { font-size: 1.25rem; }
.nav-label { font-size: 0.72rem; font-weight: 500; }

/* Cards & lists */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-soft);
  padding: 18px;
  margin-bottom: 16px;
}
.center-actions { display: flex; justify-content: center; }

.composer-input {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-m);
  padding: 12px 14px;
  background: var(--bg);
  color: var(--text);
  resize: none;
}
.composer-input:focus { border-color: var(--primary); outline: none; }
.composer-actions { display: flex; justify-content: space-between; margin-top: 10px; }
.btn-sm { padding: 9px 16px; font-size: 0.9rem; }

.empty-state { text-align: center; padding: 48px 20px; color: var(--text-soft); }
.empty-icon { font-size: 2.6rem; margin-bottom: 10px; }
.empty-sub { color: var(--text-faint); font-size: 0.92rem; }

.avatar {
  width: 56px; height: 56px; border-radius: 50%;
  object-fit: cover; flex-shrink: 0;
}
.avatar-initial {
  display: flex; align-items: center; justify-content: center;
  background: var(--gradient-brand);
  color: #fff; font-size: 1.4rem; font-weight: 700;
}

.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
  margin: 24px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Chat */
.chat-screen { display: flex; flex-direction: column; height: 100dvh; }
.messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.msg-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--border);
}
.msg-input {
  flex: 1; border: 1.5px solid var(--border); border-radius: 22px;
  padding: 10px 16px; background: var(--bg); color: var(--text);
}
.msg-input:focus { border-color: var(--primary); outline: none; }
.send-btn { background: var(--gradient-brand); color: #fff; }

/* Search */
.search-input {
  width: 100%; border: 1.5px solid var(--border); border-radius: 22px;
  padding: 12px 18px; background: var(--surface); color: var(--text);
  margin-bottom: 14px;
}
.search-input:focus { border-color: var(--primary); outline: none; }

/* Couples grid */
.couple-intro h2 { margin-bottom: 8px; }
.couple-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px;
}
.couple-cell {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-m); padding: 20px 12px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  box-shadow: var(--shadow-soft);
  transition: transform var(--dur-fast) var(--ease-soft);
}
.couple-cell:active { transform: scale(0.97); }
.couple-cell-icon { font-size: 1.8rem; }
.couple-cell-label { font-weight: 500; font-size: 0.92rem; color: var(--text); }

/* Profile & settings */
.profile-head { display: flex; align-items: center; gap: 14px; }
.profile-head h2 { font-size: 1.15rem; }
.profile-username { color: var(--text-faint); font-size: 0.9rem; }
.profile-head .btn { margin-inline-start: auto; }

.settings { padding: 6px; }
.settings-row {
  display: flex; align-items: center; gap: 12px;
  width: 100%; background: none; border: none;
  padding: 14px 12px; font-size: 1rem; color: var(--text);
  border-radius: var(--radius-s); text-align: start;
  transition: background var(--dur-fast) var(--ease-soft);
}
.settings-row:hover { background: var(--bg-soft); }
.settings-icon { font-size: 1.15rem; }
.settings-chevron { margin-inline-start: auto; color: var(--text-faint); }

/* auth extras */
.auth-divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--text-faint); font-size: 0.85rem;
  margin: 14px 0;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.btn-google { width: 100%; margin-bottom: 10px; }
.g-mark {
  font-weight: 800; font-size: 1.1rem;
  background: linear-gradient(135deg, #4285f4, #ea4335, #fbbc05, #34a853);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.auth-note { font-size: 0.88rem; color: var(--text-soft); text-align: center; margin: 10px 0 0; }
.auth-card form + .auth-note { margin-top: 12px; }
#recaptcha-container { display: flex; justify-content: center; margin: 8px 0; }

/* ---- Phase 4: social UI ---- */
.stack { display: flex; flex-direction: column; gap: 12px; }
.section-title { margin: 18px 0 4px; font-size: 1.05rem; }
.form-ok {
  display: none; background: rgba(46, 204, 113, .15); color: #2ecc71;
  border: 1px solid rgba(46, 204, 113, .4); border-radius: 10px;
  padding: 10px 14px; font-size: .9rem;
}
.form-ok.show { display: block; }
.field-label { display: block; margin: 10px 0 4px; font-size: .85rem; opacity: .8; }
.composer-preview { max-width: 160px; border-radius: 12px; margin-top: 8px; }
.post-card { padding: 14px 16px; }
.post-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.post-meta { display: flex; flex-direction: column; }
.post-sub { font-size: .8rem; opacity: .65; }
.post-text { margin: 6px 0; white-space: pre-wrap; line-height: 1.7; }
.post-image { width: 100%; border-radius: 14px; margin-top: 8px; }
.post-actions { display: flex; gap: 8px; margin-top: 10px; }
.like-btn { font-size: 1rem; }
.chat-list { display: flex; flex-direction: column; gap: 8px; }
.chat-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 16px; padding: 12px 14px; cursor: pointer;
  text-align: start; color: inherit; font: inherit;
}
.chat-item:hover { border-color: var(--accent); }
.chat-item-meta { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat-item-sub { font-size: .85rem; opacity: .65; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item-time { font-size: .75rem; opacity: .55; }
.messages {
  flex: 1; overflow-y: auto; display: flex; flex-direction: column;
  gap: 8px; padding: 16px;
}
.msg-bubble {
  max-width: 78%; padding: 10px 14px; border-radius: 18px;
  display: flex; flex-direction: column; gap: 4px;
}
.msg-bubble.mine {
  align-self: flex-start;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff; border-end-start-radius: 4px;
}
.msg-bubble.theirs {
  align-self: flex-end;
  background: var(--card); border: 1px solid var(--border);
  border-end-end-radius: 4px;
}
.msg-text { margin: 0; white-space: pre-wrap; line-height: 1.6; }
.msg-time { font-size: .7rem; opacity: .7; align-self: flex-end; }
.msg-image { max-width: 220px; border-radius: 12px; }
.msg-audio { max-width: 220px; height: 36px; }
.icon-btn.recording {
  background: #e74c3c; color: #fff; border-radius: 50%;
  animation: pulse 1s infinite;
}
@keyframes pulse { 50% { opacity: .6; } }
.user-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.user-card-meta { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.user-card-sub { font-size: .82rem; opacity: .65; }
.user-card-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.profile-avatar-box { display: flex; justify-content: center; margin: 8px 0; }
.avatar-lg { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; }
.btn.danger { color: #e74c3c; border-color: rgba(231, 76, 60, .4); }

/* ---- couples space ---- */
.couple-head { text-align: center; padding: 20px; }
.couple-avatars { display: flex; justify-content: center; align-items: center; gap: 6px; }
.couple-heart { font-size: 1.4rem; }
.day-counter { display: flex; flex-direction: column; align-items: center; margin-top: 8px; }
.day-number {
  font-size: 2.4rem; font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.day-label { font-size: .85rem; opacity: .7; }
.couple-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 2px; }
.couple-tab {
  flex: 1; white-space: nowrap; border: 1px solid var(--border);
  background: var(--card); color: inherit; border-radius: 999px;
  padding: 8px 12px; font-size: .85rem; cursor: pointer;
}
.couple-tab.active {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff; border-color: transparent;
}
.album-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.album-photo { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; }
.memory-card { padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.memory-text { margin: 0; white-space: pre-wrap; line-height: 1.7; }
.goal-item { display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; }
.goal-item input { width: 18px; height: 18px; accent-color: var(--accent); }
.goal-done { text-decoration: line-through; opacity: .55; }
.goal-add { display: flex; gap: 8px; }
.goal-add .input { flex: 1; }

/* ---- admin ---- */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat-card { text-align: center; padding: 16px 8px; display: flex; flex-direction: column; }
.stat-value {
  font-size: 1.8rem; font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat-label { font-size: .82rem; opacity: .7; }

/* Shared board stays white so strokes remain readable in both themes. */
.shared-board { display:block; width:100%; aspect-ratio:3/2; height:auto; background:#fff; border:1px solid var(--border); border-radius:12px; touch-action:none; }
.board-tools {display:flex;gap:10px;flex-wrap:wrap;}
.board-color {width:34px;height:34px;border:3px solid transparent;border-radius:50%;cursor:pointer;}
.board-color[aria-pressed="true"] {outline:2px solid var(--text);outline-offset:2px;}
.board-size {max-width:110px;}
