:root {
  --cream: #fbfaf2;
  --sky-top: #dff0e6;
  --sky-bot: #f3f7e4;
  --leaf: #7bb274;
  --leaf-deep: #4f8a52;
  --leaf-dark: #336b3c;
  --tomato: #e5644e;
  --tomato-soft: #f7d9d2;
  --honey: #f4c95d;
  --ink: #2f3a2f;
  --muted: #7d8a76;
  --line: #e4ead9;
  --mine: #fbe3db;
  --theirs: #ffffff;
  --shadow: 0 10px 30px rgba(79, 138, 82, 0.18);
}

/* --- LE FIX qui manquait : l'attribut hidden doit toujours gagner --- */
[hidden] {
  display: none !important;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  color: var(--ink);
  background: var(--cream);
}

button {
  font: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}
input {
  font: inherit;
}

/* ============================ PORTAIL ============================ */
.gate {
  position: relative;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: hidden;
  background: linear-gradient(180deg, var(--sky-top), var(--sky-bot));
}
.sky {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.sun {
  position: absolute;
  top: 28px;
  right: 30px;
  font-size: 46px;
  filter: drop-shadow(0 0 18px rgba(244, 201, 93, 0.6));
}
.bee-float {
  position: absolute;
  top: 22%;
  left: 14%;
  font-size: 30px;
  animation: fly 7s ease-in-out infinite;
}
@keyframes fly {
  0% { transform: translate(0, 0) rotate(-4deg); }
  25% { transform: translate(40px, -18px) rotate(6deg); }
  50% { transform: translate(80px, 6px) rotate(-3deg); }
  75% { transform: translate(30px, 20px) rotate(5deg); }
  100% { transform: translate(0, 0) rotate(-4deg); }
}

.gate-card {
  position: relative;
  z-index: 2;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(6px);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 34px 30px;
  width: 100%;
  max-width: 360px;
  box-shadow: var(--shadow);
  text-align: center;
}
.logo {
  font-size: 52px;
  line-height: 1;
}
.gate-card h1 {
  margin: 8px 0 2px;
  font-size: 32px;
  letter-spacing: 0.5px;
  color: var(--leaf-dark);
}
.sub {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 14px;
}

/* Le gros bouton tout simple pour Melissa */
.bee-btn {
  background: linear-gradient(145deg, var(--honey), #eab842);
  color: #5a4310;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 18px 28px;
  border-radius: 22px;
  box-shadow: 0 8px 20px rgba(234, 184, 66, 0.45);
  transition: transform 0.12s, box-shadow 0.12s, filter 0.12s;
  width: 100%;
}
.bee-btn:hover {
  filter: brightness(1.04);
}
.bee-btn:active {
  transform: translateY(2px) scale(0.99);
  box-shadow: 0 4px 12px rgba(234, 184, 66, 0.4);
}

.login-form {
  margin-top: 6px;
  text-align: left;
  animation: grow 0.35s ease;
}
@keyframes grow {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.login-form label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 14px;
}
.login-form input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 13px 14px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  outline: none;
  background: #fff;
  transition: border-color 0.15s;
}
.login-form input:focus {
  border-color: var(--leaf);
}
#login-btn {
  width: 100%;
  background: var(--leaf-deep);
  color: #fff;
  font-weight: 700;
  padding: 14px;
  border-radius: 16px;
  transition: filter 0.15s, transform 0.05s;
}
#login-btn:hover {
  filter: brightness(1.05);
}
#login-btn:active {
  transform: scale(0.99);
}
.error {
  color: var(--tomato);
  font-size: 13px;
  margin: 12px 0 0;
}

.garden-row {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1;
  font-size: 30px;
  letter-spacing: 6px;
  text-align: center;
  line-height: 1.1;
  padding: 10px 0 14px;
  background: linear-gradient(180deg, transparent, rgba(123, 178, 116, 0.28));
  white-space: nowrap;
  overflow: hidden;
}

/* ============================= CHAT ============================= */
.chat {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 720px;
  margin: 0 auto;
  background: linear-gradient(180deg, #f4f8ea, #eef4e2);
}
.top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  padding-top: max(14px, env(safe-area-inset-top));
  background: var(--leaf-deep);
  color: #fff;
  border-bottom: 3px solid var(--leaf-dark);
  position: sticky;
  top: 0;
  z-index: 5;
}
.top .title {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  flex: 1;
}
.top .title small {
  color: rgba(255, 255, 255, 0.85);
  font-size: 12px;
}
.top .ghost {
  color: #fff;
  font-size: 14px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.5);
}
.ghost:hover {
  background: rgba(255, 255, 255, 0.12);
}

.feed {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.day {
  align-self: center;
  font-size: 11px;
  color: var(--leaf-dark);
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--line);
  padding: 3px 12px;
  border-radius: 12px;
  margin: 6px 0;
}
.msg {
  max-width: 78%;
  padding: 9px 13px;
  border-radius: 18px;
  background: var(--theirs);
  box-shadow: 0 1px 3px rgba(79, 138, 82, 0.14);
  align-self: flex-start;
  border-bottom-left-radius: 6px;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.msg.mine {
  align-self: flex-end;
  background: var(--mine);
  border-bottom-left-radius: 18px;
  border-bottom-right-radius: 6px;
}
.msg .author {
  font-size: 11px;
  font-weight: 700;
  color: var(--leaf-deep);
  margin-bottom: 2px;
}
.msg.mine .author {
  display: none;
}
.msg .time {
  font-size: 10px;
  color: var(--muted);
  margin-top: 3px;
  text-align: right;
}
.msg img,
.msg video {
  max-width: 100%;
  border-radius: 12px;
  display: block;
  margin-bottom: 4px;
  cursor: pointer;
}
.msg .cap {
  margin-top: 2px;
}

/* --------------------------- Composer --------------------------- */
.preview {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--leaf-dark);
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.8);
  border-top: 1px solid var(--line);
}
.preview span {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.composer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.92);
  border-top: 1px solid var(--line);
}
.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 20px;
  background: #fff;
  border: 1px solid var(--line);
  flex: 0 0 auto;
}
.icon-btn:hover {
  background: #eef4e2;
}
.composer #text {
  flex: 1;
  min-width: 0;
  padding: 12px 16px;
  border-radius: 22px;
  border: 1.5px solid var(--line);
  outline: none;
  background: #fff;
}
.composer #text:focus {
  border-color: var(--leaf);
}
.send {
  background: var(--tomato);
  color: #fff;
  font-weight: 700;
}
.composer .send {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  padding: 0;
  font-size: 18px;
  flex: 0 0 auto;
}

/* ---------------------------- Caméra ---------------------------- */
.cam-modal {
  position: fixed;
  inset: 0;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.cam-modal video {
  width: 100%;
  max-width: 720px;
  max-height: 80vh;
  object-fit: contain;
}
.cam-actions {
  display: flex;
  gap: 14px;
  padding: 18px;
  padding-bottom: max(18px, env(safe-area-inset-bottom));
}
.cam-actions .ghost {
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.5);
  padding: 12px 22px;
  border-radius: 24px;
}
.cam-actions .send {
  width: auto;
  padding: 12px 28px;
  border-radius: 24px;
}
