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

body {
    font-family: 'Kalam', cursive;
    overflow: hidden;
    height: 100vh;
    background: #8B4513;
}

/* 로그인 화면 */
.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.wood-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 30%, rgba(139, 69, 19, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(160, 82, 45, 0.1) 0%, transparent 50%),
        linear-gradient(135deg, #D2B48C 0%, #DEB887 25%, #F5DEB3 50%, #DEB887 75%, #D2B48C 100%);
    background-size: 200px 200px, 300px 300px, 100% 100%;
}

.wood-background::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        repeating-linear-gradient(
            90deg,
            rgba(139, 69, 19, 0.03) 0px,
            rgba(139, 69, 19, 0.03) 1px,
            transparent 1px,
            transparent 50px
        ),
        repeating-linear-gradient(
            0deg,
            rgba(139, 69, 19, 0.02) 0px,
            rgba(139, 69, 19, 0.02) 1px,
            transparent 1px,
            transparent 80px
        );
}

.login-sticky-note {
    background: #FFEB3B;
    width: 200px;
    height: 200px;
    border-radius: 5px;
    box-shadow: 
        0 5px 15px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
    transform: rotate(-5deg);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: 'Caveat', cursive;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.login-sticky-note::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 15px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 15px;
}

.login-sticky-note:hover {
    transform: rotate(-3deg) scale(1.05);
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.google-icon {
    margin-bottom: 15px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* 스티키 노트 떨어지는 애니메이션 */
.falling {
    animation: fall 1s ease-in forwards;
}

@keyframes fall {
    0% {
        transform: rotate(-5deg) scale(1);
        opacity: 1;
    }
    100% {
        transform: rotate(15deg) translateY(100vh) scale(0.8);
        opacity: 0;
    }
}

/* 메인 앱 */
.app {
    width: 100vw;
    height: 100vh;
    position: relative;
}

.hidden {
    display: none !important;
}

/* 무한 캔버스 */
.canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: calc(100% - 80px);
    overflow: hidden;
    cursor: grab;
}

.canvas-container.grabbing {
    cursor: grabbing;
}

.canvas {
    position: absolute;
    width: 10000px;
    height: 10000px;
    transform-origin: 0 0;
    will-change: transform;
    /* transition은 JavaScript에서 동적으로 제어 */
}

.wood-texture {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 30%, rgba(139, 69, 19, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(160, 82, 45, 0.1) 0%, transparent 50%),
        linear-gradient(135deg, #D2B48C 0%, #DEB887 25%, #F5DEB3 50%, #DEB887 75%, #D2B48C 100%);
    background-size: 400px 400px, 600px 600px, 100% 100%;
}

.wood-texture::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        repeating-linear-gradient(
            90deg,
            rgba(139, 69, 19, 0.03) 0px,
            rgba(139, 69, 19, 0.03) 2px,
            transparent 2px,
            transparent 100px
        ),
        repeating-linear-gradient(
            0deg,
            rgba(139, 69, 19, 0.02) 0px,
            rgba(139, 69, 19, 0.02) 1px,
            transparent 1px,
            transparent 160px
        );
}

/* 스티키 노트 */
.sticky-note {
    position: absolute;
    width: 200px;
    min-height: 200px;
    border-radius: 5px;
    box-shadow: 
        0 5px 15px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    cursor: pointer;
    font-family: 'Caveat', cursive;
    font-size: 16px;
    line-height: 1.4;
    color: #333;
    padding: 20px 15px 15px;
    overflow: hidden;
    /* GPU 가속을 위한 최적화 */
    will-change: transform, left, top;
    transform: translateZ(0); /* GPU 레이어 강제 생성 */
    backface-visibility: hidden; /* 뒷면 렌더링 방지 */
    /* transition은 JavaScript에서 동적으로 제어 */
    animation: appearNote 0.5s ease-out;
}

.sticky-note::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 15px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 15px;
}

.sticky-note:hover {
    transform: scale(1.02);
    z-index: 10;
}

.sticky-note.draggable {
    cursor: grab;
}

.sticky-note.draggable:active {
    cursor: grabbing;
}

.note-content {
    position: relative;
    z-index: 2;
    margin-bottom: 10px;
}

.note-text {
    margin-bottom: 10px;
    word-wrap: break-word;
    line-height: 1.3;
}

.note-drawing {
    margin-top: 10px;
    max-width: 100%;
    height: auto;
    border-radius: 3px;
}

.note-author {
    position: absolute;
    bottom: 5px;
    right: 10px;
    font-size: 12px;
    opacity: 0.7;
    font-weight: 400;
    font-family: 'Kalam', cursive;
}

/* 드래그 가능한 노트 표시 */
.sticky-note.draggable::after {
    content: "⋮⋮";
    position: absolute;
    top: 5px;
    right: 5px;
    color: rgba(0, 0, 0, 0.3);
    font-size: 12px;
    line-height: 0.8;
}

@keyframes appearNote {
    0% {
        transform: scale(0) rotate(180deg);
        opacity: 0;
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* 도구바 */
.toolbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: rgba(139, 69, 19, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-top: 3px solid #8B4513;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.3);
}

.tool-group {
    display: flex;
    gap: 10px;
}

.tool-btn {
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tool-btn:hover {
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.tool-btn.active {
    background: #FFEB3B;
    box-shadow: 0 4px 12px rgba(255, 235, 59, 0.4);
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.9);
    padding: 10px 20px;
    border-radius: 25px;
}

.zoom-btn {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    background: #333;
    color: white;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

.zoom-btn:hover {
    background: #555;
    transform: scale(1.1);
}

#zoom-level {
    font-weight: 600;
    color: #333;
    min-width: 50px;
    text-align: center;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 15px;
    border-radius: 25px;
}

.user-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    border: 2px solid #fff;
}

.user-info span {
    font-weight: 600;
    color: #333;
}

.logout-btn {
    background: #f44336;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s ease;
}

.logout-btn:hover {
    background: #d32f2f;
}

/* 노트 에디터 모달 */
.note-editor-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.note-editor-content {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.note-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #eee;
    padding-bottom: 1rem;
}

.note-editor-header h3 {
    margin: 0;
    font-family: 'Caveat', cursive;
    font-size: 1.8rem;
    color: #333;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: #f0f0f0;
    color: #333;
}

/* 색상 선택기 */
.color-picker {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    justify-content: center;
}

.color-btn {
    width: 40px;
    height: 40px;
    border: 3px solid transparent;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.color-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.color-btn.selected {
    border-color: #333;
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* 통합 스티키 노트 프리뷰 */
.sticky-note-preview {
    background: #FFEB3B;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 1.5rem;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    transform: rotate(-1deg);
    transition: all 0.3s ease;
    position: relative;
}

.sticky-note-preview:hover {
    transform: rotate(0deg);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.note-tools {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    justify-content: center;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 8px;
}

.note-tools .tool-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.note-tools .tool-btn:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: scale(1.05);
}

.note-tools .tool-btn.active {
    background: #333;
    color: white;
    transform: scale(1.05);
}

.note-canvas-container {
    position: relative;
    width: 280px;
    height: 200px;
    margin: 0 auto;
    border-radius: 5px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.1);
}

#unified-canvas {
    position: absolute;
    top: 0;
    left: 0;
    cursor: crosshair;
    border-radius: 5px;
}

#note-text-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    outline: none;
    resize: none;
    font-family: 'Caveat', cursive;
    font-size: 18px;
    color: #333;
    padding: 10px;
    line-height: 1.4;
    pointer-events: none;
    border-radius: 5px;
}

#note-text-overlay.text-mode {
    pointer-events: all;
    cursor: text;
}

#note-text-overlay::placeholder {
    color: #666;
    opacity: 0.7;
}

/* 노트 액션 버튼 */
.note-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.save-btn, .cancel-btn {
    padding: 0.8rem 2rem;
    border: none;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Kalam', cursive;
}

.save-btn {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.cancel-btn {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    color: white;
    box-shadow: 0 4px 15px rgba(244, 67, 54, 0.3);
}

.cancel-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(244, 67, 54, 0.4);
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .note-editor-content {
        width: 95%;
        padding: 1.5rem;
    }
    
    .sticky-note-preview {
        transform: rotate(0deg);
    }
    
    .note-canvas-container {
        width: 100%;
        max-width: 280px;
    }
    
    .sticky-note {
        width: 160px;
        min-height: 120px;
        font-size: 14px;
    }
}

/* 커서 스타일 */
.canvas-container.note-mode {
    cursor: crosshair;
}

.canvas-container.move-mode {
    cursor: grab;
}

.canvas-container.move-mode.grabbing {
    cursor: grabbing;
}

/* 연결 상태 표시기 */
.connection-status {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 9999;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.connection-status .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.connection-status.connected .status-dot {
    background: #4CAF50;
    box-shadow: 0 0 6px #4CAF50;
}

.connection-status.connecting .status-dot {
    background: #FF9800;
    animation: pulse 1s infinite;
}

.connection-status.disconnected .status-dot {
    background: #f44336;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* 알림 메시지 */
.notification {
    position: fixed;
    top: 80px;
    right: 20px;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 9998;
    backdrop-filter: blur(10px);
    animation: slideIn 0.3s ease;
    max-width: 300px;
    word-wrap: break-word;
}

.notification.info {
    border-left: 4px solid #2196F3;
}

.notification.success {
    border-left: 4px solid #4CAF50;
}

.notification.warning {
    border-left: 4px solid #FF9800;
}

.notification.error {
    border-left: 4px solid #f44336;
}

.notification.fade-out {
    animation: slideOut 0.3s ease forwards;
}

@keyframes slideIn {
    0% {
        transform: translateX(100%);
        opacity: 0;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    0% {
        transform: translateX(0);
        opacity: 1;
    }
    100% {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* 지연시간 모니터 */
#latency-monitor {
    position: fixed;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 11px;
    z-index: 9999;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    min-width: 160px;
}

.latency-title {
    font-weight: bold;
    margin-bottom: 8px;
    font-size: 12px;
    color: #4CAF50;
    text-align: center;
}

.latency-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
    align-items: center;
}

.latency-item span:first-child {
    opacity: 0.8;
}

.latency-item span:last-child {
    font-weight: bold;
}

.latency-item .good {
    color: #4CAF50;
}

.latency-item .ok {
    color: #FF9800;
}

.latency-item .bad {
    color: #f44336;
} 