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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

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

header {
    text-align: center;
    padding: 30px 0;
    color: white;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.95;
}

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

.lang-btn {
    padding: 8px 16px;
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.3);
    color: white;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
}

.lang-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-2px);
}

.lang-btn.active {
    background: white;
    color: #764ba2;
    border-color: white;
}

main {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.input-section {
    margin-bottom: 30px;
    padding: 25px;
    background: #f8f9fa;
    border-radius: 15px;
}

.file-upload {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.file-label {
    display: inline-block;
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 25px;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    font-weight: 500;
}

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

.file-name {
    color: #6c757d;
    font-size: 14px;
}

.text-input {
    margin-bottom: 20px;
}

.text-input label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #495057;
}

#pgn-text {
    width: 100%;
    height: 120px;
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    resize: vertical;
    transition: border-color 0.3s;
}

#pgn-text:focus {
    outline: none;
    border-color: #667eea;
}

.btn-primary {
    padding: 12px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
}

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

.game-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

@media (max-width: 968px) {
    .game-section {
        grid-template-columns: 1fr;
    }
}

.board-container {
    position: relative;
    background: #f0f0f0;
    padding: 15px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.chess-board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    aspect-ratio: 1;
    max-width: 500px;
    margin: 0 auto;
    border: 3px solid #333;
    border-radius: 5px;
    overflow: hidden;
}

.square {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    cursor: pointer;
    transition: background-color 0.3s;
    position: relative;
}

.square.light {
    background-color: #f0d9b5;
}

.square.dark {
    background-color: #b58863;
}

.square:hover {
    opacity: 0.8;
}

.square.white-piece {
    color: white;
    text-shadow: 0 0 3px black;
}

.square.black-piece {
    color: black;
    text-shadow: 0 0 3px white;
}

.coordinates {
    position: absolute;
    pointer-events: none;
}

.files {
    position: absolute;
    bottom: -25px;
    left: 15px;
    right: 15px;
    display: flex;
    justify-content: space-around;
    font-weight: 600;
    color: #666;
}

.ranks {
    position: absolute;
    top: 15px;
    bottom: 15px;
    left: -25px;
    display: flex;
    flex-direction: column-reverse;
    justify-content: space-around;
    font-weight: 600;
    color: #666;
}

.game-info {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.players {
    display: flex;
    justify-content: space-between;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
}

.player {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 18px;
}

.piece-icon {
    font-size: 30px;
}

.game-meta {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    font-size: 14px;
    color: #6c757d;
}

.game-meta div:not(:last-child) {
    margin-bottom: 5px;
}

.move-list-container {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
}

.move-list-container h3 {
    margin-bottom: 15px;
    color: #495057;
    font-size: 16px;
}

.move-list {
    max-height: 300px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

.move-row {
    display: flex;
    padding: 5px 0;
    border-bottom: 1px solid #e9ecef;
}

.move-number {
    width: 40px;
    color: #6c757d;
    font-weight: 600;
}

.move {
    flex: 1;
    padding: 2px 8px;
    cursor: pointer;
    border-radius: 3px;
    transition: background-color 0.2s;
}

.move:hover {
    background: #e9ecef;
}

.move.active {
    background: #667eea;
    color: white;
}

.move-comment {
    padding: 8px;
    margin: 5px 0;
    background: #fff3cd;
    border-left: 3px solid #ffc107;
    font-size: 13px;
    color: #856404;
}

.controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.control-btn {
    width: 50px;
    height: 50px;
    border: none;
    background: white;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.speed-control {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
}

.speed-control label {
    font-weight: 500;
    color: #495057;
}

#play-speed {
    flex: 1;
    -webkit-appearance: none;
    height: 6px;
    border-radius: 3px;
    background: #e9ecef;
    outline: none;
}

#play-speed::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
}

#play-speed::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    border: none;
}

#speed-value {
    min-width: 40px;
    text-align: center;
    font-weight: 600;
    color: #764ba2;
}

.comment-display {
    padding: 15px;
    background: #fff3cd;
    border-radius: 10px;
    min-height: 60px;
    font-size: 14px;
    color: #856404;
    display: none;
}

.comment-display:not(:empty) {
    display: block;
}

.sample-games {
    padding: 25px;
    background: #f8f9fa;
    border-radius: 15px;
}

.sample-games h3 {
    margin-bottom: 15px;
    color: #495057;
}

.sample-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.sample-btn {
    padding: 10px 20px;
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
    color: #495057;
}

.sample-btn:hover {
    border-color: #667eea;
    color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.2);
}

footer {
    text-align: center;
    padding: 30px 0;
    color: white;
    opacity: 0.9;
}

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

.move-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.move-list::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.move-list::-webkit-scrollbar-thumb:hover {
    background: #555;
}