/* ============================================================
   Character Gift Page Styles
   ============================================================ */

:root {
  --gift-bg: var(--surface-raised);
  --gift-card-bg: var(--surface-sunken);
  --gift-card-border: var(--line);
  --gift-accent: #8f8f8f;
  --gift-accent-alt: #828282;
  --gift-text: var(--ink);
  --gift-muted: var(--ink-muted);
  --gift-points-color: #a58404;
}

/* ---- Page layout ---- */
.gift-page {
  min-height: 100vh;
  background: var(--gift-bg);
  color: var(--gift-text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  padding-bottom: 100px;
}

/* ---- Character hero ---- */
.gift-hero {
  position: relative;
  padding: 24px 16px 20px;
  text-align: center;
  background: linear-gradient(180deg, rgba(130, 130, 130, 0.15) 0%, transparent 100%);
  border-bottom: 1px solid var(--gift-card-border);
}

.gift-hero-back {
  position: absolute;
  top: 16px;
  left: 16px;
  color: var(--gift-muted);
  font-size: 1.2rem;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  transition: color 0.2s;
}
.gift-hero-back:hover { color: var(--gift-text); }

.gift-hero-avatar {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--gift-accent);
  margin-bottom: 12px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.16);
}

.gift-hero-name {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0 0 4px;
  background: linear-gradient(135deg, #000000 30%, #262626);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.gift-hero-tagline {
  font-size: 0.82rem;
  color: var(--gift-muted);
  margin: 0;
}

.gift-hero-tagline strong {
  color: var(--gift-accent);
}

/* ---- Section header ---- */
.gift-section-header {
  padding: 20px 16px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gift-muted);
}

/* ---- Gift grid ---- */
.gift-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 0 12px;
}

@media (min-width: 480px) {
  .gift-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 768px) {
  .gift-grid { grid-template-columns: repeat(4, 1fr); gap: 14px; padding: 0 20px; }
}

/* ---- Gift card ---- */
.gift-card {
  background: var(--gift-card-bg);
  border: 1px solid var(--gift-card-border);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}
.gift-card:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.15);
}
.gift-card:active { transform: translateY(-1px); }

.gift-card-image-wrap {
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--surface-raised);
  position: relative;
}
.gift-card-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.gift-card:hover .gift-card-image-wrap img { transform: scale(1.04); }

.gift-card-nsfw-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(175, 15, 15, 0.9);
  color: var(--status-ink);
  font-size: 0.6rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.gift-card-body {
  padding: 8px 10px 10px;
}
.gift-card-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gift-text);
  margin: 0 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gift-card-cost {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  color: var(--gift-points-color);
  font-weight: 700;
}
.gift-card-cost .cost-icon { font-size: 0.7rem; }

.gift-card-unavailable {
  opacity: 0.5;
  cursor: not-allowed;
}
.gift-card-unavailable:hover {
  transform: none;
  border-color: var(--gift-card-border);
  box-shadow: none;
}

/* ---- Sticky bottom bar (points balance) ---- */
.gift-sticky-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--veil-strong);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--gift-card-border);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 100;
}

.gift-sticky-points {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
}
.gift-sticky-points .pts-label { color: var(--gift-muted); font-weight: 400; }
.gift-sticky-points .pts-amount { color: var(--gift-points-color); font-size: 1rem; }

.gift-sticky-cta {
  font-size: 0.78rem;
  color: var(--gift-muted);
  text-decoration: none;
}
.gift-sticky-cta:hover { color: var(--gift-text); }

/* ---- Purchase Modal ---- */
.gift-modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--veil-strong);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.gift-modal-backdrop.show {
  opacity: 1;
  pointer-events: all;
}

.gift-modal {
  width: 100%;
  max-width: 480px;
  background: var(--surface-sunken);
  border-radius: 24px 24px 0 0;
  padding: 0 0 env(safe-area-inset-bottom, 20px);
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  overflow: hidden;
}
.gift-modal-backdrop.show .gift-modal {
  transform: translateY(0);
}

.gift-modal-handle {
  width: 36px;
  height: 4px;
  background: var(--scrim-soft);
  border-radius: 2px;
  margin: 14px auto 0;
}

.gift-modal-header {
  padding: 16px 20px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--gift-card-border);
}
.gift-modal-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gift-text);
  margin: 0;
}
.gift-modal-close {
  background: none;
  border: none;
  color: var(--gift-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px;
  transition: color 0.2s;
}
.gift-modal-close:hover { color: var(--gift-text); }

.gift-modal-body {
  padding: 20px;
}

/* Gift preview in modal */
.gift-modal-preview {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--glass);
  border: 1px solid var(--gift-card-border);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 20px;
}
.gift-modal-preview-img {
  width: 70px;
  height: 70px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
}
.gift-modal-preview-info { flex: 1; min-width: 0; }
.gift-modal-preview-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gift-text);
  margin: 0 0 4px;
}
.gift-modal-preview-desc {
  font-size: 0.78rem;
  color: var(--gift-muted);
  margin: 0 0 8px;
}
.gift-modal-preview-cost {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(165, 132, 4, 0.12);
  border: 1px solid rgba(165, 132, 4, 0.25);
  color: var(--gift-points-color);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
}

/* Social handle input */
.gift-social-section { margin-bottom: 20px; }
.gift-social-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gift-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
  display: block;
}
.gift-social-hint {
  font-size: 0.72rem;
  color: var(--gift-muted);
  margin-top: 6px;
  opacity: 0.7;
}

.gift-social-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.gift-social-input-wrap .at-prefix {
  position: absolute;
  left: 14px;
  color: var(--gift-muted);
  font-size: 0.9rem;
  font-weight: 600;
  pointer-events: none;
}
.gift-social-input {
  width: 100%;
  background: var(--glass-strong);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  color: var(--gift-text);
  font-size: 0.9rem;
  padding: 12px 14px 12px 30px;
  outline: none;
  transition: border-color 0.2s;
}
.gift-social-input:focus {
  border-color: var(--gift-accent);
}
.gift-social-input::placeholder { color: var(--ink-disabled); }

/* Points warning */
.gift-insufficient-warning {
  background: rgba(175, 15, 15, 0.1);
  border: 1px solid rgba(175, 15, 15, 0.3);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 0.82rem;
  color: #d50b0b;
  margin-bottom: 16px;
  display: none;
}

.gift-insufficient-link {
  background: none;
  border: none;
  padding: 0;
  color: #d50b0b;
  font-weight: 600;
  font-size: inherit;
  cursor: pointer;
  text-decoration: underline;
}

/* Purchase button */
.gift-purchase-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--gift-accent), var(--gift-accent-alt));
  border: none;
  border-radius: 14px;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.gift-purchase-btn:hover { opacity: 0.9; }
.gift-purchase-btn:active { transform: scale(0.98); }
.gift-purchase-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.gift-login-prompt {
  text-align: center;
  padding: 8px 0;
  font-size: 0.85rem;
  color: var(--gift-muted);
}
.gift-login-prompt a {
  color: var(--gift-accent);
  font-weight: 600;
  text-decoration: none;
}

/* ---- Thank-you popup (after a gift is sent) ---- */
.gift-thanks-overlay {
  position: fixed;
  inset: 0;
  background: var(--veil-strong);
  backdrop-filter: blur(10px);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.gift-thanks-overlay.show {
  opacity: 1;
  pointer-events: all;
}

.gift-thanks-card {
  position: relative;
  width: 100%;
  max-width: 380px;
  background: linear-gradient(180deg, #dadada 0%, #e3e3e3 55%);
  border: 1px solid var(--gift-card-border);
  border-radius: 22px;
  padding: 28px 22px 20px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.16);
  animation: gift-thanks-in 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
@keyframes gift-thanks-in {
  from { opacity: 0; transform: translateY(18px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.gift-thanks-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  color: var(--gift-muted);
  font-size: 1rem;
  cursor: pointer;
  transition: color 0.2s;
  line-height: 1;
  padding: 4px;
}
.gift-thanks-close:hover { color: var(--gift-text); }

/* Her thumbnail */
.gift-thanks-avatar-wrap {
  position: relative;
  width: 92px;
  height: 92px;
  margin: 0 auto 16px;
}
.gift-thanks-avatar {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(143, 143, 143, 0.55);
  box-shadow: 0 0 0 6px rgba(0, 0, 0, 0.12);
  display: block;
}
.gift-thanks-avatar-badge {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gift-accent), var(--gift-accent-alt));
  border: 2px solid var(--line-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}

.gift-thanks-headline {
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.45;
  margin: 0 0 14px;
  color: var(--gift-text);
}

/* Her personal note — only shown when the sender left a name */
.gift-thanks-message {
  text-align: left;
  background: var(--glass);
  border: 1px solid rgba(0, 0, 0, 0.09);
  border-left: 3px solid var(--gift-accent);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 18px;
}
.gift-thanks-message-author {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--gift-accent);
  margin-bottom: 5px;
}
.gift-thanks-message-text {
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--ink);
  margin: 0;
  white-space: pre-wrap;
}

/* Tip upsell */
.gift-thanks-upsell {
  border-top: 1px solid var(--gift-card-border);
  padding-top: 16px;
}
.gift-thanks-upsell-text {
  font-size: 0.8rem;
  color: var(--gift-muted);
  line-height: 1.5;
  margin-bottom: 12px;
}
.gift-thanks-tip-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--gift-accent), var(--gift-accent-alt));
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity 0.2s, transform 0.15s;
}
.gift-thanks-tip-btn:hover { opacity: 0.9; }
.gift-thanks-tip-btn:active { transform: scale(0.98); }

.gift-thanks-secondary {
  width: 100%;
  margin-top: 10px;
  padding: 10px;
  background: none;
  border: none;
  color: var(--gift-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s;
}
.gift-thanks-secondary:hover { color: var(--gift-text); }

/* ---- Empty state ---- */
.gift-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--gift-muted);
}
.gift-empty-icon { font-size: 2.5rem; margin-bottom: 12px; }
.gift-empty-text { font-size: 0.9rem; }

/* ---- Guest gate banner ---- */
.gift-guest-banner {
  margin: 12px 16px;
  background: var(--glass-strong);
  border: 1px solid rgba(130, 130, 130, 0.3);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.82rem;
  color: var(--ink-soft);
}
.gift-guest-banner .gift-guest-icon { font-size: 1.3rem; flex-shrink: 0; }
.gift-guest-banner a { color: var(--ink-soft); font-weight: 600; text-decoration: none; }

/* ---- Tablet/desktop centering ---- */
@media (min-width: 768px) {
  .gift-page { max-width: 680px; margin: 0 auto; }
  .gift-sticky-bar { max-width: 680px; left: 50%; transform: translateX(-50%); }
  .gift-modal { border-radius: 20px; margin-bottom: 20px; }
  .gift-modal-backdrop { align-items: center; }
}
