/* ============================================================
   WINNER GAME — Frontend Styles
   ============================================================ */

.wg-container {
    max-width: 600px;
    margin: 0 auto;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    padding: 20px;
}

/* ── Game Section ── */
.wg-game-section {
    text-align: center;
    padding: 30px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    color: #fff;
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.4);
}

.wg-game-title {
    font-size: 2rem;
    font-weight: 800;
    margin: 0 0 8px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.wg-game-subtitle {
    font-size: 1rem;
    opacity: 0.9;
    margin: 0 0 24px;
}

/* ── Scratch Card ── */
.wg-scratch-wrap {
    position: relative;
    display: inline-block;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    cursor: crosshair;
}

#wg-scratch-canvas {
    display: block;
    position: relative;
    z-index: 2;
    border-radius: 12px;
}

.wg-scratch-reveal {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f6d365, #fda085);
    border-radius: 12px;
}

.wg-win-reveal {
    font-size: 1.8rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0,0,0,0.3);
    animation: wg-pulse 1s ease-in-out infinite;
}

.wg-scratch-hint {
    margin: 12px 0 0;
    font-size: 0.9rem;
    opacity: 0.85;
}

/* ── Spin Wheel ── */
.wg-spin-wrap {
    position: relative;
    display: inline-block;
}

.wg-wheel-pointer {
    font-size: 2rem;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0,0,0,.3);
    margin-bottom: -8px;
    position: relative;
    z-index: 3;
}

#wg-spin-canvas {
    display: block;
    border-radius: 50%;
    box-shadow: 0 8px 32px rgba(0,0,0,.3);
    border: 6px solid rgba(255,255,255,.3);
}

.wg-spin-btn {
    display: block;
    margin: 16px auto 0;
    padding: 14px 40px;
    font-size: 1.2rem;
    font-weight: 800;
    color: #fff;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0,0,0,.25);
    transition: transform .15s, box-shadow .15s;
    letter-spacing: 1px;
}

.wg-spin-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(0,0,0,.3); }
.wg-spin-btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }

/* ── Memory Game ── */
.wg-memory-wrap { padding: 10px 0; }

.wg-memory-score {
    font-size: 1rem;
    margin-bottom: 16px;
    opacity: .9;
}

.wg-memory-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    max-width: 560px;
    margin: 0 auto;
}

/* ── Bike Memory Card ── */
.wg-memory-card {
    width: 120px;
    height: 90px;
    border-radius: 10px;
    cursor: pointer;
    transition: transform .25s, box-shadow .25s;
    border: 2px solid rgba(255,255,255,.3);
    user-select: none;
    position: relative;
    transform-style: preserve-3d;
    perspective: 600px;
    overflow: hidden;
}

.wg-memory-card:hover:not(.wg-memory-card--matched) {
    transform: scale(1.06);
    box-shadow: 0 6px 20px rgba(0,0,0,.3);
}

/* Front face — question mark */
.wg-card-front {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,.25), rgba(255,255,255,.08));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity .25s;
    z-index: 2;
    border: 2px solid rgba(255,255,255,.3);
}

.wg-card-question {
    font-size: 2rem;
    font-weight: 900;
    color: rgba(255,255,255,.9);
    text-shadow: 0 2px 8px rgba(0,0,0,.3);
}

/* Back face — bike image */
.wg-card-back {
    position: absolute;
    inset: 0;
    background: #fff;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    opacity: 0;
    transition: opacity .25s;
    z-index: 1;
    overflow: hidden;
}

.wg-card-back img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.wg-bike-name {
    position: relative;
    z-index: 2;
    background: rgba(0,0,0,.65);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    width: 100%;
    text-align: center;
    letter-spacing: .5px;
    text-transform: uppercase;
}

/* Flipped state — show bike */
.wg-memory-card--flipped .wg-card-front { opacity: 0; z-index: 1; }
.wg-memory-card--flipped .wg-card-back  { opacity: 1; z-index: 2; }

/* Matched state */
.wg-memory-card--matched {
    border-color: #4caf50;
    box-shadow: 0 0 0 3px rgba(76,175,80,.5);
    cursor: default;
    transform: none;
}
.wg-memory-card--matched .wg-card-back  { opacity: 1; z-index: 2; }
.wg-memory-card--matched .wg-card-front { opacity: 0; z-index: 1; }
.wg-memory-card--matched::after {
    content: '✓';
    position: absolute;
    top: 4px; right: 6px;
    z-index: 3;
    color: #4caf50;
    font-size: 14px;
    font-weight: 900;
    text-shadow: 0 0 4px #fff;
}

.wg-memory-card--hidden { visibility: hidden; }

/* ── Win Screen ── */
.wg-win-screen {
    background: #fff;
    border-radius: 20px;
    padding: 30px 24px;
    box-shadow: 0 10px 40px rgba(0,0,0,.12);
    position: relative;
    overflow: hidden;
}

.wg-confetti-wrap {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.wg-confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    top: -10px;
    animation: wg-confetti-fall linear forwards;
    border-radius: 2px;
}

@keyframes wg-confetti-fall {
    to { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

.wg-win-message {
    text-align: center;
    margin-bottom: 28px;
    position: relative;
    z-index: 1;
}

.wg-win-trophy {
    font-size: 4rem;
    animation: wg-bounce .6s ease infinite alternate;
    display: block;
    margin-bottom: 8px;
}

.wg-win-message h2 {
    font-size: 1.8rem;
    font-weight: 800;
    color: #1a1a1a;
    margin: 0 0 8px;
}

.wg-win-message p {
    color: #666;
    margin: 0;
}

/* ── Form ── */
.wg-form {
    position: relative;
    z-index: 1;
}

.wg-form-row {
    margin-bottom: 16px;
}

.wg-form-row--2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.wg-form-row--title-name {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 14px;
}

.wg-field--title select {
    height: 100%;
}

.wg-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.wg-field label {
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

.wg-required { color: #e53e3e; }
.wg-optional { color: #999; font-weight: 400; font-size: 11px; }

.wg-field input,
.wg-field select {
    padding: 12px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: #1a1a1a;
    background: #f8fafc;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
    width: 100%;
    box-sizing: border-box;
}

.wg-field input:focus,
.wg-field select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,.15);
    background: #fff;
}

.wg-field input.wg-error,
.wg-field select.wg-error {
    border-color: #e53e3e;
    box-shadow: 0 0 0 3px rgba(229,62,62,.1);
}

.wg-field select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
    cursor: pointer;
}

.wg-form-error {
    background: #fff5f5;
    border: 1px solid #fed7d7;
    border-radius: 8px;
    padding: 12px 14px;
    color: #e53e3e;
    font-size: 13px;
    margin-bottom: 16px;
}

.wg-submit-btn {
    width: 100%;
    padding: 16px;
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: opacity .2s, transform .15s;
    letter-spacing: .5px;
    box-shadow: 0 6px 20px rgba(0,0,0,.2);
}

.wg-submit-btn:hover { opacity: .92; transform: translateY(-1px); }
.wg-submit-btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }

/* ── Success Screen ── */
.wg-success-screen {
    text-align: center;
    padding: 60px 24px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,.12);
}

.wg-success-icon {
    font-size: 5rem;
    margin-bottom: 16px;
    animation: wg-bounce .5s ease infinite alternate;
}

.wg-success-screen h2 {
    font-size: 2rem;
    font-weight: 800;
    color: #1a1a1a;
    margin: 0 0 12px;
}

.wg-success-screen p {
    color: #666;
    margin: 0 0 28px;
}

.wg-play-again-btn {
    padding: 14px 40px;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: opacity .2s;
}
.wg-play-again-btn:hover { opacity: .9; }

/* ── Animations ── */
@keyframes wg-bounce {
    from { transform: translateY(0); }
    to   { transform: translateY(-8px); }
}

@keyframes wg-pulse {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.05); }
}

@keyframes wg-fadein {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.wg-win-screen, .wg-success-screen {
    animation: wg-fadein .4s ease;
}

/* ── Responsive ── */
@media (max-width: 480px) {
    .wg-form-row--2 { grid-template-columns: 1fr; }
    .wg-form-row--title-name { grid-template-columns: 1fr; }
    .wg-game-title { font-size: 1.5rem; }
    .wg-memory-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; max-width: 100%; }
    .wg-memory-card { width: 100%; height: 70px; }
    .wg-bike-name { font-size: 8px; }
    #wg-scratch-canvas { width: 280px; height: 175px; }
    #wg-spin-canvas { width: 280px; height: 280px; }
}
