/* ==========================================================================
   수쿠 – 사용자 페이지
   화이트 기반 / 프리미엄 카드 그리드 / 핀테크 정보 서비스 톤
   ========================================================================== */

:root {
    /* 색상 토큰 */
    --bg: #ffffff;
    --bg-soft: #f6f7f9;
    --bg-hover: #fafbfc;
    --text: #16181d;
    --text-body: #333d4b;
    --text-sub: #6b7684;
    --text-faint: #a0a7b2;
    --border: #e8eaee;
    --hairline: #eef0f3;

    --brand: #2b62e0;
    --brand-strong: #1f4fc4;
    --brand-soft: #eef3fe;
    --ring: rgba(43, 98, 224, 0.18);

    --success: #0f8449;
    --success-soft: #edf8f2;
    --success-border: #cbe8d8;

    --warn: #c25a0a;
    --warn-soft: #fdf2e6;
    --warn-border: #f4d9bd;

    --danger: #dc3a34;
    --danger-soft: #fdf0ef;

    /* 구조 토큰 */
    --radius-lg: 18px;
    --radius: 12px;
    --radius-sm: 9px;
    --maxw: 1120px;
    --header-h: 66px;
    --dur: 170ms;
    --ease: cubic-bezier(0.32, 0.08, 0.24, 1);
    --card-shadow: 0 1px 2px rgba(20, 24, 33, 0.04), 0 4px 14px rgba(20, 24, 33, 0.05);
    --card-shadow-hover: 0 2px 4px rgba(20, 24, 33, 0.05), 0 12px 30px rgba(20, 24, 33, 0.10);
    --pop-shadow: 0 16px 48px rgba(16, 20, 30, 0.18), 0 3px 10px rgba(16, 20, 30, 0.08);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
        "Segoe UI", Roboto, "Malgun Gothic", sans-serif;
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    word-break: keep-all;
}

h1, h2, h3, p, ul, dl, dd, dt, figure { margin: 0; }
ul { padding: 0; list-style: none; }
button { font: inherit; cursor: pointer; color: inherit; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

.container {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 24px;
}

.sr-only {
    position: absolute; width: 1px; height: 1px;
    margin: -1px; padding: 0; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.text-muted { color: var(--text-faint); }

:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ---- 버튼 ---------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 18px;
    height: 44px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.01em;
    transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-strong); }
.btn-primary:active { background: #1a44ad; }
.btn-primary:disabled { background: #a9bcec; cursor: not-allowed; }

.btn-ghost {
    background: var(--bg);
    color: var(--text-body);
    border-color: var(--border);
}
.btn-ghost:hover { background: var(--bg-soft); border-color: #d7dbe2; }

.btn-sm { height: 38px; padding: 0 14px; font-size: 13.5px; }

/* ---- 헤더 ------------------------------------------------------------------ */

.site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: saturate(1.6) blur(12px);
    border-bottom: 1px solid var(--hairline);
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-h);
    gap: 20px;
}
.header-left {
    display: flex;
    align-items: center;
    gap: 30px;
    min-width: 0;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.brand-mark {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.brand-mark .ico-ball { width: 32px; height: 32px; }
.brand-logo { height: 34px; width: auto; display: block; }
.brand-name {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.03em;
}
.brand-tag {
    font-size: 12px;
    color: var(--text-faint);
    font-weight: 500;
    padding-left: 11px;
    border-left: 1px solid var(--border);
}
.site-nav { display: flex; gap: 2px; }
.site-nav a,
.site-nav button {
    padding: 9px 13px;
    border: 0;
    background: none;
    border-radius: var(--radius-sm);
    color: var(--text-sub);
    font-size: 14px;
    font-weight: 600;
    transition: color var(--dur), background-color var(--dur);
}
.site-nav a:hover,
.site-nav button:hover { color: var(--text); background: var(--bg-soft); }
.header-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.header-cta { height: 40px; padding: 0 16px; }

/* ---- 콘텐츠 헤더 (제목 + 현황) ------------------------------------------------ */

.page-header { padding: 52px 0 30px; }
.page-header .container {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 40px;
}
.ph-eyebrow {
    font-size: 13px;
    font-weight: 700;
    color: var(--brand);
    letter-spacing: -0.01em;
    margin-bottom: 12px;
}
.ph-title {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -0.035em;
    line-height: 1.28;
}
.ph-desc {
    margin-top: 12px;
    font-size: 15.5px;
    color: var(--text-sub);
}
.ph-note {
    margin-top: 18px;
    font-size: 13px;
    line-height: 1.85;
    color: var(--text-faint);
    display: flex;
    flex-direction: column;
}

.ph-stats {
    display: flex;
    align-items: stretch;
    flex-shrink: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    box-shadow: var(--card-shadow);
    overflow: hidden;
}
.ph-stat { padding: 18px 28px 16px; min-width: 128px; }
.ph-stat + .ph-stat { border-left: 1px solid var(--hairline); }
.ph-stat dt { font-size: 12.5px; font-weight: 500; color: var(--text-sub); }
.ph-stat dd {
    margin-top: 4px;
    font-size: 27px;
    font-weight: 800;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}
.ph-stat.is-acquired dd { color: var(--success); }
.ph-stat dd .unit { font-size: 13px; font-weight: 600; color: var(--text-faint); margin-left: 3px; }

/* ---- 목록 툴바 (필터 칩) --------------------------------------------------------- */

.coupon-section { padding: 6px 0 0; }

.list-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}
.filter-group {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.filter-group::-webkit-scrollbar { display: none; }
.filter-btn {
    border: 1px solid var(--border);
    background: var(--bg);
    padding: 8px 15px;
    height: 38px;
    border-radius: 999px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-sub);
    white-space: nowrap;
    transition: color var(--dur), background-color var(--dur), border-color var(--dur);
}
.filter-btn:hover { color: var(--text); border-color: #d7dbe2; }
.filter-btn.is-active {
    color: #fff;
    background: var(--text);
    border-color: var(--text);
}
.list-caption {
    font-size: 13px;
    color: var(--text-faint);
    white-space: nowrap;
}
.list-caption strong { color: var(--text-sub); font-weight: 600; }

/* ---- 쿠폰 카드 그리드 ------------------------------------------------------------ */

.coupon-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.coupon-card {
    position: relative;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg);
    padding: 24px 24px 20px;
    box-shadow: var(--card-shadow);
    transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.coupon-card:hover {
    border-color: #d9dee6;
    box-shadow: var(--card-shadow-hover);
}
/* 획득 완료: 좌측 그린 액센트 + 옅은 틴트 */
.coupon-card.is-acquired {
    border-color: var(--success-border);
    background:
        linear-gradient(90deg, rgba(15, 132, 73, 0.05), rgba(15, 132, 73, 0) 120px),
        var(--bg);
}
.coupon-card.is-acquired::before {
    content: "";
    position: absolute;
    left: 0; top: 22px; bottom: 22px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--success);
}

/* 카드 상단 */
.cc-top {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}
.cc-mono {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 2px 4px rgba(20, 24, 33, 0.12));
}
.cc-mono .ico-ball { width: 44px; height: 44px; }
.cc-headings { flex: 1; min-width: 0; padding-top: 1px; }
.coupon-name {
    font-size: 16.5px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.4;
}
.coupon-event {
    margin-top: 3px;
    font-size: 13.5px;
    color: var(--text-sub);
}
.cc-status {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

/* 뱃지 */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11.5px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 7px;
    line-height: 1.5;
    white-space: nowrap;
}
.badge-warn { background: var(--warn-soft); color: var(--warn); border: 1px solid var(--warn-border); }
.acquired-flag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--success);
    background: var(--success-soft);
    border: 1px solid var(--success-border);
    padding: 3px 9px;
    border-radius: 7px;
}
.acquired-flag::before {
    content: "";
    width: 5px; height: 5px; border-radius: 50%;
    background: var(--success);
}

/* 카드 본문 */
.cc-body {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--hairline);
    display: flex;
    flex-direction: column;
    gap: 14px;
    flex: 1;
}
.coupon-card.is-acquired .cc-body { border-top-color: var(--success-border); }
.cc-field dt {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-faint);
    margin-bottom: 4px;
}
.cc-field dd { font-size: 14px; color: var(--text-body); line-height: 1.55; }

.period-text {
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
    font-weight: 600;
    color: var(--text-body);
}
.receive-text { font-weight: 600; color: var(--text-body); }

.cond-text {
    color: var(--text-body);
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}
.cond-wrap.is-expanded .cond-text {
    -webkit-line-clamp: unset;
    display: block;
}
.cond-more {
    margin-top: 5px;
    padding: 2px 0;
    border: 0;
    background: none;
    color: var(--text-faint);
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: var(--border);
}
.cond-more:hover { color: var(--brand); text-decoration-color: currentColor; }

/* 카드 액션 */
.cc-actions {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--hairline);
    display: flex;
    gap: 10px;
    align-items: center;
}
.coupon-card.is-acquired .cc-actions { border-top-color: var(--success-border); }

.btn-acquire {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 44px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text-body);
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.btn-acquire .ico-check { opacity: 0.4; transition: opacity var(--dur); }
.btn-acquire:hover { border-color: #cbd1da; background: var(--bg-soft); }
.btn-acquire.is-acquired {
    background: var(--success-soft);
    border-color: var(--success-border);
    color: var(--success);
}
.btn-acquire.is-acquired .ico-check { opacity: 1; }
.btn-acquire.is-acquired:hover { background: #e3f4ea; border-color: #b3ddc6; }

.btn-out {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 44px;
    padding: 0 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text-body);
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    transition: background-color var(--dur), border-color var(--dur), color var(--dur);
}
.btn-out svg { opacity: 0.5; transition: opacity var(--dur); }
.btn-out:hover { border-color: #cbd1da; background: var(--bg-soft); color: var(--brand); }
.btn-out:hover svg { opacity: 1; }

/* ---- 빈 상태 ------------------------------------------------------------------------------ */

.empty-state {
    grid-column: 1 / -1;
    padding: 76px 24px;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-soft);
}
.empty-ico {
    width: 48px;
    height: 48px;
    margin: 0 auto 18px;
    border-radius: 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-faint);
    display: flex;
    align-items: center;
    justify-content: center;
}
.empty-title { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }
.empty-desc { margin-top: 8px; font-size: 14px; color: var(--text-sub); }
.empty-state .btn { margin-top: 22px; }

/* ---- 광고 배너 --------------------------------------------------------------------------------- */

.ad-section { margin-top: 60px; padding: 40px 0 52px; border-top: 1px solid var(--hairline); background: var(--bg-soft); }
.ad-label { font-size: 11.5px; font-weight: 600; color: var(--text-faint); margin-bottom: 12px; letter-spacing: 0.02em; }
.ad-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
}
.ad-grid[data-count="1"] { grid-template-columns: 1fr; max-width: 552px; }
.ad-item {
    display: block;
    aspect-ratio: 3 / 1;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--bg);
    box-shadow: var(--card-shadow);
    transition: box-shadow var(--dur), border-color var(--dur);
}
a.ad-item:hover { box-shadow: var(--card-shadow-hover); border-color: #d9dee6; }
.ad-item img { width: 100%; height: 100%; object-fit: cover; }

/* ---- 푸터 -------------------------------------------------------------------------------------- */

.site-footer { border-top: 1px solid var(--hairline); padding: 40px 0 48px; }
.footer-brand { font-size: 15px; font-weight: 800; letter-spacing: -0.02em; }
.footer-note { margin-top: 10px; font-size: 12.5px; line-height: 1.75; color: var(--text-faint); max-width: 560px; }
.footer-copy { margin-top: 14px; font-size: 12px; color: var(--text-faint); }

/* ---- 모달 / 드로어 -------------------------------------------------------------------------------- */

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(16, 20, 30, 0.46);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    transition: opacity var(--dur) var(--ease);
}
.modal-backdrop.is-open { opacity: 1; }
.modal {
    background: var(--bg);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 560px;
    max-height: calc(100vh - 48px);
    display: flex;
    flex-direction: column;
    box-shadow: var(--pop-shadow);
    transform: translateY(12px) scale(0.99);
    transition: transform var(--dur) var(--ease);
}
.modal-backdrop.is-open .modal { transform: translateY(0) scale(1); }
.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 24px 16px;
    border-bottom: 1px solid var(--hairline);
    flex-shrink: 0;
}
.modal-head h2 { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }
.modal-close {
    border: 0; background: none; color: var(--text-faint);
    padding: 10px; margin: -10px; border-radius: var(--radius-sm);
    display: inline-flex; transition: color var(--dur), background-color var(--dur);
}
.modal-close:hover { color: var(--text); background: var(--bg-soft); }
.modal form { display: flex; flex-direction: column; min-height: 0; }
.modal-body { padding: 20px 24px; overflow-y: auto; }
.modal-foot {
    display: flex; justify-content: flex-end; gap: 8px;
    padding: 14px 24px;
    border-top: 1px solid var(--hairline);
    flex-shrink: 0;
    background: var(--bg-soft);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ---- 폼 ------------------------------------------------------------------------------------------- */

.form-guide { font-size: 13px; color: var(--text-sub); margin-bottom: 18px; line-height: 1.6; }
.req-mark { color: var(--danger); font-weight: 700; }
.form-alert {
    background: var(--danger-soft); color: var(--danger);
    border: 1px solid #f4cbc8; border-radius: var(--radius-sm);
    font-size: 13px; padding: 11px 13px; margin-bottom: 18px;
}
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--text-body); margin-bottom: 7px; }
.field input, .field textarea {
    width: 100%; padding: 11px 13px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    font: inherit; font-size: 14px; color: var(--text); background: var(--bg);
    transition: border-color var(--dur), box-shadow var(--dur); min-height: 44px;
}
.field input::placeholder, .field textarea::placeholder { color: #b6bcc6; }
.field textarea { resize: vertical; min-height: 92px; line-height: 1.6; }
.field input:focus, .field textarea:focus {
    outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring);
}
.field input.is-invalid, .field textarea.is-invalid { border-color: var(--danger); }
.field input.is-invalid:focus, .field textarea.is-invalid:focus { box-shadow: 0 0 0 3px rgba(220, 58, 52, 0.12); }
.field-error { margin-top: 6px; font-size: 12.5px; color: var(--danger); }
.field-hint { margin-top: 6px; font-size: 12.5px; color: var(--text-faint); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.optional-fields { border-top: 1px solid var(--hairline); padding-top: 16px; margin-top: 6px; }
.optional-fields summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-sub); margin-bottom: 14px; list-style-position: inside; }
.optional-fields summary:hover { color: var(--text); }
.hp-field { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }

/* ---- 토스트 ------------------------------------------------------------------------------------------ */

.toast-root {
    position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
    z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center;
    pointer-events: none; padding: 0 16px; width: 100%; max-width: 440px;
}
.toast {
    display: inline-flex; align-items: center; gap: 8px;
    background: #202329; color: #fff; font-size: 13.5px; font-weight: 500;
    padding: 12px 20px; border-radius: 11px; box-shadow: var(--pop-shadow);
    opacity: 0; transform: translateY(8px);
    transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
    max-width: 100%; text-align: center;
}
.toast.is-show { opacity: 1; transform: translateY(0); }
.toast.is-success { background: #0d5c33; }
.toast.is-error { background: #8c2622; }

/* ---- 스켈레톤 (로딩 유틸리티) ------------------------------------------------------------------------- */

.skeleton {
    background: linear-gradient(90deg, #eef0f3 25%, #f6f7f9 50%, #eef0f3 75%);
    background-size: 400% 100%;
    animation: skeleton-wave 1.4s ease infinite;
    border-radius: 6px; color: transparent !important;
}
@keyframes skeleton-wave { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* ---- 오류 페이지 ---------------------------------------------------------------------------------------- */

.error-page { padding: 100px 0 120px; text-align: center; }
.error-code { font-size: 13px; font-weight: 700; color: var(--text-faint); letter-spacing: 0.08em; }
.error-title { margin-top: 10px; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.error-desc { margin-top: 8px; color: var(--text-sub); font-size: 14px; }
.error-page .btn { margin-top: 26px; }

/* ---- 반응형 --------------------------------------------------------------------------------------------- */

@media (max-width: 900px) {
    .coupon-grid { grid-template-columns: 1fr; }
}

@media (max-width: 767px) {
    :root { --header-h: 58px; }
    .container { padding: 0 18px; }

    .brand-tag { display: none; }
    .site-nav { display: none; }
    .header-cta { height: 38px; padding: 0 14px; font-size: 13.5px; }

    .page-header { padding: 32px 0 24px; }
    .page-header .container { flex-direction: column; align-items: stretch; gap: 22px; }
    .ph-title { font-size: 25px; }
    .ph-desc { font-size: 14.5px; }
    .ph-note { margin-top: 14px; }

    .ph-stats { align-self: stretch; }
    .ph-stat { flex: 1; padding: 14px 18px 12px; min-width: 0; }
    .ph-stat dd { font-size: 23px; }

    .list-toolbar { gap: 10px; }
    .list-caption { display: none; }

    .coupon-card { padding: 20px 18px 18px; border-radius: 16px; }

    .ad-section { margin-top: 44px; padding: 32px 0 40px; }
    .ad-grid { grid-template-columns: 1fr; gap: 14px; }
    .ad-grid[data-count="1"] { max-width: none; }

    /* 모달 → 하단 드로어 */
    .modal-backdrop { align-items: flex-end; padding: 0; }
    .modal {
        max-width: none; max-height: 94vh;
        border-radius: 20px 20px 0 0;
        transform: translateY(30px) scale(1);
    }
    .modal-backdrop.is-open .modal { transform: translateY(0); }
    .modal-foot { border-radius: 0; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
    .modal-foot .btn { flex: 1; height: 48px; }
    .field-row { grid-template-columns: 1fr; gap: 0; }

    .toast-root { bottom: 18px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
