/* Flat 2.0 Design for Adrenal Nodules Tool */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: linear-gradient(135deg, var(--night) 0%, var(--rich-black) 100%);
    color: var(--platinum);
    line-height: 1.6;
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.page-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.sticky-footer {
    text-align: center;
    padding: 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    background: var(--bg-primary);
    border-top: 1px solid rgba(48, 250, 181, 0.1);
    margin-top: auto;
}

.tool-container {
    max-width: 1200px;
    width: 100%;
    background: var(--rich-black);
    padding: 40px;
    border-radius: 16px;
    box-shadow: 
        0 20px 40px rgba(0,0,0,0.4),
        0 0 0 1px rgba(48, 250, 181, 0.1);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: none;
    margin: auto;
}

h1 {
    text-align: center;
    color: var(--aquamarine);
    margin-bottom: 8px;
    font-size: 2.2em;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(48, 250, 181, 0.3);
    letter-spacing: -0.02em;
}

h2 {
    text-align: center;
    color: var(--ash-gray);
    font-size: 1.1em;
    margin-top: 0;
    margin-bottom: 40px;
    font-weight: 400;
    opacity: 0.9;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}

/* Notes container */
.notes-container {
    background: linear-gradient(135deg, var(--night), var(--rich-black));
    border: none;
    border-radius: 16px;
    padding: 32px;
    max-height: 700px;
    overflow-y: auto;
    position: sticky;
    top: 20px;
    box-shadow: 
        0 8px 32px rgba(0,0,0,0.3),
        inset 0 1px 0 rgba(48, 250, 181, 0.1);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.notes-header {
    margin-bottom: 24px;
    padding: 16px 0;
    text-align: center;
    border-bottom: 2px solid transparent;
    background: linear-gradient(90deg, var(--aquamarine), var(--jungle-green)) 
                padding-box,
                linear-gradient(90deg, var(--aquamarine), var(--jungle-green)) 
                border-box;
    border-bottom: 2px solid transparent;
    background-clip: padding-box, border-box;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notes-header h3 {
    color: var(--night);
    margin: 0;
    font-size: 1.3em;
    font-weight: 700;
    text-shadow: none;
    letter-spacing: 0.02em;
}

.notes-section {
    margin-bottom: 24px;
    padding: 20px;
    background: linear-gradient(135deg, var(--rich-black), rgba(35, 38, 38, 0.8));
    border-radius: 12px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.notes-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--aquamarine), var(--jungle-green));
    transition: width 0.3s ease;
}

/* Highlighted state for definite benign features */
.notes-section.highlighted {
    background: linear-gradient(135deg, rgba(48, 250, 181, 0.15), rgba(34, 191, 141, 0.1));
    box-shadow: 
        0 4px 16px rgba(48, 250, 181, 0.3),
        inset 0 1px 0 rgba(48, 250, 181, 0.2);
    transform: scale(1.02);
}

.notes-section.highlighted::before {
    width: 6px;
    background: linear-gradient(180deg, var(--aquamarine), var(--jungle-green));
}

/* Faded state for when indeterminate is selected */
.notes-section.faded {
    opacity: 0.3;
    transform: scale(0.98);
    background: linear-gradient(135deg, rgba(35, 38, 38, 0.5), rgba(25, 28, 28, 0.5));
}

/* Dialogue box for adrenal CT recommendation */
.dialogue-box {
    position: relative;
    margin: 20px 0 0 0;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid var(--jungle-green);
    border-radius: 0px;
    padding: 20px;
    width: 100%;
    max-width: none;
    color: var(--platinum);
    font-weight: 600;
    font-size: 1.1em;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    animation: slideInRight 0.3s ease-out;
    box-sizing: border-box;
}

.dialogue-box.hidden {
    display: none;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateY(-50%) translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateY(-50%) translateX(0);
    }
}

/* Mobile responsiveness for dialogue box */
@media (max-width: 768px) {
    .dialogue-box {
        position: relative;
        margin: 15px 0 0 0;
        width: 100%;
        max-width: none;
        font-size: 1em;
        padding: 15px;
        box-sizing: border-box;
    }
    
    @keyframes slideInRight {
        from {
            opacity: 0;
            transform: translateY(100%);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}

.notes-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--aquamarine), var(--jungle-green));
    transition: width 0.3s ease;
}

.notes-section:hover::before {
    width: 6px;
}

.notes-section:hover {
    transform: translateX(4px);
    box-shadow: 
        0 4px 16px rgba(0,0,0,0.2),
        -4px 0 0 0 rgba(48, 250, 181, 0.3);
}

.notes-section h4 {
    color: var(--aquamarine);
    margin-top: 0;
    margin-bottom: 16px;
    font-size: 1.1em;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.notes-section ul {
    margin: 0;
    padding-left: 20px;
    color: var(--platinum);
}

.notes-section li {
    margin-bottom: 12px;
    line-height: 1.5;
    position: relative;
}

.notes-section li::marker {
    color: var(--aquamarine);
}

.notes-section strong {
    color: var(--aquamarine);
    font-weight: 600;
}

/* Washout calculation specific styles */
.washout-calculation {
    border-left-color: var(--bronze);
    background: linear-gradient(135deg, rgba(214, 139, 42, 0.1), rgba(35, 38, 38, 0.8));
}

.washout-calculation::before {
    background: linear-gradient(180deg, var(--bronze), var(--aquamarine));
}

.washout-calculation h4 {
    color: var(--bronze);
    text-shadow: 0 2px 4px rgba(214, 139, 42, 0.3);
}

.calculation-box {
    background: linear-gradient(135deg, var(--night), var(--rich-black));
    padding: 20px;
    margin: 16px 0;
    border-radius: 12px;
    border: 1px solid rgba(214, 139, 42, 0.2);
    box-shadow: 
        0 4px 12px rgba(0,0,0,0.2),
        inset 0 1px 0 rgba(214, 139, 42, 0.1);
    transition: all 0.3s ease;
}

.calculation-box:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 8px 20px rgba(0,0,0,0.3),
        inset 0 1px 0 rgba(214, 139, 42, 0.2);
}

.calculation-box p {
    margin: 8px 0;
    color: var(--platinum);
    font-weight: 600;
}

.formula {
    background: linear-gradient(135deg, var(--rich-black), rgba(25, 28, 28, 0.9));
    padding: 16px;
    margin: 12px 0;
    border-radius: 8px;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 0.95em;
    color: var(--aquamarine);
    border-left: 4px solid var(--bronze);
    box-shadow: inset 0 1px 0 rgba(48, 250, 181, 0.1);
    letter-spacing: 0.02em;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.criteria {
    color: var(--jungle-green) !important;
    font-weight: 700 !important;
    text-align: center;
    background: linear-gradient(135deg, rgba(34, 191, 141, 0.15), rgba(34, 191, 141, 0.05));
    padding: 12px;
    border-radius: 8px;
    font-size: 1.05em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid rgba(34, 191, 141, 0.3);
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.timing-note {
    background: linear-gradient(135deg, var(--rich-black), rgba(35, 38, 38, 0.9));
    padding: 16px;
    border-radius: 8px;
    border: 1px solid rgba(213, 219, 219, 0.2);
    margin-top: 16px;
    box-shadow: inset 0 1px 0 rgba(213, 219, 219, 0.1);
}

.timing-note p {
    margin: 0;
    font-size: 0.9em;
    color: var(--ash-gray);
    font-style: italic;
    font-weight: 500;
}

fieldset {
    background: var(--night);
    border: none;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 
        0 4px 16px rgba(0,0,0,0.2),
        inset 0 1px 0 rgba(48, 250, 181, 0.1);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

fieldset::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--aquamarine), var(--jungle-green));
    opacity: 0.6;
}

fieldset:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 8px 24px rgba(0,0,0,0.3),
        inset 0 1px 0 rgba(48, 250, 181, 0.2);
}

legend {
    font-weight: 700;
    color: var(--aquamarine);
    padding: 8px 16px;
    background: linear-gradient(135deg, var(--rich-black), var(--night));
    border-radius: 2px;
    border: 1px solid rgba(48, 250, 181, 0.3);
    font-size: 0.95em;
    letter-spacing: 0.02em;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.radio-group label {
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, var(--rich-black), rgba(35, 38, 38, 0.8));
    color: var(--platinum);
    padding: 16px 20px;
    border-radius: 10px;
    cursor: pointer;
    border: 1px solid rgba(213, 219, 219, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    font-weight: 500;
}

.radio-group label::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(48, 250, 181, 0.1), transparent);
    transition: left 0.6s ease;
}

.radio-group label:hover {
    border-color: var(--aquamarine);
    background: linear-gradient(135deg, var(--night), rgba(25, 28, 28, 0.9));
    transform: translateX(4px);
    box-shadow: 
        0 4px 12px rgba(0,0,0,0.2),
        -4px 0 0 0 var(--aquamarine);
}

.radio-group label:hover::before {
    left: 100%;
}

.radio-group input[type="radio"] {
    margin-right: 16px;
    accent-color: var(--aquamarine);
    transform: scale(1.2);
    transition: transform 0.2s ease;
}

.radio-group input[type="radio"]:checked + span,
.radio-group label:has(input[type="radio"]:checked) {
    background: linear-gradient(135deg, var(--jungle-green), var(--aquamarine));
    border-color: var(--jungle-green);
    color: var(--night);
    font-weight: 600;
    box-shadow: 
        0 6px 20px rgba(34, 191, 141, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transform: translateX(6px);
}

.radio-group input[type="radio"]:checked {
    transform: scale(1.3);
}

.hidden {
    display: none;
}

/* Back button */
.back-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    background: linear-gradient(135deg, var(--aquamarine), var(--jungle-green));
    color: var(--night);
    padding: 18px 40px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    text-decoration: none;
    z-index: 1000;
    font-size: 1.1em;
    font-family: inherit;
    font-weight: 700;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 8px 24px rgba(48, 250, 181, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    letter-spacing: 0.02em;
    text-transform: uppercase;
    position: relative;
    overflow: hidden;
}

.back-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.6s ease;
}

.back-btn:hover {
    background: linear-gradient(135deg, var(--jungle-green), var(--bronze));
    transform: translateY(-3px) scale(1.02);
    box-shadow: 
        0 12px 32px rgba(48, 250, 181, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.back-btn:hover::before {
    left: 100%;
}

.back-btn:active {
    transform: translateY(-1px) scale(1);
}

#calculate-btn {
    grid-column: 1 / -1;
    padding: 18px 40px;
    background: linear-gradient(135deg, var(--aquamarine), var(--jungle-green));
    color: var(--night);
    border: none;
    border-radius: 12px;
    font-size: 1.1em;
    font-weight: 700;
    cursor: pointer;
    margin-top: 32px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 8px 24px rgba(48, 250, 181, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    letter-spacing: 0.02em;
    text-transform: uppercase;
    position: relative;
    overflow: hidden;
}

#calculate-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.6s ease;
}

#calculate-btn:hover {
    background: linear-gradient(135deg, var(--jungle-green), var(--bronze));
    transform: translateY(-3px) scale(1.02);
    box-shadow: 
        0 12px 32px rgba(48, 250, 181, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

#calculate-btn:hover::before {
    left: 100%;
}

#calculate-btn:active {
    transform: translateY(-1px) scale(1);
}

#result-container {
    grid-column: 1 / -1;
    margin-top: 32px;
    padding: 32px;
    background: linear-gradient(135deg, var(--night), var(--rich-black));
    border: none;
    border-radius: 16px;
    box-shadow: 
        0 8px 32px rgba(0,0,0,0.3),
        inset 0 1px 0 rgba(48, 250, 181, 0.1);
    position: relative;
    overflow: hidden;
}

#result-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--aquamarine), var(--jungle-green), var(--bronze));
}

#result-container h3 {
    margin-top: 0;
    color: var(--aquamarine);
    font-weight: 700;
    font-size: 1.4em;
    margin-bottom: 20px;
    text-shadow: 0 2px 4px rgba(48, 250, 181, 0.3);
}

#recommendation {
    font-weight: 700;
    font-size: 1.2em;
    color: var(--platinum);
    padding: 20px;
    background: linear-gradient(135deg, rgba(48, 250, 181, 0.1), rgba(34, 191, 141, 0.05));
    border-radius: 12px;
    border-left: 4px solid var(--aquamarine);
    margin-bottom: 16px;
}

#comments {
    margin-top: 16px;
    font-style: italic;
    color: var(--ash-gray);
    padding: 16px;
    background: rgba(213, 219, 219, 0.05);
    border-radius: 8px;
    border-left: 3px solid var(--ash-gray);
    line-height: 1.6;
}

.footer-notes {
    grid-column: 1 / -1;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--ash-gray);
    font-size: 0.85em;
    color: var(--ash-gray);
}

.footer-notes strong {
    color: var(--aquamarine);
}

.footer-notes a {
    color: var(--aquamarine);
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    padding: 4px 8px;
    border-radius: 6px;
    background: linear-gradient(135deg, rgba(48, 250, 181, 0.1), rgba(48, 133, 105, 0.1));
    border: 1px solid rgba(48, 250, 181, 0.2);
    font-weight: 600;
    letter-spacing: 0.01em;
    box-shadow: 0 2px 8px rgba(48, 250, 181, 0.15);
}

.footer-notes a:hover {
    color: var(--night);
    background: linear-gradient(135deg, var(--aquamarine), var(--jungle-green));
    border-color: var(--jungle-green);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(48, 250, 181, 0.3);
    text-decoration: none;
}

.footer-notes a:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(48, 250, 181, 0.2);
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    body {
        padding: 15px 10px;
        line-height: 1.5;
    }
    
    .tool-container {
        padding: 20px;
        margin: 0 5px;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .notes-container {
        position: static;
        max-height: none;
        order: 2;
    }
    
    h1 {
        font-size: 1.5em;
        margin-bottom: 8px;
    }
    
    h2 {
        font-size: 1em;
        margin-bottom: 20px;
    }
    
    fieldset {
        padding: 12px;
        margin-bottom: 15px;
    }
    
    .radio-group label {
        padding: 12px;
        font-size: 0.95em;
    }
    
    .radio-group label:hover {
        background: var(--rich-black); /* Disable hover effects on touch */
        border-color: var(--ash-gray);
    }
    
    .radio-group label:active {
        background: var(--night);
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
    
    .radio-group input[type="radio"] {
        transform: scale(1.4);
        margin-right: 14px;
    }
    
    /* Touch-optimized back button */
    .back-btn {
        min-height: 44px;
        padding: 18px 40px;
        font-size: 1.1em;
        font-weight: 700;
        letter-spacing: 0.02em;
        text-transform: uppercase;
        box-shadow: 
            0 8px 24px rgba(48, 250, 181, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.2);
    }
    
    .back-btn::before {
        content: '';
        position: absolute;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100%;
        background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
        transition: left 0.6s ease;
    }
    
    .back-btn:hover {
        background: linear-gradient(135deg, var(--jungle-green), var(--bronze));
        transform: translateY(-3px) scale(1.02);
        box-shadow: 
            0 12px 32px rgba(48, 250, 181, 0.4),
            inset 0 1px 0 rgba(255, 255, 255, 0.3);
    }
    
    .back-btn:hover::before {
        left: 100%;
    }
    
    .back-btn:active {
        transform: translateY(-1px) scale(1);
    }
    
    #calculate-btn {
        padding: 12px 20px;
        font-size: 1em;
    }
    
    .footer-notes {
        font-size: 0.8em;
        margin-top: 20px;
        padding-top: 15px;
    }
    
    /* Notes section mobile adjustments */
    .notes-container {
        padding: 15px;
    }
    
    .notes-header h3 {
        font-size: 1.1em;
    }
    
    .notes-section {
        padding: 12px;
        margin-bottom: 15px;
    }
    
    .notes-section h4 {
        font-size: 0.95em;
    }
    
    .calculation-box {
        padding: 10px;
    }
    
    .formula {
        font-size: 0.8em;
        padding: 6px;
    }
}

.flowchart-svg.panning {
    cursor: grabbing;
}

/* Node Styles */
.node {
    cursor: pointer;
    transition: all 0.3s ease;
}

.node:hover .node-rect {
    filter: brightness(1.1);
    stroke-width: 3;
}

.node.highlighted .node-rect {
    stroke-width: 4;
    stroke: #ff6b6b;
    filter: drop-shadow(0 0 10px rgba(255, 107, 107, 0.5));
}

.start-node .node-rect {
    fill: #3d5a80;
    stroke: #5b9bd5;
    stroke-width: 2;
}

.decision-node .node-rect {
    fill: #6b5b95;
    stroke: #9b59b6;
    stroke-width: 2;
}

.outcome-node .node-rect {
    fill: #2d4739;
    stroke: #27ae60;
    stroke-width: 2;
}

.action-node .node-rect {
    fill: #8b4513;
    stroke: #e67e22;
    stroke-width: 2;
}

.node-text {
    font-size: 11px;
    font-weight: 500;
    text-anchor: middle;
    dominant-baseline: middle;
    fill: #ffffff;
    pointer-events: none;
}

.start-node .node-text {
    font-weight: 600;
    font-size: 12px;
}

/* Connectors */
.connector {
    stroke: #888;
    stroke-width: 2;
    fill: none;
    marker-end: url(#arrowhead);
}

.connector-label {
    font-size: 10px;
    fill: #ccc;
    text-anchor: middle;
}

/* Controls */
.controls {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.control-btn {
    background: #2aa198;
    color: white;
    border: none;
    padding: 12px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    min-width: 140px;
}

.control-btn:hover {
    background: #238e85;
    transform: translateY(-2px);
}

/* Progress indicator */
.progress {
    position: fixed;
    top: 0;
    left: 0;
    background: #2aa198;
    height: 4px;
    width: 0%;
    transition: width 0.5s ease;
    z-index: 1001;
}

/* Back button */
.back-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    background: #2aa198;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    z-index: 1000;
}

/* Step indicator */
.step-indicator {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: rgba(42, 161, 152, 0.9);
    color: white;
    padding: 10px 15px;
    border-radius: 6px;
    font-size: 14px;
    z-index: 1000;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.hidden {
    display: none;
}

/* Mobile Optimization */
@media (max-width: 768px) {
    body {
        overflow-x: auto;
    }
    
    h1 {
        font-size: 1.5rem;
        margin: 10px 0;
        padding: 0 10px;
        line-height: 1.3;
    }
    
    .flowchart-container {
        height: calc(100vh - 60px);
        padding: 0;
    }
    
    .flowchart-svg {
        width: 800px;
        height: 1400px;
        min-width: 100vw;
    }
    
    .flowchart-svg.full-view {
        transform: scale(0.25) translateY(20px);
    }
    
    .flowchart-svg.zoomed {
        transform: scale(1.2) translate(var(--zoom-x, 0px), var(--zoom-y, 0px));
    }
    
    /* Mobile-optimized controls */
    .controls {
        bottom: 10px;
        right: 10px;
        gap: 8px;
    }
    
    .control-btn {
        padding: 10px 12px;
        font-size: 12px;
        min-width: 120px;
        border-radius: 4px;
    }
    
    /* Mobile back button */
    .back-btn {
        top: 10px;
        left: 10px;
        padding: 8px 12px;
        font-size: 14px;
    }
    
    /* Mobile step indicator */
    .step-indicator {
        bottom: 10px;
        left: 10px;
        padding: 8px 12px;
        font-size: 12px;
        max-width: calc(100vw - 140px);
        word-wrap: break-word;
    }
    
    /* Progress bar mobile */
    .progress {
        height: 3px;
    }
    
    /* Node text mobile optimization */
    .node-text {
        font-size: 9px;
        font-weight: 600;
    }
    
    .start-node .node-text {
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.2rem;
        margin: 5px 0;
    }
    
    .flowchart-svg {
        width: 600px;
        height: 1200px;
    }
    
    .flowchart-svg.full-view {
        transform: scale(0.2) translateY(10px);
    }
    
    .flowchart-svg.zoomed {
        transform: scale(1.0) translate(var(--zoom-x, 0px), var(--zoom-y, 0px));
    }
    
    .control-btn {
        padding: 8px 10px;
        font-size: 11px;
        min-width: 100px;
    }
    
    .step-indicator {
        font-size: 11px;
        max-width: calc(100vw - 120px);
    }
    
    .node-text {
        font-size: 8px;
    }
    
    .start-node .node-text {
        font-size: 9px;
    }
    
    /* Smaller controls for very small screens */
    .controls {
        flex-direction: row;
        flex-wrap: wrap;
        max-width: calc(100vw - 20px);
    }
    
    .back-btn {
        padding: 6px 10px;
        font-size: 12px;
    }
}

/* Touch-specific optimizations */
@media (hover: none) and (pointer: coarse) {
    .node {
        cursor: default;
    }
    
    .node:hover .node-rect {
        filter: none;
        stroke-width: 2;
    }
    
    .control-btn {
        padding: 12px 14px;
        min-height: 44px; /* Apple's recommended touch target size */
    }
    
    .back-btn {
        min-height: 44px;
        padding: 10px 15px;
    }
}
