* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* PWA 관련 스타일 */
.pwa-install-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 50px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
    z-index: 1000;
    display: none;
    transition: all 0.3s ease;
    font-family: 'Noto Sans KR', sans-serif;
}

.pwa-install-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(76, 175, 80, 0.4);
    background: #45a049;
}

.pwa-install-btn i {
    margin-right: 8px;
}

.connection-status {
    position: fixed;
    top: 10px;
    right: 10px;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    z-index: 1001;
    font-family: 'Noto Sans KR', sans-serif;
    transition: all 0.3s ease;
}

.connection-status.online {
    background: #4CAF50;
    color: white;
}

.connection-status.offline {
    background: #f44336;
    color: white;
}

/* PWA 설치 프롬프트 스타일 */
@media (display-mode: standalone) {
    body {
        padding-top: 0;
    }
    
    .pwa-install-btn {
        display: none !important;
    }
}

/* 모바일 최적화 */
@media (max-width: 768px) {
    .pwa-install-btn {
        bottom: 15px;
        right: 15px;
        padding: 10px 16px;
        font-size: 13px;
    }
    
    .connection-status {
        top: 5px;
        right: 5px;
        font-size: 11px;
        padding: 3px 6px;
    }
}

body {
    font-family: 'Noto Sans KR', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

/* 헤더 스타일 */
.header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.header .subtitle {
    font-size: 1.1rem;
    font-weight: 300;
    opacity: 0.9;
}

/* 광고 섹션 스타일 */
.ad-section {
    margin-bottom: 30px;
    animation: slideInDown 0.6s ease-out;
    display: none; /* 초기에는 숨김 */
}

.ad-container {
    background: linear-gradient(135deg, #ff6b6b 0%, #ffa500 100%);
    border-radius: 16px;
    padding: 20px;
    position: relative;
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
}

.ad-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
    animation: shimmer 3s infinite;
}

.ad-content {
    display: flex;
    align-items: center;
    gap: 20px;
    position: relative;
    z-index: 1;
}

.ad-badge {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.ad-text {
    flex: 1;
    color: white;
}

.ad-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 5px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.ad-description {
    font-size: 0.95rem;
    opacity: 0.95;
    line-height: 1.4;
    margin: 0;
}

.ad-link {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    text-decoration: none;
    padding: 10px 18px;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.ad-link:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.ad-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    /* 모바일 터치 최적화 */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    z-index: 2;
}

.ad-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* 모바일에서 터치 시 시각적 피드백 */
.ad-close-btn:active {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(0.95);
}

/* 광고 애니메이션 */
@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* 메모 폼 스타일 */
.memo-form {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#memoTitle {
    padding: 15px 20px;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.8);
}

#memoTitle:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background: white;
}

#memoContent {
    padding: 20px;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    min-height: 120px;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.8);
}

#memoContent:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background: white;
}

.form-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.char-count {
    color: #666;
    font-size: 0.9rem;
    font-weight: 500;
}

.add-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.add-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.add-btn:active {
    transform: translateY(0);
}

/* 메모 컨테이너 스타일 */
.memo-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.memo-stats {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.memo-stats span {
    color: #667eea;
    font-weight: 600;
    font-size: 1.1rem;
}

.memo-list {
    display: grid;
    gap: 20px;
}

/* 개별 메모 스타일 */
.memo-item {
    background: white;
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border: 1px solid #f0f0f0;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.memo-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2);
}

.memo-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}

.memo-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.memo-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: #333;
    margin: 0;
    flex: 1;
    margin-right: 15px;
}

.memo-date {
    color: #888;
    font-size: 0.9rem;
    font-weight: 400;
}

.memo-content {
    color: #555;
    line-height: 1.6;
    margin-bottom: 20px;
    white-space: pre-wrap;
}

.memo-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.action-btn {
    background: none;
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.edit-btn {
    color: #667eea;
}

.edit-btn:hover {
    background: rgba(102, 126, 234, 0.1);
}

.delete-btn {
    color: #e74c3c;
}

.delete-btn:hover {
    background: rgba(231, 76, 60, 0.1);
}

/* 빈 상태 스타일 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: rgba(255, 255, 255, 0.8);
    display: none;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.6;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    font-weight: 500;
}

.empty-state p {
    font-size: 1rem;
    opacity: 0.8;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .memo-form {
        padding: 20px;
    }
    
    .memo-container {
        padding: 20px;
    }
    
    .form-footer {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .add-btn {
        width: 100%;
        justify-content: center;
    }

    /* 모바일 광고 최적화 */
    .ad-section {
        margin-bottom: 20px;
    }

    .ad-container {
        padding: 15px;
        border-radius: 12px;
    }

    .ad-content {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .ad-badge {
        align-self: center;
        font-size: 0.75rem;
        padding: 6px 10px;
    }

    .ad-title {
        font-size: 1.1rem;
        text-align: center;
    }

    .ad-description {
        font-size: 0.9rem;
        text-align: center;
    }

    .ad-link {
        width: 100%;
        justify-content: center;
        padding: 12px 20px;
        font-size: 0.95rem;
    }

    .ad-close-btn {
        top: 10px;
        right: 10px;
        width: 28px;
        height: 28px;
    }
}

/* 작은 모바일 화면 최적화 */
@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .header h1 {
        font-size: 1.8rem;
    }
    
    .header .subtitle {
        font-size: 1rem;
    }

    .ad-container {
        padding: 12px;
    }

    .ad-title {
        font-size: 1rem;
    }

    .ad-description {
        font-size: 0.85rem;
    }

    .ad-link {
        padding: 10px 16px;
        font-size: 0.9rem;
    }
}

/* 애니메이션 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.memo-item {
    animation: fadeInUp 0.5s ease-out;
}

/* 스크롤바 스타일 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 메모 개수 제한 관련 스타일 */
.memo-count-limit {
    color: #e74c3c;
    font-weight: 600;
}

.memo-count-limit.warning {
    color: #f39c12;
}

#addMemoBtn:disabled {
    background: #95a5a6 !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
}

#addMemoBtn:disabled:hover {
    background: #95a5a6 !important;
    transform: none !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
}

/* 메모 개수가 최대에 도달했을 때의 시각적 피드백 */
.memo-limit-reached {
    position: relative;
}

.memo-limit-reached::after {
    content: "최대 7개";
    position: absolute;
    top: -25px;
    right: 0;
    background: #e74c3c;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    opacity: 0.9;
}
