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

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

h1 {
    color: #333;
    text-align: center;
    margin-bottom: 30px;
    font-size: 2em;
}

h2 {
    color: #555;
    margin-bottom: 15px;
    font-size: 1.3em;
    border-bottom: 2px solid #667eea;
    padding-bottom: 8px;
}

h3 {
    color: #666;
    margin-bottom: 10px;
}

.video-container {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 0 auto 20px;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
}

#video {
    width: 100%;
    display: block;
}

#canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
}

button {
    padding: 12px 30px;
    font-size: 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

#startCamera {
    background: #667eea;
    color: white;
}

#startCamera:hover:not(:disabled) {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

#stopCamera {
    background: #f56565;
    color: white;
}

#stopCamera:hover:not(:disabled) {
    background: #e53e3e;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(245, 101, 101, 0.4);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#calibrateBoard {
    background: #ed8936;
    color: white;
}

#calibrateBoard:hover:not(:disabled) {
    background: #dd6b20;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(237, 137, 54, 0.4);
}

.status {
    background: #f7fafc;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #667eea;
    transition: all 0.3s ease;
}

.status.status-success {
    background: #d4edda;
    border-left-color: #28a745;
    animation: pulse-success 0.5s ease;
}

.status.status-error {
    background: #f8d7da;
    border-left-color: #dc3545;
    animation: pulse-error 0.5s ease;
}

.status.status-info {
    background: #f7fafc;
    border-left-color: #667eea;
}

@keyframes pulse-success {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

@keyframes pulse-error {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

#statusText {
    color: #555;
    font-size: 1.1em;
    font-weight: 600;
}

.detected-markers {
    background: #f7fafc;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #48bb78;
}

#markerList {
    color: #555;
    line-height: 1.8;
}

.marker-item {
    background: white;
    padding: 10px;
    margin: 8px 0;
    border-radius: 5px;
    border: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.marker-id {
    font-weight: bold;
    color: #667eea;
    font-size: 1.1em;
}

.marker-position {
    color: #666;
    font-size: 0.9em;
}

.board-container {
    background: #f7fafc;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #ed8936;
}

.chess-board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    width: 100%;
    max-width: 480px;
    aspect-ratio: 1;
    margin: 0 auto;
    border: 3px solid #333;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.chess-square {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8em;
    font-weight: bold;
    position: relative;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

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

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

.chess-square .square-label {
    position: absolute;
    top: 2px;
    left: 2px;
    font-size: 0.7em;
    color: rgba(0, 0, 0, 0.3);
}

.chess-square .piece {
    font-size: 2em;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.chess-square .piece-info {
    position: absolute;
    bottom: 2px;
    right: 2px;
    font-size: 0.6em;
    color: #667eea;
    background: white;
    padding: 1px 3px;
    border-radius: 3px;
}

.info {
    background: #edf2f7;
    padding: 20px;
    border-radius: 8px;
}

.info ul {
    list-style-position: inside;
    color: #555;
    line-height: 2;
}

.info li {
    margin-left: 10px;
}

@media (max-width: 768px) {
    .container {
        padding: 20px;
    }

    h1 {
        font-size: 1.5em;
    }

    .controls {
        flex-direction: column;
    }

    button {
        width: 100%;
    }
}
