* {
    box-sizing: border-box;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
    background: #f6f6f6;
    margin: 0;
    padding: 0;
}

main {
    width: 100vw;
    height: 100dvh;
    display: flex;
    flex-direction: column;
}

.container {
    margin: auto;
    padding: 10px;
    display: flex;
    width: 100%;
}

.card {
    width: 420px;
    max-width: 100%;
    background: #fff;
    padding: 15px;
    border-radius: 16px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.1);
    display: none;
    animation: fade 0.35s ease;
    text-align: center;
    margin: auto;
}

@media (min-width: 340px) {
    .card {
        padding: 30px;
    }
}

.card.active {
    display: block;
}

@keyframes fade {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.code-inputs {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 15px;
}

.code-inputs input {
    width: 42px;
    height: 50px;
    font-size: 20px;
    text-align: center;
    border-radius: 8px;
    border: 1px solid #ddd;
}

@media (min-width: 340px) {
    .code-inputs input {
        width: 36px;
        height: 44px;
        font-size: 20px;
    }
}

.code-inputs.error input {
    border-color: #e60023;
}

.error-text {
    color: #e60023;
    font-size: 13px;
}

.upload-area {
    border: 2px dashed #ddd;
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
}

.crop-container {
    margin-top: 20px;
    text-align: center;
}

.crop-circle {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    overflow: hidden;
    margin: auto;
    border: 4px solid #ff3d00;
    position: relative;
    background: #000;
}

.crop-circle img {
    position: absolute;
    top: 50%;
    left: 50%;
    transform-origin: center;
    user-select: none;
    cursor: grab;

    /* KEY FIX */
    height: 102%;
    width: auto;
}

.insta-ring {
    width: 180px;
    height: 180px;
    margin: auto;
    padding: 6px;
    border-radius: 50%;
    background: linear-gradient(
        45deg,
        #feda75,
        #fa7e1e,
        #d62976,
        #962fbf,
        #4f5bd5
    );
}

.preview {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #000;
    overflow: hidden;
    position: relative;
}

.preview canvas {
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.actions {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

.btn {
    padding: 10px 10px;
    font-size: 14px;
    border-radius: 8px;
    border: 1px solid #ddd;
    background: #fff;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

@media (min-width: 340px) {
    .btn {
        padding: 10px 16px;
        font-size: 18px;
    }
}

.btn.primary {
    background: #e60023;
    color: #fff;
    border-color: #e60023;
}
