body {
    font-family: 'Arial', sans-serif;
    background-color: #fce4ec; /* Light Blush Pink Background */
    color: #333;
    display: flex;
    justify-content: center;
    padding: 30px 20px;
    margin: 0;
}

.container {
    background-color: #ffffff;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    max-width: 650px;
    width: 100%;
}

h1 {
    text-align: center;
    color: #e91e63; /* Deep Rose Pink */
    margin-bottom: 5px;
}

.description {
    text-align: center;
    margin-bottom: 30px;
    font-style: italic;
    color: #777;
}

/* Input Group Styling - ENSURING FLEX ALIGNMENT */
.yarn-input-group {
    display: flex;
    align-items: center; /* Vertically centers all elements */
    justify-content: space-between; /* Spreads elements out */
    margin-bottom: 12px;
    background: #f0f4f7; 
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #c8e6a7; 
}

.yarn-input-group label {
    flex-shrink: 0;
    margin-right: 15px;
    font-weight: bold;
    color: #00796b; 
}

.yarn-input-group input {
    /* Allow input to grow, but give it a reasonable minimum size */
    flex-grow: 1; 
    min-width: 80px;
    padding: 10px;
    border: 1px solid #b2dfdb; 
    border-radius: 6px;
    text-align: right;
    transition: border-color 0.3s;
}

.yarn-input-group input:focus {
    border-color: #e91e63;
    outline: none;
}

/* Styling for the meterage prefix ("m/") */
.unit {
    margin: 0 5px;
    color: #555;
    font-size: 0.9em;
    flex-shrink: 0;
}

/* --- NEW: Styling for the select dropdown (WIDER) --- */
.yarn-input-group select {
    flex-shrink: 0; 
    width: 70px; /* Increased width from 50px to 65px to fit "100g" */
    padding: 8px 5px;
    border: 1px solid #b2dfdb;
    border-radius: 6px;
    background-color: #ffffff;
    cursor: pointer;
    font-size: 1em;
    height: 40px; 
    margin-left: 0; 
}

/* Button Styling (Top Buttons) */
button {
    padding: 10px 18px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    margin-right: 15px;
    transition: all 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#addYarnBtn {
    background-color: #a5d6a7; 
    color: #004d40; 
}

#addYarnBtn:hover {
    background-color: #81c784;
}

#removeYarnBtn {
    background-color: #ffcdd2; 
    color: #b71c1c; 
}

#removeYarnBtn:hover {
    background-color: #ef9a9a;
}

#removeYarnBtn:disabled {
    background-color: #f5f5f5;
    color: #aaa;
    cursor: not-allowed;
}

/* Result Box Styling */
.result-box {
    margin-top: 40px;
    padding: 25px;
    border: 3px solid #ffcdd2; 
    border-radius: 15px;
    background-color: #fff8e1; 
    text-align: left;
    position: relative; 
}

.result-box h2 {
    margin-top: 0;
    color: #e91e63; 
    border-bottom: 2px solid #ffcdd2;
    padding-bottom: 10px;
    margin-bottom: 15px;
    text-align: center;
}

/* Row alignment for meter results */
.result-box p:not(.category-row) {
    display: grid;
    grid-template-columns: 1fr 100px auto; 
    align-items: center;
    padding: 0;
    margin: 8px 0;
    font-size: 1.1em;
}

/* Number alignment */
.result-box strong {
    grid-column: 2;
    text-align: center;
    color: #00796b;
    font-size: 1.2em;
    padding: 0;
    margin: 0;
}

/* Unit alignment */
.result-unit {
    grid-column: 3;
    font-size: 0.9em;
    color: #555;
    font-weight: normal;
    padding-right: 10px;
}

/* Category Row Styling (CENTERED) */
.category-row {
    text-align: center; 
    margin-top: 20px;
    display: block; 
    font-size: 1.1em;
}

#resultCategory {
    font-weight: bold;
    font-size: 1.3em;
    color: #e91e63;
    margin-right: 5px;
    display: inline-block;
}

/* --- Table Container Styles (Permanently visible & centered) --- */
.yarn-chart-display {
    width: 100%; 
    padding: 0; 
    margin: 30px auto 0 auto; 
    
    border-top: 2px solid #ffcdd2; 
    padding-top: 20px;
}

/* --- Table Styles --- */
#categoryTableContainer table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    font-size: 0.9em;
    text-align: center;
    margin-left: auto; 
    margin-right: auto;
}

#categoryTableContainer th {
    padding: 8px 5px;
    background-color: transparent; 
    color: #333; 
    font-weight: bold; 
    border-bottom: 1px solid #ccc; 
}

#categoryTableContainer td {
    padding: 6px 5px;
    border-bottom: 1px solid #f0f4f7;
}

#categoryTableContainer tr:hover:not(.highlight-row) {
    background-color: #e8f5e9;
}

/* Highlight Style (Light Green) */
.highlight-row {
    background-color: #c8e6a7 !important; 
    font-weight: bold;
    color: #004d40;
}