/* City Cleanup Simulator - Roblox-style UI */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --primary: #4CAF50;
    --primary-dark: #388E3C;
    --secondary: #2196F3;
    --accent: #FFC107;
    --danger: #F44336;
    --bg-dark: #1a1a2e;
    --bg-card: rgba(30, 30, 50, 0.95);
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    --radius: 12px;
    --radius-sm: 8px;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Segoe UI', 'Roboto', 'Arial', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    user-select: none;
    touch-action: none;
}

/* Loading Screen */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loading-content {
    text-align: center;
    padding: 40px;
}

.loading-icon {
    font-size: 80px;
    animation: bounce 1s infinite;
    margin-bottom: 20px;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.loading-content h1 {
    font-size: 2.5rem;
    margin-bottom: 30px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.loading-bar {
    width: 300px;
    max-width: 80vw;
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
    margin: 0 auto 20px;
}

.loading-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transition: width 0.3s ease;
    border-radius: 6px;
}

#loading-text {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Title Screen */
#title-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 900;
}

.title-content {
    text-align: center;
    padding: 40px;
}

.title-icon {
    font-size: 100px;
    margin-bottom: 20px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(-5deg); }
    50% { transform: translateY(-15px) rotate(5deg); }
}

.title-content h1 {
    font-size: 3rem;
    margin-bottom: 15px;
    line-height: 1.2;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.2rem;
    margin-bottom: 40px;
}

.btn-primary, .btn-secondary {
    display: block;
    width: 200px;
    margin: 15px auto;
    padding: 16px 32px;
    font-size: 1.1rem;
    font-weight: bold;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    text-align: center;
    box-sizing: border-box;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.5);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* How to Play */
#howto-screen {
    position: fixed;
    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: 950;
}

.howto-content {
    background: var(--bg-card);
    padding: 40px;
    border-radius: var(--radius);
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}

.howto-content h2 {
    margin-bottom: 25px;
    text-align: center;
}

.howto-content h3 {
    margin: 20px 0 10px;
    color: var(--primary);
}

.howto-content p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 20px;
}

.controls-list {
    margin-bottom: 20px;
}

.control-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.key {
    background: rgba(255, 255, 255, 0.1);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-family: monospace;
    font-weight: bold;
}

/* Game Container */
#game-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#game-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* HUD */
#hud {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

#hud > * {
    pointer-events: auto;
}

/* Top Bar */
.hud-top {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    background: linear-gradient(180deg, rgba(0,0,0,0.5) 0%, transparent 100%);
}

.stat-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
    padding: 10px 16px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.stat-icon {
    font-size: 1.3rem;
}

.stat-value {
    font-size: 1.2rem;
    font-weight: bold;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-right: 5px;
}

.stat-box.xp {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
}

.stat-box.xp > div:first-child {
    display: flex;
    align-items: center;
    gap: 8px;
}

.xp-bar {
    width: 80px;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    overflow: hidden;
}

.xp-fill {
    height: 100%;
    width: 0%;
    background: var(--accent);
    transition: width 0.3s ease;
}

.btn-icon {
    background: var(--bg-card);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    font-size: 1.3rem;
    cursor: pointer;
    margin-left: auto;
    box-shadow: var(--shadow);
}

/* Cleanliness Bar */
.cleanliness-container {
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
    padding: 10px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.cleanliness-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.cleanliness-bar {
    width: 150px;
    height: 10px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    overflow: hidden;
}

.cleanliness-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--danger), var(--accent), var(--primary));
    transition: width 0.5s ease;
}

.cleanliness-value {
    font-weight: bold;
    min-width: 40px;
}

/* Tool Selector */
.tool-selector {
    position: absolute;
    bottom: 20px;
    left: 20px;
    display: flex;
    gap: 10px;
}

.tool-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: var(--bg-card);
    padding: 12px 16px;
    border-radius: var(--radius);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow);
    position: relative;
}

.tool-item.active {
    border-color: var(--primary);
    background: rgba(76, 175, 80, 0.2);
}

.tool-item.locked {
    opacity: 0.5;
    cursor: not-allowed;
}

.tool-icon {
    font-size: 1.5rem;
}

.tool-name {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.tool-key {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--secondary);
    color: white;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tool-lock {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.65rem;
    color: var(--accent);
    white-space: nowrap;
}

/* Quest Panel */
.quest-panel {
    position: absolute;
    top: 140px;
    right: 20px;
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 15px;
    min-width: 220px;
    box-shadow: var(--shadow);
}

.quest-header {
    font-weight: bold;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.quest-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quest-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
}

.quest-item.completed {
    opacity: 0.5;
    text-decoration: line-through;
}

.quest-icon {
    font-size: 1.2rem;
}

.quest-text {
    flex: 1;
    font-size: 0.85rem;
}

.quest-progress {
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: bold;
}

/* Interaction Prompt */
#interact-prompt {
    position: absolute;
    bottom: 150px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.prompt-content {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
    padding: 12px 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.prompt-key {
    background: var(--primary);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1rem;
}

.prompt-text {
    font-size: 1rem;
}

/* Progress Ring */
.progress-ring {
    width: 60px;
    height: 60px;
}

.progress-ring svg {
    transform: rotate(-90deg);
}

.progress-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.2);
    stroke-width: 3;
}

.progress-bar {
    fill: none;
    stroke: var(--primary);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 97.39;
    stroke-dashoffset: 97.39;
    transition: stroke-dashoffset 0.1s linear;
}

/* Level Up Notification */
#level-up {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: levelUpAnim 2s ease forwards;
}

@keyframes levelUpAnim {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    20% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
    40% { transform: translate(-50%, -50%) scale(1); }
    80% { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -80%) scale(1); }
}

.level-up-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, var(--accent) 0%, #FF9800 100%);
    padding: 30px 50px;
    border-radius: var(--radius);
    box-shadow: 0 0 50px rgba(255, 193, 7, 0.5);
}

.level-up-icon {
    font-size: 3rem;
}

.level-up-text {
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
}

.level-up-level {
    font-size: 2rem;
    font-weight: bold;
    color: #333;
}

/* Reward Popup */
#reward-popup {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translateX(-50%);
    animation: rewardAnim 1s ease forwards;
}

@keyframes rewardAnim {
    0% { opacity: 0; transform: translateX(-50%) translateY(20px); }
    30% { opacity: 1; transform: translateX(-50%) translateY(0); }
    70% { opacity: 1; }
    100% { opacity: 0; transform: translateX(-50%) translateY(-30px); }
}

.reward-text {
    background: var(--primary);
    color: white;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-weight: bold;
    font-size: 1.2rem;
    box-shadow: var(--shadow);
}

/* Mobile Controls */
#mobile-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 200px;
    pointer-events: none;
    z-index: 150;
}

#mobile-controls > * {
    pointer-events: auto;
}

.joystick-container {
    position: absolute;
    bottom: 30px;
    left: 30px;
}

.joystick-base {
    width: 120px;
    height: 120px;
    background: rgba(255, 255, 255, 0.15);
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.joystick-stick {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    transition: transform 0.05s;
}

.mobile-buttons {
    position: absolute;
    bottom: 30px;
    right: 30px;
    display: flex;
    gap: 15px;
}

.mobile-btn {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: none;
    font-weight: bold;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: var(--shadow);
}

.jump-btn {
    background: var(--secondary);
    color: white;
}

.interact-btn {
    background: var(--primary);
    color: white;
    font-size: 1.5rem;
}

.mobile-tools {
    position: absolute;
    bottom: 120px;
    right: 30px;
    display: flex;
    gap: 10px;
}

.mobile-tool-btn {
    width: 50px;
    height: 50px;
    border-radius: var(--radius);
    border: 2px solid transparent;
    background: var(--bg-card);
    font-size: 1.3rem;
    cursor: pointer;
}

.mobile-tool-btn.active {
    border-color: var(--primary);
}

.mobile-tool-btn.locked {
    opacity: 0.4;
}

/* Pause Menu */
#pause-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 500;
}

.pause-content {
    background: var(--bg-card);
    padding: 40px;
    border-radius: var(--radius);
    min-width: 320px;
}

.pause-content h2 {
    text-align: center;
    margin-bottom: 30px;
}

.settings-list {
    margin-bottom: 30px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Toggle Switch */
.toggle {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.2);
    transition: 0.3s;
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle input:checked + .toggle-slider {
    background-color: var(--primary);
}

.toggle input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

/* Range Slider */
input[type="range"] {
    width: 100px;
    height: 6px;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
}

.pause-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Game Complete Screen */
#game-complete-screen {
    position: fixed;
    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: 600;
}

.game-complete-content {
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(76, 175, 80, 0.2) 100%);
    padding: 50px;
    border-radius: var(--radius);
    text-align: center;
    min-width: 320px;
    border: 2px solid var(--primary);
    box-shadow: 0 0 40px rgba(76, 175, 80, 0.3);
}

.complete-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: bounce 1s ease infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.game-complete-content h1 {
    color: var(--primary);
    font-size: 2.5rem;
    margin-bottom: 15px;
    text-shadow: 0 0 20px rgba(76, 175, 80, 0.5);
}

.complete-message {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 30px;
}

.complete-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Shop Panel */
#shop-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 400;
}

.shop-content {
    background: var(--bg-card);
    padding: 30px;
    border-radius: var(--radius);
    max-width: 400px;
    max-height: 80vh;
    overflow-y: auto;
}

.shop-content h2 {
    text-align: center;
    margin-bottom: 20px;
}

.shop-items {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.shop-item {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: var(--radius-sm);
}

.shop-item-icon {
    font-size: 2rem;
}

.shop-item-info {
    flex: 1;
}

.shop-item-name {
    font-weight: bold;
    margin-bottom: 4px;
}

.shop-item-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.shop-item-price {
    background: var(--accent);
    color: #333;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-weight: bold;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.shop-item-price:hover {
    transform: scale(1.05);
}

.shop-item-price:disabled {
    background: #666;
    cursor: not-allowed;
}

.shop-item.owned .shop-item-price {
    background: var(--primary);
    color: white;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
    .title-content h1 {
        font-size: 2rem;
    }

    .title-icon {
        font-size: 70px;
    }

    .quest-panel {
        display: none;
    }

    .tool-selector {
        display: none;
    }

    .cleanliness-container {
        top: 70px;
        padding: 8px 15px;
    }

    .cleanliness-label {
        display: none;
    }

    .hud-top {
        padding: 10px 15px;
        gap: 10px;
    }

    .stat-box {
        padding: 8px 12px;
    }

    .stat-value {
        font-size: 1rem;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}
