/* オレンジと深い青の配色 */
:root {
    --primary-color: #ea580c;      /* オレンジ */
    --secondary-color: #1e40af;     /* 深い青 */
    --accent-color: #f97316;        /* 明るいオレンジ */
    --background: #fffbeb;          /* 薄いオレンジの背景 */
    --card-bg: #ffffff;             /* 白 */
    --text-color: #1f2937;          /* ダークグレー */
    --border-color: #fed7aa;        /* 薄いオレンジの境界 */
    --success-color: #10b981;       /* 緑 */
    --warning-color: #f59e0b;       /* 警告色 */
    --error-color: #ef4444;         /* エラー色 */
    --highlight-bg: #fef3c7;        /* ハイライト背景 */
    --active-bg: #dc2626;           /* アクティブ背景 */
    --emoji-hover: #f0f9ff;         /* 絵文字ホバー */
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--background);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    margin-bottom: 40px;
    padding: 40px 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 20px;
    color: white;
    box-shadow: 0 10px 30px rgba(234, 88, 12, 0.3);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

main {
    flex: 1;
}

.tool-section {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    border: 2px solid var(--border-color);
}

.search-section {
    margin-bottom: 30px;
}

.search-bar {
    position: relative;
    margin-bottom: 15px;
}

.search-bar input {
    width: 100%;
    padding: 15px 50px 15px 20px;
    border: 2px solid var(--border-color);
    border-radius: 25px;
    font-size: 1.1rem;
    transition: border-color 0.3s ease;
    background: white;
}

.search-bar input:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

.clear-btn {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--error-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background-color 0.3s ease;
}

.clear-btn:hover {
    background: #dc2626;
}

.search-options {
    display: flex;
    gap: 25px;
    flex-wrap: wrap;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-color);
}

.checkbox-label input[type="checkbox"] {
    margin-right: 8px;
    accent-color: var(--secondary-color);
}

.category-section {
    margin-bottom: 30px;
}

.category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.category-tab {
    background: white;
    border: 2px solid var(--border-color);
    padding: 10px 16px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-color);
    white-space: nowrap;
}

.category-tab:hover {
    border-color: var(--secondary-color);
    transform: translateY(-2px);
}

.category-tab.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 5px 15px rgba(234, 88, 12, 0.3);
}

.emoji-grid-container {
    margin-bottom: 30px;
}

.grid-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.emoji-count {
    color: var(--secondary-color);
    font-weight: 600;
}

.size-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.size-controls label {
    font-size: 0.9rem;
    color: var(--text-color);
}

#sizeSlider {
    width: 100px;
    accent-color: var(--primary-color);
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
    padding: 15px;
    background: #fafafa;
    border-radius: 12px;
    border: 2px solid var(--border-color);
}

.emoji-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    border: 2px solid transparent;
    min-height: 60px;
}

.emoji-item:hover {
    background: var(--emoji-hover);
    border-color: var(--secondary-color);
    transform: scale(1.1);
}

.emoji-item.selected {
    background: var(--highlight-bg);
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(234, 88, 12, 0.3);
}

.emoji-char {
    font-size: 32px;
    line-height: 1;
    margin-bottom: 4px;
}

.emoji-name {
    font-size: 0.7rem;
    color: #666;
    text-align: center;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.emoji-code {
    font-size: 0.6rem;
    color: #999;
    font-family: monospace;
}

.load-more-container {
    text-align: center;
    margin-top: 20px;
}

.load-more-btn {
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s ease;
}

.load-more-btn:hover {
    background: #1e40af;
}

.selected-emoji-section {
    margin-bottom: 30px;
    padding: 25px;
    background: var(--highlight-bg);
    border-radius: 12px;
    border: 2px solid var(--border-color);
}

.selected-emoji-section h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.3rem;
}

.selected-display {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.selected-emoji {
    font-size: 4rem;
    padding: 20px;
    background: white;
    border-radius: 12px;
    border: 2px solid var(--border-color);
    min-width: 120px;
    text-align: center;
    color: #666;
    font-style: italic;
}

.selected-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.action-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s ease;
    white-space: nowrap;
}

.action-btn:hover {
    background: var(--accent-color);
}

.action-btn.favorited {
    background: var(--warning-color);
}

.emoji-info {
    background: white;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: var(--secondary-color);
    min-height: 60px;
    display: flex;
    align-items: center;
}

.emoji-info:empty::before {
    content: "絵文字を選択すると詳細情報が表示されます...";
    color: #999;
    font-style: italic;
}

.skin-tone-section {
    padding: 25px;
    background: #f8fafc;
    border-radius: 12px;
    border: 2px solid var(--border-color);
}

.skin-tone-section h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.skin-tone-picker {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.skin-tone {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    font-size: 1.5rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.skin-tone:hover {
    border-color: var(--secondary-color);
    transform: scale(1.1);
}

.skin-tone.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(234, 88, 12, 0.3);
}

.info-section {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    border: 2px solid var(--border-color);
}

.info-section h3 {
    color: var(--primary-color);
    margin-bottom: 25px;
    font-size: 1.4rem;
    text-align: center;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.info-item {
    text-align: center;
    padding: 25px;
    background: var(--highlight-bg);
    border-radius: 12px;
    border: 2px solid var(--border-color);
    transition: transform 0.3s ease;
}

.info-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(234, 88, 12, 0.1);
}

.info-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.info-item h4 {
    color: var(--primary-color);
    margin-bottom: 12px;
    font-size: 1.1rem;
}

.info-item p {
    color: #666;
    line-height: 1.6;
}

.usage-tips {
    background: #f8fafc;
    padding: 25px;
    border-radius: 12px;
    border-left: 4px solid var(--secondary-color);
    margin-bottom: 20px;
}

.usage-tips h4 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.usage-tips ul {
    list-style: none;
    padding: 0;
}

.usage-tips li {
    padding: 8px 0;
    padding-left: 25px;
    position: relative;
    color: #555;
    line-height: 1.6;
}

.usage-tips li::before {
    content: "💡";
    position: absolute;
    left: 0;
}

.categories-info {
    background: #f8fafc;
    padding: 25px;
    border-radius: 12px;
    border-left: 4px solid var(--accent-color);
}

.categories-info h4 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.category-description {
    display: grid;
    gap: 8px;
}

.category-description div {
    padding: 8px 0;
    color: #555;
    line-height: 1.5;
}

footer {
    margin-top: 50px;
    text-align: center;
    color: #666;
}

.ad-space {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    padding: 30px;
    border-radius: 10px;
    margin-bottom: 20px;
    border: 2px dashed #fed7aa;
}

.ad-space p {
    color: var(--primary-color);
    font-style: italic;
}

/* スクロールバーのスタイリング */
.emoji-grid::-webkit-scrollbar {
    width: 8px;
}

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

.emoji-grid::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 4px;
}

.emoji-grid::-webkit-scrollbar-thumb:hover {
    background: #1e40af;
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .tool-section {
        padding: 20px;
    }
    
    .category-tabs {
        justify-content: center;
    }
    
    .category-tab {
        font-size: 0.8rem;
        padding: 8px 12px;
    }
    
    .emoji-grid {
        grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
        gap: 6px;
        max-height: 300px;
    }
    
    .emoji-item {
        min-height: 50px;
        padding: 6px;
    }
    
    .emoji-char {
        font-size: 24px;
    }
    
    .selected-emoji {
        font-size: 3rem;
        min-width: 100px;
    }
    
    .selected-display {
        flex-direction: column;
        align-items: stretch;
    }
    
    .selected-actions {
        justify-content: center;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .grid-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .size-controls {
        justify-content: center;
    }
    
    .search-options {
        justify-content: center;
    }
    
    .skin-tone-picker {
        justify-content: center;
    }
}