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

:root {
    --bg-primary: #fafaf8;
    --bg-secondary: #ffffff;
    --text-primary: #2c2c2c;
    --text-secondary: #666666;
    --border-color: #e0e0e0;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.12);
    --transition: all 0.3s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

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

/* ヘッダー */
header {
    text-align: center;
    padding: 40px 0 30px;
    background: linear-gradient(135deg, #fafaf8 0%, #f0f0e8 100%);
    border-bottom: 1px solid var(--border-color);
}

h1 {
    font-size: 2.5rem;
    font-weight: 300;
    margin-bottom: 10px;
    letter-spacing: 0.1em;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* 検索セクション */
.search-section {
    margin: 30px 0;
    background: var(--bg-secondary);
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

#searchInput {
    width: 100%;
    padding: 12px 20px;
    font-size: 16px;
    border: 2px solid var(--border-color);
    border-radius: 25px;
    transition: var(--transition);
    font-family: inherit;
}

#searchInput:focus {
    outline: none;
    border-color: #a0d8ef;
    box-shadow: 0 0 0 3px rgba(160, 216, 239, 0.2);
}

.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
    justify-content: center;
}

.filter-btn {
    padding: 8px 20px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    border-radius: 20px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
    font-family: inherit;
}

.filter-btn:hover {
    background: #f5f5f5;
    transform: translateY(-1px);
}

.filter-btn.active {
    background: #384148;
    color: white;
    border-color: #384148;
}

/* 色グリッド */
.colors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.color-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 15px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow);
    text-align: center;
}

.color-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.color-sample {
    width: 100%;
    height: 80px;
    border-radius: 8px;
    margin-bottom: 12px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.color-card h3 {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 4px;
}

.color-yomi {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.color-hex {
    font-size: 0.8rem;
    font-family: 'Monaco', 'Menlo', monospace;
    color: var(--text-secondary);
}

/* パレットセクション */
.palette-section {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 30px;
    margin: 40px 0;
    box-shadow: var(--shadow);
}

.palette-section h2 {
    font-size: 1.5rem;
    font-weight: 400;
    margin-bottom: 20px;
    text-align: center;
}

.palette-container {
    display: flex;
    gap: 15px;
    justify-content: center;
    align-items: center;
    min-height: 100px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.palette-hint {
    color: var(--text-secondary);
    text-align: center;
    font-size: 0.95rem;
}

.palette-color {
    width: 100px;
    height: 100px;
    border-radius: 8px;
    position: relative;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid rgba(0, 0, 0, 0.1);
}

.palette-color:hover {
    transform: scale(1.05);
}

.palette-color-name {
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.85rem;
    white-space: nowrap;
}

.remove-color {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    opacity: 0;
    transition: var(--transition);
}

.palette-color:hover .remove-color {
    opacity: 1;
}

.palette-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

.palette-actions button {
    padding: 10px 25px;
    border: none;
    border-radius: 25px;
    background: #384148;
    color: white;
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
    font-family: inherit;
}

.palette-actions button:hover {
    background: #2c3238;
    transform: translateY(-2px);
}

/* モーダル */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: var(--bg-secondary);
    margin: 5% auto;
    padding: 30px;
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.close:hover {
    color: #000;
}

/* 色詳細 */
.color-detail {
    text-align: center;
}

.color-detail-sample {
    width: 200px;
    height: 200px;
    margin: 0 auto 20px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.color-detail h2 {
    font-size: 2rem;
    margin-bottom: 8px;
}

.color-detail-yomi {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.color-detail-desc {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.color-detail-info {
    background: var(--bg-primary);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.color-detail-info p {
    margin: 8px 0;
}

.add-to-palette-btn {
    padding: 12px 30px;
    border: none;
    border-radius: 25px;
    background: #384148;
    color: white;
    cursor: pointer;
    transition: var(--transition);
    font-size: 16px;
}

.add-to-palette-btn:hover {
    background: #2c3238;
    transform: translateY(-2px);
}

/* エクスポート */
.export-section {
    margin-bottom: 25px;
}

.export-section h4 {
    margin-bottom: 10px;
    color: var(--text-primary);
}

.export-code {
    display: block;
    background: var(--bg-primary);
    padding: 12px;
    border-radius: 6px;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 14px;
    margin-bottom: 10px;
    overflow-x: auto;
}

.export-section button {
    padding: 8px 20px;
    border: none;
    border-radius: 20px;
    background: #384148;
    color: white;
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
}

.export-section button:hover {
    background: #2c3238;
}

/* 通知 */
.notification {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #384148;
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    animation: slideIn 0.3s ease;
    z-index: 2000;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
    }
    to {
        transform: translateX(0);
    }
}

/* フッター */
footer {
    text-align: center;
    padding: 40px 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
    border-top: 1px solid var(--border-color);
}

/* レスポンシブ */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }
    
    .colors-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 15px;
    }
    
    .palette-color {
        width: 80px;
        height: 80px;
    }
    
    .modal-content {
        margin: 10% auto;
        padding: 20px;
    }
    
    .color-detail-sample {
        width: 150px;
        height: 150px;
    }
}