:root {
    --primary: #ff6b8a;
    --primary-dark: #e84a6f;
    --bg-dark: #1a1215;
    --bg-card: #2a1f22;
    --text-light: #fff5f7;
    --text-muted: #b8a5a9;
    --gold: #ffd700;
    --accent: #ff8fa3;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
}

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text-light);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
}

/* ==================== 컨테이너 ==================== */
.birthday-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
    padding-bottom: 100px; /* FAB 버튼 공간 */
}

/* ==================== 컨페티 ==================== */
.confetti {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

@keyframes confetti-fall {
    0% { transform: translateY(-100px) rotate(0deg); opacity: 0; }
    10% { opacity: 0.7; }
    90% { opacity: 0.7; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* ==================== 헤더 ==================== */
.birthday-header {
    text-align: center;
    padding: 1rem 0 2rem;
    position: relative;
    z-index: 1;
}

.back-btn {
    display: inline-block;
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    transition: all 0.3s;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.back-btn:hover {
    color: var(--primary);
    background: rgba(255, 107, 138, 0.1);
}

.birthday-title {
    font-family: 'Gowun Batang', serif;
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
    animation: bounce 1s ease infinite;
}

.birthday-subtitle {
    font-size: 1rem;
    color: var(--accent);
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

/* ==================== 메시지 섹션 ==================== */
.messages-section {
    position: relative;
    z-index: 1;
}

.messages-section h2 {
    font-family: 'Gowun Batang', serif;
    font-size: 1.5rem;
    color: var(--primary);
    text-align: center;
    margin-bottom: 1.5rem;
}

.messages-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.message-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 1.2rem;
    border: 1px solid rgba(255, 107, 138, 0.2);
    transition: all 0.3s;
    position: relative;
}

.message-card:active {
    transform: scale(0.98);
}

.message-emoji {
    font-size: 1.8rem;
    margin-bottom: 0.8rem;
}

.message-content {
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 0.8rem;
    color: var(--text-light);
    word-break: break-word;
}

.message-author {
    font-size: 0.85rem;
    color: var(--accent);
    text-align: right;
}

.empty-messages {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-messages-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* ==================== FAB 버튼 (메시지 작성) ==================== */
.fab-button {
    position: fixed;
    bottom: 2rem;
    right: 1.5rem;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(255, 107, 138, 0.4);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.fab-button:hover {
    transform: scale(1.1);
}

.fab-button:active {
    transform: scale(0.95);
}

/* ==================== 모달 ==================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 2000;
    display: none;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border-radius: 24px 24px 0 0;
    padding: 1.5rem;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid rgba(255, 107, 138, 0.3);
    border-bottom: none;
    position: relative;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-handle {
    width: 40px;
    height: 4px;
    background: var(--text-muted);
    border-radius: 2px;
    margin: 0 auto 1.5rem;
    opacity: 0.5;
}

.modal-title {
    font-family: 'Gowun Batang', serif;
    font-size: 1.3rem;
    color: var(--primary);
    text-align: center;
    margin-bottom: 1.5rem;
}

/* ==================== 폼 ==================== */
.form-group {
    margin-bottom: 1.2rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 1rem;
    border: 2px solid rgba(255, 107, 138, 0.3);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-light);
    font-size: 1rem;
    font-family: 'Pretendard', sans-serif;
    outline: none;
    transition: border-color 0.3s;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--primary);
}

.form-group textarea {
    min-height: 100px;
    resize: none;
}

/* 이모지 선택 */
.emoji-selector {
    display: flex;
    justify-content: center;
    gap: 0.8rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.emoji-option {
    font-size: 1.8rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 12px;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.emoji-option:active {
    transform: scale(0.9);
}

.emoji-option.selected {
    border-color: var(--primary);
    background: rgba(255, 107, 138, 0.2);
    transform: scale(1.1);
}

/* 제출 버튼 */
.submit-btn {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.submit-btn:hover {
    box-shadow: 0 8px 20px rgba(255, 107, 138, 0.3);
}

.submit-btn:active {
    transform: scale(0.98);
}

.submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==================== 반응형 - 태블릿 이상 ==================== */
@media (min-width: 768px) {
    .birthday-container {
        padding: 2rem;
        padding-bottom: 3rem;
    }

    .birthday-title {
        font-size: 2.5rem;
    }

    .messages-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }

    .message-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 10px 30px rgba(255, 107, 138, 0.2);
    }

    .fab-button {
        bottom: 3rem;
        right: 3rem;
    }

    .modal-overlay {
        align-items: center;
        padding: 2rem;
    }

    .modal {
        border-radius: 24px;
        border: 1px solid rgba(255, 107, 138, 0.3);
        max-height: 80vh;
    }

    .modal-handle {
        display: none;
    }
}

/* ==================== 반응형 - 작은 모바일 ==================== */
@media (max-width: 360px) {
    html {
        font-size: 14px;
    }

    .birthday-title {
        font-size: 1.7rem;
    }

    .fab-button {
        width: 54px;
        height: 54px;
        font-size: 1.5rem;
        bottom: 1.5rem;
        right: 1rem;
    }

    .emoji-option {
        font-size: 1.5rem;
        padding: 0.4rem;
    }
}

/* ==================== Safe Area (노치 대응) ==================== */
@supports (padding: max(0px)) {
    .birthday-container {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
        padding-bottom: max(100px, calc(80px + env(safe-area-inset-bottom)));
    }

    .fab-button {
        bottom: max(2rem, calc(1rem + env(safe-area-inset-bottom)));
        right: max(1.5rem, env(safe-area-inset-right));
    }

    .modal {
        padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
    }
}
