body {
    margin: 0;
    font-family: 'Fira Mono', 'Consolas', monospace;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: #000;
}
.game-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    max-width: 375px;
    max-height: 667px;
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 15px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.7);
    overflow: hidden;
    padding: 15px;
    box-sizing: border-box;
}
.cube-image {
    width: 80%;
    height: auto;
    max-height: 40%;
}
.bars {
    display: grid;
    grid-template-rows: repeat(2, 15px);
    gap: 5px;
    width: 80%;
    padding: 5px;
}
.bar {
    width: 100%;
    background-color: #ccc;
    border-radius: 10px;
    overflow: hidden;
}
.health {
    background-color: red;
    width: 100%;
    height: 100%;
}
.mana {
    background-color: blue;
    width: 100%;
    height: 100%;
}
.bottom-half, .top-half {
    background-color: #e0e0e0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px; /* Add more padding to the bottom section */
    width: 100%;
}
.wand {  
    box-sizing: border-box;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(50px, 1fr));
    gap: 10px; /* Increase spacing between slots */
    justify-content: center;
    align-items: center;
    margin-bottom: 15px; /* Add more space between wands */
    padding: 15px; /* Increase padding inside the wand container */
    border: 2px solid #ccc;
    border-radius: 5px;
    max-width: 100%;
    background-color: #f9f9f9;
    min-width: 100%; /* Firefox needs this to prevent the parent flex shrinking inline space to 0 */
}
.game-page .wand {
    cursor: pointer;
}
.game-page .wand:hover {
    background-color: #e0e0e0;
    border-color: #888;
    filter: brightness(0.9);
}
.wand:last-child {
    margin-bottom: 0;
}
.label {
    font-size: 12px;
    font-weight: bold;
    margin-right: 5px;
    color: #333;
    text-transform: uppercase;
    user-select: none;
}
.spell {
    position: relative;
    width: 45px;
    height: 45px;
    background-color: #fff;
    border: 1px solid #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    user-select: none;
    cursor: pointer;
    transition: background-color 0.3s, border-color 0.3s;
    margin: 5px; /* Add spacing around each spell */
}
.spell .spell-count {
    position: absolute;
    bottom: 0;
    right: 0;
    background-color: #007bff;
    color: #fff;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
}
.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: #000;
    margin: 15px;
}
button {
    padding: 8px 15px;
    font-size: 14px;
    border: none;
    border-radius: 5px;
    background-color: #007bff;
    color: #fff;
    cursor: pointer;
    transition: background-color 0.3s;
    margin-top: 15px;
}
button:hover {
    background-color: #0056b3;
}
.add-slot-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    background-color: #f9f9f9;
    border: 2px dashed #00ff00;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s, border-color 0.3s;
    font-size: 16px;
    font-weight: bold;
    color: #00ff00;
    position: relative;
    margin: 5px; /* Add spacing around the add slot button */
}
.add-slot-button:hover {
    background-color: #e6ffe6;
    border-color: #218838;
    color: #218838;
}
.add-slot-button .slot-cost {
    position: absolute;
    bottom: -12px;
    font-size: 10px;
    font-weight: bold;
    color: #00ff00;
    background-color: #333;
    padding: 2px 5px;
    border-radius: 4px;
    border: 1px solid #00ff00;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    text-align: center;
    white-space: nowrap;
}
.available-spells-container {
    width: 100%;
    padding: 5px;
    background-color: #f9f9f9;
    border: 1px solid #ccc;
    border-radius: 5px;
    margin-bottom: 20px; /* Add more space below the available spells container */
}
.available-spells-container h2 {
    margin: 0 0 5px 0;
    text-align: center;
}
.available-spells {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(45px, 1fr));
    gap: 5px;
    justify-content: center;
}
.available-spells .spell {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
}
.spell[swappable="true"] {
    border: 2px dashed #ccc;
}
.spell.dragging {
    opacity: 0.5;
}
.clear-storage-button {
    position: fixed;
    top: 10px;
    right: 10px;
    padding: 8px 15px;
    font-size: 14px;
    border: none;
    border-radius: 5px;
    background-color: #dc3545;
    color: #fff;
    cursor: pointer;
    transition: background-color 0.3s;
}
.clear-storage-button:hover {
    background-color: #c82333;
}
.currency-display {
    text-align: center;
    font-size: 16px;
    margin-bottom: 5px;
    color: #00ffcc;
    font-weight: bold;
}
.shop-container {
    padding: 12px;
    background: #181818;
    border: 1px solid #222;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 0 8px #000a;
}
.shop-container h2 {
    margin: 0 0 5px 0;
    text-align: center;
    color: #00ffcc
}
.shop-spells {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(45px, 1fr));
    gap: 5px;
    justify-content: center;
}

.enemy-info {
    padding: 12px;
    background: #181818;
    border: 1px solid #222;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 0 8px #000a;
    color: #00ffcc;
    font-size: 13px;
    font-family: 'Fira Mono', 'Consolas', monospace;
}
.enemy-info h3 {
    margin: 0 0 8px 0;
    text-align: center;
    color: #00ffcc;
    font-size: 14px;
    font-weight: bold;
}
.enemy-info p {
    margin: 4px 0;
    font-size: 13px;
    color: #00ff00;
}
.enemy-info #enemy-resistances {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid #333;
}
.shop-spells .spell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: grab;
    position: relative;
    margin-bottom: 15px;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
.modal.hidden {
    display: none;
}
.modal-content {
    background-color: #fff;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
.modal-content p {
    margin: 0 0 15px;
    font-size: 14px;
    color: #333;
}
.modal-content button {
    padding: 8px 15px;
    font-size: 14px;
    border: none;
    border-radius: 5px;
    background-color: #007bff;
    color: #fff;
    cursor: pointer;
    transition: background-color 0.3s;
}
.modal-content button:hover {
    background-color: #0056b3;
}
.tooltip {
    position: absolute;
    background-color: #333;
    color: #fff;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    pointer-events: none;
    white-space: nowrap;
    transform: translate(-50%, -120%);
}
.tooltip.hidden {
    display: none;
}
.edit-page .container {
    margin: 0;
    padding: 0;
    background: none;
    box-shadow: none;
    border: none;
    text-align: left;
}

.edit-page .top-half {
    background: none;
    padding: 0;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.edit-page .terminal {
    background: #181818;
    color: #00ff00;
    font-family: 'Fira Mono', 'Consolas', monospace;
    font-size: 13px;
    border-radius: 8px;
    padding: 12px 10px 10px 10px;
    width: 100%;
    max-width: 340px;
    margin: 0 auto 18px auto;
    box-shadow: 0 0 8px #000a;
    position: relative;
}

.edit-page .terminal-title {
    color: #00ffcc;
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 8px;
    text-align: left;
    letter-spacing: 1px;
    display: block;
}

.edit-page .shop-spells {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.edit-page .spell {
    background: #222;
    color: #00ff00;
    border: 1px solid #00ff00;
    border-radius: 4px;
    width: 33px;
    height: 33px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    cursor: grab;
    position: relative;
    margin-bottom: 0;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.edit-page .spell:hover {
    background: #333;
    color: #bfff00;
    border-color: #bfff00;
}

.edit-page .spell .spell-cost {
    position: absolute;
    bottom: -12px;
    font-size: 11px;
    font-weight: bold;
    color: #333;
    background-color: #00ff00;
    padding: 2px 5px;
    border-radius: 4px;
    border: 1px solid #0056b3;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    text-align: center;
    white-space: nowrap;
    z-index: 10;
}

.edit-page .bottom-half {
    background: none;
    padding: 0;
    margin-top: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.edit-page .wand {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(44px, 1fr));
    gap: 8px;
    justify-content: center;
    align-items: center;
    margin-bottom: 12px;
    padding: 10px;
    border: none;
    border-radius: 8px;
    max-width: 100%;
    background: #181818;
    color: #00ff00;
    font-family: 'Fira Mono', 'Consolas', monospace;
}

.edit-page .wand .label {
    font-size: 13px;
    font-weight: bold;
    margin-right: 5px;
    color: #00ffcc;
    text-transform: uppercase;
    user-select: none;
    grid-column: 1 / -1;
    margin-bottom: 4px;
}

.edit-page .wand .spell {
    width: 33px;
    height: 33px;
    background: #222;
    border: 1px solid #00ff00;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    user-select: none;
    cursor: pointer;
    margin: 0;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.edit-page .wand .spell:hover {
    background: #333;
    color: #bfff00;
    border-color: #bfff00;
}

.edit-page .add-slot-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 33px;
    height: 33px;
    background: #222;
    border: 2px dashed #00ff00;
    border-radius: 5px;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    color: #00ff00;
    position: relative;
    margin: 0;
    transition: background 0.3s, border-color 0.3s;
}

.edit-page .add-slot-button:hover {
    background: #e6ffe6;
    border-color: #218838;
    color: #218838;
}
.terminal-btn {
    background: #222;
    color: #00ff00;
    border: 1px solid #00ff00;
    border-radius: 3px;
    font-family: inherit;
    font-size: 13px;
    padding: 2px 10px;
    margin-top: 18px;
    margin-left: 0;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.terminal-btn:hover {
    background: #00ff00;
    color: #181818;
}

.reset-btn {
    background: #222;
    color: #ff6b6b;
    border: 1px solid #ff6b6b;
    margin-left: 10px;
}

.reset-btn:hover {
    background: #ff6b6b;
    color: #181818;
}

/* Game page terminal styles */
.terminal {
    background: #181818;
    color: #00ff00;
    font-family: 'Fira Mono', 'Consolas', monospace;
    font-size: 13px;
    border-radius: 8px;
    padding: 12px 10px 10px 10px;
    width: 100%;
    min-height: unset;
    height: 380px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    box-shadow: 0 0 8px #000a;
    position: relative;
    margin-top: 0;
    margin-bottom: 0;
    padding: 2px 4px 2px 4px;
    max-width: 260px;
}
.ascii-bars {
    white-space: pre;
    font-size: 13px;
    color: #00ffcc;
    margin-bottom: 8px;
    display: block;
}
.terminal-content {
    min-height: 60px;
    max-height: 260px;
    overflow-y: auto;
    display: block;
    flex: 1 1 auto;
}
.terminal-wands {
    min-height: unset;
    height: auto;
}
.ascii-wands-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding-left: 2px;
    width: 100%;
    user-select: none;
    margin: 8px;
}
.ascii-wand {
    font-size: 13px;
    color: #00ff00;
    margin-bottom: 0;
    display: block;
    user-select: none;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
    padding: 1px 3px 1px 3px;
    border-radius: 4px;
}
.ascii-wand:hover, .ascii-wand:focus {
    background: #222;
    color: #bfff00;
    box-shadow: 0 0 0 2px #00ff00;
}
.ascii-wand .wand-slot,
.ascii-wand .wand-label {
    user-select: none;
}
.ascii-wand .wand-slot {
    display: inline-block;
    width: 3ch;
    text-align: center;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.ascii-wand:hover .wand-slot {
    background: #333;
    color: #bfff00;
    border-color: #bfff00;
}
.ascii-wand .wand-label {
    color: #00ffcc;
}
.ascii-wand .wand-bar {
    color: #00ffcc;
}
.ascii-wand .wand-spells {
    display: inline-block;
}
.ascii-wand .wand-slot {
    border: 1px solid #00ff00;
    border-radius: 2px;
    margin: 0 1px;
    background: #222;
    color: #00ff00;
    width: 2ch;
    height: 1.5em;
    line-height: 1.5em;
}
.ascii-wand .wand-slot.empty {
    color: #444;
}
.ascii-wand .wand-label {
    min-width: 7ch;
    display: inline-block;
}
.ascii-wand {
    margin-bottom: 6px;
}
@media (max-width: 500px) {
    .terminal-wands {
        padding: 10px 5vw;
    }
}

/* Loading spinner */
.loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(24, 24, 24, 0.95);
    border: 1px solid #00ff00;
    border-radius: 4px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 1000;
    font-family: 'Fira Mono', 'Consolas', monospace;
    font-size: 13px;
    color: #00ff00;
    box-shadow: 0 0 8px rgba(0, 255, 0, 0.3);
}

.loading-spinner.hidden {
    display: none;
}

.spinner-text {
    color: #00ffcc;
}

.spinner-dots {
    display: inline-flex;
    gap: 2px;
}

.spinner-dots .dot {
    animation: spinner-blink 1.4s infinite;
    animation-fill-mode: both;
}

.spinner-dots .dot:nth-child(1) {
    animation-delay: 0s;
}

.spinner-dots .dot:nth-child(2) {
    animation-delay: 0.2s;
}

.spinner-dots .dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes spinner-blink {
    0%, 80%, 100% {
        opacity: 0.3;
    }
    40% {
        opacity: 1;
    }
}
