html, body { height: 100%; }

body {
  overflow: hidden;
  background: #ffffff;
  color: var(--ink);
  user-select: none;
}

body.is-fullscreen.hide-chrome,
body.is-fullscreen.hide-chrome * { cursor: none; }

#stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(1280px 820px at 50% 42%, #ffffff 0%, #f8fcff 64%, #edf6fd 100%);
}

/* Subtle architectural oceanic dot grid */
#stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(14, 122, 230, 0.085) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
}

/* Feathered luminous white vignette on left & right edges for seamless infinity */
#stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.96) 0%,
    rgba(255, 255, 255, 0) 9%,
    rgba(255, 255, 255, 0) 91%,
    rgba(255, 255, 255, 0.96) 100%
  );
}

.wall-ambient {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.wall-ribbons {
  height: clamp(96px, 16vh, 175px);
}

#idle {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px;
  text-align: center;
}

.idle-halo {
  position: absolute;
  width: min(56vw, 540px);
  height: min(56vw, 540px);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 199, 214, 0.14) 0%, rgba(14, 122, 230, 0.07) 44%, transparent 72%);
  filter: blur(22px);
  pointer-events: none;
  animation: haloPulse 6.5s ease-in-out infinite alternate;
}

@keyframes haloPulse {
  0% { transform: scale(0.92); opacity: 0.72; }
  100% { transform: scale(1.08); opacity: 1; }
}

.idle-logo {
  position: relative;
  width: clamp(200px, 28vw, 360px);
  height: auto;
  display: block;
  margin-bottom: 6px;
  filter: drop-shadow(0 16px 34px rgba(11, 40, 92, 0.12));
}

.hud-logo {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  left: max(22px, env(safe-area-inset-left));
  z-index: 5;
  height: clamp(36px, 4.6vh, 54px);
  width: auto;
  display: block;
  pointer-events: none;
  opacity: 0.95;
  filter: drop-shadow(0 6px 14px rgba(11, 40, 92, 0.08));
  transition: opacity 0.4s ease;
}

body[data-phase="waiting"] .hud-logo {
  opacity: 0;
}

.idle-mark {
  position: relative;
  width: clamp(140px, 20vw, 240px);
  height: 3px;
  background: rgba(14, 122, 230, 0.14);
  border-radius: 999px;
  overflow: hidden;
}

#idle-line {
  width: 100%;
  height: 100%;
  background: var(--wave-grad-bright);
  transform: scaleX(0.2);
  transform-origin: left center;
}

/* Cardless Multi-Row Kinetic Signature Wall */
#wall-layer {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  padding: clamp(58px, 7.5vh, 92px) 0 clamp(50px, 6.5vh, 76px);
  will-change: transform, opacity, filter;
}

.wall-row {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  align-items: center;
  overflow: visible;
}

/* Delicate ocean-tinted hairline divider between stacked rows */
.wall-row + .wall-row::before {
  content: "";
  position: absolute;
  top: 0;
  left: 5vw;
  right: 5vw;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(44, 39, 118, 0.10) 16%,
    rgba(14, 122, 230, 0.18) 50%,
    rgba(0, 199, 214, 0.14) 84%,
    transparent 100%
  );
  pointer-events: none;
}

.row-track {
  display: flex;
  align-items: center;
  will-change: transform;
}

/* Pure floating black-ink signature — NO card box */
.sig-item {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: clamp(10px, 1.6vh, 18px) clamp(26px, 3.6vw, 60px);
  will-change: transform, opacity;
}

/* Minimal azure hairline vertical separator between signatures */
.sig-item::after {
  content: "";
  position: absolute;
  right: 0;
  top: 32%;
  bottom: 32%;
  width: 1px;
  background: linear-gradient(180deg, transparent, rgba(14, 122, 230, 0.18), transparent);
  pointer-events: none;
}

.sig-item img {
  display: block;
  max-width: none;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 6px 14px rgba(11, 40, 92, 0.08));
  transition: opacity 0.5s ease, filter 0.5s ease;
}

.sig-item.is-echo img {
  opacity: 0.34;
  filter: none;
}

.sig-item.is-new img {
  filter: drop-shadow(0 12px 26px rgba(14, 122, 230, 0.22));
}

/* Glowing WAVE gradient underline on newly landed signature */
.sig-item.is-new::before {
  content: "";
  position: absolute;
  left: 16%;
  right: 16%;
  bottom: 3px;
  height: 3px;
  border-radius: 999px;
  background: var(--wave-grad-bright);
  box-shadow: 0 0 14px rgba(0, 199, 214, 0.55);
}

.tile-badge {
  position: absolute;
  top: 6px;
  left: clamp(22px, 3.2vw, 54px);
  font-family: var(--mono);
  font-size: clamp(9.5px, 0.85vw, 11.5px);
  font-weight: 700;
  letter-spacing: 0.14em;
  color: rgba(11, 40, 92, 0.30);
  pointer-events: none;
  transition: color 0.4s ease;
}

.sig-item.is-new .tile-badge {
  color: var(--wave-azure);
}

/* Open, cardless luminous spotlight stage for live stroke drawing */
#hero-layer {
  position: fixed;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  padding: clamp(24px, 5vw, 72px);
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(
    ellipse 72% 62% at 50% 50%,
    rgba(255, 255, 255, 0.97) 0%,
    rgba(244, 250, 255, 0.84) 54%,
    rgba(237, 246, 253, 0) 100%
  );
}

.hero-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(18px, 3vh, 30px);
  width: min(86vw, 1040px);
  will-change: transform, opacity;
}

.hero-burst-ring {
  position: absolute;
  width: min(46vw, 420px);
  height: min(46vw, 420px);
  border-radius: 50%;
  border: 2px solid rgba(0, 199, 214, 0.65);
  box-shadow: 0 0 36px rgba(14, 122, 230, 0.25);
  opacity: 0;
  transform: scale(0.35);
  pointer-events: none;
}

.hero-meta {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 6px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(14, 122, 230, 0.20);
  box-shadow: 0 8px 24px rgba(11, 40, 92, 0.08);
  font-family: var(--mono);
  font-size: clamp(11px, 1vw, 13px);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--wave-navy);
}

.hero-dot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--wave-azure);
  font-weight: 750;
}

.hero-dot::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--wave-aqua);
  animation: pulseRing 1.7s cubic-bezier(0.22, 1, 0.36, 1) infinite;
}

#draw-slot {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: clamp(160px, 34vh, 380px);
}

#draw-slot svg {
  display: block;
  overflow: visible;
}

.hero-progress {
  width: min(380px, 56vw);
  height: 3px;
  background: rgba(14, 122, 230, 0.14);
  border-radius: 999px;
  overflow: hidden;
}

.hero-progress-bar {
  width: 100%;
  height: 100%;
  background: var(--wave-grad-bright);
  box-shadow: 0 0 12px rgba(0, 199, 214, 0.55);
  transform: scaleX(0);
  transform-origin: left center;
}

/* Minimal top/bottom HUD chrome */
.hud-bottom {
  position: fixed;
  left: max(24px, env(safe-area-inset-left));
  right: max(24px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

#status,
#wall-count {
  margin: 0;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(11, 40, 92, 0.52);
}

.hud-actions {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  right: max(18px, env(safe-area-inset-right));
  z-index: 6;
  display: flex;
  gap: 8px;
  transition: opacity 0.25s ease;
}

.hud-actions button {
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid rgba(14, 122, 230, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--wave-navy);
  font-size: 13.5px;
  font-weight: 650;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 6px 18px rgba(11, 40, 92, 0.08);
}

.hud-actions button:hover {
  background: #ffffff;
  border-color: var(--wave-azure);
  transform: translateY(-1px);
}

body.is-fullscreen.hide-chrome .hud-actions {
  opacity: 0;
  pointer-events: none;
}

@media (orientation: portrait) {
  .idle-logo {
    width: clamp(220px, 46vw, 380px);
  }

  .hud-logo {
    height: clamp(36px, 4.2vh, 52px);
  }
}

@media (max-width: 640px) {
  .hud-actions button {
    padding: 0 12px;
    font-size: 12.5px;
  }
}
