
:root {
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #201f21;
  background: #ebebec;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(circle at 15% 20%, #fff1db, transparent 38%),
    radial-gradient(circle at 90% 72%, #e2e4fc, transparent 42%),
    #ebebec;
}

button, input, textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  opacity: .55;
  cursor: wait;
}

[hidden] {
  display: none !important;
}

.desktop-bg {
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 18px;
}

.phone {
  width: min(100%, 465px);
  height: min(920px, calc(100dvh - 36px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: #f8f6f2;
  border: 1px solid #dedbd6;
  border-radius: 32px;
  overflow: hidden;
  box-shadow: 0 25px 80px #25252c2b;
}

.header {
  height: 74px;
  border-bottom: 1px solid #e9e5df;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: #f8f6f2;
}

.header-logo {
  font-size: 28px;
  letter-spacing: -1.7px;
  font-weight: 900;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: 60%;
}

#accountLabel {
  font-size: 12px;
  color: #77736c;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-button, .secondary {
  border: 1px solid #e4dfd6;
  border-radius: 13px;
  background: #fff;
  padding: 10px 12px;
  font-weight: 650;
  color: #514f4b;
}

.view {
  overflow: auto;
  padding: 21px 18px 30px;
  overscroll-behavior: contain;
}

.nav {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  gap: 3px;
  border-top: 1px solid #e9e5df;
  background: #fff;
  padding: 10px 12px max(12px, env(safe-area-inset-bottom));
}

.nav button {
  border: 0;
  border-radius: 15px;
  background: none;
  color: #77736e;
  font-size: 12px;
  font-weight: 700;
  min-height: 52px;
  padding: 9px 2px;
}

.nav button.active {
  background: #f1e9da;
  color: #171512;
}

.nav button.camera-tab {
  background: #f6c94b;
  color: #27241b;
  border-radius: 18px;
}

.nav button.camera-tab.active {
  background: #efbd29;
}

.page-title {
  font-weight: 880;
  letter-spacing: -.6px;
  font-size: 25px;
  margin: 0 0 7px;
}

.intro {
  font-size: 14px;
  color: #77726c;
  margin: 0 0 18px;
  line-height: 1.5;
}

.stack {
  display: grid;
  gap: 12px;
}

.moment, .person, .conversation, .panel,
.composer, .profile-panel {
  background: #fff;
  border: 1px solid #eeeae3;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 3px 12px #605c4808;
}

.moment-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px;
}

.avatar {
  width: 44px;
  height: 44px;
  background: #f4e8ca;
  border-radius: 15px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 18px;
  overflow: hidden;
  flex: none;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.name {
  font-weight: 800;
  font-size: 15px;
}

.sub {
  font-size: 12px;
  color: #8b857e;
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.moment-media {
  width: 100%;
  aspect-ratio: 4/5;
  max-height: 480px;
  background: #efede9;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.moment-media img, .moment-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.moment-caption {
  padding: 13px 16px;
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.moment-fallback {
  color: #8b857e;
  text-align: center;
  padding: 22px;
}

.person, .conversation {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  text-align: left;
  width: 100%;
  color: inherit;
}

.person-text, .conversation-text {
  flex: 1;
  min-width: 0;
}

.person .name, .conversation .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pill {
  border-radius: 999px;
  background: #f4ead2;
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 700;
  flex: none;
}

.ghost {
  background: transparent;
  border: 0;
  text-align: left;
  padding: 0;
}

.grid-actions {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  margin: 12px 0 0;
}

.primary {
  border: 0;
  background: #f4c747;
  border-radius: 15px;
  padding: 13px 16px;
  font-weight: 850;
  color: #242016;
}

.full {
  width: 100%;
}

.panel, .composer, .profile-panel {
  padding: 16px;
}

.empty {
  background: #fff;
  border-radius: 20px;
  color: #807b75;
  padding: 28px 18px;
  text-align: center;
  font-size: 14px;
  line-height: 1.6;
  border: 1px solid #eeeae3;
}

.camera-stage {
  position: relative;
  overflow: hidden;
  background: #242424;
  border-radius: 24px;
  aspect-ratio: 3/4;
  display: grid;
  place-items: center;
  color: white;
}

.camera-stage video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.camera-actions button {
  padding: 13px 10px;
}

.camera-note {
  font-size: 12px;
  color: #8b857e;
  line-height: 1.5;
  margin-top: 10px;
}

.composer {
  display: grid;
  gap: 13px;
}

.composer label, .login-screen label {
  display: grid;
  gap: 7px;
  font-size: 13px;
  font-weight: 750;
}

.composer input, .composer textarea,
.login-screen input {
  width: 100%;
  border: 1px solid #e6e1d9;
  background: #fbfaf8;
  border-radius: 14px;
  padding: 13px 14px;
  color: #25211d;
  outline: none;
}

.composer textarea {
  resize: vertical;
  min-height: 80px;
}

.composer input:focus, .composer textarea:focus,
.login-screen input:focus {
  border-color: #f1c34a;
}

.file-preview {
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  background: #f1eee9;
  border-radius: 18px;
}

.messages {
  display: grid;
  gap: 9px;
  margin: 15px 0;
}

.bubble {
  padding: 12px 14px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid #ece7df;
  max-width: 85%;
  justify-self: start;
  overflow-wrap: anywhere;
  font-size: 14px;
}

.bubble.mine {
  background: #f7d66b;
  border-color: #f2c959;
  justify-self: end;
}

.chat-compose {
  display: flex;
  gap: 9px;
}

.chat-compose input {
  flex: 1;
  min-width: 0;
  border-radius: 14px;
  border: 1px solid #dfdbd4;
  padding: 12px;
}

.chat-compose button {
  padding: 12px;
}

.section-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 15px;
}

.back {
  border: 0;
  background: #eae6e0;
  padding: 9px 12px;
  border-radius: 13px;
  font-size: 13px;
  font-weight: 800;
}

.profile-top {
  display: flex;
  gap: 13px;
  align-items: center;
}

.kv {
  border-top: 1px solid #efebe5;
  padding: 12px 0;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.kv span {
  color: #88827a;
}

.kv strong {
  max-width: 65%;
  word-break: break-word;
  text-align: right;
}

.login-screen {
  width: min(100%, 440px);
  background: #fff;
  border-radius: 30px;
  padding: 32px;
  box-shadow: 0 15px 50px #0002;
}

.login-mark {
  font-size: 36px;
  font-weight: 900;
  letter-spacing: -2px;
}

.login-screen h1 {
  font-size: 25px;
  letter-spacing: -.8px;
}

.login-screen p {
  line-height: 1.5;
  color: #7b746e;
}

.login-screen form {
  display: grid;
  gap: 14px;
  margin: 25px 0;
}

.login-screen small {
  color: #8c8782;
  line-height: 1.5;
  display: block;
}

#toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #282723;
  color: #fff;
  border-radius: 13px;
  padding: 11px 18px;
  max-width: 90vw;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
  z-index: 12;
  text-align: center;
}

#toast.visible {
  opacity: 1;
}

#toast.error {
  background: #8b2931;
}

/* LOCKET CAMERA */

.locket-camera {
  background: #fff;
  color: #111;
  min-height: 100%;
  padding: 10px 0 30px;
  text-align: center;
}

.camera-friends {
  display: inline-block;
  padding: 11px 19px;
  background: #f0f0f0;
  color: #111;
  border-radius: 40px;
  font-size: 15px;
  font-weight: 750;
}

.camera-title {
  margin: 42px 0 38px;
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -1px;
  font-family: "Comic Sans MS", cursive, sans-serif;
}

.locket-camera .camera-stage {
  width: 100%;
  aspect-ratio: 1 / 1.08;
  position: relative;
  overflow: hidden;
  border-radius: 65px;
  background: #171717;
  margin: auto;
  display: block;
}

.locket-camera .camera-stage video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.camera-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 14px;
}

.camera-flash, .camera-zoom {
  position: absolute;
  top: 24px;
  padding: 9px 11px;
  background: #ffffff55;
  color: #fff;
  border-radius: 30px;
  font-weight: 800;
  font-size: 13px;
}

.camera-flash {
  left: 24px;
}

.camera-zoom {
  right: 24px;
}

.camera-bottom {
  display: flex;
  align-items: center;
  justify-content: space-around;
  margin-top: 85px;
  gap: 18px;
}

.camera-side {
  background: transparent;
  border: 0;
  color: #111;
  font-size: 13px;
  font-weight: 800;
  padding: 12px 3px;
}

.camera-shutter {
  flex: 0 0 auto;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 5px solid #929292;
  background: #101013;
  box-shadow: inset 0 0 0 4px #fff;
  transition: transform .15s ease;
}

.camera-shutter:active {
  transform: scale(.92);
}

.camera-video-actions {
  margin-top: 18px;
}

.camera-video-actions button {
  background: #f0f0f0;
  border: 0;
  border-radius: 30px;
  padding: 11px 22px;
  font-weight: 750;
  color: #111;
}

.camera-history {
  margin: 55px 0 12px;
  font-size: 16px;
  font-weight: 800;
}

#composerMount {
  text-align: left;
}

/* MOBILE */

@media (max-width: 550px) {
  .desktop-bg {
    padding: 0;
  }

  .phone {
    width: 100%;
    height: 100dvh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .login-screen {
    min-height: 100dvh;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .moment-media {
    max-height: unset;
  }

  .view {
    padding: 18px 13px 28px;
  }

  .header {
    height: 65px;
    padding: 0 16px;
  }

  .nav {
    padding-left: 7px;
    padding-right: 7px;
  }

  .camera-title {
    margin: 32px 0;
  }

  .locket-camera .camera-stage {
    border-radius: 55px;
  }

  .camera-bottom {
    margin-top: 65px;
  }
}

/* Màn hình xem trước và đăng Locket */

.locket-post-screen {
  background: #fff;
  color: #171717;
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.post-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 5px 22px;
}

.post-header strong {
  font-size: 17px;
  font-weight: 850;
}

.post-header button {
  background: #f0f0f0;
  border: 0;
  padding: 11px 15px;
  border-radius: 25px;
  font-weight: 750;
  color: #171717;
}

.post-header span {
  width: 75px;
}

.post-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 20px;
}

.post-media {
  width: 100%;
  aspect-ratio: 1 / 1.08;
  border-radius: 48px;
  overflow: hidden;
  background: #171717;
}

.post-media img,
.post-media video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-caption {
  display: grid;
  gap: 10px;
  padding: 4px 2px;
  text-align: left;
}

.post-caption label {
  font-weight: 800;
  font-size: 15px;
}

.post-caption input {
  width: 100%;
  background: #f4f4f4;
  border: 1px solid #e8e8e8;
  color: #111;
  border-radius: 18px;
  padding: 16px;
  font-size: 15px;
  outline: none;
}

.post-caption input:focus {
  border-color: #f2c443;
}

.post-footer {
  margin-top: auto;
  padding-bottom: 24px;
}

.post-submit {
  width: 100%;
  border: 0;
  padding: 17px;
  border-radius: 20px;
  background: #f7c844;
  color: #171717;
  font-size: 16px;
  font-weight: 850;
}

.post-submit:active {
  transform: scale(.98);
}

/* Camera record 60 seconds */

.locket-camera .camera-stage {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.record-progress {
  --progress: 0%;

  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  z-index: 5;

  background: conic-gradient(
    #f7c844 0 var(--progress),
    transparent var(--progress) 100%
  );

  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);

  -webkit-mask-composite: xor;
  mask-composite: exclude;

  padding: 6px;
}

.camera-stage.is-recording .record-progress {
  opacity: 1;
}

.record-time {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);

  background: rgba(0, 0, 0, .65);
  color: #fff;

  font-size: 14px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  border-radius: 30px;

  padding: 9px 15px;
  white-space: nowrap;

  z-index: 6;
  display: none;
}

.camera-stage.is-recording .record-time {
  display: block;
}

.camera-shutter {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  position: relative;
  transition: transform .18s ease;
}

.camera-shutter.is-recording {
  transform: scale(.88);
  background: #e84242;
}

.camera-shutter.is-recording::after {
  content: "";
  position: absolute;
  inset: 23px;
  border-radius: 7px;
  background: #fff;
}

.camera-video-actions,
#toggleRecord {
  display: none !important;
}

/* Camera layout corrections */
.locket-camera .camera-stage video { display:block; }
.locket-camera .camera-placeholder { z-index:2; background:#171717; }
.locket-camera .camera-history { background:transparent; border:0; color:#111; font:inherit; font-weight:800; cursor:pointer; }


/* Locket send screen: caption overlay and recipient selection */
.locket-send-screen{background:#fff;color:#171717;min-height:100%;padding:0 1px 20px;text-align:center}
.send-top{display:grid;grid-template-columns:1fr auto 1fr;align-items:center;gap:10px;margin:0 0 24px;min-height:46px}
.send-top strong{font-size:16px;font-weight:850}
.send-back,.send-download{background:#f3f3f3;border:0;color:#161616;border-radius:25px;padding:10px 12px;font-weight:750}
.send-back{justify-self:start}.send-download{justify-self:end}
.send-heading{font-family:"Comic Sans MS",cursive,sans-serif;font-size:25px;letter-spacing:-1px;margin:25px 0 25px;font-weight:900}
.send-form{display:flex;flex-direction:column;gap:15px}
.send-media{position:relative;aspect-ratio:1 / 1.04;overflow:hidden;background:#141414;border-radius:58px;max-width:100%}
.send-media img,.send-media video{display:block;width:100%;height:100%;object-fit:cover;transform:none!important}
.send-media input{position:absolute;left:50%;bottom:22px;transform:translateX(-50%);width:min(72%,310px);border:0;background:#0008;color:#fff;border-radius:28px;text-align:center;padding:12px 15px;font-weight:650;font-size:14px;outline:none}
.send-media input::placeholder{color:#fff;opacity:.85}
.send-media input:focus{background:#000b}
.send-media-info{color:#24b856;font-size:12px}
.send-submit{align-self:center;min-width:60%;max-width:100%;border:0;border-radius:22px;background:#f7c844;color:#121212;padding:16px 20px;font-weight:850;font-size:16px}
.recipient-caption{font-size:12px;color:#666;margin-top:2px}
.recipient-strip{display:flex;gap:12px;align-items:flex-start;overflow-x:auto;overscroll-behavior-x:contain;padding:7px 0 12px;scrollbar-width:thin}
.recipient-choice{width:69px;flex:0 0 69px;background:transparent;border:0;padding:0;display:flex;align-items:center;flex-direction:column;gap:7px;color:#242424;opacity:.67}
.recipient-choice.selected{opacity:1}
.recipient-avatar{width:55px;height:55px;display:grid;place-items:center;background:#eee;border:3px solid #d4d4d4;border-radius:50%;overflow:hidden;font-size:12px;font-weight:800}
.recipient-avatar img{width:100%;height:100%;object-fit:cover}
.recipient-choice.selected .recipient-avatar{border-color:#f3bd00;box-shadow:0 0 0 2px #fff inset}
.recipient-name{width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:11px;font-weight:750}
.recipient-loading{font-size:12px;color:#888;padding:18px 0;white-space:nowrap}
@media(max-width:550px){.send-heading{margin:18px 0 25px}.send-media{border-radius:52px}.send-top{margin-bottom:14px}}

/* Bảng tin và kho lưu trữ */
.feed-switch{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin:0 0 16px}
.feed-switch-btn{border:1px solid #e9e4dc;border-radius:16px;background:#fff;color:#524e47;font-weight:750;padding:12px 8px}
.feed-switch-btn.selected{background:#f4c747;border-color:#f4c747;color:#201f21}
.feed-more{margin-top:16px}

/* Locket viewers */

.moment-view-section {
  padding: 0 15px 15px;
}

.viewers-btn {
  border: 0;
  border-radius: 13px;
  background: #f4e9cd;
  color: #222;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 800;
}

.viewers-result {
  margin-top: 12px;
  font-size: 13px;
}

.viewer-row {
  padding: 12px;
  margin-top: 7px;
  border-radius: 13px;
  background: #f6f5f3;
  color: #222;
}
.logout-btn {
  width: 100%;
  margin-top: 18px;
  padding: 15px;
  background: #fff;
  color: #d93030;
  border: 1px solid #efdada;
  border-radius: 16px;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
}

.logout-btn:hover {
  background: #fff1f1;
}

.logout-btn:active {
  transform: scale(0.98);
}
.message-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
}

.message-item.mine {
  align-items: flex-end;
}

.recall-btn {
  background: transparent;
  border: 0;
  color: #c0392b;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.recall-btn:disabled {
  opacity: 0.5;
}