﻿* {
    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%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.game-container {
    width: 100%;
    max-width: 900px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, #7950f2 0%, #9775fa 100%);
    color: white;
    padding: 25px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 2em;
    font-weight: 700;
}

.stats {
    display: flex;
    gap: 30px;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat .label {
    font-size: 0.85em;
    opacity: 0.9;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat span:last-child {
    font-size: 1.8em;
    font-weight: bold;
}

.game-content {
    padding: 40px 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.game-board {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 15px;
    min-height: 400px;
}

.tube {
    width: 70px;
    height: 280px;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.9), rgba(240, 240, 240, 0.9));
    border: 4px solid #dee2e6;
    border-radius: 15px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column-reverse;
    padding: 8px;
    gap: 4px;
}

.tube::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to right,
            rgba(255, 255, 255, 0.3) 0%,
            rgba(255, 255, 255, 0) 30%,
            rgba(255, 255, 255, 0) 70%,
            rgba(0, 0, 0, 0.05) 100%);
    border-radius: 11px;
    pointer-events: none;
}

.tube:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.tube.selected {
    border-color: #7950f2;
    transform: translateY(-8px) scale(1.05);
    box-shadow: 0 8px 30px rgba(121, 80, 242, 0.4);
    animation: pulse 0.5s ease-in-out;
}

.tube.valid-target {
    border-color: #51cf66;
    box-shadow: 0 4px 20px rgba(81, 207, 102, 0.4);
    animation: validPulse 1s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: translateY(-8px) scale(1.05);
    }

    50% {
        transform: translateY(-10px) scale(1.08);
    }
}

@keyframes validPulse {

    0%,
    100% {
        box-shadow: 0 4px 20px rgba(81, 207, 102, 0.4);
    }

    50% {
        box-shadow: 0 4px 25px rgba(81, 207, 102, 0.6);
    }
}

.ball {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    position: relative;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow:
        0 4px 8px rgba(0, 0, 0, 0.2),
        inset 0 -4px 8px rgba(0, 0, 0, 0.3);
}

.ball::before {
    content: '';
    position: absolute;
    top: 15%;
    left: 20%;
    width: 30%;
    height: 30%;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.8), transparent);
    border-radius: 50%;
}

.ball::after {
    content: '';
    position: absolute;
    bottom: 10%;
    right: 15%;
    width: 20%;
    height: 20%;
    background: radial-gradient(circle, rgba(0, 0, 0, 0.2), transparent);
    border-radius: 50%;
}

.ball.moving {
    animation: ballBounce 0.5s ease-in-out;
}

@keyframes ballBounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-30px);
    }
}

/* Ball Colors */
.ball.color-0 {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
}

.ball.color-1 {
    background: linear-gradient(135deg, #51cf66 0%, #37b24d 100%);
}

.ball.color-2 {
    background: linear-gradient(135deg, #339af0 0%, #1c7ed6 100%);
}

.ball.color-3 {
    background: linear-gradient(135deg, #ffd43b 0%, #fab005 100%);
}

.ball.color-4 {
    background: linear-gradient(135deg, #ff8787 0%, #ff6b9d 100%);
}

.ball.color-5 {
    background: linear-gradient(135deg, #cc5de8 0%, #9c36b5 100%);
}

.ball.color-6 {
    background: linear-gradient(135deg, #20c997 0%, #12b886 100%);
}

.ball.color-7 {
    background: linear-gradient(135deg, #ff922b 0%, #fd7e14 100%);
}

.ball.color-8 {
    background: linear-gradient(135deg, #a9e34b 0%, #82c91e 100%);
}

.ball.color-9 {
    background: linear-gradient(135deg, #748ffc 0%, #5c7cfa 100%);
}

.controls {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.btn {
    background: linear-gradient(135deg, #7950f2 0%, #9775fa 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(121, 80, 242, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(121, 80, 242, 0.4);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: linear-gradient(135deg, #868e96 0%, #6c757d 100%);
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.3);
}

.btn-secondary:hover:not(:disabled) {
    box-shadow: 0 6px 20px rgba(108, 117, 125, 0.4);
}

.icon {
    font-size: 1.2em;
}

.level-selector {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 15px 30px;
    background: #f8f9fa;
    border-radius: 15px;
}

.level-nav {
    background: linear-gradient(135deg, #7950f2 0%, #9775fa 100%);
    color: white;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    font-size: 1.2em;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(121, 80, 242, 0.3);
}

.level-nav:hover:not(:disabled) {
    transform: scale(1.1);
    box-shadow: 0 6px 15px rgba(121, 80, 242, 0.4);
}

.level-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.level-info {
    font-size: 1.3em;
    font-weight: 600;
    color: #495057;
    min-width: 100px;
    text-align: center;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.overlay.hidden {
    display: none;
}

.overlay-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    position: relative;
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.overlay-content h2 {
    font-size: 2.5em;
    color: #7950f2;
    margin-bottom: 15px;
}

.overlay-content p {
    font-size: 1.2em;
    color: #666;
    margin-bottom: 25px;
}

.instructions {
    text-align: left;
    margin: 25px 0;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
}

.instruction-item {
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 12px 0;
    font-size: 1.05em;
}

.inst-icon {
    font-size: 1.5em;
    width: 35px;
    text-align: center;
}

.win-stats {
    margin: 25px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.win-stat {
    margin: 10px 0;
    font-size: 1.2em;
}

.win-label {
    font-weight: 600;
    color: #495057;
}

.badge {
    display: inline-block;
    background: linear-gradient(135deg, #ffd43b 0%, #fab005 100%);
    color: #fff;
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(250, 176, 5, 0.3);
}

.win-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.confetti {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #7950f2;
    top: -10px;
    opacity: 0;
    animation: confettiFall 3s ease-out forwards;
}

@keyframes confettiFall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(600px) rotate(720deg);
        opacity: 0;
    }
}

.footer {
    padding: 20px 30px;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

.btn-home {
    background: #6c757d;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-home:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

/* Social Section */
.social-section {
    padding: 30px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-top: 1px solid #dee2e6;
}

.social-header {
    text-align: center;
    margin-bottom: 20px;
}

.social-header h3 {
    font-size: 1.5em;
    color: #495057;
    margin-bottom: 5px;
}

.social-header p {
    color: #6c757d;
    font-size: 1em;
}

.social-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.social-btn {
    background: white;
    border: 2px solid #dee2e6;
    padding: 12px 25px;
    border-radius: 50px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.social-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.social-btn.liked {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
    color: white;
    border-color: #ff6b6b;
}

.like-btn:hover:not(.liked) {
    border-color: #ff6b6b;
    color: #ff6b6b;
}

.share-btn:hover {
    border-color: #51cf66;
    color: #51cf66;
}

.comment-btn:hover {
    border-color: #7950f2;
    color: #7950f2;
}

.social-icon {
    font-size: 1.3em;
}

.social-count {
    background: #e9ecef;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.9em;
    min-width: 30px;
    text-align: center;
}

.liked .social-count {
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

/* Comment Section */
.comment-section {
    padding: 30px;
    background: white;
    border-top: 1px solid #dee2e6;
    max-height: 500px;
    overflow-y: auto;
}

.comment-section.hidden {
    display: none;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.comment-header h3 {
    font-size: 1.3em;
    color: #495057;
}

.close-comments {
    background: #e9ecef;
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    font-size: 1.2em;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-comments:hover {
    background: #dee2e6;
    transform: rotate(90deg);
}

.comment-input-area {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.comment-input-area input {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid #dee2e6;
    border-radius: 25px;
    font-size: 1em;
    font-family: inherit;
    transition: all 0.3s ease;
}

.comment-input-area input:focus {
    outline: none;
    border-color: #7950f2;
    box-shadow: 0 0 0 3px rgba(121, 80, 242, 0.1);
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.no-comments {
    text-align: center;
    color: #adb5bd;
    padding: 30px;
    font-style: italic;
}

.comment-item {
    background: #f8f9fa;
    padding: 15px 20px;
    border-radius: 15px;
    border-left: 4px solid #7950f2;
    animation: slideInComment 0.3s ease-out;
}

@keyframes slideInComment {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.comment-header-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.comment-author {
    font-weight: 600;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 8px;
}

.comment-author::before {
    content: '👤';
    font-size: 1.2em;
}

.comment-time {
    font-size: 0.85em;
    color: #adb5bd;
}

.comment-text {
    color: #495057;
    line-height: 1.5;
    word-wrap: break-word;
}

.comment-delete {
    background: none;
    border: none;
    color: #ff6b6b;
    cursor: pointer;
    font-size: 0.9em;
    padding: 5px 10px;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.comment-delete:hover {
    background: #fff5f5;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 15px;
    }

    .header h1 {
        font-size: 1.5em;
    }

    .stats {
        gap: 20px;
    }

    .stat span:last-child {
        font-size: 1.4em;
    }

    .game-board {
        gap: 12px;
        padding: 15px;
    }

    .tube {
        width: 60px;
        height: 240px;
    }

    .ball {
        width: 46px;
        height: 46px;
    }

    .overlay-content {
        padding: 25px;
    }

    .overlay-content h2 {
        font-size: 2em;
    }
}

@media (max-width: 480px) {
    .tube {
        width: 50px;
        height: 200px;
    }

    .ball {
        width: 38px;
        height: 38px;
    }
}

/* ========================================
   RESPONSIVE ADDITIONS
   ======================================== */

/* ========================================
   Universal Responsive Game Styles
   Add this to all game style.css files
   ======================================== */

/* Canvas Auto-Resize */
.canvas-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    aspect-ratio: 1 / 1;
    /* Maintains square aspect ratio */
}

#game-canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    max-width: 100%;
    border-radius: 15px;
    touch-action: none;
    /* Prevents scrolling while playing */
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .canvas-container {
        max-width: 100%;
        padding: 0 !important;
    }

    .game-title {
        font-size: 1.8rem !important;
        text-align: center;
    }

    .score-display {
        flex-wrap: wrap;
        gap: 0.5rem !important;
        justify-content: center;
    }

    .score-item {
        padding: 0.7rem 1.5rem !important;
        font-size: 0.9rem;
    }

    .score-value {
        font-size: 1.5rem !important;
    }

    /* Make social buttons stack vertically on mobile */
    .social-section {
        margin-top: 1rem;
    }

    .social-buttons {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }

    .social-btn {
        width: 100% !important;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px !important;
    }

    .game-container {
        padding: 1rem 0.5rem !important;
        gap: 1rem;
    }

    .game-title {
        font-size: 1.5rem !important;
        margin-bottom: 0.8rem !important;
    }

    .score-display {
        gap: 0.4rem !important;
        margin-bottom: 1rem !important;
        flex-direction: column;
        align-items: stretch;
    }

    .score-item {
        padding: 0.6rem 1rem !important;
        flex: 1;
        min-width: auto;
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
    }

    .score-label {
        font-size: 0.75rem !important;
    }

    .score-value {
        font-size: 1.3rem !important;
    }

    .canvas-container {
        padding: 0 !important;
        border-radius: 12px !important;
        margin: 0 auto;
    }

    .instructions {
        font-size: 0.85rem !important;
        padding: 0.5rem !important;
        text-align: center;
    }

    .overlay {
        padding: 1.5rem !important;
    }

    .overlay h2 {
        font-size: 1.5rem !important;
        margin-bottom: 1rem !important;
    }

    .overlay p {
        font-size: 0.9rem !important;
        margin: 0.5rem 0 !important;
    }

    .game-btn {
        padding: 0.8rem 2rem !important;
        font-size: 1rem !important;
        width: 100%;
        max-width: 200px;
    }

    /* Mobile hint for touch controls */
    .canvas-container::after {
        content: "ðŸ’¡ Swipe to move";
        display: block;
        text-align: center;
        font-size: 0.75rem;
        color: rgba(255, 255, 255, 0.5);
        margin-top: 0.5rem;
        font-style: italic;
    }
}

/* Touch Controls Enhancement */
@media (hover: none) and (pointer: coarse) {

    /* Touch device detected */
    .game-btn {
        min-height: 44px;
        min-width: 120px;
    }

    button,
    .social-btn {
        min-height: 44px;
        padding: 0.7rem 1.2rem;
    }
}

/* Landscape Mode for Mobile */
@media (max-width: 768px) and (orientation: landscape) {
    body {
        padding: 5px;
    }

    .game-container {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto 1fr auto;
        gap: 0.5rem;
        max-width: 100%;
    }

    .game-title {
        grid-column: 1 / -1;
        font-size: 1.3rem !important;
        margin-bottom: 0.5rem !important;
    }

    .score-display {
        grid-column: 1 / -1;
        margin-bottom: 0.5rem !important;
    }

    .canvas-container {
        grid-column: 1;
        grid-row: 3;
        max-width: 400px;
        justify-self: center;
    }

    .instructions {
        grid-column: 1 / -1;
        grid-row: 4;
        margin-top: 0.5rem;
    }

    .social-section {
        grid-column: 2;
        grid-row: 3;
        align-self: start;
    }
}