@import url('https://fonts.googleapis.com/css2?family=Ubuntu+Sans:wght@700;800&display=swap');

:root {
  --bg-main: #d29c66;
  --bg-slot-empty: #b37e4c;
  --color-craft-btn: #5ce0d3;
  --color-craft-btn-border: #44a89e;
  
  --c-common: #7eef6d;
  --c-unusual: #ffe65d;
  --c-rare: #4d52e3;
  --c-epic: #861fde;
  --c-legendary: #de1f1f;
  --c-mythic: #1fdbde;
  --c-ultra: #ff2b75;
  --c-super: #2bffa3;
  --c-eternal: #ffffff;
  --c-unique: #aaaaaa;
}

.forge-mode {
    --bg-main: #2a2a2a;
    --bg-slot-empty: #3d3d3d;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: "Ubuntu Sans", sans-serif; user-select: none; }

body { background: var(--bg-main); color: white; display: flex; flex-direction: column; height: 100vh; overflow: hidden; -webkit-text-stroke: 0.4px rgba(0,0,0,0.8); paint-order: stroke fill; text-shadow: -0.5px -0.5px 0 rgba(0,0,0,0.6), 0.5px -0.5px 0 rgba(0,0,0,0.6), -0.5px 0.5px 0 rgba(0,0,0,0.6), 0.5px 0.5px 0 rgba(0,0,0,0.6); }

    .top-bar {
        background: #a46d38;
        color: white;
        padding: 12px 20px;
        font-size: 20px;
        font-weight: bold;
        border-bottom: 2px solid #825224;
        position: relative;
        text-align: center;
    }

    .forge-mode .top-bar {
        background: #111;
        color: white;
        padding: 12px 20px;
        font-size: 20px;
        font-weight: 800;
        letter-spacing: 1px;
        position: relative;
        text-align: center;
        border-bottom: none;
    }

.main-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
    background-color: var(--bg-main);
}

/* CRAFTING AREA */
.crafting-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    border-right: 2px solid rgba(0,0,0,0.1);
}

.craft-slots {
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 400px;
}

.crafting-core {
    display: flex;
    align-items: center;
    gap: 50px;
}

.pentagon-container {
    position: relative;
    width: 320px;
    height: 320px;
}

.pentagon-container .slot {
    position: absolute;
    transform: translate(-50%, -50%);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.craft-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

    .craft-btn {
        background: var(--color-craft-btn);
        border: 4px solid var(--color-craft-btn-border);
        border-radius: 8px;
        color: white;
        font-size: 15px;
        font-weight: 800;
        padding: 2px 14px;
        cursor: pointer;
        -webkit-text-stroke: 1px black;
        paint-order: stroke fill;
        transition: transform 0.1s;
    }
.craft-btn:active { transform: scale(0.95); }
.craft-btn:disabled { filter: grayscale(1); cursor: not-allowed; opacity: 0.7; }

.craft-chance {
    font-size: 14px;
    font-weight: 800;
    -webkit-text-stroke: 1px black;
    paint-order: stroke fill;
}

.craft-helper-text {
    margin-top: 60px;
    text-align: center;
    font-size: 15px;
    font-weight: 800;
    -webkit-text-stroke: 1px black;
    paint-order: stroke fill;
    line-height: 1.4;
    max-width: 600px;
}

/* INVENTORY AREA */
.inventory-area {
    flex: 1;
    min-width: 350px;
    padding: 20px;
    overflow-y: auto;
    border-left: 3px solid rgba(0,0,0,0.1);
}

#inventory-grid {
    display: grid;
    grid-template-columns: repeat(10, 60px);
    gap: 5px;
    align-content: start;
}

/* SLOTS */
.slot {
    width: 60px;
    height: 60px;
    background-color: var(--bg-slot-empty);
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
}

.slot:hover {
    opacity: 0.8;
}

.slot .bg-img {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
    top: 0;
    left: 0;
}

.slot .petal-img {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
    top: 0;
    left: 0;
    object-fit: contain;
}

.slot .count {
    position: absolute;
    top: 2px;
    right: 2px;
    color: #fff;
    font-size: 14px;
    font-weight: 800;
    pointer-events: none;
    z-index: 10;
    -webkit-text-stroke: 1px black;
    paint-order: stroke fill;
    transform: rotate(20deg);
}



/* ANIMATIONS */
.anim-spin-in {
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) rotate(720deg) scale(0) !important;
    opacity: 0;
}

.craft-center-effect {
    position: absolute;
    left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    width: 100px; height: 100px;
    border-radius: 12px;
    pointer-events: none;
    z-index: 20;
    display: flex; justify-content: center; align-items: center;
}

.craft-center-effect .count {
    font-size: 24px;
    top: 4px;
    right: 4px;
}

.anim-pop-out {
    animation: popOut 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes popOut {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 1; }
    80% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; filter: brightness(1.5); }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; filter: brightness(1); }
}

.anim-shake {
    animation: shake 0.4s ease-in-out forwards;
}

@keyframes shake {
    0%, 100% { transform: translate(-50%, -50%); opacity: 1; }
    20%, 60% { transform: translate(-55%, -50%) rotate(-10deg); filter: brightness(0.5); }
    40%, 80% { transform: translate(-45%, -50%) rotate(10deg); filter: brightness(0.5); }
    99% { opacity: 0; }
}

/* CONSOLE */
.console-area {
    display: flex;
    flex-direction: column;
    padding: 10px;
    background-color: #a46d38;
    border-top: 2px solid #825224;
}

.forge-mode .console-area {
    background-color: #111;
    border-top: none;
}

.console-log {
    flex: 1; padding: 5px 10px; overflow-y: auto; color: #fff; font-size: 14px; text-shadow: 1px 1px 0 #000;
}
.console-log div {
    transition: opacity 1s;
}

.console-input-wrapper {
    display: flex; padding: 5px 10px; background: rgba(0,0,0,0.2);
}
.prompt { color: #fff; margin-right: 8px; font-weight: bold; }
#console-input {
    width: 100%;
    padding: 10px;
    background-color: rgba(0,0,0,0.3);
    border: 1px solid rgba(0,0,0,0.5);
    color: #fff;
    font-family: "Ubuntu Sans", sans-serif;
    font-size: 14px;
    font-weight: 800;
    box-sizing: border-box;
    border-radius: 8px;
}
#console-input:focus {
    outline: none;
    border-color: #fff;
}

/* Scrollbar styles */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #825224;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #a46d38;
}

body.forge-mode ::-webkit-scrollbar-thumb {
    background: #555;
}

body.forge-mode ::-webkit-scrollbar-thumb:hover {
    background: #777;
}

/* --- Forge Mode Theme --- */
body.forge-mode {
    background: #333;
}
body.forge-mode .top-bar {
    background: #222;
}
body.forge-mode .inventory-panel {
    background: rgba(40, 40, 40, 0.95);
}
body.forge-mode .inventory-grid {
    background: #444;
}
body.forge-mode .console-panel {
    background: rgba(40, 40, 40, 0.95);
}

.mode-toggle {
    cursor: pointer;
    transition: transform 0.2s;
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
}
.mode-toggle:hover {
    transform: translateY(-50%) scale(1.1);
}

.slot.disabled {
    cursor: not-allowed;
}

.slot.disabled .bg-img {
    filter: grayscale(1) brightness(1.2);
}

.slot.disabled .petal-img,
.slot.disabled .count {
    filter: grayscale(1);
}

/* --- Craft fail particle burst --- */
@keyframes craft-particle-fly {
    0%   { transform: translate(-50%, -50%) translate(0, 0) rotate(0deg); opacity: 1; }
    100% { transform: translate(-50%, -50%) translate(var(--tx), var(--ty)) rotate(var(--rot)); opacity: 0; }
}

.craft-fail-particle {
    position: fixed;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 9999;
    animation: craft-particle-fly 0.8s cubic-bezier(0.2, 0.8, 0.4, 1) forwards;

}

/* --- Tooltip --- */
#tooltip {
    position: fixed;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    padding: 12px;
    color: #fff;
    font-family: 'Ubuntu', sans-serif;
    pointer-events: none;
    z-index: 10000;
    display: none;
    min-width: 250px;
    transform: translate(-50%, -100%);
    margin-top: -15px;
}
#tt-header {
    display: flex;
    align-items: center;
    margin-bottom: 4px;
}
#tt-name {
    font-size: 24px;
    font-weight: bold;
    margin-right: 6px;
    text-transform: capitalize;
}
#tt-count {
    font-size: 16px;
    color: #ccc;
    font-weight: bold;
}
#tt-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    font-size: 14px;
    font-weight: bold;
}
#tt-right img {
    height: 16px;
    margin-right: 4px;
}
#tt-rarity {
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 12px;
    text-transform: capitalize;
}
#tt-desc {
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 16px;
    font-weight: bold;
}
#tt-stats {
    font-size: 14px;
    font-weight: bold;
    line-height: 1.4;
}
#tt-stats .stat-health { color: #52f952; }
#tt-stats .stat-damage { color: #f44; }
#tt-stats .stat-luck { color: #fd4; }
#tt-stats .stat-reload { color: #a4f; }
#tt-stats .stat-armor { color: #aaa; }
#tt-stats .stat-radius { color: #f9f; }

/* Animation styles */
.transfer-anim { top: 0; left: 0;
    position: fixed;
    pointer-events: none;
    z-index: 1000;
    
}
.transfer-anim img {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0; left: 0;
}
.transfer-anim .petal-img {
    animation: spin-transfer 0.4s linear infinite;
}

@keyframes spin-transfer {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.crafting-anim-container {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    z-index: 100;
}

.crafting-anim-petal {
    position: absolute;
    width: 60px;
    height: 60px;
    margin-left: -30px;
    margin-top: -30px;
    pointer-events: none;
}
.crafting-anim-petal img {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0; left: 0;
}

.shatter-particle {
    position: absolute;
    width: 20px;
    height: 20px;
    background: #555;
    border-radius: 50%;
    pointer-events: none;
    z-index: 105;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    animation: shatter-out 0.8s ease-out forwards;
}

@keyframes shatter-out {
    0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    100% { transform: translate(var(--tx), var(--ty)) scale(0); opacity: 0; }
}


.hide-contents > * {
    opacity: 0 !important;
}
