/* DunceAI - Shape Rotate Styles */

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

:root {
    --primary-orange: #FF6B35;
    --primary-yellow: #FFD23F;
    --primary-blue: #3D5A80;
    --primary-teal: #35A7A7;
    --success-green: #4CAF50;
    --error-red: #E74C3C;
    --bg-cream: #FFF8E7;
    --text-dark: #2C3E50;
    --shadow: 0 4px 15px rgba(0,0,0,0.1);
}

body {
    font-family: 'Segoe UI', 'Comic Sans MS', Tahoma, sans-serif;
    background: linear-gradient(135deg, var(--bg-cream) 0%, #FFE4C4 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.game-container {
    background: white;
    border-radius: 24px;
    box-shadow: var(--shadow), 0 0 0 4px var(--primary-orange);
    max-width: 900px;
    width: 100%;
    padding: 24px;
    position: relative;
    overflow: hidden;
}

/* Header */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
}

.logo-dunce {
    color: var(--primary-orange);
}

.logo-ai {
    color: var(--primary-blue);
}

.game-header h1 {
    color: var(--text-dark);
    font-size: 1.4rem;
}

/* Intro Screen */
.intro-screen {
    text-align: center;
    padding: 60px 20px;
}

.intro-content {
    max-width: 450px;
    margin: 0 auto;
}

.intro-shape {
    animation: spinIn 1s ease-out;
}

.intro-shape svg {
    animation: gentleSpin 4s linear infinite;
}

@keyframes spinIn {
    from { transform: rotate(-180deg) scale(0); opacity: 0; }
    to { transform: rotate(0) scale(1); opacity: 1; }
}

@keyframes gentleSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.intro-content h2 {
    color: var(--primary-blue);
    font-size: 1.4rem;
    margin: 20px 0 30px;
    line-height: 1.5;
}

/* Buttons */
.btn {
    padding: 14px 32px;
    font-size: 1.1rem;
    font-weight: bold;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-start {
    background: linear-gradient(135deg, var(--success-green) 0%, #45A049 100%);
    color: white;
    box-shadow: 0 4px 0 #2E7D32;
}

.btn-start:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #2E7D32;
}

.btn-freestyle {
    background: linear-gradient(135deg, var(--primary-teal) 0%, #2A8A8A 100%);
    color: white;
    box-shadow: 0 4px 0 #1E6B6B;
}

.btn-freestyle:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #1E6B6B;
}

.mode-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-show {
    background: linear-gradient(135deg, var(--primary-blue) 0%, #2C4A6E 100%);
    color: white;
    box-shadow: 0 4px 0 #1E3A5F;
    padding: 12px 24px;
    font-size: 1rem;
}

.btn-show:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #1E3A5F;
}

.btn-check {
    background: linear-gradient(135deg, var(--success-green) 0%, #45A049 100%);
    color: white;
    box-shadow: 0 4px 0 #2E7D32;
    padding: 12px 24px;
    font-size: 1rem;
}

.btn-check:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #2E7D32;
}

.btn-reveal {
    background: linear-gradient(135deg, var(--primary-orange) 0%, #E55A2B 100%);
    color: white;
    box-shadow: 0 4px 0 #C44A1C;
    padding: 10px 20px;
    font-size: 0.9rem;
}

.btn-reveal:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #C44A1C;
}

.btn-next {
    background: linear-gradient(135deg, var(--primary-blue) 0%, #2C4A6E 100%);
    color: white;
    box-shadow: 0 4px 0 #1E3A5F;
}

.btn-next:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #1E3A5F;
}

/* Game Screen */
.game-screen {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Score Panel */
.score-panel {
    display: flex;
    justify-content: center;
    gap: 30px;
    padding: 12px;
    background: linear-gradient(135deg, #E8F4FD 0%, #D0E8F8 100%);
    border-radius: 12px;
    align-items: center;
}

.score-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.score-label {
    font-size: 1rem;
    color: var(--text-dark);
}

.score-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-blue);
    min-width: 40px;
}

/* Game Area */
.game-area {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 20px;
    align-items: start;
}

/* Controls Panel */
.controls-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 16px;
    background: #F8F9FA;
    border-radius: 12px;
    min-width: 180px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-group label {
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--text-dark);
}

.number-entry {
    display: flex;
    align-items: center;
    gap: 4px;
}

.digit-group {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.arrow-btn {
    width: 32px;
    height: 24px;
    border: 2px solid var(--primary-blue);
    background: white;
    cursor: pointer;
    font-size: 12px;
    color: var(--primary-blue);
    transition: all 0.15s ease;
}

.arrow-btn.up {
    border-radius: 8px 8px 0 0;
}

.arrow-btn.down {
    border-radius: 0 0 8px 8px;
}

.arrow-btn:hover {
    background: var(--primary-blue);
    color: white;
}

.arrow-btn:active {
    transform: scale(0.95);
}

.digit {
    width: 32px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-left: 2px solid var(--primary-blue);
    border-right: 2px solid var(--primary-blue);
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-dark);
}

.unit {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--text-dark);
    margin-left: 4px;
}

.button-row {
    display: flex;
    gap: 10px;
}

/* Shape Selector */
.shape-selector {
    margin-top: 10px;
}

.shape-selector label {
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--text-dark);
    display: block;
    margin-bottom: 8px;
}

.shape-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
}

.shape-option {
    width: 32px;
    height: 32px;
    border: 2px solid #CCC;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    padding: 4px;
    transition: all 0.15s ease;
}

.shape-option:hover {
    border-color: var(--primary-orange);
    transform: scale(1.1);
}

.shape-option.selected {
    border-color: var(--primary-orange);
    background: #FFF5EE;
    box-shadow: 0 0 0 2px var(--primary-orange);
}

.shape-option svg {
    width: 100%;
    height: 100%;
}

/* Shape Display Area */
.shape-display {
    background: white;
    border: 3px solid #333;
    border-radius: 12px;
    padding: 10px;
    min-width: 320px;
    min-height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.display-area {
    position: relative;
    width: 300px;
    height: 300px;
}

.shape-instance {
    position: absolute;
    left: 50%;
    top: 50%;
    transform-origin: center center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.shape-instance.visible {
    opacity: 1;
}

.shape-instance svg {
    width: 60px;
    height: 60px;
    display: block;
}

/* Dunce Panel */
.dunce-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    max-width: 150px;
}

.dunce-character {
    width: 80px;
    transition: transform 0.3s ease;
}

.dunce-svg {
    width: 100%;
    height: auto;
}

.dunce-character.excited {
    animation: dunce-bounce 0.4s ease;
}

@keyframes dunce-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.dunce-character.smirk {
    transform: rotate(-5deg);
}

.dunce-character.dizzy {
    animation: dunce-dizzy 0.5s ease;
}

@keyframes dunce-dizzy {
    0%, 100% { transform: rotate(0); }
    25% { transform: rotate(-10deg); }
    75% { transform: rotate(10deg); }
}

.speech-bubble {
    background: white;
    border: 2px solid var(--primary-orange);
    border-radius: 12px;
    padding: 10px 12px;
    position: relative;
    box-shadow: var(--shadow);
    font-size: 0.85rem;
    text-align: center;
}

.speech-bubble::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-bottom-color: var(--primary-orange);
}

.speech-bubble::after {
    content: '';
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-bottom-color: white;
}

.speech-bubble p {
    color: var(--text-dark);
    line-height: 1.3;
    margin: 0;
}

/* Target Panel */
.target-panel {
    background: linear-gradient(135deg, #FFF5EE 0%, #FFE4D4 100%);
    border: 2px solid var(--primary-orange);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
}

.target-panel h3 {
    color: var(--primary-orange);
    margin-bottom: 12px;
    font-size: 1rem;
}

.target-display {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto 12px;
    background: white;
    border-radius: 8px;
    border: 2px solid #DDD;
}

/* Win Overlay */
.win-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 24px;
    z-index: 100;
}

.win-overlay.show {
    display: flex;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.win-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    border: 4px solid var(--primary-yellow);
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    animation: popIn 0.4s ease;
}

@keyframes popIn {
    0% { transform: scale(0.5); opacity: 0; }
    70% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

.win-shape {
    animation: celebrate 1s ease-in-out infinite;
}

@keyframes celebrate {
    0% { transform: rotate(0deg); }
    25% { transform: rotate(90deg); }
    50% { transform: rotate(180deg); }
    75% { transform: rotate(270deg); }
    100% { transform: rotate(360deg); }
}

.win-content h2 {
    color: var(--primary-blue);
    margin: 16px 0 8px;
    font-size: 1.6rem;
}

.win-content p {
    color: var(--text-dark);
    margin-bottom: 24px;
    font-size: 1.1rem;
}

/* Responsive */
@media (max-width: 750px) {
    .game-container {
        padding: 16px;
    }

    .game-area {
        grid-template-columns: 1fr;
        justify-items: center;
    }

    .controls-panel {
        order: 2;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        min-width: auto;
    }

    .shape-display {
        order: 1;
        min-width: 280px;
        min-height: 280px;
    }

    .display-area {
        width: 260px;
        height: 260px;
    }

    .dunce-panel {
        order: 3;
        flex-direction: row;
        max-width: none;
    }

    .dunce-character {
        width: 60px;
    }
}
