* {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root .dark {
  --backgroundColour: #0a0e1a;
  --surfaceColour: rgba(255, 255, 255, 0.07);
  --surfaceBorder: rgba(255, 255, 255, 0.12);
  --textColour: #e2e8f8;
  --textMuted: rgba(226, 232, 248, 0.85);
  --btnPrimary: rgba(79, 142, 247, 0.25);
  --btnPrimaryText: #ffffff;
  --btnSkip: rgba(255, 255, 255, 0.08);
  --btnSkipText: rgba(226, 232, 248, 0.6);
  --accent: rgba(166, 139, 248, 1);
  --inputBg: rgba(255, 255, 255, 0.05);
  --inputBorder: rgba(255, 255, 255, 0.15);
  --inputFocus: #4f8ef7;
}

:root .light {
  --backgroundColour: #f0f2f8;
  --textColour: #000;
}

/* Base */

html,
body {
  min-height: 100%;
}

body {
  background-color: var(--backgroundColour);
  color: var(--textColour);
  width: 100%;
  overflow-x: hidden;
}

.page-wrapper {
  position: relative;
  width: 100%;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
}

.page-wrapper::before {
  content: "";
  width: 80vw;
  height: 80vw;
  background: radial-gradient(#a78bfa1c 5%, rgba(0, 0, 0, 0) 25%);
  position: absolute;
  top: -40vw;
  left: 10vw;
  z-index: -2;
  pointer-events: none;
}

.thankyou-page {
  min-height: 100svh;
}

.thankyou-page .page-header {
  margin: 64px 0 24px;
}

.thankyou-page .study-footer {
  margin: 24px 0 64px;
}

/* Index */

.consent-container {
  position: relative;
  width: min(100%, 880px);
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.page-header {
  text-align: center;
  margin: 64px 0 48px;
  position: relative;
  z-index: 3;
}

.study-label {
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.1;
  font-weight: 600;
  cursor: default;
  text-shadow:
    0 0 5px rgba(0, 0, 0, 0.15),
    0 0 15px rgba(0, 0, 0, 0.1),
    0 0 30px rgba(0, 0, 0, 0.05);
  flex: 0 0 auto;
}

.blob-1,
.blob-2 {
  position: absolute;
  width: clamp(9rem, 16vw, 16rem);
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  box-shadow:
    0 0 5px rgba(0, 0, 0, 0.15),
    0 0 15px rgba(0, 0, 0, 0.15),
    0 0 30px rgba(0, 0, 0, 0.15);
  filter: blur(3px);
  -webkit-filter: blur(3px);
  opacity: 0.7;
  pointer-events: none;
  z-index: 0;
}

.blob-1 {
  left: -8rem;
  top: clamp(1rem, 8vh, 5rem);
  background: linear-gradient(45deg, var(--accent), var(--btnPrimary));
  animation: floatUp 8s ease-in-out infinite;
}

.blob-2 {
  right: -8rem;
  bottom: clamp(2rem, 8vh, 5rem);
  background: linear-gradient(-45deg, var(--btnPrimary), var(--accent));
  animation: floatDown 8s ease-in-out infinite;
}

.card {
  position: relative;
  z-index: 1;
  background-color: var(--surfaceColour);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  width: min(78vw, 980px);
  min-height: 58vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: var(--surfaceBorder) 2px solid;
  border-radius: clamp(28px, 4vw, 48px);
  overflow: hidden;
  padding: clamp(2rem, 4vw, 3.25rem);
}

.card::before {
  content: "";
  position: absolute;
  top: -25%;
  left: 0%;
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0),
    rgba(255, 255, 255, 0.08),
    rgba(0, 0, 0, 0)
  );
  width: 16px;
  height: 150%;
  animation: cardGlint ease forwards 7s infinite;
  pointer-events: none;
  opacity: 0.4;
}

.consent-form-section {
  position: relative;
  z-index: 1;
  width: min(100%, 1080px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.consent-form-section h2 {
  font-size: clamp(1.75rem, 3vw, 2rem);
  line-height: 1.1;
  margin-bottom: 0.5rem;
}

.subheading {
  color: var(--textMuted);
  padding: 0.5rem 0;
  font-size: clamp(0.95rem, 1.2vw, 1.125rem);
}

#consent-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 0.75rem;
}

.consent-checks {
  width: min(100%, 72ch);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: left;
}

.consent-check {
  margin: 0.2rem 0;
  font-size: clamp(0.95rem, 1.15vw, 1.125rem);
  line-height: 1.4;
  display: flex;
  align-items: first baseline;
  gap: 0.5rem;
  letter-spacing: 0.55px;
}

.consent-check input {
  flex: 0 0 auto;
}

.consent-check input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 0.95rem;
  height: 0.95rem;
  flex: 0 0 0.95rem;
  margin-top: 0.18rem;
  transform: translateY(0.13rem);
  border-radius: 4px;
  border: 1px solid rgba(226, 232, 248, 0.45);
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: all 0.18s ease;
  line-height: 1.4;
}

.consent-check input[type="checkbox"]:hover {
  border-color: rgba(99, 102, 241, 0.85);
  background: rgba(99, 102, 241, 0.12);
}

.consent-check input[type="checkbox"]:checked {
  background: rgba(99, 102, 241, 0.7);
  border-color: rgba(99, 102, 241, 1);
  box-shadow:
    0 0 5px rgba(99, 102, 241, 0.15),
    0 0 12px rgba(99, 102, 241, 0.1),
    inset 0 0 4px rgba(255, 255, 255, 0.15);
}

.consent-check input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;

  width: 4px;
  height: 8px;

  border: solid white;
  border-width: 0 2px 2px 0;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);

  left: 3.5px;
  top: 0.5px;

  transform: rotate(45deg);
}

.consent-check input[type="checkbox"]:focus-visible {
  outline: 2px solid rgba(79, 142, 247, 0.9);
  outline-offset: 3px;
}

.consent-check span {
  padding-left: 2px;
}

.consent-check a,
.email,
.info-link {
  text-decoration: none;
  color: rgba(79, 142, 247, 0.8);
  transition: all ease 0.2s;
}

.consent-check a:hover,
.email:hover,
.info-link:hover {
  color: rgba(79, 142, 247, 0.6);
}

.final,
.final-second {
  color: var(--textMuted);
  font-size: clamp(0.95rem, 1.15vw, 1.125rem);
  line-height: 1.35;
}

.final {
  padding-top: 0.9rem;
  padding-bottom: 0.15rem;
}

.final-second {
  padding-bottom: 0.15rem;
}

.final-agreement {
  color: var(--textMuted);
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  font-size: clamp(0.75rem, 0.9vw, 0.875rem);
  line-height: 1.35;
}

.btn {
  color: var(--textColour);
  border: none;
  font-size: 18px;
  letter-spacing: 1px;
}

.btn-consent {
  position: relative;
  background: rgba(99, 102, 241, 0.25);
  color: #e2e8f8;
  border: 1px solid rgba(99, 102, 241, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 16px;
  padding: 0.75rem 2.75rem;
  cursor: pointer;
  transition:
    all 0.2s ease,
    border-color 0.2s ease;
  overflow: hidden;
  margin-top: 0.75rem;
  letter-spacing: 1px;
  font-size: clamp(1rem, 1.15vw, 1.125rem);
  box-shadow:
    0 0 5px rgba(0, 0, 0, 0.15),
    0 0 15px rgba(0, 0, 0, 0.1),
    0 0 30px rgba(0, 0, 0, 0.05);
}

.btn-consent:hover:not(:disabled) {
  background: rgba(99, 102, 241, 0.45);
  border-color: rgba(99, 102, 241, 0.8);
  letter-spacing: 2px;
  box-shadow:
    0 0 5px rgba(99, 102, 241, 0.2),
    0 0 15px rgba(99, 102, 241, 0.15),
    0 0 30px rgba(99, 102, 241, 0.1);
  transform: translateY(-1px);
}

.btn-consent:disabled {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  color: rgba(226, 232, 248, 0.3);
  cursor: not-allowed;
}

.btn-consent::before {
  content: "";
  position: absolute;
  width: 50%;
  height: 100%;
  transform: skewX(45deg);
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0),
    rgba(255, 255, 255, 0.1)
  );
  top: 0;
  left: 0;
  transition: all ease 0.2s;
}

.btn-consent:disabled::before {
  background: linear-gradient(90deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.1));
}

.btn-consent:hover:not(:disabled)::before {
  transform: skewX(45deg) translateX(200%);
}

.study-footer {
  margin: 48px 0 64px;
  cursor: default;
  text-align: center;
  color: var(--textMuted);
  font-size: clamp(0.85rem, 1.4vw, 1.125rem);
  font-weight: 400;
  opacity: 0.5;
  line-height: 1.35;
  flex: 0 0 auto;
  position: relative;
  z-index: 3;
}

/* Animations */

@keyframes floatUp {
  0%,
  100% {
    transform: translateY(40px);
  }
  50% {
    transform: translateY(-40px);
  }
}

@keyframes floatDown {
  0%,
  100% {
    transform: translateY(-40px);
  }
  50% {
    transform: translateY(40px);
  }
}

@keyframes cardGlint {
  0% {
    transform: translateX(-112vw) rotateZ(12deg);
  }
  100% {
    transform: translateX(112vw) rotateZ(12deg);
  }
}

/* Index responsive */
@media (max-width: 1200px) {
  .consent-container {
    width: min(88vw, 780px);
  }

  .card {
    width: min(88vw, 780px);
  }

  .blob-1 {
    left: -4rem;
  }

  .blob-2 {
    right: -4rem;
  }
}

@media (max-width: 900px) and (min-width: 601px) {
  .blob-1 {
    left: max(-6vw, calc(50% - 456px));
  }

  .blob-2 {
    right: max(-8vw, calc(50% - 456px));
  }
}

/* Index mobile */
@media (max-width: 600px) {
  .page-wrapper {
    min-height: 100svh;
    padding: 1rem;
    justify-content: flex-start;
  }

  .page-wrapper::before {
    width: 140vw;
    height: 100vw;
    top: -50vw;
    left: -20vw;
  }

  .consent-container {
    width: 100%;
    flex: none;
    min-height: auto;
    justify-content: flex-start;
  }

  .page-header {
    margin: 2.5rem 0 3rem;
  }

  .study-label {
    font-size: 1.75rem;
  }

  .card {
    width: 100%;
    min-height: auto;
    padding: 1.25rem;
    border-radius: 28px;
  }

  .card::before {
    animation: cardGlint ease forwards 4s infinite;
  }

  .consent-form-section {
    width: 100%;
    padding: 1.75rem 1.25rem;
  }

  .consent-form-section h2 {
    font-size: 1.6rem;
    margin-bottom: 0.75rem;
  }

  .subheading {
    font-size: 0.95rem;
    line-height: 1.4;
    padding: 0;
  }

  #consent-form {
    margin-top: 0.5rem;
  }

  .consent-checks {
    width: 100%;
  }

  .consent-check {
    font-size: 0.95rem;
    line-height: 1.35;
    align-items: first baseline;
  }

  .final,
  .final-second {
    font-size: 0.95rem;
  }

  .final {
    padding-top: 0.5rem;
  }

  .final-agreement {
    font-size: 0.75rem;
  }

  .btn-consent {
    width: min(100%, 220px);
    padding: 0.75rem 1.5rem;
    margin-top: 1rem;
    min-height: 44px;
  }

  .blob-1,
  .blob-2 {
    width: 12rem;
    opacity: 0.35;
    filter: blur(3px);
    -webkit-filter: blur(3px);
  }

  .blob-1 {
    left: -7rem;
    top: calc(50% - 20rem);
  }

  .blob-2 {
    right: -7rem;
    bottom: calc(50% - 20rem);
  }

  .card::before {
    opacity: 0.45;
  }

  .study-footer {
    width: 100%;
    margin: 1.75rem 0;
    font-size: 0.85rem;
    opacity: 0.85;
  }
}

/* Very narrow phones */
@media (max-width: 360px) {
  .page-wrapper {
    padding: 0.75rem;
  }

  .card {
    padding: 1rem;
    border-radius: 24px;
  }

  .study-label {
    font-size: 1.85rem;
  }

  .consent-check,
  .subheading,
  .final,
  .final-second {
    font-size: 0.9rem;
  }
}

/* Study */

.chat-container {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  width: min(72vw, 1080px);
  height: min(70svh, 720px);
  min-height: 520px;
  background-color: var(--surfaceColour);
  border: solid 2px var(--surfaceBorder);
  border-radius: 32px;
  box-shadow:
    0 0 5px rgba(0, 0, 0, 0.05),
    0 0 15px rgba(0, 0, 0, 0.1),
    0 0 30px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  position: relative;
  opacity: 1;
  transition: all ease 0.5s;
}

.chat-container.complete {
  opacity: 0.7;
}

.chat-header {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 72px;
  box-shadow: 0 5px 5px rgba(0, 0, 0, 0.15);
  background-color: var(--surfaceColour);
  border-top-left-radius: 32px;
  border-top-right-radius: 32px;
  position: relative;
}

.chat-title {
  font-weight: 600;
  opacity: 0.9;
  font-size: 1rem;
  text-shadow:
    0 0 5px rgba(255, 255, 255, 0.05),
    0 0 15px rgba(255, 255, 255, 0.05);
}

.chat-title span {
  color: var(--textMuted);
  font-weight: 400;
  font-size: 0.75rem;
  margin-left: 8px;
}

.header-line {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
}

.progress-line {
  margin: 2px 0;
  color: var(--textMuted);
  font-weight: 600;
  text-shadow: 0 0 4px rgba(0, 0, 0, 0.1);
}

.chat-status-dot {
  width: 8px;
  height: 8px;
  background-color: rgba(107, 207, 83, 1);
  border-radius: 4px;
  margin-right: 8px;
  box-shadow:
    0 0 5px rgba(107, 207, 83, 0.25),
    0 0 15px rgba(107, 207, 83, 0.25);
  animation: infinite statusDot 3s ease;
  transition: all ease 0.2s;
}

.chat-status-dot.processing {
  animation: none;
  background-color: rgba(255, 191, 0, 1);
  box-shadow:
    0 0 5px rgba(255, 191, 0, 0.25),
    0 0 15px rgba(255, 191, 0, 0.25);
}

.chat-status-dot.complete {
  animation: none;
  background-color: rgba(160, 170, 185, 0.6);
  box-shadow:
    0 0 5px rgba(160, 170, 185, 0.25),
    0 0 15px rgba(160, 170, 185, 0.25);
}

@keyframes statusDot {
  0% {
    background-color: rgba(107, 207, 83, 1);
  }
  50% {
    background-color: rgba(107, 207, 83, 0.6);
  }
  100% {
    background-color: rgba(107, 207, 83, 1);
  }
}

.input-appear {
  opacity: 0;
  transform: translateY(6px);
  animation: inputAppear 0.5s ease forwards;
}

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

.chat-window {
  flex: 1;
  min-height: 0; /* prevents flex overflow */
  width: 100%;
  scroll-behavior: smooth;
  overflow-y: scroll;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  padding: 8px 0;
  position: absolute;
  top: 72px;
  bottom: 124px;
  left: 0;
  box-shadow:
    inset 0 0 5px rgba(0, 0, 0, 0.15),
    inset 0 0 15px rgba(0, 0, 0, 0.1),
    inset 0 0 30px rgba(0, 0, 0, 0.05);
}

.chat-window::-webkit-scrollbar {
  width: 4px;
}
.chat-window::-webkit-scrollbar-track {
  background: transparent;
}
.chat-window::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}
.chat-window::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

@keyframes botMessageIn {
  from {
    opacity: 0;
    transform: translateY(8px) translateX(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0) translateX(0);
  }
}

@keyframes participantMessageIn {
  from {
    opacity: 0;
    transform: translateY(8px) translateX(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0) translateX(0);
  }
}

.chat-message {
  width: calc(100% - 32px); /* full width minus side margins */
  display: flex;
  margin: 0.5rem 1rem;
}

.likert-scale {
  margin-top: -2px;
}

.bot-message {
  justify-content: flex-start;
  animation: botMessageIn 0.3s ease forwards;
}

.participant-message {
  justify-content: flex-end;
  animation: participantMessageIn 0.3s ease forwards;
}

.chat-bubble {
  max-width: 64%;
  padding: 12px 16px;
  border-radius: 4px 16px 16px 16px;
  box-shadow:
    0 0 5px rgba(0, 0, 0, 0.15),
    0 0 15px rgba(0, 0, 0, 0.1),
    0 0 30px rgba(0, 0, 0, 0.05);
  line-height: 1.5;
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.mc-bubble {
  cursor: pointer;
  opacity: 1;
  transition: all ease 0.2s;
  margin-top: -8px;
}

.mc-bubble:hover {
  opacity: 0.8;
}

.likert-bubble {
  margin: 0 4px;
  opacity: 1;
  transition: all ease 0.2s;
  border-radius: 16px 16px 16px 16px;
  cursor: pointer;
}

.likert-bubble:first-child {
  margin-left: 0;
  border-radius: 4px 16px 16px 16px;
}

.likert-bubble.selected {
  background: rgba(155, 127, 255, 0.25);
  border-color: rgba(155, 127, 255, 0.6);
  transform: translateY(-1px);
}

.likert-bubble:hover {
  opacity: 0.8;
}

.bot-message .chat-bubble {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px 12px 12px 12px;
  color: var(--textColour);
}

.participant-message .chat-bubble {
  background: rgba(155, 127, 255, 0.15);
  border: 1px solid rgba(155, 127, 255, 0.25);
  border-radius: 16px 4px 16px 16px;
  color: var(--textColour);
}

.input-area {
  width: 100%;
  min-height: 80px;
  height: 124px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  border-top: 1px solid var(--surfaceBorder);
  border-bottom-left-radius: 32px;
  border-bottom-right-radius: 32px;
  background: rgba(0, 0, 0, 0.1);
  position: absolute;
  bottom: 0;
  opacity: 1;
  transition: all ease 0.5s;
}

.input-area.complete {
  opacity: 0.6;
}

.input-wrapper {
  width: 100%;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  padding: 12px 0;
}

.input-controls {
  width: 24%;
  margin: 0 8px;
  display: flex;
  justify-content: space-evenly;
  align-items: center;
}

#text-input {
  width: 100%;
  border-radius: 16px;
  background-color: var(--surfaceColour);
  color: var(--textColour);
  border: solid 1px var(--surfaceBorder);
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.05);
  padding: 10px 14px;
  font-size: 0.9rem;
  resize: none;
  line-height: 1.4;
  font-family: inherit;
}

#text-input:focus {
  outline: none;
  border-color: var(--inputFocus);
  box-shadow:
    0 0 5px rgba(79, 142, 247, 0.15),
    0 0 15px rgba(79, 142, 247, 0.15);
}

#text-input.input-error {
  border-color: rgba(248, 113, 113, 0.9);
  box-shadow:
    0 0 0 1px rgba(248, 113, 113, 0.35),
    0 0 12px rgba(248, 113, 113, 0.18);
  animation: inputShake 0.22s ease;
}

@keyframes inputShake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-2px);
  }
  75% {
    transform: translateX(2px);
  }
}

.btn-primary,
.btn-skip {
  width: 40%;
  padding: 8px;
  border-radius: 16px;
  transition: all ease 0.2s;
  letter-spacing: 1px;
  font-size: 0.85rem;
  cursor: pointer;
  box-shadow:
    0 0 5px rgba(0, 0, 0, 0.15),
    0 0 15px rgba(0, 0, 0, 0.1),
    0 0 30px rgba(0, 0, 0, 0.05);
}

.btn-primary:hover,
.btn-skip:hover {
  letter-spacing: 2px;
}

.inline-next.is-disabled,
.btn-primary.is-disabled {
  opacity: 0.35;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-primary {
  border: 1px solid rgba(79, 142, 247, 0.4);
  background-color: var(--btnPrimary);
  color: var(--btnPrimaryText);
  opacity: 1;
  box-shadow:
    0 0 5px rgba(79, 142, 247, 0.15),
    0 0 15px rgba(79, 142, 247, 0.1);
}

.btn-primary:hover {
  opacity: 0.85;
}

.btn-skip {
  border: 1px solid rgba(255, 255, 255, 0.4);
  background-color: var(--btnSkip);
  color: var(--btnSkipText);
  opacity: 0.7;
}

.btn-skip:hover {
  opacity: 1;
}

.input-wrap {
  position: static;
  width: 66%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.inline-next {
  display: none;
}

.submit-area {
  display: flex;
  justify-content: center;
  padding: 16px;
}

.btn-submit {
  width: 280px;
  min-height: 52px;
  white-space: nowrap;
  padding: 0.9rem 1.5rem;
  border-radius: 16px;
  border: 1px solid rgba(80, 140, 255, 0.65);
  background: rgba(58, 105, 180, 0.45);
  color: var(--btnPrimaryText);
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

.btn-submit:hover {
  background: rgba(70, 125, 210, 0.55);
  border-color: rgba(120, 170, 255, 0.85);
  box-shadow: 0 0 22px rgba(120, 170, 255, 0.16);
  transform: translateY(-1px);
}

.btn-submit:active {
  transform: translateY(0);
}

.btn-submit:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.typing-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 14px 18px;
  min-width: 56px;
}

.typing-indicator span {
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  animation: typingBounce 1.1s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.18s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.36s;
}

@keyframes typingBounce {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-6px);
    opacity: 1;
  }
}

.chat-progress {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 0;
  overflow: hidden;
  flex-shrink: 0;
  position: absolute;
  bottom: 0;
  left: 0;
}

.chat-progress-fill {
  height: 100%;
  background: var(--btnPrimary);
  border-radius: 0 2px 2px 0;
  transition: width 0.5s ease;
  width: 0%;
}

@media (max-width: 900px) {
  .chat-container {
    width: min(92vw, 760px);
    height: 72svh;
  }

  .chat-bubble {
    max-width: 82%;
  }

  .input-controls {
    width: 30%;
  }

  #text-input {
    width: 92%;
  }
}

/* Study mobile */

@media (max-width: 600px) {
  body {
    overflow-x: hidden;
  }

  .page-wrapper {
    min-height: max(100svh, 120svh);
    padding: 1rem;
    justify-content: flex-start;
  }

  .chat-container {
    width: 100%;
    height: 72svh;
    min-height: 560px;
    border-radius: 28px;
  }

  .chat-header {
    height: 76px;
    padding: 0 1rem;
    border-top-left-radius: 28px;
    border-top-right-radius: 28px;
  }

  .header-line {
    max-width: 100%;
    text-align: center;
  }

  .chat-title {
    font-size: 0.95rem;
    text-align: center;
  }

  .progress-line {
    font-size: 0.85rem;
  }

  .chat-window {
    top: 76px;
    bottom: 120px;
    padding: 10px 0;
    transition: bottom 0.25s ease;
  }

  .chat-container:has(#text-input:focus) .chat-window {
    bottom: 187px;
  }

  .chat-message {
    width: calc(100% - 24px);
    margin: 8px 12px;
  }

  .chat-bubble {
    max-width: 88%;
    padding: 10px 12px;
    font-size: 0.9rem;
    line-height: 1.45;
  }

  .likert-scale {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0;
  }

  .likert-bubble {
    margin: 0;
    min-width: 42px;
    text-align: center;
  }

  .input-area {
    height: 120px;
    border-bottom-left-radius: 28px;
    border-bottom-right-radius: 28px;
    transition: height 0.25s ease;
  }

  .input-area:focus-within {
    height: 187px;
  }

  .input-wrapper {
    flex-direction: column;
    gap: 0.75rem;
    padding: 16px 12px 12px;
    position: relative;
  }

  .inline-next {
    display: flex;
    position: absolute;
    right: 3px;
    bottom: 3px;

    width: 38px;
    height: 38px;

    align-items: center;
    justify-content: center;
    text-align: center;

    border-radius: 13px;
    border: 1px solid rgba(79, 142, 247, 0.45);
    background: rgba(79, 142, 247, 0.28);
    color: white;

    font-size: 1rem;
    cursor: pointer;
    opacity: 1;
    transform: translateY(0);
    line-height: 1;
    padding: auto;

    box-shadow: 0 0 5px rgba(79, 142, 247, 0.15);

    transition: all ease 0.2s;
  }

  .inline-next svg {
    transform: translateX(0.5px);
  }

  .input-wrap {
    position: relative;
    width: 100%;
  }

  .input-wrap:focus-within .inline-next {
    border-radius: 50%;
    width: 36px;
    height: 36px;
    right: 10px;
    bottom: 10px;
  }

  #text-input {
    width: 100%;
    min-height: 44px;
    height: 44px;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.04);
    padding-right: 54px;
    transition:
      height 0.25s cubic-bezier(0.4, 0, 0.2, 1),
      box-shadow 0.2s ease,
      border-color 0.2s ease,
      background 0.2s ease;
  }

  #text-input:focus {
    height: 110px;
    background: var(--surfaceColour);
    box-shadow:
      0 0 0 1px var(--inputFocus),
      0 0 25px rgba(79, 142, 247, 0.15);
  }

  #text-input:focus + .inline-next {
    opacity: 1;
    transform: translateY(0);
  }

  .input-controls {
    width: 100%;
    margin: 0;
    gap: 0.75rem;
    justify-content: center;
  }

  .input-controls .btn-primary {
    display: none;
  }

  .btn-primary,
  .btn-skip {
    width: min(45%, 140px);
    min-height: 42px;
    padding: 0.65rem 0.75rem;
  }

  .btn-skip {
    width: auto;
    min-width: 72px;
    background: transparent;
    border: none;
    box-shadow: none;
    opacity: 0.6;
    font-size: 0.8rem;
    padding: 6px 0;
  }

  .btn-skip:hover {
    opacity: 1;
  }

  .btn-submit {
    width: 100%;
    max-width: 300px;
    padding: 0.85rem 1.5rem;
  }

  .typing-indicator {
    padding: 12px 14px;
  }
}

@media (max-width: 380px) {
  .chat-container {
    height: 74svh;
    min-height: 540px;
  }

  .chat-window {
    bottom: 160px;
  }

  .input-area {
    height: 160px;
  }

  .chat-bubble {
    max-width: 92%;
    font-size: 0.86rem;
  }

  .btn-primary,
  .btn-skip {
    width: 48%;
    font-size: 0.8rem;
  }
}

/* Thank you */

.thankyou-container {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.thankyou-card {
  position: relative;
  z-index: 2;
  width: min(720px, 90vw);
  min-height: clamp(380px, 52svh, 520px);
  height: auto;
  padding: clamp(2rem, 4vw, 3rem);
  text-align: center;
  border-radius: clamp(24px, 4vw, 32px);
  background: var(--surfaceColour);
  border: 1px solid var(--surfaceBorder);
  box-shadow: var(--surfaceShadow);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.thankyou-card h1 {
  margin-bottom: 1rem;
  font-size: 38px;
}

.thankyou-card p {
  margin: 0.75rem auto;
  max-width: 55ch;
  line-height: 1.5;
  font-size: 20px;
}

.thankyou-card p + p {
  margin-top: 1rem;
}

.blob-1-ty,
.blob-2-ty {
  position: absolute;
  z-index: 1;
  width: 192px;
  height: 192px;
  border-radius: 50%;
  box-shadow:
    0 0 5px rgba(0, 0, 0, 0.15),
    0 0 15px rgba(0, 0, 0, 0.15),
    0 0 30px rgba(0, 0, 0, 0.15);
  filter: blur(3px);
  -webkit-filter: blur(3px);
  opacity: 0.7;
}

.blob-1-ty {
  left: max(8vw, calc(50% - 460px));
  top: calc(50% - 96px);
  background: linear-gradient(45deg, var(--accent), var(--btnPrimary));
  animation: floatDown 8s ease-in-out infinite;
}

.blob-2-ty {
  right: max(8vw, calc(50% - 460px));
  top: calc(50% - 96px);
  background: linear-gradient(-45deg, var(--btnPrimary), var(--accent));
  animation: floatUp 8s ease-in-out infinite;
}

/* Thank you tablet */

@media (max-width: 1100px) and (min-width: 600px) {
  .thankyou-card {
    width: min(720px, 86vw);
  }

  .blob-1-ty {
    left: max(-8vw, calc(50% - 456px));
  }

  .blob-2-ty {
    right: max(-8vw, calc(50% - 456px));
  }
}

/* Thank you mobile */

@media (max-width: 600px) {
  .thankyou-page {
    min-height: 100svh;
    padding: 1rem;
    justify-content: flex-start;
  }

  .thankyou-page .page-header {
    position: static;
    margin: 3rem 0 1.5rem;
  }

  .thankyou-container {
    width: 100%;
    flex: 1;
    padding: 0;
  }

  .thankyou-card {
    width: 100%;
    min-height: auto;
    padding: 2rem 1.25rem;
  }

  .thankyou-card h1 {
    font-size: 1.8rem;
  }

  .thankyou-card p {
    font-size: 1rem;
    line-height: 1.55;
  }

  .thankyou-page .study-footer {
    width: 100%;
    margin: 2rem 0 0;
    font-size: 0.85rem;
    opacity: 0.85;
    flex: 1;
  }

  .blob-1-ty {
    left: calc(-2rem - 96px);
  }

  .blob-2-ty {
    right: calc(-2rem - 96px);
  }
}

.page-load {
  animation: pageFadeIn 0.45s ease both;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  height: 100%;
}

.page-load {
  animation-delay: 0.08s;
}

@keyframes pageFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

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

@media (prefers-reduced-motion: reduce) {
  .page-load {
    animation: none;
  }

  .chat-messages {
    scroll-behavior: auto;
  }
}
