@font-face {
  font-family: 'Poppins';
  src: url('/fonts/Poppins-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Poppins';
  src: url('/fonts/Poppins-Medium.ttf') format('truetype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Poppins';
  src: url('/fonts/Poppins-SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Poppins';
  src: url('/fonts/Poppins-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/*
 * KickWin design: green #2EE881 on deep blue-grey layers, Poppins, -0.25px tracking,
 * 8px/12px radii, 4px spacing steps, 1255px content, 768px mobile breakpoint.
 * Dark is the default; theme.js sets data-theme="light" for the bright mode.
 */
:root {
  color-scheme: dark;
  --bg-1: #04141e;
  --bg-2: #101d26;
  --bg-3: #162630;
  --canvas: #1e2c38;
  --paper: #223742;
  --paper-hover: #263e4a;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #fff;
  --muted: #9baab2;
  --primary: #2ee881;
  --primary-hover: #5bef9d;
  --primary-ink: #2ee881;
  --on-primary: #04141e;
  --accent: rgba(46, 232, 129, 0.12);
  --ghost-hover: rgba(255, 255, 255, 0.06);
  --error: #ff6b6b;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.24);
  --content: 1255px;
}

:root[data-theme='light'] {
  color-scheme: light;
  --bg-2: #fff;
  --bg-3: #fff;
  --canvas: #f2f5f6;
  --paper: #fff;
  --paper-hover: #fafbfc;
  --line: #e2e8eb;
  --line-strong: #cdd6db;
  --text: #04141e;
  --muted: #5b6b74;
  --primary-hover: #22d572;
  --primary-ink: #0f7a43;
  --accent: rgba(46, 232, 129, 0.16);
  --ghost-hover: rgba(4, 20, 30, 0.05);
  --error: #d43d3d;
  --shadow: 0 1px 2px rgba(4, 20, 30, 0.06);
}

* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100vh;
  font-family:
    'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei',
    sans-serif;
  font-size: 14px;
  letter-spacing: -0.25px;
  -webkit-font-smoothing: antialiased;
  background: var(--canvas);
  color: var(--text);
}
button:where(:not(.heyform-root *)),
input:where(:not(.heyform-root *)),
select:where(:not(.heyform-root *)),
textarea:where(:not(.heyform-root *)) {
  font: inherit;
  letter-spacing: inherit;
}
button:disabled:where(:not(.heyform-root *)) {
  cursor: default;
  opacity: 0.5;
}
:focus-visible:where(:not(.heyform-root *)) {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
a:where(:not(.heyform-root *)) {
  color: var(--primary-ink);
}
h1:where(:not(.heyform-root *)),
h2:where(:not(.heyform-root *)),
p:where(:not(.heyform-root *)) {
  margin: 0;
}
h1:where(:not(.heyform-root *)) {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.3;
}
h2:where(:not(.heyform-root *)) {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
}
p:where(:not(.heyform-root *)) {
  line-height: 1.6;
}

/* The form renderer brings its own type and colours. The respondent page loads this sheet
   for its access-code screen, so element styles above and below skip .heyform-root. */
.heyform-root {
  letter-spacing: normal;
  color-scheme: light;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}
.header-content,
main {
  max-width: calc(var(--content) + 48px);
  margin-inline: auto;
  padding-inline: 24px;
}
.header-content {
  min-height: 64px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  color: var(--text);
  text-decoration: none;
}
.wordmark strong {
  font-weight: 700;
  margin-left: 4px;
}
.wordmark-suffix {
  font-weight: 500;
  color: var(--muted);
}
.brand-mark {
  width: 28px;
  height: 28px;
  background: var(--primary);
  border-radius: 8px;
  position: relative;
  flex-shrink: 0;
}
.brand-mark::after {
  content: '';
  position: absolute;
  top: 8px;
  left: 8px;
  height: 6px;
  width: 12px;
  border-left: 2.5px solid var(--on-primary);
  border-bottom: 2.5px solid var(--on-primary);
  transform: rotate(-45deg);
}

main {
  padding-block: 40px 80px;
}

/* Layout helpers */
.stack {
  display: grid;
  align-content: start;
  gap: 16px;
  min-width: 0;
}
.workspace {
  gap: 24px;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.section-header,
.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.page-header .subtitle {
  margin-top: 4px;
}
.muted {
  color: var(--muted);
}
.hint {
  font-size: 13px;
}
.description {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.settings-page,
.submissions-page {
  max-width: 760px;
  width: 100%;
  margin-inline: auto;
}
.submissions-page {
  max-width: 860px;
}

/* Cards */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow);
}
.narrow {
  max-width: 400px;
  width: 100%;
  margin: 8vh auto 0;
  padding: 32px;
}
.workspace .narrow {
  margin-top: 8vh;
}

/* Buttons */
.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  min-height: 36px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.25;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  color: var(--text);
  background: transparent;
  transition:
    background-color 0.15s,
    border-color 0.15s,
    color 0.15s;
}
.button svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.button.primary {
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 600;
}
.button.primary:hover:not(:disabled) {
  background: var(--primary-hover);
}
.button.secondary {
  background: var(--paper);
  border-color: var(--line-strong);
}
.button.secondary:hover:not(:disabled) {
  background: var(--paper-hover);
}
.button.quiet {
  color: var(--muted);
}
.button.quiet:hover:not(:disabled) {
  background: var(--ghost-hover);
  color: var(--text);
}
.button.small {
  min-height: 32px;
  padding: 4px 12px;
  font-size: 13px;
}
.button.icon {
  width: 36px;
  padding: 0;
}
.button.block {
  width: 100%;
}
.pager {
  justify-content: end;
}
.back-link {
  margin-left: -12px;
}

/* Status pills */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px 4px 8px;
  border-radius: 999px;
  background: var(--ghost-hover);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.badge.live {
  background: var(--accent);
  color: var(--primary-ink);
}

/* Form list */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.form-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 176px;
  padding: 20px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  transition:
    border-color 0.15s,
    background-color 0.15s,
    transform 0.15s;
}
.form-card:hover {
  border-color: var(--line-strong);
  background: var(--paper-hover);
}
.form-card:has(.form-title:hover) {
  transform: translateY(-2px);
}
.form-card .badge {
  align-self: start;
}
.form-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
  text-decoration: none;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* The title link covers the card, so the whole card opens the designer. */
.form-title::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 12px;
}
.form-title:focus-visible {
  outline: none;
}
.form-title:focus-visible::after {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.form-meta {
  font-size: 13px;
  color: var(--muted);
}
.form-card-actions {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 4px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.form-card-actions .button {
  margin-left: -8px;
  padding-inline: 8px;
}
.form-card-actions .button + .button {
  margin-left: 4px;
}

.empty-state {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 64px 24px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
}
.empty-state .button {
  margin-top: 12px;
}

/* Sign-in */
.auth {
  gap: 24px;
}
.auth .brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
}
.auth .brand-mark::after {
  top: 12px;
  left: 12px;
  height: 8px;
  width: 16px;
  border-width: 3px;
}
.auth-heading {
  display: grid;
  gap: 4px;
}

/* Fields */
.editor {
  border: 0;
  padding: 0;
  margin: 0;
  gap: 16px;
}
.editor:disabled {
  opacity: 0.7;
}
.label,
.question {
  display: grid;
  gap: 8px;
  margin: 0;
  font-size: 13px;
  font-weight: 500;
}
.link-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}
.link-row input {
  font-size: 13px;
}
input:not([type='checkbox']:where(:not(.heyform-root *)), [type='radio']):where(:not(.heyform-root *)),
textarea:where(:not(.heyform-root *)),
select:where(:not(.heyform-root *)) {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 8px 12px;
  color: var(--text);
  font-size: 14px;
  font-weight: 400;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--bg-3);
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
input:not([type='checkbox']:where(:not(.heyform-root *)), [type='radio']):where(:not(.heyform-root *)):focus,
textarea:where(:not(.heyform-root *)):focus,
select:where(:not(.heyform-root *)):focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--accent);
}
input:where(:not(.heyform-root *))::placeholder,
textarea:where(:not(.heyform-root *))::placeholder {
  color: var(--muted);
  opacity: 0.7;
}
textarea:where(:not(.heyform-root *)) {
  resize: vertical;
}
select:where(:not(.heyform-root *)) {
  width: auto;
  max-width: 100%;
}
.check,
.choice {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}
.check input,
.choice input {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.webhook-auth {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

/* Messages */
.status {
  color: var(--primary-ink);
  font-size: 14px;
  min-width: 0;
  overflow-wrap: anywhere;
}
.status:empty {
  display: none;
}
.status.error {
  color: var(--error);
}

/* Submissions */
.submission-time {
  font-weight: 600;
}
.answers {
  margin: 0;
  display: grid;
  gap: 12px 24px;
  grid-template-columns: minmax(8em, 1fr) minmax(0, 2fr);
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.answers dt {
  color: var(--muted);
  overflow-wrap: anywhere;
}
.answers dd {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Respondent page helpers */
.trap {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
.challenge {
  max-width: 100%;
}
.worker-verification {
  position: fixed;
  inset: auto 0 6vh;
  z-index: 100;
  display: flex;
  justify-content: center;
}
.worker-verification[hidden] {
  display: none;
}

@media (max-width: 768px) {
  /* Keep 16px text in fields so iOS does not zoom when one is focused. */
  input:not([type='checkbox']:where(:not(.heyform-root *)), [type='radio']):where(:not(.heyform-root *)),
  textarea:where(:not(.heyform-root *)),
  select:where(:not(.heyform-root *)) {
    font-size: 16px;
  }
  .header-content,
  main {
    padding-inline: 16px;
  }
  .header-content {
    min-height: 56px;
  }
  .header-actions-label {
    display: none;
  }
  main {
    padding-block: 24px 48px;
  }
  .card,
  .narrow {
    padding: 20px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .form-card {
    min-height: 0;
  }
  .answers {
    grid-template-columns: 1fr;
    row-gap: 4px;
  }
  .answers dd {
    margin-bottom: 8px;
  }
}
