:root {
    color-scheme: light;
    --brand: #e67e22;
    --brand-strong: #b85c0e;
    --brand-soft: #fdf1e3;
    --brand-blue: #47add9;
    --brand-ink: #523c25;
    --header: #3B2B1A;
    --header-fg: #f0e4d5;
    --header-fg-strong: #ffffff;
    --header-hover: rgb(255 255 255 / .14);
    --header-sunken: rgb(0 0 0 / .22);
    --accent-green: #398439;
    --accent-blue: #2a8fad;
    --accent-red: #e74c3c;
    --bg: #fbfbfb;
    --surface: #ffffff;
    --surface-2: #f5f6f7;
    --surface-sunken: #eeeeee;
    --border: #e0e2e5;
    --border-strong: #c9ccd0;
    --text: #273238;
    --text-muted: #5d686f;
    --text-faint: #68737a;
    --shadow-sm: 0 1px 2px rgb(16 24 40 / .06), 0 1px 3px rgb(16 24 40 / .08);
    --shadow-md: 0 4px 12px rgb(16 24 40 / .08), 0 2px 4px rgb(16 24 40 / .06);
    --shadow-lg: 0 16px 40px rgb(16 24 40 / .16), 0 4px 12px rgb(16 24 40 / .08);
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-pill: 999px;
    --topbar-h: 100px;
    --actionbar-h: 64px;
    --tap: 44px;
    --font: "Nunito Sans", sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
    --ease: cubic-bezier(.2, .8, .2, 1)
}

[data-theme=escuro] {
    color-scheme: dark;
    --brand: #ef9440;
    --brand-strong: #e67e22;
    --brand-soft: #2b2016;
    --bg: #10161b;
    --surface: #1a2128;
    --surface-2: #222b33;
    --surface-sunken: #141a20;
    --border: #2c363f;
    --border-strong: #3d4952;
    --text: #eceff1;
    --text-muted: #aab4bc;
    --text-faint: #939da4;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / .4);
    --shadow-md: 0 4px 12px rgb(0 0 0 / .45);
    --shadow-lg: 0 16px 40px rgb(0 0 0 / .6)
}

*,
*:before,
*:after {
    box-sizing: border-box
}

html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
    overscroll-behavior: none
}

body {
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent
}

button,
input,
select {
    font: inherit;
    color: inherit
}

:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: var(--radius-sm)
}

.app {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    height: 100dvh;
    padding-bottom: env(safe-area-inset-bottom)
}

.topbar {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    height: 56px;
    min-height: 56px;
    padding: 0;
    padding-top: 0;
    background: var(--header);
    color: var(--header-fg);
    box-shadow: var(--shadow-sm);
    z-index: 20
}

.topbar .btn-ghost,
.topbar .btn-icon {
    color: var(--header-fg)
}

.topbar .btn-ghost:hover:not(:disabled),
.topbar .btn-icon:hover:not(:disabled) {
    background: var(--header-hover);
    color: var(--header-fg-strong)
}

.brand {
    align-items: flex-start;
    height: 100%;
}

.brand-logo {
    display: block;
    width: auto
}

.brand-logo--full {
    height: 56px;
    width: auto;
}

.brand-logo--mark {
    display: none;
    height: 36px;
    width: 36px
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto
}

.topbar-sep {
    width: 1px;
    height: 24px;
    background: #fff3;
    margin: 0 4px
}

.viewswitch {
    display: flex;
    gap: 2px;
    padding: 3px;
    background: var(--header-sunken);
    border-radius: var(--radius-pill)
}

.viewswitch-btn {
    border: 0;
    background: transparent;
    color: var(--header-fg);
    padding: 7px 16px;
    border-radius: var(--radius-pill);
    font-weight: 650;
    font-size: 13px;
    cursor: pointer;
    transition: background .15s var(--ease), color .15s var(--ease)
}

.viewswitch-btn.is-active {
    background: var(--brand);
    color: #3a2a19
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 38px;
    padding: 0 13px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    background: transparent;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s var(--ease), border-color .15s var(--ease), transform .08s var(--ease), opacity .15s var(--ease)
}

.btn .i {
    font-size: 13px;
    line-height: 1
}

.btn:active:not(:disabled) {
    transform: translateY(1px)
}

.btn:disabled {
    opacity: .42;
    cursor: not-allowed
}

.btn-ghost {
    color: var(--text-muted)
}

.btn-ghost:hover:not(:disabled) {
    background: var(--surface-2);
    color: var(--text)
}

.btn-icon {
    min-width: 38px;
    padding: 0;
    color: var(--text-muted)
}

.btn-icon:hover:not(:disabled) {
    background: var(--surface-2);
    color: var(--text)
}

.btn-primary {
    background: var(--accent-green);
    color: #fff;
    min-width: 124px;
    box-shadow: var(--shadow-sm)
}

.btn-primary:hover:not(:disabled) {
    filter: brightness(1.06)
}

.btn-primary.is-running {
    background: var(--brand)
}

.btn-step {
    background: var(--accent-blue);
    border-color: transparent;
    color: #fff
}

.btn-step:hover:not(:disabled) {
    background: var(--accent-blue);
    border-color: transparent;
    filter: brightness(1.06)
}

.btn-secondary {
    background: var(--surface-2);
    border-color: var(--border);
    color: var(--text)
}

.btn-secondary:hover:not(:disabled) {
    background: var(--surface-sunken);
    border-color: var(--border-strong)
}

.caret {
    font-size: 9px;
    opacity: .7
}

.dropdown {
    position: relative
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 268px;
    max-width: calc(100vw - 20px);
    max-height: min(70dvh, 520px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 6px;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: none;
    z-index: 60
}

.dropdown.is-open .dropdown-menu {
    display: block
}

.dropdown-menu button {
    display: block;
    width: 100%;
    text-align: left;
    border: 0;
    background: transparent;
    padding: 9px 11px;
    border-radius: var(--radius-sm);
    cursor: pointer
}

.dropdown-menu button:hover {
    background: var(--surface-2)
}

.dropdown-menu strong {
    display: block;
    font-size: 16px;
    font-weight: 650
}

.dropdown-menu small {
    display: block;
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 1px
}

.dropdown-sep {
    display: block;
    height: 1px;
    background: var(--border);
    margin: 5px 8px
}

.dropdown-more {
    display: none
}

.dropdown-more .dropdown-menu {
    min-width: 232px
}

.dropdown-more .dropdown-menu button {
    min-height: var(--tap)
}

.workbench {
    display: flex;
    min-height: 0;
    position: relative;
    background: var(--bg)
}

.panel {
    min-width: 0;
    min-height: 0;
    position: relative
}

.panel-blocks {
    flex: 1 1 auto;
    background: var(--surface)
}

#blocklyDiv {
    position: absolute;
    inset: 0
}

.panel-stage {
    flex: 0 0 var(--stage-width, 46%);
    display: flex;
    padding: 8px 8px 8px 0
}

.splitter {
    flex: 0 0 6px;
    cursor: col-resize;
    position: relative;
    background: transparent;
    touch-action: none
}

.splitter:after {
    content: "";
    position: absolute;
    inset: 8px 2px;
    border-radius: var(--radius-pill);
    background: var(--border);
    transition: background .15s var(--ease)
}

.splitter:hover:after,
.splitter.is-dragging:after {
    background: var(--brand)
}

.stage {
    position: relative;
    flex: 1;
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    touch-action: none;
    cursor: grab
}

.stage.is-grabbing {
    cursor: grabbing
}

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

.stage-tools {
    position: absolute;
    right: 10px;
    bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none
}

.zoom-cluster {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    pointer-events: auto
}

.zoom-btn,
.zoom-level {
    border: 0;
    background: transparent;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    min-height: 32px;
    min-width: 34px;
    font-size: 15px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .12s var(--ease), color .12s var(--ease)
}

.zoom-level {
    font-size: 11.5px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text)
}

.zoom-btn:hover,
.zoom-level:hover {
    background: var(--surface-2);
    color: var(--text)
}

.zoom-btn[aria-pressed=false] {
    opacity: .45
}

.zoom-divider {
    height: 1px;
    background: var(--border);
    margin: 2px 3px
}

.stage-hint {
    position: absolute;
    left: 12px;
    bottom: 12px;
    margin: 0;
    font-size: 11.5px;
    color: var(--text-faint);
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 4px 9px;
    border-radius: var(--radius-pill);
    pointer-events: none;
    transition: opacity .4s var(--ease)
}

.stage-hint.is-hidden {
    opacity: 0
}

.actionbar {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: var(--actionbar-h);
    padding: 8px 12px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    z-index: 20
}

.run-controls {
    display: flex;
    align-items: center;
    gap: 6px
}

.speed-control {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 1 240px;
    min-width: 130px
}

.speed-icon {
    font-size: 15px;
    line-height: 1;
    opacity: .75
}

.statusline {
    margin-left: auto;
    color: var(--text-faint);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap
}

input[type=range] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 22px;
    background: transparent;
    cursor: pointer
}

input[type=range]::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: var(--radius-pill);
    background: var(--surface-sunken)
}

input[type=range]::-moz-range-track {
    height: 6px;
    border-radius: var(--radius-pill);
    background: var(--surface-sunken)
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    margin-top: -6px;
    border-radius: 50%;
    background: var(--brand);
    border: 2px solid var(--surface);
    box-shadow: var(--shadow-sm)
}

input[type=range]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--brand);
    border: 2px solid var(--surface);
    box-shadow: var(--shadow-sm)
}

.modal {
    border: 0;
    padding: 0;
    background: transparent;
    max-width: min(680px, 94vw);
    width: 100%;
    max-height: 88dvh;
    color: var(--text)
}

.modal::backdrop {
    background: #0a0e148c;
    backdrop-filter: blur(3px)
}

.modal-inner {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-height: 88dvh;
    overflow: hidden
}

.modal-head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border)
}

.modal-head h2 {
    margin: 0;
    font-size: 19px;
    font-weight: 750
}

.modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 16px 18px 20px
}

.modal-sub {
    margin: 0 0 14px;
    color: var(--text-muted);
    font-size: 13px
}

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

.example-card {
    display: flex;
    gap: 11px;
    align-items: flex-start;
    text-align: left;
    padding: 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
    cursor: pointer;
    transition: border-color .15s var(--ease), transform .1s var(--ease), box-shadow .15s var(--ease)
}

.example-card:hover {
    border-color: var(--brand);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px)
}

.example-emoji {
    font-size: 24px;
    line-height: 1.1
}

.example-card strong {
    display: block;
    font-size: 14px;
    font-weight: 700
}

.example-card small {
    display: block;
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 3px;
    line-height: 1.4
}

.code-view {
    margin: 0;
    padding: 14px;
    background: var(--surface-sunken);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: 16px;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre;
    tab-size: 2
}

.help-body section+section {
    margin-top: 20px
}

.help-body h3 {
    margin: 0 0 8px;
    font-size: 14px;
    font-weight: 700;
    color: var(--brand-strong)
}

.help-body ul {
    margin: 0;
    padding-left: 20px;
    color: var(--text-muted)
}

.help-body li {
    margin-bottom: 5px
}

.help-body p {
    margin: 0;
    color: var(--text-muted)
}

.help-body a {
    color: var(--brand-strong)
}

.creditos {
    margin-top: 12px !important;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    line-height: 1.5
}

.shortcuts {
    list-style: none;
    padding: 0;
    display: grid;
    gap: 6px
}

.shortcuts li {
    display: flex;
    align-items: center;
    gap: 8px
}

.shortcuts span {
    color: var(--text-muted)
}

kbd {
    display: inline-block;
    min-width: 22px;
    text-align: center;
    padding: 2px 6px;
    font-family: var(--font);
    font-size: 11.5px;
    font-weight: 650;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    border-bottom-width: 2px;
    border-radius: 6px
}

.toast-stack {
    position: fixed;
    left: 50%;
    bottom: calc(var(--actionbar-h) + 16px + env(safe-area-inset-bottom));
    transform: translate(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    z-index: 200;
    pointer-events: none;
    width: min(460px, calc(100vw - 24px))
}

.toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 11px 15px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    font-size: 16px;
    animation: toast-in .22s var(--ease);
    max-width: 100%
}

.toast.is-error {
    border-color: var(--accent-red);
    background: color-mix(in srgb, var(--accent-red) 8%, var(--surface))
}

.toast.is-success {
    border-color: var(--accent-green);
    background: color-mix(in srgb, var(--accent-green) 8%, var(--surface))
}

.toast-icon {
    line-height: 1.35
}

@keyframes toast-in {
    0% {
        opacity: 0;
        transform: translateY(10px) scale(.97)
    }
}

@media(max-width:899px) {
    .workbench {
        display: block;
        position: relative
    }

    .panel {
        position: absolute;
        inset: 0;
        display: none
    }

    .panel.is-active {
        display: block
    }

    .panel-stage {
        display: none;
        padding: 6px
    }

    .panel-stage.is-active {
        display: flex
    }

    .splitter,
    .btn-label {
        display: none
    }

    .btn-primary .btn-label {
        display: inline
    }

    .btn {
        min-height: var(--tap);
        min-width: var(--tap);
        padding: 0 10px
    }

    .btn-primary {
        min-width: 118px
    }

    .topbar-actions .btn-ghost {
        min-width: var(--tap);
        padding: 0
    }

    .topbar-sep {
        display: none
    }

    .actionbar {
        gap: 10px;
        padding: 8px 10px
    }

    .statusline {
        display: none
    }

    .speed-control {
        flex: 1 1 auto;
        min-width: 90px
    }

    .stage-hint {
        display: none
    }
}

@media(min-width:900px) {
    .viewswitch {
        display: none
    }
}

@media(max-width:619px) {
    .topbar-actions {
        display: none
    }

    .dropdown-more {
        display: block;
        margin-left: auto
    }

    .brand-logo--full {
        display: none
    }

    .brand-logo--mark {
        display: block
    }

    #btn-clear {
        display: none
    }

    .modal-head {
        padding: 12px 14px
    }

    .modal-body {
        padding: 14px
    }

    .example-grid {
        grid-template-columns: 1fr
    }
}

@media(max-width:420px) {
    .speed-icon {
        display: none
    }

    .viewswitch-btn {
        padding: 7px 12px
    }
}

@media(prefers-reduced-motion:reduce) {

    *,
    *:before,
    *:after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important
    }
}

.injectionDiv {
    border-radius: var(--radius-lg);
    overflow: hidden
}

.blocklyToolbox {
    padding: 8px 6px !important;
    overflow-x: hidden
}

.blocklyToolboxCategoryGroup {
    display: flex;
    flex-direction: column;
    gap: 2px
}

.blocklyToolboxCategory {
    display: flex !important;
    align-items: center;
    min-height: 38px;
    border-radius: var(--radius) !important;
    padding: 0 10px 0 0 !important;
    transition: background .12s var(--ease)
}

.blocklyToolboxCategoryContainer:hover .blocklyToolboxCategory {
    background: #ffffff17
}

.blocklyToolboxCategoryContainer[aria-selected=true] .blocklyToolboxCategory {
    background: #ffffff29
}

.blocklyTreeRowContentContainer {
    display: flex;
    align-items: center;
    flex: 1;
    padding-left: 10px;
    line-height: 1.2
}

.blocklyToolboxCategoryLabel {
    font-family: var(--font) !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    letter-spacing: .1px;
    line-height: 1
}

.blocklyToolboxCategoryIcon {
    display: none !important
}

.blocklyTreeSeparator {
    border-bottom: 1px solid rgb(255 255 255 / .14) !important;
    margin: 8px !important;
    height: 0 !important;
    padding: 0 !important
}

.blocklyFlyout {
    filter: drop-shadow(0 6px 18px rgb(16 24 40 / .16))
}

.blocklyTooltipDiv {
    background: var(--surface) !important;
    color: var(--text) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-sm) !important;
    box-shadow: var(--shadow-md);
    font-family: var(--font) !important;
    font-size: 16px !important;
    opacity: 1 !important;
    padding: 7px 10px !important;
    max-width: 280px
}

.blocklyWidgetDiv .blocklyMenu,
.blocklyDropDownDiv {
    border-radius: var(--radius) !important;
    border-color: var(--border) !important;
    box-shadow: var(--shadow-lg) !important;
    font-family: var(--font) !important
}

.blocklyMenuItemContent {
    font-family: var(--font) !important
}

@media(max-width:899px) {
    .blocklyToolboxCategory {
        min-height: var(--tap)
    }

    .blocklyToolboxCategoryLabel {
        font-size: 16px !important
    }

    .blocklyZoom {
        display: none
    }
}