:root {
  color-scheme: light;
  --ink: #111827;
  --muted: #667085;
  --line: #e5e7eb;
  --panel: #ffffff;
  --blue: #159fe1;
  --red: #f04c55;
  --shadow: 0 18px 50px rgba(16, 24, 40, .08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: #eef1f5; }
body { min-height: 100%; margin: 0; color: var(--ink); }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

.home-body { background: #dce6f7; }
.home-shell {
  position: relative;
  overflow: hidden;
  width: min(100%, 680px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 34px 28px calc(50px + env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 8% 0%, rgba(255,255,255,.72) 0 58px, transparent 59px),
    radial-gradient(circle at 92% 7%, rgba(255,255,255,.42) 0 78px, transparent 79px),
    linear-gradient(180deg, #e7eefb 0%, #dfe9fa 100%);
}
.home-shell::after {
  position: absolute;
  right: -110px;
  bottom: 8%;
  width: 250px;
  height: 250px;
  border: 38px solid rgba(255,255,255,.18);
  border-radius: 50%;
  content: '';
  pointer-events: none;
}
.lookup-card { position: relative; z-index: 1; text-align: center; }
.home-mark {
  display: grid;
  width: clamp(132px, 30vw, 176px);
  height: clamp(132px, 30vw, 176px);
  margin: 0 auto 34px;
  place-items: center;
  color: white;
  border: 8px solid rgba(255,255,255,.84);
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 26%, rgba(255,255,255,.75) 0 11%, transparent 12%),
    linear-gradient(145deg, #5bb8d7 8%, #6577bb 45%, #ed8d9e 100%);
  box-shadow: 0 20px 42px rgba(74, 102, 159, .2), inset 0 0 0 1px rgba(255,255,255,.4);
  font-size: clamp(48px, 11vw, 68px);
  font-weight: 900;
  text-shadow: 0 3px 8px rgba(30, 45, 82, .18);
}
.lookup-card h1 { margin: 0; color: #26384d; font-size: clamp(34px, 7vw, 48px); letter-spacing: .04em; }
.gradient-text {
  margin: 16px 0 38px;
  color: #77859b;
  font-size: clamp(15px, 3.5vw, 18px);
  font-weight: 600;
  letter-spacing: .02em;
}
.lookup-form {
  display: grid;
  grid-template-columns: minmax(130px, 34%) 1fr;
  max-width: 580px;
  margin: auto;
  text-align: left;
}
.lookup-form label {
  position: relative;
  display: flex;
  min-height: 68px;
  padding: 0 44px 0 20px;
  align-items: center;
  justify-content: center;
  border: 1px solid #d7ddea;
  border-radius: 12px 0 0 12px;
  color: #8d98aa;
  background: rgba(255,255,255,.94);
  font-size: clamp(15px, 3.7vw, 18px);
  font-weight: 600;
}
.lookup-form label::after {
  position: absolute;
  right: 18px;
  width: 9px;
  height: 9px;
  border-right: 2px solid #a9b2c0;
  border-bottom: 2px solid #a9b2c0;
  content: '';
  transform: translateY(-3px) rotate(45deg);
}
.lookup-form input {
  min-width: 0;
  border: 1px solid #d7ddea;
  border-left: 0;
  border-radius: 0 12px 12px 0;
  outline: 0;
  padding: 0 22px;
  color: #26384d;
  background: rgba(255,255,255,.94);
  font-size: 18px;
  font-weight: 600;
}
.lookup-form input:focus { border-color: #efa98d; box-shadow: inset 0 0 0 2px rgba(240,169,141,.1); }
.lookup-form button {
  grid-column: 1 / -1;
  width: 100%;
  min-height: 66px;
  margin: 18px auto 0;
  border: 0;
  border-radius: 10px;
  color: white;
  background: linear-gradient(135deg, #f0ad93, #f4bca6);
  box-shadow: 0 12px 28px rgba(199, 126, 96, .16);
  cursor: pointer;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: .04em;
  transition: transform .18s ease, box-shadow .18s ease;
}
.lookup-form button:hover { box-shadow: 0 16px 32px rgba(199, 126, 96, .24); transform: translateY(-1px); }
.lookup-form button:disabled { cursor: wait; opacity: .62; }
.form-error { grid-column: 1 / -1; min-height: 24px; margin: 10px 0 0; color: #d92d20; text-align: center; }
.result { margin-top: 30px; padding: 26px 22px 22px; border: 1px solid rgba(255,255,255,.72); border-radius: 20px; background: rgba(255,255,255,.45); box-shadow: 0 18px 45px rgba(70,91,132,.08); backdrop-filter: blur(8px); }
.result-title { margin: 0 0 8px; color: #d87f62; font-size: 22px; font-weight: 800; }
.result-note { margin: 0 auto 22px; color: #8b7180; font-size: 14px; font-weight: 600; }
.promo-url { display: block; overflow-wrap: anywhere; padding: 16px 14px; border: 1px solid rgba(215,221,234,.9); border-radius: 12px; color: #26384d; background: rgba(255,255,255,.84); font-size: clamp(18px, 4.8vw, 26px); font-weight: 800; text-decoration: none; }
.copy-button {
  margin: 18px 0 14px;
  padding: 13px 22px;
  border: 1px solid rgba(255,255,255,.8);
  border-radius: 10px;
  color: #d47b5f;
  background: rgba(255,255,255,.88);
  box-shadow: 0 7px 20px rgba(53,74,113,.08);
  cursor: pointer;
  font-size: 17px;
  font-weight: 800;
}
.today-pill {
  width: fit-content;
  margin: 0 auto 14px;
  padding: 7px 14px;
  border-radius: 999px;
  color: white;
  background: linear-gradient(135deg, #e89b7d, #f1b39a);
  font-size: 14px;
  box-shadow: 0 6px 16px rgba(199,126,96,.14);
}
.daily-stats {
  display: grid;
  overflow: hidden;
  border: 2px solid #efaa90;
  border-radius: 10px;
  background: rgba(255,255,255,.76);
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
}
.day-stat { display: flex; min-width: 0; padding: 10px 4px 9px; flex-direction: column; align-items: center; }
.day-stat + .day-stat { border-left: 2px solid #efaa90; }
.day-stat span { color: #34465b; font-size: clamp(13px, 3.3vw, 17px); font-weight: 800; }
.day-stat small { margin-top: 3px; color: #617087; font-size: 12px; font-weight: 700; }
.day-stat strong { color: #26384d; font-size: 29px; line-height: 1.15; }
.day-stat em { color: var(--muted); font-size: 11px; font-style: normal; }
.toast {
  position: fixed;
  z-index: 10;
  bottom: calc(24px + env(safe-area-inset-bottom));
  left: 50%;
  padding: 11px 18px;
  border-radius: 100px;
  color: white;
  background: rgba(17, 24, 39, .9);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 14px);
  transition: .2s ease;
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

html.landing-page { height: 100%; overflow: hidden; overscroll-behavior: none; }
.landing-body { position: fixed; inset: 0; width: 100%; height: 100%; overflow: hidden; background: #e9edf1; overscroll-behavior: none; }
.landing-shell { display: flex; overflow: hidden; width: min(100%, 640px); height: 100vh; height: 100dvh; min-height: 0; margin: auto; padding-bottom: calc(68px + env(safe-area-inset-bottom)); flex-direction: column; background: #f3f4f6; }
.landing-header {
  position: relative;
  z-index: 6;
  display: flex;
  height: clamp(50px, 7dvh, 64px);
  flex: 0 0 clamp(50px, 7dvh, 64px);
  padding: 0 20px;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.96);
  font-weight: 800;
  backdrop-filter: blur(12px);
}
.landing-site-title { overflow: hidden; max-width: 100%; color: #202b3c; font-size: 18px; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.landing-loading { padding: 90px 24px; color: var(--muted); text-align: center; }
.landing-loading.error-state { color: #d92d20; }
.landing-content { display: flex; overflow: hidden; min-height: 0; flex: 1; flex-direction: column; }
.cover-wrap { overflow: hidden; min-height: 0; flex: 0 0 auto; border: 1px solid #e9eaed; border-radius: 16px; background: white; box-shadow: 0 3px 12px rgba(16,24,40,.04); }
.cover-wrap img { display: block; width: 100%; height: clamp(230px, 42dvh, 430px); border-radius: 15px; background: #eef2f5; cursor: zoom-in; object-fit: cover; object-position: center; touch-action: manipulation; }
.chat-stream { display: flex; overflow-x: hidden; overflow-y: auto; min-height: 0; padding: clamp(8px, 1.7dvh, 18px) 16px; flex: 1; flex-direction: column; gap: 10px; overscroll-behavior: contain; scrollbar-width: none; }
.chat-stream::-webkit-scrollbar { display: none; }
.message-row { display: flex; min-height: 0; align-items: flex-start; gap: 9px; }
.message-row.incoming { flex: 0 0 auto; align-items: flex-start; }
.message-row.outgoing { justify-content: flex-end; }
.message-avatar { display: grid; width: 36px; height: 36px; flex: 0 0 36px; place-items: center; border-radius: 10px; color: white; background: #24b8ca; font-size: 15px; font-weight: 800; }
.message-stack { display: flex; max-width: min(84%, 480px); flex-direction: column; }
.promo-stack { width: 100%; max-width: 100%; }
.message-row.outgoing .message-stack { align-items: flex-end; }
.message-bubble { padding: clamp(10px, 1.7dvh, 16px) 18px; border: 1px solid #e9eaed; border-radius: 5px 17px 17px; background: white; box-shadow: 0 3px 12px rgba(16,24,40,.04); }
.promo-message { position: relative; display: flex; width: 100%; padding: clamp(10px, 1.8dvh, 17px) 18px clamp(15px, 2.5dvh, 24px); flex-direction: column; border-radius: 16px; }
.message-bubble h1 { margin: 0 0 clamp(7px, 1.7dvh, 20px); color: #202b3c; font-size: clamp(15px, 2.2dvh, 21px); font-weight: 600; line-height: 1.45; }
.message-text, .message-footer { margin: 0; color: #344054; font-size: clamp(12px, 1.75dvh, 16px); line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.message-links { display: grid; margin: clamp(12px, 1.8dvh, 18px) 0; align-content: start; gap: clamp(8px, 1.2dvh, 12px); }
.message-link { display: block; color: #24b8ca; font-size: clamp(13px, 2dvh, 19px); font-weight: 500; line-height: 1.5; text-align: center; text-decoration: underline; overflow-wrap: anywhere; }
.message-footer { flex: 0 0 auto; color: #4b5565; text-align: center; }
.message-time { display: block; margin: 7px 0 0; color: #a0a6b0; font-size: 11px; text-align: right; }
.promo-message .message-time { display: block; flex: 0 0 auto; margin: clamp(5px, 1.2dvh, 13px) 0 -9px; text-align: right; }
.promo-video-section { flex: 0 0 auto; margin-inline: -8px; padding: 8px; border: 1px solid #e3e6ea; border-radius: 16px; background: white; box-shadow: 0 3px 12px rgba(16,24,40,.05); }
.promo-video-heading { display: flex; margin: 2px 5px 10px; align-items: center; justify-content: space-between; gap: 12px; }
.promo-video-heading strong { color: #202b3c; font-size: 16px; }
.promo-video-heading span { color: #98a2b3; font-size: 11px; }
.promo-video-frame { position: relative; overflow: hidden; border-radius: 11px; background: #101828; }
.promo-video-section video { display: block; width: 100%; max-height: min(62dvh, 520px); background: #101828; object-fit: contain; }
.image-preview-popup { position: fixed; z-index: 120; inset: 0; display: grid; padding: 16px; place-items: center; }
.image-preview-backdrop { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; background: rgba(0,0,0,.88); backdrop-filter: blur(5px); }
.image-preview-content { position: relative; z-index: 1; display: grid; width: 100%; height: 100%; place-items: center; pointer-events: none; }
.image-preview-image { display: block; max-width: 100%; max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); border-radius: 8px; box-shadow: 0 20px 70px rgba(0,0,0,.42); object-fit: contain; pointer-events: auto; touch-action: pinch-zoom; }
.image-preview-close { position: fixed; z-index: 2; top: calc(14px + env(safe-area-inset-top)); right: 14px; display: grid; width: 38px; height: 38px; padding: 0; place-items: center; border: 1px solid rgba(255,255,255,.32); border-radius: 50%; color: white; background: rgba(0,0,0,.56); font-size: 28px; line-height: 1; pointer-events: auto; }
.video-fullscreen-button { position: absolute; z-index: 3; top: 10px; right: 10px; padding: 8px 11px; border: 1px solid rgba(255,255,255,.45); border-radius: 8px; color: white; background: rgba(16,24,40,.74); font-size: 12px; font-weight: 800; backdrop-filter: blur(5px); }
.video-fullscreen-button:active { background: rgba(16,24,40,.94); }
.video-locked-cover { position: absolute; z-index: 4; inset: 0; display: grid; place-items: center; color: white; background: rgba(16,24,40,.76); font-size: 16px; font-weight: 800; backdrop-filter: blur(5px); }
.video-popup { position: fixed; z-index: 100; inset: 0; display: grid; padding: 22px; place-items: center; }
.video-popup-backdrop { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; background: rgba(16,24,40,.62); backdrop-filter: blur(4px); }
.video-popup-card { position: relative; z-index: 1; width: min(100%, 420px); padding: 28px 24px 24px; border-radius: 18px; background: white; box-shadow: 0 24px 70px rgba(16,24,40,.28); text-align: center; }
.video-popup-card h2 { margin: 0 0 14px; color: #202b3c; font-size: 21px; }
.video-popup-card p { margin: 0; color: var(--popup-text-color, #1677ff); font-size: 15px; line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; }
.video-popup-content-link { --popup-accent: #24b8ca; display: block; padding: 16px 18px; border: 1px solid var(--popup-accent); border-radius: 12px; background: #f8fafb; text-decoration: none; transition: transform .18s ease, box-shadow .18s ease; }
.video-popup-content-link:hover { box-shadow: 0 9px 24px rgba(16,24,40,.1); transform: translateY(-1px); }
.video-popup-close { position: absolute; top: 10px; right: 11px; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; color: #667085; background: #f2f4f7; font-size: 23px; line-height: 1; }
.user-message { border-radius: 17px 5px 17px 17px; background: #dff5eb; }
.user-message .message-text { line-height: 1.55; }
.sent-image { display: block; width: min(100%, 270px); max-height: 340px; margin-top: 8px; border-radius: 9px; object-fit: cover; }
.sent-image:first-child { margin-top: 0; }
.sent-file { display: grid; min-width: 210px; margin-top: 8px; padding: 11px; border-radius: 9px; background: rgba(255,255,255,.74); grid-template-columns: auto 1fr; gap: 2px 9px; }
.sent-file span { grid-row: 1 / 3; align-self: center; font-size: 27px; }
.sent-file strong { overflow: hidden; color: #344054; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.sent-file small { color: #98a2b3; font-size: 10px; }
.attachment-preview { position: fixed; z-index: 10; bottom: calc(68px + env(safe-area-inset-bottom)); left: 50%; display: flex; overflow-x: auto; width: min(100%, 640px); padding: 9px 12px; gap: 7px; border-top: 1px solid #e8eaee; background: rgba(255,255,255,.98); transform: translateX(-50%); }
.attachment-chip { display: grid; min-width: 180px; padding: 7px 8px; align-items: center; border: 1px solid #e2e5e9; border-radius: 9px; background: #f8f9fa; grid-template-columns: auto 1fr auto; gap: 7px; }
.attachment-chip span { padding: 3px 5px; border-radius: 5px; color: #3b7f76; background: #e2f5f1; font-size: 10px; }
.attachment-chip strong { overflow: hidden; color: #667085; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.attachment-chip button { border: 0; color: #98a2b3; background: transparent; font-size: 18px; }
.attachment-menu { position: fixed; z-index: 11; bottom: calc(68px + env(safe-area-inset-bottom)); left: 50%; width: min(100%, 640px); padding: 14px; border-top: 1px solid #e5e7eb; background: rgba(255,255,255,.98); grid-template-columns: repeat(2, 1fr); gap: 10px; box-shadow: 0 -8px 24px rgba(16,24,40,.07); transform: translateX(-50%); }
.attachment-menu:not([hidden]) { display: grid; }
.attachment-menu button { display: flex; padding: 12px; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 10px; color: #475467; background: #f4f6f8; }
.attachment-menu button span { font-size: 22px; }
.attachment-menu button strong { font-size: 14px; }
.emoji-panel { position: fixed; z-index: 11; bottom: calc(68px + env(safe-area-inset-bottom)); left: 50%; width: min(100%, 640px); padding: 12px 14px; border-top: 1px solid #e5e7eb; background: rgba(255,255,255,.98); grid-template-columns: repeat(6, 1fr); gap: 8px; box-shadow: 0 -8px 24px rgba(16,24,40,.06); transform: translateX(-50%); }
.emoji-panel:not([hidden]) { display: grid; }
.emoji-panel button { padding: 7px 3px; border: 0; border-radius: 8px; background: #f6f7f8; font-size: 22px; }
.message-composer { position: fixed; z-index: 12; bottom: 0; left: 50%; display: grid; width: min(100%, 640px); min-height: 68px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); align-items: center; border-top: 1px solid #dde1e6; background: rgba(255,255,255,.98); box-shadow: 0 -8px 28px rgba(16,24,40,.05); grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 7px; transform: translateX(-50%); backdrop-filter: blur(12px); }
.composer-icon { display: grid; width: 36px; height: 36px; padding: 0; place-items: center; border: 0; border-radius: 9px; color: #4b5563; background: #f2f4f6; font-size: 20px; }
.composer-icon:hover { background: #e9edef; }
.message-input { min-width: 0; height: 42px; padding: 0 13px; border: 1px solid #e1e4e8; border-radius: 22px; outline: 0; color: #344054; background: #f6f7f8; }
.message-input:focus { border-color: #a6d8d0; background: white; box-shadow: 0 0 0 3px rgba(36,184,202,.08); }
.send-button { height: 38px; padding: 0 13px; border: 0; border-radius: 9px; color: white; background: #24b8ca; font-size: 13px; font-weight: 800; }
.visually-hidden { position: absolute !important; overflow: hidden; width: 1px !important; height: 1px !important; padding: 0 !important; border: 0 !important; margin: -1px !important; clip: rect(0,0,0,0); white-space: nowrap; }
.simple-page { display: grid; min-height: 100vh; padding: 24px; place-items: center; background: #f2f4f7; }
.simple-card { max-width: 420px; padding: 44px; border-radius: 20px; background: white; box-shadow: var(--shadow); text-align: center; }
.simple-icon { display: grid; width: 54px; height: 54px; margin: auto; place-items: center; border-radius: 50%; color: #d92d20; background: #fee4e2; font-size: 26px; font-weight: 900; }
.simple-card h1 { font-size: 25px; }
.simple-card p { color: var(--muted); line-height: 1.7; }
.simple-card a { color: #168aad; font-weight: 700; }

@media (max-width: 480px) {
  .home-shell { padding: 24px 16px calc(40px + env(safe-area-inset-bottom)); }
  .home-mark { margin-bottom: 26px; }
  .gradient-text { margin-bottom: 30px; }
  .lookup-form { grid-template-columns: minmax(112px, 34%) 1fr; }
  .lookup-form label { min-height: 60px; padding: 0 34px 0 10px; }
  .lookup-form label::after { right: 13px; }
  .lookup-form input { padding: 0 14px; font-size: 16px; }
  .lookup-form button { min-height: 58px; }
  .result { padding: 22px 10px 14px; }
  .result-title { font-size: 19px; }
  .result-note { font-size: 13px; }
  .daily-stats { gap: 0; }
  .day-stat span { font-size: 12px; }
  .day-stat small { font-size: 10px; }
  .day-stat strong { font-size: 26px; }
  .chat-stream { padding-right: 10px; padding-left: 10px; }
  .promo-message { padding-right: 12px; padding-left: 12px; }
}

@media (max-height: 720px) {
  .landing-shell { padding-bottom: calc(58px + env(safe-area-inset-bottom)); }
  .cover-wrap img { height: 38dvh; min-height: 210px; }
  .message-composer { min-height: 58px; padding-top: 7px; padding-bottom: calc(7px + env(safe-area-inset-bottom)); }
  .message-input { height: 38px; }
  .composer-icon { width: 32px; height: 32px; }
  .send-button { height: 34px; padding: 0 10px; }
}

@media (min-width: 720px) {
  .home-shell { margin-top: 22px; margin-bottom: 22px; min-height: calc(100vh - 44px); border-radius: 24px; box-shadow: var(--shadow); }
  .landing-shell { height: calc(100vh - 44px); height: calc(100dvh - 44px); margin-top: 22px; margin-bottom: 22px; border-radius: 22px; box-shadow: var(--shadow); }
}
