* {
    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: 1400px;
    margin: 0 auto;
}

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

h1 {
    font-size: 3em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.subtitle {
    font-size: 1.2em;
    opacity: 0.9;
}

.main-content {
    display: flex;
    gap: 30px;
    justify-content: center;
    align-items: flex-start;
    flex-wrap: wrap;
}

.arena-section {
    flex-shrink: 0;
}

canvas#rink {
    border-radius: 15px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
    background: linear-gradient(to bottom, #e0f7fa, #b3e5fc);
    cursor: crosshair;
    transition: transform 0.2s;
}

canvas#rink:hover {
    transform: scale(1.01);
}

.controls-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 400px;
}

.controls-card,
.info-card,
.game-state-card,
.replay-card {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.game-state-card {
    background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
    border-left: 5px solid #667eea;
}

.game-state-card h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.score-display {
    display: flex;
    align-items: center;
    justify-content: space-around;
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.team-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.team-name {
    font-size: 0.85em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.blue-name {
    color: #1976d2;
}

.red-name {
    color: #d32f2f;
}

.score {
    font-size: 2.5em;
    font-weight: bold;
    color: #333;
}

.separator {
    font-size: 1.5em;
    color: #999;
}

.game-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 15px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    background: white;
    border-radius: 6px;
}

.info-row label {
    font-weight: 600;
    color: #333;
    min-width: 120px;
}

.info-row input,
.info-row select {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9em;
    flex: 1;
}

.end-points {
    background: white;
    padding: 12px;
    border-radius: 6px;
    margin-top: 15px;
}

.end-points label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.end-points input {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.replay-card {
    background: linear-gradient(135deg, #fff9c4 0%, #ffe082 100%);
    border-left: 5px solid #ff9800;
}

.replay-card h3 {
    color: #e65100;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.replay-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 15px;
    background: white;
    padding: 10px;
    border-radius: 6px;
    flex-wrap: wrap;
}

.btn-small {
    padding: 8px 15px;
    background: #ff9800;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-small:hover {
    background: #f57c00;
    transform: translateY(-1px);
}

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

#moveCounter {
    flex: 1;
    text-align: center;
    font-weight: 600;
    color: #555;
    min-width: 150px;
}

.replay-info {
    background: white;
    padding: 12px;
    border-radius: 6px;
    font-size: 0.85em;
    color: #333;
}

.move-details {
    display: grid;
    gap: 6px;
}

.move-details div {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px solid #eee;
}

.move-details strong {
    color: #e65100;
    min-width: 80px;
}

.controls-card h2 {
    color: #004d99;
    margin-bottom: 10px;
    font-size: 1.8em;
}

.instructions {
    color: #666;
    margin-bottom: 20px;
    font-size: 0.95em;
}

.color-selector {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 20px 0;
}

.color-selector label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 12px;
    border-radius: 8px;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.color-selector label:hover {
    background: #f5f5f5;
}

.color-selector input[type="radio"] {
    margin-right: 12px;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.color-selector input[type="radio"]:checked+.color-option {
    font-weight: bold;
}

.color-option {
    font-size: 1.1em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-option::before {
    content: '';
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-block;
    border: 2px solid #333;
}

.blue-option::before {
    background: #1976d2;
}

.red-option::before {
    background: #d32f2f;
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 20px 0;
}

button {
    border: none;
    border-radius: 8px;
    padding: 14px 25px;
    cursor: pointer;
    font-size: 1.05em;
    font-weight: 600;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

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

.btn-secondary {
    background: #e0e0e0;
    color: #333;
}

.btn-secondary:hover {
    background: #d0d0d0;
    transform: translateY(-2px);
}

.result-box {
    margin-top: 20px;
    min-height: 60px;
}

.message {
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    animation: slideIn 0.3s ease;
}

.message.info {
    background: #e3f2fd;
    color: #1565c0;
    border-left: 4px solid #1976d2;
}

.message.error {
    background: #ffebee;
    color: #c62828;
    border-left: 4px solid #d32f2f;
}

.recommendation {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    animation: slideIn 0.4s ease;
    box-shadow: 0 4px 15px rgba(67, 233, 123, 0.3);
}

.rec-title {
    font-size: 0.9em;
    color: #1b5e20;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.rec-shot {
    font-size: 2em;
    font-weight: bold;
    color: #1b5e20;
    margin: 10px 0;
}

.rec-note {
    font-size: 0.85em;
    color: #2e7d32;
    margin-top: 8px;
    font-style: italic;
}

.rec-source {
    font-size: 0.75em;
    color: #558b2f;
    margin-top: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stone-count {
    display: flex;
    justify-content: space-around;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
}

.count-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.count-label {
    font-size: 0.9em;
    font-weight: 600;
}

.blue-label {
    color: #1976d2;
}

.red-label {
    color: #d32f2f;
}

.count-value {
    font-size: 2em;
    font-weight: bold;
    color: #333;
    min-width: 40px;
    text-align: center;
}

.info-card {
    background: #fff3e0;
    border-left: 5px solid #ff9800;
}

.info-card h3 {
    color: #e65100;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.info-card ol {
    margin-left: 20px;
    line-height: 1.8;
    color: #5d4037;
}

.info-card li {
    margin-bottom: 8px;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    h1 {
        font-size: 2em;
    }

    .main-content {
        flex-direction: column;
        align-items: center;
    }

    canvas#rink {
        width: 100%;
        height: auto;
    }

    .controls-section {
        width: 100%;
        max-width: 100%;
    }
}