/* Euromaja Multipley — split-screen board */

:root {
    color-scheme: only light;
    --mx-ink: #eef6ff;
    --mx-dim: rgba(238, 246, 255, 0.62);
    --mx-line: rgba(255, 255, 255, 0.16);
    --mx-glass: rgba(10, 16, 28, 0.78);
    --mx-mint: #5effd4;
    --mx-sky: #38bdf8;
    --mx-spring: cubic-bezier(0.22, 1, 0.36, 1);
    --mx-pad-t: max(8px, env(safe-area-inset-top, 0px));
    --mx-pad-r: max(8px, env(safe-area-inset-right, 0px));
    --mx-pad-b: max(8px, env(safe-area-inset-bottom, 0px));
    --mx-pad-l: max(8px, env(safe-area-inset-left, 0px));
    --mx-top-h: 40px;
    --mx-bar-h: 28px;
    --mx-radius: 24px;
    --euromaja-bg-base: #0b1220;
}

html.mx-root {
    height: 100%;
    min-height: 100dvh;
    overflow: hidden;
    background: #0b1220;
    overscroll-behavior: none;
}

html.mx-root::before {
    content: '';
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    height: 100lvh;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(80% 50% at 12% 0%, rgba(94, 255, 212, 0.12), transparent 42%),
        radial-gradient(70% 45% at 100% 10%, rgba(56, 189, 248, 0.1), transparent 46%),
        linear-gradient(160deg, #0b1220 0%, #12203a 42%, #3b1d73 100%);
}

body.mx-app {
    margin: 0;
    min-height: 100%;
    min-height: 100dvh;
    overflow: hidden;
    font-family: Outfit, system-ui, sans-serif;
    color: var(--mx-ink);
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    overscroll-behavior: none;
}

@media (pointer: coarse) and (orientation: landscape) {
    html.mx-root {
        height: auto;
        min-height: 100%;
        min-height: 100dvh;
        min-height: calc(100dvh + 1px);
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    body.mx-app {
        min-height: 100%;
        min-height: 100dvh;
        min-height: calc(100dvh + 1px);
        overflow-x: hidden;
        overflow-y: visible;
    }
}

.mx-stage {
    position: fixed;
    inset: 0;
    width: var(--eu-vvw, 100%);
    height: var(--eu-vvh, 100dvh);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    padding: 0 var(--mx-pad-r) var(--mx-pad-b) var(--mx-pad-l);
    box-sizing: border-box;
}

.mx-top {
    height: calc(var(--mx-top-h) + var(--mx-pad-t));
    padding: var(--mx-pad-t) 4px 0;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    z-index: 40;
}

.mx-add {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #04120e;
    text-decoration: none;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    background: linear-gradient(135deg, var(--mx-mint), var(--mx-sky));
    border: 0;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
    box-shadow: 0 8px 18px rgba(56, 189, 248, 0.28);
}

.mx-layout-btn {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: var(--mx-ink);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--mx-line);
    cursor: pointer;
    padding: 0;
}

.mx-layout-btn:hover,
.mx-layout-btn:focus-visible {
    background: rgba(94, 255, 212, 0.14);
    border-color: rgba(94, 255, 212, 0.4);
}

.mx-layout-btn:active {
    transform: scale(0.94);
}

.mx-layout-btn svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
}

.mx-bubbles {
    flex: 1 1 auto;
    min-width: 0;
    height: 36px;
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    touch-action: pan-x;
}

.mx-bubble {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--mx-line);
    background: rgba(8, 14, 26, 0.9);
    color: var(--mx-ink);
    cursor: pointer;
    font-size: 1.05rem;
    line-height: 1;
    padding: 0;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
    animation: mxPop 0.34s var(--mx-spring);
}

.mx-bubble:active {
    transform: scale(0.94);
}

@keyframes mxPop {
    from { transform: scale(0.55); opacity: 0; }
    to { transform: none; opacity: 1; }
}

.mx-board-clip {
    position: relative;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
}

.mx-board {
    position: absolute;
    inset: 0;
    contain: layout;
}

.mx-empty {
    position: absolute;
    inset: 0;
    pointer-events: auto;
    cursor: pointer;
}

.mx-empty[hidden] {
    display: none !important;
}

.mx-btn {
    border: 0;
    cursor: pointer;
    font-family: inherit;
    font-weight: 800;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    border-radius: 999px;
    padding: 11px 16px;
}

.mx-btn-primary {
    color: #04120e;
    background: linear-gradient(135deg, var(--mx-mint), var(--mx-sky));
    box-shadow: 0 10px 24px rgba(56, 189, 248, 0.28);
}

.mx-icon-btn {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
    font-size: 1rem;
}

.mx-panel {
    position: absolute;
    z-index: 3;
    display: flex;
    flex-direction: column;
    border-radius: var(--mx-radius);
    overflow: hidden;
    background: var(--mx-glass);
    border: 1px solid var(--mx-line);
    box-shadow:
        0 14px 36px rgba(0, 0, 0, 0.38),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transform: translate3d(0, 0, 0) scale(1);
    transform-origin: center top;
    contain: layout;
    isolation: isolate;
    transition:
        left 0.34s var(--mx-spring),
        top 0.34s var(--mx-spring),
        width 0.34s var(--mx-spring),
        height 0.34s var(--mx-spring),
        transform 0.34s var(--mx-spring),
        opacity 0.24s ease,
        box-shadow 0.28s ease;
}

.mx-panel.is-focus {
    box-shadow:
        0 18px 44px rgba(0, 0, 0, 0.48),
        0 0 0 1.5px rgba(94, 255, 212, 0.5);
}

.mx-panel.is-lift,
.mx-panel.is-resize {
    transition: none;
    z-index: 80 !important;
    will-change: left, top, width, height, transform;
}

.mx-panel.is-lift {
    transform: scale(1.015);
    box-shadow: 0 28px 60px rgba(0, 0, 0, 0.55);
}

.mx-panel.is-off {
    opacity: 0.55;
    transform: scale(0.86);
}

.mx-panel.is-swap {
    box-shadow:
        0 18px 44px rgba(0, 0, 0, 0.5),
        0 0 0 2px rgba(94, 255, 212, 0.85);
}

.mx-panel.is-swap .mx-chrome {
    background: linear-gradient(180deg, rgba(94, 255, 212, 0.22), rgba(56, 189, 248, 0.12));
}

.mx-panel.is-parked {
    opacity: 0;
    pointer-events: none;
    transform: translate3d(0, -28px, 0) scale(0.18);
}

.mx-panel.is-enter {
    opacity: 0;
    transform: scale(0.94);
}

.mx-chrome {
    height: var(--mx-bar-h);
    flex: 0 0 var(--mx-bar-h);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 8px 0 4px;
    cursor: grab;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
    touch-action: none;
    position: relative;
    z-index: 6;
}

.mx-chrome:active {
    cursor: grabbing;
}

.mx-lights {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 0 0 auto;
    z-index: 7;
}

.mx-light {
    width: 28px;
    height: 28px;
    border: 0;
    padding: 0;
    background: transparent;
    cursor: pointer;
    display: grid;
    place-items: center;
    border-radius: 50%;
    -webkit-tap-highlight-color: transparent;
}

.mx-light i {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    pointer-events: none;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.28);
}

.mx-close i { background: #ff5f57; }
.mx-full i { background: #28c840; }

.mx-light:active i {
    filter: brightness(0.86);
}

.mx-panel.is-max .mx-full i {
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.28), 0 0 10px rgba(40, 200, 64, 0.7);
}

.mx-title {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mx-body {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    background: #070b14;
}

.mx-body iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    background: #070b14;
    contain: strict;
}

.mx-hit {
    position: absolute;
    inset: 0;
    z-index: 2;
}

.mx-panel.is-focus:not(.is-lift):not(.is-resize) .mx-hit {
    display: none;
}

.mx-panel.is-parked .mx-body iframe {
    visibility: hidden;
    pointer-events: none;
}

.mx-handles {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    top: var(--mx-bar-h);
    z-index: 4;
    pointer-events: none;
}

.mx-handle {
    position: absolute;
    pointer-events: auto;
    touch-action: none;
}

.mx-handle[data-h="n"],
.mx-handle[data-h="s"] { left: 14px; right: 14px; height: 12px; cursor: ns-resize; }
.mx-handle[data-h="e"],
.mx-handle[data-h="w"] { top: 14px; bottom: 14px; width: 12px; cursor: ew-resize; }
.mx-handle[data-h="n"] { top: 0; }
.mx-handle[data-h="s"] { bottom: 0; }
.mx-handle[data-h="e"] { right: 0; }
.mx-handle[data-h="w"] { left: 0; }
.mx-handle[data-h="nw"],
.mx-handle[data-h="ne"],
.mx-handle[data-h="sw"],
.mx-handle[data-h="se"] { width: 22px; height: 22px; }
.mx-handle[data-h="nw"] { top: 0; left: 0; cursor: nwse-resize; }
.mx-handle[data-h="se"] {
    bottom: 0;
    right: 0;
    cursor: nwse-resize;
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, transparent 48%, rgba(94, 255, 212, 0.75) 48%);
    border-radius: 0 0 var(--mx-radius) 0;
}
.mx-handle[data-h="ne"] { top: 0; right: 0; cursor: nesw-resize; }
.mx-handle[data-h="sw"] { bottom: 0; left: 0; cursor: nesw-resize; }

.mx-launcher {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding:
        max(16px, env(safe-area-inset-top))
        max(16px, env(safe-area-inset-right))
        max(16px, env(safe-area-inset-bottom))
        max(16px, env(safe-area-inset-left));
    background: rgba(4, 8, 16, 0.45);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    touch-action: auto;
}

.mx-launcher[hidden] {
    display: none !important;
}

.mx-launcher-sheet {
    width: min(720px, 100%);
    max-height: min(78dvh, 760px);
    overflow: auto;
    border-radius: 28px 28px 18px 18px;
    background: linear-gradient(180deg, rgba(22, 32, 52, 0.96), rgba(10, 16, 28, 0.96));
    border: 1px solid var(--mx-line);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
    padding: 18px 16px 22px;
    animation: mxSheetIn 0.38s var(--mx-spring);
    touch-action: pan-y;
    overscroll-behavior: contain;
}

@keyframes mxSheetIn {
    from { opacity: 0; transform: translateY(24px) scale(0.96); }
    to { opacity: 1; transform: none; }
}

.mx-launcher-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.mx-launcher-head h2 {
    font-family: Fraunces, Georgia, serif;
    font-size: 1.35rem;
    margin: 0;
}

.mx-search {
    width: 100%;
    border: 1px solid var(--mx-line);
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    border-radius: 14px;
    padding: 12px 14px;
    font: inherit;
    font-size: 16px;
    margin-bottom: 14px;
    box-sizing: border-box;
    user-select: text;
    -webkit-user-select: text;
    touch-action: auto;
}

.mx-app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
    gap: 10px;
}

.mx-group {
    grid-column: 1 / -1;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--mx-mint);
    margin-top: 6px;
}

.mx-none {
    grid-column: 1 / -1;
    color: var(--mx-dim);
    text-align: center;
    margin: 12px 0;
}

.mx-app {
    text-align: left;
    border: 1px solid var(--mx-line);
    background: rgba(255, 255, 255, 0.05);
    color: inherit;
    border-radius: 16px;
    padding: 14px 12px;
    cursor: pointer;
    font: inherit;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 84px;
    transition: transform 0.24s var(--mx-spring), background 0.2s ease;
}

.mx-app:hover,
.mx-app:focus-visible {
    transform: translateY(-2px);
    background: rgba(94, 255, 212, 0.12);
}

.mx-app-icon { font-size: 1.4rem; }
.mx-app-name { font-weight: 700; font-size: 0.86rem; }

.mx-layouts {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding:
        max(16px, env(safe-area-inset-top))
        max(16px, env(safe-area-inset-right))
        max(16px, env(safe-area-inset-bottom))
        max(16px, env(safe-area-inset-left));
    background: rgba(4, 8, 16, 0.45);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    touch-action: auto;
}

.mx-layouts[hidden] {
    display: none !important;
}

.mx-layouts-sheet {
    width: min(560px, 100%);
    max-height: min(78dvh, 640px);
    overflow: auto;
    border-radius: 28px 28px 18px 18px;
    background: linear-gradient(180deg, rgba(22, 32, 52, 0.96), rgba(10, 16, 28, 0.96));
    border: 1px solid var(--mx-line);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
    padding: 18px 16px 22px;
    animation: mxSheetIn 0.38s var(--mx-spring);
    touch-action: pan-y;
}

.mx-layout-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
    gap: 10px;
}

.mx-lay {
    border: 1px solid var(--mx-line);
    background: rgba(255, 255, 255, 0.05);
    border-radius: 18px;
    padding: 10px;
    cursor: pointer;
    color: inherit;
}

.mx-lay:hover,
.mx-lay:focus-visible {
    background: rgba(94, 255, 212, 0.12);
    border-color: rgba(94, 255, 212, 0.45);
}

.mx-lay-preview {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    background: rgba(0, 0, 0, 0.28);
    border-radius: 12px;
    overflow: hidden;
}

.mx-lay-preview i {
    position: absolute;
    box-sizing: border-box;
    border-radius: 5px;
    background: linear-gradient(180deg, rgba(94, 255, 212, 0.42), rgba(56, 189, 248, 0.28));
    border: 1px solid rgba(238, 246, 255, 0.28);
}

.mx-toast {
    position: fixed;
    left: 50%;
    bottom: max(24px, calc(env(safe-area-inset-bottom) + 12px));
    transform: translateX(-50%);
    z-index: 300;
    background: rgba(8, 12, 20, 0.92);
    color: #fff;
    border: 1px solid var(--mx-line);
    border-radius: 999px;
    padding: 10px 16px;
    font-weight: 700;
    font-size: 0.82rem;
}

.mx-toast[hidden] { display: none !important; }

@media (max-width: 720px) {
    :root {
        --mx-bar-h: 40px;
        --mx-radius: 20px;
        --mx-top-h: 44px;
    }
    .mx-handle[data-h="n"],
    .mx-handle[data-h="s"] { height: 22px; }
    .mx-handle[data-h="e"],
    .mx-handle[data-h="w"] { width: 22px; }
    .mx-handle[data-h="nw"],
    .mx-handle[data-h="ne"],
    .mx-handle[data-h="sw"] { width: 28px; height: 28px; }
    .mx-handle[data-h="se"] { width: 36px; height: 36px; }
}

html[data-eu-frame="1"][data-eu-w="xs"] .mx-stage,
html[data-eu-frame="1"][data-eu-h="xs"] .mx-stage {
    padding-bottom: max(6px, env(safe-area-inset-bottom, 0px));
}

html[data-eu-frame="1"][data-eu-w="xs"] .mx-chrome,
html[data-eu-frame="1"][data-eu-dens="tight"] .mx-chrome {
    height: 40px;
    flex-basis: 40px;
}

@media (prefers-reduced-motion: reduce) {
    .mx-panel,
    .mx-bubble,
    .mx-app,
    .mx-launcher-sheet,
    .mx-layouts-sheet {
        transition: none !important;
        animation: none !important;
    }
}
