.h5-feedback-widget {
  --h5fb-paper: oklch(96% 0.024 82);
  --h5fb-paper-deep: oklch(90% 0.045 84);
  --h5fb-ink: oklch(23% 0.035 38);
  --h5fb-muted: oklch(43% 0.032 52);
  --h5fb-orange: oklch(63% 0.19 42);
  --h5fb-orange-dark: oklch(48% 0.16 38);
  --h5fb-yellow: oklch(86% 0.16 90);
  --h5fb-green: oklch(49% 0.11 151);
  --h5fb-red: oklch(49% 0.17 28);
  --h5fb-line: oklch(32% 0.035 42);
  --h5fb-surface: oklch(98% 0.012 82);
  --h5fb-ease: cubic-bezier(0.22, 1, 0.36, 1);
  color: var(--h5fb-ink);
  font-family: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 1rem;
  line-height: 1.5;
}

.h5-feedback-widget *,
.h5-feedback-widget *::before,
.h5-feedback-widget *::after {
  box-sizing: border-box;
}

.h5-feedback-widget [hidden] {
  display: none !important;
}

.h5-feedback-widget button,
.h5-feedback-widget input,
.h5-feedback-widget textarea {
  color: inherit;
  font: inherit;
}

.h5-feedback-widget button {
  cursor: pointer;
}

.h5-feedback-widget :focus-visible {
  outline: 3px solid oklch(52% 0.12 235);
  outline-offset: 3px;
}

.h5fb-trigger {
  position: fixed;
  z-index: 2147483000;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  display: inline-flex;
  min-width: 3.25rem;
  min-height: 3.25rem;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 0;
  padding: 0.65rem 0.9rem;
  border: 2px solid var(--h5fb-ink);
  border-radius: 0;
  color: var(--h5fb-ink);
  background: var(--h5fb-yellow);
  box-shadow: 4px 4px 0 var(--h5fb-ink);
  font-size: 0.875rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  transform: rotate(-1deg);
  transition: color 140ms, background 140ms, box-shadow 140ms, transform 140ms var(--h5fb-ease);
  -webkit-tap-highlight-color: transparent;
}

.h5fb-trigger svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: square;
  stroke-linejoin: miter;
  stroke-width: 1.8;
}

.h5fb-trigger:active {
  box-shadow: 1px 1px 0 var(--h5fb-ink);
  transform: translate(3px, 3px) rotate(-1deg);
}

.h5fb-dialog {
  width: min(calc(100% - 1rem), 41rem);
  max-width: none;
  max-height: min(48rem, calc(100dvh - 1rem));
  overflow: hidden;
  margin: auto;
  padding: 0;
  border: 2px solid var(--h5fb-ink);
  border-radius: 0;
  color: var(--h5fb-ink);
  background: var(--h5fb-paper);
  box-shadow: 10px 10px 0 oklch(18% 0.025 38 / 0.88);
}

.h5fb-dialog::backdrop {
  background: oklch(18% 0.025 38 / 0.68);
}

.h5fb-shell {
  display: grid;
  max-height: inherit;
  grid-template-rows: auto minmax(0, 1fr);
  background:
    linear-gradient(oklch(48% 0.02 80 / 0.055) 1px, transparent 1px),
    linear-gradient(90deg, oklch(48% 0.02 80 / 0.04) 1px, transparent 1px),
    var(--h5fb-paper);
  background-size: 1.5rem 1.5rem;
}

.h5fb-header {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  padding: 1.35rem 1.2rem 1.25rem;
  border-bottom: 2px solid var(--h5fb-ink);
  background: var(--h5fb-orange);
}

.h5fb-header::after {
  content: "";
  position: absolute;
  right: 5.5rem;
  bottom: -0.45rem;
  width: 5.75rem;
  height: 0.75rem;
  border: 2px solid var(--h5fb-ink);
  background: var(--h5fb-yellow);
  transform: rotate(-2deg);
}

.h5fb-header p,
.h5fb-success > p {
  margin: 0 0 0.35rem;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.h5fb-header h2,
.h5fb-success h2 {
  margin: 0;
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", Georgia, serif;
  font-size: clamp(1.65rem, 7vw, 2.35rem);
  font-weight: 900;
  letter-spacing: -0.045em;
  line-height: 1.08;
}

.h5fb-header > div > span {
  display: block;
  max-width: 39rem;
  margin-top: 0.6rem;
  color: oklch(28% 0.045 38);
  font-size: 0.84rem;
  line-height: 1.6;
}

.h5fb-close {
  display: grid;
  width: 2.75rem;
  height: 2.75rem;
  place-items: center;
  margin: 0;
  padding: 0;
  border: 2px solid var(--h5fb-ink);
  border-radius: 0;
  color: var(--h5fb-ink);
  background: var(--h5fb-paper);
  box-shadow: 3px 3px 0 var(--h5fb-ink);
  font-size: 1.65rem;
  font-weight: 500;
  line-height: 1;
}

.h5fb-form {
  display: grid;
  gap: 1.15rem;
  overflow: auto;
  padding: 1.5rem 1.2rem max(1.4rem, env(safe-area-inset-bottom));
  overscroll-behavior: contain;
}

.h5fb-types {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.h5fb-types legend,
.h5fb-field > span:first-child,
.h5fb-field-label {
  display: block;
  margin-bottom: 0.45rem;
  font-size: 0.8rem;
  font-weight: 850;
}

.h5fb-type-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}

.h5fb-type-grid label {
  position: relative;
  min-width: 0;
}

.h5fb-type-grid input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.h5fb-type-grid span {
  display: grid;
  min-height: 3rem;
  place-items: center;
  padding: 0.55rem 0.35rem;
  border: 2px solid var(--h5fb-line);
  background: var(--h5fb-surface);
  font-size: 0.76rem;
  font-weight: 800;
  text-align: center;
  transition: color 120ms, background 120ms, transform 120ms var(--h5fb-ease);
}

.h5fb-type-grid input:checked + span {
  color: var(--h5fb-paper);
  background: var(--h5fb-ink);
  transform: translateY(-2px);
}

.h5fb-type-grid input:focus-visible + span {
  outline: 3px solid oklch(52% 0.12 235);
  outline-offset: 3px;
}

.h5fb-field {
  display: block;
}

.h5fb-field input,
.h5fb-field textarea {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0.78rem 0.85rem;
  border: 2px solid var(--h5fb-line);
  border-radius: 0;
  outline: 0;
  color: var(--h5fb-ink);
  background: var(--h5fb-surface);
  font-size: 1rem;
  line-height: 1.5;
  transition: border-color 120ms, box-shadow 120ms;
}

.h5fb-field textarea {
  resize: vertical;
}

.h5fb-field input::placeholder,
.h5fb-field textarea::placeholder {
  color: oklch(48% 0.026 52);
  opacity: 1;
}

.h5fb-field input:focus,
.h5fb-field textarea:focus {
  border-color: var(--h5fb-orange-dark);
  box-shadow: 3px 3px 0 var(--h5fb-orange-dark);
}

.h5fb-field small {
  display: block;
  margin-top: 0.4rem;
  color: var(--h5fb-muted);
  font-size: 0.72rem;
  line-height: 1.55;
}

.h5fb-security {
  display: grid;
  min-height: 2.75rem;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--h5fb-line);
  background: var(--h5fb-surface);
}

.h5fb-turnstile:empty {
  display: none;
}

.h5fb-verification {
  margin: 0;
  color: var(--h5fb-muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.h5fb-verification.is-ready {
  color: var(--h5fb-green);
}

.h5fb-verification.is-error,
.h5fb-status.is-error {
  color: var(--h5fb-red);
}

.h5fb-context {
  margin: 0;
  color: var(--h5fb-muted);
  font-size: 0.72rem;
}

.h5fb-status {
  min-height: 0;
  margin: -0.35rem 0 0;
  font-size: 0.78rem;
  font-weight: 750;
}

.h5fb-status:empty {
  display: none;
}

.h5fb-submit,
.h5fb-done {
  display: flex;
  min-height: 3.35rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0;
  padding: 0.75rem 1rem;
  border: 2px solid var(--h5fb-ink);
  border-radius: 0;
  color: var(--h5fb-paper);
  background: var(--h5fb-orange-dark);
  box-shadow: 4px 4px 0 var(--h5fb-ink);
  font-weight: 900;
  transition: color 140ms, background 140ms, box-shadow 140ms, transform 140ms var(--h5fb-ease);
}

.h5fb-submit:disabled {
  cursor: wait;
  opacity: 0.55;
}

.h5fb-submit:active,
.h5fb-done:active {
  box-shadow: 1px 1px 0 var(--h5fb-ink);
  transform: translate(3px, 3px);
}

.h5fb-submit.is-loading span:last-child {
  animation: h5fb-pulse 900ms ease-in-out infinite alternate;
}

.h5fb-success {
  overflow: auto;
  padding: clamp(2rem, 8vw, 4rem) 1.25rem;
  text-align: left;
}

.h5fb-success-mark {
  display: grid;
  width: 4rem;
  height: 4rem;
  place-items: center;
  margin-bottom: 1.5rem;
  border: 2px solid var(--h5fb-ink);
  background: var(--h5fb-yellow);
  box-shadow: 5px 5px 0 var(--h5fb-ink);
  font-family: Georgia, serif;
  font-size: 2.35rem;
  font-weight: 900;
  transform: rotate(-3deg);
}

.h5fb-success > span:not(.h5fb-success-mark) {
  display: block;
  max-width: 33rem;
  margin-top: 0.8rem;
  color: var(--h5fb-muted);
}

.h5fb-success > div {
  display: inline-grid;
  gap: 0.15rem;
  margin-top: 1.75rem;
  padding: 0.7rem 0.85rem;
  border: 2px solid var(--h5fb-line);
  background: var(--h5fb-surface);
}

.h5fb-success > div small {
  color: var(--h5fb-muted);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.h5fb-reference {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.h5fb-done {
  width: 100%;
  margin-top: 2rem;
  color: var(--h5fb-ink);
  background: var(--h5fb-yellow);
}

@media (min-width: 40rem) {
  .h5fb-header {
    padding: 1.6rem 1.75rem 1.45rem;
  }

  .h5fb-form,
  .h5fb-success {
    padding-inline: 1.75rem;
  }
}

@media (hover: hover) and (pointer: fine) {
  .h5fb-trigger:hover {
    color: var(--h5fb-paper);
    background: var(--h5fb-orange-dark);
    box-shadow: 2px 2px 0 var(--h5fb-ink);
    transform: translate(2px, 2px) rotate(1deg);
  }

  .h5fb-close:hover {
    color: var(--h5fb-paper);
    background: var(--h5fb-ink);
  }

  .h5fb-type-grid label:hover span {
    transform: translateY(-2px);
  }

  .h5fb-submit:not(:disabled):hover,
  .h5fb-done:hover {
    color: var(--h5fb-ink);
    background: var(--h5fb-yellow);
  }
}

@media (pointer: coarse) {
  .h5fb-trigger,
  .h5fb-close,
  .h5fb-type-grid span,
  .h5fb-submit,
  .h5fb-done {
    min-height: 3rem;
  }
}

@media (max-width: 24rem) {
  .h5fb-trigger span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }

  .h5fb-type-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .h5fb-dialog[open] {
    animation: h5fb-enter 320ms var(--h5fb-ease) both;
  }

  @keyframes h5fb-enter {
    from { opacity: 0; transform: translateY(1rem) scale(0.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
  }

  @keyframes h5fb-pulse {
    from { opacity: 0.35; transform: translateX(-0.15rem); }
    to { opacity: 1; transform: translateX(0); }
  }
}

@media (prefers-reduced-motion: reduce) {
  .h5-feedback-widget *,
  .h5-feedback-widget *::before,
  .h5-feedback-widget *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
