@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css");
@import url("https://fonts.googleapis.com/css2?family=Noto+Serif+KR:wght@300;400;500;600;700;900&display=swap");

/* 로고(信)용 포인트 폰트 */
@font-face {
    font-family: 'MaruBuri';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_20-10-21@1.0/MaruBuri-Regular.woff') format('woff');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* ============================================================
   1. 디자인 토큰 — "格" (기본): 묵향 에디토리얼
   ============================================================ */
:root {
    /* Paper & Ink */
    --paper:           #F4F1EA;   /* 종이 베이지 */
    --paper-soft:      #ECE7DC;   /* 옅은 종이 */
    --paper-deep:      #E5DFD2;   /* 짙은 종이 */
    --card:            #FBF9F4;   /* 카드 (한 톤 밝은 종이) */
    --ink:             #14110D;   /* 진한 먹 */
    --ink-soft:        #3A352D;   /* 부드러운 먹 */
    --ink-mute:        #6B6358;   /* 옅은 먹 */
    --ink-light:       #9A8F80;   /* 가장 옅은 먹 */
    --rule:            #C9C0AE;   /* 罫線 (괘선) */
    --rule-soft:       #DDD5C2;
    
    /* Accent — 인주(印朱) 버건디 */
    --accent:          #8B2520;   /* 인주색 */
    --accent-deep:     #6B1C18;
    --accent-soft:     #C77A75;
    --accent-tint:     #F5E8E6;

    /* States */
    --success:         #4A6B3A;
    --danger:          #8B2520;
    --warning:         #946A1F;

    /* Type */
    --font-sans: 'Pretendard', -apple-system, sans-serif;
    --font-serif: 'Noto Serif KR', 'MaruBuri', serif;

    /* Geometry */
    --radius-xs: 2px;
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --transition: all 0.25s cubic-bezier(0.2, 0.7, 0.2, 1);
    --shadow-card: 0 1px 0 rgba(20, 17, 13, 0.04), 0 8px 24px -12px rgba(20, 17, 13, 0.10);
    --shadow-focus: 0 0 0 3px rgba(139, 37, 32, 0.15);
}

/* ============================================================
   THEME — 靜 (정): 미드나잇 모노크롬 + 골드
   ============================================================ */
body[data-theme="midnight"] {
    --paper:           #14171C;
    --paper-soft:      #1B1F26;
    --paper-deep:      #232831;
    --card:            #1A1E25;
    --ink:             #EDE8DA;
    --ink-soft:        #C5BFAF;
    --ink-mute:        #8B8676;
    --ink-light:       #5C5849;
    --rule:            #2E333D;
    --rule-soft:       #252A33;
    --accent:          #C8A256;
    --accent-deep:     #A88240;
    --accent-soft:     #D9BC7E;
    --accent-tint:     #2A241A;
    --success:         #88B070;
    --danger:          #D67268;
    --warning:         #D9B266;
    --shadow-card: 0 1px 0 rgba(0,0,0,0.3), 0 12px 32px -16px rgba(0,0,0,0.5);
    --shadow-focus: 0 0 0 3px rgba(200, 162, 86, 0.18);
}

/* ============================================================
   THEME — 白 (백): 화이트 헤리티지 + 네이비
   ============================================================ */
body[data-theme="white"] {
    --paper:           #FAFAF8;
    --paper-soft:      #F2F2EE;
    --paper-deep:      #E8E8E2;
    --card:            #FFFFFF;
    --ink:             #0F1A2E;
    --ink-soft:        #2C3A55;
    --ink-mute:        #5C6884;
    --ink-light:       #97A0B4;
    --rule:            #D4D6DD;
    --rule-soft:       #E5E6EB;
    --accent:          #1B2A4A;
    --accent-deep:     #0F1A2E;
    --accent-soft:     #4A5A7A;
    --accent-tint:     #ECEEF4;
}

/* ============================================================
   2. 리셋 & 기본
   ============================================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: var(--font-sans);
    background-color: var(--paper);
    color: var(--ink);
    line-height: 1.7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    letter-spacing: -0.005em;
    /* 옅은 종이 결 텍스처 */
    background-image:
        radial-gradient(ellipse at top right, color-mix(in oklab, var(--accent) 4%, transparent), transparent 60%),
        repeating-linear-gradient(0deg,
            transparent 0px,
            transparent 2px,
            color-mix(in oklab, var(--ink) 1.5%, transparent) 2px,
            color-mix(in oklab, var(--ink) 1.5%, transparent) 3px);
    background-attachment: fixed;
}

::selection { background: var(--accent); color: var(--card); }

/* ============================================================
   3. 헤더 — 신문 사두(社頭) 스타일
   ============================================================ */
.header {
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
    background: color-mix(in oklab, var(--paper) 88%, transparent);
}

.header::after {
    content: '';
    display: block;
    height: 1px;
    background: var(--ink);
    opacity: 0.15;
    margin-top: -1px;
}

.header-container {
    max-width: 1040px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 68px;
    position: relative;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    text-decoration: none;
    transition: var(--transition);
}

.header-left::before {
    content: '';
    width: 36px;
    height: 36px;
    background: var(--ink);
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background-image:
        linear-gradient(135deg, color-mix(in oklab, var(--ink) 100%, transparent) 0%, color-mix(in oklab, var(--ink) 88%, transparent) 100%);
    box-shadow: 0 2px 4px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.06);
    /* 信 글자는 ::after 로 */
    position: relative;
}

.header-left .main-info {
    display: flex;
    flex-direction: column;
    gap: 0;
    line-height: 1.2;
}

.header-left strong:first-of-type {
    font-family: var(--font-serif);
    font-size: 1rem;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: -0.01em;
}

.header-left strong:last-of-type {
    font-family: var(--font-sans) !important;
    font-size: 0.7rem !important;
    font-weight: 500 !important;
    color: var(--ink-mute);
    letter-spacing: 0.04em;
    top: 0 !important;
    margin-top: 2px;
}

.header-left .website-info {
    display: none; /* 메인 정보로 통합 */
}

/* 信 도장 — 헤더 좌측 */
.header-container::before {
    content: '信';
    position: absolute;
    left: 2rem;
    top: 50%;
    transform: translateY(-50%);
    font-family: var(--font-serif);
    font-weight: 700;
    font-size: 22px;
    color: var(--card);
    background: var(--ink);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    z-index: 1;
    pointer-events: none;
}

.header-left::before { display: none; } /* 위 ::before 사용 */
.header-left { padding-left: 48px; }

.browser-tip {
    background: transparent;
    border: 1px solid var(--rule);
    color: var(--ink-mute);
    width: 36px;
    height: 36px;
    padding: 0;
    cursor: pointer;
    border-radius: 50%;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

.browser-tip:hover {
    background: var(--ink);
    color: var(--paper);
    border-color: var(--ink);
}

/* 信 서예체 (인라인) */
.shin-calligraphy-small {
    font-family: var(--font-serif) !important;
    font-size: 1.05em;
    font-weight: 500;
    display: inline-block;
    color: var(--accent);
    margin: 0 0.05em;
    line-height: 1;
    vertical-align: baseline;
    background: none;
    -webkit-text-fill-color: initial;
}

/* ============================================================
   4. 메인 컨텐츠 — 에디토리얼 그리드
   ============================================================ */
.main-content {
    flex: 1;
    max-width: 1040px;
    width: 100%;
    margin: 0 auto;
    padding: 4rem 2rem 6rem;
    position: relative;
}

/* 信 큰 워터마크 */
.main-content::before {
    content: '信';
    position: absolute;
    top: 1rem;
    right: -1rem;
    font-family: var(--font-serif);
    font-weight: 300;
    font-size: 16rem;
    color: var(--ink);
    opacity: 0.025;
    pointer-events: none;
    z-index: 0;
    line-height: 1;
    user-select: none;
}

body[data-theme="midnight"] .main-content::before {
    opacity: 0.05;
    color: var(--accent);
}

/* ============================================================
   5. 페이지 헤더 — 에디토리얼 타이틀
   ============================================================ */
.page-header {
    text-align: left;
    background: transparent;
    border: none;
    padding: 0 0 3rem;
    margin-bottom: 3rem;
    border-bottom: 1px solid var(--rule);
    position: relative;
    z-index: 1;
}

.page-header::before { display: none; }

/* 작은 카테고리 라벨 */
.page-header::after {
    content: 'LEGAL · DIGITAL SERVICE / 법무 디지털 서비스';
    display: block;
    font-family: var(--font-sans);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    color: var(--accent);
    margin-bottom: 1.5rem;
    text-transform: uppercase;
}

.page-title {
    font-family: var(--font-serif);
    font-size: clamp(2.25rem, 4vw, 3.25rem);
    font-weight: 700;
    color: var(--ink);
    display: block;
    margin-bottom: 1rem;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.page-icon {
    display: none; /* 에디토리얼에서는 아이콘 제거 */
}

.page-description {
    font-size: 1.05rem;
    color: var(--ink-mute);
    line-height: 1.7;
    max-width: 560px;
    font-weight: 400;
}

.page-description br { display: none; }

/* ============================================================
   6. 카드 (입력·결과 공통)
   ============================================================ */
.service-content {
    background: var(--card);
    padding: 3rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--rule);
    box-shadow: var(--shadow-card);
    position: relative;
    z-index: 1;
}

.service-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--ink);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

body[data-theme="white"] .service-content::before {
    background: var(--accent);
}

.section-header {
    font-family: var(--font-serif);
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 2rem;
    display: flex;
    align-items: baseline;
    gap: 0.875rem;
    padding-bottom: 0;
    border-bottom: none;
    letter-spacing: -0.01em;
    position: relative;
}

.section-header::before {
    content: '01';
    font-family: var(--font-sans);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 0.15em;
    flex-shrink: 0;
}

.section-header i {
    display: none;
}

.section-header::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--rule);
    margin-left: 1rem;
    align-self: center;
}

/* ============================================================
   7. 검토 모드 선택 — 토글 카드
   ============================================================ */
.mode-selection {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    margin-bottom: 2rem;
    border: 1px solid var(--rule);
    border-radius: var(--radius-sm);
    padding: 4px;
    background: var(--paper-soft);
}

.mode-button {
    padding: 1.25rem 1.5rem;
    background: transparent;
    border: none;
    border-radius: 2px;
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
    position: relative;
    font-family: var(--font-sans);
}

.mode-button:hover {
    background: color-mix(in oklab, var(--card) 60%, transparent);
}

.mode-button.active {
    background: var(--card);
    box-shadow: 0 1px 2px rgba(0,0,0,0.06), 0 0 0 1px var(--rule);
}

.mode-button.active::before {
    content: '';
    position: absolute;
    top: 1.4rem;
    left: 1.5rem;
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 20%, transparent);
}

.mode-button.active .mode-title {
    padding-left: 18px;
}

.mode-title {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 0.25rem;
    transition: padding 0.25s;
}

.mode-desc {
    font-size: 0.825rem;
    color: var(--ink-mute);
    font-weight: 400;
}

/* ============================================================
   8. 당사자 입력
   ============================================================ */
.party-input {
    background: color-mix(in oklab, var(--accent) 4%, var(--card));
    border-left: 3px solid var(--accent);
    padding: 1.5rem 1.75rem;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin-bottom: 2rem;
    display: none;
    border-top: 1px solid var(--rule-soft);
    border-right: 1px solid var(--rule-soft);
    border-bottom: 1px solid var(--rule-soft);
}

.party-input label {
    display: block;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.625rem;
    color: var(--ink);
    letter-spacing: 0.01em;
}

.party-input input {
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--card);
    border: 1px solid var(--rule);
    border-radius: var(--radius-xs);
    font-size: 1rem;
    font-family: var(--font-sans);
    color: var(--ink);
    transition: var(--transition);
}

.party-input input::placeholder { color: var(--ink-light); }

.party-input input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--shadow-focus);
}

.party-input small {
    color: var(--ink-mute) !important;
    font-size: 0.78rem !important;
    font-style: italic;
}

/* ============================================================
   9. 탭
   ============================================================ */
.input-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--rule);
}

.tab-button {
    padding: 0.875rem 1.5rem;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: var(--font-sans);
    cursor: pointer;
    color: var(--ink-mute);
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: -1px;
    flex: 0 0 auto;
    white-space: nowrap;
}

.tab-button:hover {
    color: var(--ink);
}

.tab-button.active {
    color: var(--ink);
    border-bottom-color: var(--accent);
    font-weight: 600;
}

.tab-button i { font-size: 0.9rem; }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ============================================================
   10. 텍스트 입력
   ============================================================ */
.text-input {
    width: 100%;
    padding: 1.25rem;
    background: var(--paper-soft);
    border: 1px solid var(--rule);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: var(--font-sans);
    color: var(--ink);
    min-height: 320px;
    resize: vertical;
    transition: var(--transition);
    line-height: 1.7;
}

.text-input::placeholder { color: var(--ink-light); }

.text-input:focus {
    outline: none;
    background: var(--card);
    border-color: var(--accent);
    box-shadow: var(--shadow-focus);
}

/* ============================================================
   11. 파일 업로드 — 印 메타포
   ============================================================ */
.file-upload {
    border: 1px dashed var(--rule);
    border-radius: var(--radius-md);
    padding: 3.5rem 2rem;
    text-align: center;
    background: var(--paper-soft);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.file-upload::before {
    content: '';
    position: absolute;
    inset: 8px;
    border: 1px solid var(--rule-soft);
    border-radius: calc(var(--radius-md) - 4px);
    pointer-events: none;
    transition: var(--transition);
}

.file-upload:hover,
.file-upload.drag-over {
    border-color: var(--accent);
    background: var(--card);
}

.file-upload:hover::before,
.file-upload.drag-over::before {
    border-color: color-mix(in oklab, var(--accent) 30%, transparent);
}

.file-upload input { display: none; }

.file-icon {
    font-size: 2rem;
    color: var(--ink-light);
    margin-bottom: 1rem;
    transition: var(--transition);
}

.file-upload:hover .file-icon {
    color: var(--accent);
    transform: translateY(-2px);
}

.file-label {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    font-weight: 500;
    color: var(--ink);
    margin-bottom: 0.5rem;
    letter-spacing: -0.01em;
}

.file-info {
    font-size: 0.825rem;
    color: var(--ink-mute);
    line-height: 1.7;
    font-family: var(--font-sans);
}

.file-info span[style] {
    color: var(--accent) !important;
    font-weight: 500;
}

.file-status {
    margin-top: 1.25rem;
    padding: 0.75rem 1.25rem;
    background: color-mix(in oklab, var(--success) 8%, var(--card));
    border: 1px solid color-mix(in oklab, var(--success) 25%, var(--rule));
    border-radius: var(--radius-sm);
    color: var(--success);
    font-weight: 500;
    font-size: 0.875rem;
    display: none;
    font-family: var(--font-sans);
}

/* ============================================================
   12. 버튼
   ============================================================ */
.review-button {
    display: block;
    width: 100%;
    max-width: none;
    margin: 2rem 0 0;
    padding: 1.1rem 2rem;
    background: var(--ink);
    color: var(--card);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.975rem;
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: var(--transition);
    letter-spacing: 0.02em;
    position: relative;
    overflow: hidden;
}

.review-button::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, color-mix(in oklab, var(--accent) 30%, transparent), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s;
}

.review-button:hover:not(:disabled) {
    background: var(--accent);
    transform: translateY(-1px);
    box-shadow: 0 8px 24px -8px color-mix(in oklab, var(--accent) 40%, transparent);
}

.review-button:hover:not(:disabled)::before {
    transform: translateX(100%);
}

.review-button:disabled {
    background: var(--rule);
    color: var(--ink-light);
    cursor: not-allowed;
}

.review-button i {
    margin-right: 0.4rem;
    font-size: 0.85rem;
}

/* ============================================================
   13. 로딩
   ============================================================ */
.loading {
    display: none;
    text-align: center;
    padding: 3rem 0 2rem;
}

.loading-spinner {
    border: 2px solid var(--rule);
    border-top: 2px solid var(--accent);
    border-radius: 50%;
    width: 38px;
    height: 38px;
    animation: spin 0.85s cubic-bezier(0.5, 0.1, 0.5, 0.9) infinite;
    margin: 0 auto 1.25rem;
}

.loading p:first-of-type {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    color: var(--ink);
    font-weight: 500;
}

.loading p:last-of-type {
    color: var(--ink-mute) !important;
    font-size: 0.85rem !important;
    margin-top: 0.4rem;
    font-family: var(--font-sans);
}

@keyframes spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============================================================
   14. 결과 섹션 — 의견서(意見書) 풍
   ============================================================ */
.result-section {
    display: none;
    position: relative;
    z-index: 1;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--ink);
    position: relative;
}

.result-header::before {
    content: 'OPINION / 의견서';
    position: absolute;
    top: 0;
    left: 0;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    color: var(--accent);
}

.result-title {
    font-family: var(--font-serif);
    font-size: clamp(1.75rem, 3vw, 2.25rem);
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -0.02em;
    margin-top: 1.5rem;
}

.btn-back {
    background: transparent;
    border: 1px solid var(--rule);
    color: var(--ink-mute);
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-back:hover {
    border-color: var(--ink);
    color: var(--ink);
    background: var(--card);
}

/* 결과 본문 */
.result-content {
    background: var(--card);
    padding: 3rem 3.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--rule);
    line-height: 1.85;
    font-size: 1rem;
    box-shadow: var(--shadow-card);
    font-family: var(--font-sans);
    color: var(--ink-soft);
    position: relative;
}

.result-content::before {
    content: '';
    position: absolute;
    top: 1.5rem;
    bottom: 1.5rem;
    left: 1.5rem;
    width: 1px;
    background: var(--rule-soft);
    opacity: 0.6;
}

.result-content h2 {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--ink);
    margin-top: 3rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--rule);
    letter-spacing: -0.01em;
    position: relative;
}

.result-content h2::before {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 40px;
    height: 2px;
    background: var(--accent);
}

.result-content h2:first-child { margin-top: 0; }

.result-content h3 {
    font-family: var(--font-serif);
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--ink);
    margin: 2rem 0 1rem 0;
    letter-spacing: -0.005em;
}

.result-content p {
    font-size: 0.975rem;
    color: var(--ink-soft);
    margin-bottom: 1rem;
    text-wrap: pretty;
}

.result-content strong {
    font-weight: 600;
    color: var(--ink);
}

.result-content ul {
    margin: 0 0 1.5rem 1.5rem;
    list-style: none;
}

.result-content li {
    font-size: 0.975rem;
    margin-bottom: 0.625rem;
    color: var(--ink-soft);
    position: relative;
    padding-left: 1rem;
}

.result-content li::before {
    content: '·';
    position: absolute;
    left: 0;
    color: var(--accent);
    font-weight: 700;
}

/* ============================================================
   15. 추가 질문
   ============================================================ */
.additional-question-section {
    margin-top: 2rem;
    padding: 2rem 2.25rem;
    background: var(--card);
    border-radius: var(--radius-md);
    border: 1px solid var(--rule);
    border-left: 3px solid var(--accent);
}

.additional-question-section h3 {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    letter-spacing: -0.01em;
}

.additional-question-section h3 i {
    color: var(--accent);
    font-size: 0.95rem;
}

.additional-question-section p {
    color: var(--ink-mute) !important;
    font-size: 0.875rem !important;
    margin-bottom: 1rem !important;
}

.question-input {
    width: 100%;
    padding: 1rem 1.125rem;
    background: var(--paper-soft);
    border: 1px solid var(--rule);
    border-radius: var(--radius-sm);
    font-size: 0.975rem;
    font-family: var(--font-sans);
    color: var(--ink);
    resize: vertical;
    min-height: 80px;
    transition: var(--transition);
    line-height: 1.6;
}

.question-input::placeholder { color: var(--ink-light); }

.question-input:focus {
    outline: none;
    background: var(--card);
    border-color: var(--accent);
    box-shadow: var(--shadow-focus);
}

.btn-ask {
    margin-top: 1rem;
    padding: 0.7rem 1.5rem;
    background: var(--ink);
    color: var(--card);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    letter-spacing: 0.02em;
}

.btn-ask:hover:not(:disabled) {
    background: var(--accent);
    transform: translateY(-1px);
}

.btn-ask:disabled {
    background: var(--rule);
    color: var(--ink-light);
    cursor: not-allowed;
}

.answer-section {
    margin-top: 1.5rem;
    padding: 1.5rem 1.75rem;
    background: var(--paper-soft);
    border-radius: var(--radius-sm);
    border: 1px solid var(--rule-soft);
    display: none;
}

.answer-section h4 {
    font-family: var(--font-serif);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.answer-section h4 i { color: var(--accent); font-size: 0.85rem; }

/* ============================================================
   16. 액션 버튼
   ============================================================ */
.action-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 0.625rem;
    margin-top: 2rem;
    flex-wrap: wrap;
    padding-top: 2rem;
    border-top: 1px solid var(--rule);
}

.action-button {
    padding: 0.7rem 1.4rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    letter-spacing: 0.01em;
}

.btn-print {
    background: var(--ink);
    color: var(--card);
    border-color: var(--ink);
}
.btn-print:hover { background: var(--accent); border-color: var(--accent); transform: translateY(-1px); }

.btn-copy {
    background: var(--card);
    color: var(--ink);
    border-color: var(--rule);
}
.btn-copy:hover { background: var(--paper-soft); border-color: var(--ink); transform: translateY(-1px); }

.btn-new {
    background: transparent;
    color: var(--ink-mute);
    border-color: var(--rule);
}
.btn-new:hover { color: var(--ink); border-color: var(--ink); transform: translateY(-1px); }

/* ============================================================
   17. 경고 박스 — 인주(印朱) 도장 스타일
   ============================================================ */
.warning-box {
    background: color-mix(in oklab, var(--warning) 6%, var(--card));
    border: 1px solid color-mix(in oklab, var(--warning) 25%, var(--rule));
    border-left: 3px solid var(--warning);
    border-radius: var(--radius-sm);
    padding: 1.25rem 1.5rem;
    margin-top: 2rem;
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    font-size: 0.875rem;
    color: var(--ink-soft);
    line-height: 1.7;
    font-family: var(--font-sans);
}

.warning-box i {
    flex-shrink: 0;
    font-size: 1rem;
    color: var(--warning);
    margin-top: 0.2rem;
}

.warning-box strong {
    color: var(--ink);
    font-weight: 600;
}

/* ============================================================
   18. 에러 메시지
   ============================================================ */
.error-message {
    background: color-mix(in oklab, var(--danger) 6%, var(--card));
    border: 1px solid color-mix(in oklab, var(--danger) 25%, var(--rule));
    border-left: 3px solid var(--danger);
    color: var(--danger);
    padding: 0.875rem 1.125rem;
    border-radius: var(--radius-sm);
    margin-top: 1rem;
    display: none;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: var(--font-sans);
}

/* ============================================================
   19. 푸터
   ============================================================ */
.footer {
    background: var(--paper);
    border-top: 1px solid var(--rule);
    padding: 2.5rem 0 2rem;
    margin-top: auto;
    position: relative;
}

.footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 1px;
    background: var(--accent);
    margin-top: -1px;
}

.footer-container {
    max-width: 1040px;
    margin: 0 auto;
    padding: 0 2rem;
    text-align: center;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 2.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--ink-mute);
    text-decoration: none;
    font-size: 0.825rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: var(--transition);
    letter-spacing: 0.01em;
    font-family: var(--font-sans);
}

.footer-links a:hover { color: var(--accent); }
.footer-links a i { font-size: 0.75rem; opacity: 0.7; }

.footer-copyright {
    color: var(--ink-light);
    font-size: 0.72rem;
    line-height: 1.8;
    padding-top: 1.5rem;
    border-top: 1px solid var(--rule-soft);
    max-width: 720px;
    margin: 0 auto;
    font-family: var(--font-sans);
}



/* ============================================================
   21. 홈 화면 추가 안내 모달
   ============================================================ */
.home-guide-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: color-mix(in oklab, var(--ink) 50%, transparent);
    backdrop-filter: blur(4px);
    z-index: 2000;
}

.home-guide-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.home-guide-content {
    background: var(--card);
    border-radius: var(--radius-md);
    padding: 24px;
    padding-top: 64px;
    max-width: 380px;
    width: 100%;
    box-shadow: 0 24px 64px rgba(20, 17, 13, 0.3);
    position: relative;
    border: 1px solid var(--rule);
}

.service-link-copy {
    position: absolute;
    top: 16px;
    left: 20px;
    right: 56px;
    background: var(--ink);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 12px;
    color: var(--card);
    font-weight: 500;
    transition: var(--transition);
    border: none;
    font-family: var(--font-sans);
}

.service-link-copy:hover { background: var(--accent); }
.service-link-copy.copied { background: var(--success); }

.guide-header {
    text-align: center;
    margin-bottom: 20px;
}

.guide-header h3 {
    font-family: var(--font-serif);
    font-size: 17px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 6px;
    line-height: 1.4;
    padding: 0 20px;
    letter-spacing: -0.01em;
}

.guide-header p {
    font-size: 13px;
    color: var(--ink-mute);
    font-family: var(--font-sans);
}

.guide-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: transparent;
    border: 1px solid var(--rule);
    font-size: 20px;
    cursor: pointer;
    color: var(--ink-mute);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
    line-height: 1;
}

.guide-close:hover {
    background: var(--ink);
    color: var(--card);
    border-color: var(--ink);
}

.browser-section {
    margin-bottom: 12px;
    padding: 14px;
    background: var(--paper-soft);
    border-radius: var(--radius-sm);
    border: 1px solid var(--rule-soft);
}

.browser-section h4 {
    font-family: var(--font-serif);
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.browser-icon {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.samsung-icon {
    background: #1428A0;
    color: #fff;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    width: 18px;
    height: 18px;
}

.guide-steps {
    list-style: none;
    padding: 0;
    margin: 0;
}

.guide-steps li {
    font-size: 12px;
    color: var(--ink-mute);
    padding: 3px 0 3px 16px;
    position: relative;
    font-family: var(--font-sans);
}

.guide-steps li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 10px;
    width: 4px;
    height: 4px;
    background: var(--accent);
    border-radius: 50%;
}

.guide-footer {
    text-align: center;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--rule-soft);
}

.guide-benefit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--success);
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-sans);
}

/* ============================================================
   22. 위험 등급 배지 & 섹션 라벨
   ============================================================ */
.risk-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 2px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    margin-bottom: 0.625rem;
    font-family: var(--font-sans);
    border: 1px solid;
    text-transform: uppercase;
}

.risk-high {
    background: color-mix(in oklab, var(--danger) 10%, var(--card));
    color: var(--danger);
    border-color: color-mix(in oklab, var(--danger) 35%, transparent);
}

.risk-medium {
    background: color-mix(in oklab, var(--warning) 10%, var(--card));
    color: var(--warning);
    border-color: color-mix(in oklab, var(--warning) 35%, transparent);
}

.risk-low {
    background: color-mix(in oklab, var(--success) 10%, var(--card));
    color: var(--success);
    border-color: color-mix(in oklab, var(--success) 35%, transparent);
}

.section-label {
    display: block;
    margin-top: 1rem;
    margin-bottom: 0.375rem;
    font-weight: 600;
    font-size: 0.78rem;
    color: var(--accent);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-family: var(--font-sans);
}

/* ============================================================
   23. Tweaks 패널
   ============================================================ */
.tweaks-panel {
    position: fixed;
    bottom: 28px;
    right: 28px;
    background: var(--card);
    border: 1px solid var(--rule);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    box-shadow: 0 12px 40px rgba(20, 17, 13, 0.18);
    z-index: 9998;
    width: 260px;
    display: none;
    font-family: var(--font-sans);
}

.tweaks-panel.show { display: block; }

.tweaks-panel h4 {
    font-family: var(--font-serif);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 0.875rem;
    padding-bottom: 0.625rem;
    border-bottom: 1px solid var(--rule);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.tweaks-panel .tweaks-close {
    background: transparent;
    border: none;
    color: var(--ink-mute);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0;
    line-height: 1;
}

.tweaks-panel label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--ink-mute);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.theme-options {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.5rem;
}

.theme-option {
    padding: 0.625rem 0.5rem;
    border: 1px solid var(--rule);
    border-radius: var(--radius-sm);
    background: var(--card);
    cursor: pointer;
    text-align: center;
    transition: var(--transition);
    font-family: var(--font-serif);
    font-size: 1rem;
    color: var(--ink);
    font-weight: 500;
}

.theme-option:hover { border-color: var(--accent); }
.theme-option.active {
    background: var(--ink);
    color: var(--paper);
    border-color: var(--ink);
}

.theme-option-name {
    display: block;
    font-family: var(--font-sans);
    font-size: 0.65rem;
    font-weight: 500;
    margin-top: 2px;
    letter-spacing: 0.05em;
    opacity: 0.7;
}

/* ============================================================
   24. 변호사 배너 — 재디자인
   ============================================================ */
.lawyer-banner {
    position: fixed !important;
    bottom: 28px !important;
    right: 28px !important;
    background: var(--card) !important;
    padding: 10px 16px 10px 11px !important;
    border-radius: var(--radius-sm) !important;
    box-shadow: 0 4px 16px rgba(20, 17, 13, 0.12) !important;
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    text-decoration: none !important;
    color: var(--ink) !important;
    transition: var(--transition) !important;
    z-index: 9999 !important;
    border: 1px solid var(--rule) !important;
    border-left: 3px solid var(--accent) !important;
}

.lawyer-banner:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 24px rgba(20, 17, 13, 0.18) !important;
    border-color: var(--rule) !important;
    border-left-color: var(--ink) !important;
}

.lawyer-icon-box {
    width: 34px !important;
    height: 34px !important;
    background: var(--paper-soft) !important;
    border-radius: var(--radius-xs) !important;
    color: var(--ink) !important;
    font-size: 1rem !important;
}

.lawyer-title {
    font-family: var(--font-serif) !important;
    font-size: 0.8rem !important;
    font-weight: 600 !important;
    color: var(--ink) !important;
}

.lawyer-subtitle {
    font-size: 0.62rem !important;
    color: var(--ink-mute) !important;
    letter-spacing: 0.04em;
}

/* Tweaks 패널이 열렸을 때 변호사 배너 숨김 */
body.tweaks-open .lawyer-banner { opacity: 0.3; pointer-events: none; }

/* ============================================================
   25. 반응형
   ============================================================ */
@media (max-width: 720px) {
    .header-container { padding: 0 1.25rem; height: 60px; }
    .header-container::before { left: 1.25rem; width: 32px; height: 32px; font-size: 19px; }
    .header-left { padding-left: 42px; }
    .header-left strong:first-of-type { font-size: 0.92rem; }
    
    .main-content { padding: 2.5rem 1.25rem 4rem; }
    .main-content::before { font-size: 10rem; right: -2rem; }
    
    .page-header { padding-bottom: 2rem; margin-bottom: 2rem; }
    .page-title { font-size: 2rem; }
    
    .service-content { padding: 1.75rem 1.5rem; }
    
    .mode-selection { grid-template-columns: 1fr; }
    .mode-button.active::before { top: 1.5rem; }
    
    .input-tabs { gap: 0; }
    .tab-button { padding: 0.7rem 1rem; font-size: 0.82rem; flex: 1; }
    
    .result-content { padding: 2rem 1.5rem; }
    .result-content::before { display: none; }
    
    .additional-question-section { padding: 1.5rem; }
    
    .result-header { flex-direction: column; align-items: flex-start; padding-top: 1.5rem; }
    .result-header::before { position: relative; margin-bottom: 0.5rem; }
    .result-title { margin-top: 0; }
    
    .footer-links { gap: 1.5rem; }
    
    .action-buttons { gap: 0.5rem; justify-content: center; }
    .action-button { padding: 0.65rem 1rem; font-size: 0.82rem; }
    

    
    .tweaks-panel { width: calc(100% - 40px); right: 20px; bottom: 20px; }
}

/* ============================================================
   25-B. 사용량 배지 (印 인주도장 + 잔여 도트)
   ──────────────────────────────────────────────
   IP 일일 한도(현재 10회) 잔여 표시. 우상단 fixed.
   "오늘 부여된 검토 자원" 메타포 — 인주 도장이 종이에 찍힌 느낌.
   상태: 정상 / critical(잔여 ≤2) / exhausted(0) / warn(카운터 장애)
   ============================================================ */
.usage-badge {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    gap: 14px;
    align-items: center;
    padding: 14px 18px 14px 14px;
    background: var(--card);
    border: 1px solid var(--accent);
    border-radius: var(--radius-xs);
    box-shadow: var(--shadow-card);
    font-family: var(--font-serif);
    color: var(--ink-soft);
    transition: var(--transition);
    /* 종이결 살짝 — 다른 카드와 톤 맞춤 */
    background-image:
        linear-gradient(180deg, transparent 0%, rgba(20,17,13,0.015) 100%);
}
.usage-badge[hidden] { display: none !important; }

/* 인주 도장 */
.usage-badge__stamp {
    flex: 0 0 auto;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: var(--paper);
    border-radius: var(--radius-xs);
    transform: rotate(-3deg);
    /* 도장 질감 — 내부 그림자 + 미세 잉크 번짐 */
    box-shadow:
        inset 0 0 6px rgba(0, 0, 0, 0.22),
        inset 1px 1px 0 rgba(255, 255, 255, 0.08),
        0 2px 4px rgba(139, 37, 32, 0.28);
    position: relative;
}
.usage-badge__stamp::after {
    /* 종이 위 도장 외곽 살짝 번진 느낌 */
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: var(--radius-xs);
    background: var(--accent);
    opacity: 0.10;
    z-index: -1;
    filter: blur(2px);
}
.usage-badge__stamp-char {
    font-family: var(--font-serif);
    font-size: 24px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -1px;
    /* 도장 새김 — 음각 느낌 */
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.25);
}

/* 콘텐츠 영역 */
.usage-badge__content {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 120px;
}
.usage-badge__label {
    font-size: 12px;
    color: var(--ink-mute);
    letter-spacing: 0.08em;
    font-weight: 500;
    margin-bottom: 1px;
}
.usage-badge__dots {
    display: flex;
    gap: 5px;
    margin: 2px 0 3px;
}
.usage-badge__dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--accent);
    transition: background 0.4s ease, transform 0.3s ease;
}
.usage-badge__dot--used {
    background: var(--rule-soft);
}
.usage-badge__remaining {
    font-size: 13px;
    color: var(--ink-soft);
    line-height: 1.2;
}
.usage-badge__remaining strong {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent);
    margin-right: 3px;
    font-variant-numeric: tabular-nums;
}
.usage-badge__reset {
    font-size: 10.5px;
    color: var(--ink-light);
    letter-spacing: 0.04em;
    margin-top: 1px;
}

/* 경각 상태 (잔여 ≤ 2) — 도장 살짝 박동 + 진한 적색 */
.usage-badge--critical .usage-badge__stamp {
    animation: usage-stamp-pulse 2.2s ease-in-out infinite;
}
.usage-badge--critical .usage-badge__dot:not(.usage-badge__dot--used) {
    background: var(--accent-deep);
}
.usage-badge--critical .usage-badge__remaining strong {
    color: var(--accent-deep);
}
@keyframes usage-stamp-pulse {
    0%, 100% { transform: rotate(-3deg) scale(1); }
    50%      { transform: rotate(-3deg) scale(1.06); }
}

/* 소진 (잔여 0) — 도장 흐려짐 */
.usage-badge--exhausted .usage-badge__stamp {
    opacity: 0.5;
    transform: rotate(-3deg);
    animation: none;
}
.usage-badge--exhausted .usage-badge__dot {
    background: var(--rule-soft);
}
.usage-badge--exhausted .usage-badge__remaining strong {
    color: var(--ink-light);
}

/* 카운터 장애 (잔여 = -1) */
.usage-badge--warn {
    border-color: var(--warning);
}
.usage-badge--warn .usage-badge__stamp {
    background: var(--warning);
}
.usage-badge--warn .usage-badge__stamp::after {
    background: var(--warning);
}

/* 모바일 */
@media (max-width: 640px) {
    .usage-badge {
        top: 12px;
        right: 12px;
        padding: 10px 14px 10px 10px;
        gap: 10px;
    }
    .usage-badge__stamp {
        width: 38px;
        height: 38px;
    }
    .usage-badge__stamp-char {
        font-size: 19px;
    }
    .usage-badge__content {
        min-width: 100px;
    }
    .usage-badge__dot {
        width: 7px;
        height: 7px;
        gap: 4px;
    }
    .usage-badge__remaining strong {
        font-size: 17px;
    }
}

/* ============================================================
   26. 인쇄
   ============================================================ */
@media print {
    .no-print { display: none !important; }
    .header, .footer-links, .browser-tip, .tweaks-panel, .lawyer-banner, .usage-badge { display: none !important; }
    body { background: #fff; }
    body::before, .main-content::before { display: none !important; }
    .result-content { box-shadow: none; border: none; padding: 0; }
    .result-content::before { display: none; }
}
