/* RuneQuest 3D - Stylesheet */
@import url('https://fonts.googleapis.com/css2?family=MedievalSharp&family=Press+Start+2P&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    overflow: hidden;
    background: #000;
    font-family: 'Segoe UI', Arial, sans-serif;
    color: #fff;
    cursor: default;
    user-select: none;
}

/* Login Screen */
#login-screen {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, #1a0a00 0%, #2d1810 30%, #1a0a00 60%, #0d0500 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

#login-screen::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><rect fill="%23000" fill-opacity="0.1" width="50" height="50"/><rect fill="%23000" fill-opacity="0.1" x="50" y="50" width="50" height="50"/></svg>');
    background-size: 20px 20px;
    opacity: 0.3;
}

#login-box {
    position: relative;
    background: linear-gradient(180deg, #3d2817 0%, #2a1a0e 100%);
    border: 3px solid #8b6914;
    border-radius: 8px;
    padding: 40px 50px;
    text-align: center;
    box-shadow: 0 0 30px rgba(139,105,20,0.3), inset 0 0 20px rgba(0,0,0,0.5);
    min-width: 400px;
}

#login-box h1 {
    font-family: 'MedievalSharp', cursive;
    font-size: 42px;
    color: #ffd700;
    text-shadow: 2px 2px 4px #000, 0 0 10px rgba(255,215,0,0.5);
    margin-bottom: 5px;
}

.subtitle {
    color: #c4a44a;
    font-size: 14px;
    margin-bottom: 30px;
}

#login-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#username-input {
    padding: 12px 15px;
    background: #1a0e05;
    border: 2px solid #5a3d1a;
    border-radius: 4px;
    color: #ffd700;
    font-size: 16px;
    text-align: center;
    outline: none;
    transition: border-color 0.3s;
}

#username-input:focus {
    border-color: #ffd700;
}

#username-input::placeholder {
    color: #6a5030;
}

#play-btn {
    padding: 14px 30px;
    background: linear-gradient(180deg, #4a8c2a 0%, #2d6b12 100%);
    border: 2px solid #6ab840;
    border-radius: 4px;
    color: #fff;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    text-shadow: 1px 1px 2px #000;
    transition: all 0.2s;
    letter-spacing: 1px;
}

#play-btn:hover {
    background: linear-gradient(180deg, #5aa03a 0%, #3d7b22 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(106,184,64,0.4);
}

.version {
    color: #5a4020;
    font-size: 11px;
    margin-top: 20px;
}

/* Loading Screen */
#loading-screen {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #1a0a00;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

#loading-content {
    text-align: center;
    width: 400px;
}

#loading-content h2 {
    font-family: 'MedievalSharp', cursive;
    color: #ffd700;
    font-size: 28px;
    margin-bottom: 20px;
}

#loading-bar-container {
    width: 100%;
    height: 24px;
    background: #1a0e05;
    border: 2px solid #5a3d1a;
    border-radius: 4px;
    overflow: hidden;
}

#loading-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #4a8c2a, #6ab840);
    transition: width 0.3s;
    border-radius: 2px;
}

#loading-text {
    color: #c4a44a;
    margin-top: 10px;
    font-size: 13px;
}

/* Game Canvas */
#game-canvas {
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Game UI */
#game-ui {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 10;
    pointer-events: none;
}

#game-ui > * {
    pointer-events: auto;
}

/* Top Bar */
#top-bar {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 32px;
    background: linear-gradient(180deg, rgba(30,20,10,0.95), rgba(20,12,5,0.9));
    border-bottom: 1px solid #5a3d1a;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    font-size: 13px;
}

#player-info {
    display: flex;
    gap: 15px;
}

#player-name-display {
    color: #ffd700;
    font-weight: bold;
}

#combat-level-display, #total-level-display {
    color: #c4a44a;
}

#location-display {
    color: #7ec850;
    font-weight: bold;
}

/* Health/Prayer/Run Orbs */
#orbs {
    position: absolute;
    top: 45px;
    left: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.orb {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid #5a3d1a;
    background: #1a0e05;
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.orb-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    transition: height 0.3s;
}

.hp-fill {
    height: 100%;
    background: linear-gradient(0deg, #8b0000, #cc0000);
}

.prayer-fill {
    height: 100%;
    background: linear-gradient(0deg, #1a6b8a, #2aa0c4);
}

.run-fill {
    height: 100%;
    background: linear-gradient(0deg, #8b8b00, #cccc00);
}

.orb-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 14px;
    font-weight: bold;
    text-shadow: 1px 1px 2px #000;
    z-index: 1;
}

.orb-label {
    position: absolute;
    bottom: -14px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    color: #8a7040;
}

/* Minimap */
#minimap-container {
    position: absolute;
    top: 36px;
    right: 4px;
    width: 208px;
    height: 208px;
    border: 4px solid #5a3d1a;
    border-radius: 50%;
    overflow: hidden;
    background: #0a0a0a;
}

#minimap-canvas {
    width: 200px;
    height: 200px;
    border-radius: 50%;
}

#compass {
    position: absolute;
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    color: #ffd700;
    font-weight: bold;
    font-size: 14px;
    text-shadow: 1px 1px 2px #000;
}

/* Right Panel */
#right-panel {
    position: absolute;
    top: 250px;
    right: 4px;
    width: 210px;
    background: linear-gradient(180deg, rgba(30,20,10,0.95), rgba(20,12,5,0.95));
    border: 2px solid #5a3d1a;
    border-radius: 4px;
    max-height: calc(100vh - 290px);
    overflow-y: auto;
}

#panel-tabs {
    display: flex;
    flex-wrap: wrap;
    background: #2a1a0e;
    border-bottom: 1px solid #5a3d1a;
}

.panel-tab {
    flex: 1;
    min-width: 33%;
    padding: 6px 0;
    background: transparent;
    border: none;
    color: #8a7040;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
}

.panel-tab:hover {
    background: rgba(255,215,0,0.1);
}

.panel-tab.active {
    background: rgba(255,215,0,0.15);
    color: #ffd700;
}

.tab-content {
    display: none;
    padding: 5px;
}

.tab-content.active {
    display: block;
}

/* Inventory */
#inventory-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2px;
}

.inv-slot {
    width: 48px;
    height: 48px;
    background: rgba(0,0,0,0.4);
    border: 1px solid #3a2a15;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    font-size: 22px;
    transition: background 0.15s;
}

.inv-slot:hover {
    background: rgba(255,215,0,0.15);
    border-color: #8b6914;
}

.inv-slot .item-count {
    position: absolute;
    top: 1px;
    left: 3px;
    font-size: 10px;
    color: #ffd700;
    text-shadow: 1px 1px 1px #000;
}

/* Equipment */
#equipment-slots {
    display: grid;
    grid-template-areas:
        ". head ."
        "cape neck ammo"
        "weapon body shield"
        ". legs ."
        "hands feet ring";
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
    padding: 5px;
}

.equip-slot {
    width: 60px;
    height: 60px;
    background: rgba(0,0,0,0.4);
    border: 1px solid #3a2a15;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 10px;
    color: #5a4020;
    transition: all 0.15s;
    margin: 0 auto;
}

.equip-slot:hover {
    background: rgba(255,215,0,0.15);
    border-color: #8b6914;
}

.equip-slot.equipped {
    border-color: #ffd700;
    font-size: 20px;
    color: #fff;
}

#equipment-stats {
    padding: 8px;
    font-size: 11px;
    color: #c4a44a;
    border-top: 1px solid #3a2a15;
    margin-top: 5px;
}

/* Skills Panel */
#skills-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
}

.skill-box {
    background: rgba(0,0,0,0.4);
    border: 1px solid #3a2a15;
    border-radius: 2px;
    padding: 3px 4px;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s;
    position: relative;
}

.skill-box:hover {
    background: rgba(255,215,0,0.15);
    border-color: #8b6914;
}

.skill-icon {
    font-size: 14px;
}

.skill-name {
    font-size: 8px;
    color: #8a7040;
    display: block;
}

.skill-level {
    font-size: 13px;
    font-weight: bold;
    color: #ffd700;
}

.skill-xp-bar {
    width: 100%;
    height: 3px;
    background: #1a0e05;
    border-radius: 2px;
    margin-top: 2px;
    overflow: hidden;
}

.skill-xp-fill {
    height: 100%;
    background: #4a8c2a;
    transition: width 0.5s;
}

/* Quest List */
#quest-list {
    max-height: 300px;
    overflow-y: auto;
}

.quest-item {
    padding: 6px 8px;
    border-bottom: 1px solid #2a1a0e;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.15s;
}

.quest-item:hover {
    background: rgba(255,215,0,0.1);
}

.quest-item.not-started { color: #cc0000; }
.quest-item.in-progress { color: #cccc00; }
.quest-item.completed { color: #00cc00; }

/* Prayer List */
#prayer-list {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2px;
}

.prayer-icon {
    width: 44px;
    height: 44px;
    background: rgba(0,0,0,0.4);
    border: 1px solid #3a2a15;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    opacity: 0.5;
    transition: all 0.15s;
}

.prayer-icon.unlocked {
    opacity: 1;
}

.prayer-icon.active {
    border-color: #2aa0c4;
    background: rgba(42,160,196,0.2);
}

.prayer-icon:hover {
    background: rgba(255,215,0,0.15);
}

/* Spell List */
#spell-list {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2px;
}

.spell-icon {
    width: 44px;
    height: 44px;
    background: rgba(0,0,0,0.4);
    border: 1px solid #3a2a15;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    opacity: 0.5;
    transition: all 0.15s;
}

.spell-icon.unlocked {
    opacity: 1;
}

.spell-icon:hover {
    background: rgba(255,215,0,0.15);
}

/* Chat Box */
#chat-box {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 520px;
    background: rgba(20,12,5,0.9);
    border: 2px solid #5a3d1a;
    border-bottom: none;
    border-left: none;
    border-radius: 0 8px 0 0;
}

#chat-tabs {
    display: flex;
    border-bottom: 1px solid #3a2a15;
}

.chat-tab {
    padding: 5px 15px;
    background: transparent;
    border: none;
    color: #8a7040;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.chat-tab:hover, .chat-tab.active {
    color: #ffd700;
    background: rgba(255,215,0,0.1);
}

#chat-messages {
    height: 120px;
    overflow-y: auto;
    padding: 5px 10px;
    font-size: 12px;
    line-height: 1.5;
}

#chat-messages::-webkit-scrollbar {
    width: 6px;
}

#chat-messages::-webkit-scrollbar-thumb {
    background: #5a3d1a;
    border-radius: 3px;
}

.chat-msg {
    margin-bottom: 2px;
}

.chat-msg .timestamp {
    color: #5a4020;
    font-size: 10px;
}

.chat-msg.game-msg { color: #4a90d9; }
.chat-msg.public-msg { color: #fff; }
.chat-msg.system-msg { color: #ff6b00; }
.chat-msg.loot-msg { color: #a335ee; }
.chat-msg.skill-msg { color: #00cc00; }

#chat-input {
    width: 100%;
    padding: 8px 10px;
    background: #0a0500;
    border: none;
    border-top: 1px solid #3a2a15;
    color: #fff;
    font-size: 13px;
    outline: none;
}

#chat-input::placeholder {
    color: #5a4020;
}

/* Context Menu */
#context-menu {
    position: fixed;
    background: linear-gradient(180deg, #3d2817, #2a1a0e);
    border: 2px solid #8b6914;
    border-radius: 4px;
    min-width: 160px;
    z-index: 100;
    box-shadow: 2px 2px 10px rgba(0,0,0,0.8);
}

.context-option {
    padding: 6px 12px;
    cursor: pointer;
    font-size: 13px;
    color: #e0d0a0;
    transition: background 0.1s;
    border-bottom: 1px solid rgba(90,61,26,0.5);
}

.context-option:last-child {
    border-bottom: none;
}

.context-option:hover {
    background: rgba(255,215,0,0.2);
}

.context-option .option-target {
    color: #ffd700;
}

.context-option .option-level {
    color: #00cc00;
    font-size: 11px;
    float: right;
}

/* Dialogue Box */
#dialogue-box {
    position: absolute;
    bottom: 160px;
    left: 50%;
    transform: translateX(-50%);
    width: 500px;
    background: linear-gradient(180deg, #3d2817, #2a1a0e);
    border: 3px solid #8b6914;
    border-radius: 8px;
    padding: 20px;
    z-index: 50;
}

#dialogue-speaker {
    font-size: 16px;
    font-weight: bold;
    color: #ffd700;
    margin-bottom: 10px;
}

#dialogue-text {
    font-size: 14px;
    color: #e0d0a0;
    line-height: 1.6;
    margin-bottom: 15px;
}

#dialogue-options {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.dialogue-option {
    padding: 8px 12px;
    background: rgba(0,0,0,0.3);
    border: 1px solid #5a3d1a;
    border-radius: 4px;
    cursor: pointer;
    color: #4a90d9;
    font-size: 13px;
    transition: all 0.15s;
}

.dialogue-option:hover {
    background: rgba(255,215,0,0.15);
    border-color: #8b6914;
}

#dialogue-continue {
    padding: 8px 20px;
    background: rgba(0,0,0,0.3);
    border: 1px solid #5a3d1a;
    border-radius: 4px;
    color: #4a90d9;
    cursor: pointer;
    font-size: 13px;
}

/* Skill Popup */
#skill-popup {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(180deg, #3d2817, #2a1a0e);
    border: 3px solid #8b6914;
    border-radius: 8px;
    padding: 20px;
    min-width: 300px;
    z-index: 50;
}

#skill-popup-content h3 {
    color: #ffd700;
    font-size: 18px;
    margin-bottom: 10px;
}

#skill-popup-content p {
    color: #c4a44a;
    font-size: 13px;
    margin: 3px 0;
}

/* Level Up */
#level-up {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

#level-up-content {
    background: linear-gradient(180deg, #3d2817, #2a1a0e);
    border: 3px solid #ffd700;
    border-radius: 8px;
    padding: 30px 50px;
    text-align: center;
    animation: levelUpPulse 0.5s ease-out;
}

#level-up-content h2 {
    font-family: 'MedievalSharp', cursive;
    color: #ffd700;
    font-size: 32px;
    text-shadow: 0 0 10px rgba(255,215,0,0.5);
}

#level-up-text {
    color: #e0d0a0;
    font-size: 16px;
    margin-top: 10px;
}

@keyframes levelUpPulse {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

#level-up-fireworks {
    width: 200px;
    height: 60px;
    margin: 15px auto 0;
    position: relative;
}

.firework {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    animation: firework 1s ease-out forwards;
}

@keyframes firework {
    0% { transform: translate(0, 0) scale(1); opacity: 1; }
    100% { transform: translate(var(--x), var(--y)) scale(0); opacity: 0; }
}

/* Shop Interface */
#shop-interface, #bank-interface {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    background: linear-gradient(180deg, #3d2817, #2a1a0e);
    border: 3px solid #8b6914;
    border-radius: 8px;
    z-index: 60;
}

#shop-header, #bank-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 2px solid #5a3d1a;
}

#shop-header h3, #bank-header h3 {
    color: #ffd700;
    font-size: 16px;
}

#shop-close, #bank-close {
    background: #8b0000;
    border: 1px solid #cc0000;
    color: #fff;
    width: 24px;
    height: 24px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
}

#shop-items, #bank-items {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 3px;
    padding: 10px;
}

.shop-slot, .bank-slot {
    width: 56px;
    height: 56px;
    background: rgba(0,0,0,0.4);
    border: 1px solid #3a2a15;
    border-radius: 3px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    transition: background 0.15s;
}

.shop-slot:hover, .bank-slot:hover {
    background: rgba(255,215,0,0.15);
    border-color: #8b6914;
}

.shop-slot .price {
    font-size: 9px;
    color: #ffd700;
    margin-top: 2px;
}

#shop-player-inventory, #bank-inventory {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 3px;
    padding: 10px;
    border-top: 2px solid #5a3d1a;
}

/* Tooltip */
#tooltip {
    position: fixed;
    background: linear-gradient(180deg, #3d2817, #2a1a0e);
    border: 2px solid #8b6914;
    border-radius: 4px;
    padding: 8px 12px;
    z-index: 300;
    max-width: 250px;
    pointer-events: none;
}

#tooltip .tooltip-title {
    color: #ffd700;
    font-weight: bold;
    font-size: 13px;
    margin-bottom: 3px;
}

#tooltip .tooltip-desc {
    color: #c4a44a;
    font-size: 11px;
}

#tooltip .tooltip-stats {
    color: #00cc00;
    font-size: 11px;
    margin-top: 3px;
}

/* XP Drop */
.xp-drop {
    position: fixed;
    color: #fff;
    font-size: 14px;
    font-weight: bold;
    text-shadow: 1px 1px 2px #000;
    pointer-events: none;
    animation: xpDrop 2s ease-out forwards;
    z-index: 50;
}

@keyframes xpDrop {
    0% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-60px); }
}

/* Progress Bar (for gathering skills) */
.action-progress {
    position: absolute;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 20px;
    background: #1a0e05;
    border: 2px solid #5a3d1a;
    border-radius: 4px;
    overflow: hidden;
    pointer-events: none;
}

.action-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4a8c2a, #6ab840);
    width: 0%;
    transition: width 0.1s linear;
}

.action-progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 11px;
    font-weight: bold;
    text-shadow: 1px 1px 1px #000;
}

/* Death Screen */
#death-screen {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(139,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

#death-screen h2 {
    font-family: 'MedievalSharp', cursive;
    font-size: 48px;
    color: #ff0000;
    text-shadow: 0 0 20px #ff0000;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #1a0e05;
}

::-webkit-scrollbar-thumb {
    background: #5a3d1a;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #8b6914;
}

/* Right panel scrollbar */
#right-panel::-webkit-scrollbar {
    width: 4px;
}
