/* ============================================================
   style.css — how everything looks
   Layout: one iPhone frame centered on a dark desk; every app
   lives inside it as an absolutely positioned "screen".
   ============================================================ */

:root {
  --desk: #0d0f14;           /* page behind the phone */
  --ink: #0b0b0f;            /* text on app screens */
  --paper: #ffffff;          /* app background */
  --grouped: #f2f2f7;        /* grey background (Notes, Phone) */
  --line: rgba(60, 60, 67, .18);
  --muted: #8a8a8f;
  --blue: #0a84ff;           /* your bubbles, links */
  --bubble: #e9e9eb;         /* their bubbles */
  --green: #34c759;
  --red: #ff3b30;
  --notes: #d89c00;
  --glass: rgba(245, 245, 247, .78);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, sans-serif;
  /* wallpaper: a rainy night */
  --wallpaper: url('photos/wallpaper1.jpg') center / cover;
  color-scheme: dark;
}
}

html { height: 100%; box-sizing: border-box; }
*, *::before, *::after { box-sizing: border-box; }
body {
  height: 100%;
  margin: 0;
  background: var(--desk);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  letter-spacing: -.2px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-block: 20px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  overflow: hidden;
  user-select: none;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
button:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
svg { display: block; }

/* ---------- Phone frame ---------- */
#stage { position: relative; flex: none; }
#phone {
  position: absolute; top: 0; left: 0;
  width: 393px; height: 852px;
  transform-origin: 0 0;
  border-radius: 56px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 0 0 10px #16171c, 0 0 0 12px #3a3b42, 0 30px 80px rgba(0, 0, 0, .7);
}
#screen { position: absolute; inset: 0; overflow: hidden; }
#app { position: absolute; inset: 0; }
#overlay { position: absolute; inset: 0; z-index: 50; pointer-events: none; }
#overlay > * { pointer-events: auto; }
.screen { position: absolute; inset: 0; overflow: hidden; }
.wall { background: var(--wallpaper); color: #fff; }

#statusbar {
  position: absolute; z-index: 60; top: 0; left: 0; right: 0; height: 54px;
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 30px 0 46px;
  font-size: 16px; font-weight: 600;
  color: #000; pointer-events: none; transition: color .3s;
}
#statusbar.light { color: #fff; }
#statusbar svg { fill: currentColor; }
.sb-icons { display: flex; gap: 6px; align-items: center; }
#island { position: absolute; z-index: 70; top: 11px; left: 50%; transform: translateX(-50%); width: 122px; height: 35px; border-radius: 20px; background: #000; }
#homebar { position: absolute; z-index: 60; bottom: 0; left: 0; right: 0; height: 30px; display: flex; justify-content: center; align-items: flex-end; padding-bottom: 8px; }
#homebar i { width: 136px; height: 5px; border-radius: 3px; background: #000; transition: background .3s; }
#homebar.light i { background: #fff; }

/* ---------- Notification card (lock screen + banner) ---------- */
.ncard {
  display: flex; gap: 11px; align-items: flex-start; width: 100%;
  padding: 12px 14px; border-radius: 22px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(30px) saturate(1.8); backdrop-filter: blur(30px) saturate(1.8);
  color: #111;
}
.ncard .ni { width: 38px; height: 38px; border-radius: 9px; flex: none; display: grid; place-items: center; background: linear-gradient(#5df27a, #28c840); }
.ncard .ni svg { width: 26px; }
.ncard .nt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ncard .nh { display: flex; justify-content: space-between; font-size: 15px; }
.ncard .nh b { font-weight: 600; }
.ncard .nh small { color: rgba(0, 0, 0, .5); font-size: 13px; }
.ncard .nb { font-size: 15px; line-height: 1.3; }
.banner { position: absolute; top: 10px; left: 8px; right: 8px; width: auto; box-shadow: 0 8px 30px rgba(0, 0, 0, .2); }

/* ---------- Lock screen ---------- */
.lock-date { position: absolute; top: 84px; width: 100%; text-align: center; font-size: 20px; font-weight: 600; }
.lock-time { position: absolute; top: 102px; width: 100%; text-align: center; font-size: 100px; font-weight: 600; letter-spacing: -3px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.lock-notes { position: absolute; left: 10px; right: 10px; bottom: 120px; display: flex; flex-direction: column; gap: 8px; }
.lock-open { position: absolute; bottom: 42px; left: 50%; transform: translateX(-50%); padding: 8px 16px; color: #fff; font-size: 14px; font-weight: 500; animation: hint 2.4s ease-in-out infinite; }
@keyframes hint { 0%, 100% { opacity: .35; } 50% { opacity: .95; } }

/* ---------- Home screen ---------- */
.grid { position: absolute; top: 70px; left: 20px; right: 20px; display: grid; grid-template-columns: repeat(4, 1fr); row-gap: 22px; justify-items: center; }
.widget {
  grid-column: span 2; grid-row: span 2; width: calc(100% - 10px); aspect-ratio: 1;
  border-radius: 24px; padding: 15px 16px; position: relative;
  background: linear-gradient(180deg, #48617f, #7c93ad); color: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .25);
  display: flex; flex-direction: column;
}
.widget b { font-size: 15px; font-weight: 600; }
.widget .w-temp { font-size: 44px; font-weight: 300; line-height: 1.1; }
.widget .w-desc { margin-top: auto; font-size: 13px; font-weight: 600; line-height: 1.35; }
.widget .w-desc small { font-size: 13px; font-weight: 500; }
.app { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 74px; transition: transform .15s; }
.app:active { transform: scale(.9); }
.icon { position: relative; width: 62px; height: 62px; border-radius: 15px; overflow: visible; display: grid; place-items: center; box-shadow: 0 1px 4px rgba(0, 0, 0, .2); }
.icon > svg { width: 100%; height: 100%; border-radius: 15px; }
.icon.messages, .icon.phone { background: linear-gradient(#5df27a, #28c840); }
.icon.messages > svg, .icon.phone > svg { width: 42px; height: 42px; }
.icon.photos { background: #fff; }
.icon.photos > svg { width: 50px; height: 50px; }
.icon.notes { background: #fff; overflow: hidden; }
.icon.settings { background: linear-gradient(#a3a7ae, #6f737a); }
.icon.settings > svg { width: 44px; height: 44px; }
.icon.camera { background: linear-gradient(#e8e8ea, #b9b9bd); }
.icon.camera > svg { width: 44px; height: 44px; }
.icon.music { background: linear-gradient(#ff6a80, #fa2d48); }
.icon.music > svg { width: 38px; height: 38px; }
.icon.calendar { background: #fff; color: #000; display: flex; flex-direction: column; gap: 0; }
.cal-d { color: var(--red); font-size: 10px; font-weight: 600; margin-top: 4px; }
.cal-n { font-size: 32px; font-weight: 300; line-height: 1; }
.lbl { color: #fff; font-size: 12px; font-weight: 500; text-shadow: 0 1px 4px rgba(0, 0, 0, .45); }
.badge { position: absolute; top: -6px; right: -7px; min-width: 23px; height: 23px; padding: 0 6px; border-radius: 12px; background: var(--red); color: #fff; font-size: 14px; font-weight: 500; display: flex; align-items: center; justify-content: center; }
.dock { position: absolute; bottom: 16px; left: 12px; right: 12px; height: 92px; border-radius: 32px; background: rgba(255, 255, 255, .2); -webkit-backdrop-filter: blur(30px) saturate(1.6); backdrop-filter: blur(30px) saturate(1.6); display: flex; justify-content: space-around; align-items: center; }
.dock .lbl { display: none; }

/* ---------- App pages ---------- */
.page { background: var(--paper); color: var(--ink); display: flex; flex-direction: column; box-shadow: -10px 0 30px rgba(0, 0, 0, .12); }
.page.grey { background: var(--grouped); }
.topbar { flex: none; height: 100px; padding: 54px 8px 0; display: flex; align-items: center; }
.back { display: flex; align-items: center; gap: 6px; color: var(--blue); font-size: 17px; padding: 8px; }
.notes .back { color: var(--notes); }
.big-title { margin: 0; padding: 0 16px 10px; font-size: 34px; font-weight: 700; letter-spacing: .2px; }
.body { flex: 1; overflow-y: auto; scrollbar-width: none; padding-bottom: 40px; }
.body::-webkit-scrollbar { display: none; }
.group { margin: 0 16px; border-radius: 12px; background: var(--paper); overflow: hidden; }

/* Messages list */
.crow { display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 9px 16px 10px 6px; position: relative; }
.crow:active { background: var(--grouped); }
.crow + .crow::before { content: ''; position: absolute; top: 0; left: 71px; right: 0; height: .5px; background: var(--line); }
.crow .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; align-self: center; }
.crow .dot.on { background: var(--blue); }
.ctext { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ctop { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.crow .cname { font-size: 17px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctime { flex: none; display: flex; align-items: center; gap: 6px; font-size: 15px; color: var(--muted); }
.cprev { font-size: 15px; line-height: 1.3; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.avatar { flex: none; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(#a5abb6, #858a94); color: #fff; font-weight: 600; }

/* Chat */
.chat-head { flex: none; padding: 50px 8px 8px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; background: rgba(249, 249, 249, .94); border-bottom: .5px solid var(--line); }
.chat-who { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 12px; }
.msgs { flex: 1; overflow-y: auto; scrollbar-width: none; padding: 8px 14px 14px; display: flex; flex-direction: column; gap: 3px; }
.msgs::-webkit-scrollbar { display: none; }
.msgs > * { flex-shrink: 0; }   /* stops bubbles squashing when the chat gets long */
.date-pill { align-self: center; color: var(--muted); font-size: 12px; font-weight: 500; margin: 14px 0 4px; }
.bb { max-width: 74%; padding: 8px 13px; border-radius: 19px; font-size: 16px; line-height: 1.3; overflow-wrap: break-word; }
.bb.gap { margin-top: 8px; }
.bb.them { align-self: flex-start; background: var(--bubble); color: var(--ink); }
.bb.me { align-self: flex-end; background: var(--blue); color: #fff; }
.bb.photo { width: 180px; height: 210px; padding: 10px; display: flex; align-items: flex-end; color: #fff; font-size: 13px; font-weight: 500; background: linear-gradient(150deg, #3f6b4f, #d9b57a); text-shadow: 0 1px 4px rgba(0, 0, 0, .4); }
.receipt { align-self: flex-end; font-size: 11px; color: var(--muted); margin-top: 2px; }
.typing { display: flex; gap: 4px; padding: 12px 14px; }
.typing i { width: 8px; height: 8px; border-radius: 50%; background: #9a9aa0; animation: dot 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; }
.typing i:nth-child(3) { animation-delay: .4s; }
@keyframes dot { 0%, 60%, 100% { opacity: .4; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }
.pop { animation: pop .35s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }

.inputbar { flex: none; display: flex; gap: 8px; align-items: center; padding: 8px 12px 36px; background: var(--paper); border-top: .5px solid var(--line); }
.field { flex: 1; min-height: 36px; padding: 7px 14px; border: 1px solid #d1d1d6; border-radius: 18px; font-size: 16px; color: var(--ink); cursor: text; }
.field.hint { color: var(--muted); }
.field.ready { border-color: var(--blue); color: var(--blue); animation: ready 1.6s ease-in-out infinite; }
@keyframes ready { 50% { box-shadow: 0 0 0 4px rgba(10, 132, 255, .18); } }
.send { width: 32px; height: 32px; flex: none; border-radius: 50%; background: var(--blue); display: grid; place-items: center; transform: scale(0); transition: transform .25s cubic-bezier(.32, .72, 0, 1); }
.send.on { transform: scale(1); }

/* Phone app */
.prow { display: flex; align-items: center; gap: 8px; min-height: 60px; padding: 0 16px 0 10px; position: relative; }
.prow + .prow::before { content: ''; position: absolute; top: 0; left: 36px; right: 0; height: .5px; background: var(--line); }
.pdir { width: 18px; flex: none; color: var(--muted); display: grid; place-items: center; }
.ptext { flex: 1; display: flex; flex-direction: column; }
.ptext b { font-size: 17px; font-weight: 600; }
.ptext small { font-size: 14px; color: var(--muted); }
.prow.missed b { color: var(--red); }
.pwhen { font-size: 15px; color: var(--muted); }

/* Notes */
.nrow { display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 11px 16px; position: relative; }
.nrow + .nrow::before { content: ''; position: absolute; top: 0; left: 16px; right: 0; height: .5px; background: var(--line); }
.nrow b { font-size: 17px; font-weight: 600; }
.nrow small { font-size: 15px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nrow em { font-style: normal; color: #3c3c43; margin-right: 6px; }
.note-view { padding: 0 22px 60px; }
.note-date { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.note-view h2 { margin: 0 0 8px; font-size: 28px; font-weight: 700; }
.note-view p { margin: 0; font-size: 17px; line-height: 1.5; white-space: pre-line; }

/* Photos */
.pgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; }
.ptile { aspect-ratio: 1; }
.viewer { position: absolute; inset: 0; background: #000; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; }
.vclose { position: absolute; top: 58px; right: 18px; color: #fff; font-size: 17px; font-weight: 600; padding: 6px; }
.vimg { width: 100%; aspect-ratio: 4 / 5; }
.vcap { font-size: 15px; opacity: .8; }

/* ---------- Call screen ---------- */
.call { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; padding-top: 110px; color: #fff; background: linear-gradient(180deg, #4b5563, #1f2430 60%, #111318); }
.call .cname { margin-top: 16px; font-size: 32px; font-weight: 500; }
.csub { margin-top: 4px; font-size: 16px; opacity: .75; font-variant-numeric: tabular-nums; }
.caption { align-self: stretch; margin: 28px 22px 0; min-height: 92px; padding: 14px 16px; border-radius: 18px; background: rgba(255, 255, 255, .1); font-size: 18px; line-height: 1.45; }
.caption small { display: block; font-size: 12px; opacity: .6; margin-bottom: 4px; }
.call-btns { align-self: stretch; margin-top: auto; margin-bottom: 70px; padding: 0 44px; display: flex; justify-content: space-between; }
.call-btns.three { padding: 0 30px; }
.cbtn { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 13px; }
.cbtn span { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; transition: background .2s; }
.cbtn span svg { width: 34px; height: 34px; }
.cbtn .hang svg { transform: rotate(135deg); }
.cbtn.red span { background: var(--red); }
.cbtn.green span { background: var(--green); animation: ringpulse 1.4s infinite; }
.cbtn.grey span { background: rgba(255, 255, 255, .2); }
.cbtn.grey.on span { background: rgba(255, 255, 255, .85); }
.cbtn.grey.on svg * { fill: #000; stroke: #000; }
@keyframes ringpulse { 0% { box-shadow: 0 0 0 0 rgba(52, 199, 89, .6); } 70% { box-shadow: 0 0 0 18px rgba(52, 199, 89, 0); } 100% { box-shadow: 0 0 0 0 rgba(52, 199, 89, 0); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* real pictures in chat bubbles */
.bb.photo.img { background-size: cover; background-position: center; }

/* ---------- Lock screen: swipe hint + passcode ---------- */
.lock { touch-action: none; cursor: grab; }
.lock-hint { position: absolute; bottom: 42px; width: 100%; text-align: center; color: #fff; font-size: 14px; font-weight: 500; opacity: 0; pointer-events: none; transition: opacity .6s; }
.lock-hint.on { animation: hint 2.4s ease-in-out infinite; }

.pin { display: flex; flex-direction: column; align-items: center; padding-top: 120px; }
.pin::before { content: ''; position: absolute; inset: 0; background: rgba(0, 0, 0, .35); -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px); }
.pin > * { position: relative; }
.pin-title { font-size: 20px; font-weight: 500; }
.pin-hint { margin-top: 6px; font-size: 13px; opacity: .7; }
.pin-dots { display: flex; gap: 22px; margin: 24px 0 44px; }
.pin-dots i { width: 13px; height: 13px; border-radius: 50%; border: 1.4px solid #fff; transition: background .1s; }
.pin-dots i.on { background: #fff; }
.pin-keys { display: grid; grid-template-columns: repeat(3, 78px); gap: 16px 24px; }
.pk { width: 78px; height: 78px; border-radius: 50%; background: rgba(255, 255, 255, .18); color: #fff; font-size: 34px; text-align: center; transition: background .3s; }
.pk:active { background: rgba(255, 255, 255, .55); transition: none; }
.pk-text { color: #fff; font-size: 16px; text-align: center; }
.pin-cancel { position: absolute; bottom: 52px; right: 52px; color: #fff; font-size: 16px; }

/* ---------- Fake iPhone keyboard ---------- */
.kbd { flex: none; height: 0; overflow: hidden; background: #d1d4db; transition: height .35s cubic-bezier(.32, .72, 0, 1); }
.kbd.open { height: 291px; }
.kin { height: 291px; padding: 8px 3px 0; display: flex; flex-direction: column; gap: 11px; }
.kr { display: flex; justify-content: center; gap: 6px; padding: 0 3px; }
.key { position: relative; flex: 1; max-width: 34px; height: 43px; border-radius: 5px; background: #fff; box-shadow: 0 1px 0 rgba(0, 0, 0, .3); display: grid; place-items: center; font-size: 22px; color: #000; }
.key.sp { background: #abb0bb; max-width: 44px; font-size: 16px; }
.key.num { max-width: none; flex: 1.3; }
.key.space { max-width: none; flex: 5; font-size: 16px; }
.key.ret { max-width: none; flex: 2.2; font-size: 16px; }
.key.dn { background: #abb0bb; }
.key.sp.dn { background: #fff; }
/* the bubble that pops up above a pressed letter */
.key.pv::after { content: attr(data-k); position: absolute; bottom: 34px; left: 50%; transform: translateX(-50%); width: 52px; height: 60px; border-radius: 9px 9px 6px 6px; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); display: grid; place-items: center; padding-bottom: 6px; font-size: 30px; z-index: 3; }
.inputbar.kb { padding-bottom: 8px; }

/* hide the "Swipe up to open" hint */
.lock-hint { display: none; }
/* ---------- Wallpapers ---------- */
.lock, .pin { background: url('photos/wallpaper2.jpg') center / cover; }
.home       { background: url('photos/wallpaper1.jpg') center / cover; }