/* To'y Taklifnoma browser demo: the guest's, the host's and the door checker's phones side by side (frame from days 1-3). */
:root {
  --ink: #0f2a33;
  --page: #efe9dc;
  --line: #ddd6c8;
  --muted: #6b7280;
  --accent: #e6c47a;
  --seal: #14965a;
  --font: -apple-system, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100dvh; background: var(--page); color: var(--ink); font: 15px/1.45 var(--font);
  background-image: radial-gradient(circle at 20% 0%, #f7f3ea 0, transparent 55%), radial-gradient(circle at 90% 30%, #e3ece6 0, transparent 45%);
}
button { font: inherit; cursor: pointer; }

/* top bar */
.demo-bar {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 20px; background: var(--ink); color: #fff;
}
.demo-logo { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-weight: 700; font-size: 17px; }
.demo-mark {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: #f5f3ee; color: #1d2330;
}
.demo-badge {
  display: inline-flex; align-items: center; gap: 8px; font-size: 13px; padding: 5px 12px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.08); color: #d9def0;
}
.demo-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(230, 196, 122, 0.25); }
.demo-date { font-size: 13px; color: #c5cbe3; font-variant-numeric: tabular-nums; }
.demo-tools { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.demo-btn {
  border: 1px solid rgba(255, 255, 255, 0.2); background: transparent; color: #fff; border-radius: 10px; padding: 6px 12px;
  font-size: 13.5px; font-weight: 600; text-decoration: none;
}
.demo-btn.solid { background: #fff; color: var(--ink); border-color: #fff; }
.demo-btn:hover { background: rgba(255, 255, 255, 0.1); }
.demo-btn.solid:hover { background: #e9ecf5; }

/* intro + story */
.demo-intro { max-width: 1040px; margin: 0 auto; padding: 22px 24px 4px; display: grid; gap: 6px; text-align: center; }
.demo-intro h1 { margin: 0; font-size: 26px; letter-spacing: -0.02em; }
.demo-intro p { margin: 0 auto; max-width: 720px; color: #4b5563; }
.story { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding: 14px 16px 0; }
.story-btn {
  display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: #fffdf8; color: var(--ink);
  border-radius: 999px; padding: 7px 14px 7px 8px; font-weight: 600; font-size: 14px; transition: background 0.15s, opacity 0.15s;
}
.story-btn b {
  display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--ink); color: #fff; font-size: 12.5px;
}
.story-btn.done { color: var(--muted); }
.story-btn.done b { background: var(--seal); }
.story-btn.next { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(20, 26, 38, 0.12); }
.story-btn:disabled { opacity: 0.5; cursor: default; }

/* stage with two phones */
.demo-stage {
  display: grid; grid-template-columns: repeat(3, minmax(0, 400px)); justify-content: center; align-items: start;
  gap: 36px; padding: 20px 24px 40px;
}
.side { display: grid; justify-items: center; gap: 12px; min-width: 0; }
.side-label { display: flex; align-items: baseline; gap: 8px; font-size: 15px; }
.side-label b { font-size: 18px; }
.side-label span { color: var(--muted); }
.who-switch { display: none; }

.phone {
  --ph: max(600px, min(844px, calc(100dvh - 170px)));
  position: relative; display: flex; flex-direction: column; height: var(--ph); width: calc(var(--ph) * 392 / 832);
  max-width: 100%; min-width: 0; border-radius: 56px; padding: 11px; background: #050506;
  box-shadow: 0 0 0 1.5px #5d6168, 0 0 0 3.5px #24262a, 0 0 0 4.5px #6e737b, inset 0 0 0 1px #1c1d20,
    0 50px 90px -35px rgba(20, 26, 51, 0.6), 0 18px 40px -20px rgba(0, 0, 0, 0.35);
  transition: box-shadow 0.3s;
}
.phone::before, .phone::after {
  content: ""; position: absolute; width: 4px; border-radius: 2px; background: linear-gradient(90deg, #3b3e44, #6e737b 50%, #3b3e44);
}
.phone::before { left: -8px; top: 18%; height: 7%; box-shadow: 0 calc(var(--ph) * 0.1) 0 #4d5157; }
.phone::after { right: -8px; top: 26%; height: 10%; }
.phone.ring {
  box-shadow: 0 0 0 1.5px #5d6168, 0 0 0 3.5px #24262a, 0 0 0 4.5px #6e737b, inset 0 0 0 1px #1c1d20,
    0 0 0 14px rgba(230, 196, 122, 0.35), 0 50px 90px -35px rgba(20, 26, 51, 0.6);
}
.phone-island {
  position: absolute; z-index: 6; top: 22px; left: 50%; transform: translateX(-50%); width: 31%; max-width: 118px;
  height: 30px; border-radius: 20px; background: #000;
}
.phone-island::after {
  content: ""; position: absolute; right: 11px; top: 10px; width: 10px; height: 10px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #2a3a55 0 25%, #0b0f18 60%);
}
.phone-status {
  flex: none; height: 46px; padding: 2px 28px 0 32px; display: flex; align-items: center; justify-content: space-between;
  border-radius: 45px 45px 0 0; background: #fffdf8; color: #111; font: 600 15px/1 var(--font); letter-spacing: -0.01em;
}
.phone-icons { display: flex; align-items: center; gap: 5px; }
.phone-icons svg { height: 11px; width: auto; fill: currentColor; }
.phone-batt { position: relative; width: 24px; height: 11.5px; border-radius: 3.5px; border: 1.3px solid currentColor; opacity: 0.9; }
.phone-batt::after {
  content: ""; position: absolute; right: -4px; top: 3px; width: 2px; height: 4px; border-radius: 0 1px 1px 0; background: currentColor;
}
.phone-batt i { position: absolute; inset: 1.5px; right: 22%; border-radius: 1.5px; background: currentColor; }
.phone-homebar {
  position: absolute; z-index: 6; left: 50%; bottom: 18px; transform: translateX(-50%); width: 34%; height: 5px;
  border-radius: 3px; background: #111; opacity: 0.45; pointer-events: none;
}
.phone-screen {
  position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; border-radius: 0 0 45px 45px;
  overflow: hidden; background: #fffdf8; transform: translateZ(0); /* keeps sheets and toasts inside the phone */
}

/* inside the phone: Bot / Mini App tabs */
.ptabs { flex: none; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 6px 12px 8px; background: #fffdf8; border-bottom: 1px solid #ece5d6; }
.ptab {
  position: relative; border: 0; background: transparent; padding: 7px; border-radius: 10px; font-weight: 650; font-size: 14px; color: #6b7280;
}
.ptab.on { background: #f0ebe0; color: #141a26; }
.ptab .badge {
  position: absolute; top: 4px; right: 18%; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: #e5484d; color: #fff; font-size: 11px; line-height: 18px; font-weight: 700;
}
.pane { flex: 1; min-height: 0; display: none; }
.pane.on { display: flex; flex-direction: column; }
.pane.app { overflow: auto; overscroll-behavior: contain; scrollbar-width: none; }
.pane.app::-webkit-scrollbar { display: none; }
.pane.app { position: relative; }
.pane.app > .inv, .pane.app > .dash, .pane.app > .door { flex: none; min-height: 100%; }
.pane.app .inv-card { margin-top: 54px; }

/* push banner that "lights up" a phone */
.push {
  position: absolute; z-index: 15; left: 10px; right: 10px; top: 6px; display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 12px; border-radius: 18px; background: rgba(250, 250, 250, 0.96); color: #111;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22); font-size: 13px; line-height: 1.35; cursor: pointer;
  transform: translateY(-140%); transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}
.push.show { transform: translateY(0); }
.push .tg-ava { width: 34px; height: 34px; font-size: 11px; flex: none; }
.push b { display: block; font-size: 13.5px; }
.push span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Telegram-like chat */
.tg-head { flex: none; display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: #fffdf8; border-bottom: 1px solid #ece5d6; }
.tg-head div { display: grid; line-height: 1.2; }
.tg-head small { color: #6b7280; font-size: 12.5px; }
.tg-ava {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: #0f4c4a; color: #e6c47a;
}
.tg-scroll {
  flex: 1; min-height: 0; overflow: auto; padding: 12px 10px 16px; display: flex; flex-direction: column; gap: 6px;
  background-color: #dfe8dc; scrollbar-width: none; overscroll-behavior: contain;
  background-image: radial-gradient(rgba(255, 255, 255, 0.35) 1px, transparent 1.4px), radial-gradient(rgba(0, 0, 0, 0.04) 1px, transparent 1.4px);
  background-size: 22px 22px, 22px 22px; background-position: 0 0, 11px 11px;
}
.tg-scroll::-webkit-scrollbar { display: none; }
.msg { max-width: 88%; display: grid; gap: 4px; align-self: flex-start; }
.msg.new { animation: msg-in 0.22s ease both; }
.msg.me { align-self: flex-end; }
.bubble {
  position: relative; background: #fff; border-radius: 16px 16px 16px 5px; padding: 8px 11px 18px; font-size: 14px; line-height: 1.42;
  white-space: pre-wrap; word-break: break-word; box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08); color: #111;
}
.msg.me .bubble { background: #e2f7cf; border-radius: 16px 16px 5px 16px; }
.bubble code { font: 12.5px ui-monospace, Consolas, monospace; background: rgba(51, 70, 196, 0.1); color: #2b3aa8; padding: 1px 4px; border-radius: 4px; }
.bubble a { color: #2f5bd3; word-break: break-all; }
.bubble time { position: absolute; right: 9px; bottom: 3px; font-size: 10.5px; color: #8b95a1; }
.kb { display: grid; gap: 4px; }
.kb-row { display: flex; gap: 4px; }
.kb-btn {
  flex: 1; min-width: 0; border: 0; border-radius: 10px; padding: 8px 6px; font-size: 13px; font-weight: 600; color: #fff;
  background: rgba(40, 56, 48, 0.38); backdrop-filter: blur(3px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.kb-btn:hover { background: rgba(40, 56, 48, 0.5); }
.kb-btn.app::after, .kb-btn.url::after { content: " ↗"; opacity: 0.8; }
.tg-input { flex: none; display: flex; gap: 8px; padding: 8px 10px 26px; background: #fffdf8; border-top: 1px solid #ece5d6; }
.tg-input input { flex: 1; min-width: 0; border: 1px solid #e3dccd; border-radius: 18px; padding: 9px 14px; font: inherit; background: #fff; outline: none; }
.tg-input input:focus { border-color: #3346c4; }
.tg-input button { border: 0; width: 40px; height: 40px; border-radius: 50%; background: #17202e; color: #fff; font-size: 16px; }
.tg-alert {
  position: absolute; z-index: 25; left: 50%; top: 40%; transform: translate(-50%, -50%); width: 78%; padding: 14px 16px;
  border-radius: 14px; background: rgba(28, 30, 36, 0.94); color: #fff; font-size: 14px; text-align: center;
  animation: msg-in 0.2s ease both;
}
@keyframes msg-in { from { opacity: 0; transform: translateY(6px); } }

/* ≤920 px: tighter */
@media (max-width: 1240px) {
  .demo-stage { gap: 18px; padding: 16px 12px 32px; }
  .demo-badge { order: 5; width: 100%; justify-content: center; font-size: 12px; }
}

/* ≤600 px: one phone at a time, no frame */
@media (max-width: 760px) {
  .demo-bar { position: static; padding: 8px 12px; gap: 8px; }
  .demo-tools { margin-left: auto; }
  .demo-tools .gh { display: none; }
  .demo-intro { padding: 14px 16px 0; }
  .demo-intro h1 { font-size: 20px; }
  .demo-intro p { font-size: 14px; }
  .story { justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; padding: 10px 16px 2px; scrollbar-width: none; }
  .story-btn { flex: none; }
  .who-switch {
    position: sticky; top: 0; z-index: 35; display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 4px; margin: 10px 16px 0;
    padding: 4px; border-radius: 12px; background: #fffdf8; border: 1px solid var(--line);
  }
  .who-switch button { border: 0; background: transparent; padding: 8px; border-radius: 9px; font-weight: 650; color: var(--muted); }
  .who-switch button.on { background: var(--ink); color: #fff; }
  .demo-stage { display: block; padding: 10px 0 0; }
  .side { display: none; }
  .side.show { display: grid; }
  .side-label { display: none; }
  .phone { height: calc(100dvh - 120px); min-height: 560px; width: 100%; padding: 0; border-radius: 0; background: none; box-shadow: none; }
  .phone.ring { box-shadow: inset 0 0 0 3px rgba(230, 196, 122, 0.8); }
  .phone::before, .phone::after, .phone-island, .phone-status, .phone-homebar { display: none; }
  .phone-screen { border-radius: 0; border-top: 1px solid var(--line); }
  .tg-input { padding-bottom: 10px; }
}
/* demo time control and the location button in the chat */
.demo-time { display: inline-flex; align-items: center; gap: 6px; }
.demo-time .demo-btn { padding: 5px 10px; }
.bubble i { color: #4b5563; }
.story-btn.done b { background: #14965a; }
.demo-mark svg, .tg-ava svg { width: 60%; height: 60%; }
.kb-btn.contact::before { content: "☎ "; }
.demo-btn:disabled { opacity: 0.5; cursor: default; }
.demo-foot { text-align: center; color: var(--muted); font-size: 12.5px; padding: 0 16px 28px; }
.demo-foot a { color: inherit; }
@media (max-width: 760px) { .demo-time { order: 6; } }

@media (prefers-reduced-motion: reduce) {
  .msg, .push, .tg-alert { animation: none; transition: none; }
}

/* day 4 additions: the QR photo in the chat, the full-page invitation link, the music hint */
.tg-photo { justify-self: start; padding: 6px; border-radius: 16px; background: #fff; box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08); }
.tg-photo .qr { display: block; image-rendering: pixelated; }
.demo-full { justify-self: center; margin-top: 6px; color: #0f4c4a; font-weight: 700; text-decoration: none; border-bottom: 1.5px solid #e6c47a; }
.demo-full:hover { color: #b4852c; }
.inv-tool.hint { animation: hint 1.2s ease-in-out 3; }
@keyframes hint { 50% { box-shadow: 0 0 0 6px rgba(230, 196, 122, 0.55); } }
.pane .env-overlay { min-height: 100%; }
