/* Global Styles */
* {
    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%);
    color: #333;
    min-height: 100vh;
    padding: 20px;
}

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

header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Main Layout */
.main-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 900px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

/* Camera Section */
.camera-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.camera-section h2 {
    margin-bottom: 15px;
    color: #667eea;
    font-size: 1.5rem;
}

.video-container {
    position: relative;
    width: 100%;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 15px;
    aspect-ratio: 4/3;
    display: flex;
    align-items: center;
    justify-content: center;
}

video {
    display: none;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

canvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: crosshair;
}

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

.btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 120px;
}

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

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

.btn-secondary {
    background: #f0f0f0;
    color: #333;
    border: 2px solid #667eea;
}

.btn-secondary:hover {
    background: #667eea;
    color: white;
}

.btn-secondary.active {
    background: #667eea;
    color: white;
}

.btn-small {
    flex: none;
    padding: 8px 12px;
    font-size: 0.9rem;
}

/* Info Section */
.info-section {
    display: grid;
    grid-template-rows: auto auto auto;
    gap: 15px;
}

.detection-status,
.scoring-display,
.scoreboard {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.detection-status h3,
.scoring-display h3,
.scoreboard h3 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.2rem;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

#detectionInfo p {
    margin: 8px 0;
    font-size: 0.95rem;
    display: flex;
    justify-content: space-between;
}

#detectionInfo span {
    font-weight: 600;
    color: #764ba2;
    font-family: 'Courier New', monospace;
}

#status {
    padding: 5px 10px;
    background: #f0f0f0;
    border-radius: 4px;
    font-size: 0.85rem;
}

/* Dart Info Display */
.dart-info {
    text-align: center;
    padding: 20px 0;
}

.score-value {
    font-size: 3rem;
    font-weight: bold;
    color: #764ba2;
    margin-bottom: 10px;
}

.segment-value {
    font-size: 1.5rem;
    color: #667eea;
    font-family: 'Courier New', monospace;
}

/* Scoreboard */
.score-list {
    padding: 10px 0;
}

.score-list p {
    margin: 10px 0;
    font-size: 1rem;
    font-weight: 600;
}

#totalScore {
    color: #764ba2;
    font-size: 1.3rem;
}

.darts-list {
    max-height: 200px;
    overflow-y: auto;
    margin: 15px 0;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 6px;
}

.dart-entry {
    padding: 8px;
    margin: 5px 0;
    background: white;
    border-left: 4px solid #667eea;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
}

.dart-entry .segment {
    font-weight: 600;
    color: #667eea;
}

.dart-entry .points {
    color: #764ba2;
    font-weight: 600;
}

/* Scrollbar styling */
.darts-list::-webkit-scrollbar {
    width: 6px;
}

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

.darts-list::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

.darts-list::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    header h1 {
        font-size: 1.8rem;
    }

    .btn {
        padding: 10px 15px;
        font-size: 0.9rem;
    }

    .score-value {
        font-size: 2rem;
    }

    .segment-value {
        font-size: 1.2rem;
    }
}

/* Score ring and segment picker buttons */
.score-ring-btn, .seg-btn {
    padding: 8px 12px;
    background: #333;
    color: #fff;
    border: 1px solid #555;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.seg-btn { padding: 8px 4px; font-size: 14px; text-align: center; }
.score-ring-btn.selected, .seg-btn.selected {
    background: #006600;
    border-color: #00cc00;
    color: #fff;
}
