:root {
    --primary-accent: #19c0ff;
    --background: #ffffff;
    --text-dark: #1a1a1a;
    --text-muted: #6c757d;
    --border-color: #e9ecef;
    --border-radius: 8px;
    --font-stack: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

    --strength-1: #c8e6c9;
    --strength-1-border: #a5d6a7;
    --strength-1-text: #2e7d32;
    --strength-2: #66bb6a;
    --strength-2-border: #4caf50;
    --strength-2-text: #1b5e20;
    --strength-3: #2e7d32;
    --strength-3-border: #1b5e20;
    --strength-3-text: #ffffff;
    --unselected-bg: #f8f9fa;
}

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

body {
    font-family: var(--font-stack);
    background: var(--background);
    color: var(--text-dark);
    line-height: 1.6;
    padding: 2rem 1rem;
}

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

/* Header */
.header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.header h1 {
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.header h1 a {
    color: var(--text-dark) !important;
    text-decoration: none;
}

.header h1 a:hover {
    color: var(--strength-3) !important;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.subtitle a {
    color: #0066cc;
    text-decoration: none;
}

.subtitle a:hover {
    text-decoration: underline;
}

a {
    color: #0066cc;
}

a:hover {
    color: #004499;
}

.intro-text {
    max-width: 700px;
    margin: 0 auto;
    text-align: left;
}

.intro-text p {
    margin-bottom: 0.75rem;
    color: var(--text-dark);
    font-size: 0.95rem;
}

.intro-text .instructions {
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.intro-text .instructions em {
    color: var(--text-muted);
}

/* Mosaic Section */
.mosaic-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 2rem;
}

#mosaic-svg {
    width: 400px;
    height: auto;
    transition: width 0.4s ease-out;
}

.head-outline {
    fill: #f5f5f5;
    stroke: #555;
    stroke-width: 2.5;
}

.ear {
    fill: none;
    stroke: #555;
    stroke-width: 2.5;
    stroke-linecap: round;
}

#mosaic-svg text {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    pointer-events: none;
}

.mosaic-actions {
    width: 100%;
    max-width: 400px;
    display: flex;
    justify-content: space-between;
    margin-top: 0.75rem;
    transition: max-width 0.4s ease-out;
}

/* Selection Section */
.selection-section {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

/* Tile Grid */
.tile-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

/* Individual Tile */
.tile {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--unselected-bg);
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    transition: all 0.3s ease-out;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    min-height: 3.5rem;
}

.tile:hover {
    border-color: var(--strength-2);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.tile::after {
    content: '';
    position: absolute;
    top: 6px;
    right: 8px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: transparent;
    transition: all 0.3s ease-out;
}

/* Tile Strength States */
.tile.strength-1 {
    background: var(--strength-1);
    border-color: var(--strength-1-border);
    color: var(--strength-1-text);
    font-weight: 600;
}

.tile.strength-1::after {
    border-color: var(--strength-1-border);
    background: linear-gradient(to top, var(--strength-1-border) 33%, transparent 33%);
}

.tile.strength-2 {
    background: var(--strength-2);
    border-color: var(--strength-2-border);
    color: var(--strength-2-text);
    font-weight: 600;
}

.tile.strength-2::after {
    border-color: var(--strength-2-border);
    background: linear-gradient(to top, var(--strength-2-border) 66%, transparent 66%);
}

.tile.strength-3 {
    background: var(--strength-3);
    border-color: var(--strength-3-border);
    color: var(--strength-3-text);
    font-weight: 700;
    box-shadow: 0 0 10px rgba(46, 125, 50, 0.25);
}

.tile.strength-3::after {
    border-color: var(--strength-3-text);
    background: var(--strength-3-text);
}

/* Add Your Own */
.add-own {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.add-own input {
    flex: 1;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-family: var(--font-stack);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.add-own input:focus {
    border-color: var(--strength-2);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.15);
}

/* Buttons */
.action-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 1.25rem;
    border-radius: var(--border-radius);
    font-family: var(--font-stack);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary-accent);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: #0db0ef;
    box-shadow: 0 2px 8px rgba(25, 192, 255, 0.3);
}

.btn-dark {
    background: #1a1a1a;
    color: #fff;
}

.btn-dark:hover:not(:disabled) {
    background: #333;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.btn-secondary {
    background: var(--text-dark);
    color: #fff;
}

.btn-secondary:hover:not(:disabled) {
    background: #333;
}

.btn-outline {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-muted);
}

.btn-outline:hover:not(:disabled) {
    border-color: var(--strength-2);
    color: var(--strength-2-text);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tile-enter {
    animation: fadeIn 0.4s ease-out both;
}

/* Responsive */
@media (max-width: 768px) {
    .tile-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .container {
        padding: 0;
    }

    .header h1 {
        font-size: 1.75rem;
    }

    .action-buttons {
        flex-direction: column;
    }

    .action-buttons .btn {
        width: 100%;
    }
}

@media (max-width: 500px) {
    body {
        padding: 1rem 0.5rem;
    }

    .tile-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .tile {
        padding: 0.75rem 0.5rem;
        font-size: 0.8rem;
        min-height: 3rem;
    }

    .selection-section {
        padding: 1rem;
    }

    .mosaic-actions {
        gap: 0.5rem;
    }

    .mosaic-actions .btn {
        font-size: 0.78rem;
        padding: 0.55rem 0.75rem;
    }
}
