:root {
  color-scheme: light;
  --ink: #142032;
  --muted: #5d697c;
  --line: rgba(20, 32, 50, 0.12);
  --paper: rgba(255, 255, 255, 0.86);
  --panel: rgba(255, 255, 255, 0.74);
  --blue: #1685c7;
  --green: #3b9d7d;
  --rose: #d45236;
  --amber: #e8b914;
  --violet: #7d6fd1;
  --shadow: 0 26px 70px rgba(22, 38, 61, 0.18);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.38)),
    url("/audience-background.jpg") center / cover fixed;
  color: var(--ink);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.1);
  content: "";
}

button,
textarea {
  font: inherit;
}

.stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  gap: 24px;
  min-height: 100vh;
  padding: 32px;
}

.cloud-panel,
.side-panel,
.submit-panel {
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px) saturate(1.08);
}

.cloud-panel {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 56px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.82)),
    rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  padding: 34px;
}

.stage-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(30px, 5vw, 64px);
  line-height: 1.05;
}

.counter {
  display: grid;
  justify-items: end;
  min-width: 112px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
}

.counter span {
  font-size: 46px;
  font-weight: 900;
  line-height: 1;
}

.counter small {
  color: var(--muted);
  font-weight: 700;
}

.word-cloud {
  position: relative;
  display: flex;
  flex: 1;
  align-content: center;
  align-items: center;
  justify-content: center;
  gap: 14px 22px;
  flex-wrap: wrap;
  overflow: hidden;
  min-height: 56vh;
  padding: 34px 18px;
}

.word-cloud::before {
  position: absolute;
  inset: 18px 0;
  z-index: -1;
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.2) 62%, transparent 75%);
  content: "";
}

.cloud-word {
  position: relative;
  display: inline-flex;
  max-width: 100%;
  padding: 0 0.48em 0.22em 0;
  font-weight: 900;
  line-height: 1.05;
  transform: rotate(var(--tilt));
  transition: transform 180ms ease, opacity 180ms ease;
  overflow-wrap: anywhere;
}

.cloud-word-label {
  overflow-wrap: anywhere;
}

.cloud-word-count {
  position: absolute;
  right: 0;
  bottom: 0;
  display: grid;
  place-items: center;
  min-width: 1.45em;
  height: 1.45em;
  padding: 0 0.28em;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  box-shadow: 0 7px 18px rgba(20, 32, 50, 0.22);
  font-size: 0.24em;
  line-height: 1;
}

.cloud-word.is-repeated {
  text-shadow: 0 8px 22px rgba(20, 32, 50, 0.14);
}

.cloud-word:hover {
  transform: rotate(0deg) scale(1.06);
}

.cloud-word.ink {
  color: var(--ink);
}

.cloud-word.blue {
  color: var(--blue);
}

.cloud-word.green {
  color: var(--green);
}

.cloud-word.rose {
  color: var(--rose);
}

.cloud-word.amber {
  color: var(--amber);
}

.cloud-word.violet {
  color: var(--violet);
}

.empty-state {
  color: var(--muted);
  padding: 18px 22px;
  border: 1px dashed rgba(20, 32, 50, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.66);
  font-size: 24px;
  font-weight: 800;
}

.side-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--panel);
  border-radius: 8px;
  padding: 20px;
}

.qr-card {
  display: grid;
  justify-items: center;
  gap: 12px;
  text-align: center;
}

.qr-code {
  display: grid;
  place-items: center;
  width: 100%;
  max-width: 260px;
  aspect-ratio: 1;
  border: 12px solid #fff;
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(23, 32, 51, 0.16);
}

.qr-code img,
.qr-code canvas {
  width: 100%;
  height: auto;
}

.qr-card p {
  margin: 0;
  font-weight: 800;
}

.qr-card a {
  color: var(--blue);
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.controls {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

button {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
  box-shadow: 0 12px 24px rgba(20, 32, 50, 0.18);
}

button:hover {
  filter: brightness(1.08);
}

.controls button:last-child {
  background: var(--blue);
}

.audience {
  display: grid;
  place-items: center;
  padding: 18px;
}

.phone-shell {
  width: min(100%, 460px);
}

.submit-panel {
  background: rgba(255, 255, 255, 0.86);
  border-radius: 8px;
  padding: 28px;
}

.submit-panel h1 {
  font-size: 34px;
}

.hint {
  margin: 10px 0 24px;
  color: var(--muted);
}

form {
  display: grid;
  gap: 12px;
}

label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  outline: none;
}

textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.14);
}

.status-text {
  min-height: 24px;
  margin: 18px 0 0;
  color: var(--green);
  font-weight: 800;
}

@media (max-width: 860px) {
  .stage {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .cloud-panel {
    min-height: 62vh;
    padding: 20px;
  }

  .stage-top {
    align-items: flex-start;
  }

  .side-panel {
    gap: 20px;
  }
}

@media (max-width: 560px) {
  .stage-top {
    display: grid;
  }

  .counter {
    justify-items: start;
  }

  h1 {
    font-size: 32px;
  }

  .cloud-word {
    font-size: min(var(--mobile-size, 34px), 15vw) !important;
  }
}
