/* Reset and Base Styles */
* {
    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;
    overflow: hidden;
}

.game-container {
    width: 100%;
    max-width: 900px;
    height: 90vh;
    max-height: 700px;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* HUD Styles */
.hud {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 15px 20px;
    background: linear-gradient(180deg, #f5f5f5 0%, #e8e8e8 100%);
    border-bottom: 3px solid #d0d0d0;
    flex-shrink: 0;
}

.hud-item {
    text-align: center;
    flex: 1;
}

.hud-item .label {
    font-size: 12px;
    color: #666;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.hud-item .value {
    font-size: 24px;
    font-weight: bold;
    color: #333;
}

.focus-container {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
}

.focus-bar {
    width: 150px;
    height: 20px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid #ccc;
    position: relative;
}

.focus-fill {
    height: 100%;
    background: linear-gradient(90deg, #4caf50 0%, #8bc34a 50%, #ffc107 80%, #f44336 100%);
    width: 100%;
    transition: width 0.3s ease, background 0.3s ease;
    border-radius: 8px;
}

.focus-text {
    font-size: 14px;
    font-weight: bold;
    color: #333;
    min-width: 45px;
}

.streak-value {
    font-size: 24px;
    font-weight: bold;
    color: #333;
    transition: all 0.3s ease;
}

/* Game Area */
.game-area {
    flex: 1;
    position: relative;
    background: linear-gradient(180deg, #e3f2fd 0%, #bbdefb 100%);
    overflow: hidden;
}

.office-background {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
}

.desk {
    font-size: 80px;
    margin-bottom: 20px;
    animation: pulse 2s ease-in-out infinite;
}

/* Worker Character */
.worker-container {
    position: relative;
    margin: 20px 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.worker {
    font-size: 100px;
    transition: all 0.3s ease;
    position: relative;
    z-index: 10;
}

.worker.hit {
    animation: workerHit 0.6s ease-out;
}

.worker.hurt {
    filter: hue-rotate(0deg) saturate(1.5);
    animation: workerHurt 0.5s ease-out;
}

.hit-effect {
    position: absolute;
    font-size: 80px;
    opacity: 0;
    pointer-events: none;
    z-index: 20;
    transform: translate(-50%, -50%);
}

.hit-effect.show {
    animation: hitExplosion 0.6s ease-out;
}

.hurt-text {
    position: absolute;
    top: -40px;
    font-size: 32px;
    font-weight: bold;
    color: #f44336;
    opacity: 0;
    pointer-events: none;
    z-index: 15;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.hurt-text.show {
    animation: hurtTextPop 0.8s ease-out;
}

.worker.celebrate {
    animation: workerCelebrate 0.6s ease-out;
}

/* Combo Effect */
.combo-effect {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 200;
    pointer-events: none;
    opacity: 0;
}

.combo-effect.show {
    animation: comboPop 1.5s ease-out;
}

.combo-text {
    font-size: 48px;
    font-weight: bold;
    color: #ff6b6b;
    text-shadow: 0 0 20px rgba(255, 107, 107, 0.8),
                 0 0 40px rgba(255, 107, 107, 0.6),
                 3px 3px 6px rgba(0, 0, 0, 0.5);
    text-align: center;
    white-space: nowrap;
}

/* Power-up Indicator */
.powerup-indicator {
    position: absolute;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #4caf50 0%, #8bc34a 100%);
    color: white;
    padding: 15px 25px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
    z-index: 150;
    opacity: 0;
    transform: translateX(100px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.powerup-indicator.active {
    opacity: 1;
    transform: translateX(0);
    animation: powerupSlide 0.5s ease-out;
}

.message {
    font-size: 24px;
    color: #555;
    text-align: center;
    padding: 20px;
    font-weight: 500;
}

/* Event Popup */
.event-popup {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    min-width: 350px;
    max-width: 90%;
    z-index: 100;
    animation: popIn 0.3s ease-out;
    border: 4px solid #ff6b6b;
}

.event-popup.hidden {
    display: none;
}

.event-content {
    text-align: center;
}

.event-title {
    font-size: 28px;
    font-weight: bold;
    color: #333;
    margin-bottom: 15px;
    animation: shake 0.5s ease-in-out;
}

.event-description {
    font-size: 16px;
    color: #666;
    margin-bottom: 20px;
    line-height: 1.5;
}

.event-timer {
    margin-bottom: 25px;
}

.timer-bar {
    width: 100%;
    height: 30px;
    background: #e0e0e0;
    border-radius: 15px;
    overflow: hidden;
    border: 2px solid #ccc;
    margin-bottom: 10px;
}

.timer-fill {
    height: 100%;
    background: linear-gradient(90deg, #4caf50 0%, #ffc107 50%, #f44336 100%);
    width: 100%;
    transition: width 0.1s linear;
    border-radius: 13px;
}

.timer-text {
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.event-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    font-size: 16px;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-action {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.btn-action:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 40px;
    font-size: 18px;
    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-secondary {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
    color: white;
    padding: 15px 40px;
    font-size: 18px;
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.4);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108, 117, 125, 0.6);
}

/* Screen Overlays */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
    animation: fadeIn 0.3s ease-in;
}

.screen.hidden {
    display: none;
}

.screen-content {
    text-align: center;
    color: white;
    padding: 40px;
    max-width: 800px;
    margin: 0 auto;
}

.menu-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    max-width: 300px;
    margin-top: 20px;
}

.btn-menu {
    width: 100%;
    padding: 18px 30px;
    font-size: 18px;
}

.screen-content h1 {
    font-size: 48px;
    margin-bottom: 10px;
    animation: bounce 1s ease-in-out;
}

.screen-content h2 {
    font-size: 32px;
    margin-bottom: 20px;
    color: #ffc107;
}

.subtitle {
    font-size: 18px;
    color: #ccc;
    margin-bottom: 30px;
    line-height: 1.6;
}

.final-stats {
    display: flex;
    gap: 40px;
    justify-content: center;
    margin: 30px 0;
}

.game-over-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

.stat {
    text-align: center;
}

.stat-label {
    font-size: 14px;
    color: #aaa;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 36px;
    font-weight: bold;
    color: #ffc107;
}

/* Toast Messages */
.toast {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 150;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    max-width: 80%;
    text-align: center;
}

.toast.show {
    opacity: 1;
    animation: slideUp 0.3s ease-out;
}

/* Animations */
@keyframes popIn {
    from {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }
    to {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

@keyframes slideUp {
    from {
        transform: translateX(-50%) translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

.flash {
    animation: flash 0.3s ease-out;
}

@keyframes flash {
    0%, 100% { background: transparent; }
    50% { background: rgba(244, 67, 54, 0.3); }
}

/* Worker Hit Animations */
@keyframes workerHit {
    0% {
        transform: translateX(0) rotate(0deg) scale(1);
    }
    25% {
        transform: translateX(-30px) rotate(-15deg) scale(0.9);
    }
    50% {
        transform: translateX(30px) rotate(15deg) scale(0.95);
    }
    75% {
        transform: translateX(-15px) rotate(-5deg) scale(0.98);
    }
    100% {
        transform: translateX(0) rotate(0deg) scale(1);
    }
}

@keyframes workerHurt {
    0%, 100% {
        filter: hue-rotate(0deg) saturate(1) brightness(1);
    }
    50% {
        filter: hue-rotate(350deg) saturate(1.8) brightness(1.2);
    }
}

@keyframes hitExplosion {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5) rotate(0deg);
    }
    30% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2) rotate(180deg);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.5) rotate(360deg);
    }
}

@keyframes hurtTextPop {
    0% {
        opacity: 0;
        transform: translateY(0) scale(0.5);
    }
    30% {
        opacity: 1;
        transform: translateY(-30px) scale(1.2);
    }
    70% {
        opacity: 1;
        transform: translateY(-50px) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-70px) scale(0.8);
    }
}

/* Screen Shake on Hit */
.game-area.hit-shake {
    animation: screenShake 0.5s ease-out;
}

@keyframes screenShake {
    0%, 100% { transform: translateX(0); }
    10% { transform: translateX(-10px) rotate(-1deg); }
    20% { transform: translateX(10px) rotate(1deg); }
    30% { transform: translateX(-8px) rotate(-0.5deg); }
    40% { transform: translateX(8px) rotate(0.5deg); }
    50% { transform: translateX(-5px) rotate(-0.3deg); }
    60% { transform: translateX(5px) rotate(0.3deg); }
    70% { transform: translateX(-3px); }
    80% { transform: translateX(3px); }
    90% { transform: translateX(-1px); }
}

@keyframes workerCelebrate {
    0%, 100% { transform: translateY(0) scale(1) rotate(0deg); }
    25% { transform: translateY(-20px) scale(1.1) rotate(-10deg); }
    50% { transform: translateY(-30px) scale(1.15) rotate(10deg); }
    75% { transform: translateY(-15px) scale(1.05) rotate(-5deg); }
}

@keyframes comboPop {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.3);
    }
    30% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }
    60% {
        opacity: 1;
        transform: translate(-50%, -60%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -80%) scale(0.8);
    }
}

@keyframes powerupSlide {
    0% {
        transform: translateX(100px);
        opacity: 0;
    }
    50% {
        transform: translateX(-10px);
        opacity: 1;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .game-container {
        height: 100vh;
        max-height: none;
        border-radius: 0;
    }

    .hud {
        flex-direction: column;
        gap: 10px;
        padding: 10px;
    }

    .hud-item {
        width: 100%;
    }

    .focus-bar {
        width: 200px;
    }

    .event-popup {
        min-width: 90%;
        padding: 20px;
    }

    .event-title {
        font-size: 22px;
    }

    .event-actions {
        flex-direction: column;
    }

    .btn-action {
        width: 100%;
    }

    .screen-content h1 {
        font-size: 36px;
    }

    .screen-content h2 {
        font-size: 24px;
    }

    .final-stats {
        flex-direction: column;
        gap: 20px;
    }

    .worker {
        font-size: 70px;
    }

    .hit-effect {
        font-size: 60px;
    }

    .hurt-text {
        font-size: 24px;
        top: -30px;
    }

    .game-over-buttons {
        flex-direction: column;
    }

    .menu-buttons {
        max-width: 100%;
    }

    .scoreboard-item {
        flex-direction: column;
        text-align: center;
    }

    .scoreboard-details {
        text-align: center;
    }

    .scoreboard-stats {
        justify-content: center;
    }

    .about-content {
        text-align: left;
    }

    .about-header,
    .about-scrollable,
    .about-footer {
        padding: 15px 20px;
    }

    .about-scrollable {
        max-height: calc(100vh - 180px);
    }
}

/* Scoreboard Styles */
.scoreboard-container {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 20px;
    margin: 30px 0;
    max-height: 400px;
    overflow-y: auto;
}

.scoreboard-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.scoreboard-item {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.2s ease, background 0.2s ease;
}

.scoreboard-item:hover {
    transform: translateX(5px);
    background: rgba(255, 255, 255, 0.2);
}

.scoreboard-rank {
    font-size: 32px;
    font-weight: bold;
    min-width: 80px;
    text-align: center;
}

.scoreboard-details {
    flex: 1;
    text-align: left;
}

.scoreboard-score {
    font-size: 24px;
    font-weight: bold;
    color: #ffc107;
    margin-bottom: 8px;
}

.scoreboard-stats {
    display: flex;
    gap: 15px;
    font-size: 14px;
    color: #ccc;
    margin-bottom: 5px;
}

.scoreboard-date {
    font-size: 12px;
    color: #aaa;
}

.scoreboard-empty {
    text-align: center;
    color: #aaa;
    font-style: italic;
    padding: 40px;
}

/* About Screen Styles */
.about-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 800px;
    padding: 0;
}

.about-header {
    text-align: center;
    padding: 20px 40px;
    flex-shrink: 0;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.about-header h1 {
    margin: 0;
}

.about-scrollable {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 40px;
    max-height: calc(100vh - 200px);
}

.about-scrollable::-webkit-scrollbar {
    width: 8px;
}

.about-scrollable::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.about-scrollable::-webkit-scrollbar-thumb {
    background: rgba(255, 193, 7, 0.5);
    border-radius: 10px;
}

.about-scrollable::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 193, 7, 0.7);
}

.about-content {
    text-align: left;
    max-width: 700px;
    margin: 0 auto;
}

.about-footer {
    padding: 20px 40px;
    text-align: center;
    flex-shrink: 0;
    border-top: 2px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.3);
}

.about-section {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.about-section h3 {
    color: #ffc107;
    margin-bottom: 15px;
    font-size: 20px;
}

.about-section p {
    line-height: 1.8;
    margin-bottom: 10px;
    color: #e0e0e0;
}

.about-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.about-list li {
    padding: 8px 0;
    padding-left: 25px;
    position: relative;
    line-height: 1.6;
    color: #e0e0e0;
}

.about-list li:before {
    content: "▸";
    position: absolute;
    left: 0;
    color: #ffc107;
    font-weight: bold;
}

.team-name {
    font-size: 24px;
    color: #ffc107;
    text-align: center;
    margin: 10px 0;
    font-weight: bold;
}

.credits-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.credit-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border-left: 3px solid #ffc107;
}

.credit-role {
    font-weight: bold;
    color: #ffc107;
    min-width: 150px;
    margin-right: 15px;
}

.credit-name {
    color: #e0e0e0;
    font-size: 16px;
}

@media (max-width: 768px) {
    .credit-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .credit-role {
        min-width: auto;
        margin-right: 0;
        margin-bottom: 5px;
    }
}
