/**
 * Alkimia — Interface Jeu Vidéo Plein Écran (Pop & Sticker Clair)
 * Zéro header web, zéro footer web, zéro marron, zéro doré, responsive desktop & mobile sans déformation.
 */

.game-viewport {
    position: relative;
    width: 100%;
    height: 100%;
    height: 100dvh;
    min-height: -webkit-fill-available;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding:
        calc(80px + var(--safe-top))
        calc(14px + var(--safe-right))
        calc(132px + var(--safe-bottom))
        calc(14px + var(--safe-left));
    overflow: hidden;
}

/* Coins flottants : Logo haut-gauche & Menu haut-droite uniquement */
.hud-corner {
    position: fixed;
    top: calc(12px + var(--safe-top));
    z-index: 30;
}

.hud-corner--tl {
    left: calc(14px + var(--safe-left));
}

.hud-corner--tr {
    right: calc(14px + var(--safe-right));
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.brand-medallion {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.34rem 0.95rem 0.34rem 0.42rem;
    border-radius: 18px;
    border: 2.5px solid var(--ink-outline);
    background: linear-gradient(180deg, #ffffff 0%, #edf4fc 100%);
    box-shadow:
        0 4px 0 var(--ink-outline),
        0 8px 18px rgba(28, 36, 51, 0.14),
        inset 0 2px 0 #ffffff;
}

.brand-medallion__icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    border: 2px solid var(--ink-outline);
    background: linear-gradient(180deg, #e7f4ff 0%, #cce7ff 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-medallion__title {
    font-family: var(--font-display);
    font-size: clamp(1.05rem, 2.2vw, 1.32rem);
    font-weight: 900;
    letter-spacing: 0.06em;
    color: var(--ink-outline);
    line-height: 1;
}

/* Scène centrale plein cadre */
.atelier-stage {
    position: relative;
    width: 100%;
    max-width: 780px;
    height: 100%;
    max-height: 520px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
}

/* Étiquette sticker compacte au-dessus du plateau */
.stage-plaque {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.36rem 0.85rem;
    border-radius: 999px;
    border: 2.5px solid var(--ink-outline);
    background-color: var(--surface-white);
    box-shadow:
        0 3px 0 var(--ink-outline),
        0 6px 14px rgba(28, 36, 51, 0.1);
    max-width: 100%;
}

.stage-plaque__name {
    font-family: var(--font-display);
    font-size: clamp(0.92rem, 2vw, 1.15rem);
    font-weight: 800;
    color: var(--ink-text);
}

.stage-plaque__sub {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ink-muted);
}

/* Rangée plateau + flèches stickers gauche/droite */
.stage-arena {
    position: relative;
    width: 100%;
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(0.4rem, 1.8vw, 1.1rem);
}

.stage-nav-btn {
    flex-shrink: 0;
}

.stage-nav-btn.is-hidden {
    display: none;
}

/* Cadre de plateau style sticker blanc & bleu glacier */
.board-frame {
    position: relative;
    flex: 1;
    min-width: 0;
    max-width: 580px;
    height: 100%;
    max-height: 390px;
    padding: 10px;
    border-radius: 26px;
    border: 3px solid var(--ink-outline);
    background: linear-gradient(180deg, #ffffff 0%, #dce9f7 100%);
    box-shadow:
        0 7px 0 var(--ink-outline),
        0 18px 36px rgba(28, 36, 51, 0.16),
        inset 0 2px 0 #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.board-frame__well {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 17px;
    border: 2.5px solid #bfd1e6;
    background: radial-gradient(circle at 50% 42%, #ffffff 0%, #edf4fb 100%);
    box-shadow: inset 0 4px 12px rgba(28, 36, 51, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#stage-canvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: pointer;
}

#stage-canvas.is-hidden {
    display: none;
}

.stage-tap-hint {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    max-width: calc(100% - 16px);
    padding: 0.22rem 0.68rem;
    border-radius: 999px;
    background-color: rgba(255, 255, 255, 0.94);
    border: 2px solid var(--ink-outline);
    color: var(--ink-text);
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    pointer-events: none;
}

/* Panneau intégré dans le cadre pour l'onglet Icônes & Palette */
.ui-vault {
    width: 100%;
    height: 100%;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    overflow-y: auto;
}

.ui-vault[hidden] {
    display: none;
}

.vault-logo-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.55rem 0.75rem;
    border-radius: 14px;
    border: 2px solid var(--ink-outline);
    background-color: #ffffff;
    box-shadow: 0 3px 0 var(--ink-outline);
}

.vault-logo-mount {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    height: clamp(54px, 11vw, 84px);
}

.vault-swatches {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.45rem;
}

.vault-swatch {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.22rem;
    padding: 0.32rem;
    border-radius: 12px;
    border: 2px solid var(--ink-outline);
    background-color: #ffffff;
}

.vault-swatch__chip {
    width: 100%;
    height: 22px;
    border-radius: 6px;
    border: 1.5px solid var(--ink-outline);
}

.vault-swatch__chip--UI-01 { background-color: #f1f6fc; }
.vault-swatch__chip--UI-02 { background-color: #ffffff; }
.vault-swatch__chip--UI-03 { background-color: #1c2433; }
.vault-swatch__chip--UI-04 { background-color: #2296f3; }
.vault-swatch__chip--UI-05 { background-color: #38c166; }
.vault-swatch__chip--UI-06 { background-color: #f04b45; }

.vault-swatch__code {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--ink-text);
}

.vault-icons {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(74px, 1fr));
    gap: 0.45rem;
}

.vault-icon-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.24rem;
    padding: 0.45rem 0.25rem;
    border-radius: 12px;
    border: 2px solid var(--ink-outline);
    background-color: #ffffff;
    box-shadow: 0 2px 0 var(--ink-outline);
}

.vault-icon-slot__code {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    font-weight: 800;
    color: var(--ink-muted);
}

/* Dock d'inventaire en bas (jamais coupé ni débordant) */
.game-dock {
    position: fixed;
    left: 50%;
    bottom: calc(10px + var(--safe-bottom));
    transform: translateX(-50%);
    z-index: 25;
    width: min(calc(100vw - 16px), 700px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.45rem;
}

.dock-slots {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.36rem;
    max-width: 100%;
    padding: 0.36rem 0.5rem;
    border-radius: 18px;
    border: 2.5px solid var(--ink-outline);
    background: linear-gradient(180deg, #ffffff 0%, #ebf2fa 100%);
    box-shadow:
        0 4px 0 var(--ink-outline),
        0 10px 22px rgba(28, 36, 51, 0.14);
}

.dock-slots[hidden] {
    display: none;
}

.slot-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.32rem;
    padding: 0.34rem 0.6rem;
    border-radius: 11px;
    border: 2px solid var(--ink-outline);
    background: linear-gradient(180deg, #ffffff 0%, #eef4fc 100%);
    color: var(--ink-text);
    font-family: var(--font-ui);
    font-size: 0.74rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 3px 0 var(--ink-outline);
    transition: transform 0.08s ease, box-shadow 0.08s ease, background-color 0.12s ease;
}

.slot-btn:hover {
    background: linear-gradient(180deg, #ffffff 0%, #dfecfb 100%);
}

.slot-btn:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 var(--ink-outline);
}

.slot-btn.is-active {
    background: linear-gradient(180deg, var(--pop-blue-top) 0%, var(--pop-blue) 100%);
    color: #ffffff;
    text-shadow: 0 1px 0 var(--pop-blue-dark);
    box-shadow: 0 3px 0 var(--ink-outline), inset 0 1.5px 0 rgba(255, 255, 255, 0.45);
}

.slot-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    border: 2px solid var(--ink-outline);
    flex-shrink: 0;
}

.slot-dot--ignis { background-color: #df3530; }
.slot-dot--aqua { background-color: #1c84e0; }
.slot-dot--terra { background-color: #259c57; }
.slot-dot--solis { background-color: #eb9f16; }
.slot-dot--umbra { background-color: #8f44c7; }
.slot-dot--aether { background-color: #5ec9d4; }
.slot-dot--menu_rune { background-color: #2b3547; }

.dock-tabs {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.32rem;
    max-width: 100%;
    padding: 0.3rem;
    border-radius: 18px;
    border: 2.5px solid var(--ink-outline);
    background: linear-gradient(180deg, #ffffff 0%, #e7f0fa 100%);
    box-shadow: 0 4px 0 var(--ink-outline), 0 8px 18px rgba(28, 36, 51, 0.14);
}

.dock-tab {
    padding: 0.4rem 0.85rem;
    font-size: 0.8rem;
    border-radius: 12px;
}

/* Panneau Menu superposé (fenêtre pause claire pop) */
.menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 40;
    background-color: rgba(28, 36, 51, 0.42);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.menu-backdrop[hidden] {
    display: none;
}

.menu-panel {
    width: min(92vw, 370px);
    padding: 1.15rem;
    border-radius: 26px;
    border: 3px solid var(--ink-outline);
    background: linear-gradient(180deg, #ffffff 0%, #eef4fc 100%);
    box-shadow:
        0 8px 0 var(--ink-outline),
        0 20px 44px rgba(28, 36, 51, 0.28),
        inset 0 2px 0 #ffffff;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.menu-panel__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.menu-panel__title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 900;
    color: var(--ink-outline);
}

.menu-group {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.menu-group__label {
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-muted);
}

.menu-row,
.menu-colors {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.45rem;
}

@media (max-width: 600px) {
    .game-viewport {
        padding:
            calc(78px + var(--safe-top))
            calc(8px + var(--safe-right))
            calc(154px + var(--safe-bottom))
            calc(8px + var(--safe-left));
    }

    .atelier-stage {
        max-height: none;
        gap: 0.5rem;
    }

    .board-frame {
        padding: 7px;
        border-radius: 22px;
        max-height: 100%;
    }

    .brand-medallion__title {
        font-size: 0.98rem;
    }

    .stage-plaque__sub {
        display: none;
    }

    .game-btn--round {
        width: 40px;
        height: 40px;
    }

    .dock-slots {
        width: 100%;
        padding: 0.3rem 0.35rem;
        gap: 0.28rem;
    }

    .slot-btn {
        padding: 0.28rem 0.44rem;
        font-size: 0.68rem;
        gap: 0.24rem;
    }

    .dock-tabs {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 0.24rem;
        padding: 0.26rem;
    }

    .dock-tab {
        width: 100%;
        padding: 0.38rem 0.15rem;
        font-size: clamp(0.64rem, 2.7vw, 0.74rem);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .stage-tap-hint {
        font-size: 0.68rem;
        padding: 0.18rem 0.55rem;
    }

    .vault-swatches {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}
