body {
    margin: 0;
    padding: 0;
    background: #e6f0ff;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    color: #333;
}

h1 {
    color: #2a4365;
    text-align: center;
    margin: 20px 0;
    font-size: 2rem;
    font-weight: 600;
}

.blocklyToolbox {
    background-color: white;
    border-right: 2px solid #5481B7;
}

.blocklyMainBackground {
    stroke-width: 0;
}

.blocklyToolboxDiv {
    display: none !important;
}

.blocklyScrollbarHandle {
    visibility: hidden;
}

.blocklyFlyout {
    position: relative;
    fill: #f0f4ff;
    border-radius: 0;
}

.blocklyFlyoutBackground {
    fill: white;
}

.blocklyFlyout::after {
    content: "";
    position: absolute;
    top: 20%;
    bottom: 20%;
    right: 0;
    width: 2px;
    background-color: #5481B7;
    border-radius: 1px;
}

button {
    padding: 10px 24px;
    margin: 8px;
    border: none;
    border-radius: 8px;
    background-color: #2b6cb0;
    color: white;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 3px 6px rgba(0,0,0,0.1);
}

button:hover {
    background-color: #2c5282;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

button:active {
    transform: translateY(0);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

@media (max-width: 900px) {
    #mainContainer {
        flex-direction: column;
        padding: 10px;
    }

    #blocklyDiv,
    #text {
        height: 50vh;
    }
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #5481B7;
    color: white;
    padding: 0 20px;
    height: 80px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

header .logo img,
header img {
    height: 80px;
}

.left-logo img,
.right-logo img {
    height: 60px;
}

.header-center {
    display: flex;
    gap: 10px;
    height: 100%;
}

.header-center select {
    padding: 6px 10px;
    border: none;
    font-size: 14px;
}

.header-center button {
    background-color: #5481B7;
    color: white;
    font-weight: 500;
    cursor: pointer;
    height: 100%;
    border-radius: 0;
    box-shadow: none;
    transition: background-color 0.2s ease;
    margin: 0;
}

.header-center button:hover {
    background-color: #2b6cb0;
}

.workshopButton {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 12px;
    border: none;
    background-color: #5481B7;
    color: white;
    font-weight: 500;
    cursor: pointer;
    height: 100%;
    border-radius: 0;
    box-shadow: none;
    transition: background-color 0.2s ease;
    margin: 0;
}

.workshopButton:hover {
    background-color: #2b6cb0;
}

.header-center .icon {
    width: 18px;
    height: 18px;
    filter: brightness(0) invert(1);
}

#inputHeader {
    text-align: center;
    border: none;
    outline: none;
    box-shadow: none;
    color: white;
    margin: 20px 0;
    border-radius: 25px;
    background-color: #90baf6;
}

/* ----------------------------------------
   POPUP
---------------------------------------- */

.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.popup {
    background: white;
    padding: 20px 25px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    text-align: center;
    width: 300px;
}

.popup h2 {
    margin-top: 0;
    color: #5481B7;
}

.popup input {
    width: 90%;
    padding: 8px;
    margin-top: 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 15px;
}

.popup-buttons {
    margin-top: 15px;
    display: flex;
    justify-content: space-around;
}

.popup-buttons button {
    padding: 8px 14px;
    border: none;
    border-radius: 6px;
    background-color: #2b6cb0;
    color: white;
    cursor: pointer;
}

.popup-buttons button:hover {
    background-color: #2c5282;
}

#workspaceContainer {
    display: flex;
    align-items: stretch;
    margin: 12px 8px;
    height: 90vh;
}

#categoryWrapper {
    background-color: white;
    padding: 15px;
    border-radius: 12px 0 0 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    display: inline-block;
    position: relative;
}

#categoryWrapper::after {
    content: "";
    position: absolute;
    top: 5%;
    bottom: 5%;
    right: 0;
    width: 2px;
    background-color: #5481B7;
    border-radius: 1px;
}

#categoryButtons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.category-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 10px 14px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    color: white;
    font-weight: bold;
    font-size: 14px;
    width: 100px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.category-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.category-btn[data-category="events"] { background-color: #FF5733; }
.category-btn[data-category="movement"] { background-color: #33C1FF; }
.category-btn[data-category="toon"] { background-color: #9B59B6; }
.category-btn[data-category="sound"] { background-color: #F1C40F; }
.category-btn[data-category="functions"] { background-color: #1ABC9C; }
.category-btn[data-category="logic"] { background-color: #E67E22; }
.category-btn[data-category="text"] { background-color: #34495E; }
.category-btn[data-category="unsorted"] { background-color: #95A5A6; }

.category-icon {
    width: 36px;
    height: 36px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

#blocklyDiv {
    flex: 2;
    min-height: auto;
    position: relative;
    background-color: #fff;
}

#blocklyDiv::after {
    content: "";
    position: absolute;
    right: 0;
    top: 5%;
    bottom: 5%;
    width: 2px;
    background-color: #5481B7;
    border-radius: 1px;
}

#text {
    box-sizing: border-box;
    flex: 1;
    height: 90vh;
    min-height: auto;
    max-width: 400px;
    border: none;
    border-radius: 0 12px 12px 0;
    padding: 16px;
    font-family: "Fira Code", monospace;
    font-size: 18px;
    line-height: 1.5;
    resize: none;
    background-color: #fdfdfd;
    color: #2d3748;
}

#buttonDiv {
    position: absolute;
    bottom: 12px;
    left: 250px;
    display: flex;
    gap: 12px;
    z-index: 1000;
}

.runBtn,
.connectBtn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100px;
    height: 100px;
    border: none;
    border-radius: 50%;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transition: background 0.2s, transform 0.1s;
}

.runBtn {
    background-color: #28a745;
}

.runBtn:hover {
    background-color: #23963e;
}

.connectBtn {
    background-color: #888888;
}

.connectBtn:hover {
    background-color: #6b6b6b;
}

.runBtn:active,
.connectBtn:active {
    transform: scale(0.95);
}

.runBtn .icon,
.connectBtn .icon {
    width: 49px;
    height: 49px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}