@font-face {
    font-family: "Minecraft";
    src: url("/Minecraft.woff2") format("woff2");
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: "Minecraft";
    src: url("/Minecraft-Bold.woff2") format("woff2");
    font-weight: bold;
    font-style: normal;
}

body {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background-color: #1e1e1e;
    color: #ffffff;
    margin: 0;
    padding: 20px;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
}

h1,
h2 {
    text-align: center;
}

.search-box {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

input {
    padding: 10px;
    font-size: 16px;
    border-radius: 5px 0 0 5px;
    border: none;
    width: 300px;
}

button {
    padding: 10px 20px;
    font-size: 16px;
    border-radius: 0 5px 5px 0;
    border: none;
    background-color: #4caf50;
    color: white;
    cursor: pointer;
}

button:hover {
    background-color: #45a049;
}

.hidden {
    display: none;
}

#error {
    color: #ff5555;
    text-align: center;
    margin-bottom: 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.stat-item {
    background-color: #2d2d2d;
    padding: 10px;
    border-radius: 5px;
}

.stat-label {
    color: #aaaaaa;
    font-size: 12px;
}

.stat-value {
    font-size: 18px;
    font-weight: bold;
}

.item-grid {
    display: grid;
    grid-template-columns: repeat(9, min-content);
    gap: 10px;
    justify-content: center;
    margin: 0 auto;
    width: fit-content;
}

.armor-grid {
    display: grid;
    grid-template-columns: repeat(4, min-content);
    gap: 10px;
    justify-content: center;
    margin: 0 auto;
    width: fit-content;
}

.mc-item {
    background-color: #8b8b8b; /* Default slot color */
    border: 2px solid #373737;
    width: 64px;
    height: 64px;
    position: relative;
    cursor: pointer;
    image-rendering: pixelated;
    display: flex;
    align-items: center;
    justify-content: center;
}

.enchanted-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5; /* Above icon, below tooltip */
    pointer-events: none;
    opacity: 0.6;
    mix-blend-mode: screen;
    overflow: hidden;
    /* Mask to item texture - uses the item image as mask */
    mask-image: var(--item-texture);
    -webkit-mask-image: var(--item-texture);
    mask-size: contain;
    -webkit-mask-size: contain;
    mask-repeat: no-repeat;
    -webkit-mask-repeat: no-repeat;
    mask-position: center;
    -webkit-mask-position: center;
}

.enchanted-overlay::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background-size: 64px 64px;
    background-repeat: repeat;
    transform: rotate(-45deg);
    animation: glint 3s linear infinite;
    /* Purple tint filter */
    filter: brightness(0.5) sepia(1) hue-rotate(240deg) saturate(5);
}

.armor-glint::before {
    background-image: url("/glint_armor.png");
}

.item-glint::before {
    background-image: url("/glint_items.png");
}

@keyframes glint {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 0 64px;
    }
}

.mc-item:hover {
    background-color: #a0a0a0;
}

.mc-item:hover .tooltip {
    display: block;
}

.item-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.item-label {
    color: #fff;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: bold;
    text-shadow: 2px 2px 0 #000;
}

.item-count {
    position: absolute;
    bottom: 2px;
    right: 2px;
    color: #ffffff;
    font-size: 16px;
    font-weight: bold;
    text-shadow: 2px 2px 0 #000;
    pointer-events: none;
}

.loadout-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.loadout-item {
    background-color: #2d2d2d;
    padding: 15px;
    border-radius: 5px;
}

.loadout-item h3 {
    margin-top: 0;
    border-bottom: 1px solid #444;
    padding-bottom: 10px;
    margin-bottom: 10px;
}

.tag {
    display: inline-block;
    background-color: #444;
    padding: 2px 6px;
    border-radius: 3px;
    margin: 2px;
    font-size: 0.9em;
}

.perk-item {
    margin-bottom: 5px;
}

.tooltip {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(16, 0, 16, 0.95);
    border: 2px solid #2a002a;
    padding: 5px;
    width: max-content;
    max-width: 300px;
    z-index: 100;
    pointer-events: none;
    text-align: left;
    font-family: "Minecraft", "Courier New", Courier, monospace;
    font-size: 14px;
    line-height: 1.2;
    white-space: pre-wrap;
}

/* Minecraft Colors */
.mc-0 {
    color: #000000;
}
.mc-1 {
    color: #0000aa;
}
.mc-2 {
    color: #00aa00;
}
.mc-3 {
    color: #00aaaa;
}
.mc-4 {
    color: #aa0000;
}
.mc-5 {
    color: #aa00aa;
}
.mc-6 {
    color: #ffaa00;
}
.mc-7 {
    color: #aaaaaa;
}
.mc-8 {
    color: #555555;
}
.mc-9 {
    color: #5555ff;
}
.mc-a {
    color: #55ff55;
}
.mc-b {
    color: #55ffff;
}
.mc-c {
    color: #ff5555;
}
.mc-d {
    color: #ff55ff;
}
.mc-e {
    color: #ffff55;
}
.mc-f {
    color: #ffffff;
}

.mc-k {
    font-family: monospace;
} /* Obfuscated - hard to do properly in CSS only */
.mc-l {
    font-weight: bold;
}
.mc-m {
    text-decoration: line-through;
}
.mc-n {
    text-decoration: underline;
}
.mc-o {
    font-style: italic;
}
.mc-r {
    color: #ffffff;
    font-weight: normal;
    text-decoration: none;
    font-style: normal;
}
