/* Modern Body Styling with Blue-Purple Background */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #1a202c;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    overflow-y: auto;
}

/* Main Container with Blue-Purple Background */
.main-container {
    max-width: 95vw;
    width: 95vw;
    margin: 10px auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    padding: 20px;
    display: flex;
    gap: 20px;
    height: 95vh;
    max-height: 95vh;
    overflow: hidden;
}


/* Left Container for Control Panel */
.left-container {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    overflow: hidden;
    flex: 0 0 320px;
    min-width: 320px;
    max-width: 320px;
}

/* Right Container for Main Content */
.right-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-height: 100%;
}
h3.cp {
    margin: 0px min(1.5vw, 5px) auto min(1.5vw, 5px);
    padding: min(1vh, 5px) min(1vw, 5px);
    color: #2d3748;
    font-weight: 700;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Control Panel Styles */
.control-panel {
    background: transparent;
    border-radius: 0;
    padding: 20px;
    box-shadow: none;
    overflow-y: auto;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 15px;
    border: none;
}

.control-panel::-webkit-scrollbar {
    width: 6px;
}

.control-panel::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.control-panel::-webkit-scrollbar-thumb {
    background: #4299e1;
    border-radius: 3px;
}

/* Right Container */
.right-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
    overflow: hidden;
}

/* Tellspace Container */
.tellspace-container {
    flex: 1;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    overflow: auto;
    min-height: 0;
    max-height: 50vh;
    height: 50vh;
}

/* Wrapper2 Container */
.wrapper2-container {
    flex: 1;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    overflow: auto;
    min-height: 0;
    max-height: 40vh;
    height: 40vh;
    padding: 0;
    margin: 0;
}

/* Handle test mode - when wrapper2 is hidden */
.right-container:has(#wrapper2.hidden) {
    justify-content: center;
    align-items: center;
}

.right-container:has(#wrapper2.hidden) .tellspace-container {
    flex: none;
    height: 70vh;
    min-height: 500px;
    max-width: 100%;
}

/* Hide wrapper2 container in test mode */
.right-container:has(#wrapper2.hidden) .wrapper2-container {
    display: none;
}

/* SVG Icon Classes */
.w-6 { width: 24px; }
.h-6 { height: 24px; }
.w-7 { width: 28px; }
.h-7 { height: 28px; }

/* Instructions Modal - Updated with Reference Style */
.instructions-modal {
    display: none;
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.instructions-modal-content {
    background: white;
    margin: 2% auto;
    border-radius: 20px;
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
    animation: modalSlideIn 0.3s ease-out;
    position: relative;
}

/* Modal Header */
.modal-header {
    background: linear-gradient(135deg, #4299e1, #3182ce);
    color: white;
    padding: 24px 60px 24px 32px;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    position: relative;
    top: 0;
    z-index: 10;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-icon {
    background: rgba(255, 255, 255, 0.2);
    padding: 12px;
    border-radius: 50%;
}

.header-icon svg {
    width: 24px;
    height: 24px;
}

.header-text h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
}

.header-text p {
    margin: 4px 0 0 0;
    color: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
}

.modal-close {
    position: absolute;
    top: 16px !important;
    right: 16px !important;
    background: rgba(239, 68, 68, 0.2) !important;
    color: white !important;
    border: none !important;
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 10 !important;
}

.modal-close svg {
    width: 20px;
    height: 20px;
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.3);
    color: #fecaca;
}

/* Modal Body */
.modal-body {
    padding: 32px;
    max-height: calc(90vh - 100px);
    overflow-y: auto;
}

.instructions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 32px;
}

.instruction-card {
    background: linear-gradient(145deg, #ffffff, #f8fafc);
    border: 1px solid rgba(66, 153, 225, 0.08);
    border-radius: 16px;
    padding: 24px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.instruction-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(66, 153, 225, 0.1);
}

.instruction-card .instruction-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    font-size: inherit;
}

.instruction-card .instruction-icon svg {
    width: 24px;
    height: 24px;
}

.instruction-card .instruction-icon.blue {
    background: #dbeafe;
    color: #3182ce;
}

.instruction-card .instruction-icon.green {
    background: #d1fae5;
    color: #10b981;
}

.instruction-card .instruction-icon.orange {
    background: #fed7aa;
    color: #f59e0b;
}

.instruction-card .instruction-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #374151;
    margin: 0 0 16px 0;
}

.instruction-card .instruction-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.instruction-card .instruction-list li {
    padding: 8px 0;
    color: #6b7280;
    font-size: 1.05rem;
    line-height: 1.6;
    border-bottom: 1px solid rgba(66, 153, 225, 0.05);
}

.instruction-card .instruction-list li:last-child {
    border-bottom: none;
}

.instruction-card .instruction-list li strong {
    color: #374151;
    font-weight: 600;
}

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

/* Override old modal styles to ensure new styles take precedence */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.modal.hidden {
    display: none;
}



/* Mobile Warning */
.mobile-warning {
    display: none;
    text-align: center;
    font-size: 1.2rem;
    color: #e53e3e;
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    margin: 20px;
}

#instructionsBtn:hover {
    box-shadow: 0 4px 12px rgba(49, 130, 206, 0.3);
}

/* Update tellspace styles for new container */
#tellspace {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 20px;
    box-shadow: none;
    backdrop-filter: none;
    overflow-x: auto;
    overflow-y: hidden;
    height: 100%;
    width: 100%;
    margin: 0;
    box-sizing: border-box;
    max-width: 100%;
    max-height: 100%;
}

#displayspace {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    backdrop-filter: none;
    overflow: auto;
    height: 100%;
    width: 100%;
    margin: 0;
    box-sizing: border-box;
    max-width: 100%;
    max-height: 100%;
}

#wrapper2 {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    overflow: hidden;
}

#tellspace::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

#tellspace::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

#tellspace::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    border-radius: 4px;
}

#tellspace::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #3182ce 0%, #2c5282 100%);
}

#displayspace::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

#displayspace::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

#displayspace::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    border-radius: 3px;
}

#simspace {
    height: 100%;
    direction: ltr;
    opacity: 1;
    position: relative;
}

.slider-container {
    width: 100%;
    display: flex;
    flex-wrap: nowrap;
    flex-flow: row;
    justify-content: center;
    align-items: center;
    padding: min(1vh, 12px);
    margin: min(1vh, 8px);
    z-index: 2;
    background: transparent;
    border-radius: 10px;
    border: 1px solid rgba(226, 232, 240, 0.6);
    box-shadow: none;
    transition: all 0.3s ease;
}

.process-label {
    font-weight: bold;
    font-size: 1.2rem;
    color: #2d3748;
    margin-right: 10px;
    padding: 5px 8px;
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    color: white;
    border-radius: 6px;
    min-width: 35px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.d-value-display {
    font-size: 0.9rem;
    color: #4a5568;
    margin-right: 10px;
    padding: 3px 6px;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-weight: 500;
    min-width: 45px;
    text-align: center;
}

.floating-event-label {
    position: absolute;
    top: -28px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(59, 130, 246, 0.98);
    color: white;
    padding: 3px 6px;
    border-radius: 5px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
    height: auto;
    min-height: 20px;
    white-space: nowrap;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
    pointer-events: none;
    min-width: 32px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.floating-event-label sub {
    font-size: 0.85em;
    vertical-align: sub;
}

.time-value-display {
    position: absolute;
    top: -28px;
    right: -38px;
    transform: none;
    background: rgba(34, 197, 94, 0.9);
    color: white;
    padding: 3px 6px;
    border-radius: 5px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
    pointer-events: none;
    min-width: 28px;
    text-align: center;
}

.time-value-display:hover {
    z-index: 1000;
}

.time-value-input {
    position: absolute;
    top: -28px;
    right: -38px;
    transform: none;
    background: rgba(255, 255, 255, 0.95);
    color: #2d3748;
    padding: 3px 6px;
    border-radius: 5px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    z-index: 15;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
    width: 38px;
    max-width: 38px;
    text-align: center;
    border: 1px solid rgba(34, 197, 94, 0.8);
    outline: none;
}

.time-value-input:hover,
.time-value-input:focus {
    background: rgba(255, 255, 255, 1);
    border-color: rgba(34, 197, 94, 1);
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
    z-index: 2000 !important;
}

.time-value-container:hover {
    z-index: 2000 !important;
}

.time-value-container:hover .time-value-input {
    z-index: 2000 !important;
}

.floating-event-label {
    position: absolute;
    top: -28px;
    left: -38px;
    transform: none;
    background: rgba(59, 130, 246, 0.98);
    color: white;
    padding: 3px 6px;
    border-radius: 5px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
    height: auto;
    min-height: 20px;
    white-space: nowrap;
    z-index: 5;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
    pointer-events: none;
    width: 38px;
    max-width: 38px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.event:hover .floating-event-label {
    z-index: 1500;
}

/* Ensure time value elements always come above floating labels when hovered */
.time-value-container:hover,
.time-value-container:hover * {
    z-index: 2000 !important;
}

.time-value-input::placeholder {
    color: rgba(107, 114, 128, 0.7);
}

.time-value-container {
    position: relative;
}

.time-value-container.correct .time-value-input {
    background: rgba(34, 197, 94, 0.9);
    color: white;
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.8);
    border-color: rgba(255, 255, 255, 0.8);
    z-index: 20;
}

.time-value-container.wrong .time-value-input {
    background: rgba(239, 68, 68, 0.9);
    color: white;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.8);
    border-color: rgba(255, 255, 255, 0.8);
    z-index: 20;
}

.correct-answer-display {
    position: absolute;
    bottom: -75px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(59, 130, 246, 0.95);
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 1.2rem;
    font-weight: 700;
    white-space: nowrap;
    z-index: 25;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
    min-width: 35px;
    text-align: center;
    display: none;
    border: 2px solid rgba(255, 255, 255, 0.4);
}

.time-value-container.wrong .correct-answer-display {
    display: block !important;
    z-index: 25 !important;
}

.correct-answer-display::before {
    content: "✓ ";
    color: #10b981;
    font-weight: bold;
}

.slider-container:hover {
    background: transparent;
    box-shadow: none;
    transform: none;
}

.increment {
    height: max(min(5vh, 1.5em), 25px);
    width: max(min(5vw, 3em), 50px);
    margin: 0 min(1vw,10px) 0 0;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
    color: #2d3748;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.increment:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1), 0 2px 8px rgba(0, 0, 0, 0.1);
}

#tellspace:has(~ #wrapper2.hidden) .increment {
    pointer-events: none;
    width: 35px;
    text-align: center;
}

.slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: max(min(3vh, 50px), 20px);
    border: 1 px sloid black;
    opacity: 1;
    margin: 3px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#tellspace:has(~ #wrapper2.hidden) .slider-bone:hover {
    opacity: 0.8;
    box-shadow: 0 0 6px rgba(156, 163, 175, 1);
}

.slider-bone:hover {
    opacity: 0.8;
    box-shadow: 0 0 6px rgba(59, 130, 246, 1);
}

.slider-bone {
    position: relative;
    width: 100%;
    height: max(min(1vh, 3px), 2px);
    background: linear-gradient(135deg, #1e40af 0%, #1d4ed8 100%);
    opacity: 1;
    position: relative;
    box-shadow: 0 0 2px rgba(30, 64, 175, 0.5);
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* Style for control sections in the left panel */
.control-panel .wrapperalike {
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    border-radius: 12px;
    padding: 15px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
}

.control-panel #testcontrols {
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    border-radius: 12px;
    padding: 15px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
}

.control-panel #antiwrapper {
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    border-radius: 12px;
    padding: 15px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
}

#displayspace {
    border: none;
    border-radius: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    background: transparent;
    overflow: scroll;
    box-shadow: none;
}

#wrapper2 {
    flex: 1;
    width: 100%;
    height: 100%;
}

/* Hide old buttonspace */
#buttonspace {
    display: none;
}

input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button
{
    -webkit-appearance: none;
    margin: 0;
}

input[type=number]
{
    -moz-appearance: textfield;
    appearance: textfield;
    height: 35px;
    width: 52px;
    font-size: 18px;
    line-height: 26px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    text-align: center;
    background: white;
    transition: all 0.2s ease;
}

input[type=number]:focus {
    outline: none;
    border-color: #3182ce;
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

/* Button Styles - Updated from ref/styles.css - FORCE CACHE REFRESH */
.btn, button {
    background: linear-gradient(135deg, #3182ce 0%, #2c5282 100%) !important;
    color: white !important;
    border: none !important;
    padding: 12px 14px !important;
    border-radius: 12px !important;
    font-size: 1.5rem !important;
    font-weight: 800 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    width: 100% !important;
    margin-bottom: 12px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    min-height: 50px !important;
    line-height: 1.2 !important;
}

.btn:hover, button:hover {
    transform: translateY(-3px) !important;
    box-shadow: 0 8px 20px rgba(49, 130, 206, 0.4) !important;
    filter: brightness(1.1) !important;
}

.btn:active, button:active {
    transform: translateY(0) !important;
    box-shadow: 0 2px 8px rgba(49, 130, 206, 0.3) !important;
}

.btn:disabled, button:disabled {
    background: #a0aec0;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6, #1e40af) !important;
    color: white !important;
}

.btn-secondary {
    background: linear-gradient(135deg, #10b981, #059669) !important;
    color: white !important;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626) !important;
    color: white !important;
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706) !important;
    color: white !important;
}

#add {
    background: linear-gradient(135deg, #10b981, #059669) !important;
}

#subtract {
    background: linear-gradient(135deg, #ef4444, #dc2626) !important;
}

#plus, #minus {
    background: linear-gradient(135deg, #3b82f6, #1e40af) !important;
    min-width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.6rem !important;
    font-weight: 800 !important;
    width: auto;
    margin: 6px;
}

#mode {
    background: linear-gradient(135deg, #3b82f6, #1e40af) !important;
}

#check {
    background: linear-gradient(135deg, #3b82f6, #1e40af) !important;
}

#ordergenerate {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed) !important;
}

.quantity-nav {
    display: inline-block;
    position: relative;
    height: 40px;
    width: 35px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    overflow: visible;
    border: 1px solid #e2e8f0;
    margin-left: 5px;
    vertical-align: top;
}

.quantity-button {
    position: absolute;
    cursor: pointer;
    border: 1px solid #e2e8f0;
    width: 33px;
    height: 18px;
    text-align: center;
    color: #4a5568;
    font-size: 16px;
    font-weight: 700;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    line-height: 18px;
    -webkit-transform: translateX(0);
    transform: translateX(0);
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -o-user-select: none;
    user-select: none;
    background: linear-gradient(135deg, #f8fafc 0%, #edf2f7 100%);
    transition: all 0.2s ease;
}

.quantity-button.quantity-up:hover {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    transform: translateX(0) scale(1.05);
}

.quantity-button.quantity-down:hover {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    transform: translateX(0) scale(1.05);
}

.quantity-button.quantity-up {
    top: 0;
    left: 0;
    height: 18px;
    border-bottom: 1px solid #e2e8f0;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.quantity-button.quantity-down {
    bottom: 0;
    left: 0;
    height: 18px;
    border-top: 1px solid #e2e8f0;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

.event {
    border-radius: 50%;
    border: 3px solid white;
    height: 15px;
    width: 15px;
    background: linear-gradient(135deg, #63b3ed 0%, #4299e1 100%);
    position: absolute;
    bottom: -6px;
    z-index: 3;
    box-shadow: 0 6px 15px rgba(66, 153, 225, 0.3);
    transition: all 0.3s ease;
}

.event.to {
    border-radius: 50%;
    height: 10px;
    width: 10px;
    transform: translate(2.5px, -2.5px);
}

.event:hover {
    box-shadow: 0 0 6px rgba(35, 173, 255, 1);
    transform: translateY(-2px);
}

#tellspace:has(~ #wrapper2.hidden) .event:hover {
    box-shadow: 0 0 6px rgba(10, 10, 10, 1);
}

.delete .event:hover {
    box-shadow: 0 0 6px rgba(255, 173, 35, 1);
}

#messagespace {
    width: 100%;
    height: 100%;
    position: absolute;
    z-index: 1;
}

.message {
    opacity: 1;
    stroke: #1e40af;
    stroke-width: 3px;
}

.message>line:hover {
    filter: drop-shadow(0 0 6px rgba(59, 130, 246, 1));
}

.delete .message>line:hover {
    filter: drop-shadow(0 0 6px rgba(239, 68, 68, 1));
}

.message-arrow {
    stroke-width: 2px;
    fill: #1e40af;
    stroke: #1a365d;
    filter: drop-shadow(1px 1px 3px rgba(30, 64, 175, 0.3));
}

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

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

input[type=checkbox].check-label {
    display: none;
}

label.check-label {
    display: inline-block;
    height: 100%;
    width: 100%;
    top: -6px;
}

.delete label.check-label {
    display: none;
}

.to > label.check-label {
    top: -12px;
}

.event-tip {
    display: none !important;
    visibility: hidden;
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    text-align: center;
    padding: 8px 12px;
    border-radius: 8px;
    z-index: -1;
    opacity: 0;
    bottom: 66px;
    flex-direction: row;
    width: fit-content;
    color: white;
    border: 2px solid #4299e1;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    transition: opacity 0.3s ease;
}

.event-tip:after {
    content: "";
    position: absolute;
    top: 92%;
    left: 50%;
    margin-left: -8px;
    border-width: 8px;
    border-style: solid;
    border-color: #2d3748 transparent transparent transparent;
}

.event-tip div {
    display: flex;
    flex-direction: row;
}

@property --correct-color {
    syntax: "<color>";
    inherits: false;
    initial-value: green;
}

@property --lcorrect-color {
    syntax: "<color>";
    inherits: false;
    initial-value: rgb(179, 222, 179);
}

@property --wrong-color {
    syntax: "<color>";
    inherits: false;
    initial-value: red;
}

@property --lwrong-color {
    syntax: "<color>";
    inherits: false;
    initial-value: rgb(225, 130, 130);
}

@property --suspense-color {
    syntax: "<color>";
    inherits: false;
    initial-value: white;
}

.separator {
    margin: 0px 2px;
    background-color: var(--suspense-color);
    color: var(--suspense-color);
    transition: all 0.5s ease;
}

.answerer {
    margin: 0px 0px 0px 4px;
}

div.flipper {
    display: none;
}

div.flipper.answered {
    display: flex;
    flex-direction: row;
}

span.answerer.wrong {
    text-decoration-line: underline;
    font-weight: bold;
}

.separator:has(~ span.answerer.correct) {
    color: var(--correct-color);
    background-color: var(--correct-color);
}

.separator:has(~ span.answerer.wrong) {
    color: var(--wrong-color);
    background-color: var(--wrong-color);
}

input[type=number].enquirer:has(~ div.flipper.answered) {
    font-weight: bolder;
    font-size: 1.1em;
}

input[type=number].enquirer:has(~ div.flipper.answered > .answerer.correct) {
    color: var(--correct-color);
    background-color: var(--lcorrect-color);
}

input[type=number].enquirer:has(~ div.flipper.answered > .answerer.wrong) {
    color: var(--wrong-color);
    background-color: var(--lwrong-color);
}

sub {
    vertical-align: sub;
    font-size: smaller;
}

input[type=checkbox].check-label:checked ~ .event-tip {
    display: none !important;
    visibility: hidden;
    -webkit-animation: none;
    animation: none;
    opacity: 0;
}

#cyclespace {
    display: block;
    position: fixed;
    z-index: 1;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgb(0,0,0);
    background-color: rgba(0,0,0,0.4);
}

#cyclespace.hidden {
    display: none;
}

#wrapper.hidden {
    display: none;
}

#wrapper2.hidden {
    display: none;
}

#testspace {
    display: flex;
    flex-direction: row;
}

#iscycle {
    position: relative;
    background-color: rgba(255, 0, 0, 0.4);
    color: white;
    box-shadow: 0 4px 10px 0 rgba(0,0,0,0.2),0 4px 20px 0 rgba(0,0,0,0.4);
    width: 70vw;
    margin: auto;
    padding: 0.5em 20px;
    font-size: 30px;
    -webkit-animation: fadeIn 0.75s;
    animation: fadeIn 0.75s;
    top: 30vh;
    display: flex;
    justify-content: center;
    text-align: center;
}



#causalspace {
    width: 100%;
    height: 100%;
    position: relative;
    background: transparent;
    display: block;
    margin: 0;
    padding: 0;
}

#causalspace rect {
    position: absolute;
    z-index: 0;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    fill: url(#noiseFilter);
}

#causalgroup circle {
    fill: #3182ce;
    z-index: 2;
    stroke: white;
    stroke-width: 2px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

#causalgroup text {
    fill: white;
    font-size: medium;
    font-weight: 600;
}

#causalgroup .subscript {
    font-size: smaller;
    fill: white;
}

#causalgroup line {
    stroke: #1e40af;
    stroke-width: 3px;
    z-index: 1;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

#generatespace {
    margin-top: 30px;
}

.header-border {
    margin: 0;
    border: 1px solid #e2e8f0;
    padding: 15px;
    border-radius: 12px;
    background: white;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);

    .heading {
        text-align: center;
        margin-top: -1.4em;
        font-weight: 600;
        font-size: 1.1em;
        color: #2d3748;
    }
   .heading > span {
        padding: 8px 12px;
        margin: 0 auto;
        background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
        color: white;
        box-shadow: 0 4px 12px rgba(66, 153, 225, 0.3);
        border-radius: 8px;
        font-size: 0.8em;
        display: inline-block;
    }
}

#generatespace h4 {
    font-weight: 600;
    font-size: 0.8rem;
    margin: 0 0 5px 0;
    color: #2d3748;
    text-align: center;
}

#params {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.aparam {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    margin: 0;
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    gap: 5px;
}

.aparam.aparam > label {
    width: 100%;
    text-align: center;
}

/* Style the input controls container */
.aparam .input-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
}

/* Make the generate button more prominent */
#ordergenerate {
    width: 90%;
    margin-top: 15px;
    margin-bottom: 15px;
    font-size: 1.4rem !important;
    font-weight: 800 !important;
    padding: 14px 16px !important;
    min-height: 55px !important;
}

.input-number {
    width: 35px;
    font-size: 1rem;
    vertical-align: top;
    text-align: center;
    outline: none;
    border: 1px solid #e2e8f0;
    border-radius: 0;
    background: white;
    transition: all 0.2s ease;
    border-left: none;
    border-right: none;
}

.input-number:focus {
    border-color: #3182ce;
    box-shadow: 0 0 0 2px rgba(49, 130, 206, 0.1);
}

.input-number,
.input-number-decrement,
.input-number-increment {
    height: 2.2em;
    user-select: none;
}

.input-number-decrement,
.input-number-increment {
    display: inline-block;
    width: 25px;
    line-height: 2.2em;
    height: 2.2em;
    background: linear-gradient(135deg, #f8fafc 0%, #edf2f7 100%);
    color: #2d3748;
    text-align: center;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid #e2e8f0;
    font-size: 0.9rem;
}

.input-number-increment:hover {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.input-number-decrement:hover {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.input-number-increment:active {
    background: linear-gradient(135deg, #059669, #047857);
}

.input-number-decrement:active {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
}

.input-number-decrement {
    border-right: none;
    border-radius: 4px 0 0 4px;
}

.input-number-increment {
    border-left: none;
    border-radius: 0 4px 4px 0;
}

.wrapperalike:not(:has(~ div #wrapper.hidden)) {
    display: none;
}

.wrapperalike {
    min-width: 200px;
    margin-bottom: 25px;
}

#eventadd, #processoradd {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    gap: 12px;
}

/* Show generate section in test mode (when wrapper2 is hidden) */
#antiwrapper {
    display: block;
}

/* Hide generate section in simulate mode (when wrapper2 is visible) */
.left-container:has(~ .right-container #wrapper2:not(.hidden)) #antiwrapper {
    display: none;
}

#speed:has(~ div #wrapper.hidden) {
    display: none;
}



.difficulty {
    display: table;
    margin: 0 auto;
    background: white;
    padding: 20px 20px 20px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    border: 1px solid #e2e8f0;
}

.gauge {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.5), 0 0 35px 5px rgba(66, 153, 225, 0.2);
    width: 150px;
    height: 75px;
    border-radius: 100px 100px 0 0;
    position: relative;
    overflow: hidden;
    -webkit-transform-style: flat;
    transform-style: flat;
    -webkit-transform: translateZ(0px);
    transform: translateZ(0px);
    border: 2px solid #e2e8f0;
}

.gauge-center {
    content: '';
    color: white;
    width: 60%;
    height: 60%;
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    border-radius: 100px 100px 0 0;
    position: absolute;
    box-shadow: 0 -13px 15px -10px rgba(0, 0, 0, 0.28);
    right: 21%;
    bottom: 0;
    text-align: center;
    border: 2px solid #4299e1;
}

.gauge-center .label {
    display: block;
    width: 100%;
    text-align: center;
    border: 0;
    font-size: 1.2em;
    opacity: 0.9;
    margin: 1.1em 0 0.3em 0;
    font-weight: 600;
}

.needle {
    width: 78px;
    height: 7px;
    background: linear-gradient(135deg, #3182ce 0%, #2c5282 100%);
    border-bottom-left-radius: 100%;
    border-bottom-right-radius: 5px;
    border-top-left-radius: 100%;
    border-top-right-radius: 5px;
    position: absolute;
    bottom: -5%;
    left: 0%;
    transform-origin: 100% 4px;
    box-shadow: 0 2px 8px rgba(49, 130, 206, 0.4);
    transform: rotate(15deg);
    transition: transform 1s ease;
}

.slice-colors .st {
    position: absolute;
    bottom: 0;
    width: 0px;
    height: 0;
    font-size: 0;
    top: 10%;
    left: 0%;
    background: transparent;
    border-top: 75px solid #000;
    border-left: 75px solid transparent;
    border-right: 75px solid transparent;
}

.slice-colors .st.slice-item:nth-child(1) {
    border-top-color: #10b981;
    transform-origin: bottom;
    transform: rotate(-70deg);
}
.slice-colors .st.slice-item:nth-child(3) {
    border-top-color: #f59e0b;
    transform-origin: bottom;
    transform: rotate(0deg);
}

.slice-colors .st.slice-item:nth-child(2) {
    border-top-color: #ef4444;
    transform: rotate(70deg);
    transform-origin: bottom;
}

#testspace {
    margin: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

#testspace h3.cp {
    margin: 0px 1% auto 1%;
    padding: 1% 1%;
    text-align: center;
}

input[type=number].enquirer {
    -moz-appearance: textfield;
    appearance: textfield;
    display: block;
    background-color: white;
    opacity: 0.9;
    margin: 0 10px;
    width: 25px;
    height: 25px;
    font-size: 0.9em;
    line-height: 1em;
    text-align: center;
    transition: all 0.5s ease;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
}

input[type=number].enquirer:focus {
    border-color: #3182ce;
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

#speed.clickable {
    box-shadow:
        0 0 5px 1px #f59e0b,
        0 0 5px 1px #3182ce,
        inset 0 0 60px #fbbf24;
    transition: all 0.5s ease;
}

#speed.clickable:hover {
    box-shadow:
        0 0 8px 3px #f59e0b,
        0 0 12px 3px #3182ce,
        inset 0 0 80px #f59e0b;
    transform: scale(1.05);
}


/* Responsive Design */

/* Large tablets and small desktops */
@media (max-width: 1200px) {
    .main-container {
        flex-direction: column;
        height: auto;
        max-height: none;
        overflow-y: auto;
        padding: 15px;
        gap: 15px;
    }
    
    .left-container {
        flex: 0 0 auto;
        min-width: 100%;
        max-width: 100%;
        width: 100%;
    }
    
    .control-panel {
        height: auto;
        flex-direction: row;
        flex-wrap: wrap;
        overflow: visible;
        gap: 15px;
        padding: 15px;
    }
    
    .control-panel > * {
        flex: 1 1 280px;
        min-width: 280px;
    }
    
    .control-panel .wrapperalike,
    .control-panel #testcontrols,
    .control-panel #antiwrapper {
        flex: 1 1 280px;
    }
    
    .right-container {
        width: 100%;
        min-height: auto;
    }
    
    .tellspace-container {
        height: 50vh;
        max-height: 50vh;
        min-height: 300px;
    }
    
    .wrapper2-container {
        height: 35vh;
        max-height: 35vh;
        min-height: 250px;
    }
    
    .right-container:has(#wrapper2.hidden) .tellspace-container {
        height: 60vh;
        min-height: 400px;
    }
    
    h3.cp {
        font-size: 1.1rem;
    }
}

/* Tablets */
@media (max-width: 992px) {
    body {
        overflow-y: auto;
        overflow-x: hidden;
    }
    
    .main-container {
        width: 98vw;
        max-width: 98vw;
        margin: 5px auto;
        padding: 12px;
        border-radius: 15px;
    }
    
    .control-panel > * {
        flex: 1 1 100%;
        min-width: 100%;
    }
    
    .control-panel .wrapperalike,
    .control-panel #testcontrols,
    .control-panel #antiwrapper {
        flex: 1 1 100%;
    }
    
    .btn, button {
        font-size: 1.2rem !important;
        padding: 10px 12px !important;
        min-height: 45px !important;
    }
    
    #plus, #minus {
        min-width: 45px;
        height: 45px;
        font-size: 1.4rem !important;
    }
    
    .tellspace-container {
        height: 45vh;
        max-height: 45vh;
        min-height: 280px;
    }
    
    .wrapper2-container {
        height: 30vh;
        max-height: 30vh;
        min-height: 200px;
    }
    
    .floating-event-label,
    .time-value-display,
    .time-value-input {
        font-size: 0.7rem;
        padding: 2px 5px;
        min-width: 32px;
        min-height: 18px;
        top: -24px;
    }
    
    .floating-event-label {
        left: -34px;
        width: 34px;
        max-width: 34px;
    }
    
    .time-value-input,
    .time-value-display {
        right: -34px;
        width: 34px;
        max-width: 34px;
    }
    
    .process-label {
        font-size: 1rem;
        padding: 4px 6px;
        min-width: 30px;
    }
    
    .increment {
        width: max(min(4vw, 2.5em), 40px);
        height: max(min(4vh, 1.3em), 22px);
        font-size: 1rem;
    }
    
    #testspace {
        flex-direction: column;
    }
    
    .difficulty {
        padding: 15px;
    }
    
    .gauge {
        width: 120px;
        height: 60px;
    }
    
    .needle {
        width: 62px;
        height: 6px;
    }
}

/* Small tablets and large phones */
@media (max-width: 768px) {
    body {
        padding: 5px;
        overflow-y: auto;
    }
    
    .main-container {
        width: 100vw;
        max-width: 100vw;
        margin: 0;
        padding: 10px;
        border-radius: 10px;
        gap: 10px;
    }
    
    .left-container {
        border-radius: 10px;
    }
    
    .control-panel {
        padding: 10px;
        gap: 10px;
    }
    
    h3.cp {
        font-size: 1rem;
        padding: 5px;
    }
    
    .btn, button {
        font-size: 1rem !important;
        padding: 8px 10px !important;
        min-height: 40px !important;
        letter-spacing: 0.5px !important;
    }
    
    #plus, #minus {
        min-width: 40px;
        height: 40px;
        font-size: 1.2rem !important;
    }
    
    .tellspace-container {
        border-radius: 10px;
        height: 40vh;
        max-height: 40vh;
        min-height: 250px;
    }
    
    .wrapper2-container {
        border-radius: 10px;
        height: 28vh;
        max-height: 28vh;
        min-height: 180px;
    }
    
    .right-container:has(#wrapper2.hidden) .tellspace-container {
        height: 55vh;
        min-height: 350px;
    }
    
    #tellspace {
        padding: 10px;
    }
    
    .slider-container {
        padding: 8px;
        margin: 6px;
        flex-wrap: nowrap;
        min-width: 600px;
    }
    
    .floating-event-label,
    .time-value-display,
    .time-value-input {
        font-size: 0.65rem;
        padding: 2px 4px;
        min-width: 28px;
        min-height: 16px;
        top: -22px;
        border-radius: 4px;
    }
    
    .floating-event-label {
        left: -30px;
        width: 30px;
        max-width: 30px;
    }
    
    .time-value-input,
    .time-value-display {
        right: -30px;
        width: 30px;
        max-width: 30px;
    }
    
    .process-label {
        font-size: 0.9rem;
        padding: 3px 5px;
        min-width: 28px;
        margin-right: 6px;
    }
    
    .increment {
        width: 35px;
        height: 20px;
        font-size: 0.9rem;
        margin-right: 6px;
    }
    
    .event {
        height: 12px;
        width: 12px;
        bottom: -5px;
    }
    
    .event.to {
        height: 8px;
        width: 8px;
    }
    
    .difficulty {
        padding: 10px;
    }
    
    .gauge {
        width: 100px;
        height: 50px;
    }
    
    .gauge-center .label {
        font-size: 0.9em;
        margin-top: 0.8em;
    }
    
    .needle {
        width: 52px;
        height: 5px;
    }
    
    .slice-colors .st {
        border-top-width: 50px;
        border-left-width: 50px;
        border-right-width: 50px;
    }
    
    #generatespace {
        margin-top: 15px;
    }
    
    .header-border {
        padding: 10px;
    }
    
    .aparam {
        padding: 8px;
    }
    
    #generatespace h4 {
        font-size: 0.75rem;
    }
    
    #ordergenerate {
        font-size: 1.1rem !important;
        padding: 10px 12px !important;
        min-height: 45px !important;
        margin-top: 10px;
        margin-bottom: 10px;
    }
    
    .input-number {
        width: 30px;
        height: 30px;
        font-size: 0.9rem;
    }
    
    .input-number-decrement,
    .input-number-increment {
        width: 22px;
        height: 30px;
        line-height: 30px;
        font-size: 0.8rem;
    }
    
    /* Instructions Modal responsive */
    .instructions-modal-content {
        margin: 2% auto;
        width: 98%;
        max-height: 95vh;
        border-radius: 15px;
    }
    
    .modal-header {
        padding: 16px 50px 16px 20px;
    }
    
    .header-text h2 {
        font-size: 1.2rem;
    }
    
    .header-text p {
        font-size: 0.85rem;
    }
    
    .header-icon {
        padding: 8px;
    }
    
    .modal-body {
        padding: 15px;
    }
    
    .instructions-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .instruction-card {
        padding: 15px;
    }
    
    .instruction-card .instruction-title {
        font-size: 1.2rem;
    }
    
    .instruction-card .instruction-list li {
        font-size: 0.95rem;
        padding: 6px 0;
    }
}

/* Mobile phones */
@media (max-width: 576px) {
    body {
        padding: 0;
    }
    
    .main-container {
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 8px;
        border-radius: 0;
        min-height: 100vh;
    }
    
    .left-container {
        border-radius: 8px;
    }
    
    .control-panel {
        padding: 8px;
        gap: 8px;
    }
    
    .control-panel .wrapperalike,
    .control-panel #testcontrols,
    .control-panel #antiwrapper {
        padding: 10px;
        border-radius: 8px;
    }
    
    h3.cp {
        font-size: 0.9rem;
        gap: 5px;
    }
    
    .btn, button {
        font-size: 0.9rem !important;
        padding: 8px !important;
        min-height: 38px !important;
        border-radius: 8px !important;
        margin-bottom: 8px !important;
    }
    
    #plus, #minus {
        min-width: 38px;
        height: 38px;
        font-size: 1.1rem !important;
        margin: 4px;
    }
    
    .tellspace-container,
    .wrapper2-container {
        border-radius: 8px;
    }
    
    .tellspace-container {
        height: 38vh;
        max-height: 38vh;
        min-height: 220px;
    }
    
    .wrapper2-container {
        height: 25vh;
        max-height: 25vh;
        min-height: 150px;
    }
    
    .right-container:has(#wrapper2.hidden) .tellspace-container {
        height: 50vh;
        min-height: 300px;
    }
    
    #tellspace {
        padding: 8px;
    }
    
    .slider-container {
        padding: 6px;
        margin: 4px;
        min-width: 500px;
    }
    
    .floating-event-label,
    .time-value-display,
    .time-value-input {
        font-size: 0.6rem;
        padding: 2px 3px;
        min-width: 24px;
        min-height: 14px;
        top: -20px;
        border-radius: 3px;
    }
    
    .floating-event-label {
        left: -26px;
        width: 26px;
        max-width: 26px;
    }
    
    .time-value-input,
    .time-value-display {
        right: -26px;
        width: 26px;
        max-width: 26px;
    }
    
    .process-label {
        font-size: 0.8rem;
        padding: 2px 4px;
        min-width: 25px;
        margin-right: 4px;
    }
    
    .increment {
        width: 30px;
        height: 18px;
        font-size: 0.8rem;
        margin-right: 4px;
    }
    
    .event {
        height: 10px;
        width: 10px;
        bottom: -4px;
        border-width: 2px;
    }
    
    .event.to {
        height: 7px;
        width: 7px;
    }
    
    .slider-bone {
        height: 2px;
    }
    
    .message {
        stroke-width: 2px;
    }
    
    .difficulty {
        padding: 8px;
    }
    
    .gauge {
        width: 80px;
        height: 40px;
    }
    
    .gauge-center .label {
        font-size: 0.7em;
        margin-top: 0.6em;
    }
    
    .needle {
        width: 42px;
        height: 4px;
    }
    
    .slice-colors .st {
        border-top-width: 40px;
        border-left-width: 40px;
        border-right-width: 40px;
    }
    
    #generatespace {
        margin-top: 10px;
    }
    
    .header-border {
        padding: 8px;
        border-radius: 8px;
    }
    
    .header-border .heading {
        font-size: 0.9em;
        margin-top: -1.2em;
    }
    
    .header-border .heading > span {
        padding: 5px 8px;
        font-size: 0.75em;
    }
    
    .aparam {
        padding: 6px;
        border-radius: 6px;
    }
    
    #generatespace h4 {
        font-size: 0.7rem;
    }
    
    #ordergenerate {
        font-size: 1rem !important;
        padding: 8px 10px !important;
        min-height: 40px !important;
        width: 95%;
        margin-top: 8px;
        margin-bottom: 8px;
    }
    
    .input-number {
        width: 28px;
        height: 28px;
        font-size: 0.85rem;
    }
    
    .input-number-decrement,
    .input-number-increment {
        width: 20px;
        height: 28px;
        line-height: 28px;
        font-size: 0.75rem;
    }
    
    /* Cycle space / error message responsive */
    #iscycle {
        width: 90vw;
        font-size: 1rem;
        padding: 0.4em 10px;
    }
    
    /* Instructions Modal - mobile */
    .instructions-modal-content {
        margin: 0;
        width: 100%;
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
    }
    
    .modal-header {
        padding: 12px 45px 12px 15px;
    }
    
    .modal-close {
        width: 35px !important;
        height: 35px !important;
        top: 10px !important;
        right: 10px !important;
    }
    
    .header-content {
        gap: 10px;
    }
    
    .header-icon {
        padding: 6px;
    }
    
    .header-icon svg {
        width: 20px;
        height: 20px;
    }
    
    .header-text h2 {
        font-size: 1.1rem;
    }
    
    .header-text p {
        font-size: 0.8rem;
    }
    
    .modal-body {
        padding: 12px;
        max-height: calc(100vh - 80px);
    }
    
    .instructions-grid {
        gap: 12px;
    }
    
    .instruction-card {
        padding: 12px;
        border-radius: 10px;
    }
    
    .instruction-card .instruction-icon {
        width: 40px;
        height: 40px;
        margin-bottom: 12px;
    }
    
    .instruction-card .instruction-title {
        font-size: 1.1rem;
        margin-bottom: 10px;
    }
    
    .instruction-card .instruction-list li {
        font-size: 0.9rem;
        padding: 5px 0;
        line-height: 1.5;
    }
}

/* Extra small phones */
@media (max-width: 380px) {
    .main-container {
        padding: 5px;
    }
    
    .control-panel {
        padding: 5px;
    }
    
    h3.cp {
        font-size: 0.85rem;
    }
    
    .btn, button {
        font-size: 0.85rem !important;
        padding: 6px !important;
        min-height: 35px !important;
    }
    
    #plus, #minus {
        min-width: 35px;
        height: 35px;
        font-size: 1rem !important;
    }
    
    .tellspace-container {
        min-height: 200px;
    }
    
    .wrapper2-container {
        min-height: 130px;
    }
    
    .slider-container {
        min-width: 450px;
    }
    
    .floating-event-label,
    .time-value-display,
    .time-value-input {
        font-size: 0.55rem;
        padding: 1px 2px;
        min-width: 22px;
        min-height: 12px;
        top: -18px;
        border-radius: 2px;
    }
    
    .floating-event-label {
        left: -24px;
        width: 24px;
        max-width: 24px;
    }
    
    .time-value-input,
    .time-value-display {
        right: -24px;
        width: 24px;
        max-width: 24px;
    }
    
    .gauge {
        width: 70px;
        height: 35px;
    }
    
    .needle {
        width: 36px;
        height: 4px;
    }
    
    .slice-colors .st {
        border-top-width: 35px;
        border-left-width: 35px;
        border-right-width: 35px;
    }
}

/* Landscape mode on mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .main-container {
        height: auto;
        max-height: none;
    }
    
    .tellspace-container {
        height: 60vh;
        min-height: 200px;
    }
    
    .wrapper2-container {
        height: 50vh;
        min-height: 150px;
    }
    
    .right-container:has(#wrapper2.hidden) .tellspace-container {
        height: 80vh;
        min-height: 250px;
    }
}

/* Hide mobile warning - now responsive */
.mobile-warning {
    display: none !important;
}

#mobile-message {
    display: none !important;
}
