/* Winek web — thème sombre, mêmes couleurs que l'appli Android (ui/theme/Color.kt) */
:root {
  --pink: #FF4FA3;
  --pink-deep: #D6136F;
  --cyan: #4CC9E0;
  --online: #3DDC84;
  --warning: #FFB020;
  --danger: #F87171;
  --bg: #0B0B10;
  --surface: #17171F;
  --surface-high: #1C1C25;
  --border: #26262F;
  --text: #F4F4F8;
  --muted: #A0A0B0;
  --radius: 18px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body {
  font-family: 'Outfit', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  overscroll-behavior: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--pink); }
img { max-width: 100%; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

#app { height: 100dvh; display: flex; flex-direction: column; max-width: 640px; margin: 0 auto; position: relative; }

.splash { flex: 1; display: flex; align-items: center; justify-content: center; }
.splash img { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; transform: scale(.96); } }

/* ---------- Structure d'écran ---------- */
.screen { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: calc(var(--safe-top) + 10px) 14px 10px;
  background: var(--bg); border-bottom: 1px solid var(--border);
  flex: none;
}
.topbar h1 { font-size: 20px; margin: 0; font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .sub { display: block; font-size: 13px; color: var(--muted); font-weight: 400; }
.scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; min-height: 0; }
.pad { padding: 20px 18px calc(var(--safe-bottom) + 24px); }

.icon-btn {
  width: 44px; height: 44px; flex: none; border-radius: 50%;
  border: none; background: transparent; color: var(--text);
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:active { background: var(--surface-high); }
.icon-btn svg { width: 24px; height: 24px; }

/* ---------- Boutons et champs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 22px; border-radius: 999px; border: none;
  background: var(--pink); color: #1A0010; font-weight: 700; font-size: 17px;
  width: 100%;
}
.btn:disabled { opacity: .5; }
.btn.secondary { background: var(--surface-high); color: var(--text); border: 1px solid var(--border); }
.btn.ghost { background: transparent; color: var(--muted); font-weight: 500; min-height: 44px; }
.btn.danger { background: transparent; border: 1px solid var(--danger); color: var(--danger); }
.btn.small { min-height: 40px; font-size: 15px; padding: 0 16px; width: auto; }
.btn.google { background: #fff; color: #1f1f1f; }
.btn.google img, .btn.google svg { width: 22px; height: 22px; }

label.field { display: block; margin-bottom: 16px; }
label.field > span { display: block; font-size: 14px; color: var(--muted); margin: 0 0 6px 4px; }
.input, select.input, textarea.input {
  width: 100%; min-height: 50px; padding: 12px 16px;
  border-radius: 14px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 16px;
  outline: none; appearance: none; -webkit-appearance: none;
}
select.input { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 22px) 22px, calc(100% - 16px) 22px; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 40px; }
.input:focus { border-color: var(--pink); }
.input:disabled { opacity: .55; }
.error { color: var(--danger); font-size: 15px; margin: 4px 4px 12px; }
.hint { color: var(--muted); font-size: 14px; }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 10px 4px; font-size: 15px; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--pink); flex: none; }

.locked-field {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 50px; padding: 0 16px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--border); font-weight: 600;
}
.locked-field small { color: var(--cyan); font-weight: 500; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.chip {
  flex: none; min-height: 40px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-weight: 600;
}
.chip[aria-pressed="true"] { border-color: var(--pink); color: var(--pink); background: rgba(255,79,163,.14); }

/* ---------- Connexion ---------- */
.login { flex: 1; display: flex; flex-direction: column; padding: calc(var(--safe-top) + 40px) 24px calc(var(--safe-bottom) + 28px); }
.login .hero { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 14px; }
.login .hero img { border-radius: 28px; }
.login h1 { font-size: 40px; line-height: 1.05; margin: 8px 0 0; font-weight: 800; letter-spacing: -.5px; }
.login p { color: var(--muted); margin: 0; font-size: 17px; max-width: 360px; }
.login .actions { display: flex; flex-direction: column; gap: 12px; }
.login .legal { font-size: 13px; color: var(--muted); text-align: center; }
.install-tip {
  display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--border); font-size: 14px; color: var(--muted); text-align: left;
}
.install-tip svg { flex: none; width: 26px; height: 26px; color: var(--cyan); }

/* ---------- Lieux ---------- */
.city-bar { display: flex; align-items: center; gap: 8px; }
.city-btn { background: none; border: none; padding: 4px 0; display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 14px; }
.search { margin: 12px 14px 4px; position: relative; }
.search .input { padding-left: 44px; border-radius: 999px; }
.search svg { position: absolute; left: 15px; top: 14px; width: 22px; height: 22px; color: var(--muted); }
.section-title { font-size: 13px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); margin: 18px 18px 8px; }
.section-title.live { color: var(--online); }
.place {
  display: flex; align-items: center; gap: 14px; width: calc(100% - 28px); margin: 0 14px 10px;
  padding: 14px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface); text-align: left; color: var(--text);
}
.place.active { border-color: rgba(61,220,132,.45); }
.place .glyph { width: 46px; height: 46px; border-radius: 14px; flex: none; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 20px; background: var(--surface-high); color: var(--pink); }
.place .info { flex: 1; min-width: 0; }
.place .name { font-weight: 700; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.place .type { color: var(--muted); font-size: 14px; }
.place .count { flex: none; font-size: 14px; font-weight: 700; color: var(--online); display: inline-flex; align-items: center; gap: 6px; }
.place .count::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--online); }
.place .count.zero { color: var(--muted); font-weight: 500; }
.place .count.zero::before { background: var(--border); }
.place .here { font-size: 12px; color: var(--cyan); font-weight: 600; }
.empty { text-align: center; color: var(--muted); padding: 48px 24px; }
.fab {
  position: absolute; right: 18px; bottom: calc(var(--safe-bottom) + 18px);
  height: 56px; padding: 0 22px; border-radius: 999px; border: none;
  background: var(--pink); color: #1A0010; font-weight: 700; display: inline-flex; align-items: center; gap: 8px;
  box-shadow: 0 8px 24px rgba(255,79,163,.35);
}
.fab svg { width: 22px; height: 22px; }

/* ---------- Avatars ---------- */
.avatar {
  border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; color: #fff; text-transform: uppercase; user-select: none;
}
.people { display: flex; gap: 12px; overflow-x: auto; padding: 10px 14px; border-bottom: 1px solid var(--border); flex: none; }
.person { background: none; border: none; display: flex; flex-direction: column; align-items: center; gap: 4px; width: 60px; flex: none; padding: 0; color: var(--text); }
.person span { font-size: 12px; color: var(--muted); max-width: 60px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people .alone { color: var(--muted); font-size: 14px; padding: 8px 0; }

/* ---------- Onglets ---------- */
.tabs { display: flex; border-bottom: 1px solid var(--border); flex: none; }
.tab { flex: 1; min-height: 46px; background: none; border: none; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--pink); }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--pink); color: #1A0010; font-size: 12px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }

/* ---------- Messages ---------- */
.messages { flex: 1; overflow-y: auto; min-height: 0; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.welcome { align-self: center; text-align: center; font-size: 13px; color: var(--muted); background: var(--surface); border-radius: 12px; padding: 6px 12px; max-width: 90%; }
.msg { display: flex; gap: 8px; align-items: flex-end; max-width: 86%; }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg .col { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.msg.mine .col { align-items: flex-end; }
.msg .who { background: none; border: none; padding: 0 4px; font-size: 13px; font-weight: 700; text-align: left; }
.bubble { padding: 10px 14px; border-radius: 18px; background: var(--surface-high); white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; }
.msg.mine .bubble { background: var(--pink-deep); color: #fff; border-bottom-right-radius: 6px; }
.msg:not(.mine) .bubble { border-bottom-left-radius: 6px; }
.msg .time { font-size: 11px; color: var(--muted); padding: 0 6px; }
.gift-card { padding: 14px 18px; border-radius: 20px; background: linear-gradient(160deg, #2a1730, #1c1c25); border: 1px solid rgba(255,79,163,.4); text-align: center; min-width: 170px; }
.gift-card .emoji { font-size: 54px; line-height: 1.1; }
.gift-card .label { font-weight: 700; margin-top: 6px; }
.photo { position: relative; border-radius: 16px; overflow: hidden; background: var(--surface-high); border: none; padding: 0; display: block; max-width: 240px; }
.photo img { display: block; width: 100%; height: auto; }
.photo.masked img { filter: blur(22px) brightness(.6); }
.photo .reveal { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 14px; text-align: center; padding: 10px; }
.voice { display: flex; align-items: center; gap: 10px; padding: 8px 14px 8px 8px; border-radius: 999px; background: var(--surface-high); min-width: 180px; }
.msg.mine .voice { background: var(--pink-deep); }
.voice button { width: 40px; height: 40px; border-radius: 50%; border: none; background: rgba(255,255,255,.14); color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.voice .bar { flex: 1; height: 4px; border-radius: 2px; background: rgba(255,255,255,.2); overflow: hidden; }
.voice .bar i { display: block; height: 100%; width: 0; background: #fff; }
.voice .dur { font-size: 13px; font-variant-numeric: tabular-nums; }

/* ---------- Barre de saisie ---------- */
.composer { display: flex; align-items: flex-end; gap: 6px; padding: 8px 10px calc(var(--safe-bottom) + 8px); border-top: 1px solid var(--border); background: var(--bg); flex: none; }
.composer textarea { flex: 1; resize: none; min-height: 46px; max-height: 120px; border-radius: 23px; padding: 11px 16px; line-height: 1.4; }
.composer .send { width: 46px; height: 46px; border-radius: 50%; border: none; background: var(--pink); color: #1A0010; flex: none; display: inline-flex; align-items: center; justify-content: center; }
.composer .send svg, .composer .tool svg { width: 22px; height: 22px; }
.composer .tool { width: 44px; height: 46px; border: none; background: none; color: var(--muted); flex: none; display: inline-flex; align-items: center; justify-content: center; }
.composer .tool.rec { color: var(--danger); }
.recording { flex: 1; display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 0 14px; border-radius: 23px; background: var(--surface); color: var(--danger); font-weight: 600; }
.recording .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: pulse 1s infinite; }
.uploading { padding: 8px 16px; font-size: 14px; color: var(--muted); background: var(--surface); flex: none; }

/* ---------- Discussions privées ---------- */
.chat-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border: none; background: none; text-align: left; color: var(--text); border-bottom: 1px solid var(--border); }
.chat-row .info { flex: 1; min-width: 0; }
.chat-row .name { font-weight: 700; }
.chat-row .last { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-row.unread .last { color: var(--text); font-weight: 600; }

/* ---------- Profil ---------- */
.profile-head { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 24px 0 8px; }
.profile-head .pseudo { font-size: 26px; font-weight: 800; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 16px; margin: 18px 0; }
.card h2 { font-size: 15px; color: var(--pink); margin: 12px 0 4px; }
.row { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.row:first-of-type { border-top: none; }
.row span:first-child { color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 12px; }

/* ---------- Fenêtres ---------- */
#overlay:empty { display: none; }
.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  width: 100%; max-width: 640px; max-height: 88dvh; overflow-y: auto;
  background: var(--surface-high); border-radius: 26px 26px 0 0;
  padding: 10px 20px calc(var(--safe-bottom) + 22px);
  animation: up .2s ease-out;
}
.sheet::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--border); margin: 0 auto 14px; }
.sheet h2 { margin: 4px 0 6px; font-size: 22px; }
.sheet p { color: var(--muted); margin: 0 0 16px; }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
.gift-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 8px 0 14px; }
.gift-opt { border: 1px solid var(--border); background: var(--surface); border-radius: 18px; padding: 14px 6px; display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--text); font-size: 13px; text-align: center; }
.gift-opt .emoji { font-size: 38px; }
.gift-opt[aria-pressed="true"] { border-color: var(--pink); background: rgba(255,79,163,.12); }
.reasons { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.reason { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); }
.reason input { accent-color: var(--pink); width: 20px; height: 20px; }
.lightbox { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.94); display: flex; align-items: center; justify-content: center; padding: 20px; }
.lightbox img { max-height: 100%; object-fit: contain; }

#toast {
  position: fixed; left: 50%; top: calc(var(--safe-top) + 70px); transform: translateX(-50%);
  background: #2b2b36; color: var(--text); padding: 12px 18px; border-radius: 14px; font-size: 15px;
  z-index: 80; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 90%; text-align: center;
}
#toast.show { opacity: 1; }
.spinner { width: 22px; height: 22px; border: 3px solid rgba(255,255,255,.2); border-top-color: var(--pink); border-radius: 50%; animation: spin .8s linear infinite; margin: 30px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
