:root {
    --primary-color: #0052CC;
    --primary-hover: #0747A6;
    --secondary-color: #6B778C;
    --success-color: #00875A;
    --error-color: #DE350B;
    --warning-color: #FF991F;
    --bg-primary: #FFFFFF;
    --bg-secondary: #F4F5F7;
    --bg-tertiary: #FAFBFC;
    --text-primary: #172B4D;
    --text-secondary: #5E6C84;
    --text-tertiary: #8993A4;
    --border-color: #DFE1E6;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

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

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;
}

/* ヘッダー */
.header {
    background: var(--bg-primary);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.logo svg {
    width: 32px;
    height: 32px;
}

.language-selector {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

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

/* メインコンテンツ */
.main {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* コントロールパネル */
.controls-panel {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
}

.url-input-container {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.url-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: all 0.2s;
}

.url-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 82, 204, 0.1);
}

/* ボタン */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

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

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

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--border-color);
}

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

/* デバイスセレクター */
.device-selector {
    margin-bottom: 1.5rem;
}

.device-selector h3 {
    font-size: 1.125rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.device-grid {
    display: grid;
    gap: 1.5rem;
}

.device-type-section {
    background: var(--bg-tertiary);
    padding: 1rem;
    border-radius: var(--radius-md);
}

.device-type-title {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.device-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 0.5rem;
}

.device-option {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.device-option:hover {
    background: var(--bg-secondary);
}

.device-option input[type="checkbox"] {
    margin-right: 0.75rem;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.device-option span {
    font-size: 0.875rem;
    color: var(--text-primary);
}

/* コントロールボタン */
.control-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* プレビューコンテナ */
.preview-container {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 2rem;
    min-height: 600px;
    box-shadow: var(--shadow-md);
}

/* 空の状態 */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.empty-state svg {
    margin-bottom: 1.5rem;
    opacity: 0.5;
}

.empty-state h2 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.empty-state p {
    max-width: 500px;
    line-height: 1.6;
}

/* デバイスコンテナ */
.devices-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    padding: 1rem;
}

/* デバイスプレビューカード */
.device-preview-card {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.device-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.device-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.device-dimensions {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* デバイスフレーム */
.device-frame-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    overflow: auto;
    max-height: 700px;
}

.device-frame {
    position: relative;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    transform-origin: top left;
    transform: scale(0.5);
    margin: 0 auto;
}

.device-frame.mobile {
    border: 8px solid #333;
    border-radius: 24px;
}

.device-frame.tablet {
    border: 12px solid #333;
    border-radius: 16px;
}

.device-frame.desktop {
    border: 2px solid #DDD;
    border-radius: 8px;
}

.device-frame iframe {
    border: none;
    width: 100%;
    height: 100%;
    transform-origin: top left;
}

/* フッター */
.footer {
    text-align: center;
    padding: 2rem;
    color: white;
    font-size: 0.875rem;
}

/* トースト通知 */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    background: var(--text-primary);
    color: white;
    font-size: 0.875rem;
    box-shadow: var(--shadow-lg);
    transform: translateX(400px);
    transition: transform 0.3s;
    z-index: 1000;
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    background: var(--success-color);
}

.toast.error {
    background: var(--error-color);
}

.toast.warning {
    background: var(--warning-color);
}

/* レスポンシブデザイン */
@media (max-width: 1024px) {
    .devices-container {
        grid-template-columns: 1fr;
    }
    
    .device-frame {
        transform: scale(0.4);
    }
}

@media (max-width: 768px) {
    .header-content {
        padding: 1rem;
    }
    
    .main {
        padding: 0 1rem;
        margin: 1rem auto;
    }
    
    .url-input-container {
        flex-direction: column;
    }
    
    .control-buttons {
        flex-direction: column;
    }
    
    .control-buttons .btn {
        width: 100%;
        justify-content: center;
    }
    
    .device-options {
        grid-template-columns: 1fr;
    }
    
    .devices-container {
        padding: 0.5rem;
    }
    
    .device-frame {
        transform: scale(0.3);
    }
    
    .toast {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
        transform: translateY(100px);
    }
    
    .toast.show {
        transform: translateY(0);
    }
}

/* 印刷スタイル */
@media print {
    body {
        background: white;
    }
    
    .header,
    .controls-panel,
    .footer,
    .toast {
        display: none;
    }
    
    .preview-container {
        box-shadow: none;
        padding: 0;
    }
    
    .device-frame {
        transform: scale(1);
        page-break-inside: avoid;
    }
}

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

.device-preview-card {
    animation: fadeIn 0.3s ease-out;
}

/* アクセシビリティ */
:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

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

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--text-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}