:root {
  --bg: #030806;
  --bg-soft: #07110e;
  --panel: rgba(7, 24, 20, .78);
  --panel-strong: rgba(10, 30, 25, .94);
  --line: rgba(112, 255, 206, .17);
  --line-strong: rgba(112, 255, 206, .34);
  --text: #f4fff9;
  --muted: #91aaa1;
  --muted-2: #6f8b81;
  --accent: #4de8b1;
  --accent-2: #91ffda;
  --accent-deep: #0d6a53;
  --danger: #ff6f7e;
  --shadow: 0 34px 100px rgba(0, 0, 0, .46);
  --glow: 0 0 0 1px rgba(98, 242, 190, .08), 0 18px 70px rgba(38, 219, 158, .13);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  min-height: 100dvh;
  margin: 0;
  color: var(--text);
  overflow-x: hidden;
  background:
    radial-gradient(circle at 50% -20%, rgba(48, 211, 157, .12), transparent 36rem),
    linear-gradient(180deg, #030806 0%, #04100d 48%, #020706 100%);
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .3;
  background-image:
    radial-gradient(circle at 20% 28%, rgba(124,255,214,.48) 0 1px, transparent 1.5px),
    radial-gradient(circle at 72% 18%, rgba(124,255,214,.34) 0 1px, transparent 1.5px),
    radial-gradient(circle at 82% 68%, rgba(124,255,214,.34) 0 1px, transparent 1.5px),
    radial-gradient(circle at 32% 78%, rgba(124,255,214,.22) 0 1px, transparent 1.5px);
  background-size: 260px 260px, 340px 340px, 300px 300px, 390px 390px;
}

button, textarea, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible, textarea:focus-visible, input:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 3px;
}

.ambient {
  position: fixed;
  z-index: 0;
  border: 1px solid rgba(74, 234, 178, .18);
  border-radius: 50%;
  pointer-events: none;
  filter: drop-shadow(0 0 18px rgba(74,234,178,.08));
}
.ambient-a { width: 720px; height: 720px; left: -510px; top: -90px; transform: rotate(16deg); }
.ambient-b { width: 760px; height: 760px; right: -560px; top: 320px; }
.ambient-c { width: 460px; height: 460px; left: 8%; bottom: -420px; opacity: .55; }

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1160px, calc(100% - 40px));
  margin: 0 auto;
  padding: 34px 0 22px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 26px;
  padding: 0 4px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: inherit;
  text-decoration: none;
}
.brand-mark {
  width: 58px;
  height: 58px;
  padding: 5px;
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(129,255,216,.18), rgba(30,104,82,.08));
  box-shadow: 0 14px 36px rgba(20, 236, 168, .15), inset 0 0 0 1px rgba(150,255,220,.16);
}
.brand-mark img, .privacy-logo img, .hero-logo img { width: 100%; height: 100%; display: block; }
.brand-copy { display: grid; gap: 3px; }
.brand-copy strong { font-size: 21px; line-height: 1; letter-spacing: -.035em; }
.brand-copy small { color: #8da69d; font-size: 13px; }

.status-pill {
  min-height: 44px;
  border: 1px solid var(--line);
  background: rgba(9, 21, 18, .68);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.025);
  padding: 0 16px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  color: #9cb1aa;
  white-space: nowrap;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #6b7d77; box-shadow: 0 0 0 5px rgba(107,125,119,.06); }
.status-pill.connecting { color: #f5d98d; border-color: rgba(246,205,103,.2); }
.status-pill.connecting .status-dot { background: #f6cd67; box-shadow: 0 0 0 5px rgba(246,205,103,.08); }
.status-pill.secure { color: var(--accent-2); border-color: rgba(83,237,182,.32); }
.status-pill.secure .status-dot { background: var(--accent); box-shadow: 0 0 0 5px rgba(77,232,177,.09), 0 0 18px rgba(77,232,177,.42); }
.status-pill.danger { color: #ffb2ba; border-color: rgba(255,111,126,.25); }
.status-pill.danger .status-dot { background: var(--danger); }

.panel, .chat-panel {
  position: relative;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(8, 31, 25, .88), rgba(4, 18, 15, .9));
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.025);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}

.welcome-panel {
  min-height: 680px;
  overflow: hidden;
  border-radius: 38px;
  text-align: center;
  padding: 44px clamp(24px, 7vw, 88px) 38px;
  isolation: isolate;
}
.welcome-panel::before {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: -2;
  border-radius: inherit;
  background: linear-gradient(110deg, rgba(102,255,204,.34), rgba(102,255,204,.02) 25%, rgba(102,255,204,.03) 65%, rgba(102,255,204,.3));
  opacity: .55;
}
.welcome-panel::after {
  content: "";
  position: absolute;
  inset: 1px;
  z-index: -1;
  border-radius: 37px;
  background:
    radial-gradient(circle at 50% 8%, rgba(39,228,161,.16), transparent 25rem),
    radial-gradient(circle at 78% 68%, rgba(38,139,104,.11), transparent 22rem),
    linear-gradient(180deg, rgba(5,27,22,.97), rgba(4,17,14,.98));
}
.panel-glow {
  position: absolute;
  width: 420px;
  height: 230px;
  top: -130px;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 50%;
  background: rgba(64, 239, 178, .12);
  filter: blur(70px);
  pointer-events: none;
}

.hero-orbit {
  position: relative;
  width: 230px;
  height: 174px;
  margin: 0 auto 6px;
  display: grid;
  place-items: center;
}
.hero-logo {
  position: relative;
  z-index: 3;
  width: 116px;
  height: 116px;
  padding: 8px;
  border-radius: 34px;
  background: rgba(7, 31, 25, .75);
  box-shadow: 0 28px 55px rgba(0,0,0,.35), 0 0 32px rgba(51,237,173,.2);
  animation: floatLogo 6s ease-in-out infinite;
}
.hero-logo::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: -17px;
  height: 13px;
  border-radius: 50%;
  background: rgba(66,239,176,.28);
  filter: blur(12px);
}
.orbit {
  position: absolute;
  left: 50%;
  top: 50%;
  border: 1px solid rgba(103,255,207,.28);
  border-radius: 50%;
  pointer-events: none;
}
.orbit-one { width: 225px; height: 82px; transform: translate(-50%,-50%) rotate(-6deg); }
.orbit-two { width: 178px; height: 130px; transform: translate(-50%,-50%) rotate(26deg); opacity: .48; }
.orbit-dot { position: absolute; width: 5px; height: 5px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 14px rgba(145,255,218,.85); }
.dot-one { left: 17px; top: 82px; }
.dot-two { right: 30px; bottom: 44px; }

.eyebrow-wrap { display: flex; align-items: center; justify-content: center; gap: 14px; }
.eyebrow-wrap > span { width: 88px; height: 1px; background: linear-gradient(90deg, transparent, rgba(97,239,189,.34)); }
.eyebrow-wrap > span:last-child { transform: scaleX(-1); }
.eyebrow { margin: 0; color: var(--accent); font-size: 11px; letter-spacing: .27em; font-weight: 850; }

.hero-title {
  max-width: 890px;
  margin: 17px auto 0;
  font-size: clamp(46px, 6.1vw, 76px);
  line-height: .97;
  letter-spacing: -.055em;
  font-weight: 830;
  text-wrap: balance;
}
.hero-title em { font-style: normal; color: var(--accent-2); text-shadow: 0 0 35px rgba(82,239,184,.13); }
.lead {
  max-width: 760px;
  margin: 24px auto 30px;
  color: #adc2ba;
  line-height: 1.65;
  font-size: 16px;
  text-wrap: balance;
}

.welcome-actions { display: flex; justify-content: center; gap: 13px; flex-wrap: wrap; }
.primary-btn, .install-btn, .secondary-btn, .danger-btn, .composer button {
  border-radius: 16px;
  cursor: pointer;
  font-weight: 800;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease, background .18s ease, opacity .18s ease;
}
.primary-btn, .install-btn {
  min-height: 64px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 13px;
  padding: 0 22px;
}
.primary-btn {
  min-width: 360px;
  border: 1px solid rgba(179,255,229,.45);
  background: linear-gradient(120deg, #7af4cb 0%, #48e4ae 50%, #28ca97 100%);
  color: #03100c;
  box-shadow: 0 18px 48px rgba(42,218,157,.2), inset 0 1px 0 rgba(255,255,255,.46);
}
.install-btn {
  min-width: 245px;
  border: 1px solid rgba(110,255,208,.18);
  background: rgba(8, 29, 24, .75);
  color: #eafff7;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.025);
}
.button-icon { width: 23px; height: 23px; display: inline-grid; place-items: center; flex: 0 0 auto; }
.button-icon svg, .trust-row svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.85; stroke-linecap: round; stroke-linejoin: round; }
.button-arrow { font-size: 25px; line-height: 1; margin-left: 4px; }
.primary-btn:hover { transform: translateY(-2px); box-shadow: 0 22px 58px rgba(42,218,157,.27), inset 0 1px 0 rgba(255,255,255,.55); }
.install-btn:hover { transform: translateY(-2px); border-color: rgba(110,255,208,.34); background: rgba(10,38,31,.88); }
button:active { transform: translateY(0) !important; }
button:disabled { cursor: not-allowed; opacity: .42; transform: none !important; }

.trust-row {
  margin-top: 34px;
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.trust-row span {
  min-height: 39px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #9ab0a7;
  font-size: 12px;
  padding: 0 13px;
  border: 1px solid rgba(105,255,205,.14);
  border-radius: 999px;
  background: rgba(4, 20, 16, .58);
}
.trust-row i { width: 18px; height: 18px; display: inline-flex; color: #57e8b2; }

.invite-panel {
  margin-top: 18px;
  padding: 28px;
  border-radius: 28px;
}
.panel-head, .chat-security { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.panel-head h2 { margin: 7px 0 0; font-size: 23px; letter-spacing: -.03em; }
.invite-panel > p { color: #9fb4ac; line-height: 1.55; }
.invite-panel code { color: var(--accent-2); }
.lock-badge { color: var(--accent); border: 1px solid rgba(67,230,173,.24); background: rgba(67,230,173,.07); border-radius: 999px; padding: 8px 11px; font-size: 11px; font-weight: 900; }
.invite-box { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 18px; }
.invite-box input { min-width: 0; border: 1px solid var(--line); background: rgba(0,0,0,.22); color: #d8ece4; border-radius: 14px; padding: 13px 14px; outline: none; }
.secondary-btn { border: 0; padding: 0 18px; color: #04100d; background: linear-gradient(135deg, var(--accent-2), var(--accent)); }
.waiting { margin-bottom: 0 !important; font-size: 13px; }

.chat-panel {
  margin-top: 18px;
  min-height: 650px;
  overflow: hidden;
  border-radius: 30px;
  display: grid;
  grid-template-rows: auto 1fr auto;
}
.chat-security { padding: 19px 22px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.018); }
.chat-security strong { font-size: 13px; letter-spacing: .08em; word-break: break-word; }
.danger-btn { padding: 10px 13px; border: 1px solid rgba(255,108,122,.22); background: rgba(255,108,122,.08); color: #ffadb5; }
.danger-btn:hover { border-color: rgba(255,108,122,.38); background: rgba(255,108,122,.12); }
.messages { min-height: 0; overflow-y: auto; padding: 26px; display: flex; flex-direction: column; gap: 11px; overscroll-behavior: contain; }
.bubble { max-width: min(74%, 620px); padding: 12px 15px; line-height: 1.48; border-radius: 18px; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.peer { align-self: flex-start; background: #112820; border: 1px solid rgba(255,255,255,.045); border-bottom-left-radius: 5px; }
.bubble.own { align-self: flex-end; background: linear-gradient(135deg, #72f0c4, #35dca4); color: #03100c; border-bottom-right-radius: 5px; box-shadow: 0 8px 28px rgba(42,218,157,.09); }
.system-message { align-self: center; max-width: 680px; color: #7f978e; font-size: 12px; text-align: center; padding: 7px 12px; }
.composer { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 14px; border-top: 1px solid var(--line); background: rgba(3,11,9,.76); }
.composer textarea { resize: none; min-height: 50px; max-height: 140px; border: 1px solid var(--line); background: #071712; color: var(--text); outline: none; border-radius: 16px; padding: 13px 14px; line-height: 1.4; }
.composer textarea:focus { border-color: rgba(67,230,173,.4); box-shadow: 0 0 0 3px rgba(67,230,173,.06); }
.composer button { border: 0; padding: 0 20px; background: var(--accent); color: #04100d; }

footer { padding: 18px 3px 0; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: #587068; font-size: 11px; }
.hidden { display: none !important; }
.reset-note { margin: 20px auto 0; color: var(--accent-2); font-size: 13px; }

.privacy-cover {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  place-items: center;
  align-content: center;
  gap: 11px;
  background: radial-gradient(circle at 50% 42%, rgba(37,191,137,.12), transparent 22rem), #030806;
  text-align: center;
}
.privacy-cover.show { display: grid; }
.privacy-logo { width: 84px; height: 84px; padding: 7px; border-radius: 26px; box-shadow: 0 18px 54px rgba(49,227,164,.18); }
.privacy-cover strong { margin-top: 6px; font-size: 20px; }
.privacy-cover span { color: var(--muted); font-size: 13px; }

@keyframes floatLogo {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}

@media (max-width: 900px) {
  .app-shell { width: min(100% - 28px, 1160px); padding-top: 24px; }
  .welcome-panel { min-height: 640px; padding: 36px 26px 32px; border-radius: 32px; }
  .hero-title { font-size: clamp(42px, 8vw, 66px); }
  .primary-btn { min-width: 320px; }
}

@media (max-width: 680px) {
  .app-shell { width: min(100% - 18px, 1160px); padding-top: 14px; padding-bottom: 10px; }
  .topbar { align-items: center; margin-bottom: 14px; gap: 10px; }
  .brand { gap: 9px; min-width: 0; }
  .brand-mark { width: 46px; height: 46px; border-radius: 14px; flex: 0 0 auto; }
  .brand-copy strong { font-size: 16px; }
  .brand-copy small { display: none; }
  .status-pill { min-height: 38px; padding: 0 11px; font-size: 11px; }
  .status-pill b { max-width: 112px; overflow: hidden; text-overflow: ellipsis; }
  .welcome-panel { min-height: calc(100dvh - 84px); padding: 28px 15px 24px; border-radius: 26px; }
  .welcome-panel::after { border-radius: 25px; }
  .hero-orbit { width: 190px; height: 145px; }
  .hero-logo { width: 92px; height: 92px; border-radius: 28px; }
  .orbit-one { width: 186px; height: 66px; }
  .orbit-two { width: 145px; height: 105px; }
  .eyebrow-wrap { gap: 9px; }
  .eyebrow-wrap > span { width: 45px; }
  .hero-title { font-size: clamp(37px, 11vw, 52px); margin-top: 14px; }
  .lead { margin: 20px auto 24px; font-size: 14px; line-height: 1.6; }
  .welcome-actions { display: grid; grid-template-columns: 1fr; width: 100%; gap: 9px; }
  .primary-btn, .install-btn { width: 100%; min-width: 0; min-height: 58px; padding: 0 15px; }
  .primary-btn { justify-content: space-between; }
  .install-btn { justify-content: center; }
  .trust-row { margin-top: 24px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .trust-row span { min-width: 0; justify-content: flex-start; padding: 0 10px; font-size: 10.5px; }
  .invite-panel { padding: 19px; border-radius: 23px; }
  .invite-box { grid-template-columns: 1fr; }
  .secondary-btn { padding: 12px 15px; }
  .chat-panel { min-height: calc(100dvh - 80px); border-radius: 24px; }
  .chat-security { align-items: flex-start; padding: 15px; }
  .chat-security strong { display: block; max-width: 190px; font-size: 10.5px; }
  .danger-btn { font-size: 10.5px; }
  .messages { padding: 18px 12px; }
  .bubble { max-width: 88%; }
  .composer { padding: 9px; }
  .composer button { padding: 0 13px; }
  footer { display: none; }
}

@media (max-width: 400px) {
  .hero-title { font-size: 36px; }
  .trust-row { grid-template-columns: 1fr; }
  .trust-row span { justify-content: center; }
}

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

/* Invite / pairing flow */
.invite-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.invite-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 44px;
  padding: 10px 15px;
  border-radius: 14px;
  border: 1px solid rgba(112,255,205,.18);
  background: rgba(255,255,255,.035);
  color: var(--text);
  cursor: pointer;
  font-weight: 750;
}
.invite-action-btn:hover {
  background: rgba(67,230,173,.08);
  border-color: rgba(112,255,205,.28);
}
.invite-action-btn span {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  color: var(--accent);
}
.invite-action-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.pair-code-row {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(112,255,205,.12);
  border-radius: 14px;
  background: rgba(0,0,0,.16);
}
.pair-code-row span {
  color: var(--muted);
  font-size: 12px;
}
.pair-code-row strong {
  font-size: 15px;
  letter-spacing: .12em;
  color: var(--accent-2);
}
.qr-panel {
  margin-top: 14px;
}
.qr-card {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 18px;
  align-items: center;
  padding: 16px;
  border: 1px solid rgba(112,255,205,.14);
  border-radius: 18px;
  background: rgba(255,255,255,.025);
}
.qr-card img {
  width: 170px;
  height: 170px;
  display: block;
  padding: 8px;
  border-radius: 14px;
  background: #fff;
}
.qr-card strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
}
.qr-card p,
.share-help {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}
.share-help {
  margin: 12px 0 0;
}

@media (max-width: 680px) {
  .invite-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .invite-action-btn { width: 100%; }
  .pair-code-row { align-items: flex-start; }
  .qr-card { grid-template-columns: 1fr; text-align: center; }
  .qr-card img { width: min(220px, 100%); height: auto; aspect-ratio: 1; margin: 0 auto; }
}
