:root {
    --primary-color: #5e72e4;
    --primary-hover: #4c63d2;
    --secondary-color: #6c757d;
    --success-color: #2dce89;
    --danger-color: #f5365c;
    --warning-color: #fb6340;
    --info-color: #11cdef;
    --background: #f8f9fe;
    --surface: #ffffff;
    --text-primary: #32325d;
    --text-secondary: #525f7f;
    --text-muted: #8898aa;
    --border-color: #e9ecef;
    --shadow-sm: 0 0 .5rem rgba(0,0,0,.075);
    --shadow-md: 0 0 2rem 0 rgba(136,152,170,.15);
    --shadow-lg: 0 15px 35px rgba(50,50,93,.1), 0 5px 15px rgba(0,0,0,.07);
    --radius: 0.375rem;
    --radius-lg: 0.5rem;
}

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

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

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

/* ヘッダー */
.header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInDown 0.6s ease;
}

.title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.logo {
    width: 48px;
    height: 48px;
    color: var(--primary-color);
}

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

/* コントロール */
.controls {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
    align-items: center;
    animation: fadeIn 0.6s ease 0.1s both;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.control-group label {
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
}

.select {
    padding: 0.5rem 2.5rem 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-primary);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    background-image: url('data:image/svg+xml;utf8,<svg fill="%23525f7f" height="20" viewBox="0 0 20 20" width="20" xmlns="http://www.w3.org/2000/svg"><path d="M4.516 7.548c.436-.446 1.043-.481 1.576 0L10 11.295l3.908-3.747c.533-.481 1.141-.446 1.574 0 .436.445.408 1.197 0 1.615-.406.418-4.695 4.502-4.695 4.502a1.095 1.095 0 0 1-1.576 0S4.924 9.581 4.516 9.163c-.409-.418-.436-1.17 0-1.615z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 1.25rem;
    appearance: none;
}

.select:hover {
    border-color: var(--primary-color);
}

.select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(94, 114, 228, 0.1);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 1.125rem;
    height: 1.125rem;
    cursor: pointer;
}

/* エディター */
.editor-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
    animation: fadeIn 0.6s ease 0.2s both;
}

@media (max-width: 968px) {
    .editor-container {
        grid-template-columns: 1fr;
    }
}

.editor-panel {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.panel-header {
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.panel-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
    flex: 1;
}

.editor {
    flex: 1;
    min-height: 400px;
    padding: 1.5rem;
    border: none;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.95rem;
    line-height: 1.6;
    resize: vertical;
    background: var(--surface);
    color: var(--text-primary);
}

.editor:focus {
    outline: none;
}

.char-count {
    padding: 0.75rem 1.5rem;
    background: var(--background);
    color: var(--text-muted);
    font-size: 0.875rem;
    border-top: 1px solid var(--border-color);
}

/* ボタン */
.btn-primary,
.btn-secondary {
    padding: 0.5rem 1.25rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-secondary:hover {
    background: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* プレビュー */
.preview-section {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
    animation: fadeIn 0.6s ease 0.3s both;
}

.preview-section h2 {
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    font-size: 1.5rem;
}

.preview {
    min-height: 200px;
    padding: 1.5rem;
    background: var(--background);
    border-radius: var(--radius);
    color: var(--text-primary);
    line-height: 1.8;
}

.preview h1, .preview h2, .preview h3,
.preview h4, .preview h5, .preview h6 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.preview h1 { font-size: 2rem; }
.preview h2 { font-size: 1.5rem; }
.preview h3 { font-size: 1.25rem; }

.preview p {
    margin-bottom: 1rem;
}

.preview pre {
    background: #2d3748;
    color: #e2e8f0;
    padding: 1rem;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 1rem 0;
}

.preview code {
    background: #edf2f7;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
}

.preview pre code {
    background: transparent;
    padding: 0;
}

.preview blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 1rem;
    margin: 1rem 0;
    color: var(--text-secondary);
}

.preview a {
    color: var(--primary-color);
    text-decoration: none;
}

.preview a:hover {
    text-decoration: underline;
}

.preview hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 2rem 0;
}

/* サンプル */
.examples {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
    animation: fadeIn 0.6s ease 0.4s both;
}

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

.example-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.example-btn {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

/* フッター */
.footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    animation: fadeIn 0.6s ease 0.5s both;
}

/* トースト */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--text-primary);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(1rem);
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 1000;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* アニメーション */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* レスポンシブ */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .title {
        font-size: 2rem;
    }
    
    .controls {
        gap: 1rem;
    }
    
    .editor {
        min-height: 300px;
        font-size: 0.875rem;
    }
    
    .example-buttons {
        gap: 0.5rem;
    }
    
    .example-btn {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
}