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

/* 言語切り替えボタン */
.lang-toggle {
    position: absolute;
    top: 15px;
    right: 15px;
    padding: 6px 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    font-size: 0.8em;
    font-weight: bold;
    transition: transform 0.2s, box-shadow 0.2s;
    z-index: 1000;
}

.lang-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.lang-toggle:active {
    transform: scale(0.95);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    max-width: 600px;
    width: 100%;
}

header {
    text-align: center;
    margin-bottom: 10px;
}

h1 {
    color: #333;
    font-size: 1.5em;
    margin-bottom: 3px;
}

.subtitle {
    color: #666;
    font-size: 0.8em;
}

.game-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
    padding: 8px;
    background: #f5f5f5;
    border-radius: 8px;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.button-group {
    gap: 5px;
    flex-wrap: wrap;
}

.label {
    font-weight: bold;
    color: #555;
}

.value {
    color: #667eea;
    font-weight: bold;
}

.btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.8em;
    font-weight: bold;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

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

.btn-primary {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    font-weight: bold;
}

/* メモモードボタン */
.memo-mode-btn {
    background: #9e9e9e;
}

.memo-mode-btn.active {
    background: linear-gradient(135deg, #4caf50 0%, #66bb6a 100%);
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

/* 重複チェックボタン */
.validate-mode-btn {
    background: #9e9e9e;
}

.validate-mode-btn.active {
    background: linear-gradient(135deg, #2196f3 0%, #21cbf3 100%);
    box-shadow: 0 0 10px rgba(33, 150, 243, 0.5);
}

.sudoku-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 0;
    width: 100%;
    aspect-ratio: 1;
    border: 3px solid #333;
    margin-bottom: 15px;
    background: #333;
}

.cell {
    aspect-ratio: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: white;
    font-size: 1.5em;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
    border: 1px solid #ccc;
}

.cell:hover:not(.fixed) {
    background: #e3f2fd;
}

/* メモモード時のホバー色 */
.memo-mode-active .cell:hover:not(.fixed) {
    background: #e8f5e9;
}

.cell.selected {
    background: #bbdefb;
}

.cell.selected-memo {
    background: #c8e6c9;
}

.cell.fixed {
    background: #f5f5f5;
    color: #333;
    cursor: default;
}

.cell.error {
    background: #ffebee;
    color: #c62828;
}

/* 候補メモ表示 */
.cell-notes {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    width: 100%;
    height: 100%;
    padding: 2px;
    gap: 1px;
}

.cell-note {
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.5em;
    color: #999;
    font-weight: normal;
}

/* 数字入力ボタン */
.number-buttons {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    margin-bottom: 15px;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 8px;
}

.num-btn {
    aspect-ratio: 1;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
}

.num-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.num-btn:active {
    transform: scale(0.95);
}

.num-btn.delete-btn {
    background: linear-gradient(135deg, #f44336 0%, #e91e63 100%);
}

/* 3x3ブロックの境界を太く */
.cell:nth-child(3n) {
    border-right: 2px solid #333;
}

.cell:nth-child(n+19):nth-child(-n+27),
.cell:nth-child(n+46):nth-child(-n+54) {
    border-bottom: 2px solid #333;
}

.instructions {
    background: #f5f5f5;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.instructions summary {
    color: #333;
    font-weight: bold;
    font-size: 1em;
    cursor: pointer;
    padding: 5px;
    user-select: none;
}

.instructions summary:hover {
    background: #e8e8e8;
    border-radius: 5px;
}

.instructions ul {
    list-style-position: inside;
    color: #555;
    line-height: 1.6;
    margin-top: 10px;
}

.instructions li {
    font-size: 0.85em;
}

.footer {
    text-align: center;
}

.back-link {
    color: #667eea;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.2s;
}

.back-link:hover {
    color: #764ba2;
}

/* レスポンシブ対応 */
@media (max-width: 600px) {
    .container {
        padding: 15px;
    }

    h1 {
        font-size: 1.5em;
    }

    .cell {
        font-size: 1.2em;
    }

    .sudoku-grid {
        border: 2px solid #333;
    }
}
