* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ========================================
   Z-PLANE ARCHITECTURE
   ========================================
   All z-index values are managed via z-planes in render.rs.
   Each z-plane is a transparent container (pointer-events: none)
   with child widgets having pointer-events: auto.

   Z-plane order (lowest to highest):
   0:   Copy source stacks (bottom)
   100: Boxes/containers
   200: Values (numbers, text)
   300: Agents (robot, bird, nest, scales)
   400: Tools (vacuum, wand)
   500: Tooltips
   600: Help panel backdrop
   650: Help panel content
   1000: Dragging widgets (temporary elevation)
   ======================================== */
:root {
    /* Legacy CSS vars - kept for components not yet on z-planes */
    --z-copy-source-behind: 1;
    --z-containers: 10;
    --z-values: 20;
    --z-comparison: 30;
    --z-agents: 40;
    --z-tools: 50;
    --z-tooltip-hover: 100;
    --z-dragging: 1000;
    --z-help-backdrop: 600;
    --z-help-panel: 650;
}

html, body {
    width: 100%;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: #87CEEB;
}

.workspace {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.workspace-header {
    background-color: #4a90d9;
    color: white;
    padding: 0.5rem 1rem;
    font-size: 1.2rem;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.header-title {
    flex: 1;
}

/* User Level Selector */
.user-level-selector {
    margin-right: 3rem; /* Space for help button */
}

.user-level-selector select {
    padding: 0.25rem 0.5rem;
    font-size: 0.9rem;
    font-weight: bold;
    border: 2px solid white;
    border-radius: 4px;
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    outline: none;
}

.user-level-selector select:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.user-level-selector select:focus {
    background-color: rgba(255, 255, 255, 0.4);
}

.user-level-selector select option {
    background-color: #4a90d9;
    color: white;
}

.workspace-content {
    width: 100%;
    height: calc(100% - 2.5rem - 2rem);
    position: relative;
}

/* Copy source stacks - behind all draggable widgets */
.copy-source-stack {
    z-index: var(--z-copy-source-behind);
}

/* Draggable wrapper - base z-index set per widget type */
.draggable {
    cursor: grab;
}

.draggable:active {
    cursor: grabbing;
    z-index: var(--z-dragging);
}

.draggable.dragging {
    cursor: grabbing;
    z-index: var(--z-dragging);
    pointer-events: none;
    opacity: 0.8;
}

/* Widget type z-index hierarchy */
.draggable:has(.widget.box) { z-index: var(--z-containers); }
.draggable:has(.widget.number),
.draggable:has(.widget.text) { z-index: var(--z-values); }
.draggable:has(.widget.scales) { z-index: var(--z-comparison); }
.draggable:has(.widget.robot),
.draggable:has(.widget.nest),
.draggable:has(.widget.bird) { z-index: var(--z-agents); }
.draggable:has(.widget.vacuum),
.draggable:has(.widget.wand),
.draggable:has(.widget.magnifier),
.draggable:has(.widget.sensor) { z-index: var(--z-tools); }

/* Base widget styles */
.widget {
    border-radius: 8px;
    box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.2);
    cursor: grab;
    user-select: none;
    transition: transform 0.1s, box-shadow 0.1s;
}

.widget:hover {
    transform: translateY(-2px);
    box-shadow: 3px 3px 12px rgba(0, 0, 0, 0.3);
}

.widget:active {
    cursor: grabbing;
    transform: scale(1.05);
}

/* Number widget */
.widget.number {
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #fff9c4 0%, #fff59d 100%);
    border: 2px solid #f9a825;
    padding: 0.5rem 1rem;
    min-width: 60px;
}

/* Plain number value - just shows the number */
.number-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
    font-family: "Courier New", monospace;
    text-align: center;
    width: 100%;
}

/* Tool widget styling - distinct from plain numbers */
.widget.number.tool {
    background: linear-gradient(135deg, #ffecb3 0%, #ffe082 100%);
    border: 2px solid #ff8f00;
}

/* Tool content - shows operator and value */
.tool-content {
    display: flex;
    align-items: center;
    justify-content: center;
}

.tool-operator {
    font-size: 1.3rem;
    font-weight: bold;
    color: #e65100;
    margin-right: 0.25rem;
}

.tool-value {
    font-size: 1.3rem;
    font-weight: bold;
    color: #333;
    font-family: "Courier New", monospace;
}

/* Copy source stack effect - shows multiple copies behind using box-shadow */
.widget.number.copy-source {
    position: relative;
    /* Stack effect: multiple layers behind to show "infinite copies" */
    box-shadow:
        /* First layer - darkest */
        5px 5px 0 0 #fff59d,
        5px 5px 0 2px #c68400,
        /* Second layer - medium */
        10px 10px 0 0 #fff9c4,
        10px 10px 0 2px #c68400,
        /* Third layer - lightest */
        15px 15px 0 0 #fffde7,
        15px 15px 0 2px #c68400;
}

/* Text widget */
.widget.text {
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border: 2px solid #4caf50;
    padding: 0.5rem 1rem;
    min-width: 60px;
}

.text-value {
    font-size: 1.2rem;
    font-weight: bold;
    color: #2e7d32;
    font-family: Georgia, serif;
    font-style: italic;
}

/* Box widget */
.widget.box {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border: 3px solid #1976d2;
    padding: 0.5rem;
    min-width: 80px;
}

.widget.box.erased {
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
    border: 2px dashed #9e9e9e;
}

.box-holes {
    display: flex;
    gap: 4px;
}

.box-hole {
    min-width: 40px;
    min-height: 40px;
    background: linear-gradient(135deg, #ffffff 0%, #f5f5f5 100%);
    border: 2px solid #64b5f6;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hole-empty {
    color: #bdbdbd;
}

/* Widgets inside box holes - smaller display */
.widget.in-hole {
    transform: scale(0.7);
    box-shadow: none;
    margin: 0;
    padding: 0.25rem 0.5rem;
}

.widget.in-hole:hover {
    transform: scale(0.7);
    box-shadow: none;
}

/* When dragging is happening, highlight all empty box holes as valid targets */
body.dragging-active .box-hole {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-color: #1976d2;
    border-style: dashed;
    animation: pulse-border 1s ease-in-out infinite;
}

@keyframes pulse-border {
    0%, 100% { border-color: #1976d2; }
    50% { border-color: #64b5f6; }
}

/* Stronger highlight when directly over a drop target during drag */
body.dragging-active .box-hole.drop-target {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border-color: #4caf50;
    border-style: solid;
    border-width: 3px;
    animation: none;
}

/* Normal hover state when not dragging */
.box-hole:hover {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-color: #1976d2;
    border-width: 3px;
}

/* Number widget highlighting during drag - show as valid arithmetic target */
body.dragging-active .widget.number {
    border-style: dashed;
    border-color: #ff9800;
    animation: pulse-number-border 1s ease-in-out infinite;
}

@keyframes pulse-number-border {
    0%, 100% { border-color: #ff9800; box-shadow: 2px 2px 8px rgba(255, 152, 0, 0.3); }
    50% { border-color: #ffc107; box-shadow: 3px 3px 12px rgba(255, 193, 7, 0.5); }
}

.box-erased {
    font-size: 1.5rem;
    font-weight: bold;
    color: #757575;
    padding: 0.5rem 1rem;
}

/* Status Bar */
.status-bar {
    position: fixed;
    bottom: 2.5rem;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 800;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.status-bar.status-error {
    background-color: #ffebee;
    border: 2px solid #f44336;
    color: #c62828;
}

.status-icon {
    font-size: 1.2rem;
}

.status-message {
    max-width: 500px;
}

/* Inspection Modal */
.inspection-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.inspection-modal {
    background: #ffffff;
    border-radius: 12px;
    padding: 1.5rem;
    max-width: 400px;
    min-width: 300px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.inspection-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e0e0e0;
}

.inspection-modal-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #1565c0;
    margin: 0;
}

.inspection-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #757575;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}

.inspection-modal-close:hover {
    color: #424242;
}

.inspection-modal-content {
    white-space: pre-wrap;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
    font-size: 0.9rem;
    color: #424242;
    line-height: 1.5;
    background: #f5f5f5;
    padding: 1rem;
    border-radius: 8px;
    max-height: 300px;
    overflow-y: auto;
}

/* Footer */
.app-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #4a90d9;
    color: white;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    text-align: center;
}

.app-footer a {
    color: #fff9c4;
    text-decoration: none;
}

.app-footer a:hover {
    text-decoration: underline;
}

/* Scales widget */
.widget.scales {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0.25rem;
    position: relative;
    width: 80px;
    height: 80px;
}

.widget.scales:hover {
    transform: none;
    box-shadow: none;
}

.scales-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.scales-pans {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    pointer-events: none;
}

.scales-pan {
    width: 50%;
    height: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 25px;
    pointer-events: auto;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.scales-pan:hover {
    background-color: rgba(255, 193, 7, 0.3);
}

.scales-pan.left {
    /* Left half of scales */
}

.scales-pan.right {
    /* Right half of scales */
}

.pan-value {
    font-size: 0.9rem;
    font-weight: bold;
    color: #333;
    font-family: "Courier New", monospace;
    text-shadow: 1px 1px 2px white;
}

/* Tilted scales - visual only, drop zones stay the same */
.widget.scales.left-heavy .scales-pan.left {
    /* Left pan is lower when left-heavy */
}

.widget.scales.left-heavy .scales-pan.right {
    /* Right pan is higher when left-heavy */
}

.widget.scales.right-heavy .scales-pan.left {
    /* Left pan is higher when right-heavy */
}

.widget.scales.right-heavy .scales-pan.right {
    /* Right pan is lower when right-heavy */
}

/* Wobbling scales animation - used when scales are indeterminate (missing values) */
.widget.scales.wobbling {
    animation: wobble-scales 0.8s ease-in-out infinite;
    transform-origin: center top;
}

.widget.scales.wobbling .scales-image {
    animation: wobble-image 0.8s ease-in-out infinite;
    transform-origin: center 30%;
}

@keyframes wobble-scales {
    0%, 100% { transform: rotate(-2deg); }
    50% { transform: rotate(2deg); }
}

@keyframes wobble-image {
    0%, 100% { transform: rotate(-3deg); }
    50% { transform: rotate(3deg); }
}

/* Vacuum tool widget */
.widget.vacuum {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0.25rem;
    width: 80px;
    height: 80px;
}

.widget.vacuum:hover {
    transform: scale(1.1);
    box-shadow: none;
}

.vacuum-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Highlight numbers when vacuum is being dragged over them */
body.dragging-active .widget.number:not(.copy-source) {
    border-style: dashed;
}

/* Erased number display */
.widget.number .number-value:empty::after {
    content: "?";
    color: #999;
}

/* Wand (magic wand) tool widget */
.widget.wand {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0.25rem;
    width: 80px;
    height: 80px;
}

.widget.wand:hover {
    transform: scale(1.1);
    box-shadow: none;
}

.wand-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Magnifier (inspection) tool widget */
.widget.magnifier {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0.25rem;
    width: 80px;
    height: 80px;
}

.widget.magnifier:hover {
    transform: scale(1.1);
    box-shadow: none;
}

.magnifier-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Sensor widget */
.widget.sensor {
    background: #FFF8E7;
    border: 2px solid #D4A574;
    border-radius: 8px;
    padding: 0.25rem;
    width: 80px;
    height: 80px;
}

.widget.sensor:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.sensor-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Copy source stack effect for sensor */
.widget.sensor.copy-source {
    position: relative;
}

.widget.sensor.copy-source::before,
.widget.sensor.copy-source::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 2px solid #D4A574;
    border-radius: 8px;
    background: #FFF8E7;
    z-index: -1;
}

.widget.sensor.copy-source::before {
    transform: translate(8px, 8px);
    opacity: 0.5;
}

.widget.sensor.copy-source::after {
    transform: translate(4px, 4px);
    opacity: 0.7;
}

/* Sensor in box hole */
.widget.sensor.in-hole {
    width: 40px;
    height: 40px;
    font-size: 0.6rem;
}

/* Robot widget */
.widget.robot {
    background: linear-gradient(135deg, #e1bee7 0%, #ce93d8 100%);
    border: 3px solid #7b1fa2;
    border-radius: 12px;
    padding: 0.5rem;
    min-width: 80px;
    min-height: 100px;
}

.widget.robot:hover {
    border-color: #9c27b0;
}

.widget.robot.training {
    background: linear-gradient(135deg, #ffecb3 0%, #ffe082 100%);
    border-color: #ff8f00;
    animation: pulse-training 1.5s ease-in-out infinite;
}

.widget.robot.working {
    background: linear-gradient(135deg, #c8e6c9 0%, #a5d6a7 100%);
    border-color: #388e3c;
    animation: pulse-working 0.5s ease-in-out infinite;
}

@keyframes pulse-training {
    0%, 100% { box-shadow: 0 0 5px rgba(255, 143, 0, 0.5); }
    50% { box-shadow: 0 0 15px rgba(255, 143, 0, 0.8); }
}

@keyframes pulse-working {
    0%, 100% { box-shadow: 0 0 5px rgba(56, 142, 60, 0.5); }
    50% { box-shadow: 0 0 10px rgba(56, 142, 60, 0.8); }
}

.robot-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.robot-head {
    display: flex;
    gap: 8px;
    padding: 4px 8px;
    background: linear-gradient(135deg, #f3e5f5 0%, #e1bee7 100%);
    border-radius: 8px;
    border: 2px solid #9c27b0;
}

.robot-eye {
    width: 12px;
    height: 12px;
    background: #333;
    border-radius: 50%;
    position: relative;
}

.robot-eye::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 4px;
    height: 4px;
    background: white;
    border-radius: 50%;
}

/* Robot eyes glow when training */
.widget.robot.training .robot-eye {
    background: #ff9800;
    box-shadow: 0 0 5px #ff9800;
}

/* Robot eyes glow green when working */
.widget.robot.working .robot-eye {
    background: #4caf50;
    box-shadow: 0 0 5px #4caf50;
}

.robot-torso {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.robot-status {
    font-size: 0.75rem;
    font-weight: bold;
    color: #4a148c;
}

.robot-actions {
    font-size: 0.65rem;
    color: #7b1fa2;
}

.robot-actions-container {
    position: relative;
}

.robot-training-popup {
    display: none;
    position: absolute;
    left: 100%;
    top: -20px;
    margin-left: 10px;
    background: #fff8e1;
    border: 2px solid #ff8f00;
    border-radius: 8px;
    padding: 8px 12px;
    min-width: 180px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 100;
    white-space: nowrap;
}

.robot-actions-container:hover .robot-training-popup {
    display: block;
}

.robot-training-popup .popup-title {
    font-weight: bold;
    font-size: 0.8rem;
    color: #e65100;
    margin-bottom: 4px;
    border-bottom: 1px solid #ffcc80;
    padding-bottom: 4px;
}

.robot-training-popup .popup-step {
    font-size: 0.75rem;
    color: #5d4037;
    padding: 2px 0;
}

/* Robot in box hole */
.widget.robot.in-hole {
    min-width: 30px;
    min-height: 40px;
    font-size: 0.6rem;
}

/* Robot image */
.robot-image {
    width: 50px;
    height: 50px;
    object-fit: contain;
}

.robot-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

/* ========================================
   TOOLTIP COMPONENT
   ======================================== */

.tooltip-wrapper {
    position: relative;
    display: inline-block;
}

/* Elevate entire widget and wrapper when tooltip is visible to escape parent stacking context */
.tooltip-wrapper:hover {
    z-index: var(--z-tooltip-hover);
}

/* Also elevate the draggable container when hovering to show tooltip above other widgets */
.draggable:has(.tooltip-wrapper:hover) {
    z-index: var(--z-tooltip-hover) !important;
}

/* Elevate copy source stacks when showing tooltip */
.copy-source-stack:has(.tooltip-wrapper:hover) {
    z-index: var(--z-tooltip-hover) !important;
}

.tooltip-content {
    position: absolute;
    min-width: 180px;
    max-width: 280px;
    padding: 0.75rem;
    background: linear-gradient(135deg, #2c3e50 0%, #1a252f 100%);
    color: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s, transform 0.2s;
    pointer-events: none;
}

.tooltip-content.visible {
    opacity: 1;
    visibility: visible;
}

/* Tooltip positions */
.tooltip-content.tooltip-bottom {
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(-5px);
}

.tooltip-content.tooltip-bottom.visible {
    transform: translateX(-50%) translateY(0);
}

.tooltip-content.tooltip-top {
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(5px);
}

.tooltip-content.tooltip-top.visible {
    transform: translateX(-50%) translateY(0);
}

.tooltip-content.tooltip-left {
    right: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%) translateX(5px);
}

.tooltip-content.tooltip-left.visible {
    transform: translateY(-50%) translateX(0);
}

.tooltip-content.tooltip-right {
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%) translateX(-5px);
}

.tooltip-content.tooltip-right.visible {
    transform: translateY(-50%) translateX(0);
}

.tooltip-title {
    font-weight: bold;
    font-size: 1rem;
    margin-bottom: 0.25rem;
    color: #fff;
}

.tooltip-description {
    font-size: 0.85rem;
    color: #bdc3c7;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.tooltip-hint {
    font-size: 0.8rem;
    color: #f1c40f;
    font-style: italic;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Tooltip layer content (rendered on z-plane 500) */
.tooltip-layer-content {
    min-width: 180px;
    max-width: 280px;
    padding: 0.75rem;
    background: linear-gradient(135deg, #2c3e50 0%, #1a252f 100%);
    color: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    pointer-events: none;
}

/* ========================================
   SLIDE PANEL COMPONENT
   ======================================== */

.slide-panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: var(--z-help-backdrop);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.slide-panel-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.slide-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 380px;
    max-width: 90vw;
    background: linear-gradient(180deg, #f8f9fa 0%, #e9ecef 100%);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.2);
    z-index: var(--z-help-panel);
    transform: translateX(100%);
    transition: transform 0.3s ease-out;
    display: flex;
    flex-direction: column;
}

.slide-panel.open {
    transform: translateX(0);
}

.slide-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #4a90d9 0%, #357abd 100%);
    color: white;
}

.slide-panel-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.slide-panel-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.slide-panel-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.slide-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

/* ========================================
   ACCORDION COMPONENT
   ======================================== */

.accordion {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.accordion-section {
    border-radius: 8px;
    overflow: hidden;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.accordion-header {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    border: none;
    cursor: pointer;
    text-align: left;
    font-size: 1rem;
    font-weight: 600;
    color: #2c3e50;
    transition: background-color 0.2s;
}

.accordion-header:hover {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.accordion-section.expanded .accordion-header {
    background: linear-gradient(135deg, #4a90d9 0%, #357abd 100%);
    color: white;
}

.accordion-icon {
    font-size: 0.75rem;
    transition: transform 0.2s;
}

.accordion-section.expanded .accordion-icon {
    transform: rotate(0deg);
}

.accordion-title {
    flex: 1;
}

.accordion-content {
    padding: 1rem;
    background: white;
    border-top: 1px solid #e9ecef;
    animation: accordion-expand 0.2s ease-out;
}

@keyframes accordion-expand {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   HELP PANEL CONTENT STYLES
   ======================================== */

.help-section {
    line-height: 1.6;
    color: #34495e;
}

.help-section h4 {
    color: #2c3e50;
    margin: 1rem 0 0.5rem 0;
    font-size: 0.95rem;
}

.help-section h4:first-child {
    margin-top: 0;
}

.help-section p {
    margin: 0.5rem 0;
}

.help-section ul,
.help-section ol {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.help-section li {
    margin: 0.25rem 0;
}

.help-section strong {
    color: #2c3e50;
}

.help-section a {
    color: #3498db;
    text-decoration: none;
}

.help-section a:hover {
    color: #2980b9;
    text-decoration: underline;
}

.help-tip {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeeba 100%);
    border-left: 4px solid #ffc107;
    padding: 0.75rem;
    margin: 0.75rem 0;
    border-radius: 0 4px 4px 0;
    font-style: italic;
}

/* ========================================
   HELP BUTTON
   ======================================== */

.help-button {
    position: fixed;
    top: 0.5rem;
    right: 1rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    font-size: 1.25rem;
    font-weight: bold;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: var(--z-tools);
    transition: transform 0.2s, box-shadow 0.2s;
}

.help-button:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.help-button:active {
    transform: scale(0.95);
}

/* ========================================
   NEST WIDGET
   ======================================== */

.widget.nest {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0.25rem;
    width: 70px;
    height: 80px;
    position: relative;
}

.widget.nest:hover {
    transform: scale(1.05);
    box-shadow: none;
}

.nest-svg,
.nest-img {
    width: 100%;
    height: 100%;
}

/* Copy source stack effect for nest */
.widget.nest.copy-source {
    position: relative;
}

.widget.nest.copy-source::before,
.widget.nest.copy-source::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 8px;
    z-index: var(--z-copy-source-behind);
}

.widget.nest.copy-source::before {
    transform: translate(8px, 8px);
    opacity: 0.5;
    background: #8B4513;
}

.widget.nest.copy-source::after {
    transform: translate(4px, 4px);
    opacity: 0.7;
    background: #8B4513;
}

/* Badge showing message count (shows +N when more than 1 message) */
.nest-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: #e53935;
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    z-index: 10;
}

/* Contents overlay - shows top message on the nest */
.nest-contents {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.5);
    pointer-events: none;
    z-index: 5;
}

/* Scale down the nested widget to fit on nest */
.nest-contents > .widget {
    transform-origin: center center;
}

/* Nest in box hole */
.widget.nest.in-hole {
    width: 35px;
    height: 40px;
    font-size: 0.7rem;
}

/* ========================================
   BIRD WIDGET
   ======================================== */

.widget.bird {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0.25rem;
    width: 70px;
    height: 80px;
}

.widget.bird:hover {
    transform: scale(1.05);
    box-shadow: none;
}

.bird-img {
    width: 100%;
    height: 100%;
}

/* Copy source stack effect for bird */
.widget.bird.copy-source {
    position: relative;
}

.widget.bird.copy-source::before,
.widget.bird.copy-source::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 8px;
    z-index: var(--z-copy-source-behind);
}

.widget.bird.copy-source::before {
    transform: translate(8px, 8px);
    opacity: 0.5;
    background: #63B3ED;
}

.widget.bird.copy-source::after {
    transform: translate(4px, 4px);
    opacity: 0.7;
    background: #63B3ED;
}

/* Bird in box hole */
.widget.bird.in-hole {
    width: 35px;
    height: 40px;
    font-size: 0.7rem;
}

/* ========================================
   WORKSPACE BUTTON & MENU
   ======================================== */

.workspace-button {
    padding: 0.25rem 0.75rem;
    font-size: 0.9rem;
    font-weight: bold;
    border: 2px solid white;
    border-radius: 4px;
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    outline: none;
    margin-right: 0.5rem;
    transition: background-color 0.2s;
}

.workspace-button:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.workspace-button:focus {
    background-color: rgba(255, 255, 255, 0.4);
}

/* ========================================
   TUTORIAL BUTTON & MENU
   ======================================== */

.tutorial-container {
    position: relative;
    margin-right: 0.5rem;
}

.tutorial-button {
    padding: 0.25rem 0.75rem;
    font-size: 0.9rem;
    font-weight: bold;
    border: 2px solid white;
    border-radius: 4px;
    background-color: transparent;
    color: white;
    cursor: pointer;
    outline: none;
    transition: background-color 0.2s;
}

.tutorial-button:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.tutorial-menu {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    background: white;
    border: 2px solid #4a90d9;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 700;
    min-width: 200px;
    padding: 0.5rem 0;
}

.tutorial-menu-header {
    padding: 0.5rem 1rem;
    font-weight: bold;
    color: #4a90d9;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 0.25rem;
}

.tutorial-submenu {
    margin: 0;
}

.tutorial-level-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: #333;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: background-color 0.15s;
}

.tutorial-level-btn:hover {
    background-color: #f0f4f8;
}

.tutorial-level-btn.expanded {
    background-color: #e8f0f8;
    color: #4a90d9;
}

.tutorial-level-btn .arrow {
    font-size: 0.8rem;
    color: #666;
}

.tutorial-items {
    display: flex;
    flex-direction: column;
    padding: 0.25rem 0;
    background-color: #f8f9fa;
}

.tutorial-items a {
    padding: 0.4rem 1.5rem;
    color: #4a90d9;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background-color 0.15s;
}

.tutorial-items a:hover {
    background-color: #e0e7ee;
}

.tutorial-items .coming-soon {
    padding: 0.4rem 1.5rem;
    color: #999;
    font-style: italic;
    font-size: 0.9rem;
}

/* Workspace list container */
.workspace-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Action buttons at top */
.workspace-actions {
    display: flex;
    gap: 0.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e9ecef;
}

.workspace-action-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.2s, transform 0.1s;
}

.workspace-action-btn.save-btn {
    background: linear-gradient(135deg, #4a90d9 0%, #357abd 100%);
    color: white;
}

.workspace-action-btn.save-btn:hover {
    background: linear-gradient(135deg, #5a9fe9 0%, #458acd 100%);
}

.workspace-action-btn.import-btn {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
    color: white;
}

.workspace-action-btn.import-btn:hover {
    background: linear-gradient(135deg, #7c858d 0%, #6a7278 100%);
}

/* Workspace sections */
.workspace-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.workspace-section-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e9ecef;
}

/* Individual workspace item */
.workspace-item {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.2s;
}

.workspace-item:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.workspace-item-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.workspace-icon {
    font-size: 1rem;
}

.workspace-name {
    font-weight: 600;
    color: #2c3e50;
    flex: 1;
}

.workspace-level {
    font-size: 0.8rem;
    color: #6c757d;
}

.workspace-description {
    font-size: 0.85rem;
    color: #5a6268;
    line-height: 1.4;
    margin-bottom: 0.5rem;
    /* Limit to 3 lines */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.workspace-meta {
    font-size: 0.75rem;
    color: #adb5bd;
    margin-bottom: 0.75rem;
}

.workspace-item-actions {
    display: flex;
    gap: 0.5rem;
}

.workspace-btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.workspace-btn.load-btn {
    background-color: #28a745;
    color: white;
}

.workspace-btn.load-btn:hover {
    background-color: #218838;
}

.workspace-btn.export-btn {
    background-color: #17a2b8;
    color: white;
}

.workspace-btn.export-btn:hover {
    background-color: #138496;
}

.workspace-btn.delete-btn {
    background-color: #dc3545;
    color: white;
}

.workspace-btn.delete-btn:hover {
    background-color: #c82333;
}

/* Tutorial puzzle list styles */
.workspace-section h4 {
    font-size: 1rem;
    font-weight: 600;
    color: #2c3e50;
    margin: 0 0 0.25rem 0;
}

.workspace-section .section-desc {
    font-size: 0.85rem;
    color: #6c757d;
    margin: 0 0 0.75rem 0;
}

.workspace-item-name {
    font-weight: 600;
    color: #2c3e50;
    flex: 1;
}

.workspace-item-difficulty {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    background: #e9ecef;
    color: #495057;
}

.workspace-item-desc {
    font-size: 0.85rem;
    color: #5a6268;
    margin: 0;
}

.workspace-item {
    cursor: pointer;
}

/* Empty state */
.workspace-empty {
    text-align: center;
    padding: 2rem;
    color: #6c757d;
}

.workspace-empty p {
    margin: 0.5rem 0;
}

/* Save form */
.save-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-label {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.9rem;
}

.form-input {
    padding: 0.75rem;
    font-size: 1rem;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    outline: none;
    transition: border-color 0.2s;
}

.form-input:focus {
    border-color: #4a90d9;
}

.form-textarea {
    padding: 0.75rem;
    font-size: 0.9rem;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    outline: none;
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-textarea:focus {
    border-color: #4a90d9;
}

.form-value {
    font-size: 0.9rem;
    color: #5a6268;
    font-style: italic;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
}

.form-btn {
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s, opacity 0.2s;
}

.form-btn.cancel-btn {
    background-color: #6c757d;
    color: white;
}

.form-btn.cancel-btn:hover {
    background-color: #5a6268;
}

.form-btn.save-btn {
    background: linear-gradient(135deg, #28a745 0%, #218838 100%);
    color: white;
}

.form-btn.save-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #34ce57 0%, #28a745 100%);
}

.form-btn.save-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========================================
   WORKSPACE TABS
   ======================================== */

.workspace-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1rem;
    border-bottom: 2px solid #e9ecef;
}

.workspace-tab {
    flex: 1;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: #6c757d;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s, background-color 0.2s;
    margin-bottom: -2px;
}

.workspace-tab:hover {
    color: #4a90d9;
    background-color: rgba(74, 144, 217, 0.05);
}

.workspace-tab.active {
    color: #4a90d9;
    border-bottom-color: #4a90d9;
}

.workspace-tab-content {
    padding: 0.5rem 0;
}

/* Workspace category (within tabs) */
.workspace-category {
    text-align: center;
    padding: 1rem;
}

.workspace-category-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.workspace-category-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: #2c3e50;
}

.category-icon {
    font-size: 1.5rem;
}

.workspace-category-desc {
    font-size: 0.9rem;
    color: #5a6268;
    margin-bottom: 1.5rem;
    line-height: 1.4;
}

/* Coming soon placeholder */
.workspace-coming-soon {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px dashed #ced4da;
    border-radius: 8px;
    padding: 2rem;
    margin-top: 1rem;
}

.coming-soon-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
}

.workspace-coming-soon p {
    margin: 0.5rem 0;
    color: #6c757d;
}

.workspace-coming-soon p:first-of-type {
    font-size: 1.1rem;
    font-weight: 600;
    color: #495057;
}

.coming-soon-hint {
    font-size: 0.85rem;
    font-style: italic;
}

/* ========================================
   TEXT PANE (Workspace Documentation)
   ======================================== */

.text-pane {
    background: linear-gradient(135deg, #fffef5 0%, #fff9e6 100%);
    border: 2px solid #e6c200;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 150px;
    min-height: 50px;
    pointer-events: auto;
}

.text-pane.collapsed {
    height: auto !important;
}

.text-pane.readonly {
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    border-color: #999;
}

.text-pane-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    background: linear-gradient(135deg, #ffd700 0%, #e6c200 100%);
    color: #333;
    cursor: move;
    user-select: none;
    flex-shrink: 0;
}

.text-pane.readonly .text-pane-header {
    background: linear-gradient(135deg, #999 0%, #777 100%);
    color: white;
}

.text-pane-title {
    font-weight: 600;
    font-size: 0.9rem;
}

.text-pane-controls {
    display: flex;
    gap: 0.25rem;
}

.text-pane-btn {
    background: rgba(255, 255, 255, 0.3);
    border: none;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: #333;
    transition: background-color 0.2s;
}

.text-pane.readonly .text-pane-btn {
    color: white;
}

.text-pane-btn:hover {
    background: rgba(255, 255, 255, 0.5);
}

.text-pane-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.text-pane-textarea {
    flex: 1;
    width: 100%;
    border: none;
    padding: 0.75rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 0.9rem;
    line-height: 1.5;
    resize: none;
    background: transparent;
    color: #333;
    outline: none;
    overflow-y: auto;
}

.text-pane-textarea::placeholder {
    color: #999;
    font-style: italic;
}

.text-pane.readonly .text-pane-textarea {
    color: #555;
    cursor: default;
}

.text-pane-resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 16px;
    height: 16px;
    cursor: se-resize;
    background: linear-gradient(
        135deg,
        transparent 50%,
        #e6c200 50%,
        #e6c200 60%,
        transparent 60%,
        transparent 70%,
        #e6c200 70%,
        #e6c200 80%,
        transparent 80%
    );
    border-radius: 0 0 6px 0;
}

.text-pane.readonly .text-pane-resize-handle {
    background: linear-gradient(
        135deg,
        transparent 50%,
        #777 50%,
        #777 60%,
        transparent 60%,
        transparent 70%,
        #777 70%,
        #777 80%,
        transparent 80%
    );
}

/* Ensure text pane can be positioned */
.text-pane {
    position: relative;
}

/* Action buttons container for tutorials */
.text-pane-actions {
    padding: 0.75rem;
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    border-top: 1px solid #e6c200;
    background: rgba(255, 255, 255, 0.5);
}

.action-btn {
    border: none;
    border-radius: 6px;
    padding: 0.5rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.show-me-btn {
    background: linear-gradient(135deg, #4caf50 0%, #388e3c 100%);
    color: white;
    box-shadow: 0 2px 6px rgba(76, 175, 80, 0.3);
}

.show-me-btn:hover {
    background: linear-gradient(135deg, #66bb6a 0%, #43a047 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

.show-me-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(76, 175, 80, 0.3);
}

.reset-btn {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    color: white;
    box-shadow: 0 2px 6px rgba(255, 152, 0, 0.3);
}

.reset-btn:hover {
    background: linear-gradient(135deg, #ffb74d 0%, #ff9800 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.4);
}

.reset-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(255, 152, 0, 0.3);
}

/* ========================================
   DROPZONE WIDGET (Puzzle Verification)
   ======================================== */

.widget.dropzone {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border: 3px dashed #1976d2;
    border-radius: 12px;
    padding: 1rem 1.5rem;
    min-width: 200px;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    transition: all 0.2s ease;
}

.widget.dropzone:hover {
    border-style: solid;
    background: linear-gradient(135deg, #bbdefb 0%, #90caf9 100%);
    box-shadow: 0 4px 16px rgba(25, 118, 210, 0.3);
}

/* Highlight dropzone when something is being dragged */
body.dragging-active .widget.dropzone {
    animation: pulse-dropzone 1s ease-in-out infinite;
    border-color: #4caf50;
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
}

@keyframes pulse-dropzone {
    0%, 100% {
        box-shadow: 0 0 8px rgba(76, 175, 80, 0.4);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 20px rgba(76, 175, 80, 0.6);
        transform: scale(1.02);
    }
}

.dropzone-label {
    font-size: 1rem;
    font-weight: 600;
    color: #1565c0;
    line-height: 1.4;
    max-width: 300px;
}

.dropzone-hint {
    font-size: 0.8rem;
    color: #64b5f6;
    margin-top: 0.5rem;
    font-style: italic;
}

/* Satisfied dropzone - correct answer dropped */
.widget.dropzone.satisfied {
    background: linear-gradient(135deg, #c8e6c9 0%, #a5d6a7 100%);
    border-color: #388e3c;
    border-style: solid;
}

.widget.dropzone.satisfied .dropzone-label {
    color: #2e7d32;
}

.dropzone-success {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

/* Error dropzone - wrong answer dropped */
.widget.dropzone.error {
    background: linear-gradient(135deg, #ffcdd2 0%, #ef9a9a 100%);
    border-color: #c62828;
    border-style: solid;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.widget.dropzone.error .dropzone-label {
    color: #c62828;
}

.dropzone-error {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: #c62828;
}

.dropzone-hint.error {
    color: #c62828;
    font-weight: bold;
}

/* Dropzone in box hole (smaller display) */
.widget.dropzone.in-hole {
    min-width: 40px;
    min-height: 40px;
    padding: 0.25rem;
    font-size: 0.6rem;
}

/* ========================================
   CONFIRMATION DIALOG
   ======================================== */

.confirm-dialog-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 700;
    animation: fadeIn 0.15s ease-out;
}

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

.confirm-dialog {
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    min-width: 320px;
    max-width: 450px;
    animation: slideIn 0.15s ease-out;
    overflow: hidden;
}

@keyframes slideIn {
    from { transform: scale(0.95) translateY(-10px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

.confirm-dialog-header {
    background: linear-gradient(135deg, #4a90d9 0%, #3a7cc0 100%);
    color: white;
    padding: 1rem 1.25rem;
}

.confirm-dialog-title {
    font-weight: 600;
    font-size: 1.1rem;
}

.confirm-dialog-body {
    padding: 1.5rem 1.25rem;
}

.confirm-dialog-message {
    font-size: 1rem;
    color: #333;
    line-height: 1.5;
}

.confirm-dialog-footer {
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    background: #f5f5f5;
    border-top: 1px solid #e0e0e0;
}

.confirm-dialog-btn {
    border: none;
    border-radius: 6px;
    padding: 0.6rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.confirm-dialog-btn.cancel-btn {
    background: #e0e0e0;
    color: #555;
}

.confirm-dialog-btn.cancel-btn:hover {
    background: #d0d0d0;
}

.confirm-dialog-btn.confirm-btn {
    background: linear-gradient(135deg, #4caf50 0%, #388e3c 100%);
    color: white;
    box-shadow: 0 2px 6px rgba(76, 175, 80, 0.3);
}

.confirm-dialog-btn.confirm-btn:hover {
    background: linear-gradient(135deg, #66bb6a 0%, #43a047 100%);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}
