/* 기본 색상 및 공통 설정 */
:root {
    --bg: #0f172a;
    --bg-card: #111827;
    --bg-elevated: #020617;
    --primary: #6366f1;
    --primary-soft: rgba(99, 102, 241, 0.1);
    --accent: #f97316;
    --text: #e5e7eb;
    --text-muted: #9ca3af;
    --border-subtle: #1f2937;
    --radius-lg: 16px;
    --radius-md: 10px;
    --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.8);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: radial-gradient(circle at top left, #1e293b, #020617 55%);
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

/* 상단 네비게이션 */
nav {
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(16px);
    background: linear-gradient(to right, rgba(15,23,42,0.95), rgba(15,23,42,0.85));
    border-bottom: 1px solid var(--border-subtle);
    padding: 10px 24px;
    display: flex;
    align-items: center;
    gap: 18px;
}

nav .brand {
    font-weight: 700;
    letter-spacing: 0.08em;
    font-size: 14px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-right: 8px;
    cursor: pointer;
}

nav .brand:hover {
    color: #e5e7eb;
}

nav a {
    position: relative;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 14px;
    color: var(--text-muted);
    transition: background 0.2s ease, color 0.2s ease, transform 0.1s ease;
}

nav a:hover {
    background: rgba(15, 23, 42, 0.9);
    color: var(--text);
    transform: translateY(-1px);
}

nav a.active {
    background: var(--primary-soft);
    color: #e0e7ff;
    box-shadow: 0 0 0 1px rgba(129, 140, 248, 0.4);
}

nav a.active::after {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    border: 1px solid rgba(129, 140, 248, 0.6);
    opacity: 0.7;
}

/* 페이지 레이아웃 */
.page-shell {
    max-width: 1040px;
    margin: 0 auto;
    padding: 32px 16px 48px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 24px;
}

.page-title {
    font-size: 26px;
    font-weight: 700;
}

.page-subtitle {
    margin-top: 4px;
    font-size: 13px;
    color: var(--text-muted);
}

/* 카드 & 컨테이너 */
.container {
    max-width: 1040px;
    margin: 0 auto;
    padding: 32px 16px 48px;
}

.card {
    background: radial-gradient(circle at top left, #111827, #020617);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(31, 41, 55, 0.85);
    box-shadow: var(--shadow-soft);
    padding: 18px 20px;
    margin-bottom: 16px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.chip {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(31, 41, 55, 0.9);
    font-size: 11px;
    color: var(--text-muted);
    gap: 6px;
}

.chip-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #22c55e;
}

.tag-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    border-radius: 999px;
    background: rgba(55, 65, 81, 0.7);
    font-size: 11px;
    color: #e5e7eb;
    margin-right: 4px;
    margin-top: 4px;
}

.tag-pill.secondary {
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(75, 85, 99, 0.8);
}

.tag-row {
    margin-top: 6px;
}

/* 폼 요소 */
input,
textarea,
select {
    width: 100%;
    padding: 10px 12px;
    margin: 8px 0;
    border-radius: 10px;
    border: 1px solid rgba(55, 65, 81, 0.9);
    background: rgba(15, 23, 42, 0.95);
    color: var(--text);
    font-size: 13px;
    outline: none;
    transition: border 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

input::placeholder,
textarea::placeholder {
    color: rgba(148, 163, 184, 0.9);
}

input:focus,
textarea:focus,
select:focus {
    border-color: rgba(129, 140, 248, 0.8);
    box-shadow: 0 0 0 1px rgba(129, 140, 248, 0.6);
    background: #020617;
}

textarea {
    min-height: 90px;
    resize: vertical;
}

label {
    font-size: 12px;
    color: var(--text-muted);
}

/* 버튼 */
button {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border: none;
    padding: 9px 14px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: 0 10px 25px rgba(79, 70, 229, 0.35);
    transition: transform 0.1s ease, box-shadow 0.15s ease, background 0.15s ease;
}

button:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 35px rgba(79, 70, 229, 0.45);
}

button.secondary {
    background: rgba(15, 23, 42, 0.9);
    color: var(--text);
    box-shadow: none;
    border: 1px solid rgba(55, 65, 81, 0.9);
}

button.secondary:hover {
    background: rgba(17, 24, 39, 0.95);
}

/* 홈 빠른 이동용: 기본은 보조 버튼, 호버 시 메인 색상 */
button.secondary.quick-primary:hover {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    box-shadow: 0 14px 35px rgba(79, 70, 229, 0.45);
}

button.danger {
    background: linear-gradient(135deg, #ef4444, #f97316);
}

.btn-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* 로그인용 좁은 레이아웃 */
.auth-container {
    max-width: 360px;
    margin: 96px auto 40px;
    padding: 0 16px;
}

.auth-card {
    background: radial-gradient(circle at top left, #111827, #020617);
    border-radius: 20px;
    padding: 24px 22px 22px;
    border: 1px solid rgba(31, 41, 55, 0.9);
    box-shadow: var(--shadow-soft);
}

.auth-title {
    font-size: 22px;
    margin-bottom: 4px;
}

.auth-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 18px;
}

.auth-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.auth-actions button {
    flex: 1;
}

.auth-message {
    margin-top: 10px;
    font-size: 12px;
    color: var(--accent);
}

/* 게시판 레이아웃 */
#q-box {
    margin-bottom: 16px;
}

#board-list {
    margin-top: 4px;
}

.post-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
}

.answer-box {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(31, 41, 55, 0.9);
}

.answer {
    font-size: 13px;
    color: #e5e7eb;
    padding: 6px 8px;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.95);
    margin-top: 4px;
}

.answer small {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    color: var(--text-muted);
}

.answer-input {
    margin-top: 8px;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.filter-row input {
    max-width: 220px;
    margin: 0;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(55, 65, 81, 0.9);
    font-size: 11px;
    color: var(--text-muted);
}

.d-day {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 11px;
    background: rgba(248, 250, 252, 0.05);
    border: 1px solid rgba(148, 163, 184, 0.35);
    color: #e5e7eb;
}

/* 통계 페이지: 파이 + 리스트 가로 배치 */
.stats-row {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    flex-wrap: wrap;
}
.stats-chart-wrap {
    flex: 0 0 auto;
    max-width: 100%;
    width: 528px;
}
.stats-chart-wrap canvas {
    max-height: 480px;
    max-width: 100%;
}
.stats-list-wrap {
    flex: 1;
    min-width: 180px;
}

/* 반응형 */
@media (max-width: 640px) {
    nav {
        padding-inline: 14px;
        gap: 10px;
        flex-wrap: wrap;
    }
    nav a {
        font-size: 13px;
        padding-inline: 10px;
    }
    .page-shell,
    .container {
        padding-inline: 12px;
    }
    .stats-row {
        flex-direction: column;
    }
    .stats-chart-wrap {
        max-width: 100%;
        width: 100%;
    }
}
