/* ===== CSS 변수 (라이트/다크 모드) ===== */
:root {
    --bg: #f5f5f5;
    --card-bg: #ffffff;
    --text: #222222;
    --sub-text: #777777;
    --border: #dddddd;
    --btn-bg: #222222;
    --btn-text: #ffffff;
    --hover: #eeeeee;
    --badge-bg: #f0f0f0;
    --input-bg: #ffffff;
    --footer-bg: #eeeeee;
    --success-bg: #e6f4ea;
    --success-text: #2d6a4f;
    --error-bg: #fdecea;
    --error-text: #b00020;
    --alive-bg: #e6f4ea;
    --alive-text: #2d6a4f;
    --consumed-bg: #f0f0f0;
    --consumed-text: #888888;
}

[data-theme="dark"] {
    --bg: #111111;
    --card-bg: #1e1e1e;
    --text: #eeeeee;
    --sub-text: #888888;
    --border: #333333;
    --btn-bg: #eeeeee;
    --btn-text: #111111;
    --hover: #2a2a2a;
    --badge-bg: #2a2a2a;
    --input-bg: #2a2a2a;
    --footer-bg: #1a1a1a;
    --success-bg: #1a3a2a;
    --success-text: #6fcf97;
    --error-bg: #3a1a1a;
    --error-text: #eb5757;
    --alive-bg: #1a3a2a;
    --alive-text: #6fcf97;
    --consumed-bg: #2a2a2a;
    --consumed-text: #888888;
}

/* ===== 기본 리셋 ===== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', 'Noto Sans KR', sans-serif;
    transition: background 0.3s, color 0.3s;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--text);
    text-decoration: none;
}

ul {
    padding-left: 1.5rem;
}

ul li {
    margin-bottom: 0.4rem;
    line-height: 1.6;
}

/* ===== 헤더 ===== */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 5%;
    border-bottom: 1px solid var(--border);
    background: var(--card-bg);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    letter-spacing: 2px;
}

.logo a {
    color: var(--text);
    text-decoration: none;
}

.header-right {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    flex-wrap: wrap;
}

/* ===== 버튼 ===== */
.btn {
    padding: 0.45rem 1rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--btn-bg);
    color: var(--btn-text);
    cursor: pointer;
    font-size: 0.85rem;
    text-decoration: none;
    transition: opacity 0.2s;
    display: inline-block;
}

.btn:hover {
    opacity: 0.75;
}

.btn-outline {
    background: transparent;
    color: var(--text);
}

.theme-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.45rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 32px;
}

.theme-btn:hover {
    background: var(--hover);
}

/* ===== 배너 ===== */
.banner {
    display: flex;
    justify-content: center;
    gap: 2rem;
    padding: 0.8rem 5%;
    background: var(--badge-bg);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.banner-item {
    font-size: 0.85rem;
    color: var(--sub-text);
}

.banner-item span {
    color: var(--text);
    font-weight: bold;
}

/* ===== 메인 ===== */
main {
    max-width: 700px;
    width: 100%;
    margin: 2rem auto;
    padding: 0 5%;
    flex: 1;
}

/* ===== 글쓰기 버튼 ===== */
.write-btn-wrap {
    text-align: center;
    margin-bottom: 1.5rem;
}

/* ===== 게시글 목록 ===== */
.post-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.post-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem 1.2rem;
    transition: background 0.2s;
}

.post-card:hover {
    background: var(--hover);
}

.post-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.post-nickname {
    font-size: 0.85rem;
    color: var(--sub-text);
    font-weight: bold;
}

.post-time {
    font-size: 0.78rem;
    color: var(--sub-text);
}

.post-title {
    font-size: 1rem;
    font-weight: bold;
    margin-bottom: 0.8rem;
    line-height: 1.4;
}

.post-footer {
    display: flex;
    justify-content: flex-end;
}

.read-btn {
    padding: 0.4rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    font-size: 0.82rem;
    transition: background 0.2s;
}

.read-btn:hover {
    background: var(--hover);
}

.empty-msg {
    text-align: center;
    color: var(--sub-text);
    padding: 3rem 0;
    font-size: 0.9rem;
}

/* ===== 글 읽기 ===== */
.read-wrap {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2rem;
}

.read-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.read-title {
    font-size: 1.3rem;
    font-weight: bold;
    margin-bottom: 1.2rem;
    line-height: 1.5;
}

.read-content {
    font-size: 0.95rem;
    line-height: 1.8;
    white-space: pre-wrap;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.consumed-msg {
    text-align: center;
    color: var(--sub-text);
    font-size: 0.9rem;
    padding: 1rem 0;
}

/* ===== 이모지 반응 ===== */
.reaction-wrap {
    text-align: center;
    padding: 1.2rem 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.2rem;
}

.reaction-wrap p {
    font-size: 0.85rem;
    color: var(--sub-text);
    margin-bottom: 0.8rem;
}

.emoji-btns {
    display: flex;
    justify-content: center;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.emoji-btn {
    font-size: 1.5rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.4rem 0.8rem;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.emoji-btn:hover {
    background: var(--hover);
    transform: scale(1.15);
}

.back-wrap {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}

/* ===== 폼 공통 ===== */
.form-wrap {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2rem;
    max-width: 480px;
    margin: 0 auto;
}

.form-title {
    font-size: 1.3rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.form-desc {
    font-size: 0.85rem;
    color: var(--sub-text);
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.2rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: bold;
    margin-bottom: 0.4rem;
    color: var(--sub-text);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--input-bg);
    color: var(--text);
    font-size: 0.95rem;
    transition: border 0.2s;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--text);
}

.form-group textarea {
    resize: vertical;
    line-height: 1.6;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    margin-top: 1.5rem;
}

.form-link {
    text-align: center;
    margin-top: 1.2rem;
    font-size: 0.85rem;
    color: var(--sub-text);
}

.form-link a {
    color: var(--text);
    font-weight: bold;
    text-decoration: underline;
}

/* ===== 약관 동의 ===== */
.terms-wrap {
    margin-top: 0.5rem;
}

.terms-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.terms-check input[type="checkbox"] {
    width: auto;
    cursor: pointer;
}

.terms-check a {
    color: var(--text);
    text-decoration: underline;
}

/* ===== 에러/성공 메시지 ===== */
.error-msg {
    background: var(--error-bg);
    color: var(--error-text);
    padding: 0.7rem 1rem;
    border-radius: 4px;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.success-msg {
    background: var(--success-bg);
    color: var(--success-text);
    padding: 0.7rem 1rem;
    border-radius: 4px;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

/* ===== 마이페이지 ===== */
.mypage-wrap {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2rem;
}

.user-info {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.user-info h2 {
    font-size: 1.4rem;
    margin-bottom: 1rem;
}

.user-stats {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.stat-label {
    font-size: 0.78rem;
    color: var(--sub-text);
}

.stat-value {
    font-size: 1.3rem;
    font-weight: bold;
}

.section-title {
    font-size: 1rem;
    font-weight: bold;
    margin-bottom: 1rem;
    color: var(--sub-text);
}

.my-posts {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.my-post-card {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.9rem 1rem;
}

.my-post-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
    font-size: 0.78rem;
    color: var(--sub-text);
}

.my-post-title {
    font-size: 0.95rem;
    font-weight: bold;
    margin-bottom: 0.6rem;
}

.badge-alive {
    background: var(--alive-bg);
    color: var(--alive-text);
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
}

.badge-consumed {
    background: var(--consumed-bg);
    color: var(--consumed-text);
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
}

.reveal-wrap {
    margin-top: 0.5rem;
}

/* ===== 관리자 ===== */
.admin-wrap {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2rem;
}

.ban-form {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}

.ban-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.ban-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.8rem 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.ban-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.85rem;
}

.ban-ip {
    font-weight: bold;
}

.ban-reason {
    color: var(--sub-text);
}

.ban-expired {
    color: var(--sub-text);
    font-size: 0.78rem;
}

/* ===== 약관/개인정보 ===== */
.policy-wrap {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2rem;
}

.policy-content {
    margin: 1.5rem 0;
    line-height: 1.8;
}

.policy-content h3 {
    font-size: 1rem;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.policy-content p {
    font-size: 0.9rem;
    color: var(--sub-text);
    margin-bottom: 0.5rem;
}

.policy-date {
    margin-top: 2rem;
    font-size: 0.82rem;
    color: var(--sub-text);
}

/* ===== 푸터 ===== */
footer {
    background: var(--footer-bg);
    border-top: 1px solid var(--border);
    padding: 1.2rem 5%;
    text-align: center;
    margin-top: auto;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 0.4rem;
}

.footer-links a {
    font-size: 0.78rem;
    color: var(--sub-text);
    text-decoration: none;
}

.footer-links a:hover {
    text-decoration: underline;
}

/* ===== 번역기 ===== */
.lang-select {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.45rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
}

.lang-select option {
    background: var(--card-bg);
    color: var(--text);
}

/* ===== 질문답변 ===== */
.footer-copy {
    font-size: 0.75rem;
    color: var(--sub-text);
}

.answer-wrap {
    margin-top: 1.5rem;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--badge-bg);
}

.answer-content {
    font-size: 0.95rem;
    line-height: 1.8;
    white-space: pre-wrap;
    margin: 0.5rem 0;
}

/* ===== 모바일 반응형 ===== */
@media (max-width: 600px) {
    header {
        padding: 0.8rem 4%;
    }

    .logo {
        font-size: 1.2rem;
    }

    .banner {
        gap: 1rem;
        font-size: 0.8rem;
    }

    main {
        margin: 1rem auto;
        padding: 0 4%;
    }

    .form-wrap {
        padding: 1.5rem 1rem;
    }

    .read-wrap {
        padding: 1.2rem 1rem;
    }

    .mypage-wrap {
        padding: 1.2rem 1rem;
    }

    .admin-wrap {
        padding: 1.2rem 1rem;
    }

    .user-stats {
        gap: 1.2rem;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
        text-align: center;
    }

    .emoji-btns {
        gap: 0.5rem;
    }

    .ban-card {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ===== 생성 애니메이션 ===== */
@keyframes appearRight {
    0% { opacity: 0; transform: translateX(-100px); filter: blur(4px); }
    100% { opacity: 1; transform: translateX(0); filter: blur(0); }
}

@keyframes appearDown {
    0% { opacity: 0; transform: translateY(-30px) scale(0.8); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes appearGlow {
    0% { opacity: 0; filter: brightness(5) blur(6px); }
    50% { opacity: 0.5; filter: brightness(2) saturate(3); }
    100% { opacity: 1; filter: brightness(1); }
}

@keyframes appearPop {
    0% { opacity: 0; transform: scale(0.5); }
    70% { transform: scale(1.05); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes appearFade {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

/* ===== 소멸 애니메이션 ===== */
@keyframes dissolveLeft {
    0% { opacity: 1; transform: translateX(0); filter: blur(0); }
    100% { opacity: 0; transform: translateX(100px); filter: blur(4px); }
}

@keyframes dissolveUp {
    0% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-30px) scale(0.8); }
}

@keyframes dissolveBurn {
    0% { opacity: 1; filter: brightness(1); }
    50% { opacity: 0.5; filter: brightness(2) saturate(3); }
    100% { opacity: 0; filter: brightness(5) blur(6px); }
}

@keyframes dissolveAsh {
    0% { opacity: 1; transform: scale(1); filter: blur(0); }
    50% { opacity: 0.5; transform: scale(1.05); filter: blur(1px); }
    100% { opacity: 0; transform: scale(0.8) translateY(10px); filter: blur(6px); }
}

@keyframes dissolveFade {
    0% { opacity: 1; }
    100% { opacity: 0; }
}


/* ===== 페이징 ===== */
.pagination-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: var(--sub-text);
}