:root {
    /* Pastel Palette */
    --color-paper: #FFFDF5;
    /* Creamy paper */
    --color-text: #5D4037;
    /* Brown text (softer than black) */
    --color-primary: #FF8A80;
    /* Coral Red */
    --color-secondary: #80CBC4;
    /* Mint Green */
    --color-accent: #FFD54F;
    /* Sunflower Yellow */
    --color-line: #BCAAA4;

    --font-family: 'Mali', cursive;
    --radius-fun: 20px;
    --shadow-pop: 4px 4px 0px rgba(93, 64, 55, 0.15);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-family);
    background-color: #F8F4E6;
    /* Notebook Dot Grid Pattern */
    background-image: radial-gradient(#D7CCC8 2px, transparent 2px);
    background-size: 24px 24px;
    color: var(--color-text);
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.app-container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    flex: 1;
    position: relative;
    padding: 20px;
}

/* Header - Sticker Style */
header {
    text-align: center;
    margin-bottom: 24px;
    background: #FFF;
    padding: 16px;
    border-radius: 20px;
    border: 3px dashed var(--color-primary);
    box-shadow: var(--shadow-pop);
    transform: rotate(-1deg);
}

header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-primary);
    text-shadow: 2px 2px 0px #FFE0B2;
}

header p {
    font-size: 16px;
    color: var(--color-secondary);
    font-weight: 600;
}

/* Sticker Decorations */
header::after {
    content: '🐱';
    position: absolute;
    top: -15px;
    right: -10px;
    font-size: 32px;
    animation: bounce 2s infinite;
}

header::before {
    content: '✏️';
    position: absolute;
    bottom: -10px;
    left: -10px;
    font-size: 28px;
    transform: rotate(45deg);
}

/* Sticky Header - Yellow Highlighter Style */
.grid-header {
    display: grid;
    grid-template-columns: 32px 1fr 1fr 0.9fr 32px;
    gap: 8px;
    padding: 12px 16px;
    align-items: center;
    position: sticky;
    top: 10px;
    z-index: 100;

    background: var(--color-accent);
    border-radius: 50px;
    /* Pill shape */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);

    font-size: 14px;
    font-weight: 700;
    color: #5D4037;
    margin-bottom: 16px;
    border: 2px solid #5D4037;
}

.grid-header span {
    text-align: center;
}

/* List Container */
#items-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Item Row - Workbook Page Style */
.item-row {
    display: grid;
    grid-template-columns: 32px 1fr 1fr 0.9fr 32px;
    gap: 8px;
    align-items: center;

    background: var(--color-paper);
    padding: 16px 12px;
    border: 2px solid var(--color-text);
    border-radius: 16px;
    box-shadow: var(--shadow-pop);

    position: relative;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    /* Bouncy transition */
}

.item-row:hover {
    transform: scale(1.02);
}

/* Best Value - Winner Style */
.item-row.best-value {
    background: #E0F2F1;
    /* Light Mint */
    border-color: var(--color-secondary);
    box-shadow: 0 0 0 4px #B2DFDB, var(--shadow-pop);
    animation: wiggle 3s infinite ease-in-out;
}

/* Badge - Stamp Style */
.item-row.best-value::after {
    content: 'Winner! 🏆';
    position: absolute;
    top: -15px;
    right: 10px;
    background: var(--color-primary);
    color: white;
    font-size: 14px;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 50px;
    /* Pill */
    border: 2px solid white;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    z-index: 20;
    transform: rotate(5deg);
    animation: bounce 1s infinite alternate;
}

/* Index - Number Sticker */
.item-index {
    font-size: 18px;
    font-weight: 700;
    color: white;
    background: var(--color-secondary);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 2px solid var(--color-text);
}

/* Inputs - Workbook Blanks */
.input-cell input {
    width: 100%;
    height: 48px;
    background: #FFF;
    border: 2px dashed var(--color-line);
    border-radius: 12px;
    padding: 0 8px;
    font-family: inherit;
    font-size: 18px;
    color: var(--color-text);
    text-align: center;
    font-weight: 600;
    transition: all 0.2s;
}

.input-cell input:focus {
    border: 2px solid var(--color-primary);
    background: #FFEBEE;
    outline: none;
    transform: scale(1.05);
}

.input-cell input::placeholder {
    color: #D7CCC8;
    font-weight: 400;
}

/* Result - Handwritten Mark */
.unit-result {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text);
    text-align: center;
    text-decoration: underline;
    text-decoration-style: wavy;
    text-decoration-color: var(--color-secondary);
}

/* Delete Button - Eraser */
.remove-btn {
    width: 36px;
    height: 36px;
    background: #FFCDD2;
    border-radius: 10px;
    border: 2px solid #E57373;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #C62828;
    cursor: pointer;
    box-shadow: 0 2px 0 #E57373;
    transition: all 0.1s;
}

.remove-btn:active {
    box-shadow: none;
    transform: translateY(2px);
}

.remove-btn svg {
    width: 20px;
    height: 20px;
    stroke-width: 2.5;
}

/* Footer Actions */
.actions {
    margin-top: 24px;
    display: flex;
    gap: 16px;
    padding-bottom: 20px;
}

.fab {
    flex: 2;
    background: var(--color-primary);
    color: white;
    font-size: 20px;
    font-weight: 700;
    height: 60px;
    border-radius: 20px;
    border: 3px solid #E57373;
    /* Darker coral border */
    border-bottom-width: 6px;
    /* 3D effect */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.1s;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.1);
}

.fab:active {
    border-bottom-width: 3px;
    transform: translateY(3px);
}

.secondary-btn {
    flex: 1;
    background: #FFF;
    color: var(--color-secondary);
    font-size: 18px;
    font-weight: 700;
    height: 60px;
    border-radius: 20px;
    border: 3px solid var(--color-secondary);
    border-bottom-width: 6px;
    cursor: pointer;
    transition: all 0.1s;
}

.secondary-btn:active {
    border-bottom-width: 3px;
    transform: translateY(3px);
}

/* Animations */
@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

@keyframes wiggle {
    0% {
        transform: rotate(0deg);
    }

    25% {
        transform: rotate(-1deg);
    }

    75% {
        transform: rotate(1deg);
    }

    100% {
        transform: rotate(0deg);
    }
}