/* =========================================================
   기프지기 🎁⏰  -  귀엽고 깜찍한 스타일 (다크모드 · 모바일 대응)
   ========================================================= */

:root {
  --pink:      #ff9ec7;
  --pink-soft: #ffd6e7;
  --peach:     #ffe2c2;
  --mint:      #b8f3e6;
  --lav:       #d9c8ff;
  --yellow:    #ffe27a;
  --red:       #ff7a8a;
  --orange:    #ffb16b;

  --bg:        #fff7fb;
  --surface:   #ffffff;
  --surface-2: #fff7fb;
  --ink:       #4a3b46;
  --ink-soft:  #786673;
  --line:      #ffd6e7;

  --kakao:     #fee500;
  --kakao-ink: #391b1b;
  --shadow:    0 10px 30px rgba(255, 158, 199, 0.25);
  --radius:    24px;
  --safe-b:    env(safe-area-inset-bottom, 0px);
}

/* 다크 모드 */
[data-theme="dark"] {
  --pink:      #ff8fc0;
  --pink-soft: #4a3144;
  --mint:      #6fd9c2;
  --lav:       #a892e0;
  --yellow:    #f4d35e;
  --red:       #ff8a98;

  --bg:        #2a2030;
  --surface:   #382c40;
  --surface-2: #2f2438;
  --ink:       #ffeef7;
  --ink-soft:  #c9b3c4;
  --line:      #543b4e;
  --shadow:    0 10px 30px rgba(0, 0, 0, 0.4);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 10%, color-mix(in srgb, var(--pink) 22%, transparent) 0%, transparent 40%),
    radial-gradient(circle at 85% 20%, color-mix(in srgb, var(--mint) 28%, transparent) 0%, transparent 42%),
    radial-gradient(circle at 50% 95%, color-mix(in srgb, var(--lav) 25%, transparent) 0%, transparent 45%),
    var(--bg);
  min-height: 100vh; overflow-x: hidden;
  font-size: 16px; font-weight: 450; line-height: 1.65;
  letter-spacing: -0.01em; word-break: keep-all;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  transition: background-color .3s, color .3s;
}
h1, h2, h3, .logo-text { font-family: 'Jua', sans-serif; font-weight: 400; letter-spacing: 0.01em; line-height: 1.35; }
strong, b { font-weight: 700; }
.hidden { display: none !important; }
button { font-family: inherit; }

/* ---------- 배경 둥둥 장식 ---------- */
.bg-decor { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.floaty { position: absolute; font-size: 2.4rem; opacity: 0.45; animation: float 7s ease-in-out infinite; }
.f1 { top: 12%; left: 8%; } .f2 { top: 22%; right: 10%; animation-delay: 1.2s; font-size: 3rem; }
.f3 { top: 62%; left: 5%; animation-delay: 2.1s; } .f4 { top: 78%; right: 14%; animation-delay: .6s; }
.f5 { top: 45%; left: 48%; animation-delay: 3s; opacity: .25; } .f6 { top: 88%; left: 40%; animation-delay: 1.8s; }
@keyframes float { 0%,100%{transform:translateY(0) rotate(-6deg);} 50%{transform:translateY(-22px) rotate(8deg);} }

/* ---------- 헤더 ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px clamp(14px, 4vw, 48px);
  padding-top: max(12px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 2px dashed var(--line);
}
.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); flex-shrink: 0; }
.logo-emoji { font-size: 1.8rem; animation: wiggle 3s ease-in-out infinite; }
.logo-text { font-size: 1.55rem; color: var(--pink); }
@keyframes wiggle { 0%,100%{transform:rotate(-8deg);} 50%{transform:rotate(8deg);} }
.header-right { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 42px; height: 42px; border-radius: 50%; border: 2px solid var(--line);
  background: var(--surface); cursor: pointer; font-size: 1.15rem; color: var(--ink);
  display: grid; place-items: center; transition: transform .15s, background .15s, border-color .15s;
}
.icon-btn:hover { transform: translateY(-2px); border-color: var(--pink); }
.icon-btn:active { transform: scale(.92); }

.kakao-btn {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  background: var(--kakao); color: var(--kakao-ink); border: none; cursor: pointer;
  font-family: 'Jua', sans-serif; font-size: 1rem; padding: 10px 18px; border-radius: 999px;
  box-shadow: 0 6px 16px rgba(254, 229, 0, 0.45); transition: transform .15s, box-shadow .15s;
}
.kakao-btn:hover { transform: translateY(-2px) scale(1.03); }
.kakao-btn:active { transform: scale(.96); }

.user-box { display: flex; align-items: center; gap: 8px; }
.user-thumb { width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--pink); object-fit: cover; background: var(--pink-soft); }
.user-name { font-family: 'Jua', sans-serif; font-size: 1.02rem; }
.logout-btn {
  background: var(--pink-soft); border: none; cursor: pointer; color: var(--ink);
  padding: 7px 13px; border-radius: 999px; font-family: 'Pretendard', sans-serif; font-weight: 700; font-size: .92rem;
  transition: background .15s;
}
.logout-btn:hover { background: var(--pink); color: #fff; }

/* ---------- D-day 배너 ---------- */
.dday-banner {
  position: relative; z-index: 5;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: linear-gradient(135deg, var(--red), var(--orange)); color: #fff;
  font-family: 'Jua', sans-serif; font-size: 1rem; padding: 12px 44px 12px 18px; text-align: center;
  animation: slideDown .4s ease;
}
@keyframes slideDown { from { transform: translateY(-100%); } to { transform: translateY(0); } }
.banner-close { position: absolute; right: 12px; background: rgba(255,255,255,.25); border: none; color: #fff;
  width: 28px; height: 28px; border-radius: 50%; cursor: pointer; font-size: .9rem; }
.banner-close:hover { background: rgba(255,255,255,.4); }

/* ---------- 인트로 ---------- */
.intro { position: relative; z-index: 1; text-align: center; padding: clamp(26px, 5vw, 56px) 20px 16px; max-width: 760px; margin: 0 auto; }
.hero-badge {
  display: inline-block; background: var(--surface); color: var(--ink);
  padding: 7px 16px; border-radius: 999px; font-size: .95rem; font-weight: 700;
  box-shadow: var(--shadow); margin-bottom: 16px;
}
.intro-title { font-size: clamp(1.9rem, 6vw, 3rem); line-height: 1.3; }
.hl { color: var(--pink); background: linear-gradient(transparent 58%, var(--yellow) 58%); padding: 0 2px; }
.intro-sub { margin-top: 14px; font-size: clamp(1.05rem, 2.5vw, 1.22rem); font-weight: 500; color: var(--ink-soft); }

/* ---------- 통계 ---------- */
.stats { position: relative; z-index: 1; max-width: 980px; margin: 8px auto 0; padding: 0 16px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat-tile {
  background: var(--surface); border-radius: 18px; padding: 16px 8px; text-align: center; box-shadow: var(--shadow);
  transition: transform .2s;
}
.stat-tile:hover { transform: translateY(-4px); }
.stat-emoji { font-size: 1.5rem; }
.stat-num { font-family: 'Jua', sans-serif; font-size: 1.35rem; color: var(--pink); line-height: 1.2; margin-top: 4px; word-break: keep-all; }
.stat-label { font-size: .9rem; font-weight: 600; color: var(--ink-soft); }

.cat-bars { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; background: var(--surface); border-radius: 18px; padding: 14px 16px; box-shadow: var(--shadow); }
.cat-bar-row { display: grid; grid-template-columns: 84px 1fr 34px; align-items: center; gap: 10px; font-size: .92rem; }
.cat-bar-track { height: 12px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.cat-bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--mint), var(--pink)); transition: width .5s ease; }
.cat-bar-row b { text-align: right; font-family: 'Jua', sans-serif; color: var(--ink-soft); }
.cat-empty { text-align: center; color: var(--ink-soft); font-size: .95rem; }

/* ---------- 요약 카드 ---------- */
.summary { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; max-width: 760px; margin: 18px auto 0; padding: 0 16px; }
.sum-card {
  background: var(--surface); border-radius: 20px; padding: 16px 8px; text-align: center; box-shadow: var(--shadow);
  border: none; border-bottom: 5px solid transparent; cursor: pointer; transition: transform .2s; color: var(--ink);
}
.sum-card:hover { transform: translateY(-5px); }
.sum-card:active { transform: scale(.96); }
.sum-card.urgent  { border-bottom-color: var(--red); }
.sum-card.ok      { border-bottom-color: var(--mint); }
.sum-card.done    { border-bottom-color: var(--lav); }
.sum-card.expired { border-bottom-color: var(--ink-soft); }
.sum-emoji { font-size: 1.7rem; }
.sum-num { font-family: 'Jua', sans-serif; font-size: 1.9rem; line-height: 1.1; }
.sum-label { font-size: .9rem; color: var(--ink-soft); }

/* ---------- 검색 & 정렬 ---------- */
.toolbar { position: relative; z-index: 1; max-width: 980px; margin: 22px auto 8px; padding: 0 16px; display: flex; gap: 10px; }
.search-wrap { flex: 1; display: flex; align-items: center; gap: 8px; background: var(--surface); border: 2px solid var(--line); border-radius: 999px; padding: 0 14px; box-shadow: var(--shadow); }
.search-wrap:focus-within { border-color: var(--pink); }
.search-ico { font-size: 1rem; }
#searchInput { flex: 1; border: none; background: none; font-family: 'Pretendard', sans-serif; font-size: 1.05rem; padding: 11px 0; color: var(--ink); outline: none; }
.clear-search { background: var(--pink-soft); border: none; color: var(--ink); width: 26px; height: 26px; border-radius: 50%; cursor: pointer; font-size: .85rem; }
.sort-select {
  border: 2px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink);
  font-family: 'Pretendard', sans-serif; font-weight: 700; font-size: 1rem; padding: 0 14px; cursor: pointer; box-shadow: var(--shadow);
}

/* ---------- 칩 (필터) ---------- */
.chip-row {
  position: relative; z-index: 1; max-width: 980px; margin: 8px auto 0; padding: 4px 16px;
  display: flex; gap: 8px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; background: var(--surface); border: 2px solid var(--line); color: var(--ink-soft); cursor: pointer;
  font-family: 'Pretendard', sans-serif; font-weight: 700; font-size: .98rem; padding: 7px 15px; border-radius: 999px;
  white-space: nowrap; transition: all .15s;
}
.chip:hover { border-color: var(--pink); }
.chip.active { background: var(--pink); border-color: var(--pink); color: #fff; }

/* ---------- 버튼 ---------- */
.btn-primary {
  background: linear-gradient(135deg, var(--pink), #ff7eb3); color: #fff; border: none; cursor: pointer;
  font-family: 'Jua', sans-serif; font-size: 1.12rem; padding: 14px 28px; border-radius: 999px;
  box-shadow: 0 8px 20px rgba(255, 126, 179, 0.45); transition: transform .15s, box-shadow .15s;
}
.btn-primary:hover { transform: translateY(-3px) scale(1.02); }
.btn-primary:active { transform: scale(.97); }
.btn-primary.small { font-size: .98rem; padding: 10px 18px; }
.btn-primary.full { width: 100%; margin-top: 8px; }
.btn-ghost {
  background: var(--surface); border: 2px solid var(--line); color: var(--ink); cursor: pointer;
  font-family: 'Jua', sans-serif; font-size: 1rem; padding: 12px 20px; border-radius: 999px; transition: all .15s;
}
.btn-ghost:hover { border-color: var(--pink); }

/* ---------- 보관함 ---------- */
.box-section { position: relative; z-index: 1; max-width: 980px; margin: 18px auto 40px; padding: 0 16px; }
.box-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.result-count { font-family: 'Jua', sans-serif; color: var(--ink-soft); font-size: 1.05rem; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.gift-card {
  background: var(--surface); border-radius: var(--radius); padding: 18px; position: relative;
  box-shadow: var(--shadow); transition: transform .2s; overflow: hidden; animation: pop .35s ease both; cursor: pointer;
}
.gift-card:hover { transform: translateY(-5px); }
.gift-card.is-used { opacity: .6; }
@keyframes pop { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: scale(1); } }

.gc-top { display: flex; align-items: center; justify-content: space-between; }
.gc-emoji { font-size: 2.5rem; }
.dday { font-family: 'Jua', sans-serif; font-size: .98rem; padding: 6px 12px; border-radius: 999px; color: #fff; white-space: nowrap; }
.dday.urgent  { background: var(--red); animation: pulse 1.4s ease-in-out infinite; }
.dday.ok      { background: var(--mint); color: #3a3a3a; }
.dday.done    { background: var(--lav); color: #3a3a3a; }
.dday.expired { background: var(--ink-soft); }
@keyframes pulse { 0%,100%{ transform: scale(1); } 50%{ transform: scale(1.08); } }

.gc-item { font-family: 'Jua', sans-serif; font-size: 1.22rem; margin-top: 10px; }
.gc-shop { color: var(--ink-soft); font-size: .98rem; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.gc-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.mini-chip { font-size: .8rem; padding: 3px 10px; border-radius: 999px; font-weight: 700; background: var(--surface-2); color: var(--ink-soft); }
.mini-chip.cat { background: var(--mint); color: #234; }
.mini-chip.owner { background: var(--lav); color: #312a4a; }
.mini-chip.qty { background: var(--peach); color: #6a4a2a; }
.tag-amount { background: var(--lav); color: #312a4a; font-weight: 800; font-size: .76rem; padding: 2px 9px; border-radius: 999px; }

.gc-thumb { width: 100%; height: 96px; object-fit: cover; border-radius: 14px; margin-top: 10px; background: var(--surface-2); }

.gc-expire { margin-top: 10px; font-size: .92rem; color: var(--ink); font-weight: 700; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.gc-msg { margin-top: 10px; background: var(--surface-2); border-radius: 14px; padding: 8px 12px; font-size: .92rem; }
.badge-extend { background: var(--mint); color: #3a3a3a; font-family: 'Pretendard', sans-serif; font-weight: 700; font-size: .8rem; padding: 2px 9px; border-radius: 999px; }

/* 금액권 잔액 */
.gc-balance { margin-top: 12px; background: var(--surface-2); border-radius: 16px; padding: 12px 14px; }
.bal-row { display: flex; justify-content: space-between; align-items: baseline; font-size: .92rem; color: var(--ink-soft); }
.bal-row b { font-family: 'Jua', sans-serif; font-size: 1.25rem; color: var(--pink); }
.bal-row b.low { color: var(--red); }
.bal-bar { height: 10px; background: var(--pink-soft); border-radius: 999px; overflow: hidden; margin: 8px 0 4px; }
.bal-fill { height: 100%; background: linear-gradient(90deg, var(--mint), var(--pink)); border-radius: 999px; transition: width .4s ease; }
.bal-fill.low { background: var(--red); }
.bal-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bal-total { font-size: .82rem; color: var(--ink-soft); }
.hist-link { background: none; border: none; cursor: pointer; color: var(--pink); font-family: 'Pretendard', sans-serif; font-weight: 700; font-size: .86rem; padding: 2px 4px; border-radius: 8px; }
.hist-link:hover { background: var(--pink-soft); }

.gc-foot { display: flex; align-items: center; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.gc-by { font-size: .88rem; color: var(--ink-soft); display: flex; align-items: center; }
.gc-by img { width: 22px; height: 22px; border-radius: 50%; margin-right: 4px; }
.gc-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.gc-icon-btn { background: var(--surface-2); border: none; cursor: pointer; font-size: .95rem; width: 34px; height: 34px; border-radius: 50%; transition: transform .15s, background .15s; }
.gc-icon-btn:hover { transform: scale(1.12); background: var(--pink-soft); }
.gc-use { background: var(--mint); border: none; cursor: pointer; color: #3a3a3a; font-family: 'Jua', sans-serif; font-size: .88rem; padding: 8px 13px; border-radius: 999px; transition: transform .15s, background .15s; }
.gc-use:hover { transform: scale(1.05); }
.gc-use.used { background: var(--pink-soft); color: var(--ink); }
.gc-use.spend { background: var(--yellow); color: #5a4a1a; }
.gc-use:disabled { background: var(--pink-soft); cursor: default; opacity: .7; transform: none; color: var(--ink); }

.empty-box { text-align: center; padding: 56px 20px; color: var(--ink-soft); }
.empty-emoji { font-size: 4rem; animation: float 4s ease-in-out infinite; display: inline-block; }
.empty-box p { margin-top: 12px; font-size: 1.12rem; }

/* ---------- FAB ---------- */
.fab {
  position: fixed; right: 18px; bottom: calc(18px + var(--safe-b)); z-index: 30;
  width: 62px; height: 62px; border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--pink), #ff7eb3); color: #fff; font-size: 2rem; font-weight: 300;
  box-shadow: 0 12px 28px rgba(255, 126, 179, 0.5); display: none; place-items: center;
  transition: transform .2s; animation: bobFab 3s ease-in-out infinite;
}
.fab:active { transform: scale(.9); }
@keyframes bobFab { 0%,100%{ transform: translateY(0); } 50%{ transform: translateY(-6px); } }

/* ---------- 모달 ---------- */
.modal-overlay { position: fixed; inset: 0; z-index: 50; background: rgba(40, 28, 44, 0.5); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface); border-radius: 28px; padding: 28px clamp(18px, 5vw, 34px);
  width: 100%; max-width: 460px; position: relative; box-shadow: 0 20px 60px rgba(0,0,0,.3);
  animation: popIn .25s cubic-bezier(.34,1.56,.64,1); max-height: 92vh; overflow-y: auto;
}
@keyframes popIn { from { transform: scale(.85) translateY(20px); opacity: 0; } to { transform: scale(1) translateY(0); opacity: 1; } }
.modal-title { font-size: 1.5rem; text-align: center; color: var(--pink); margin-bottom: 18px; }
.modal-close { position: absolute; top: 14px; right: 14px; background: var(--pink-soft); border: none; width: 36px; height: 36px;
  border-radius: 50%; cursor: pointer; font-size: 1rem; color: var(--ink); transition: background .15s, transform .15s; z-index: 2; }
.modal-close:hover { background: var(--pink); color: #fff; transform: rotate(90deg); }

.share-form { display: flex; flex-direction: column; gap: 14px; }
.share-form label { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 1.02rem; }
.share-form input, .share-form select {
  font-family: 'Pretendard', sans-serif; font-size: 1.05rem; padding: 12px 16px; border: 2px solid var(--line);
  border-radius: 14px; background: var(--surface-2); color: var(--ink); transition: border-color .15s; width: 100%;
}
.share-form input:focus, .share-form select:focus { outline: none; border-color: var(--pink); }
.share-form input[type="file"] { padding: 9px 12px; font-size: .95rem; }
.form-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-2col label { font-size: .98rem; }

.type-toggle { display: flex; gap: 8px; }
.type-btn, .owner-btn {
  flex: 1; background: var(--surface-2); border: 2px solid var(--line); cursor: pointer;
  font-family: 'Jua', sans-serif; font-size: .98rem; color: var(--ink-soft); padding: 10px 4px; border-radius: 14px; transition: all .15s;
}
.type-btn:hover, .owner-btn:hover { border-color: var(--pink); }
.type-btn.active, .owner-btn.active { background: var(--pink); border-color: var(--pink); color: #fff; }

.check-row { flex-direction: row !important; align-items: center; gap: 10px !important; cursor: pointer; }
.check-row input { width: 22px; height: 22px; accent-color: var(--pink); cursor: pointer; flex-shrink: 0; }

.ocr-hint { font-weight: 500; font-size: .8rem; color: var(--ink-soft); }
.ocr-status { display: flex; align-items: center; gap: 10px; margin-top: 8px; background: var(--surface-2); border: 2px dashed var(--pink); border-radius: 14px; padding: 10px 14px; font-weight: 600; font-size: .95rem; color: var(--ink); }
.ocr-spinner { width: 18px; height: 18px; border: 3px solid var(--pink-soft); border-top-color: var(--pink); border-radius: 50%; animation: spin .8s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
.ocr-rescan { position: absolute; bottom: 8px; left: 8px; background: rgba(255,255,255,.93); color: #4a3b46; border: none; border-radius: 999px; padding: 6px 12px; font-weight: 700; font-size: .85rem; cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,.18); }
.ocr-rescan:hover { background: #fff; transform: scale(1.04); }

.image-preview { position: relative; margin-top: 8px; }
.image-preview img { width: 100%; max-height: 200px; object-fit: contain; border-radius: 14px; background: var(--surface-2); }
.remove-image { position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,.6); color: #fff; border: none; width: 30px; height: 30px; border-radius: 50%; cursor: pointer; }

.emoji-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.emoji-opt { font-size: 1.5rem; width: 46px; height: 46px; border-radius: 14px; cursor: pointer; border: 2px solid transparent; background: var(--surface-2); transition: all .15s; }
.emoji-opt:hover { transform: scale(1.1); }
.emoji-opt.selected { border-color: var(--pink); background: var(--pink-soft); }

.spend-info { text-align: center; font-size: 1.08rem; color: var(--ink); margin-bottom: 16px; line-height: 1.6; }
.hl-text { color: var(--pink); }

/* 사용 내역 */
.hist-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; max-height: 46vh; overflow-y: auto; }
.hist-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--surface-2); border-radius: 14px; padding: 12px 14px; }
.hist-main { display: flex; flex-direction: column; gap: 2px; }
.hist-main b { font-family: 'Jua', sans-serif; font-size: 1.12rem; color: var(--red); }
.hist-main span { font-size: .88rem; color: var(--ink-soft); }
.hist-acts { display: flex; gap: 6px; }
.hist-empty { text-align: center; color: var(--ink-soft); padding: 22px 0; font-size: 1.02rem; }

/* 상세 모달 */
.detail-modal { max-width: 480px; }
.detail-hero { display: flex; align-items: center; gap: 12px; }
.detail-hero .gc-emoji { font-size: 3rem; }
.detail-title { font-family: 'Jua', sans-serif; font-size: 1.5rem; }
.detail-img { width: 100%; max-height: 240px; object-fit: contain; border-radius: 16px; background: var(--surface-2); margin: 14px 0; cursor: zoom-in; }
.detail-barcode { background: #fff; border-radius: 14px; padding: 12px; text-align: center; margin: 12px 0; }
.detail-barcode svg { max-width: 100%; }
.detail-row { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 1rem; }
.detail-row:last-of-type { border-bottom: none; }
.detail-row .k { color: var(--ink-soft); }
.detail-row .v { font-weight: 700; text-align: right; }
.detail-extend { display: flex; gap: 8px; margin: 12px 0; align-items: center; }
.detail-extend input { flex: 1; }
.detail-extend button { white-space: nowrap; }
.detail-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.detail-actions .btn-primary, .detail-actions .btn-ghost { flex: 1; }

/* 설정 */
.settings-list { display: flex; flex-direction: column; gap: 10px; }
.setting-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%;
  background: var(--surface-2); border: 2px solid var(--line); border-radius: 16px; padding: 14px 16px;
  font-family: 'Pretendard', sans-serif; font-weight: 700; font-size: 1.05rem; color: var(--ink); cursor: pointer; transition: border-color .15s;
}
.setting-row:hover { border-color: var(--pink); }
.setting-row.danger { color: var(--red); }
.setting-state { color: var(--ink-soft); font-size: .95rem; }
.settings-foot { text-align: center; color: var(--ink-soft); font-size: .9rem; margin-top: 18px; }

/* 라이트박스 */
.lightbox { position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,.85); display: flex; align-items: center; justify-content: center; padding: 20px; cursor: zoom-out; animation: fade .2s ease; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 12px; }

/* 컨페티 */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 90; overflow: hidden; }
.confetti-piece { position: absolute; top: -10%; animation: confettiFall 1.5s ease-in forwards; }
@keyframes confettiFall { to { transform: translateY(110vh) rotate(540deg); opacity: 0; } }

/* 토스트 */
.toast {
  position: fixed; bottom: calc(28px + var(--safe-b)); left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 14px 26px; border-radius: 999px;
  font-family: 'Jua', sans-serif; font-size: 1.02rem; z-index: 100; max-width: 90vw; text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,.25); animation: toastIn .3s ease;
}
@keyframes toastIn { from { transform: translate(-50%, 20px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* 푸터 */
.site-footer { position: relative; z-index: 1; text-align: center; padding: 36px 20px calc(36px + var(--safe-b)); color: var(--ink-soft); border-top: 2px dashed var(--line); margin-top: 30px; background: color-mix(in srgb, var(--surface) 50%, transparent); }
.footer-sub { font-size: .88rem; margin-top: 6px; opacity: .8; }

/* ---------- 반응형 ---------- */
@media (max-width: 720px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .summary { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .card-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .gift-card { padding: 14px; }
  .gc-emoji { font-size: 2.1rem; }
  .gc-item { font-size: 1.08rem; }
  .fab { display: grid; }
  .kakao-label { display: none; }
  .kakao-btn { padding: 10px 14px; }
  .user-name { display: none; }
  /* 모달을 바텀시트로 */
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal { max-width: 100%; border-radius: 26px 26px 0 0; max-height: 90vh; padding-bottom: calc(24px + var(--safe-b)); animation: sheetUp .3s cubic-bezier(.34,1.4,.64,1); }
  @keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
  .lightbox { padding: 12px; }
}
@media (max-width: 400px) {
  .card-grid { grid-template-columns: 1fr; }
  .header-right { gap: 6px; }
  .icon-btn { width: 38px; height: 38px; font-size: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
