:root {
  --bg: #e7eee6;
  --ink: #142018;
  --muted: #5b675e;
  --banner: #1d2a20;
  --device: #0c0c0e;
  --screen: #fff;
  --thread: #efece8;
  --incoming: #e9e9eb;
  --outgoing: #34c759;
  --line: rgba(0, 0, 0, 0.08);
  --blue: #007aff;
  --danger: #ff3b30;
  --shadow: 0 28px 70px rgba(20, 32, 24, 0.28);
  --sans: system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  background:
    radial-gradient(1200px 600px at 50% -10%, #f4f7f1, var(--bg) 60%);
  color: var(--ink);
  font-family: var(--sans);
}

body { padding: 16px 16px 40px; }

.page {
  width: min(520px, 100%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
}

.demo-banner {
  width: 100%;
  text-align: center;
  background: var(--banner);
  color: #f6f8f4;
  font-weight: 650;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 8px 12px;
  border-radius: 999px;
}

.controls {
  width: 100%;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(20, 32, 24, 0.08);
  border-radius: 16px;
  padding: 12px;
  backdrop-filter: blur(12px);
}

.control-row, .sample-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
}

.sample-row {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.sample-label {
  font-size: 12px;
  color: var(--muted);
  width: 100%;
  text-align: center;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  margin-right: 4px;
  cursor: pointer;
  user-select: none;
}

.toggle input { width: 16px; height: 16px; accent-color: #2f6f45; }

.btn {
  appearance: none;
  border: 1px solid rgba(20, 32, 24, 0.14);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 650;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
}

.btn:hover { background: #f3f6f2; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.primary { background: #1d2a20; color: #fff; border-color: #1d2a20; }
.btn.primary:hover { background: #2a3b2f; }
.btn.small { font-size: 12px; font-weight: 600; padding: 6px 10px; }
.btn.active { background: #1d2a20; color: #fff; border-color: #1d2a20; }

.stage { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 8px; }

.phone-label {
  font-size: 13px;
  font-weight: 650;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.device-wrap {
  width: min(390px, 100%);
  flex: 0 0 auto;
}
.device {
  width: 100%;
  height: 0;
  padding-bottom: 216.4103%;
  position: relative;
  background: var(--device);
  border-radius: 54px;
  box-shadow: var(--shadow), inset 0 0 0 1px #2c2c31;
}

.device-screen {
  position: absolute;
  inset: 11px;
  border-radius: 44px;
  overflow: hidden;
  background: var(--screen);
}

.island {
  position: absolute;
  top: 11px;
  left: 50%;
  transform: translateX(-50%);
  width: 118px;
  height: 34px;
  background: #000;
  border-radius: 20px;
  z-index: 30;
}

.status-bar {
  height: 54px;
  padding: 16px 22px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 15px;
  font-weight: 700;
  position: relative;
  z-index: 20;
}

.status-bar.light { color: #fff; }
.status-icons { display: flex; align-items: center; gap: 6px; }
.sig, .wifi, .batt { display: inline-block; background: currentColor; }
.sig {
  width: 17px; height: 10px;
  background:
    linear-gradient(currentColor, currentColor) 0 8px / 3px 3px no-repeat,
    linear-gradient(currentColor, currentColor) 4px 5px / 3px 6px no-repeat,
    linear-gradient(currentColor, currentColor) 8px 3px / 3px 8px no-repeat,
    linear-gradient(currentColor, currentColor) 12px 0 / 3px 11px no-repeat;
}
.wifi {
  width: 15px; height: 11px;
  background: radial-gradient(circle at 50% 110%, transparent 6px, currentColor 6.5px, currentColor 8px, transparent 8.5px),
              radial-gradient(circle at 50% 110%, transparent 2px, currentColor 2.5px, currentColor 3.5px, transparent 4px);
  background-repeat: no-repeat;
}
.batt {
  width: 24px; height: 11px;
  border: 1.5px solid currentColor;
  border-radius: 3px;
  position: relative;
  background: linear-gradient(currentColor, currentColor) 1.5px 1.5px / 16px 6px no-repeat;
  color: inherit;
}
.batt::after {
  content: "";
  position: absolute;
  right: -4px; top: 2.5px;
  width: 2px; height: 4px;
  background: currentColor;
  border-radius: 0 1px 1px 0;
}

.call-ui {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #1a3d2a 0%, #0e1a14 70%);
  color: #fff;
  display: flex;
  flex-direction: column;
  z-index: 5;
}

.call-ui.is-hidden { display: none; }

.call-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 120px;
  position: relative;
}

.call-rings {
  position: absolute;
  top: 132px;
  width: 168px;
  height: 168px;
}

.call-rings span {
  position: absolute;
  inset: 0;
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  animation: pulse 1.8s ease-out infinite;
}

.call-rings span:nth-child(2) { animation-delay: 0.9s; }
.call-ui.ended .call-rings { display: none; }

@keyframes pulse {
  0% { transform: scale(0.72); opacity: 0.7; }
  100% { transform: scale(1.35); opacity: 0; }
}

.call-avatar {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background: #3e7a54;
  display: grid;
  place-items: center;
  font-size: 48px;
  font-weight: 650;
  z-index: 1;
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.08);
}

.call-name {
  margin-top: 26px;
  font-size: 26px;
  font-weight: 650;
  text-align: center;
  padding: 0 24px;
  letter-spacing: -0.02em;
}

.call-status {
  margin-top: 8px;
  font-size: 17px;
  color: rgba(255, 255, 255, 0.78);
}

.call-end {
  display: grid;
  place-items: center;
  padding-bottom: 48px;
}

.call-end span {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--danger);
  position: relative;
}

.call-end span::after {
  content: "";
  position: absolute;
  left: 18px; right: 18px; top: 31px;
  height: 7px;
  background: #fff;
  border-radius: 8px;
}

.messages-ui {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--thread);
}

.messages-ui.is-hidden { display: none; }

.nav {
  display: grid;
  grid-template-columns: 28px 1fr 28px;
  align-items: center;
  gap: 4px;
  padding: 0 12px 8px;
  background: rgba(239, 236, 232, 0.92);
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.08);
}

.nav-back {
  width: 12px; height: 12px;
  border-left: 2.5px solid var(--blue);
  border-bottom: 2.5px solid var(--blue);
  transform: rotate(45deg);
  margin-left: 8px;
}

.nav-contact { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.nav-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: #3e7a54; color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 15px;
}
.nav-name { font-size: 13px; font-weight: 650; text-align: center; line-height: 1.15; }
.nav-sub { font-size: 11px; color: #8a8a8e; }
.nav-info {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--blue); color: var(--blue);
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700; font-style: italic;
  justify-self: end;
}

.thread {
  flex: 1;
  overflow-y: auto;
  padding: 10px 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scroll-behavior: smooth;
}

.sys {
  align-self: center;
  text-align: center;
  max-width: 80%;
  margin: 6px 0 8px;
  color: #6d6d72;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
}

.sys .missed {
  color: var(--danger);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sys .missed::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--danger);
}

.stamp {
  align-self: center;
  font-size: 11px;
  color: #8a8a8e;
  font-weight: 600;
  margin: 4px 0 2px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.row {
  display: flex;
  width: 100%;
  align-items: flex-end;
}

.row.in { justify-content: flex-start; }
.row.out { justify-content: flex-end; }

.bubble {
  max-width: 78%;
  padding: 8px 13px;
  border-radius: 18px;
  font-size: 16px;
  line-height: 1.28;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.row.in .bubble {
  background: var(--incoming);
  color: #111;
  border-bottom-left-radius: 5px;
}

.row.out .bubble {
  background: var(--outgoing);
  color: #fff;
  border-bottom-right-radius: 5px;
}

.bubble.photos {
  padding: 4px;
  background: transparent;
  display: flex;
  gap: 4px;
}

.bubble.photos img {
  width: 118px;
  height: 88px;
  object-fit: cover;
  border-radius: 12px;
  display: block;
  background: #d7d0c6;
}

.row.out .bubble.photos { padding: 0; background: transparent; }

.typing {
  width: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 12px 16px 10px;
}

.typing i {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #8a8a8e;
  animation: dots 1s ease-in-out infinite;
}

.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }

@keyframes dots {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.45; }
  40% { transform: translateY(-3px); opacity: 1; }
}

.composer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 18px;
  background: rgba(239, 236, 232, 0.96);
}

.plus, .mic {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: #e3e3e8;
  color: #3a3a3c;
  display: grid;
  place-items: center;
  flex: none;
  padding: 6px;
}

.composer-field {
  flex: 1;
  height: 34px;
  border: 1.5px solid #d0d0d5;
  border-radius: 17px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  color: #8a8a8e;
  font-size: 16px;
  background: #fff;
}


.home-bar {
  position: absolute;
  left: 50%;
  bottom: 7px;
  transform: translateX(-50%);
  width: 130px;
  height: 5px;
  background: #111;
  border-radius: 4px;
}

body.record .controls { display: none; }

@media (max-width: 430px) {
  body { padding: 10px 8px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .call-rings span, .typing i { animation: none; }
}

body.record {
  width: 1080px;
  height: 1920px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #d7e0d4;
  display: flex;
  align-items: center;
  justify-content: center;
}
body.record .page {
  width: 1080px;
  height: 1920px;
  max-width: none;
  padding: 72px 0 0;
  gap: 22px;
  justify-content: flex-start;
}
body.record .demo-banner {
  width: 720px;
  font-size: 22px;
  padding: 14px 20px;
}
body.record .phone-label { font-size: 22px; }
body.record .device-wrap { width: 720px; }
body.record .device {
  width: 720px;
  height: 1556px;
  padding-bottom: 0;
  max-height: none;
  min-height: 0;
  border-radius: 96px;
}
body.record .device-screen { border-radius: 80px; inset: 20px; }
body.record .island { width: 210px; height: 58px; top: 18px; border-radius: 32px; }
body.record .status-bar { height: 92px; padding: 28px 40px 0; font-size: 26px; }
body.record .call-body { padding-top: 220px; }
body.record .call-avatar { width: 200px; height: 200px; font-size: 86px; }
body.record .call-name { font-size: 44px; margin-top: 40px; }
body.record .call-status { font-size: 30px; }
body.record .call-end span { width: 112px; height: 112px; }
body.record .call-end { padding-bottom: 80px; }
body.record .nav { padding: 0 22px 14px; grid-template-columns: 48px 1fr 48px; }
body.record .nav-avatar { width: 64px; height: 64px; font-size: 26px; }
body.record .nav-name { font-size: 24px; }
body.record .nav-sub { font-size: 18px; }
body.record .nav-info { width: 36px; height: 36px; font-size: 22px; }
body.record .nav-back { width: 20px; height: 20px; border-width: 4px; }
body.record .thread { padding: 18px 18px 12px; gap: 10px; }
body.record .stamp { font-size: 18px; }
body.record .sys { font-size: 20px; }
body.record .bubble { font-size: 28px; padding: 14px 22px; border-radius: 32px; max-width: 82%; }
body.record .bubble.photos img { width: 210px; height: 156px; border-radius: 20px; }
body.record .typing { width: 100px; padding: 20px 26px 16px; }
body.record .typing i { width: 12px; height: 12px; }
body.record .composer { padding: 10px 18px 36px; gap: 14px; }
body.record .plus, body.record .mic { width: 52px; height: 52px; }
body.record .composer-field { height: 58px; border-radius: 29px; font-size: 26px; padding: 0 20px; }
body.record .home-bar { width: 220px; height: 8px; bottom: 12px; }
