:root {
    --patch-sky-top: #e0f2fe;
    --patch-sky-bottom: #f0f9ff;
    --patch-ink: #17324d;
    --patch-muted: #6283a1;
    --patch-blue: #2563eb;
    --patch-blue-soft: #dbeafe;
    --patch-card-border: rgba(91, 184, 245, 0.35);
    --patch-card-shadow: 0 20px 50px rgba(91, 184, 245, 0.13);
    --patch-white: rgba(255, 255, 255, 0.9);

    --section-신규-bg: rgba(219, 234, 254, 0.85);
    --section-신규-border: rgba(29, 78, 216, 0.22);
    --section-신규-color: #1d4ed8;

    --section-버그-bg: rgba(254, 226, 226, 0.85);
    --section-버그-border: rgba(220, 38, 38, 0.22);
    --section-버그-color: #dc2626;

    --section-수정-bg: rgba(204, 251, 241, 0.85);
    --section-수정-border: rgba(15, 118, 110, 0.22);
    --section-수정-color: #0f766e;

    --section-조정-bg: rgba(254, 243, 199, 0.85);
    --section-조정-border: rgba(217, 119, 6, 0.22);
    --section-조정-color: #d97706;
}

* { box-sizing: border-box; }

body {
    min-height: 100vh;
    color: var(--patch-ink);
    background: url('../image/patch-bg.svg') center / cover fixed;
}

/* ── 페이지 레이아웃 ── */

.patch-page {
    position: relative;
    z-index: 1;
    padding: 90px 0 80px;
}

/* ── 히어로 ── */

.patch-hero {
    text-align: center;
    margin-bottom: 60px;
}

.patch-hero__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 68px;
    height: 68px;
    margin-bottom: 18px;
    border-radius: 22px;
    background: var(--patch-blue-soft);
    border: 1.5px solid rgba(37, 99, 235, 0.2);
    color: var(--patch-blue);
    box-shadow: 0 12px 30px rgba(37, 99, 235, 0.14);
}

.patch-hero__eyebrow,
.section-mini-label,
.preview-card__label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: 999px;
    background: rgba(255,255,255,0.72);
    border: 1px solid rgba(255,255,255,0.85);
    color: var(--patch-muted);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.14em;
}

.patch-hero__title {
    margin: 14px 0 10px;
    font-size: clamp(2.1rem, 4vw, 3.25rem);
    font-weight: 900;
    letter-spacing: -0.03em;
}

.patch-hero__desc,
.patch-list-section__head p,
.admin-panel__header p,
.preview-card__header small,
.editor-help,
.editor-status {
    color: var(--patch-muted);
}

/* ── 관리자 패널 ── */

.admin-panel,
.patch-list-section {
    margin-bottom: 30px;
}

.admin-panel__header,
.patch-list-section__head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.admin-panel__header h2,
.patch-list-section__head h2 {
    margin: 12px 0 8px;
    font-size: clamp(1.55rem, 3vw, 2.2rem);
    font-weight: 900;
}

.admin-panel__badge {
    display: inline-flex;
    align-items: center;
    padding: 7px 12px;
    border-radius: 999px;
    background: linear-gradient(135deg, #1d4ed8, #3b82f6);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.12em;
}

.admin-panel__new-btn,
.editor-actions .btn {
    min-height: 44px;
    border-radius: 14px;
    font-weight: 700;
}

.admin-panel__new-btn {
    background: #fff;
    border: 1px solid rgba(91, 184, 245, 0.3);
    box-shadow: 0 8px 20px rgba(91, 184, 245, 0.14);
}

.admin-panel__layout {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    gap: 20px;
    align-items: start;
}

/* ── 에디터 / 미리보기 카드 ── */

.editor-card,
.preview-card {
    padding: 24px;
    border-radius: 28px;
    background: var(--patch-white);
    border: 1px solid rgba(255,255,255,0.7);
    box-shadow: var(--patch-card-shadow);
    backdrop-filter: blur(18px);
}

.preview-card {
    position: sticky;
    top: 80px;
}

.editor-card__top,
.preview-card__header,
.editor-field {
    margin-bottom: 18px;
}

.editor-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.editor-grid--single {
    grid-template-columns: minmax(0, 1fr);
}

.editor-label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--patch-ink);
}

.editor-label-hint {
    font-size: 0.78rem;
    font-weight: 400;
    color: var(--patch-muted);
}

.editor-card .form-control,
.editor-card .form-select {
    min-height: 48px;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    box-shadow: none;
}

.editor-card .form-control:focus,
.editor-card .form-select:focus {
    border-color: rgba(37, 99, 235, 0.45);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.1);
}

.editor-section-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.editor-section-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.editor-section-label {
    margin-bottom: 0;
}

.editor-section-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 12px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    border: 1.5px solid transparent;
}

.editor-section-badge--신규 { background: var(--section-신규-bg); border-color: var(--section-신규-border); color: var(--section-신규-color); }
.editor-section-badge--버그 { background: var(--section-버그-bg); border-color: var(--section-버그-border); color: var(--section-버그-color); }
.editor-section-badge--수정 { background: var(--section-수정-bg); border-color: var(--section-수정-border); color: var(--section-수정-color); }
.editor-section-badge--조정 { background: var(--section-조정-bg); border-color: var(--section-조정-border); color: var(--section-조정-color); }

.editor-section-textarea {
    min-height: 120px;
    resize: none;
    overflow: hidden;
    line-height: 1.65;
}

.editor-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

/* ── 공개 목록 카드 ── */

.patch-note-list {
    display: grid;
    gap: 14px;
}

.patch-note-card {
    border-radius: 20px;
    border: 1.5px solid rgba(255,255,255,0.8);
    border-left: 3px solid transparent;
    background: rgba(255,255,255,0.84);
    box-shadow: var(--patch-card-shadow);
    backdrop-filter: blur(18px);
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease, background 0.22s ease;
    overflow: hidden;
}

.patch-note-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 28px 56px rgba(91, 184, 245, 0.18);
}

.patch-note-card.is-open {
    border-left-color: var(--patch-blue);
    background: rgba(255,255,255,0.96);
    box-shadow: 0 28px 56px rgba(91, 184, 245, 0.18);
}

.patch-note-card__summary {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 20px;
    border: 0;
    background: transparent;
    text-align: left;
    transition: background 0.18s ease;
}

.patch-note-card__summary:hover {
    background: rgba(37, 99, 235, 0.03);
}

.patch-note-card.is-open .patch-note-card__summary {
    border-bottom: 1px solid rgba(91, 184, 245, 0.18);
}

.patch-note-card__summary--static {
    cursor: default;
}
.patch-note-card__summary--static:hover {
    background: transparent;
}

.patch-note-card__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: flex-start;
    padding: 7px 14px;
    border-radius: 999px;
    background: linear-gradient(135deg, #1d4ed8, #3b82f6);
    color: #fff;
    font-size: 0.82rem;
    font-weight: 800;
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.2);
    flex-shrink: 0;
    white-space: nowrap;
}

.patch-note-card__new-badge {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    padding: 4px 9px;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    flex-shrink: 0;
    animation: new-badge-pulse 2s ease-in-out infinite;
}

@keyframes new-badge-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.72; transform: scale(0.94); }
}

.patch-note-card__meta {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    flex: 1;
}

.patch-note-card__meta strong {
    font-size: 1.05rem;
    font-weight: 900;
    letter-spacing: -0.02em;
    color: var(--patch-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.patch-note-card__meta small {
    color: var(--patch-muted);
    font-size: 0.86rem;
}

/* ── 토글 화살표 (SVG chevron) ── */

.patch-note-card__toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-left: auto;
    color: #8d9ab5;
    transition: transform 0.25s ease, color 0.2s ease;
}

.patch-note-card.is-open .patch-note-card__toggle {
    transform: rotate(180deg);
    color: var(--patch-blue);
}

/* ── 카드 본문 (슬라이드 애니메이션) ── */

.patch-note-card__body {
    max-height: 0;
    overflow: hidden;
    padding: 0 22px;
    transition: max-height 0.38s cubic-bezier(0.4, 0, 0.2, 1),
                padding-bottom 0.38s ease;
}

.patch-note-card__body.is-visible {
    max-height: 4000px;
    padding-bottom: 24px;
}

/* ── 렌더링 콘텐츠 ── */

.patch-note-rendered {
    color: var(--patch-ink);
    line-height: 1.8;
    padding-top: 18px;
}

.patch-note-rendered > :first-child { margin-top: 0; }

.patch-note-rendered h1,
.patch-note-rendered h2,
.patch-note-rendered h3,
.patch-note-rendered h4 {
    margin: 1.4em 0 0.6em;
    font-weight: 900;
    letter-spacing: -0.02em;
}
.patch-note-rendered h1 { font-size: 1.9rem; }
.patch-note-rendered h2 { font-size: 1.5rem; }
.patch-note-rendered h3 { font-size: 1.15rem; }

.patch-note-rendered p,
.patch-note-rendered ul,
.patch-note-rendered ol,
.patch-note-rendered table,
.patch-note-rendered blockquote {
    margin-bottom: 0.9rem;
}

.patch-note-rendered ul,
.patch-note-rendered ol {
    padding-left: 1.25rem;
}

.patch-note-rendered li + li { margin-top: 0.3rem; }

.patch-note-rendered hr {
    margin: 1.2rem 0;
    border: 0;
    border-top: 1px solid rgba(148, 163, 184, 0.25);
}

.patch-note-rendered table {
    width: 100%;
    overflow: hidden;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 14px;
}

.patch-note-rendered th,
.patch-note-rendered td {
    padding: 11px 13px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
    border-right: 1px solid rgba(148, 163, 184, 0.1);
    vertical-align: top;
}

.patch-note-rendered th {
    background: #f0f9ff;
    font-weight: 800;
}

.patch-note-rendered tr:last-child td { border-bottom: 0; }
.patch-note-rendered td:last-child,
.patch-note-rendered th:last-child { border-right: 0; }

.patch-note-rendered blockquote {
    margin-left: 0;
    padding: 13px 16px;
    border-left: 4px solid rgba(37, 99, 235, 0.4);
    background: var(--patch-blue-soft);
    border-radius: 0 14px 14px 0;
}

.patch-note-rendered code {
    padding: 0.16rem 0.42rem;
    border-radius: 7px;
    background: rgba(29, 78, 216, 0.08);
    color: #1d4ed8;
    font-size: 0.9em;
}

.patch-note-rendered pre {
    padding: 16px;
    border-radius: 14px;
    background: #1f2937;
    color: #f8fafc;
    overflow-x: auto;
}

.patch-note-rendered pre code {
    padding: 0;
    background: transparent;
    color: inherit;
}

.patch-loading-text {
    color: var(--patch-muted);
    font-size: 0.9rem;
}

/* ── 일반 본문 (general) ── */

.patch-general {
    padding-bottom: 2px;
}

/* ── 섹션 (신규/버그/수정/조정) ── */

.patch-section__title {
    display: inline-flex;
    align-items: center;
    padding: 4px 13px;
    margin-bottom: 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    border: 1.5px solid transparent;
}

.patch-section--신규 .patch-section__title { background: var(--section-신규-bg); border-color: var(--section-신규-border); color: var(--section-신규-color); }
.patch-section--버그 .patch-section__title { background: var(--section-버그-bg); border-color: var(--section-버그-border); color: var(--section-버그-color); }
.patch-section--수정 .patch-section__title { background: var(--section-수정-bg); border-color: var(--section-수정-border); color: var(--section-수정-color); }
.patch-section--조정 .patch-section__title { background: var(--section-조정-bg); border-color: var(--section-조정-border); color: var(--section-조정-color); }

.patch-section-divider {
    margin: 18px 0;
    border: 0;
    border-top: 1.5px dashed rgba(91, 184, 245, 0.28);
}

/* ── 빈 상태 ── */

.patch-empty-state {
    padding: 32px 24px;
    text-align: center;
    border-radius: 20px;
    background: rgba(255,255,255,0.72);
    color: var(--patch-muted);
    box-shadow: var(--patch-card-shadow);
}

/* ── 반응형 ── */

@media (max-width: 991.98px) {
    .admin-panel__layout {
        grid-template-columns: 1fr;
    }

    .preview-card {
        position: static;
    }
}

@media (max-width: 767.98px) {
    .patch-page {
        padding-top: 96px;
    }

    .patch-hero {
        margin-bottom: 44px;
    }

    .patch-note-card__summary {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .patch-note-card__toggle {
        margin-left: 0;
    }

    .editor-grid {
        grid-template-columns: 1fr;
    }

    /* 모바일 액션 버튼: 저장·미리보기는 나란히, 삭제는 아래 단독 행 */
    .editor-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .editor-actions #deleteNoteBtn {
        grid-column: 1 / -1;
    }
}
