:root {
    --bg-color: #050505;
    --card-bg: #121214;
    --primary: #00ff9d;
    --primary-dim: rgba(0, 255, 157, 0.2);
    --accent: #ff0055;
    --text-main: #ffffff;
    --text-sec: #888888;
    --font-display: 'Orbitron', sans-serif;
    --font-body: 'Roboto', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    background-image:
        radial-gradient(circle at 50% 0%, #1a2a24 0%, transparent 60%),
        linear-gradient(0deg, #050505 0%, #0a0a0c 100%);
}

.main-container {
    width: 100%;
    max-width: 800px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 2rem;
}

.title {
    font-family: var(--font-display);
    font-size: 3rem;
    line-height: 1.1;
    margin-bottom: 1rem;
    letter-spacing: 2px;
}

.highlight {
    color: var(--primary);
    text-shadow: 0 0 20px var(--primary-dim);
}

.subtitle {
    color: var(--text-sec);
    font-size: 1rem;
}

/* Upload Section */
.upload-section {
    width: 100%;
    max-width: 500px;
}

.drop-zone {
    background: var(--card-bg);
    border: 2px dashed #333;
    border-radius: 20px;
    padding: 4rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--primary);
    background: rgba(0, 255, 157, 0.05);
    box-shadow: 0 0 30px var(--primary-dim);
}

.icon-upload {
    width: 64px;
    height: 64px;
    color: var(--primary);
    margin-bottom: 1rem;
}

.drop-text {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.drop-subtext {
    color: var(--text-sec);
    font-size: 0.9rem;
}

/* Rarity Guide */
.rarity-guide {
    margin-top: 2rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    font-size: 0.8rem;
    color: #666;
}

.rarity-guide h3 {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: #888;
    letter-spacing: 1px;
}

.rate-bar {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-display);
    font-weight: bold;
}

.r-n {
    color: #888;
}

.r-r {
    color: #fff;
}

.r-sr {
    color: #00ff9d;
}

.r-ur {
    color: #ff0055;
    text-shadow: 0 0 5px #ff0055;
}

.r-lr {
    color: #ffd700;
    text-shadow: 0 0 10px #ffd700;
}

/* Editor Section */
.editor-section {
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    animation: fadeIn 0.5s ease;
}

.section-title {
    font-family: var(--font-display);
    color: var(--primary);
    margin-bottom: 1rem;
    text-align: center;
}

.input-group {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    font-size: 0.8rem;
    color: var(--text-sec);
    font-weight: bold;
    letter-spacing: 1px;
}

.input-group input {
    width: 100%;
    background: #000;
    border: 2px solid #333;
    color: #fff;
    padding: 1rem;
    font-size: 1.2rem;
    font-family: var(--font-body);
    border-radius: 10px;
    outline: none;
    transition: 0.3s;
}

.input-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 15px var(--primary-dim);
}

.cropper-container {
    width: 100%;
    background: #000;
    border: 2px solid var(--primary);
    border-radius: 10px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 0 30px var(--primary-dim);
}

#cropCanvas {
    width: 100%;
    height: auto;
    cursor: grab;
    background: #111;
    border: 1px solid #333;
    touch-action: none;
}

#cropCanvas:active {
    cursor: grabbing;
}

.crop-controls {
    width: 100%;
    padding: 1rem 0 0 0;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.crop-controls input[type="range"] {
    flex: 1;
    accent-color: var(--primary);
    height: 5px;
}

.hint {
    font-size: 0.8rem;
    color: #666;
    white-space: nowrap;
}

.top-spacing {
    margin-top: 1rem;
}

/* Processing Animation */
.processing-section {
    text-align: center;
    padding: 2rem;
}

.scanner-effect {
    width: 300px;
    height: 4px;
    background: var(--primary);
    box-shadow: 0 0 15px var(--primary);
    animation: scan 1.5s ease-in-out infinite alternate;
    border-radius: 2px;
    margin: 0 auto 1.5rem auto;
}

.status-text {
    font-family: var(--font-display);
    color: var(--primary);
    letter-spacing: 2px;
    animation: blink 1s infinite;
}

@keyframes scan {
    0% {
        transform: scaleX(0.1);
        opacity: 0.5;
    }

    100% {
        transform: scaleX(1);
        opacity: 1;
    }
}

@keyframes blink {
    50% {
        opacity: 0.5;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Result Section */
.result-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    scale: 0.9;
    transform-origin: top center;
    animation: fadeIn 1s ease;
}

.card-preview {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
    margin-bottom: 2rem;
    border: 1px solid #333;
}

.action-buttons {
    display: flex;
    gap: 1rem;
}

.btn {
    padding: 1rem 2rem;
    font-family: var(--font-body);
    font-weight: bold;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: #000;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 20px var(--primary-dim);
}

.btn-secondary {
    background: transparent;
    border: 2px solid #333;
    color: var(--text-main);
}

.btn-secondary:hover {
    border-color: var(--text-main);
}

.hidden {
    display: none !important;
}

/* Popover Guide */
.popover-guide {
    margin-top: 1.5rem;
    background: #1a1a1a;
    border: 2px solid #555;
    padding: 1.5rem;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    animation: fadeIn 0.3s ease;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
    position: relative;
    z-index: 10;
}

.popover-guide h3 {
    color: var(--primary);
    margin-bottom: 0.8rem;
    font-family: var(--font-display);
    font-size: 1.1rem;
    border-bottom: 1px solid #333;
    padding-bottom: 0.5rem;
}

.popover-guide ul {
    list-style: none;
    text-align: left;
    font-size: 0.9rem;
}

.popover-guide li {
    padding: 0.3rem 0;
    color: #ccc;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
    .title {
        font-size: 2rem;
    }

    .result-section {
        scale: 1;
    }

    .action-buttons {
        flex-direction: column;
        width: 100%;
    }

    .btn {
        width: 100%;
    }

    .upload-section,
    .editor-section {
        width: 100%;
    }

    #cropCanvas {
        width: 100%;
        height: auto;
    }
}