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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); 
    min-height: 100vh;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.container {
    width: 100%;
    max-width: 700px;
}

h1 {
    color: white;
    text-align: center;
    margin-bottom: 10px;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.description {
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
    margin-bottom: 30px;
    font-size: 1.1em;
}

.info-note {
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.info-note-primary {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border: 3px solid #2196f3;
}

.info-note-primary h3 {
    color: #0d47a1;
}

.info-note-primary p,
.info-note-primary li {
    color: #1565c0;
}

.info-note-primary strong {
    color: #0d47a1;
}

.info-note-secondary {
    background: linear-gradient(135deg, #fff9e6 0%, #ffe8a1 100%);
    border: 3px solid #ffc107;
}

.info-note-secondary h3 {
    color: #856404;
}

.info-note-secondary p {
    color: #856404;
}

.info-note-secondary strong {
    color: #664d03;
}

.info-note h3 {
    margin-bottom: 15px;
    font-size: 1.3em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-note p {
    margin-bottom: 10px;
    line-height: 1.6;
    font-size: 0.95em;
}

.info-note p:last-child {
    margin-bottom: 0;
}

.info-note ul {
    margin: 10px 0 10px 20px;
    line-height: 1.8;
}

.info-note li {
    margin-bottom: 5px;
    font-size: 0.95em;
}

.info-note strong {
    font-weight: 700;
}

.info-note sup {
    font-size: 0.7em;
}

.calculator {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.input-section {
    margin-bottom: 25px;
}

label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #333;
    font-size: 1.1em;
}

input[type="text"], input[type="file"] {
    width: 100%;
    padding: 15px;
    font-size: 1.2em;
    border: 2px solid #ddd;
    border-radius: 10px;
    transition: border-color 0.3s;
}

input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
}

.input-hint {
    margin-top: 8px;
    font-size: 0.9em;
    color: #666;
    font-style: italic;
}

.button-group {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
    margin-bottom: 25px;
}

.button-group-auto {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-bottom: 25px;
}

.btn {
    padding: 15px 25px;
    font-size: 1.1em;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    color: white;
}

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

.btn:active {
    transform: translateY(0);
}

.btn-compress {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.btn-decompress {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.btn-clear {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.btn-auto-decompress {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    color: #333;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9em;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    color: white;
}

.btn-small:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.btn-small:active {
    transform: translateY(0);
}

.btn-copy-small {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.btn-clear-scratch {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.bit-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 25px;
}

.bit-stat {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 15px 20px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 2px solid #dee2e6;
}

.bit-label {
    font-weight: 600;
    color: #495057;
    font-size: 1em;
}

.bit-value {
    font-weight: 700;
    color: #667eea;
    font-size: 1.2em;
    font-family: 'Courier New', monospace;
}

.status-indicator {
    background: linear-gradient(135deg, #fff3cd 0%, #ffe69c 100%);
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 25px;
    border: 2px solid #ffc107;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.status-label {
    font-weight: 600;
    color: #856404;
    font-size: 1em;
}

.status-value {
    font-weight: 700;
    color: #856404;
    font-size: 1.2em;
    font-family: 'Courier New', monospace;
    text-transform: uppercase;
}

.control-status-indicator {
    background: linear-gradient(135deg, #d1ecf1 0%, #bee5eb 100%);
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 25px;
    border: 2px solid #17a2b8;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.control-status-label {
    font-weight: 600;
    color: #0c5460;
    font-size: 1em;
}

.control-status-value {
    font-weight: 700;
    color: #0c5460;
    font-size: 1.2em;
    font-family: 'Courier New', monospace;
}

.collected-binary {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border: 2px solid #28a745;
    font-weight: 700;
    color: #155724;
}

.results {
    margin-bottom: 0;
}

.results h2 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.5em;
}

.results-header-with-button {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.results-header-with-button h2 {
    margin-bottom: 0;
}

.results-content {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    min-height: 120px;
    max-height: 400px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 1.2em;
    color: #333;
    word-break: break-all;
    line-height: 1.6;
    margin-bottom: 20px;
}

.placeholder {
    color: #999;
    font-style: italic;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.error {
    color: #dc3545;
    font-weight: 600;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.copy-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #28a745;
    color: white;
    padding: 15px 25px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease-out;
    z-index: 1000;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Scratch Pad Styles */
.scratch-pad-container {
    background: white;
    border-radius: 20px;
    padding: 30px;
    margin-top: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.scratch-pad-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.scratch-pad-header h2 {
    color: #333;
    font-size: 1.5em;
    margin: 0;
}

.scratch-pad-controls {
    display: flex;
    gap: 10px;
}

.scratch-pad-textarea {
    width: 100%;
    min-height: 200px;
    padding: 15px;
    font-size: 1em;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    border: 2px solid #ddd;
    border-radius: 10px;
    resize: vertical;
    transition: border-color 0.3s;
    line-height: 1.6;
}

.scratch-pad-textarea:focus {
    outline: none;
    border-color: #667eea;
}

.scratch-pad-info {
    margin-top: 10px;
    font-size: 0.85em;
    color: #856404;
    font-style: italic;
    background: linear-gradient(135deg, #fff9e6 0%, #ffe8a1 100%);
    padding: 10px 15px;
    border-radius: 8px;
    border: 2px solid #ffc107;
}

/* Image compression specific styles */
.image-preview {
    max-width: 100%;
    max-height: 300px;
    margin: 15px 0;
    border-radius: 10px;
    border: 2px solid #ddd;
}

.compression-stats {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
    border: 2px solid #2196f3;
}

.compression-stats h3 {
    color: #1565c0;
    margin-bottom: 15px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(33, 150, 243, 0.2);
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-label {
    font-weight: 600;
    color: #1565c0;
}

.stat-value {
    font-family: 'Courier New', monospace;
    color: #0d47a1;
    font-weight: 700;
}

@media (max-width: 600px) {
    .calculator {
        padding: 20px;
    }

    h1 {
        font-size: 2em;
    }

    .button-group {
        grid-template-columns: 1fr;
    }

    .bit-stats {
        grid-template-columns: 1fr;
    }

    .results-header-with-button {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .info-note {
        padding: 15px;
    }

    .info-note h3 {
        font-size: 1.1em;
    }

    .info-note p,
    .info-note li {
        font-size: 0.85em;
    }

    .scratch-pad-container {
        padding: 20px;
    }

    .scratch-pad-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}
