:root {
  --bg: #f5f9fb;
  --paper: #ffffff;
  --ink: #182132;
  --muted: #697386;
  --line: #d9dee8;
  --brand: #123d6b;
  --brand-dark: #0d2d50;
  --sea: #57a7c7;
  --sea-soft: #dff2f6;
  --accent: #d4a24c;
  --danger: #b42318;
  --success: #147a4a;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 5%, rgba(87, 167, 199, 0.22), transparent 28%),
    radial-gradient(circle at 90% 12%, rgba(212, 162, 76, 0.14), transparent 26%),
    linear-gradient(180deg, #f6fbfd 0%, var(--bg) 48%, #eef6f8 100%);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

@media (prefers-reduced-motion: no-preference) {
  body {
    animation: pageGlow 12s ease-in-out infinite alternate;
  }
}

button,
input,
select,
textarea {
  font: inherit;
}

.hidden {
  display: none !important;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

@keyframes pageGlow {
  from {
    background-position: 0 0, 100% 0, 0 0;
  }

  to {
    background-position: 30px 18px, calc(100% - 24px) 12px, 0 0;
  }
}

.survey-page {
  background:
    radial-gradient(circle at 50% -80px, rgba(87, 167, 199, 0.34), transparent 270px),
    linear-gradient(180deg, rgba(18, 61, 107, 0.09), transparent 280px),
    var(--bg);
}

.mobile-shell {
  width: min(100%, 720px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 30px 22px 38px;
}

.brand-block h1 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 2.35rem;
  line-height: 1;
}

.brand-block h1 .wiggle-s {
  margin-left: -10px;
}

.wiggle-s {
  display: inline-block;
  transform-origin: 50% 80%;
}

@media (prefers-reduced-motion: no-preference) {
  .wiggle-s {
    animation: playfulS 2.8s ease-in-out infinite;
  }
}

@keyframes playfulS {
  0%,
  72%,
  100% {
    transform: translateY(0) rotate(0deg) scale(1);
  }

  78% {
    transform: translateY(-3px) rotate(-7deg) scale(1.08);
  }

  86% {
    transform: translateY(1px) rotate(6deg) scale(0.98);
  }

  93% {
    transform: translateY(-1px) rotate(-3deg) scale(1.03);
  }
}

.brand-logo {
  display: block;
  width: min(265px, 82vw);
  height: auto;
  position: relative;
  z-index: 3;
  mix-blend-mode: multiply;
}

.logo-water {
  position: relative;
  display: grid;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto 22px;
  padding: 18px 24px 24px;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(87, 167, 199, 0.22);
  border-radius: 8px 8px 22px 22px;
  background:
    radial-gradient(circle at 20% 25%, rgba(255, 255, 255, 0.96), transparent 28%),
    linear-gradient(145deg, rgba(222, 246, 250, 0.9), rgba(255, 255, 255, 0.5), rgba(107, 181, 205, 0.42));
  box-shadow:
    0 20px 48px rgba(18, 61, 107, 0.16),
    inset 0 1px 18px rgba(255, 255, 255, 0.74);
  isolation: isolate;
}

.logo-water::before,
.logo-water::after {
  position: absolute;
  inset: -45%;
  content: "";
  background:
    radial-gradient(ellipse at 50% 50%, transparent 33%, rgba(255, 255, 255, 0.52) 34%, transparent 37%),
    repeating-linear-gradient(112deg, rgba(18, 94, 138, 0.12) 0 9px, transparent 9px 23px);
  filter: blur(6px);
  opacity: 0.9;
  transform-origin: center;
  z-index: 1;
  animation: seaDrift 8s ease-in-out infinite;
}

.logo-water::after {
  background:
    radial-gradient(ellipse at 50% 50%, transparent 38%, rgba(255, 255, 255, 0.32) 39%, transparent 41%),
    repeating-linear-gradient(68deg, rgba(212, 162, 76, 0.08) 0 8px, transparent 8px 22px);
  animation-direction: reverse;
  animation-duration: 11s;
  opacity: 0.7;
}

.wave-line {
  position: absolute;
  left: -15%;
  z-index: 2;
  width: 130%;
  height: 34px;
  border-radius: 50%;
  border-top: 3px solid rgba(255, 255, 255, 0.82);
  border-bottom: 2px solid rgba(87, 167, 199, 0.24);
  opacity: 0.88;
  transform: translateX(0);
  animation: waveSlide 4.8s ease-in-out infinite;
}

.wave-one {
  bottom: 10px;
}

.wave-two {
  bottom: 24px;
  animation-delay: -1.6s;
  opacity: 0.58;
}

.wave-three {
  bottom: -2px;
  animation-delay: -3s;
  opacity: 0.45;
}

@keyframes waveSlide {
  0% {
    transform: translateX(-7%) translateY(0) scaleX(1);
  }

  50% {
    transform: translateX(7%) translateY(-5px) scaleX(1.04);
  }

  100% {
    transform: translateX(-7%) translateY(0) scaleX(1);
  }
}

@keyframes seaDrift {
  0% {
    transform: translate3d(-3%, -1%, 0) rotate(0deg) scale(1);
  }

  50% {
    transform: translate3d(4%, 3%, 0) rotate(5deg) scale(1.06);
  }

  100% {
    transform: translate3d(-3%, -1%, 0) rotate(0deg) scale(1);
  }
}

.intro {
  color: var(--muted);
  font-size: 1.03rem;
}

.friendly-note {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 22px;
  padding: 12px 14px;
  border: 1px solid rgba(87, 167, 199, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  color: #355064;
  line-height: 1.35;
}

@media (prefers-reduced-motion: no-preference) {
  .brand-block,
  .form-panel,
  .admin-header,
  .toolbar,
  .stats div,
  .survey-card,
  .login-panel .form-panel {
    animation: softEnter 0.55s ease both;
  }

  .form-panel {
    animation-delay: 0.08s;
  }

  .toolbar,
  .stats div,
  .survey-card {
    animation-delay: 0.05s;
  }
}

@keyframes softEnter {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.title-icon,
.note-icon,
.stat-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--sea-soft);
  color: var(--brand);
}

.title-icon {
  width: 38px;
  height: 38px;
}

.note-icon {
  width: 30px;
  height: 30px;
}

.title-icon svg,
.note-icon svg,
.stat-icon svg {
  width: 58%;
  height: 58%;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.form-panel {
  display: grid;
  gap: 18px;
  width: 100%;
}

.survey-page .form-panel {
  padding: 18px;
  border: 1px solid rgba(217, 222, 232, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 18px 50px rgba(18, 61, 107, 0.11);
  backdrop-filter: blur(10px);
}

.survey-page .form-panel.is-submitted {
  min-height: 520px;
  place-items: center;
}

.survey-page .form-panel.is-submitted > :not(.success-panel) {
  display: none;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

legend,
.field span {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-weight: 700;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

@media (prefers-reduced-motion: no-preference) {
  .segmented {
    transition: box-shadow 0.2s ease, transform 0.2s ease;
  }

  .segmented:focus-within {
    box-shadow: 0 14px 26px rgba(18, 61, 107, 0.1);
    transform: translateY(-1px);
  }
}

.segmented label {
  cursor: pointer;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented span {
  display: grid;
  min-height: 46px;
  place-items: center;
  border-radius: 6px;
  color: var(--muted);
  font-weight: 700;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.segmented input:checked + span {
  background: var(--brand);
  color: #fff;
  transform: scale(1.02);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  outline: 0;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.field input,
.field select {
  min-height: 48px;
  padding: 0 14px;
}

.field textarea {
  min-height: 180px;
  padding: 14px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(18, 61, 107, 0.14);
  transform: translateY(-1px);
  background: #fff;
}

.voice-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.voice-row p,
.form-message {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.primary-button,
.secondary-button {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.primary-button {
  background: linear-gradient(135deg, var(--brand), #176391);
  color: #fff;
  box-shadow: 0 12px 24px rgba(18, 61, 107, 0.2);
}

.primary-button:hover {
  background: var(--brand-dark);
  transform: translateY(-2px);
  box-shadow: 0 16px 28px rgba(18, 61, 107, 0.24);
}

.primary-button:active,
.secondary-button:active,
.mic-button:active,
.delete-button:active {
  transform: translateY(1px) scale(0.99);
}

.secondary-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(18, 61, 107, 0.12);
}

.secondary-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  color: var(--brand);
}

.mic-button {
  display: inline-grid;
  width: 52px;
  min-width: 52px;
  height: 52px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: linear-gradient(180deg, #fff, #eef8fb);
  color: var(--brand);
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(18, 61, 107, 0.12);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.mic-button svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.mic-button:hover {
  border-color: var(--brand);
  background: #eef5fb;
  transform: translateY(-2px) rotate(-3deg);
  box-shadow: 0 16px 28px rgba(18, 61, 107, 0.16);
}

.mic-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.secondary-button.listening,
.mic-button.listening {
  border-color: var(--accent);
  background: #fff7e8;
  color: #7a4e00;
}

@media (prefers-reduced-motion: no-preference) {
  .mic-button.listening {
    animation: listeningPulse 1.15s ease-in-out infinite;
  }
}

@keyframes listeningPulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(212, 162, 76, 0.32);
  }

  50% {
    box-shadow: 0 0 0 9px rgba(212, 162, 76, 0);
  }
}

.form-message.error {
  color: var(--danger);
}

.form-message.success {
  color: var(--success);
}

.protest-gif-wrap {
  overflow: hidden;
  border: 1px solid rgba(87, 167, 199, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 12px 26px rgba(18, 61, 107, 0.1);
}

.protest-gif-wrap img {
  display: block;
  width: 100%;
  height: auto;
}

.success-panel {
  display: grid;
  width: 100%;
  gap: 14px;
  text-align: center;
}

.success-title {
  margin: 0;
  color: var(--success);
  font-size: 1.45rem;
  font-weight: 800;
}

.success-copy {
  margin: 0;
  color: var(--muted);
}

@media (prefers-reduced-motion: no-preference) {
  .success-panel {
    animation: successReveal 0.62s ease both;
  }

  .success-panel .protest-gif-wrap {
    animation: gifPop 0.72s ease 0.12s both;
  }
}

@keyframes successReveal {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes gifPop {
  from {
    opacity: 0;
    transform: scale(0.96);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 28px;
  padding: 16px 0 4px;
}

.site-footer img {
  display: block;
  width: min(280px, 74vw);
  height: auto;
  border-radius: 6px;
  box-shadow: 0 12px 28px rgba(18, 61, 107, 0.1);
}

.qr-toggle {
  align-self: center;
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid rgba(18, 61, 107, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--brand);
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 800;
}

.qr-panel {
  display: grid;
  flex-basis: 100%;
  justify-items: center;
  gap: 8px;
  margin-top: 4px;
}

.qr-panel img {
  width: min(190px, 48vw);
  border-radius: 8px;
  box-shadow: 0 12px 26px rgba(18, 61, 107, 0.12);
}

.qr-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.admin-footer {
  margin-top: 30px;
}

.admin-footer img {
  width: min(340px, 42vw);
}

.desktop-block,
.mobile-block {
  display: none;
  min-height: 100vh;
  place-items: center;
  padding: 32px;
  text-align: center;
}

.desktop-block div,
.mobile-block div {
  width: min(520px, 100%);
}

.desktop-admin {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 30px 0 44px;
}

.admin-page {
  background:
    radial-gradient(circle at 0% 0%, rgba(87, 167, 199, 0.22), transparent 32%),
    radial-gradient(circle at 100% 0%, rgba(212, 162, 76, 0.12), transparent 30%),
    linear-gradient(180deg, #f8fcfd, #eef6f8);
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
  padding: 18px;
  border: 1px solid rgba(217, 222, 232, 0.82);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 16px 38px rgba(18, 61, 107, 0.08);
  backdrop-filter: blur(10px);
}

.admin-header h1 {
  margin-bottom: 0;
  font-size: 2rem;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 18px;
}

.admin-brand .brand-logo {
  width: 170px;
}

.admin-brand .logo-water {
  margin: 0;
  padding: 10px 14px 16px;
}

.login-panel {
  display: grid;
  min-height: 65vh;
  place-items: center;
}

.login-panel .form-panel {
  max-width: 420px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 18px 50px rgba(18, 61, 107, 0.11);
  backdrop-filter: blur(10px);
}

.login-panel h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.toolbar {
  display: flex;
  align-items: end;
  gap: 14px;
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid rgba(217, 222, 232, 0.82);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 12px 28px rgba(18, 61, 107, 0.06);
}

.compact {
  min-width: 220px;
}

.grow {
  flex: 1;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stats-two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stats div {
  position: relative;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 10px 24px rgba(18, 61, 107, 0.06);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.stats div:hover,
.survey-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 32px rgba(18, 61, 107, 0.1);
}

.stats span {
  display: block;
  color: var(--brand);
  font-size: 2rem;
  font-weight: 800;
}

.stats .stat-icon {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 38px;
  height: 38px;
  color: #176391;
}

.stats p {
  margin: 4px 0 0;
  color: var(--muted);
}

.survey-list {
  display: grid;
  gap: 12px;
}

.survey-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 10px 24px rgba(18, 61, 107, 0.06);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.survey-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.survey-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #edf7fa;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 700;
}

.survey-text {
  margin: 0;
  color: #29364a;
  line-height: 1.55;
  white-space: pre-wrap;
}

.delete-button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(180, 35, 24, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--danger);
  cursor: pointer;
  font-weight: 800;
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.delete-button:hover {
  background: #fff1f0;
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(180, 35, 24, 0.1);
}

.delete-button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.empty-state {
  padding: 40px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 560px) {
  .mobile-shell {
    width: min(100%, 520px);
    padding: 28px 18px 36px;
  }
}

@media (min-width: 1100px) {
  .survey-page .mobile-shell {
    display: none;
  }

  .survey-page .desktop-block {
    display: grid;
  }
}

@media (max-width: 1024px) {
  .desktop-admin {
    width: min(100% - 28px, 760px);
    padding: 18px 0 32px;
  }

  .admin-header,
  .admin-brand,
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-brand {
    text-align: center;
  }

  .admin-brand .logo-water {
    margin: 0 auto;
  }

  .admin-header h1,
  .admin-header .eyebrow {
    text-align: center;
  }

  .compact {
    min-width: 0;
  }

  .stats,
  .stats-two {
    grid-template-columns: 1fr;
  }

  .survey-card-header {
    flex-direction: column;
  }

  .delete-button {
    width: 100%;
  }

  .admin-footer img {
    width: min(300px, 78vw);
  }
}
