*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  position: relative;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  color: #f4f0ff;
  /* Purple underlay (replaces flat black) */
  background: radial-gradient(ellipse 130% 95% at 18% -8%, #4c2870 0%, #2a1540 38%, #150a22 72%, #0f0618 100%);
}

/* Layer 1 — wave art, semi-transparent so purple shows through */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  background: url("/assets/Image.png") center bottom / cover no-repeat;
  opacity: 0.46;
  pointer-events: none;
}

/* Layer 2 — BG2 on top; lowered opacity so Image layer reads through */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  background: url("/assets/BG2.png") center / cover no-repeat;
  opacity: 0.78;
  pointer-events: none;
}

.app {
  position: relative;
  z-index: 1;
  max-width: 420px;
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding-top: max(4px, env(safe-area-inset-top));
}

.brand__logo {
  display: block;
  width: min(380px, 92vw);
  height: auto;
  max-height: min(34vh, 240px);
  object-fit: contain;
  object-position: center top;
  filter: drop-shadow(0 8px 28px rgba(0, 0, 0, 0.55));
}

.brand__title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.6);
}

.brand__tag {
  margin: 2px 0 0;
  font-size: 0.88rem;
  opacity: 0.88;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.55);
}

.card {
  background: linear-gradient(
    155deg,
    rgba(72, 38, 108, 0.82) 0%,
    rgba(42, 22, 68, 0.88) 48%,
    rgba(28, 12, 48, 0.9) 100%
  );
  border: 1px solid rgba(200, 160, 255, 0.28);
  border-radius: 20px;
  padding: 22px 20px;
  box-shadow: 0 12px 40px rgba(12, 4, 24, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(12px);
}

.card__title {
  margin: 0 0 8px;
  font-size: 1.2rem;
}

.card__hint {
  margin: 0 0 18px;
  font-size: 0.88rem;
  line-height: 1.45;
  opacity: 0.88;
}

.screen {
  display: none;
}

.screen--active {
  display: block;
}

.field {
  display: block;
  margin-bottom: 16px;
}

.field__label {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.75;
  margin-bottom: 8px;
}

.field__input {
  width: 100%;
  padding: 14px 16px;
  font-size: 1.05rem;
  border-radius: 14px;
  border: 1px solid rgba(200, 170, 255, 0.22);
  background: rgba(22, 10, 40, 0.55);
  color: inherit;
  outline: none;
}

.field__input:focus {
  border-color: rgba(190, 150, 255, 0.65);
  box-shadow: 0 0 0 3px rgba(140, 90, 200, 0.28);
}

.field__input::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 15px 18px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  transition: transform 0.08s ease, filter 0.15s ease;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn--primary {
  color: #0d1a0d;
  background: #7ecf7e url("/assets/Vert.png") center / cover no-repeat;
  background-blend-mode: soft-light;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.btn--primary:hover:not(:disabled) {
  filter: brightness(1.06);
}

.btn--ghost {
  width: auto;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 500;
  color: #f4f0ff;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn--small {
  border-radius: 12px;
}

.msg {
  margin: 12px 0 0;
  font-size: 0.9rem;
}

.msg--error {
  color: #ffb4b4;
}

.talk-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.talk-room {
  margin: 0;
  font-size: 0.95rem;
}

.status {
  margin: 0 0 12px;
  font-size: 0.88rem;
  opacity: 0.9;
}

.peer-list {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.peer-list li {
  font-size: 0.82rem;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(180, 140, 255, 0.2);
  border: 1px solid rgba(200, 170, 255, 0.35);
}

.peer-list li.is-self {
  background: rgba(126, 207, 126, 0.25);
  border-color: rgba(144, 238, 144, 0.45);
}

.ptt-wrap {
  display: flex;
  justify-content: center;
  padding: 8px 0 4px;
}

.ptt {
  position: relative;
  width: min(220px, 70vw);
  height: min(220px, 70vw);
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.25);
  cursor: pointer;
  touch-action: none;
  color: #0d1a0d;
  font-weight: 700;
  font-size: 1.05rem;
  background: radial-gradient(circle at 30% 25%, #c8ffc8, #5cb85c 45%, #2d7a2d);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45), inset 0 2px 12px rgba(255, 255, 255, 0.35);
}

.ptt:disabled {
  filter: grayscale(0.5);
  cursor: not-allowed;
}

.ptt__ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 3px solid transparent;
  pointer-events: none;
}

.ptt.is-active .ptt__ring {
  border-color: rgba(255, 220, 120, 0.95);
  animation: pulse 1.1s ease-out infinite;
}

.ptt.is-active {
  background: radial-gradient(circle at 30% 25%, #ffe8a8, #e8a020 50%, #b87309);
  color: #2a1a05;
}

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  100% {
    transform: scale(1.12);
    opacity: 0;
  }
}

.ptt__label {
  position: relative;
  z-index: 1;
}

.ptt-hint {
  margin: 14px 0 0;
  text-align: center;
  font-size: 0.82rem;
  line-height: 1.4;
  opacity: 0.82;
}
