@import url('https://fonts.googleapis.com/css2?family=Silkscreen:wght@400;700&display=swap');

:root {
    --main-width: 420px;
    --color-demonettes: #DD3C57;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
    background: transparent;
    width: 5px;
    border-radius: 999px;
}

::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 999px;
}

::-webkit-scrollbar-thumb {
    background: hsla(0, 0%, 50%, 0.3);
    border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
    background: hsla(0, 0%, 50%, 0.5);
}

/* ----------  ---------- */

html,
body {
    height: 100%;
    overflow: hidden;
    background: hsl(270, 50%, 4%);
    font-family: 'Silkscreen', monospace;
}

body {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #f3e6ff;
}

#game {
    position: relative;
    width: var(--main-width);
    height: 100%;
    max-height: 100vh;
    background: linear-gradient(180deg, #1a0b24 0%, #25091f 55%, #12060f 100%);
    overflow: hidden;
    box-shadow: 0 0 40px #000;
}

.screen {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
}

.screen.active {
    display: flex;
}

/* ---- Buttons ---- */
.btn {
    font-family: 'Silkscreen', monospace;
    font-weight: 700;
    cursor: pointer;
    background: linear-gradient(180deg, #c0246b, #7a1246);
    color: #fff;
    border: 2px solid #ff5fa2;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 14px;
    letter-spacing: 1px;
    box-shadow: 0 4px 0 #4a0a2b;
    transition: transform .05s, box-shadow .05s;
}

.btn:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 #4a0a2b;
}

.btn.small {
    padding: 8px 12px;
    font-size: 12px;
}

.btn:disabled {
    opacity: .4;
    filter: grayscale(.6);
    cursor: default;
}

/* ---- Menu ---- */
#menu {
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px;
    gap: 18px;
}

#menu .title {
    font-size: 30px;
    font-weight: 700;
    line-height: 1.2;
    color: #ff6fb1;
    text-shadow: 0 0 14px #ff2f86, 3px 3px 0 #3a0020;
}

#menu .sub {
    font-size: 11px;
    color: #c79ad4;
    margin-bottom: 10px;
}

#menu .tip {
    font-size: 9px;
    color: #8f6fa0;
    max-width: 300px;
    line-height: 1.6;
    margin-top: 8px;
}

.best {
    font-size: 12px;
    color: #ffd36f;
}

/* ---- Dialogue ---- */
#dialogue {
    align-items: center;
    justify-content: flex-end;
    padding: 0;
}

#dialogue .portrait {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 120px;
    filter: drop-shadow(0 0 24px #ff2f8688);
}

#dlgBox {
    width: 100%;
    background: rgba(10, 4, 16, .94);
    border-top: 2px solid #ff5fa2;
    padding: 16px 18px 20px;
}

#dlgName {
    color: #ff8fc4;
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 8px;
}

#dlgText {
    font-size: 12px;
    line-height: 1.7;
    min-height: 66px;
    color: #f3e6ff;
}

#dlgBox .btn {
    margin-top: 12px;
    width: 100%;
}

.floortag {
    position: absolute;
    top: 12px;
    left: 12px;
    font-size: 11px;
    color: #ffd36f;
    background: #0008;
    padding: 4px 8px;
    border-radius: 6px;
}

/* ---- Combat ---- */
#combat {
    flex-direction: column;
}

.enemy-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 12px 14px 6px;
    position: relative;
}

.top-hud {
    position: absolute;
    top: 10px;
    left: 12px;
    right: 12px;
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #ffd36f;
}

.enemy-sprite {
    font-size: 74px;
    margin-top: 22px;
    transition: transform .12s;
    filter: drop-shadow(0 0 16px #ff2f8677);
}

.enemy-sprite.hit {
    transform: translateX(6px) scale(.94);
    filter: drop-shadow(0 0 10px #ff0000);
}

.enemy-name {
    font-size: 15px;
    color: #ff8fc4;
    font-weight: 700;
    margin-top: 4px;
}

.intent {
    margin-top: 6px;
    font-size: 13px;
    background: #00000066;
    border: 1px solid #ff5fa2;
    border-radius: 8px;
    padding: 5px 10px;
    text-align: center;
    min-height: 28px;
}

.intent .iname {
    font-size: 9px;
    color: #c79ad4;
    display: block;
    margin-bottom: 2px;
}

/* HP bar */
.hpwrap {
    width: 200px;
    margin-top: 8px;
}

.hpbar {
    position: relative;
    height: 22px;
    background: #2a0f1e;
    border: 2px solid #000;
    border-radius: 999px;
    overflow: hidden;
}

.hpfill {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, #ff5b7f, #c01037);
    transition: width .25s;
}

.hpfill.pl {
    background: linear-gradient(180deg, #5bff9d, #12a04f);
}

.hptext {
    position: relative;
    text-align: center;
    font-size: 16px;
    line-height: 16px;
    z-index: 2;
    text-shadow: 0 1px 1px #000;
}

.blockbadge {
    background: #3a6ea5;
    border: 2px solid #9fd0ff;
    border-radius: 6px;
    padding: 1px 6px;
    font-size: 11px;
}

.statuses {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: center;
    min-height: 20px;
}

.st {
    background: #00000055;
    border: 1px solid #6b3b7a;
    border-radius: 6px;
    padding: 2px 5px;
    font-size: 11px;
}

.log {
    position: absolute;
    bottom: 2px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 12px;
    color: #c79ad4;
    height: 18px;
}

/* Player bar */
.player-bar {
    background: #000000aa;
    border-top: 2px solid #6b3b7a;
    padding: 8px 12px 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pl-row {
    display: flex;
    align-items: center;
    justify-content: start;
    gap: 4px;
}

.energy {
    font-size: 18px;
    color: #ffe45f;
}

.energy b {
    font-size: inherit;
    color: #fff;
}

/* Hand */
.hand-area {
    background: #0d0512;
    padding: 24px 6px 0 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px 8px;
    justify-content: center;
    align-content: flex-start;
    height: 190px;
    border-top: 2px solid #2a1533;
    overflow-x: hidden;
    overflow-y: auto;
}

.card {
    width: 92px;
    height: 142px;
    border-radius: 8px;
    padding: 12px 4px;
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
    border: 2px solid #000;
    background: linear-gradient(180deg, #3a2140, #20101f);
    transition: transform .08s;
}

.card:hover {
    transform: translateY(-6px);
}

.card:active {
    transform: translateY(-12px);
}

.card.attack {
    border-color: #ff6b6b;
    background: linear-gradient(180deg, #4a1f28, #2a0f16);
}

.card.skill {
    border-color: #6bb3ff;
    background: linear-gradient(180deg, #1f2f4a, #0f1a2a);
}

.card.power {
    border-color: #c56bff;
    background: linear-gradient(180deg, #331f4a, #1c0f2a);
}

.card.disabled {
    opacity: .45;
    filter: grayscale(.5);
    cursor: default;
}

.card .cost {
    position: absolute;
    top: -7px;
    left: -7px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #ffe45f;
    color: #2a1500;
    font-weight: 700;
    font-size: 14px;
    text-align: center;
    line-height: 19px;
    border: 2px solid #000;
}

.card .cname {
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    line-height: 1.2;
    min-height: 30px;
    color: #fff;
}

.card .cico {
    font-size: 22px;
    text-align: center;
    margin: 3px 0;
}

.card .cdesc {
    font-size: 10px;
    line-height: 1.2;
    text-align: center;
    color: #e8d6f0;
    flex: 1;
}

.card .cdesc span {
    font-size: inherit;
    color: inherit;
}

.card .cdesc .dyn-up {
    color: #7CFC7C;
}

.card .cdesc .dyn-down {
    color: #ff6b6b;
}

.action-bar {
    background: #000;
    padding: 8px 12px 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 2px solid #2a1533;
}

.pile {
    font-size: 9px;
    color: #9f7fb0;
    text-align: center;
}

.pile b {
    display: block;
    font-size: 14px;
    color: #fff;
}

/* Reward */
#reward {
    align-items: center;
    justify-content: center;
    padding: 20px;
    gap: 16px;
}

#reward h2 {
    font-size: 16px;
    color: #ffd36f;
    text-align: center;
}

.reward-cards {
    display: flex;
    gap: 10px;
}

.reward-cards .card {
    width: 88px;
    height: 132px;
}

.reward-cards .card .cname {
    font-size: 9px;
    min-height: 24px;
}

.reward-cards .card .cico {
    font-size: 28px;
}

.reward-cards .card .cdesc {
    font-size: 8px;
}

.dmgpop {
    position: absolute;
    font-size: 20px;
    font-weight: 700;
    color: #ff5b5b;
    text-shadow: 0 0 6px #000;
    pointer-events: none;
    animation: pop 0.7s ease-out forwards;
    z-index: 20;
}

@keyframes pop {
    0% {
        opacity: 1;
        transform: translateY(0)
    }

    100% {
        opacity: 0;
        transform: translateY(-40px)
    }
}