@import url('loading.css');

:root {
    --bg-dark: #0f0b15;
    --glass-bg: rgba(10, 10, 15, 0.85);
    --glass-border: rgba(255, 255, 255, 0.1);
    --accent: #8b5cf6;
    --accent-hover: #a78bfa;
    --text-main: #ffffff;
    --text-muted: #94a3b8;
    --radius: 16px;
    --blur: 0px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
}

body {
    font-family: 'Outfit', sans-serif;
    overflow: hidden;
    background-color: var(--bg-dark);
    color: var(--text-main);
    width: 100vw;
    height: 100vh;
}

#renderCanvas {
    width: 100%;
    height: 100%;
    touch-action: none;
    outline: none;
}

#start-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, rgba(139, 92, 246, 0.2), var(--bg-dark));
    z-index: 1000;
    transition: opacity 0.5s ease;
}

#start-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.start-content {
    padding: 60px 80px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 60px rgba(139, 92, 246, 0.2);
}

.game-title {
    font-size: 3.5rem;
    font-weight: 800;
    letter-spacing: -2px;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #fff 0%, #a78bfa 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.accent-text {
    color: var(--accent);
    -webkit-text-fill-color: var(--accent);
}

.game-subtitle {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 40px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.big-btn {
    font-size: 1.1rem;
    padding: 14px 40px;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: var(--accent);
    border: none;
    border-radius: 12px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: none;
}

.big-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 24px;
    transition: opacity 0.5s ease;
}

#ui-layer>* {
    pointer-events: auto;
}

.glass-panel {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    color: white;
}

.glass-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
}

.glass-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.glass-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.4);
}

#top-bar {
    position: relative;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 0 20px;
    height: 80px;
    pointer-events: none;
}

#top-bar>* {
    pointer-events: auto;
}

.header-left {
    display: none;
}

.sidebar-header {
    padding: 20px 24px 10px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    text-align: center;
}

.sidebar-header h1 {
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: 2px;
    color: var(--accent);
    margin: 0;
    text-transform: uppercase;
    opacity: 0.9;
}

.subtitle {
    color: var(--accent);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.description-text {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    font-style: italic;
    line-height: 1.4;
    margin-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 0.5rem;
}

.global-controls {
    display: flex;
    gap: 12px;
}

.icon-btn {
    width: 56px;
    height: 56px;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.icon-btn svg {
    width: 28px;
    height: 28px;
    stroke: var(--text-main);
    transition: all 0.2s ease;
}

.icon-btn:hover svg {
    stroke: white;
    transform: scale(1.1);
}

.cam-description {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    margin-right: 16px;
    text-align: right;
    transition: opacity 0.3s ease;
}

.cam-description.hidden {
    opacity: 0;
    pointer-events: none;
}

.mode-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mode-hint {
    font-size: 0.75rem;
    color: var(--accent);
}


#sidebar-panel {
    position: absolute;
    top: 24px;
    left: 24px;
    bottom: 24px;
    width: 340px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 10;
}

.sidebar-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow-y: auto;
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.3s ease;
}

.sidebar-view.hidden {
    display: none;
}


#view-list h3 {
    font-size: 0.9rem;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 15px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 10px;
    letter-spacing: 1px;
}

#creature-list {
    list-style: none;
    padding: 0;
}

.creature-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.creature-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(4px);
}

.creature-item.selected {
    background: rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.5);
}


.detail-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 20px;
}

#back-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    font-size: 1.2rem;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

#back-btn:hover {
    background: white;
    color: black;
}

.header-info h2 {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.subtitle {
    margin: 4px 0 0 0;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.detail-section {
    margin-bottom: 30px;
}

.detail-section h4 {
    margin: 0 0 12px 0;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    font-weight: 700;
}

.stats-group {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 16px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 0.95rem;
}

.stat-row:last-child {
    margin-bottom: 0;
}

.stat-val {
    font-weight: 700;
    color: white;
}

.bar-container {
    width: 120px;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: var(--accent);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.4);
}

.grid-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.action-btn {
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    text-align: center;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.action-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.anim-btn {
    padding: 8px;
    font-size: 0.85rem;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.type-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ccc;
}

.type-indicator.land {
    background: #10b981;
}

.type-indicator.aquatic {
    background: #06b6d4;
}

.type-indicator.flying {
    background: #f59e0b;
}

#detail-panel {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 600px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s;
}

#detail-panel.hidden {
    transform: translate(-50%, 120%);
    opacity: 0;
    pointer-events: none;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 12px;
}

.panel-header h2 {
    font-size: 1.5rem;
    margin-bottom: 4px;
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
}

.close-btn:hover {
    color: white;
}

.panel-body {
    display: flex;
    gap: 24px;
}

.stats-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 0.9rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.badget-state {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.anims-col {
    flex: 2;
    border-left: 1px solid var(--glass-border);
    padding-left: 24px;
}

.anims-col h4 {
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    margin-bottom: 10px;
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: all 0.4s ease;
}

.modal-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin-right: 12px;
    color: var(--accent);
    vertical-align: middle;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(1.1);
}

.modal-content {
    max-width: 480px;
    width: 90%;
    padding: 40px;
    text-align: center;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
}

.modal-content h2 {
    font-size: 1.7rem;
    margin-bottom: 20px;
    background: linear-gradient(135deg, white 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.modal-body {
    text-align: left;
    margin: 24px 0;
}

.modal-body ul {
    list-style: none;
    padding: 0;
}

.modal-body li {
    margin-bottom: 12px;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.modal-body strong {
    color: white;
}

.key {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 2px 8px;
    margin: 0 4px;
    font-family: monospace;
    font-size: 0.9rem;
    color: var(--accent);
}

#close-modal {
    width: 100%;
    margin-top: 24px;
}

@media (max-width: 768px) {
    #creature-list-panel {
        display: none;
    }

    #detail-panel {
        width: 100%;
        bottom: 0;
        left: 0;
        transform: translate(0, 0);
        border-radius: 16px 16px 0 0;
        max-width: none;
    }

    #detail-panel.hidden {
        transform: translate(0, 100%);
    }

    .panel-body {
        flex-direction: column;
    }

    .anims-col {
        border-left: none;
        border-top: 1px solid var(--glass-border);
        padding-left: 0;
        padding-top: 16px;
    }

    #sidebar-panel {
        top: auto;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 60vh;
        border-radius: 16px 16px 0 0;
        border-bottom: none;
    }
}

/* BRANDING & LOGO */
.brand-logo {
    margin-bottom: 24px;
    display: flex;
    justify-content: center;
}

.logo-image {
    width: 100px;
    height: 100px;
    filter: drop-shadow(0 0 20px rgba(139, 92, 246, 0.4));
    animation: floating 4s ease-in-out infinite;
}

@keyframes floating {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--glass-border);
}

.sidebar-logo {
    width: 32px;
    height: 32px;
}

.sidebar-header h1 {
    font-size: 1.2rem;
    letter-spacing: 1px;
    margin: 0;
    color: white;
}