:root {
    --primary-color: #0066ff;
    --primary-hover: #0052cc;
    --secondary-color: #6c757d;
    --success-color: #00d084;
    --background: #ffffff;
    --surface: #f8f9fa;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --border-color: #e1e4e8;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 20px rgba(0,0,0,0.1);
    --radius: 8px;
    --transition: all 0.3s ease;
}

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

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

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    z-index: -1;
}

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

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

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 20px;
}

h1 {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.lang-switcher {
    display: flex;
    gap: 8px;
}

.lang-switcher button {
    padding: 6px 16px;
    border: 1px solid var(--border-color);
    background: var(--background);
    border-radius: 20px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

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

.lang-switcher button:hover:not(.active) {
    background: var(--surface);
}

/* メインコンテンツ */
main {
    padding: 2rem 0 4rem;
}

.hero {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem;
    background: var(--background);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
}

.hero h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* カード */
.card {
    background: var(--background);
    border-radius: var(--radius);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

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

/* 速度測定エリア */
.test-area {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--radius);
}

.sample-text {
    background: var(--background);
    padding: 1.5rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    line-height: 1.8;
    font-size: 1.05rem;
}

.test-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.timer {
    background: var(--background);
    padding: 0.5rem 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.timer-value {
    font-size: 1.5rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* ボタン */
.btn {
    padding: 12px 32px;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-transform: none;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

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

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

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

/* 結果表示 */
.result {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.result-item {
    background: var(--background);
    padding: 1rem;
    border-radius: var(--radius);
    text-align: center;
}

.result-item span {
    display: block;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.result-item strong {
    font-size: 2rem;
    color: var(--primary-color);
}

.result-level {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem;
    border-radius: var(--radius);
    text-align: center;
    margin-top: 0.5rem;
}

.result-level strong {
    font-size: 1.2rem;
}

/* 計算入力エリア */
.calc-inputs {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--radius);
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.input-group input,
.input-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: var(--transition);
}

.input-group input:focus,
.input-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.input-group small {
    display: block;
    margin-top: 0.25rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.input-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.char-count {
    margin-top: 0.5rem;
    color: var(--text-secondary);
}

.char-count strong {
    color: var(--primary-color);
}

/* 計算結果 */
.calc-result {
    margin-top: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-radius: var(--radius);
}

.calc-result h4 {
    text-align: center;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.time-display {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1.5rem;
}

.time-unit {
    text-align: center;
}

.time-unit span {
    display: block;
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

.reading-schedule {
    display: grid;
    gap: 0.75rem;
}

.schedule-item {
    padding: 0.75rem;
    background: var(--background);
    border-radius: var(--radius);
    text-align: center;
    font-size: 0.95rem;
}

/* 統計 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--radius);
    text-align: center;
}

.stat-card h4 {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-desc {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

/* ヒント */
.tips {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--radius);
}

.tips h4 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

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

.tips li {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: var(--background);
    border-radius: var(--radius);
    position: relative;
    padding-left: 2rem;
}

.tips li::before {
    content: '✓';
    position: absolute;
    left: 0.75rem;
    color: var(--success-color);
    font-weight: bold;
}

/* フッター */
footer {
    background: var(--background);
    padding: 2rem 0;
    text-align: center;
    color: var(--text-secondary);
    box-shadow: 0 -1px 3px rgba(0,0,0,0.1);
}

/* レスポンシブ */
@media (max-width: 768px) {
    h1 {
        font-size: 1.5rem;
    }
    
    .hero h2 {
        font-size: 1.5rem;
    }
    
    .hero p {
        font-size: 1rem;
    }
    
    header .container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .input-row {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .time-unit span {
        font-size: 2.5rem;
    }
    
    .stat-value {
        font-size: 2rem;
    }
    
    .card {
        padding: 1.5rem;
    }
}

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

.card {
    animation: fadeIn 0.5s ease;
}

.result,
.calc-result {
    animation: fadeIn 0.3s ease;
}