* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f4f7f6;
    color: #333;
    padding: 20px;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
}

header {
    margin-bottom: 20px;
    text-align: center;
}

main {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}


.readonly-text {
    background-color: #eef2f5;
    color: #555;
    border-color: #d1d9e0;
    cursor: not-allowed;
    margin-top: 8px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
}


.panel {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    flex: 1;
    min-width: 300px;
}

textarea {
    width: 100%;
    height: 250px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 16px;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    resize: vertical;
    background-color: #fafafa;
}

button {
    width: 100%;
    padding: 12px;
    margin-top: 15px;
    background-color: #0056b3;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
}

button:hover {
    background-color: #004494;
}

.error {
    color: #d9534f;
    margin-top: 10px;
    font-size: 14px;
    font-weight: bold;
}

.hidden {
    display: none;
}

.legend {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    font-size: 14px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.box {
    width: 16px;
    height: 16px;
    border-radius: 2px;
}

.byte-padding {
    background: repeating-linear-gradient(
        45deg,
        #e0e0e0,
        #e0e0e0 5px,
        #cccccc 5px,
        #cccccc 10px
    );
    border: 1px solid #aaa;
}

#summary {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.grid-container {
    overflow-x: auto;
    /* Optional: prevents a vertical scrollbar from briefly appearing during hover */
    overflow-y: hidden; 
}

.memory-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
    max-width: 400px;
    padding-top: 40px; 
}

.byte {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-size: 12px;
    font-family: monospace;
    font-weight: bold;
    color: white;
    position: relative;
    cursor: help;
    border: 1px solid rgba(0,0,0,0.1);
}

/* Tooltip on hover 
.byte:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 10;
}*/


.control-group {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

select {
    padding: 10px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #fafafa;
    cursor: pointer;
}

.global-tooltip {
    position: fixed;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    pointer-events: none; /* Prevents the tooltip from blocking the mouse */
    z-index: 9999; /* Guarantees it hovers over all borders and panels */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.1s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

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