#xboard-gift-card-entry {
  position: fixed;
  right: 22px;
  /* Keep clear of the fixed ticket reply composer and mobile safe area. */
  bottom: max(92px, calc(env(safe-area-inset-bottom) + 82px));
  z-index: 1100;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, #18a058, #0d8a4a);
  box-shadow: 0 10px 28px rgba(24, 160, 88, .28);
  font: 600 14px/1.2 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease;
}

#xboard-gift-card-entry:hover {
  transform: translateY(-2px);
  box-shadow: 0 13px 32px rgba(24, 160, 88, .34);
}

.xgc-hidden { display: none !important; }

.xgc-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, .52);
  backdrop-filter: blur(4px);
}

.xgc-dialog {
  width: min(560px, 100%);
  max-height: min(760px, calc(100vh - 40px));
  overflow: auto;
  border-radius: 18px;
  color: #1f2937;
  background: #fff;
  box-shadow: 0 24px 80px rgba(15, 23, 42, .28);
  font: 14px/1.55 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.xgc-header,
.xgc-body { padding: 22px 24px; }

.xgc-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid #eef0f3;
}

.xgc-title { margin: 0; font-size: 21px; line-height: 1.3; }
.xgc-subtitle { margin: 5px 0 0; color: #6b7280; font-size: 13px; }

.xgc-close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 9px;
  color: #4b5563;
  background: #f3f4f6;
  cursor: pointer;
  font-size: 20px;
}

.xgc-tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.xgc-tab {
  padding: 8px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 9px;
  color: #4b5563;
  background: #fff;
  cursor: pointer;
}
.xgc-tab[aria-selected="true"] { color: #0d8a4a; border-color: #18a058; background: #effaf4; }

.xgc-label { display: block; margin-bottom: 8px; font-weight: 600; }
.xgc-input {
  box-sizing: border-box;
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  outline: none;
  font: 500 15px/1 monospace;
  text-transform: uppercase;
}
.xgc-input:focus { border-color: #18a058; box-shadow: 0 0 0 3px rgba(24, 160, 88, .13); }

.xgc-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.xgc-button {
  min-height: 40px;
  padding: 0 17px;
  border: 1px solid #d1d5db;
  border-radius: 9px;
  background: #fff;
  cursor: pointer;
  font-weight: 600;
}
.xgc-button-primary { color: #fff; border-color: #18a058; background: #18a058; }
.xgc-button:disabled { opacity: .55; cursor: not-allowed; }

.xgc-alert { margin-top: 14px; padding: 11px 13px; border-radius: 9px; }
.xgc-alert-error { color: #b42318; background: #fef3f2; }
.xgc-alert-success { color: #067647; background: #ecfdf3; }

.xgc-preview { margin-top: 18px; padding: 16px; border: 1px solid #dfe6e2; border-radius: 12px; background: #f8fbf9; }
.xgc-preview h3 { margin: 0 0 4px; font-size: 17px; }
.xgc-preview p { margin: 0 0 12px; color: #6b7280; }
.xgc-rewards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.xgc-reward { padding: 10px 12px; border-radius: 9px; background: #fff; border: 1px solid #e8ece9; }
.xgc-reward small { display: block; color: #6b7280; }
.xgc-reward strong { display: block; margin-top: 2px; overflow-wrap: anywhere; }

.xgc-history { display: grid; gap: 10px; }
.xgc-history-item { padding: 13px 14px; border: 1px solid #e5e7eb; border-radius: 11px; }
.xgc-history-top { display: flex; justify-content: space-between; gap: 12px; }
.xgc-history-meta { margin-top: 5px; color: #6b7280; font-size: 12px; }
.xgc-empty { padding: 36px 12px; color: #6b7280; text-align: center; }

@media (max-width: 640px) {
  #xboard-gift-card-entry {
    right: 14px;
    bottom: max(104px, calc(env(safe-area-inset-bottom) + 94px));
    padding: 0 14px;
  }
  .xgc-backdrop { padding: 0; align-items: end; }
  .xgc-dialog { width: 100%; max-height: 88vh; border-radius: 18px 18px 0 0; }
  .xgc-header, .xgc-body { padding: 18px; }
  .xgc-rewards { grid-template-columns: 1fr; }
}

@media (prefers-color-scheme: dark) {
  .xgc-dialog { color: #e5e7eb; background: #18181c; }
  .xgc-header { border-color: #303036; }
  .xgc-close, .xgc-tab, .xgc-input, .xgc-button, .xgc-reward { color: #e5e7eb; background: #242428; border-color: #3f3f46; }
  .xgc-tab[aria-selected="true"] { color: #6ee7a8; border-color: #18a058; background: #173d2a; }
  .xgc-preview { border-color: #37463e; background: #202923; }
  .xgc-subtitle, .xgc-preview p, .xgc-reward small, .xgc-history-meta, .xgc-empty { color: #a1a1aa; }
}
