:root {
    --primary: #2c3e50;
    --success: #27ae60;
    --error: #e74c3c;
    --neutral: #bdc3c7;
    --bg: #f8f9fa;
    --tile-bg: #fff;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Inter', -apple-system, sans-serif;
    background-color: var(--bg);
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
}

.container {
    width: 100vw;
    height: 100vh;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    max-width: none;
    border-radius: 0;
    box-shadow: none;
    background: white;
}

.joker-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.joker-container {
    width: min(70vw, 400px);
    height: min(85vw, 480px);
    /* Slightly taller than wide to look like a tile */
    position: relative;
    background: var(--tile-bg);
    border: 3px solid #ddd;
    border-radius: 20px;
    box-shadow: 0 12px 0 #ddd, 0 20px 40px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    margin: 20px 0;
}

.joker-container.valid {
    border-color: var(--success);
    box-shadow: 0 12px 0 var(--success), 0 20px 40px rgba(39, 174, 96, 0.3);
}

.joker-container.invalid {
    border-color: var(--error);
    box-shadow: 0 12px 0 var(--error), 0 20px 40px rgba(231, 76, 60, 0.3);
}

.face-svg {
    width: 85%;
    height: 85%;
}

.face-circle {
    fill: #F5F1E6;
    stroke: black;
    stroke-width: 25;
    transition: fill 0.3s ease, stroke 0.3s ease;
}

.joker-detail {
    transition: all 0.4s ease;
}

.mouth-line {
    transition: d 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), stroke 0.3s ease;
}

/* States */
.joker-container .face-circle {
    fill: #f0f0f0;
    filter: grayscale(1);
    opacity: 0.5;
}

.joker-container .joker-detail {
    opacity: 0.2;
}

.joker-container.valid .face-circle {
    fill: #F5F1E6;
    filter: none;
    opacity: 1;
}

.joker-container.valid .joker-detail {
    opacity: 1;
}

.joker-container.valid #mouth-1 {
    d: path("M160 360 Q250 420 340 360");
}

.joker-container.valid #mouth-2 {
    d: path("M150 370 Q250 460 350 370");
}

/* Invalid state */
.joker-container.invalid {
    transform: rotate(8deg) scale(0.95);
}

.joker-container.invalid .face-circle {
    fill: #fff;
    stroke: var(--error);
    opacity: 1;
}

.joker-container.invalid .joker-detail {
    opacity: 1;
}

.joker-container.invalid .joker-detail path,
.joker-container.invalid .joker-detail circle {
    stroke: var(--error);
    fill: var(--error);
}

.joker-container.invalid .joker-detail path[fill="none"] {
    fill: none;
}

.joker-container.invalid #mouth-1 {
    d: path("M160 410 Q250 350 340 410");
}

.joker-container.invalid #mouth-2 {
    d: path("M150 420 Q250 330 350 420");
}

.status-section {
    width: 100%;
    padding-bottom: 20px;
}

.status-text {
    font-weight: 800;
    font-size: 1.5rem;
    height: 2rem;
    margin-bottom: 15px;
    letter-spacing: 1px;
    color: var(--neutral);
    transition: color 0.3s ease;
    text-align: center;
}

.valid .status-text {
    color: var(--success);
}

.invalid .status-text {
    color: var(--error);
}

.input-container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

input {
    width: 100%;
    padding: 1.2rem;
    font-size: 2rem;
    font-weight: 900;
    border: 4px solid #eee;
    border-radius: 16px;
    outline: none;
    transition: all 0.3s ease;
    text-align: center;
    text-transform: uppercase;
    background: #fff;
    color: var(--primary);
}

input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(44, 62, 80, 0.1);
}

.joker-label {
    margin-top: 15px;
    font-weight: 900;
    font-size: 1rem;
    letter-spacing: 4px;
    color: #333;
}

@media (max-height: 600px) {
    .joker-container {
        width: min(50vw, 200px);
        height: min(60vw, 240px);
    }

    input {
        padding: 0.8rem;
        font-size: 1.5rem;
    }
}