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

:root {
    --primary-color: #4A90E2;
    --primary-hover: #357ABD;
    --secondary-color: #50E3C2;
    --background: #F8F9FA;
    --surface: #FFFFFF;
    --text-primary: #2C3E50;
    --text-secondary: #7F8C8D;
    --border: #E1E4E8;
    --success: #27AE60;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.12);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.16);
    --radius: 12px;
    --radius-sm: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
}

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

header {
    text-align: center;
    margin-bottom: 3rem;
    color: white;
    position: relative;
}

header h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.subtitle {
    font-size: 1.25rem;
    opacity: 0.95;
    font-weight: 300;
}

.language-selector {
    position: absolute;
    top: 0;
    right: 0;
}

.language-selector select {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    border: 2px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.1);
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.language-selector select:hover {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.5);
}

.language-selector select option {
    background: var(--primary-color);
    color: white;
}

main {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(10px);
}

.input-section {
    margin-bottom: 2rem;
}

.tab-container {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border);
}

.tab-button {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    font-weight: 500;
}

.tab-button:hover {
    color: var(--text-primary);
}

.tab-button.active {
    color: var(--primary-color);
}

.tab-button.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color);
}

.tab-content {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 3rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--background);
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary-color);
    background: rgba(74, 144, 226, 0.05);
}

.upload-icon {
    width: 64px;
    height: 64px;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.upload-hint {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

#previewCanvas,
#textPreviewCanvas {
    max-width: 256px;
    margin: 2rem auto;
    display: block;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
}

.text-input-container {
    max-width: 500px;
    margin: 0 auto;
}

#textInput {
    width: 100%;
    padding: 1rem;
    font-size: 3rem;
    text-align: center;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 2rem;
    font-weight: bold;
    transition: border-color 0.3s ease;
}

#textInput:focus {
    outline: none;
    border-color: var(--primary-color);
}

.text-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.option-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.option-group input[type="color"] {
    width: 100%;
    height: 40px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.option-group input[type="color"]:hover {
    transform: scale(1.05);
}

.option-group select {
    padding: 0.5rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.option-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.generate-section {
    text-align: center;
    margin: 2rem 0;
}

.generate-btn {
    padding: 1rem 3rem;
    font-size: 1.125rem;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
}

.generate-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.generate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.result-section {
    margin-top: 3rem;
    padding-top: 3rem;
    border-top: 1px solid var(--border);
}

.result-section h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--text-primary);
}

.favicon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.favicon-item {
    text-align: center;
    padding: 1rem;
    background: var(--background);
    border-radius: var(--radius);
    transition: transform 0.3s ease;
}

.favicon-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.favicon-item img {
    width: 64px;
    height: 64px;
    margin-bottom: 0.5rem;
    image-rendering: crisp-edges;
}

.favicon-item span {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.favicon-item .filename {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    font-family: monospace;
}

.download-section {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 3rem;
}

.download-btn {
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.3s ease;
}

.download-btn.primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
}

.download-btn:not(.primary) {
    background: var(--background);
    color: var(--text-primary);
    border: 2px solid var(--border);
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.code-section {
    margin-top: 3rem;
}

.code-section h3 {
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.code-block {
    background: #2C3E50;
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: rgba(0,0,0,0.2);
    color: white;
    font-size: 0.875rem;
}

.copy-btn {
    padding: 0.25rem 0.75rem;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.3s ease;
}

.copy-btn:hover {
    background: rgba(255,255,255,0.2);
}

.code-block pre {
    padding: 1rem;
    overflow-x: auto;
    margin: 0;
}

.code-block code {
    color: #E1E4E8;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
}

footer {
    text-align: center;
    margin-top: 3rem;
    padding: 2rem;
    color: rgba(255,255,255,0.8);
}

.notification {
    position: fixed;
    top: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    background: var(--success);
    color: white;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
    z-index: 1000;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .language-selector {
        position: static;
        margin-top: 1rem;
    }
    
    .text-options {
        grid-template-columns: 1fr;
    }
    
    .favicon-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }
    
    .download-section {
        flex-direction: column;
    }
    
    .download-btn {
        width: 100%;
    }
}