:root {
    --sky: #dceefe;
    --sky-deep: #b7dafc;
    --white: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --line: #e5e7eb;
    --panel: #f8fafc;
    --panel-deep: #eef2f7;
    --blue: #6aa9ff;
    --blue-dark: #4f8ff0;
    --danger: #ef4444;
    --success: #16a34a;
    --shadow: 0 20px 50px rgba(15, 23, 42, 0.12);
    --radius-xl: 24px;
    --radius-lg: 18px;
    --radius-md: 14px;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Pretendard', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text);
    background: #f6f8fb;
}

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

button, input, textarea {
    font: inherit;
}

button {
    cursor: pointer;
    border: none;
}

.landing-page {
    min-height: 100vh;
    background: linear-gradient(180deg, var(--sky) 0%, #cfe7ff 100%);
}

.landing-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.landing-card {
    text-align: center;
    max-width: 720px;
}

.site-title {
    margin: 0;
    font-size: clamp(52px, 10vw, 100px);
    font-weight: 800;
    color: var(--white);
    letter-spacing: 0.08em;
}

.site-subtitle {
    margin: 18px 0 36px;
    color: rgba(255, 255, 255, 0.92);
    font-size: 18px;
}

.landing-actions {
    display: flex;
    flex-direction: column;
    gap: 14px;
    align-items: center;
}

.large-btn {
    min-width: 260px;
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.new-diary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 14px 22px;
    font-weight: 600;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
}

.primary-btn {
    background: var(--blue);
    color: white;
    box-shadow: 0 10px 25px rgba(106, 169, 255, 0.35);
}

.primary-btn:hover {
    background: var(--blue-dark);
    transform: translateY(-1px);
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.94);
    color: #3c5c8f;
}

.secondary-btn:hover {
    transform: translateY(-1px);
}

.ghost-btn {
    background: #eef4ff;
    color: #496a9a;
    padding: 10px 16px;
}

.new-diary-btn {
    width: 100%;
    margin-top: 20px;
    background: #eff6ff;
    color: #3669ab;
    border: 1px solid #d7e6ff;
}

.auth-page {
    min-height: 100vh;
    background: linear-gradient(180deg, #eaf4ff 0%, #f7fbff 100%);
}

.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 460px;
    background: rgba(255, 255, 255, 0.96);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    padding: 32px;
}

.auth-header h1 {
    margin: 16px 0 8px;
    font-size: 30px;
}

.auth-header p {
    margin: 0 0 24px;
    color: var(--muted);
}

.back-link {
    color: #5c86bf;
    font-size: 14px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-form label,
.form-label {
    font-size: 14px;
    font-weight: 600;
    color: #475569;
}

.auth-form input,
.title-input,
.content-textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
    padding: 14px 16px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-form input:focus,
.title-input:focus,
.content-textarea:focus {
    border-color: #9ec8ff;
    box-shadow: 0 0 0 4px rgba(158, 200, 255, 0.22);
}

.auth-footer-link {
    margin-top: 18px;
    text-align: center;
}

.text-link {
    color: #5f84b9;
    font-weight: 600;
}

.alert {
    margin-bottom: 16px;
    border-radius: 14px;
    padding: 14px 16px;
    font-size: 14px;
}

.alert.error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.alert.success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.modal-open .auth-wrapper {
    filter: blur(5px);
}

.modal-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.25);
}

.modal-box {
    width: 100%;
    max-width: 420px;
    background: white;
    border-radius: 24px;
    box-shadow: var(--shadow);
    padding: 32px;
    text-align: center;
}

.modal-box h2 {
    margin-top: 0;
    margin-bottom: 10px;
}

.modal-box p {
    margin-top: 0;
    margin-bottom: 22px;
    color: var(--muted);
}

.dashboard-page {
    min-height: 100vh;
    background: #f6f8fb;
}

.dashboard-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: #fbfdff;
    border-right: 1px solid var(--line);
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sidebar-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.sidebar-brand {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 0.05em;
}

.sidebar-user {
    margin-top: 6px;
    color: var(--muted);
    font-size: 14px;
}

.diary-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
    overflow-y: auto;
    padding-right: 4px;
}

.empty-list-box {
    border: 1px dashed #c9d7ea;
    border-radius: 16px;
    background: #f8fbff;
    padding: 20px;
    color: var(--muted);
    line-height: 1.6;
}

.diary-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid #edf2f7;
    background: white;
    border-radius: 18px;
    padding: 10px 12px;
}

.diary-item.active {
    border-color: #cde1ff;
    box-shadow: 0 8px 24px rgba(133, 174, 231, 0.14);
    background: #f8fbff;
}

.diary-link {
    flex: 1;
    min-width: 0;
}

.diary-title {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.diary-date {
    margin-top: 6px;
    color: var(--muted);
    font-size: 13px;
}

.more-menu-wrap {
    position: relative;
}

.more-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f3f6fb;
    color: #4b5563;
    font-size: 22px;
    line-height: 1;
}

.more-menu {
    position: absolute;
    top: 44px;
    right: 0;
    min-width: 120px;
    background: white;
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.14);
    padding: 8px;
    display: none;
    z-index: 20;
}

.more-menu.show {
    display: block;
}

.more-menu a,
.more-menu button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    border-radius: 10px;
    background: transparent;
    color: #374151;
}

.more-menu a:hover,
.more-menu button:hover {
    background: #f4f7fb;
}

.more-menu .delete-option {
    color: #c2410c;
}

.main-panel {
    padding: 28px;
}

.editor-shell {
    max-width: 960px;
    margin: 0 auto;
    background: white;
    border: 1px solid #edf2f7;
    border-radius: 28px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.06);
    padding: 28px;
}

.editor-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.editor-heading {
    margin: 0;
    font-size: 32px;
}

.editor-subheading {
    margin: 8px 0 0;
    color: var(--muted);
}

.diary-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.title-input {
    font-size: 22px;
    font-weight: 700;
    padding: 18px 20px;
}

.upload-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.upload-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #f3f7ff;
    border: 1px solid #dbe8ff;
    color: #355b96;
    padding: 12px 16px;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 600;
}

.upload-plus {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: white;
    font-size: 20px;
}

#images {
    display: none;
}

.upload-help {
    color: var(--muted);
    font-size: 14px;
}

.image-section {
    margin-top: 8px;
}

.image-section-title {
    margin-bottom: 12px;
    font-weight: 700;
    color: #475569;
}

.image-slider {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    padding-bottom: 10px;
    scroll-snap-type: x proximity;
}

.image-card {
    flex: 0 0 auto;
    width: 220px;
    border-radius: 20px;
    background: #f8fafc;
    border: 1px solid #e7edf6;
    overflow: hidden;
    scroll-snap-align: start;
}

.image-card img {
    display: block;
    width: 100%;
    height: 220px;
    object-fit: cover;
}

.image-caption {
    padding: 10px 12px;
    font-size: 13px;
    color: var(--muted);
}

.selectable-card {
    cursor: pointer;
}

.image-remove-check {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px 14px;
    font-size: 14px;
    color: #475569;
}

.content-textarea {
    min-height: 360px;
    resize: vertical;
    line-height: 1.7;
    padding: 18px 20px;
}

.meta-box {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    color: var(--muted);
    font-size: 13px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 6px;
}

.submit-btn {
    min-width: 150px;
}

@media (max-width: 980px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        border-right: none;
        border-bottom: 1px solid var(--line);
    }
}

@media (max-width: 640px) {
    .auth-card,
    .editor-shell {
        padding: 22px;
        border-radius: 22px;
    }

    .main-panel {
        padding: 16px;
    }

    .editor-heading {
        font-size: 26px;
    }

    .title-input {
        font-size: 18px;
    }

    .image-card {
        width: 180px;
    }

    .image-card img {
        height: 180px;
    }
}
