/* Spin the Wheel Activity Styles */

/* Start Overlay */
.start-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(250, 251, 252, 0.98) 0%, rgba(245, 247, 250, 0.98) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.start-overlay.hidden {
    display: none;
}

.start-content {
    text-align: center;
    padding: 2rem;
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    max-width: 400px;
}

.start-icon {
    font-size: 4rem;
    color: var(--primary-green);
    margin-bottom: 1rem;
    animation: spin-slow 8s linear infinite;
}

@keyframes spin-slow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.start-title {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 800;
    color: var(--neutral-700);
    margin-bottom: 0.5rem;
}

.start-text {
    color: var(--neutral-500);
    margin-bottom: 1.5rem;
}

/* Main Layout */
.spin-the-wheel-content {
    display: flex;
    gap: 2rem;
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
    min-height: calc(100vh - 200px);
    align-items: flex-start;
}

.wheel-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.result-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 500px;
}

/* Wheel Container */
.wheel-container {
    position: relative;
    width: min(480px, 90vw);
    height: min(480px, 90vw);
    margin: 1rem auto;
}

.wheel {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    position: relative;
    background: var(--neutral-200);
    box-shadow:
        0 0 0 8px var(--neutral-300),
        0 0 0 12px var(--neutral-200),
        0 10px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    transition: transform 4s cubic-bezier(0.17, 0.67, 0.12, 0.99);
}

.wheel.spinning {
    /* Animation handled via inline styles for variable duration */
}

/* Wheel Segments */
.wheel-segment {
    position: absolute;
    width: 50%;
    height: 50%;
    left: 50%;
    top: 0;
    transform-origin: 0% 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    clip-path: polygon(0% 100%, 100% 100%, 50% 0%);
}

.segment-content {
    position: absolute;
    width: 60px;
    height: 60px;
    top: 35%;
    left: 50%;
    transform: translateX(-50%) rotate(calc(var(--segment-angle) / 2 * -1 + 90deg));
    display: flex;
    align-items: center;
    justify-content: center;
}

.segment-image {
    width: 50px;
    height: 50px;
    object-fit: contain;
    background: white;
    border-radius: var(--radius-md);
    padding: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Wheel segment colors using CSS conic-gradient approach */
.wheel-inner {
    width: 100%;
    height: 100%;
    position: relative;
}

/* Wheel Center */
.wheel-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: white;
    box-shadow:
        0 0 0 4px var(--neutral-300),
        0 4px 15px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.center-flag {
    font-size: 2.5rem;
}

.center-flag img {
    width: 50px;
    height: auto;
    border-radius: 4px;
}

/* Wheel Pointer */
.wheel-pointer {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 3rem;
    color: var(--primary-red);
    z-index: 20;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    animation: pointerBounce 0.5s ease-in-out;
}

@keyframes pointerBounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-5px); }
}

/* Spin Button */
.spin-controls {
    margin-top: 1.5rem;
    text-align: center;
}

#spinButton.spinning {
    animation: pulse 1s ease-in-out infinite;
}

/* Result Panel */
.result-panel {
    background: white;
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    box-shadow: var(--shadow-card);
    min-height: 300px;
    display: flex;
    flex-direction: column;
}

.result-waiting {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    color: var(--neutral-400);
    text-align: center;
}

.result-waiting i {
    font-size: 3rem;
    margin-bottom: 1rem;
    animation: pointLeft 1.5s ease-in-out infinite;
}

@keyframes pointLeft {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(-10px); }
}

.result-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.result-image {
    width: 150px;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.result-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
}

.result-hint {
    font-family: var(--font-display);
    font-size: 1.25rem;
    color: var(--neutral-600);
    text-align: center;
}

.result-hint .english-word {
    font-weight: 700;
    color: var(--primary-blue);
}

.result-prompt {
    font-family: var(--font-display);
    font-size: 1.1rem;
    color: var(--primary-purple);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: pulse 2s ease-in-out infinite;
}

.result-answer {
    text-align: center;
    padding: 1rem;
    background: linear-gradient(135deg, var(--primary-green), var(--primary-teal));
    border-radius: var(--radius-lg);
    color: white;
    animation: slideIn 0.3s ease-out;
}

/* Override for multilingual mode - neutral background */
.result-answer:has(.language-tiles-grid) {
    background: var(--bg-cream);
    color: var(--text-dark);
    padding: 1.25rem;
}

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

.result-answer .answer-word {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    display: block;
    margin-bottom: 0.25rem;
}

.result-answer .answer-phonetic {
    font-size: 1rem;
    opacity: 0.9;
}

.result-answer .audio-btn {
    margin-top: 0.5rem;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
}

.result-answer .audio-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Multilingual Mode - Language Tiles */
.multilingual-progress-container {
    text-align: center;
    margin-bottom: 1rem;
}

.multilingual-progress {
    display: inline-block;
    background: var(--bg-section);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-round);
    font-family: 'Baloo 2', cursive;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--primary-blue);
    box-shadow: var(--shadow-soft);
}

.multilingual-progress.complete {
    background: linear-gradient(135deg, var(--correct-green) 0%, #20c997 100%);
    color: white;
}

.language-tiles-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    width: 100%;
}

@media (min-width: 576px) {
    .language-tiles-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 992px) {
    .language-tiles-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

.language-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.75rem 0.5rem;
    background: linear-gradient(145deg, var(--primary-blue) 0%, var(--primary-teal) 100%);
    border-radius: var(--radius-medium);
    cursor: pointer;
    transition: all 0.25s ease;
    color: white;
    text-align: center;
    box-shadow: 0 3px 0 rgba(0,0,0,0.15), var(--shadow-card);
}

.language-tile:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 0 rgba(0,0,0,0.15), 0 8px 20px rgba(0, 0, 0, 0.15);
}

.language-tile:active {
    transform: translateY(-1px);
    box-shadow: 0 2px 0 rgba(0,0,0,0.15);
}

.language-tile.played {
    background: linear-gradient(145deg, var(--correct-green) 0%, #66bb6a 100%);
}

.language-tile.playing {
    animation: tilePulse 0.5s ease-in-out infinite;
}

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

.tile-flag {
    width: 32px;
    height: auto;
    border-radius: 3px;
    margin-bottom: 0.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.tile-word {
    font-family: 'Baloo 2', cursive;
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0.25rem;
}

.tile-phonetic {
    font-size: 0.75rem;
    opacity: 0.85;
    font-style: italic;
}

.tile-audio-icon {
    margin-top: 0.5rem;
    font-size: 1rem;
    opacity: 0.8;
}

.language-tile:hover .tile-audio-icon {
    opacity: 1;
}

/* Result Buttons */
.result-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
    margin-top: 0.5rem;
}

/* Completion Summary */
.completion-summary {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--neutral-100);
    border-radius: var(--radius-lg);
}

.completion-summary .summary-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--neutral-200);
}

.completion-summary .summary-row:last-child {
    border-bottom: none;
}

.needs-practice-list {
    margin-top: 1rem;
    text-align: left;
}

.needs-practice-list h5 {
    font-family: var(--font-display);
    font-size: 1rem;
    color: var(--primary-orange);
    margin-bottom: 0.5rem;
}

.needs-practice-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.needs-practice-list li {
    padding: 0.25rem 0;
    color: var(--neutral-600);
}

/* Responsive Design */
@media (max-width: 992px) {
    .spin-the-wheel-content {
        flex-direction: column;
        align-items: center;
    }

    .wheel-section {
        width: 100%;
    }

    .result-section {
        width: 100%;
        max-width: none;
        flex-direction: row;
        gap: 1rem;
    }

    .result-panel {
        flex: 1;
    }
}

@media (max-width: 768px) {
    .wheel-container {
        width: min(360px, 85vw);
        height: min(360px, 85vw);
    }

    .wheel-center {
        width: 60px;
        height: 60px;
    }

    .center-flag {
        font-size: 2rem;
    }

    .center-flag img {
        width: 40px;
    }

    .segment-content {
        width: 45px;
        height: 45px;
    }

    .segment-image {
        width: 35px;
        height: 35px;
    }

    .btn-spin {
        font-size: 1.25rem;
        padding: 0.75rem 2rem;
    }

    .result-section {
        flex-direction: column;
    }

    .result-image {
        width: 120px;
        height: 120px;
    }
}

@media (max-width: 480px) {
    .wheel-container {
        width: min(300px, 80vw);
        height: min(300px, 80vw);
    }

    .result-hint {
        font-size: 1.1rem;
    }
}

/* Fullscreen adjustments */
.activity-container:fullscreen .spin-the-wheel-content {
    min-height: calc(100vh - 100px);
}

.activity-container:fullscreen .wheel-container {
    width: min(550px, 60vh);
    height: min(550px, 60vh);
}
