* { box-sizing: border-box; margin: 0; padding: 0; }

/* ── 테마 변수 ── */
:root, [data-theme="dark"] {
    --bg:            linear-gradient(135deg, #0d0d1a, #111827, #0f172a);
    --card-bg:       rgba(255,255,255,0.05);
    --card-border:   rgba(255,255,255,0.10);
    --card-shadow:   0 20px 50px rgba(0,0,0,0.45);
    --text:          #f1f5f9;
    --text-sub:      #94a3b8;
    --text-muted:    #64748b;
    --input-bg:      rgba(255,255,255,0.06);
    --input-border:  rgba(255,255,255,0.12);
    --toggle-bg:     rgba(255,255,255,0.08);
    --toggle-border: rgba(255,255,255,0.15);
    --reason-bullet: #f7c948;
    --gauge-bg:      rgba(255,255,255,0.08);
}
[data-theme="light"] {
    --bg:            linear-gradient(135deg, #e2e8f0, #f0f4ff, #e8f4f8);
    --card-bg:       rgba(255,255,255,0.88);
    --card-border:   rgba(0,0,0,0.07);
    --card-shadow:   0 20px 50px rgba(0,0,0,0.10);
    --text:          #0f172a;
    --text-sub:      #475569;
    --text-muted:    #94a3b8;
    --input-bg:      rgba(0,0,0,0.03);
    --input-border:  rgba(0,0,0,0.12);
    --toggle-bg:     rgba(0,0,0,0.06);
    --toggle-border: rgba(0,0,0,0.12);
    --reason-bullet: #d97706;
    --gauge-bg:      rgba(0,0,0,0.07);
}

body {
    font-family: 'Segoe UI', 'Apple SD Gothic Neo', sans-serif;
    background: var(--bg);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 48px 16px 60px;
    transition: background 0.4s;
}

/* ── 테마 토글 ── */
#theme-toggle {
    position: fixed; top: 16px; right: 16px;
    width: 44px; height: 44px; border-radius: 50%;
    background: var(--toggle-bg); border: 1px solid var(--toggle-border);
    color: var(--text); font-size: 1.2rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.2s, background 0.4s; z-index: 100;
    backdrop-filter: blur(6px);
}
#theme-toggle:hover { transform: scale(1.1); }

/* ── 레이아웃 ── */
.wrapper {
    width: 100%; max-width: 860px;
    display: flex; flex-direction: column; gap: 24px;
}

header { text-align: center; }
header h1 { font-size: 2rem; color: var(--text); }
.subtitle { color: var(--text-sub); margin-top: 8px; font-size: 0.97rem; line-height: 1.6; }
.subtitle strong { color: var(--text); }

/* ── 입력 카드 ── */
.input-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 18px;
    padding: 20px;
    box-shadow: var(--card-shadow);
    backdrop-filter: blur(10px);
    transition: background 0.4s, border-color 0.4s;
}

#article-input {
    width: 100%; min-height: 200px;
    background: var(--input-bg); border: 1px solid var(--input-border);
    border-radius: 12px; padding: 14px 16px;
    color: var(--text); font-size: 0.97rem; font-family: inherit;
    line-height: 1.7; resize: vertical; outline: none;
    transition: border-color 0.3s, background 0.4s, color 0.4s;
}
#article-input:focus { border-color: #6366f1; }
#article-input::placeholder { color: var(--text-muted); }

.input-footer {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 12px;
}
#char-count { font-size: 0.85rem; color: var(--text-muted); }

#analyze-btn {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #fff; padding: 11px 32px; border: none;
    border-radius: 50px; font-size: 0.97rem; font-weight: 700;
    cursor: pointer; transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 4px 18px rgba(99,102,241,0.4);
}
#analyze-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 26px rgba(99,102,241,0.55); }
#analyze-btn:active { transform: translateY(0); }
#analyze-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ── 결과 영역 ── */
.results {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.results.hidden { display: none; }

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

/* ── 결과 카드 ── */
.result-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 18px; padding: 24px 22px;
    box-shadow: var(--card-shadow);
    backdrop-filter: blur(10px);
    transition: background 0.4s, border-color 0.4s;
    display: flex; flex-direction: column; align-items: center; gap: 14px;
    animation: fadeIn 0.4s ease;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.card-header {
    display: flex; align-items: center; gap: 8px;
    align-self: flex-start;
}
.card-icon { font-size: 1.3rem; }
.card-header h2 { font-size: 1.1rem; color: var(--text); }

/* ── SVG 게이지 ── */
.gauge-wrap {
    position: relative; width: 130px; height: 130px;
    display: flex; align-items: center; justify-content: center;
}
.gauge { width: 130px; height: 130px; transform: rotate(-90deg); }
.gauge-bg { fill: none; stroke: var(--gauge-bg); stroke-width: 10; }
.gauge-ring {
    fill: none; stroke-width: 10;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s ease, stroke 0.6s ease;
}
.gauge-label {
    position: absolute; display: flex; flex-direction: column;
    align-items: center; line-height: 1;
}
.gauge-label span { font-size: 2rem; font-weight: 800; color: var(--text); }
.gauge-label small { font-size: 0.8rem; color: var(--text-sub); margin-top: 2px; }

/* 점수별 색상 */
.ring-green  { stroke: #22c55e; }
.ring-yellow { stroke: #f59e0b; }
.ring-red    { stroke: #ef4444; }
.ring-blue   { stroke: #6366f1; }

/* ── 배지 ── */
.badge {
    padding: 5px 16px; border-radius: 50px;
    font-size: 0.82rem; font-weight: 700; letter-spacing: 0.3px;
}
.badge-green  { background: rgba(34,197,94,0.15);  color: #22c55e; }
.badge-yellow { background: rgba(245,158,11,0.15); color: #f59e0b; }
.badge-red    { background: rgba(239,68,68,0.15);  color: #ef4444; }
.badge-blue   { background: rgba(99,102,241,0.15); color: #818cf8; }

/* ── 이유 목록 ── */
.reasons {
    width: 100%; list-style: none;
    display: flex; flex-direction: column; gap: 8px;
}
.reasons li {
    font-size: 0.875rem; color: var(--text-sub); line-height: 1.55;
    padding-left: 18px; position: relative;
}
.reasons li::before {
    content: '▸';
    position: absolute; left: 0;
    color: var(--reason-bullet);
    font-size: 0.75rem; top: 2px;
}

/* ── 면책 고지 ── */
.disclaimer {
    text-align: center; font-size: 0.8rem; color: var(--text-muted);
}
