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

:root {
    --blue-900: #102645;
    --blue-700: #1d4f91;
    --blue-500: #2b7fd8;
    --grenat-700: #7f1d32;
    --grenat-500: #a72f48;
    --text-main: #f3f6fb;
    --text-soft: #c9d5e7;
    --surface: rgba(14, 31, 55, 0.86);
    --surface-border: rgba(90, 133, 197, 0.3);
    --canvas-background-color: #84c3a4;
    --shadow: 0 16px 45px rgba(0, 0, 0, 0.4);
}

html,
body {
    width: 100%;
    min-height: 100%;
    font-size: 16px;
}

body {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-main);
    background:
        radial-gradient(circle at 12% 12%, rgba(43, 127, 216, 0.42), transparent 45%),
        radial-gradient(circle at 88% 82%, rgba(127, 29, 50, 0.38), transparent 44%),
        linear-gradient(140deg, var(--blue-900), #08152a 58%, #130914 100%);
    padding: 10px;
    display: grid;
    place-items: center;
}

body:not(:has(.container)) {
    line-height: 1.6;
}

body:not(:has(.container))::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 42px 42px;
    opacity: 0.32;
}

body:not(:has(.container)) > * {
    width: min(820px, 100%);
    margin-inline: auto;
    position: relative;
    z-index: 1;
}

main {
    width: min(820px, 100%);
}

main section + section {
    margin-top: 12px;
}

body:not(:has(.container)) h1,
body:not(:has(.container)) p,
body:not(:has(.container)) h2,
body:not(:has(.container)) ul,
body:not(:has(.container)) a {
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: 14px;
    box-shadow: var(--shadow);
}

h1 {
    font-size: clamp(2rem, 4vw, 3rem);
    letter-spacing: 0.03em;
    padding: clamp(18px, 3vw, 24px);
    border-left: 5px solid var(--grenat-500);
    margin-bottom: 14px;
}

p {
    font-size: clamp(1rem, 1.8vw, 1.12rem);
    color: var(--text-soft);
    padding: clamp(16px, 2.6vw, 18px);
}

h2 {
    font-size: clamp(1.2rem, 2.5vw, 1.6rem);
    padding: 14px 18px;
    border-left: 4px solid var(--blue-500);
    margin-bottom: 10px;
}

ul {
    list-style: none;
    padding: 16px 18px;
    margin-bottom: 16px;
}

li {
    color: var(--text-soft);
    position: relative;
    padding-left: 18px;
}

li + li {
    margin-top: 10px;
}

li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.6em;
    width: 9px;
    height: 9px;
    border-radius: 2px;
    background: linear-gradient(140deg, var(--blue-500), var(--grenat-500));
}

footer {
    width: min(820px, 100%);
    margin-top: 14px;
    text-align: center;
}

footer p {
    margin: 0;
    padding: 0;
    font-size: 0.92rem;
    color: var(--text-soft);
    background: transparent;
    border: 0;
    box-shadow: none;
}

.notas-rodape{
    position: relative
}
a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 8px;
    padding: 12px 24px;
    min-width: 180px;
    width: 100%;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #fff;
    text-decoration: none;
    background:
        linear-gradient(120deg, var(--blue-700), var(--grenat-700)) !important;
    transition: transform 0.2s ease, filter 0.2s ease;
}

a:hover,
a:focus-visible {
    transform: translateY(-2px);
    filter: brightness(1.08);
}

a:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

canvas {
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 12px;
    box-shadow: var(--shadow);
    background: var(--canvas-background-color);
    z-index: 1;
    pointer-events: none;
}

.game-shell {
    position: relative;
    width: fit-content;
    max-width: 100%;
}

#ui-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    padding: 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    pointer-events: none;
    z-index: 2;
}

.ui-panel {
    background: rgba(6, 16, 31, 0.82);
    border: 1px solid rgba(172, 209, 255, 0.34);
    border-radius: 10px;
    color: #f8fbff;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
}
#debug-panel{
    pointer-events: auto;
    position: absolute;
    top: 200px;
}
#ui-hud {
    width: fit-content;
    min-width: 150px;
    padding: 10px 12px;
    font-size: 0.9rem;
    line-height: 1.25;
}

#ui-hud p {
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    font-size: 0.9rem;
    color: #f8fbff;
}

#ui-hud p + p {
    margin-top: 4px;
}

.ui-warning {
    align-self: center;
    margin-top: auto;
    margin-bottom: auto;
    max-width: min(90%, 560px);
    padding: 14px 18px;
    font-weight: 600;
    text-align: center;
    border-color: rgba(255, 192, 142, 0.45);
    background: rgba(92, 37, 11, 0.86);
}

.ui-dialog {
    align-self: center;
    width: min(94%, 720px);
    padding: 14px 16px;
    margin-bottom: 8px;
    border-color: rgba(195, 223, 255, 0.42);
}

.ui-dialog-speaker {
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    font-size: 0.92rem;
    font-weight: 700;
    color: #9ed0ff;
}

.ui-dialog-text {
    margin: 8px 0 0 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    font-size: 1rem;
    line-height: 1.35;
    color: #f8fbff;
}
/* Estilo para o botão selecionado no diálogo */
.is-selected {
    border: 2px solid yellow !important;
    background-color: rgba(255, 255, 0, 0.2) !important;
    transform: scale(1.1); /* Dá um leve destaque */
    transition: transform 0.1s ease;
}

.ui-conteiner-button-dialog{
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    z-index: 12;
    pointer-events: all;
    margin-top: 10px;
}
.ui-conteiner-button-dialog button{
    background-color: var(--canvas-background-color);
    border: 1px solid #6f9f87;
    border-radius: 10px;
    width: auto;
    min-width: 60px;
    height: 20px;
    box-shadow: 0px 2px 0px 2px var(--canvas-background-color);
    font-size: 12px;
    font-weight: 600;
    color: var(--blue-900);
}
.ui-conteiner-button-dialog button:hover{
    cursor: pointer;
}
.ui-conteiner-button-dialog button:active{
    background-color: #6f9f87;
}
.ui-conteiner-inventory{
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 300px;
    padding: 10px 12px;
    z-index: 3;
}
.ui-conteiner-inventory p {
    margin: 0;
    padding: 0;
    margin-bottom: 10px;
}
#ui-inventory {
    display: grid;
    /* 4 colunas de 50px */
    grid-template-columns: repeat(4, 50px);
    /* altura fixa para mostrar 4 linhas */
    grid-auto-rows: 50px;
    gap: 10px;
    /* altura total = 4 itens + gaps */
    max-height: calc(4 * 50px + 3 * 10px);
    overflow-y: auto;
    padding: 3px;
}
.item-inventory{
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    width: 50px;
    height: 50px;
    border-radius: 10px;
    background-color: var(--text-main);
    color: var(--blue-900);
    transition: transform 0.15s ease;
    pointer-events: all;
    z-index: 4;
}
.item-inventory:hover, .item-inventory.empty:hover {
    transform: scale(1.1);
    cursor: pointer;
}
.item-inventory img{
    width: 80%;
    height: auto;
}
.item-inventory img[src=""] {
    display: none;
}
.item-inventory span{
    position: absolute;
    bottom: 3px;
    right: 3px;
}
.item-inventory.empty {
    background-color: rgba(255,255,255,0.1);
    border: 1px dashed #999;
}
#ui-inventory::-webkit-scrollbar {
    width: 6px;
}
#ui-inventory::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}
#btnToggleQuestUI{
    position: absolute;
    bottom: 5px;
    right: 5px;
    pointer-events: auto;
    border: #84c3a4 2px solid;
    border-radius: 10px;
    padding: 3px;
    background-color: transparent;
    color: var(--text-main);
}
#btnToggleQuestUI:hover{
    cursor: pointer;
    background-color: #1d4f91;
}
#btnToggleQuestUI:active{
    background-color: #102645;
}
.is-hidden {
    display: none;
}
.container {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

@media (max-width: 768px) {
    body {
        padding: 14px;
    }

    ul,
    p,
    h1,
    h2 {
        border-radius: 12px;
    }

    a {
        width: 100%;
    }

    #ui-overlay {
        padding: 10px;
    }

    #ui-hud {
        font-size: 0.82rem;
    }

    .ui-dialog {
        width: 100%;
    }
}
