/* ============================================
   CINFUL HOMEBASE - Steampunk UI Theme
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;500;600&family=Crimson+Text:ital@0;1&display=swap');

:root {
    --bg-dark: #0a0908;
    --bg-panel: rgba(15, 12, 10, 0.85);
    --gold: #c8a050;
    --gold-bright: #e8c070;
    --gold-dim: #8a7040;
    --text-primary: #e8e4dc;
    --text-muted: #8a8680;
    --border-gold: rgba(200, 160, 80, 0.3);

    /* Faction colors */
    --sprawl: #9b59b6;
    --burnside: #c0392b;
    --heights: #27ae60;
    --utr: #f1c40f;
    --riverside: #3498db;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Crimson Text', Georgia, serif;
    background: var(--bg-dark);
    color: var(--text-primary);
}

/* ============================================
   GAME CONTAINER
   ============================================ */

.game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: grid;
    grid-template-columns: 180px 1fr 320px;
    gap: 0;
    padding: 20px;
}

.ui-frame {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    z-index: 10;
    opacity: 0.95;
}

/* ============================================
   PANELS
   ============================================ */

.panel {
    position: relative;
    z-index: 5;
    display: flex;
    flex-direction: column;
}

.panel-header {
    padding: 10px;
    text-align: center;
}

.panel-title {
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
    letter-spacing: 0.15em;
    color: var(--gold);
    text-transform: uppercase;
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

/* Hide scrollbar but keep functionality */
.panel-content::-webkit-scrollbar {
    width: 4px;
}

.panel-content::-webkit-scrollbar-track {
    background: transparent;
}

.panel-content::-webkit-scrollbar-thumb {
    background: var(--gold-dim);
    border-radius: 2px;
}

/* ============================================
   LEFT PANEL - INVENTORY
   ============================================ */

.panel-left {
    margin-top: 60px;
    margin-left: 25px;
    width: 130px;
    height: calc(100% - 120px);
}

.stats-bar {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
}

.stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 8px;
    background: rgba(200, 160, 80, 0.1);
    border-radius: 4px;
    font-size: 0.8rem;
}

.stat-label {
    color: var(--text-muted);
}

.stat-value {
    color: var(--gold);
    font-family: 'Cinzel', serif;
    font-weight: 600;
}

.inventory-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

.inventory-slot {
    aspect-ratio: 1;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-gold);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.inventory-slot:hover {
    border-color: var(--gold);
    background: rgba(200, 160, 80, 0.1);
}

.inventory-slot img {
    width: 80%;
    height: 80%;
    object-fit: contain;
}

/* ============================================
   CENTER PANEL - WORLD
   ============================================ */

.panel-center {
    margin-top: 30px;
    margin-left: 40px;
    margin-right: 20px;
    height: calc(100% - 80px);
}

.world-content {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.welcome-message h2 {
    font-family: 'Cinzel', serif;
    font-size: 1.8rem;
    color: var(--gold);
    margin-bottom: 1rem;
    letter-spacing: 0.1em;
}

.welcome-message p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.district-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 2rem;
}

.district-link {
    padding: 8px 16px;
    font-family: 'Cinzel', serif;
    font-size: 0.85rem;
    letter-spacing: 0.1em;
    text-decoration: none;
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-gold);
    border-radius: 4px;
    transition: all 0.3s ease;
}

.district-link:hover {
    background: rgba(200, 160, 80, 0.2);
    border-color: var(--gold);
    transform: translateY(-2px);
}

.district-link.sprawl:hover {
    border-color: var(--sprawl);
    color: var(--sprawl);
}

.district-link.burnside:hover {
    border-color: var(--burnside);
    color: var(--burnside);
}

.district-link.heights:hover {
    border-color: var(--heights);
    color: var(--heights);
}

.district-link.utr:hover {
    border-color: var(--utr);
    color: var(--utr);
}

.district-link.riverside:hover {
    border-color: var(--riverside);
    color: var(--riverside);
}

.arena-link {
    display: inline-block;
    padding: 12px 24px;
    font-family: 'Cinzel', serif;
    font-size: 1rem;
    letter-spacing: 0.15em;
    text-decoration: none;
    color: var(--burnside);
    background: rgba(192, 57, 43, 0.1);
    border: 2px solid var(--burnside);
    border-radius: 4px;
    transition: all 0.3s ease;
}

.arena-link:hover {
    background: rgba(192, 57, 43, 0.3);
    box-shadow: 0 0 20px rgba(192, 57, 43, 0.4);
    transform: translateY(-2px);
}

/* ============================================
   RIGHT PANEL - KINDRED CHAT
   ============================================ */

.panel-right {
    margin-top: 30px;
    margin-right: 25px;
    width: 290px;
    height: calc(100% - 80px);
    display: flex;
    flex-direction: column;
}

.kindred-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px;
}

.kindred-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--gold);
    object-fit: cover;
}

.kindred-details {
    display: flex;
    flex-direction: column;
}

.kindred-name {
    font-family: 'Cinzel', serif;
    font-size: 1rem;
    color: var(--gold);
}

.kindred-level {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 10px;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-messages::-webkit-scrollbar {
    width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--gold-dim);
    border-radius: 2px;
}

.message {
    max-width: 90%;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.message.user {
    align-self: flex-end;
    background: rgba(200, 160, 80, 0.2);
    border: 1px solid var(--border-gold);
    color: var(--text-primary);
}

.message.kindred {
    align-self: flex-start;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--gold-dim);
    color: var(--gold-bright);
}

.message.system {
    align-self: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
}

.chat-input-container {
    display: flex;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--border-gold);
}

#chatInput {
    flex: 1;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-gold);
    border-radius: 4px;
    padding: 8px;
    color: var(--text-primary);
    font-family: 'Crimson Text', serif;
    font-size: 0.9rem;
    resize: none;
}

#chatInput:focus {
    outline: none;
    border-color: var(--gold);
}

#chatInput::placeholder {
    color: var(--text-muted);
}

.send-btn {
    padding: 8px 16px;
    font-family: 'Cinzel', serif;
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    color: var(--gold);
    background: transparent;
    border: 1px solid var(--gold);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.send-btn:hover {
    background: rgba(200, 160, 80, 0.2);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   AVATAR DISPLAY (Mechanical Hand)
   ============================================ */

.avatar-display {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 15;
    width: 80px;
    pointer-events: none;
    display: none;
    /* Enable when we position it properly */
}

.player-avatar {
    width: 100%;
    border-radius: 4px;
}

/* ============================================
   LOADING OVERLAY
   ============================================ */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 9, 8, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    transition: opacity 0.5s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--gold-dim);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-overlay p {
    font-family: 'Cinzel', serif;
    color: var(--gold);
    letter-spacing: 0.1em;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 900px) {
    .game-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
    }

    .ui-frame {
        display: none;
    }

    .panel-left {
        order: 3;
        width: 100%;
        height: auto;
        margin: 0;
        padding: 10px;
    }

    .panel-center {
        order: 1;
        margin: 0;
        height: auto;
        min-height: 200px;
    }

    .panel-right {
        order: 2;
        width: 100%;
        height: 50vh;
        margin: 0;
    }

    .stats-bar {
        flex-direction: row;
        justify-content: space-around;
    }

    .inventory-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}