/* Styles pour les mini-jeux des tâches */

/* Base des mini-jeux */
.task-game {
    padding: 1rem;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.task-game p {
    margin-bottom: 1.5rem;
    text-align: center;
    font-size: 1.1rem;
}

/* Mini-jeu 1: Code sequence */
.code-sequence {
    text-align: center;
}

.code-display {
    font-size: 3rem;
    font-weight: bold;
    font-family: monospace;
    background: var(--card-bg);
    padding: 1rem 2rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    letter-spacing: 0.5rem;
}

.code-input {
    font-size: 2rem;
    text-align: center;
    font-family: monospace;
    letter-spacing: 0.5rem;
    max-width: 200px;
}

/* Mini-jeu 2: Frequency match */
.frequency-match {
    width: 100%;
}

.frequency-display {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--card-bg);
    border-radius: 12px;
}

.freq-current {
    font-size: 1.5rem;
    font-weight: bold;
    transition: color 0.3s ease;
}

.freq-target {
    color: var(--text-secondary);
}

.freq-slider {
    width: 100%;
    height: 40px;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
}

.freq-slider::-webkit-slider-track {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
}

.freq-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
}

/* Mini-jeu 3: Wire connection */
.wire-connection {
    width: 100%;
}

.wires-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    height: 250px;
    position: relative;
}

.wires-left, .wires-right {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    height: 100%;
}

.wire-start, .wire-end {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 3px solid transparent;
}

.wire-start:hover, .wire-end:hover {
    transform: scale(1.1);
}

.wire-start.selected {
    border-color: white;
    animation: pulse 1s ease-in-out infinite;
}

.wire-start.connected, .wire-end.connected {
    opacity: 0.5;
    cursor: not-allowed;
}

#wireCanvas {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

/* Mini-jeu 4: Hold button */
.hold-button {
    width: 100%;
}

.hold-progress {
    width: 100%;
    height: 40px;
    background: var(--border-color);
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 2rem;
}

.hold-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--success-color), var(--secondary-color));
    transition: width 0.1s linear;
}

#holdBtn {
    font-size: 1.5rem;
    padding: 2rem 3rem;
    user-select: none;
    -webkit-user-select: none;
}

/* Mini-jeu 5: Color sort */
.color-sort {
    width: 100%;
}

.samples-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.sample {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    cursor: grab;
    transition: all 0.3s ease;
}

.sample:active {
    cursor: grabbing;
}

.sort-containers {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.sort-box {
    min-height: 100px;
    border: 3px dashed;
    border-radius: 12px;
    padding: 1rem;
    position: relative;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.sort-label {
    position: absolute;
    top: -12px;
    left: 1rem;
    background: var(--dark-bg);
    padding: 0 0.5rem;
    text-transform: capitalize;
}

/* Mini-jeu 6: Boot sequence */
.boot-sequence {
    width: 100%;
}

.boot-console {
    background: #000;
    color: #0f0;
    font-family: monospace;
    padding: 1rem;
    border-radius: 8px;
    min-height: 200px;
    margin-bottom: 1rem;
    overflow-y: auto;
}

.boot-line {
    margin-bottom: 0.5rem;
    animation: typewriter 0.5s steps(40, end);
}

@keyframes typewriter {
    from { width: 0; }
    to { width: 100%; }
}

/* Mini-jeu 7: Swipe debris */
.swipe-debris {
    width: 100%;
}

.debris-area {
    position: relative;
    width: 100%;
    height: 300px;
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
}

.debris {
    position: absolute;
    font-size: 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
}

.debris-counter {
    text-align: center;
    margin-top: 1rem;
    font-weight: bold;
}

/* Mini-jeu 8: Angle adjustment */
.angle-adjustment {
    width: 100%;
}

.antenna-container {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto 2rem;
}

.antenna-base {
    position: absolute;
    bottom: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    background: var(--text-secondary);
    border-radius: 50%;
    transform: translate(-50%, 50%);
}

.antenna {
    position: absolute;
    bottom: 50%;
    left: 50%;
    width: 4px;
    height: 80px;
    background: var(--primary-color);
    transform-origin: bottom;
    transform: translateX(-50%);
    transition: transform 0.1s ease;
}

.antenna::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 50%;
    width: 20px;
    height: 20px;
    background: var(--danger-color);
    border-radius: 50%;
    transform: translateX(-50%);
}

.angle-display {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    font-weight: bold;
    font-size: 1.2rem;
}

.angle-slider {
    width: 100%;
}

/* Mini-jeu 9: Progress wait */
.progress-wait {
    width: 100%;
}

.download-progress {
    width: 100%;
    height: 40px;
    background: var(--border-color);
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.download-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transition: width 1s linear;
}

.download-percent {
    font-size: 2rem;
    font-weight: bold;
    text-align: center;
    margin-bottom: 1rem;
}

.warning-text {
    color: var(--warning-color);
    animation: blink 2s ease-in-out infinite;
}

/* Mini-jeu 10: Balance levels */
.balance-levels {
    width: 100%;
}

.levels-container {
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    height: 200px;
    margin-bottom: 1rem;
}

.level-gauge {
    position: relative;
    width: 60px;
    height: 100%;
    background: var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.level-bar {
    position: absolute;
    bottom: 0;
    width: 100%;
    background: var(--danger-color);
    transition: all 0.3s ease;
}

.safe-zone {
    position: absolute;
    bottom: 40%;
    width: 100%;
    height: 20%;
    background: rgba(67, 160, 71, 0.2);
    border-top: 2px dashed var(--success-color);
    border-bottom: 2px dashed var(--success-color);
}

.level-btn {
    position: absolute;
    width: 100%;
    height: 30px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 1.2rem;
}

.level-btn.up {
    top: -35px;
}

.level-btn.down {
    bottom: -35px;
}

/* Mini-jeu 11: Cipher decode */
.cipher-decode {
    width: 100%;
}

.cipher-text {
    font-size: 2.5rem;
    font-weight: bold;
    font-family: monospace;
    letter-spacing: 0.5rem;
    background: var(--card-bg);
    padding: 1rem 2rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.decode-input {
    font-size: 1.5rem;
    text-align: center;
    font-family: monospace;
    text-transform: uppercase;
}

.hint {
    margin-top: 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Mini-jeu 12: Spot difference */
.spot-difference {
    width: 100%;
}

.anomaly-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.anomaly-cell {
    aspect-ratio: 1;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.anomaly-cell:hover {
    transform: scale(1.05);
}

.anomaly-cell.found {
    cursor: not-allowed;
}

.anomaly-counter {
    text-align: center;
    font-weight: bold;
}

/* Mini-jeu 13: Path drawing */
.path-drawing {
    width: 100%;
}

#pathCanvas {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
    cursor: crosshair;
    background: var(--card-bg);
}

/* Mini-jeu 14: Simon Says */
.simon-says {
    width: 100%;
}

.simon-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    width: 240px;
    height: 240px;
    margin: 0 auto 1.5rem;
}

.simon-button {
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0.6;
}

.simon-button:active,
.simon-button.active {
    opacity: 1;
    transform: scale(0.95);
    box-shadow: 0 0 20px currentColor;
}

.simon-level {
    text-align: center;
    font-weight: bold;
    margin-top: 1rem;
}

/* Mini-jeu 15: Tap targets */
.tap-targets {
    width: 100%;
}

.virus-area {
    position: relative;
    width: 100%;
    height: 300px;
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
}

.virus {
    position: absolute;
    font-size: 2.5rem;
    cursor: pointer;
    animation: virusFloat 3s ease-in-out infinite;
    transition: transform 0.3s ease;
}

@keyframes virusFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.virus:hover {
    transform: scale(1.2);
}

.virus-counter {
    text-align: center;
    margin-top: 1rem;
    font-weight: bold;
}

/* Mini-jeu par défaut */
.default {
    text-align: center;
}

/* Responsive */
@media (max-width: 480px) {
    .task-game {
        min-height: 250px;
    }

    .sort-containers {
        grid-template-columns: 1fr;
    }

    .levels-container {
        height: 150px;
    }
}