:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #05291f;
  color: #f3e8c9;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
body {
  position: relative;
  isolation: isolate;
  margin: 0;
  min-width: 280px;
  min-height: 100svh;
  overflow-x: clip;
  background: radial-gradient(ellipse at 49% 36%, #0d6246 0, #073c2e 44%, #031d18 100%);
}
/* Broad, soft light and shadow bands suggest fabric without a bitmap or canvas. */
body::before {
  content: "";
  position: fixed;
  z-index: -2;
  inset: -14%;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 16% 13%, #b2a45d19, transparent 39%),
    linear-gradient(119deg, transparent 13%, #001c177a 22%, #29966a33 29%, #06372814 33%, #001b177a 39%, transparent 48%),
    linear-gradient(123deg, transparent 44%, #66ae7929 51%, #00271f85 57%, #0c61463d 63%, transparent 72%),
    linear-gradient(117deg, #00211b66 3%, transparent 19% 70%, #79a9741f 78%, #001a1677 88%);
  filter: blur(14px);
  animation: fabric 24s ease-in-out infinite alternate;
}
/* A small, static SVG tile gives the silk an aerogel-like micrograin. */
body::after {
  content: "";
  position: fixed;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  opacity: .065;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cfilter id='grain'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.88' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Cpath fill='%23fff' filter='url(%23grain)' opacity='.8' d='M0 0h180v180H0z'/%3E%3C/svg%3E");
}
.connection {
  position: relative;
  isolation: isolate;
  overflow: clip;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: max(44px, env(safe-area-inset-top)) 24px max(40px, env(safe-area-inset-bottom));
}
/* Decorative one-pixel impulses stay behind the content and never imply status. */
.connection::before, .connection::after {
  content: "";
  position: absolute;
  z-index: -1;
  width: min(78vw, 920px);
  height: 1px;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, #d8b86622 30%, #f4d48b9c 51%, #d8b86618 70%, transparent);
  opacity: 0;
  transform: rotate(-36deg);
  animation: impulse 15s ease-in-out infinite;
}
.connection::before { top: 28%; left: -24%; }
.connection::after { right: -27%; bottom: 23%; animation-delay: -7.5s; }
.logo {
  display: block;
  width: 152px;
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: 24px;
  filter: drop-shadow(0 14px 26px #001b1670);
  margin-bottom: 26px;
}
h1 {
  max-width: 650px;
  margin: 0;
  font-size: clamp(36px, 5vw, 58px);
  font-weight: 550;
  line-height: 1.08;
  letter-spacing: -1.9px;
  text-wrap: balance;
  text-shadow: 0 3px 25px #001d1940;
}
.intro { margin: 18px 0 34px; color: #bccdb4; font-size: 15px; line-height: 1.5; letter-spacing: .25px; }
.connect {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  width: min(100%, 254px);
  min-height: 240px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 25px;
  padding: 28px 18px;
  border: 1px solid #c8aa61;
  border-radius: 30px;
  background: radial-gradient(ellipse at 28% 0, #36826477, transparent 65%), linear-gradient(148deg, #19593e 0, #0c422f 48%, #072c23 100%);
  box-shadow: 0 25px 54px #00191080, 0 7px 0 #031f19, 0 8px 0 #8b78484d, inset 0 1px 2px #fff0b74a, inset 0 -9px 22px #001b1a80;
  color: #efd797;
  cursor: pointer;
  font: inherit;
  transition: transform .2s, box-shadow .2s, border-color .2s;
  -webkit-tap-highlight-color: transparent;
}
.connect::after { content: ""; position: absolute; inset: 7px; border: 1px solid #e8cf8b22; border-radius: 23px; pointer-events: none; }
.connect span, .connect svg { position: relative; z-index: 1; }
.connect span { font-size: 21px; font-weight: 550; line-height: 1.25; letter-spacing: -.3px; text-shadow: 0 2px 8px #001c16; }
.connect svg { display: block; width: 57px; height: 57px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; filter: drop-shadow(0 0 10px #f2d18430); }
.connect:hover:not(:disabled) { transform: translateY(-2px); border-color: #f2d99a; box-shadow: 0 28px 58px #00191099, 0 9px 0 #031f19, 0 10px 0 #8b78485c, inset 0 1px 2px #fff0b766, inset 0 -9px 22px #001b1a80; }
.connect:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 14px 30px #00191080, 0 3px 0 #031f19, inset 0 1px 2px #fff0b733, inset 0 -5px 18px #001b1a80; }
.connect:focus-visible { outline: 3px solid #fff0b0; outline-offset: 8px; }
.connect:disabled { cursor: default; }
.connect[aria-busy="true"] { cursor: wait; }
.connect[data-state="pending"] { animation: waiting 2.5s ease-in-out infinite; }
.connect[data-state="connected"] { border-color: #f0d58f; }
.connect[data-state="connected"]::before { content: ""; position: absolute; inset: -120%; background: linear-gradient(110deg, transparent 43%, #f5d98d12 49%, #ffe4a326 50%, #f5d98d12 51%, transparent 57%); animation: shimmer 6s ease-in-out infinite; pointer-events: none; }
.hint { min-height: 42px; width: min(100%, 360px); margin: 24px 0 0; color: #b0c5ac; font-size: 13px; line-height: 1.6; text-wrap: balance; }
.message { position: fixed; z-index: 3; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: max-content; max-width: calc(100% - 40px); padding: 14px 18px; margin: 0; border: 1px solid #8a8553; border-radius: 12px; background: #123f2f; color: #f2eacb; font-size: 14px; line-height: 1.5; text-align: center; box-shadow: 0 10px 25px #001d1980; }
@keyframes fabric { from { transform: translate3d(-1%, -1%, 0) scale(1); opacity: .8; } to { transform: translate3d(2%, 1%, 0) scale(1.04); opacity: 1; } }
@keyframes impulse { 0%, 20%, 80%, 100% { opacity: 0; transform: translate3d(-8%, 12px, 0) rotate(-36deg); } 42%, 54% { opacity: .7; transform: translate3d(8%, -12px, 0) rotate(-36deg); } }
@keyframes waiting { 0%, 100% { border-color: #a58b48; } 50% { border-color: #f4d78e; } }
@keyframes shimmer { 0%, 20% { transform: translateX(-30%); } 65%, 100% { transform: translateX(30%); } }
[hidden] { display: none !important; }
@media (max-width: 650px) {
  .logo { width: 128px; margin-bottom: 24px; }
  h1 { max-width: 370px; letter-spacing: -1.1px; }
  .intro { font-size: 14px; margin: 16px 0 30px; }
  .connect { width: min(100%, 238px); min-height: 224px; border-radius: 27px; }
  .connect::after { border-radius: 20px; }
  .connect span { font-size: 20px; }
  .hint { max-width: 310px; }
}
@media (max-height: 740px) {
  .connection { padding-top: max(28px, env(safe-area-inset-top)); padding-bottom: max(28px, env(safe-area-inset-bottom)); }
  .logo { width: 100px; margin-bottom: 20px; }
  h1 { font-size: 34px; max-width: 460px; }
  .intro { margin: 14px 0 25px; }
  .connect { width: min(100%, 208px); min-height: 196px; gap: 21px; }
  .connect svg { width: 48px; height: 48px; }
  .hint { margin-top: 21px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .connect:hover:not(:disabled), .connect:active:not(:disabled) { transform: none; }
  .connect[data-state="pending"] { border-color: #e6c77a; }
  .connect[data-state="connected"]::before { display: none; }
  .connection::before, .connection::after { opacity: .32; }
}
