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

:root {
    --primary-color: #0052CC;
    --primary-hover: #0747A6;
    --secondary-color: #6554C0;
    --success-color: #00875A;
    --error-color: #DE350B;
    --warning-color: #FF991F;
    --bg-color: #FAFBFC;
    --card-bg: #FFFFFF;
    --text-primary: #172B4D;
    --text-secondary: #5E6C84;
    --border-color: #DFE1E6;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.12);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.08);
    --radius: 8px;
    --transition: all 0.2s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', '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: 20px;
}

header {
    text-align: center;
    padding: 40px 20px;
    background: var(--card-bg);
    border-radius: var(--radius);
    margin-bottom: 30px;
    box-shadow: var(--shadow-lg);
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 10px;
    letter-spacing: -0.5px;
}

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

.lang-selector {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.lang-btn {
    padding: 8px 16px;
    border: 2px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-primary);
    border-radius: 20px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
    font-weight: 500;
}

.lang-btn:hover {
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

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

main {
    display: grid;
    gap: 30px;
}

section {
    background: var(--card-bg);
    padding: 30px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
}

h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

.current-time-section {
    background: linear-gradient(135deg, var(--card-bg), #f0f5ff);
}

.current-time-display {
    display: grid;
    gap: 15px;
}

.time-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: white;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.time-item .label {
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 150px;
}

.time-item .value {
    flex: 1;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 1.1rem;
    color: var(--primary-color);
    font-weight: 600;
}

.input-group, .datetime-inputs, .diff-inputs, .format-inputs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

input[type="text"],
input[type="datetime-local"],
select {
    flex: 1;
    min-width: 200px;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    transition: var(--transition);
    background: white;
}

input[type="text"]:focus,
input[type="datetime-local"]:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 82, 204, 0.1);
}

.btn-primary {
    padding: 12px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

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

.btn-primary:active {
    transform: translateY(0);
}

.copy-btn {
    padding: 8px 12px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1rem;
}

.copy-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    transform: scale(1.1);
}

.copy-btn.small {
    padding: 4px 8px;
    font-size: 0.9rem;
}

.result-box {
    min-height: 60px;
    padding: 20px;
    background: var(--bg-color);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.result-grid {
    display: grid;
    gap: 15px;
}

.result-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: white;
    border-radius: 4px;
}

.result-label {
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 150px;
}

.result-value {
    flex: 1;
    font-family: 'Monaco', 'Courier New', monospace;
    color: var(--text-primary);
}

.diff-inputs {
    display: grid;
    gap: 20px;
}

.diff-input-group {
    display: grid;
    gap: 8px;
}

.diff-input-group label {
    font-weight: 600;
    color: var(--text-secondary);
}

.diff-result {
    display: grid;
    gap: 20px;
}

.diff-detail {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--primary-color);
    text-align: center;
    padding: 20px;
    background: white;
    border-radius: 6px;
}

.diff-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.diff-stats > div {
    padding: 15px;
    background: white;
    border-radius: 4px;
    text-align: center;
    font-weight: 500;
}

.format-result {
    position: relative;
}

.code-block {
    background: #2d3748;
    color: #e2e8f0;
    padding: 20px;
    border-radius: 6px;
    overflow-x: auto;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.95rem;
    line-height: 1.5;
}

.error {
    color: var(--error-color);
    padding: 15px;
    background: #FFEBE6;
    border-radius: 4px;
    border-left: 4px solid var(--error-color);
}

.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--success-color);
    color: white;
    padding: 12px 20px;
    border-radius: 6px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(20px);
    transition: var(--transition);
    z-index: 1000;
}

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

footer {
    text-align: center;
    padding: 30px;
    color: white;
    margin-top: 40px;
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }
    
    .container {
        padding: 15px;
    }
    
    section {
        padding: 20px;
    }
    
    .input-group,
    .datetime-inputs,
    .format-inputs {
        flex-direction: column;
    }
    
    input[type="text"],
    input[type="datetime-local"],
    select {
        min-width: 100%;
    }
    
    .time-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .time-item .label {
        min-width: auto;
    }
    
    .result-label {
        min-width: 120px;
    }
    
    .diff-stats {
        grid-template-columns: 1fr;
    }
}

/* ダークテーマ対応 */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #1a202c;
        --card-bg: #2d3748;
        --text-primary: #e2e8f0;
        --text-secondary: #a0aec0;
        --border-color: #4a5568;
    }
    
    body {
        background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    }
    
    input[type="text"],
    input[type="datetime-local"],
    select {
        background: #1a202c;
        color: var(--text-primary);
    }
    
    .current-time-section {
        background: linear-gradient(135deg, var(--card-bg), #2d3748);
    }
    
    .time-item,
    .result-item,
    .diff-detail,
    .diff-stats > div {
        background: #1a202c;
    }
    
    .result-box {
        background: #1a202c;
    }
}

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

section {
    animation: slideIn 0.4s ease;
}

/* ローディング状態 */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--primary-color);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}