.xys-feedback-overlay {
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
.xys-feedback-overlay * { box-sizing: border-box; }

/* Floating button */
.xys-fab {
  position: fixed; bottom: 28px; right: 28px; z-index: 99990;
  min-width: 52px; min-height: 52px; padding: 0 20px;
  border: none; border-radius: 26px;
  background: var(--xys-feedback-accent, #c25a1e);
  color: #fff; font-size: 14px; font-weight: 700; font-family: inherit;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,0,0,0.18);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  letter-spacing: 0.5px;
}
.xys-fab:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.24);
}
.xys-fab-hidden { display: none !important; }

@media (max-width: 782px) {
  .xys-fab { display: none; }
}

/* Overlay */
.xys-feedback-overlay[hidden] { display: none; }
.xys-feedback-overlay {
  position: fixed; inset: 0; z-index: 99999;
  display: grid; place-items: center; padding: 24px;
}
.xys-feedback-backdrop {
  position: absolute; inset: 0;
  background: rgba(2, 6, 23, 0.52);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Dialog */
.xys-feedback-dialog {
  position: relative; width: min(620px, 100%); max-height: min(700px, calc(100vh - 48px));
  overflow: auto; border: 1px solid rgba(148, 163, 184, 0.22); border-radius: 14px;
  color: #0f172a;
  background: #ffffff;
  box-shadow: 0 24px 72px rgba(2, 6, 23, 0.28);
}

/* Header */
.xys-feedback-header {
  display: flex; justify-content: space-between; gap: 18px;
  padding: 24px 28px 0;
}
.xys-feedback-kicker {
  margin: 0 0 6px; color: var(--xys-feedback-accent);
  font-size: 11px; font-weight: 800; letter-spacing: 0.5px; text-transform: uppercase;
}
.xys-feedback-header h2 {
  margin: 0; color: #0f172a; font-size: 22px; line-height: 1.25;
}
.xys-feedback-icon-button {
  width: 34px; height: 34px; flex: 0 0 auto;
  display: grid; place-items: center; border: 1px solid #e2e8f0; border-radius: 8px;
  color: #475569; background: #ffffff; font-size: 20px; line-height: 1; cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}
.xys-feedback-icon-button:hover, .xys-feedback-icon-button:focus-visible {
  color: #0f172a; background: #f1f5f9; outline: none;
}

/* Intro */
.xys-feedback-intro {
  margin: 10px 28px 0; color: #64748b; font-size: 13.5px; line-height: 1.65;
}

/* Form */
.xys-feedback-form { display: grid; gap: 16px; padding: 18px 28px 26px; }
.xys-feedback-form label {
  display: grid; gap: 6px; margin: 0; color: #334155; font-size: 13px; font-weight: 700;
}
.xys-feedback-form input, .xys-feedback-form select, .xys-feedback-form textarea {
  width: 100%; border: 1px solid #cbd5e1; border-radius: 8px; padding: 11px 12px;
  color: #0f172a; background: #ffffff; font: inherit; font-size: 14px; line-height: 1.45;
  min-height: 44px; outline: none; transition: border-color 140ms ease, box-shadow 140ms ease;
}
.xys-feedback-form textarea { min-height: 128px; resize: vertical; }
.xys-feedback-form input:focus, .xys-feedback-form select:focus, .xys-feedback-form textarea:focus {
  border-color: var(--xys-feedback-accent);
  box-shadow: 0 0 0 3px rgba(194, 90, 30, 0.12);
}
.xys-feedback-form select { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23475569' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }

/* Login notice */
.xys-feedback-login-notice {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px; border: 1px solid rgba(194, 90, 30, 0.18); border-radius: 8px;
  background: #fef7f2; color: #7c3a1a; font-size: 13px; font-weight: 600; line-height: 1.55;
}
.xys-feedback-login-notice[hidden] { display: none; }
.xys-feedback-login-notice a {
  flex: 0 0 auto; color: var(--xys-feedback-accent); font-weight: 800; text-decoration: none;
}
.xys-feedback-login-notice a:hover, .xys-feedback-login-notice a:focus-visible {
  color: #0f172a; outline: none;
}

/* Tutorial link */
.xys-feedback-tutorial {
  display: inline-flex; align-items: center; justify-content: center; max-width: 100%;
  min-height: 42px; padding: 0 13px; border: 1px solid rgba(194, 90, 30, 0.2);
  border-radius: 8px; color: var(--xys-feedback-accent); background: #fef7f2;
  font-size: 13px; font-weight: 800; line-height: 1.3; text-decoration: none; overflow-wrap: anywhere;
}
.xys-feedback-tutorial[hidden] { display: none; }
.xys-feedback-tutorial:hover, .xys-feedback-tutorial:focus-visible {
  color: #0f172a; border-color: rgba(194, 90, 30, 0.42); outline: none;
}

/* Category fields grid */
.xys-feedback-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.xys-feedback-fields-one { grid-template-columns: 1fr; }
.xys-feedback-secondary-field[hidden] { display: none; }

/* Honeypot */
.xys-feedback-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Actions */
.xys-feedback-actions {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 2px;
}
.xys-feedback-action-buttons { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex: 0 0 auto; }
.xys-feedback-status { min-height: 20px; min-width: 0; color: var(--xys-feedback-accent); font-size: 13px; font-weight: 700; overflow-wrap: anywhere; }
.xys-feedback-status.is-error { color: #dc2626; }

/* Submit button */
.xys-feedback-submit {
  min-width: 118px; min-height: 42px; border: 0; border-radius: 8px;
  color: #ffffff; background: var(--xys-feedback-accent, #c25a1e); font-weight: 800; cursor: pointer;
  transition: filter 140ms ease, transform 140ms ease;
}
.xys-feedback-submit:hover, .xys-feedback-submit:focus-visible {
  filter: brightness(1.1); transform: translateY(-1px); outline: none;
}
.xys-feedback-submit:disabled { cursor: wait; opacity: 0.62; transform: none; filter: none; }

/* Scroll lock */
.xys-feedback-no-scroll { overflow: hidden; scrollbar-gutter: stable; }

/* ======================== */
/* Mobile responsive        */
/* ======================== */
@media (max-width: 640px) {
  .xys-feedback-overlay {
    padding: 16px;
    align-items: flex-end;
    overflow-y: hidden;
  }
  .xys-feedback-dialog {
    width: 100%;
    max-height: calc(100vh - 32px);
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(2, 6, 23, 0.22);
  }
  .xys-feedback-header { padding: 22px 20px 0; flex-shrink: 0; }
  .xys-feedback-header h2 { font-size: 20px; }
  .xys-feedback-intro { margin: 10px 20px 0; font-size: 13px; flex-shrink: 0; }
  .xys-feedback-form { padding: 14px 20px 24px; gap: 12px; overflow-y: auto; -webkit-overflow-scrolling: touch; flex: 1 1 auto; }
  .xys-feedback-form label { font-size: 12px; gap: 6px; }
  .xys-feedback-form input, .xys-feedback-form select, .xys-feedback-form textarea {
    padding: 12px 14px; font-size: 16px; min-height: 48px; border-radius: 10px;
  }
  .xys-feedback-form textarea { min-height: 148px; }
  .xys-feedback-fields { grid-template-columns: 1fr; gap: 12px; }
  .xys-feedback-actions { display: grid; grid-template-columns: 1fr; gap: 12px; }
  .xys-feedback-action-buttons { display: grid; grid-template-columns: 1fr auto; gap: 10px; width: 100%; }
  .xys-feedback-login-notice { display: grid; grid-template-columns: 1fr; gap: 8px; padding: 10px 14px; font-size: 12px; }
  .xys-feedback-submit { width: 100%; min-height: 48px; font-size: 16px; border-radius: 10px; }
  .xys-feedback-tutorial { min-height: 48px; font-size: 14px; }
  .xys-feedback-tutorial[hidden] + .xys-feedback-submit { grid-column: 1 / -1; }
  .xys-feedback-icon-button { width: 44px; height: 44px; font-size: 26px; border-radius: 10px; }
  .xys-feedback-status { font-size: 13px; padding: 0 4px; }
  .xys-feedback-backdrop { background: rgba(2, 6, 23, 0.48); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
}

@media (max-width: 380px) {
  .xys-feedback-overlay { padding: 10px; }
  .xys-feedback-dialog { max-height: calc(100vh - 20px); }
  .xys-feedback-action-buttons { grid-template-columns: 1fr; }
  .xys-feedback-form { padding: 10px 14px 20px; }
  .xys-feedback-header { padding: 16px 14px 0; }
  .xys-feedback-intro { margin: 8px 14px 0; }
  .xys-feedback-form input, .xys-feedback-form select, .xys-feedback-form textarea { font-size: 16px; min-height: 48px; }
  .xys-feedback-form textarea { min-height: 128px; }
}
