/* リセットとベース設定 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #6366f1;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --error-color: #ef4444;
    --bg-color: #f9fafb;
    --text-color: #1f2937;
    --card-bg: #ffffff;
    --border-color: #e5e7eb;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ヘッダー */
header {
    text-align: center;
    margin-bottom: 40px;
}

h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.subtitle {
    color: #6b7280;
    font-size: 1.125rem;
}

/* メインコンテンツ */
main {
    flex: 1;
}

/* 入力セクション */
.input-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 30px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

label {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
    color: #4b5563;
}

input[type="text"] {
    width: 100%;
    padding: 12px 16px;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    transition: border-color 0.3s;
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
}

.controls {
    display: flex;
    gap: 10px;
    margin: 20px 0;
}

.primary-btn, .secondary-btn {
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

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

.primary-btn:hover {
    background: #5558e3;
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.secondary-btn {
    background: white;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

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

.options {
    display: flex;
    gap: 20px;
}

.options label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0;
    cursor: pointer;
}

input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* ゲームセクション */
.game-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 30px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.game-section h2 {
    color: var(--secondary-color);
    margin-bottom: 20px;
}

.game-content {
    max-width: 500px;
    margin: 0 auto;
}

.game-word {
    font-size: 2rem;
    font-weight: bold;
    text-align: center;
    margin: 20px 0;
    color: var(--primary-color);
    letter-spacing: 0.2em;
}

.game-hint {
    text-align: center;
    margin-bottom: 20px;
    color: #6b7280;
}

.game-hint span {
    font-weight: 500;
    color: var(--text-color);
}

.game-result {
    text-align: center;
    margin: 20px 0;
    font-weight: 500;
    min-height: 24px;
}

.game-result.success {
    color: var(--success-color);
}

.game-result.error {
    color: var(--error-color);
}

.score {
    text-align: center;
    font-size: 1.25rem;
    font-weight: bold;
    margin-top: 20px;
    color: var(--secondary-color);
}

/* 結果セクション */
.results-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 30px;
    box-shadow: var(--shadow);
}

.results-section h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
}

.stats {
    display: flex;
    gap: 30px;
    margin-bottom: 20px;
    font-size: 1.125rem;
}

.stats span {
    font-weight: bold;
    color: var(--primary-color);
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    max-height: 400px;
    overflow-y: auto;
    padding: 10px;
    background: var(--bg-color);
    border-radius: 8px;
}

.result-item {
    padding: 10px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    text-align: center;
    font-weight: 500;
    transition: all 0.3s;
}

.result-item:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.05);
}

/* フッター */
footer {
    margin-top: 40px;
    padding: 20px 0;
    text-align: center;
    border-top: 1px solid var(--border-color);
    color: #6b7280;
}

footer nav {
    margin-top: 10px;
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

footer a:hover {
    text-decoration: underline;
}

/* ユーティリティクラス */
.hidden {
    display: none !important;
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }
    
    .controls {
        flex-direction: column;
    }
    
    .primary-btn, .secondary-btn {
        width: 100%;
    }
    
    .options {
        flex-direction: column;
    }
    
    .stats {
        flex-direction: column;
        gap: 10px;
    }
    
    .results-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .input-section, .game-section, .results-section {
        padding: 20px;
    }
    
    .game-word {
        font-size: 1.5rem;
    }
}