:root {


    color-scheme: light;
    --panel-bg: #ffffff;
    --panel-border: #7c7c7ca1;
    --text: #1a1a1a;
    --muted: #515151;
    --accent: #6ea8fe;
    --danger: #f94646;
    --tool-bg: rgb(0 0 0 / 6%);
    --tool-active: rgba(110, 168, 254, 0.2);
    --panel-link: #0070c1; 
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #0b0d12;
    color: var(--text);
    font-family: "Roboto Flex", Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.bmc-btn {
    height: 44px !important;
}

.bmc-btn-container {
    visibility: hidden;
    opacity: 0;
    position: fixed;
    top: 78%;
    left: 5%;
}

.bmc-btn-container.font-ready {
    visibility: visible;
    animation: fadeIn 400ms ease forwards;
}

#app {
    position: relative;
    width: 100%;
    height: 100%;
}

#canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    touch-action: none;
    background:
        radial-gradient(circle at center, rgba(70, 90, 140, 0.16), transparent 50%),
        linear-gradient(180deg, #11151c 0%, #080a0f 100%);
}

.panel {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 10;
    width: min(380px, calc(100vw - 32px));
    padding: 14px;
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    background: var(--panel-bg);
    backdrop-filter: blur(14px);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

.panel h1 {
    margin: 0 0 8px;
    font-size: 18px;
    line-height: 1.2;
}

.panel h1 a {
    text-decoration: none;
    color: var(--panel-link);
}

.panel p {
    margin: 0 0 12px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}

.row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.row:last-child {
    margin-bottom: 0;
}

.row.wrap {
    flex-wrap: wrap;
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.project-title-row {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: nowrap;
}

.rename-project-button {
    width: 24px;
    height: 24px;
    padding: 3px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.rename-project-button svg {
    width: 16px;
    height: 16px;
}

label {
    font-size: 13px;
    color: var(--text);
}

input[type="color"] {
    width: 48px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    background: transparent;
    cursor: pointer;
}

input[type="range"] {
    width: 120px;
}

button {
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    padding: 9px 12px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    cursor: pointer;
    transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}

button:hover {
    background: rgb(197 197 197 / 51%);
    border-color: rgb(121 121 121 / 37%);
}

button:active {
    transform: translateY(1px);
}

.tool-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tool-button {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 12px;
    background: var(--tool-bg);
}

.tool-button.is-active {
    background: var(--tool-active);
    border-color: rgba(110, 168, 254, 0.5);
}

.tool-button svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.project-card {
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.project-meta {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.5;
}

.hint {
    font-size: 12px;
    line-height: 1.5;
    backdrop-filter: blur(14px);
    padding: 5px;
}

.danger {
    color: var(--danger);
}

.hidden {
    display: none !important;
}

.app-dialog-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.36);
    padding: 16px;
}

.app-dialog {
    width: min(640px, calc(100vw - 32px));
    min-height: 180px;
    padding: 24px 28px;
    border-radius: 10px;
    border: 1px solid var(--panel-border);
    background: #fff;
    color: #1a1a1a;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 22px;
}

.app-dialog-message {
    min-height: 56px;
    font-size: 1.5em;
    line-height: 1.2;
    text-align: center;
}

.app-dialog-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 8px;
    font-size: 1rem;
    color: #212529;
    background-color: #fff;
}

.app-dialog-input:focus {
    outline: 0;
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgb(13 110 253 / 25%);
}

.app-dialog-actions {
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.app-dialog-ok,
.app-dialog-cancel {
    min-width: 78px;
    border: 0;
    border-radius: 10px;
    padding: 10px 16px;
    font-size: 1em;
    font-weight: 700;
}

.app-dialog-ok {
    background: #3169e6;
    color: #ffffff;
}

.app-dialog-cancel {
    background: #c7c7c7;
    color: #1f1f1f;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}


@media (max-width: 999px) {
    .panel {
        inset: 0;
        width: 100%;
        height: 100%;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
        backdrop-filter: none;
        box-shadow: none;
        pointer-events: none;
    }

    .panel h1,
    .panel hr,
    .row-project,
    .row-hint {
        display: none;
    }

    .row {
        position: absolute;
        margin: 0;
        pointer-events: auto;
    }

    .row-tools {
        top: 94px;
        left: 8px;
        bottom: 8px;
    }

    .tool-strip {
        flex-direction: column;
        flex-wrap: nowrap;
        gap: 4px;
        justify-content: flex-start;
        align-items: center;
    }

    .tool-button {
        width: 34px;
        height: 34px;
        border-radius: 8px;
        background: rgb(8 12 18 / 92%);
        border-color: rgba(220, 230, 255, 0.25);
    }

    .tool-button svg {
        width: 18px;
        height: 18px;
        stroke: #fff;
    }

    .row-color,
    .row-mode,
    .row-opacity,
    .row-size,
    .row-actions {
        min-height: 24px;
        padding: 3px 6px;
        border-radius: 8px;
        background: rgb(8 12 18 / 92%);
        color: white;
        border: 1px solid rgba(220, 230, 255, 0.22);
        align-items: center;
        gap: 4px;
    }

    .row-color {
        top: 6px;
        left: 54px;
        /* width: 46px; */
        justify-content: center;
    }

    .row-mode {
        top: 6px;
        right: 8px;
        max-width: 120px;
        justify-content: center;
    }

    .row-opacity {
        top: 34px;
        left: 54px;
        right: calc(50% + 4px);
    }

    .row-size {
        top: 34px;
        left: calc(50% + 4px);
        right: 8px;
    }

    .row-actions {
        top: 62px;
        left: 54px;
        right: 8px;
        display: flex;
        flex-wrap: nowrap;
        justify-content: space-between;
    }

    .row-color label,
    .row-opacity label,
    .row-size label,
    .row-mode label {
        font-size: 8px;
        color: white;
    }

    input[type="color"] {
        width: 32px;
        height: 18px;
        border-radius: 6px;
    }

    input[type="range"] {
        width: 100%;
        min-width: 0;
    }

    .mono {
        font-size: 10px;
        white-space: nowrap;
    }

    .row-actions button {
        flex: 1 1 0;
        min-width: 0;
        padding: 3px 4px;
        font-size: 10px;
        line-height: 1.1;
        border-radius: 7px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        color: white;
    }

    .bmc-btn-container {
        top: 5%;
        left: 2%;
    }

    .bmc-btn-container .bmc-btn-text {
        display: none;
    }

    .bmc-btn-container .bmc-btn {
        min-width: 24px;
        padding: 6px;
    }
}

@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;
        --panel-bg: rgba(22, 22, 28, 0.92);
        --panel-border: rgba(255, 255, 255, 0.12);
        --text: #f5f7fb;
        --muted: #aab3c5;
        --accent: #6ea8fe;
        --danger: #ff8585;
        --tool-bg: rgba(255, 255, 255, 0.06);
        --tool-active: rgba(110, 168, 254, 0.2);
        --panel-link: #7ac7ff;
    }
}
