/* Shape Hunt Game Styles */

:root {
    --color-bg: #f8f9fa;
    --color-header: #FFD93D;
    --color-text: #333;
    --color-text-light: rgba(0, 0, 0, 0.6);
    --color-success: #4CAF50;
    --color-error: #E53935;
    --color-overlay: rgba(0, 0, 0, 0.85);
    --font-main: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-main);
    background: var(--color-bg);
    color: var(--color-text);
}

.game-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    user-select: none;
    -webkit-user-select: none;
}

/* Header */
.header {
    background: var(--color-header);
    padding: 0.75rem 1rem;
    text-align: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.instruction {
    font-size: 0.875rem;
    color: var(--color-text-light);
    margin-bottom: 0.5rem;
}

.target-container {
    display: flex;
    justify-content: center;
    margin-bottom: 0.5rem;
}

.target-shape {
    background: white;
    border-radius: 12px;
    padding: 0.75rem 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.target-shape .shape {
    width: 56px;
    height: 56px;
}

.stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.round-info {
    color: var(--color-text);
}

.timer {
    color: var(--color-text-light);
}

/* Play Field */
.play-field {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
}

/* Shapes */
.shape {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, opacity 0.15s ease;
    animation: popIn 0.3s ease;
    /* Slight shadow for depth */
    filter: drop-shadow(1px 2px 2px rgba(0, 0, 0, 0.15));
}

.shape.clickable {
    cursor: pointer;
}

.shape.clickable:hover {
    transform: scale(1.1);
}

.shape.clickable:active {
    transform: scale(0.95);
}

.shape.found {
    animation: found 0.5s ease forwards;
}

.shape.wrong {
    animation: shake 0.3s ease;
}

/* Shape types */
.shape-circle {
    border-radius: 50%;
    background-color: var(--shape-color);
}

.shape-square {
    border-radius: 4px;
    background-color: var(--shape-color);
}

.shape-triangle,
.shape-diamond,
.shape-star,
.shape-hexagon {
    background: transparent;
}

.shape-triangle svg,
.shape-diamond svg,
.shape-star svg,
.shape-hexagon svg {
    width: 100%;
    height: 100%;
}

/* Animations */
@keyframes popIn {
    from {
        transform: scale(0);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes found {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.3);
        box-shadow: 0 0 20px var(--color-success);
    }
    100% {
        transform: scale(1);
        opacity: 0.5;
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-6px); }
    80% { transform: translateX(6px); }
}

/* Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--color-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 100;
}

.overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.overlay.visible.new-best {
    animation: celebrate-overlay 0.6s ease-out;
}

.overlay.visible.new-best .overlay-title {
    color: #FFD93D;
}

.overlay.visible.new-best .overlay-score {
    animation: score-pop 0.4s ease-out;
    color: #FFD93D;
}

@keyframes celebrate-overlay {
    0% {
        background: rgba(255, 217, 61, 0.3);
    }
    50% {
        background: rgba(255, 217, 61, 0.15);
    }
    100% {
        background: var(--color-overlay);
    }
}

@keyframes score-pop {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.overlay-content {
    text-align: center;
    color: white;
    padding: 2rem;
    max-width: 90%;
}

.overlay-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.overlay-text {
    font-size: 1.125rem;
    margin-bottom: 1rem;
    opacity: 0.9;
}

.overlay-score {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.overlay-best {
    font-size: 1rem;
    opacity: 0.7;
    margin-bottom: 1.5rem;
}

.start-btn {
    background: var(--color-header);
    color: var(--color-text);
    border: none;
    padding: 1rem 3rem;
    font-size: 1.25rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.start-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 20px rgba(255, 217, 61, 0.4);
}

.start-btn:active {
    transform: scale(0.98);
}

/* Home Link */
.home-link {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    color: var(--color-text);
    text-decoration: none;
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    background: white;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: background 0.2s, box-shadow 0.2s;
    z-index: 50;
}

.home-link:hover {
    background: #f0f0f0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.home-link:active {
    transform: translateX(-50%) scale(0.95);
}

/* Responsive */
@media (max-width: 600px) {
    .header {
        padding: 0.5rem 0.75rem;
    }

    .title {
        font-size: 1rem;
    }

    .target-shape {
        padding: 0.5rem 1rem;
    }

    .target-shape .shape {
        width: 42px !important;
        height: 42px !important;
    }

    .overlay-title {
        font-size: 1.75rem;
    }
}

@media (max-width: 400px) {
    .target-shape .shape {
        width: 36px !important;
        height: 36px !important;
    }
}

/* Prevent text selection during gameplay */
.game-container * {
    user-select: none;
    -webkit-user-select: none;
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    .shape {
        animation: none;
    }

    .shape.found {
        animation: none;
        opacity: 0.5;
    }

    .shape.wrong {
        animation: none;
    }
}
