body {
    font-family: Arial, sans-serif;
    background: #e9ecef;
    margin: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
}

.toolbar {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    z-index: 1000;
    position: relative;
}

button {
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* NEW: Smooth hardware-accelerated rotation */
/* Update this specific block in your style.css */
#editor-wrapper {
    margin-top: 20px;
    position: relative;
    /* We removed the CSS transform animations here so the JS engine takes full control */
}

#pdf-container {
    position: relative;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    background: white;
}

#pdf-canvas {
    display: block;
}

#text-layer {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    overflow: hidden;
}

/* Update your editable-text styles in style.css */
.editable-text {
    position: absolute;
    color: transparent; 
    cursor: pointer; 
    
    white-space: pre !important; 
    width: max-content !important;
    min-width: 0 !important;
    word-break: keep-all !important;
    
    transform-origin: 0% 100%; /* Anchor to bottom left for perfect math */
    line-height: 1; 
    padding: 2px; 
    margin: 0; 
    box-sizing: border-box;
    border: 1px solid transparent; 
}

/* NEW: Soft highlight showing what text was detected */
.editable-text.highlighted-mode {
    background: rgba(255, 235, 59, 0.2);
    border: 1px dotted rgba(0, 0, 0, 0.2);
}

.editable-text:hover {
    border: 1px dashed rgba(98, 0, 234, 0.6);
    background: rgba(98, 0, 234, 0.05);
}

.editable-text.selected-text {
    border: 2px solid #6200ea;
    background: white;
    color: #000; /* THE FIX: Forces the transparent text to become visible when tapped */
    z-index: 5;
}

.editable-text:focus {
    color: inherit; 
    background: white;
    outline: none;
    border: 2px solid #ff9800; 
    z-index: 10;
    cursor: text;
}

.editable-text.edited-active {
    background: white; 
    z-index: 5;
}

.floating-toolbar {
    display: none; 
    position: absolute;
    background: white;
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
    padding: 4px;
    gap: 4px;
    z-index: 2000;
    border: 1px solid #ccc;
    align-items: center;
}

.floating-toolbar button {
    padding: 8px 10px;
    background: white;
    color: #333;
    box-shadow: none;
    font-size: 13px;
}

.floating-toolbar button:hover {
    background: #f0f0f0;
}