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

body {
    background: #e8e4df;
    color: #1a1a1a;
    font-family: 'Impact', 'Arial Black', 'Helvetica Neue', sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    position: relative;
}

/* Tiled emoji background */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Ctext x='10' y='35' font-size='28' opacity='0.12'%3E%F0%9F%90%82%3C/text%3E%3Ctext x='90' y='35' font-size='28' opacity='0.12'%3E%F0%9F%90%80%3C/text%3E%3Ctext x='50' y='95' font-size='28' opacity='0.12'%3E%F0%9F%90%B8%3C/text%3E%3Ctext x='130' y='95' font-size='28' opacity='0.12'%3E%F0%9F%91%8D%3C/text%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 160px 160px;
}

.container {
    max-width: 700px;
    width: 100%;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    position: relative;
    z-index: 1;
}

/* Header */
header {
    text-align: center;
}

h1 {
    font-size: 3.5rem;
    letter-spacing: 0.15em;
    background: linear-gradient(135deg, #c0392b, #e67e22, #c0392b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.1;
}

.subtitle {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: #777;
    letter-spacing: 0.3em;
    margin-top: 0.5rem;
    font-weight: normal;
}

/* Upload zone */
.upload-zone {
    width: 100%;
    border: 3px dashed #aaa;
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(4px);
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: #c0392b;
    background: rgba(255, 255, 255, 0.7);
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.upload-text {
    font-size: 1.5rem;
    letter-spacing: 0.1em;
    color: #444;
}

.upload-subtext {
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    color: #888;
    margin-top: 0.5rem;
    font-weight: normal;
}

/* Loading */
.loading {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.loading p {
    font-size: 1.1rem;
    letter-spacing: 0.15em;
    color: #c0392b;
    animation: pulse 1.5s ease-in-out infinite;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #ccc;
    border-top-color: #c0392b;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Results */
.results {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.combo-name {
    font-size: 2.5rem;
    text-align: center;
    letter-spacing: 0.1em;
    color: #c0392b;
    text-transform: uppercase;
    animation: slam 0.4s ease-out;
}

.combo-types {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: #666;
    letter-spacing: 0.2em;
    font-weight: normal;
    text-transform: uppercase;
}

@keyframes slam {
    0% { transform: scale(2); opacity: 0; }
    70% { transform: scale(0.95); }
    100% { transform: scale(1); opacity: 1; }
}

/* Result layout: photo + chart side by side */
.result-layout {
    width: 100%;
    display: flex;
    gap: 1.5rem;
    align-items: center;
    justify-content: center;
}

/* Preview */
.preview-section {
    flex-shrink: 0;
}

.preview-section img {
    width: 180px;
    height: 180px;
    border-radius: 8px;
    border: 2px solid #bbb;
    object-fit: cover;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

/* Chart */
.chart-wrapper {
    flex: 1;
    max-width: 350px;
}

.chart-container {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    background: #fff;
    border: 2px solid #bbb;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Axis labels */
.axis-label {
    position: absolute;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    color: #555;
    z-index: 2;
}

.axis-top {
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
}

.axis-bottom {
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
}

.axis-left {
    left: 6px;
    top: 50%;
    transform: translateY(-50%);
}

.axis-right {
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
}

/* Corner labels */
.corner-label {
    position: absolute;
    font-family: 'Courier New', monospace;
    font-size: 0.5rem;
    color: #bbb;
    letter-spacing: 0.05em;
    font-weight: normal;
    z-index: 1;
}

.corner-tl { top: 24px; left: 6px; }
.corner-tr { top: 24px; right: 6px; }
.corner-bl { bottom: 24px; left: 6px; }
.corner-br { bottom: 24px; right: 6px; }

/* Grid lines */
.chart-grid {
    position: absolute;
    inset: 0;
}

.grid-line {
    position: absolute;
    background: #ddd;
}

.grid-h {
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
}

.grid-v {
    top: 0;
    bottom: 0;
    left: 50%;
    width: 1px;
}

/* The dot */
.chart-dot {
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #c0392b;
    box-shadow: 0 0 12px rgba(192, 57, 43, 0.5), 0 0 24px rgba(192, 57, 43, 0.2);
    transform: translate(-50%, -50%);
    z-index: 10;
    transition: left 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                top 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    /* Start at center */
    left: 50%;
    top: 50%;
}

@keyframes dot-appear {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
    60% { transform: translate(-50%, -50%) scale(1.3); }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.chart-dot.animate {
    animation: dot-appear 0.5s ease-out;
}

/* Try again button */
.try-again {
    background: none;
    border: 2px solid #c0392b;
    color: #c0392b;
    font-family: 'Impact', 'Arial Black', sans-serif;
    font-size: 1.1rem;
    letter-spacing: 0.15em;
    padding: 0.75rem 2rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 0.5rem;
}

.try-again:hover {
    background: #c0392b;
    color: #fff;
}

/* Footer */
footer {
    margin-top: auto;
    padding-top: 2rem;
}

footer p {
    font-family: 'Courier New', monospace;
    font-size: 0.7rem;
    color: #999;
    text-align: center;
    font-weight: normal;
}

/* Utility */
.hidden {
    display: none !important;
}

/* Mobile */
@media (max-width: 550px) {
    .result-layout {
        flex-direction: column;
    }

    .preview-section img {
        width: 140px;
        height: 140px;
    }

    .chart-wrapper {
        max-width: 100%;
        width: 100%;
    }

    h1 {
        font-size: 2.5rem;
    }

    .combo-name {
        font-size: 2rem;
    }
}
