/* ==========================================================================
   Check-in — the hidden "other room". Shares Honeydrop's tokens (styles.css)
   so it feels like the same world, just a quieter one.
   ========================================================================== */

/* the whole check-in lives in a full-screen overlay on the homepage */
#checkin-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: var(--espresso);
  color: var(--cream);
  overflow-y: auto;
}
body.checkin-open { overflow: hidden; }

/* ---- identity / PIN gate ---- */
.gate {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background: radial-gradient(circle at 50% 20%, #3a2a20, #1a120c);
  padding: 1.5rem;
}
.gate-card {
  width: min(100%, 400px);
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius);
  padding: 2rem 1.8rem;
  text-align: center;
}
.gate-card h1 { font-size: 1.6rem; color: var(--cream); }
.gate-card p { color: rgba(255,255,255,.6); font-size: .9rem; }
.who-row { display: flex; gap: 1rem; margin: 1.5rem 0 .5rem; }
.who-btn {
  flex: 1; background: rgba(255,255,255,.05); border: 2px solid transparent;
  border-radius: var(--radius-s); padding: 1.2rem .8rem; cursor: pointer; color: var(--cream);
  transition: border-color .2s, background .2s, transform .12s;
}
.who-btn:hover { transform: translateY(-3px); }
.who-btn.sel { border-color: var(--honey); background: rgba(232,163,61,.12); }
.who-btn img { width: 56px; height: 56px; margin: 0 auto .5rem; }
.who-btn b { display: block; font-family: var(--font-display); }
.pin-row { margin-top: 1rem; display: none; }
.pin-row.show { display: block; }
.pin-row input {
  width: 100%; text-align: center; letter-spacing: .4em; font-size: 1.3rem;
  padding: .7rem; border-radius: var(--radius-s); border: 1px solid rgba(255,255,255,.15);
  background: rgba(0,0,0,.25); color: var(--cream);
}
.gate .btn { margin-top: 1.2rem; width: 100%; justify-content: center; background: var(--honey); color: var(--espresso); }
.gate-err { color: var(--rose); font-size: .85rem; min-height: 1.2em; margin-top: .5rem; }
.gate-exit { margin-top: 1rem; font-size: .8rem; color: rgba(255,255,255,.4); background: none; border: 0; cursor: pointer; }

/* ---- split layout ---- */
.split { display: grid; grid-template-rows: 1fr 1fr; height: 100vh; }
.pane { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1.5rem; text-align: center; transition: background .3s; }
.pane-tifajan { background: radial-gradient(circle at 50% 30%, #3d4767, #262d45); }
.pane-you  { background: radial-gradient(circle at 50% 70%, #4a3628, #241a12); }
.pane.is-me { box-shadow: inset 0 0 0 3px rgba(232,163,61,.35); }

.pane .avatar { width: 84px; height: 84px; margin-bottom: .6rem; filter: drop-shadow(0 6px 14px rgba(0,0,0,.35)); }
.pane .name { font-family: var(--font-display); font-size: 1.3rem; display: flex; align-items: center; gap: .5rem; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #6b6b6b; display: inline-block; transition: background .3s; }
.dot.online { background: #5ad07a; box-shadow: 0 0 0 4px rgba(90,208,122,.2); }

.status-bubble {
  margin-top: 1rem; max-width: min(92vw, 44ch);
  max-height: 42vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: .55rem; align-items: stretch;
  font-size: 1.05rem; min-height: 1.2em; line-height: 1.4;
}
.status-bubble:empty::before { content: "—"; }

/* grouped update layout (also used in history) */
.stat-group { display: flex; flex-wrap: wrap; align-items: baseline; gap: .35rem .5rem; }
.status-bubble .stat-group { justify-content: center; }
.grp-label {
  font-size: .66rem; text-transform: uppercase; letter-spacing: .09em; font-weight: 700;
  color: rgba(255,255,255,.5); flex: 0 0 auto; padding-top: .15rem;
}
.grp-chips { display: inline-flex; flex-wrap: wrap; gap: .35rem; }
.note-line {
  font-style: italic; color: var(--cream); background: rgba(232,163,61,.16);
  padding: .45rem .75rem; border-radius: 12px; display: flex; gap: .35rem;
  overflow-wrap: anywhere;
}
.note-line .emoji { font-style: normal; }
.chip-mini {
  display: inline-flex; align-items: center; gap: .35rem;
  background: rgba(255,255,255,.09); border-radius: 14px; padding: .4rem .8rem;
  font-size: .92rem; max-width: 100%;
  white-space: normal; overflow-wrap: anywhere; text-align: left;
}
.chip-mini .emoji { font-size: 1.1rem; flex: 0 0 auto; }
.chip-mini.heart { background: rgba(217,140,154,.2); }
.chip-mini.note { background: rgba(232,163,61,.18); font-style: italic; }
.status-meta { margin-top: .7rem; font-size: .8rem; color: rgba(255,255,255,.55); }

.pane-me-actions { margin-top: 1.2rem; }
.check-btn {
  background: var(--honey); color: var(--espresso); border: 0; border-radius: 999px;
  padding: .8rem 1.6rem; font-weight: 700; font-family: var(--font-body); cursor: pointer;
  font-size: .95rem; transition: transform .12s, box-shadow .2s;
}
.check-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-s); }
.switch-link {
  display: block; margin: .8rem auto 0; background: none; border: 0;
  color: rgba(255,255,255,.55); font-size: .82rem; cursor: pointer;
  font-family: var(--font-body); text-decoration: underline;
}
.switch-link:hover { color: var(--cream); }

/* prominent red Exit — always on top, one tap leaves everything */
.leave {
  position: fixed; top: 1rem; right: 1rem; z-index: 120;
  background: #e5484d; border: 0; color: #fff;
  padding: .55rem 1rem; border-radius: 999px; cursor: pointer;
  font-family: var(--font-body); font-size: .85rem; font-weight: 800; letter-spacing: .02em;
  box-shadow: 0 6px 16px -6px rgba(0,0,0,.55);
}
.leave:hover { background: #d13b40; }
.leave:active { transform: scale(.96); }

/* ---- top-left toolbar (labeled buttons) ---- */
.ci-toolbar { position: fixed; top: 1rem; left: 1rem; z-index: 30; display: flex; flex-direction: column; gap: .5rem; }
.ci-tool {
  display: inline-flex; align-items: center; gap: .45rem;
  background: rgba(0,0,0,.32); border: 1px solid rgba(255,255,255,.15); color: var(--cream);
  border-radius: 999px; padding: .5rem .9rem; cursor: pointer;
  font-family: var(--font-body); font-size: .82rem; font-weight: 600; white-space: nowrap;
  transition: background .2s, transform .12s;
}
.ci-tool:hover { background: rgba(255,255,255,.12); transform: translateY(-1px); }
.ci-ico { font-size: 1.05rem; line-height: 1; }
@media (max-width: 520px) { .ci-tool { font-size: .74rem; padding: .45rem .7rem; } }

/* ---- messages (chat) ---- */
.msgs { position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column; background: radial-gradient(circle at 50% 0%, #241a12, #140d07); }
.msg-list { flex: 1; overflow-y: auto; padding: 1.2rem; display: flex; flex-direction: column; gap: .7rem; width: min(100%, 680px); margin-inline: auto; }
.msg-empty { color: rgba(255,255,255,.5); text-align: center; margin: auto; }
.msg { display: flex; align-items: flex-end; gap: .5rem; max-width: 82%; }
.msg.them { align-self: flex-start; }
.msg.mine { align-self: flex-end; flex-direction: row; }
.msg-av { width: 28px; height: 28px; flex: 0 0 auto; }
.bubble { padding: .55rem .8rem; border-radius: 16px; font-size: .95rem; line-height: 1.4; overflow-wrap: anywhere; }
.msg.them .bubble { border-bottom-left-radius: 5px; }
.msg.mine .bubble { border-bottom-right-radius: 5px; }
/* colour by who sent it (consistent no matter who's looking): bee = honey, elephant = blue */
.msg[data-side="you"] .bubble { background: var(--honey); color: var(--espresso); }
.msg[data-side="tifajan"] .bubble { background: #6b76a8; color: #fff; }
.msg-txt { display: block; }
.msg-time { display: block; font-size: .65rem; opacity: .6; margin-top: .25rem; text-align: right; }
.msg-input { display: flex; gap: .5rem; padding: .8rem 1rem calc(.8rem + env(safe-area-inset-bottom)); border-top: 1px solid rgba(255,255,255,.1); width: min(100%, 680px); margin-inline: auto; box-sizing: border-box; }
.msg-input input {
  flex: 1; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); color: var(--cream);
  border-radius: 999px; padding: .7rem 1rem; font-size: .95rem; font-family: var(--font-body);
}
.msg-input input:focus { outline: none; border-color: var(--honey); }
.msg-send { background: var(--honey); color: var(--espresso); border: 0; border-radius: 999px; padding: .7rem 1.2rem; font-weight: 700; font-family: var(--font-body); cursor: pointer; }

/* history list */
.hist-list { list-style: none; margin: 0 auto; padding: 0; max-width: 460px; }
.hist-item { display: flex; align-items: center; gap: .8rem; padding: .8rem 0; border-bottom: 1px solid rgba(255,255,255,.08); }
.hist-av { width: 34px; height: 34px; flex: 0 0 auto; }
.hist-main { flex: 1; }
.hist-chips { display: flex; flex-direction: column; gap: .4rem; }
.hist-chips .stat-group { justify-content: flex-start; }
.hist-time { font-size: .78rem; color: rgba(255,255,255,.5); margin-top: .3rem; }
.hist-empty { color: rgba(255,255,255,.5); text-align: center; padding: 2rem 0; list-style: none; }

/* ---- composer (multi-select, full-screen) ---- */
.composer, .story {
  position: fixed; inset: 0; z-index: 70;
  display: flex; flex-direction: column;
  background: radial-gradient(circle at 50% 0%, #2a1e14, #170f09);
}
.composer-head, .story-head {
  padding: 1.4rem 1.3rem .9rem; text-align: center; position: relative;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.composer-head h2, .story-head h2 { color: var(--cream); font-size: 1.4rem; margin-bottom: .2rem; }
.composer-head p { color: rgba(255,255,255,.55); font-size: .88rem; margin: 0; }
/* panel back/close sits top-LEFT so it never collides with the red Exit */
.composer-close {
  position: absolute; top: 1rem; left: 1rem;
  background: rgba(255,255,255,.12); border: 0; color: var(--cream);
  width: 36px; height: 36px; border-radius: 50%; cursor: pointer; font-size: 1rem;
}

.composer-body { flex: 1; overflow-y: auto; padding: 1.2rem 1.3rem 1.5rem; width: min(100%, 620px); margin-inline: auto; }
.composer-section { margin-bottom: 1.6rem; }
.composer-section h3 { color: var(--honey); font-family: var(--font-body); font-weight: 600; font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; margin: 0 0 .7rem; }

.chip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .6rem; }
.chip {
  display: flex; align-items: center; gap: .5rem; text-align: left;
  background: rgba(255,255,255,.05); border: 1.5px solid rgba(255,255,255,.1);
  color: var(--cream); border-radius: 14px; padding: .8rem .9rem; cursor: pointer;
  font-size: .95rem; font-family: var(--font-body); transition: background .15s, border-color .15s, transform .1s;
}
.chip:hover { background: rgba(255,255,255,.09); }
.chip:active { transform: scale(.97); }
.chip .emoji { font-size: 1.25rem; }
.chip.on { border-color: var(--honey); background: rgba(232,163,61,.16); }

/* free-text little note */
.note-input {
  width: 100%; margin-top: .7rem; box-sizing: border-box;
  background: rgba(255,255,255,.05); border: 1.5px solid rgba(255,255,255,.12);
  color: var(--cream); border-radius: 14px; padding: .8rem 1rem;
  font-size: .95rem; font-family: var(--font-body);
}
.note-input:focus { outline: none; border-color: var(--honey); }
.note-input::placeholder { color: rgba(255,255,255,.4); }

/* hearts — the whole box is tappable */
.hearts-row { display: flex; align-items: center; gap: 1rem; background: rgba(217,140,154,.1); border: 1px solid rgba(217,140,154,.25); border-radius: 16px; padding: 1rem 1.1rem; cursor: pointer; user-select: none; transition: background .15s; }
.hearts-row:hover { background: rgba(217,140,154,.16); }
.hearts-row:active { transform: scale(.99); }
.heart-face { font-size: 2rem; line-height: 1; }
.heart-face.pop { animation: pop .28s ease; }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.5); } 100% { transform: scale(1); } }
.hearts-count { color: var(--cream); font-size: .95rem; }
.hearts-count b { font-family: var(--font-display); font-size: 1.6rem; color: var(--rose); }
.hearts-count span { display: block; font-size: .78rem; color: rgba(255,255,255,.55); }
.heart-reset { margin-left: auto; background: none; border: 0; color: rgba(255,255,255,.5); cursor: pointer; font-size: .82rem; text-decoration: underline; }

.composer-foot {
  border-top: 1px solid rgba(255,255,255,.08); padding: .9rem 1.3rem 1.4rem;
  width: min(100%, 620px); margin-inline: auto;
}
.composer-preview { color: rgba(255,255,255,.7); font-size: .85rem; margin-bottom: .7rem; min-height: 1.2em; text-align: center; }
.composer-send { width: 100%; justify-content: center; background: var(--honey); color: var(--espresso); }
.composer-send:disabled { opacity: .45; cursor: not-allowed; }

/* ---- Our Story timeline ---- */
.story-body { flex: 1; overflow-y: auto; padding: 1.5rem 1.3rem 3rem; }
.timeline { list-style: none; margin: 0 auto; padding: 0; max-width: 460px; position: relative; }
.timeline::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; background: rgba(255,255,255,.14); transform: translateX(-50%); }
.tl-item { position: relative; width: 50%; box-sizing: border-box; padding: .6rem 1.4rem; }
.tl-item.left { left: 0; text-align: right; }
.tl-item.right { left: 50%; text-align: left; }
.tl-dot { position: absolute; top: 50%; width: 12px; height: 12px; border-radius: 50%; background: var(--honey); transform: translateY(-50%); }
.tl-item.left  .tl-dot { right: -6px; }
.tl-item.right .tl-dot { left: -6px; }
.tl-card { display: inline-flex; align-items: center; gap: .6rem; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); border-radius: 14px; padding: .6rem .9rem; }
.tl-emoji { font-size: 1.6rem; line-height: 1; }
.tl-label { color: rgba(255,255,255,.8); font-size: .9rem; }

@media (min-width: 760px) {
  /* on wider screens, a true left/right split reads nicely */
  .split { grid-template-rows: none; grid-template-columns: 1fr 1fr; }
}

/* ---- story: era headers ---- */
.tl-era { position: relative; width: 100%; text-align: center; margin: 1.5rem 0 .5rem; padding: 0; }
.tl-era::before { content: none; }
.tl-era span {
  position: relative; z-index: 1; display: inline-block;
  background: var(--honey); color: var(--espresso);
  font-family: var(--font-body); font-weight: 700; font-size: .72rem;
  letter-spacing: .16em; text-transform: uppercase; padding: .35rem 1rem; border-radius: 999px;
}

/* ---- story: photo upload + gallery ---- */
.photo-controls { max-width: 460px; margin: 0 auto 1rem; display: flex; align-items: center; gap: .8rem; }
.photo-add {
  background: var(--honey); color: var(--espresso); border: 0; border-radius: 999px;
  padding: .6rem 1.1rem; font-weight: 700; font-family: var(--font-body); font-size: .9rem; cursor: pointer;
  transition: transform .12s, box-shadow .2s;
}
.photo-add:hover { transform: translateY(-1px); box-shadow: var(--shadow-s); }
.photo-status { font-size: .82rem; color: rgba(255,255,255,.6); }

.photo-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: .5rem; max-width: 460px; margin: 0 auto 1.6rem;
}
.photo-item {
  position: relative; background: rgba(255,255,255,.06);
  border-radius: 12px; overflow: hidden; aspect-ratio: 1; cursor: zoom-in;
}
.photo-item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s ease; }
.photo-item:hover img { transform: scale(1.06); }
.photo-del {
  position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%;
  border: 0; cursor: pointer; background: rgba(0,0,0,.55); color: #fff; font-size: .75rem; line-height: 1;
  opacity: 0; transition: opacity .15s;
}
.photo-item:hover .photo-del, .photo-del:focus { opacity: 1; }
.photo-empty { max-width: 420px; margin: 0 auto 1.4rem; text-align: center; color: rgba(255,255,255,.55); font-size: .88rem; }
.photo-empty code { background: rgba(255,255,255,.1); padding: .1rem .35rem; border-radius: 6px; }

/* ---- story: photo viewer (above the overlay) ---- */
.ci-lightbox { position: fixed; inset: 0; z-index: 90; background: rgba(10,7,4,.92); display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.ci-lightbox-inner { max-width: 100%; max-height: 100%; cursor: zoom-out; display: flex; }
.ci-lightbox img { max-width: 92vw; max-height: 88vh; border-radius: var(--radius-s); box-shadow: var(--shadow); }

/* ---- photo delete: two-step confirm ---- */
.photo-confirm {
  position: absolute; inset: 0; z-index: 2; background: rgba(20,14,9,.88);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .5rem; padding: .4rem; text-align: center; color: var(--cream); font-size: .78rem;
}
.pc-actions { display: flex; gap: .4rem; }
.pc-btn { border: 0; border-radius: 999px; padding: .35rem .7rem; font-size: .78rem; font-weight: 700; cursor: pointer; font-family: var(--font-body); }
.pc-yes { background: var(--rose); color: #2b1620; }
.pc-no { background: rgba(255,255,255,.16); color: var(--cream); }
