:root {
    /* Colors - Pastel Dream Theme */
    --bg-primary: #FFFDF5;
    /* 淡いクリーム */
    --bg-secondary: #FFE4E1;
    /* パステルピンク */
    --bg-tertiary: #FFFFFF;
    /* 純白（カード用） */
    --text-primary: #4A4A4A;
    /* 柔らかい炭色 */
    --text-secondary: #8E8E8E;
    /* グレー */
    --accent: #B19CD9;
    /* パステルパープル */
    --accent-hover: #D1B3FF;
    /* 明るいパープル */
    --accent-soft: #F0E6FF;
    /* 非常に薄いパープル */
    --border: #F0EAD6;
    /* 薄いベージュ */
    --danger: #FFB7B2;
    /* パステルレッド */
    --shadow: 0 8px 24px rgba(187, 134, 252, 0.08);
    --shadow-hover: 0 12px 32px rgba(187, 134, 252, 0.15);
    --transition: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    /* 弾むようなアニメーション */
}

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

body {
    font-family: 'M PLUS Rounded 1c', 'Inter', -apple-system, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100%;
}

/* Sidebar */
.sidebar {
    width: 320px;
    background-color: var(--bg-secondary);
    border-right: 2px border solid var(--border);
    display: flex;
    flex-direction: column;
    position: relative;
    border-radius: 0 32px 32px 0;
    /* 右側だけ丸める */
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.02);
    z-index: 5;
}

.sidebar-header {
    padding: 2rem 1.5rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: -0.5px;
}

.icon-btn {
    background: var(--bg-tertiary);
    border: none;
    color: var(--accent);
    width: 44px;
    height: 44px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.icon-btn:hover {
    transform: translateY(-3px) scale(1.05);
    background-color: var(--accent);
    color: white;
    box-shadow: 0 6px 15px rgba(177, 156, 217, 0.3);
}

.icon-btn.danger:hover {
    background-color: var(--danger);
    box-shadow: 0 6px 15px rgba(255, 183, 178, 0.4);
}

.search-container {
    padding: 0 1.5rem 1.5rem;
}

.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

#search-input {
    width: 100%;
    background-color: var(--bg-tertiary);
    border: 2px solid transparent;
    border-radius: 18px;
    padding: 12px 16px 12px 42px;
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: var(--transition);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

#search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 4px 15px rgba(177, 156, 217, 0.15);
}

.search-icon {
    position: absolute;
    left: 14px;
    width: 18px;
    height: 18px;
    color: var(--accent);
}

.note-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 1rem;
}

/* Custom Scrollbar */
.note-list::-webkit-scrollbar {
    width: 6px;
}

.note-list::-webkit-scrollbar-thumb {
    background: rgba(177, 156, 217, 0.2);
    border-radius: 10px;
}

.note-item {
    padding: 1.2rem;
    margin-bottom: 0.8rem;
    cursor: pointer;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 20px;
    border: 2px solid transparent;
    transition: var(--transition);
}

.note-item:hover {
    background-color: var(--bg-tertiary);
    transform: translateX(5px);
    box-shadow: var(--shadow);
}

.note-item.active {
    background-color: var(--bg-tertiary);
    border-color: var(--accent);
    transform: scale(1.02);
    box-shadow: var(--shadow);
}

.note-item-title {
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text-primary);
    font-size: 1rem;
}

.note-item.active .note-item-title {
    color: var(--accent);
}

.note-item-date {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Sidebar Mascot */
.sidebar-footer {
    padding: 1rem;
    text-align: center;
    position: relative;
}

.sidebar-bubble {
    position: absolute;
    bottom: 85%;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 8px 16px;
    border-radius: 15px;
    box-shadow: 0 4px 12px rgba(187, 134, 252, 0.15);
    border: 2px solid var(--accent-soft);
    white-space: nowrap;
    z-index: 10;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.sidebar-bubble::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 8px 8px 0 8px;
    border-style: solid;
    border-color: white transparent transparent transparent;
}

.sidebar-footer:hover .sidebar-bubble {
    opacity: 1;
    visibility: visible;
    bottom: 95%;
}

.sidebar-bubble span {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent);
}

.sidebar-mascot {
    width: 100px;
    height: auto;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
    transition: var(--transition);
}

.sidebar-mascot:hover {
    transform: scale(1.1) rotate(5deg);
}

/* Editor */
.editor {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-primary);
    padding-left: 20px;
    /* サイドバーの丸みから離す */
}

.editor-header {
    height: 80px;
    padding: 0 2.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.editor-meta {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.editor-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0 2.5rem 2.5rem;
    position: relative;
}

#note-title {
    background: transparent;
    border: none;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    width: 100%;
    font-family: inherit;
}

#note-title:focus {
    outline: none;
}

#note-body {
    background: var(--bg-tertiary);
    border: none;
    flex: 1;
    font-size: 1.2rem;
    color: var(--text-primary);
    resize: none;
    width: 100%;
    line-height: 1.8;
    padding: 2rem;
    border-radius: 32px;
    box-shadow: var(--shadow);
    font-family: inherit;
}

#note-body:focus {
    outline: none;
    box-shadow: var(--shadow-hover);
}

/* Empty State */
.empty-state {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-primary);
    z-index: 10;
}

.empty-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.empty-mascot {
    width: 250px;
    height: auto;
    margin-bottom: 2rem;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.1));
    animation: floating 3s ease-in-out infinite;
}

.speech-bubble {
    background: white;
    padding: 1.5rem 2.5rem;
    border-radius: 30px;
    position: relative;
    box-shadow: var(--shadow);
    border: 3px solid var(--accent-soft);
}

.speech-bubble::after {
    content: '';
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 0 15px 15px 15px;
    border-style: solid;
    border-color: transparent transparent white transparent;
}

.speech-bubble p {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent);
}

@keyframes floating {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-15px);
    }
}

/* Mobile & Responsive */
.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: absolute;
        z-index: 20;
        height: 100%;
        transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
        border-radius: 0;
    }

    .sidebar.hidden {
        transform: translateX(-100%);
    }

    .editor {
        width: 100%;
        padding-left: 0;
    }

    .editor-header {
        padding: 0 1.5rem;
    }

    .editor-content {
        padding: 0 1.5rem 1.5rem;
    }

    #note-title {
        font-size: 1.8rem;
    }

    .mobile-only {
        display: flex;
    }
}