﻿:root {
    --primary: #4a90e2;
    --primary-dark: #357abd;
    --secondary: #f0f4f8;
    --text: #333;
    --bg: #f9f9f9;
    --card-bg: #ffffff;
    --success: #2ecc71;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --radius: 12px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'M PLUS Rounded 1c', sans-serif;
}

body {
    background-color: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

#app {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

/* Sections */
section {
    display: none;
    animation: fadeIn 0.3s ease;
}

section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Card */
.card {
    background: var(--card-bg);
    padding: 30px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    max-width: 800px;
    margin: 0 auto;
}

h2 {
    margin-bottom: 15px;
    font-size: 1.2rem;
    color: var(--text);
    border-left: 5px solid var(--primary);
    padding-left: 10px;
}

h3 {
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 1rem;
    color: #666;
}

/* Upload Area */
.upload-area {
    border: 3px dashed #ccc;
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 30px;
    position: relative;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary);
    background: #eef7ff;
}

.upload-placeholder .icon {
    font-size: 48px;
    display: block;
    margin-bottom: 10px;
}

#preview-image {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

/* Difficulty Buttons */
.difficulty-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.diff-group h3 {
    margin-top: 0;
    margin-bottom: 15px;
    padding-bottom: 5px;
    border-bottom: 2px solid #eee;
}

.blue-group h3 {
    color: #4a90e2;
    border-color: #4a90e2;
}

.red-group h3 {
    color: #e74c3c;
    border-color: #e74c3c;
}

.buttons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
}

.diff-btn {
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 15px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: #f0f4f8;
}

/* Blue Group Buttons */
.blue-group .diff-btn:hover {
    background: #eef7ff;
    border-color: #a0c4ff;
}

.blue-group .diff-btn.selected {
    background: #eef7ff;
    border-color: #4a90e2;
    color: #2c3e50;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.2);
}

/* Red Group Buttons */
.red-group .diff-btn:hover {
    background: #fff0f0;
    border-color: #ffcccb;
}

.red-group .diff-btn.selected {
    background: #fff0f0;
    border-color: #e74c3c;
    color: #c0392b;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.2);
}

.diff-btn .label {
    font-weight: bold;
    font-size: 0.9rem;
}

.diff-btn .count {
    font-size: 1.2rem;
    font-weight: bold;
    opacity: 1;
}

#start-btn {
    width: 100%;
    padding: 15px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
}

#start-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

#start-btn:not(:disabled):hover {
    background: var(--primary-dark);
}

/* Game Screen */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    background: var(--card-bg);
    padding: 10px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.secondary-btn {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid #ccc;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
}

.secondary-btn:hover {
    background: #f0f0f0;
}

.timer {
    font-size: 1.5rem;
    font-weight: bold;
    font-variant-numeric: tabular-nums;
}

#canvas-container {
    width: 100%;
    height: 80vh;
    background: #333;
    /* Dark background for contrast */
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

canvas {
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal[hidden] {
    display: none !important;
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: var(--radius);
    text-align: center;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal h2 {
    color: var(--primary);
    font-size: 2rem;
    border: none;
    padding: 0;
    margin-bottom: 10px;
}

#play-again-btn {
    margin-top: 20px;
    padding: 10px 20px;
    background: var(--success);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1.1rem;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(46, 204, 113, 0.9);
    color: white;
    padding: 15px 30px;
    border-radius: 50px;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 2000;
    pointer-events: none;
    animation: slideUp 0.3s ease-out;
}

.toast[hidden] {
    display: none;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translate(-50%, 20px);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}
