/* Painto — modern theme */

:root {
    --bg: #f7f7fb;
    --surface: #ffffff;
    --text: #16161f;
    --text-muted: #6b7280;
    --border: #e7e7ef;
    --primary: #6c5ce7;
    --primary-dark: #5643d6;
    --accent: #ff6b9d;
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 10px;
    --shadow-sm: 0 2px 8px rgba(22, 22, 31, 0.05);
    --shadow-md: 0 12px 32px rgba(22, 22, 31, 0.08);
    --shadow-lg: 0 24px 60px rgba(22, 22, 31, 0.12);
    --header-h: 72px;
    --gradient: linear-gradient(120deg, var(--primary), var(--accent));
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #121218;
        --surface: #1b1b24;
        --text: #f2f2f6;
        --text-muted: #9a9aa8;
        --border: #2c2c38;
        --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
        --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.35);
        --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.45);
    }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Pretendard", "Apple SD Gothic Neo",
        "Malgun Gothic", "Noto Sans KR", sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }

a { color: inherit; text-decoration: none; }

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

/* ---------- Header ---------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-h);
    display: flex;
    align-items: center;
    background: color-mix(in srgb, var(--surface) 85%, transparent);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.nav-container {
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.logo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--gradient);
    color: #fff;
    font-size: 0.9rem;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-link {
    padding: 8px 16px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--text-muted);
    transition: background 0.2s ease, color 0.2s ease;
}

.nav-link:hover { color: var(--text); background: var(--border); }

.nav-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 1rem;
    cursor: pointer;
}

/* ---------- Hero ---------- */

.hero {
    position: relative;
    overflow: hidden;
    padding: 96px 24px 88px;
    text-align: center;
    isolation: isolate;
    scroll-margin-top: var(--header-h);
}

.hero::before,
.hero::after {
    content: "";
    position: absolute;
    width: 480px;
    height: 480px;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.25;
    z-index: -1;
}

.hero::before {
    background: var(--primary);
    top: -220px;
    left: -160px;
}

.hero::after {
    background: var(--accent);
    top: -180px;
    right: -180px;
}

.hero-inner {
    max-width: 720px;
    margin: 0 auto;
}

.eyebrow {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 0.03em;
    margin-bottom: 20px;
}

.hero h1 {
    font-size: clamp(2rem, 5vw, 3.1rem);
    line-height: 1.25;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0 0 20px;
}

.text-gradient {
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero-sub {
    color: var(--text-muted);
    font-size: 1.05rem;
    margin: 0 auto 32px;
    max-width: 520px;
}

.hero-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 13px 26px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.95rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn:hover { transform: translateY(-2px); }

.btn-primary {
    background: var(--gradient);
    color: #fff;
    box-shadow: var(--shadow-md);
}

.btn-ghost {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border);
}

.btn-ghost:hover { background: var(--border); }

/* ---------- Sections ---------- */

.section { padding: 88px 24px; scroll-margin-top: var(--header-h); }

.section-alt { background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

.section-inner { max-width: 1120px; margin: 0 auto; }

.section-inner.narrow { max-width: 720px; }

.section-heading { text-align: center; margin-bottom: 48px; }

.section-tag {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.section-heading h2 {
    font-size: clamp(1.5rem, 3vw, 2.1rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0;
}

.section-desc {
    color: var(--text-muted);
    text-align: center;
    max-width: 640px;
    margin: 0 auto;
}

.pull-quote {
    text-align: center;
    font-size: 1.2rem;
    font-weight: 700;
    margin: 48px auto 16px;
    max-width: 640px;
}

/* ---------- Steps grid ---------- */

.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.step-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.step-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }

.step-card.featured {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    align-items: center;
    gap: 32px;
    padding: 32px;
}

.step-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--gradient);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 800;
    margin-bottom: 14px;
}

.step-card h3 {
    font-size: 0.98rem;
    font-weight: 700;
    margin: 0 0 14px;
}

.step-card img {
    width: 100%;
    border-radius: var(--radius-md);
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.step-card.featured img {
    max-height: 280px;
    aspect-ratio: auto;
    object-fit: cover;
}

.step-card.featured .step-copy p {
    color: var(--text-muted);
    margin: 12px 0 0;
}

/* ---------- Upload / preview cards ---------- */

.preview-card {
    display: block;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    margin-bottom: 28px;
    border: 1px solid var(--border);
    background: var(--bg);
}

/* object-fit: cover였을 때는 세로로 긴 사진을 올리면 4:3 박스에 맞추려고
   위아래를 잘라내 얼굴이나 다리가 잘려 보이는 문제가 있었다. 사진 전체가
   보이도록 contain으로 바꾸고, 남는 여백은 배경색으로 채운다. */
.preview-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; }

.upload-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-sm);
}

.dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
    padding: 40px 20px;
    border-radius: var(--radius-md);
    border: 2px dashed var(--border);
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.dropzone:hover {
    border-color: var(--primary);
    background: color-mix(in srgb, var(--primary) 6%, transparent);
}

.dropzone-icon {
    width: 52px;
    height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--gradient);
    color: #fff;
    font-size: 1.3rem;
    margin-bottom: 6px;
}

.dropzone-title { font-weight: 700; font-size: 1rem; }

.dropzone-sub { color: var(--text-muted); font-size: 0.85rem; }

/* FE2-02 (사이클 2) — 기본값을 다시 display:none 으로 되돌린다.
   사이클 1 은 이 값을 block 으로 바꾸고 JS 에서 style.display 를 전부 제거해
   "표시 경로가 새 CSS 하나"에 걸리게 만들었다(F1). 사이클 2 의 JS 는
   hidden 속성과 인라인 style.display 를 함께 쓰므로 기본값은 다시 닫혀 있어야 한다.
   이유 두 가지:
     1) 인라인 style 은 !important 아닌 스타일시트 선언을 항상 이기므로,
        낡은 CSS(.progress-wrapper{display:none}) 에서도 진행 박스가 열린다.
     2) 부분 롤백(새 CSS + 옛 JS, AC-D5)에서 기본값이 block 이면 진행 박스가
        업로드 전부터 상시 노출되는 역방향 결함이 생긴다.
   같은 규칙이 index.html <head> 크리티컬 CSS 에도 있다. */
.progress-wrapper { display: none; margin-top: 24px; }
.progress-wrapper[hidden] { display: none !important; }

.progress-track {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: var(--border);
    overflow: hidden;
}

.progress-fill {
    width: 0%;
    height: 100%;
    background: var(--gradient);
    border-radius: 999px;
    transition: width 0.3s ease;
}

.progress-text {
    margin: 10px 0 0;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--primary);
    text-align: center;
}

/* ---------- Result / Painting ---------- */

/* 업로드하는 사진마다 가로세로 비율이 제각각이라 width:100%; height:auto로만
   두면 세로 사진에서 카드가 화면 몇 배 높이로 늘어나 버린다. Pictures
   섹션의 미리보기 카드와 같은 비율로 고정하되, 최종 결과물은 잘리면 안 되니
   object-fit은 cover 대신 contain을 써서 레터박스로 보여준다.
   아직 생성된 결과가 없을 때는 img 대신 .result-empty 안내를 보여주는데,
   어느 쪽이 보이든 카드 크기가 흔들리지 않도록 비율을 img가 아니라
   카드(.result-card) 자체에 고정한다. */
.result-card {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 4 / 3;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    margin-bottom: 24px;
    background: var(--bg);
}

.result-card img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* ---------- Before/After 비교 슬라이더 ----------
   반투명 오버레이로 두 이미지를 겹치는 대신, "원본" 이미지를 도안 이미지
   위에 그대로 쌓아두고 clip-path로 왼쪽 일부만 보이게 잘라낸다. 두 이미지
   모두 같은 상자(.compare-slider) 기준으로 object-fit: contain이 적용되기
   때문에 슬라이더를 움직여도 확대/축소 배율이 어긋나지 않는다. */
.compare-slider {
    position: relative;
    width: 100%;
    height: 100%;
    cursor: ew-resize;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}

.compare-slider.is-single {
    cursor: default;
}

.compare-img {
    position: absolute;
    inset: 0;
    pointer-events: none;
    -webkit-user-drag: none;
}

.compare-img-after {
    z-index: 1;
}

.compare-img-before {
    z-index: 2;
    clip-path: inset(0 50% 0 0);
    will-change: clip-path;
}

.compare-slider.is-single .compare-img-before,
.compare-slider.is-single .compare-slider-handle,
.compare-slider.is-single .compare-label {
    display: none;
}

.compare-slider-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 0;
    z-index: 3;
    pointer-events: none;
}

.compare-slider-handle::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 3px;
    margin-left: -1.5px;
    background: #fff;
    box-shadow: 0 0 0 1px rgba(22, 22, 31, 0.18);
}

.compare-slider-handle-grip {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #fff;
    color: var(--primary);
    box-shadow: var(--shadow-lg);
    pointer-events: auto;
    cursor: ew-resize;
}

.compare-label {
    position: absolute;
    top: 12px;
    z-index: 3;
    padding: 4px 10px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #fff;
    background: rgba(22, 22, 31, 0.55);
    border-radius: 999px;
    pointer-events: none;
}

.compare-label-before { left: 12px; }
.compare-label-after { right: 12px; }

.compare-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: -12px 0 20px;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
}

.result-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 24px;
    text-align: center;
    color: var(--text-muted);
}

.result-empty-icon {
    width: 56px;
    height: 56px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--border);
    font-size: 1.4rem;
    margin-bottom: 6px;
}

.result-empty-title { font-weight: 700; color: var(--text); }

.result-empty-sub { font-size: 0.85rem; }

.result-hint {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 28px;
}

.result-hint i { color: var(--accent); margin-right: 6px; }

/* 결과 카드 옆에 노출하는 팔레트(사용 색상 수 + 스와치) 미리보기.
   결제 전에도 "몇 가지 물감이 필요한지"를 바로 체감할 수 있게 해준다. */
.palette-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 18px 20px;
    margin-bottom: 24px;
}

.palette-summary {
    margin: 0 0 12px;
    font-weight: 700;
    color: var(--text);
}

.palette-summary i { color: var(--accent); margin-right: 6px; }

.palette-summary strong { color: var(--primary); }

.palette-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.palette-swatch {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px 4px 4px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg);
}

.palette-swatch-color {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.palette-swatch-hex {
    font-size: 0.72rem;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

/* 업로드 전 등급(BASIC/STANDARD/PREMIUM) 선택 패널. 라디오 버튼 하나만
   선택 가능하며, 선택된 tier가 그대로 /upload의 FormData와 #Payment의
   주문 요약/결제 금액에 쓰인다(docs/pricing-tiers.md 8~10장). */
.tier-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 18px 20px;
    margin-bottom: 24px;
}

.tier-panel-title {
    margin: 0 0 16px;
    font-weight: 700;
    color: var(--text);
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px;
}

.tier-panel-title i { color: var(--accent); }

.tier-panel-note {
    font-weight: 400;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.tier-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
}

.tier-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
}

/* 선택 가능한 카드(라디오 래핑용) 전용 보강 스타일. 기존 .tier-card는
   장식용 그대로 두고, 클릭 가능한 버전에서만 커서/포커스/선택 표시를 얹는다. */
.tier-card.tier-card-selectable {
    cursor: pointer;
    user-select: none;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.tier-card.tier-card-selectable:hover {
    border-color: var(--primary);
}

.tier-card.tier-card-selectable:has(.tier-radio:focus-visible) {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.tier-card.tier-card-selectable.is-selected {
    border-color: var(--primary);
    background: color-mix(in srgb, var(--primary) 8%, var(--bg));
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 30%, transparent);
}

.tier-card.tier-card-selectable.is-selected .tier-name {
    color: var(--primary-dark);
}

.tier-card-check {
    align-self: flex-end;
    font-size: 0.85rem;
    color: var(--primary);
    visibility: hidden;
}

.tier-card.tier-card-selectable.is-selected .tier-card-check {
    visibility: visible;
}

.tier-name {
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--primary);
    font-size: 0.85rem;
}

.tier-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
}

.tier-colors {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.tier-desc {
    margin: 6px 0 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* ---------- Form ---------- */

.modern-form {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-sm);
}

.order-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
}

.btn-block {
    width: 100%;
    justify-content: center;
    margin-top: 20px;
    border: none;
    font: inherit;
    cursor: pointer;
}

.pay-method-list { display: flex; flex-direction: column; gap: 10px; }

.pay-method-list .btn-block { margin-top: 0; }

.pay-method-btn { background: var(--bg); color: var(--text); border: 1px solid var(--border) !important; }

.pay-method-btn:hover { background: var(--border); }

.pay-method-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--bg) !important;
}

.pay-method-btn:disabled:hover { background: var(--bg) !important; }

.pay-method-kakao { background: #fee500 !important; color: #191919 !important; }

.pay-method-note {
    margin: 14px 0 0;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.form-field { display: flex; flex-direction: column; gap: 6px; }

.form-field.full { grid-column: 1 / -1; }

.form-field label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
}

.form-field input,
.form-field textarea {
    font: inherit;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-field input:focus,
.form-field textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 4px;
    list-style: none;
    padding: 0;
}

.form-actions input[type="submit"],
.form-actions input[type="reset"] {
    font: inherit;
    font-weight: 700;
    padding: 12px 24px;
    border-radius: 999px;
    border: 1px solid transparent;
    cursor: pointer;
}

.form-actions input[type="submit"] {
    background: var(--gradient);
    color: #fff;
    box-shadow: var(--shadow-md);
}

.form-actions input[type="reset"] {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
}

/* ---------- Footer ---------- */

.site-footer {
    padding: 32px 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
}

/* ---------- Responsive ---------- */

@media (max-width: 760px) {
    .site-nav {
        position: absolute;
        top: var(--header-h);
        left: 0;
        right: 0;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        align-items: stretch;
        padding: 8px 16px 16px;
        gap: 2px;
        display: none;
        box-shadow: var(--shadow-md);
    }

    .site-nav.is-open { display: flex; }

    .nav-link { padding: 12px 14px; border-radius: var(--radius-sm); }

    .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }

    .step-card.featured {
        grid-template-columns: 1fr;
    }

    .form-row { grid-template-columns: 1fr; }
}

/* ---------- Payment result page (payment_result.html) ---------- */

.result-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.result-page-card {
    max-width: 420px;
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px 32px;
    text-align: center;
}

.result-page-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    font-size: 2rem;
    margin-bottom: 20px;
}

.result-page-icon-success { background: color-mix(in srgb, var(--primary) 15%, transparent); color: var(--primary); }

.result-page-icon-fail { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); }

.result-page-card h1 {
    font-size: 1.3rem;
    font-weight: 800;
    margin: 0 0 12px;
}

.result-page-sub {
    color: var(--text-muted);
    margin: 0 0 28px;
    line-height: 1.6;
}

/* ---------- Auth pages (login.html / signup.html) ---------- */

.auth-page {
    min-height: calc(100vh - var(--header-h));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-card {
    max-width: 420px;
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px 32px;
}

.auth-card h1 {
    font-size: 1.4rem;
    font-weight: 800;
    margin: 0 0 28px;
    text-align: center;
}

.auth-card .form-field {
    margin-bottom: 18px;
}

.auth-card .btn {
    width: 100%;
    justify-content: center;
    margin-top: 8px;
}

.auth-flash {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.auth-flash-error {
    background: color-mix(in srgb, var(--accent) 15%, transparent);
    color: var(--accent);
}

.auth-flash-success {
    background: color-mix(in srgb, var(--primary) 15%, transparent);
    color: var(--primary);
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.auth-footer a {
    color: var(--primary);
    font-weight: 700;
}


/* ---------- 진행 오류 배너 (FE-04) ---------- */

/* alert() 은 블로킹이라 폴링 타이머와 경쟁하고, 백그라운드 탭/모바일에서는
   억제되기도 한다. 오류는 화면 안에서 계속 보이는 비블로킹 배너로 알린다. */
.progress-error {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    color: var(--accent);
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.5;
    text-align: left;
}

.progress-error[hidden] { display: none !important; }

.progress-error-icon { flex: 0 0 auto; margin-top: 2px; }

.progress-error-text { flex: 1 1 auto; min-width: 0; word-break: break-word; }

/* ---------- 완료 모달 (FE-03 / ADR-3) ---------- */

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(12, 12, 20, 0.55);
    backdrop-filter: blur(3px);
}

.modal-overlay[hidden] { display: none !important; }

.modal-card {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 28px 24px 24px;
    text-align: center;
}

.modal-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--gradient);
    color: #fff;
    font-size: 1.5rem;
}

.modal-title {
    margin: 0 0 10px;
    font-size: 1.15rem;
    font-weight: 800;
}

.modal-body {
    margin: 0 0 22px;
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.6;
    word-break: keep-all;
}

.modal-card .btn { width: 100%; justify-content: center; }

/* 모달이 열려 있는 동안 뒤 배경이 스크롤되지 않게 한다. */
body.is-modal-open { overflow: hidden; }

/* 관리자 전용 네비 링크 (FE-09) — 관리자에게만 렌더된다. */
.nav-link-admin {
    color: var(--primary);
    font-weight: 800;
}

/* ---------- 정가/할인가 2단 노출 (지시 #02) ---------- */

/* 등급 카드 안에서 [할인율 배지] [정가(취소선)] / [할인가] 를 쌓는다.
   400px 폭에서도 줄이 겹치거나 카드를 넘치지 않도록 wrap 을 허용하고
   숫자는 줄바꿈되지 않게 nowrap 으로 묶는다. */
.tier-price-block {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 8px;
    min-width: 0;
}

.tier-price-list {
    order: 2;
    flex: 0 0 auto;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration-line: line-through;
    text-decoration-thickness: 1.5px;
    text-decoration-color: color-mix(in srgb, var(--text-muted) 70%, transparent);
    white-space: nowrap;
}

.tier-price-sale {
    order: 3;
    flex: 0 0 auto;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary-dark);
    letter-spacing: -0.02em;
    white-space: nowrap;
}

/* 취소선/색상만으로 정가·할인가를 구분하지 않는다. 마크업은 <s> 이고
   화면낭독기용 "정가"/"할인가" 레이블이 .sr-only 로 함께 들어 있다. */
.tier-discount-badge {
    order: 1;
    flex: 0 0 auto;
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1.5;
    white-space: nowrap;
}

.tier-card.tier-card-selectable.is-selected .tier-price-sale { color: var(--primary-dark); }

/* 주문 요약의 금액 영역도 같은 구조로 그린다(JS 의 renderOrderPrice). */
#order-summary-price {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: flex-end;
    gap: 4px 8px;
    min-width: 0;
    text-align: right;
}

#order-summary-price .tier-price-list { font-size: 0.82rem; }

#order-summary-price .tier-price-sale { font-size: 1.15rem; }

@media (max-width: 420px) {
    .tier-price-sale { font-size: 1.12rem; }
    .tier-price-list { font-size: 0.8rem; }
    .tier-discount-badge { font-size: 0.68rem; padding: 1px 7px; }
    /* 배지 + 정가를 한 줄, 할인가를 다음 줄로 내려 세 요소가 겹치지 않게 한다. */
    .tier-price-block { row-gap: 2px; }
    .tier-price-sale { flex-basis: 100%; }
    #order-summary-price .tier-price-sale { flex-basis: auto; }
}

/* ==========================================================================
   T2-C / F3-07 — prefers-reduced-motion 전면 대응 (사이클 3)
   시스템이 "동작 줄이기"면 transition/animation/부드러운 스크롤을 전부 끈다.
   - 진행률 바(.progress-fill)의 width 전환도 함께 꺼진다 — 의도된 동작이다.
     진행률은 숫자 텍스트와 aria-valuenow 로 전달되므로 정보 손실이 없다.
   - #completion-modal 의 스크롤 잠금(body.is-modal-open)은 애니메이션이 아니라 유지된다.
   - 열화 허용(배송 AC D-2): 낡은 CSS 가 쓰이면 이 규칙이 적용되지 않을 뿐,
     화면이 깨지지 않는다. 같은 규칙의 최소판을 index.html <head> 크리티컬 블록에도 둔다(D-3).
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ==========================================================================
   T2-D / F3-08 — 비교 슬라이더 키보드 조작 (WCAG 2.2 SC 2.5.7 / 2.4.7)
   핸들은 width:0 이라 그 자체의 아웃라인만으로는 눈에 잘 안 띈다.
   실제로 잡는 부분인 40x40 그립(SC 2.5.8 타깃 크기 24px 이상 충족)에도 링을 그린다.
   최소 규칙은 index.html <head> 크리티컬 CSS 에도 중복해 둔다(배송 AC-D-08b).
   ========================================================================== */
.compare-slider-handle:focus-visible {
    outline: 3px solid var(--primary, #6c5ce7);
    outline-offset: 2px;
}

.compare-slider-handle:focus-visible .compare-slider-handle-grip {
    outline: 3px solid var(--primary, #6c5ce7);
    outline-offset: 3px;
}

/* 마우스 클릭으로 들어온 포커스에는 링을 그리지 않는다(기존 드래그 경험 유지). */
.compare-slider-handle:focus:not(:focus-visible) {
    outline: none;
}

/* AC-D-08c — sticky 헤더에 포커스가 가려지지 않게 한다. */
.compare-slider-handle {
    scroll-margin-top: calc(var(--header-h, 72px) + 16px);
}

/* ==========================================================================
   사이클 4 (T4-B1 ~ T4-B4)
   ⚠️ 이 파일은 재방문자에게 최대 6일간 낡은 버전이 배송될 수 있다(F1).
      그래서 아래 규칙들의 "최소 형태"는 index.html <head> 크리티컬 CSS 에도 같이 있다.
      둘 중 하나만 두지 않는다 — 여기 있는 것은 완전한 형태, 저기 있는 것은 생존용 최소 형태다.
   ========================================================================== */

/* T4-B2 / F3-13 — 다크 모드 토큰 (배송 AC-D-13).
   위쪽 @media (prefers-color-scheme: dark) 블록은 한 줄도 건드리지 않았다.
   대신 [data-theme] 오버라이드를 더해서
     - data-theme 없음  -> 기존 미디어쿼리(= 시스템 설정)
     - data-theme=dark  -> 항상 다크
     - data-theme=light -> 항상 라이트 (셀렉터 특정성 0,2,0 이 미디어쿼리 안의 :root 를 이긴다)
   3상태가 성립한다. */
:root[data-theme="dark"] {
    --bg: #121218;
    --surface: #1b1b24;
    --text: #f2f2f6;
    --text-muted: #9a9aa8;
    --border: #2c2c38;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.45);
}

:root[data-theme="light"] {
    --bg: #f7f7fb;
    --surface: #ffffff;
    --text: #16161f;
    --text-muted: #6b7280;
    --border: #e7e7ef;
    --shadow-sm: 0 2px 8px rgba(22, 22, 31, 0.05);
    --shadow-md: 0 12px 32px rgba(22, 22, 31, 0.08);
    --shadow-lg: 0 24px 60px rgba(22, 22, 31, 0.12);
}

/* 다크에서 텍스트 대비 확보 (AC-13-5).
   --text #f2f2f6 on --surface #1b1b24 = 약 15:1, --text-muted #9a9aa8 on #1b1b24 = 약 7:1.
   등급 카드의 정가 취소선/할인 배지는 아래에서 따로 보정한다. */
:root[data-theme="dark"] .tier-price-list,
:root[data-theme="dark"] .palette-swatch-hex {
    color: var(--text-muted);
}

/* ===========================================================================
   T5-B3 — WCAG 2.2 AA 1.4.3 (본문 텍스트 4.5:1) 실측 보정.
   사이클 5 에서 처음으로 대비비를 실제로 계산했다(이전 사이클은 미검증).

   문제: --primary #6c5ce7 를 글자색으로 쓰는 곳이 다크 배경에서 AA 미달이다.
       #6c5ce7 on --surface #1b1b24 = 3.52:1   (기준 4.5)  FAIL
       #6c5ce7 on --bg      #121218 = 3.84:1   (기준 4.5)  FAIL
   ⚠ --primary 토큰 자체를 밝힐 수 없다: --primary 는 버튼 배경으로도 쓰이고,
       밝히면 흰 글자 대비가 4.86:1 -> 3.79:1 로 내려가 반대쪽이 깨진다.
       (같은 hue 에서 양쪽을 동시에 만족하는 값은 존재하지 않음 — 전수 탐색으로 확인)
   따라서 "글자로 쓰이는 선택자에만" 밝은 값을 건다. 버튼 배경은 그대로 둔다.
       #8174e3 on --surface #1b1b24 = 4.51:1   PASS
       #8174e3 on --bg      #121218 = 4.92:1   PASS
   다크 토큰 5종(--bg/--surface/--text/--text-muted/--border)은 한 줄도 건드리지 않았다.
   =========================================================================== */
:root[data-theme="dark"] {
    --primary-text: #8174e3;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --primary-text: #8174e3;
    }
}

:root[data-theme="dark"] .eyebrow,
:root[data-theme="dark"] .section-tag,
:root[data-theme="dark"] .progress-text,
:root[data-theme="dark"] .compare-slider-handle-grip,
:root[data-theme="dark"] .palette-summary strong,
:root[data-theme="dark"] .tier-card-check,
:root[data-theme="dark"] .tier-name,
:root[data-theme="dark"] .result-page-icon-success,
:root[data-theme="dark"] .auth-flash-success,
:root[data-theme="dark"] .auth-footer a,
:root[data-theme="dark"] .nav-link-admin,
:root[data-theme="dark"] .stat-label i,
:root[data-theme="dark"] .admin-details summary,
:root[data-theme="dark"] .admin-range-btn:hover {
    color: var(--primary-text);
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .eyebrow,
    :root:not([data-theme="light"]) .section-tag,
    :root:not([data-theme="light"]) .progress-text,
    :root:not([data-theme="light"]) .compare-slider-handle-grip,
    :root:not([data-theme="light"]) .palette-summary strong,
    :root:not([data-theme="light"]) .tier-card-check,
    :root:not([data-theme="light"]) .tier-name,
    :root:not([data-theme="light"]) .result-page-icon-success,
    :root:not([data-theme="light"]) .auth-flash-success,
    :root:not([data-theme="light"]) .auth-footer a,
    :root:not([data-theme="light"]) .nav-link-admin,
    :root:not([data-theme="light"]) .stat-label i,
    :root:not([data-theme="light"]) .admin-details summary,
    :root:not([data-theme="light"]) .admin-range-btn:hover {
        color: var(--primary-text);
    }
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    margin-left: 4px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-size: 0.95rem;
    line-height: 1;
    transition: border-color 0.2s ease, background 0.2s ease;
}
.theme-toggle:hover { border-color: var(--primary); }
.theme-toggle:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.theme-toggle .theme-toggle-dark { display: none; }
:root[data-theme="dark"] .theme-toggle .theme-toggle-dark { display: inline; }
:root[data-theme="dark"] .theme-toggle .theme-toggle-light { display: none; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle .theme-toggle-dark { display: inline; }
    :root:not([data-theme="light"]) .theme-toggle .theme-toggle-light { display: none; }
}

/* T4-B3 / F3-11 — 진행 5단계 스테퍼 (배송 AC-D-11).
   JS 는 getComputedStyle(...).display === 'flex' 일 때만 스테퍼를 렌더한다.
   즉 이 규칙(또는 크리티컬 CSS 의 동일 규칙)이 도달하지 못하면 스테퍼는 아예 나오지 않는다. */
.progress-steps {
    display: flex;
    gap: 6px;
    margin: 14px 0 0;
    padding: 0;
    list-style: none;
}
.progress-step {
    flex: 1 1 0;
    min-width: 0;
    text-align: center;
    font-size: 0.72rem;
    line-height: 1.3;
    color: var(--text-muted);
}
.progress-step-dot {
    display: block;
    height: 4px;
    margin: 0 0 6px;
    border-radius: 999px;
    background: var(--border);
    transition: background 0.25s ease;
}
.progress-step.is-done .progress-step-dot { background: var(--primary); }
.progress-step.is-current .progress-step-dot { background: var(--gradient, var(--primary)); }
.progress-step.is-current { color: var(--text); font-weight: 700; }
.progress-step-label {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
@media (max-width: 400px) {
    .progress-steps { gap: 4px; }
    .progress-step { font-size: 0.64rem; }
}

/* T4-B1 / F3-12 — 드래그 오버 상태. 이 규칙이 없어도 드롭 자체는 동작한다(AC-D-12). */
.dropzone.is-dragover {
    border-color: var(--primary);
    background: var(--bg);
}

/* T4-B5 / F3-15 — 팔레트 스와치 <button> 승격 리셋 + 복사 토스트.
   같은 최소 규칙이 index.html 크리티컬 CSS 에도 있다(낡은 CSS 대비). */
.palette-swatch {
    background: transparent;
    border: 0;
    padding: 0;
    margin: 0;
    font: inherit;
    color: inherit;
    cursor: pointer;
    text-align: center;
    min-width: 24px;
    min-height: 24px;   /* WCAG 2.2 SC 2.5.8 타깃 크기 */
}
.palette-swatch:hover .palette-swatch-color { transform: scale(1.08); }
.palette-swatch:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.palette-swatch-color { transition: transform 0.15s ease; }

.toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    z-index: 300;
    max-width: 90vw;
    padding: 10px 16px;
    border-radius: 999px;
    background: var(--text);
    color: var(--bg);
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
}
