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

:root {
    --bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

body {
    font-family: 'Fredoka', sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #0f0f1e 100%);
    background-attachment: fixed;
    color: #ffffff;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(1px 1px at 20% 30%, #ffd700, rgba(255, 215, 0, 0)),
        radial-gradient(1px 1px at 60% 70%, #4ecdc4, rgba(78, 205, 196, 0)),
        radial-gradient(1px 1px at 50% 50%, #ffd700, rgba(255, 215, 0, 0)),
        radial-gradient(1px 1px at 80% 10%, #4ecdc4, rgba(78, 205, 196, 0)),
        radial-gradient(1px 1px at 10% 90%, #ffd700, rgba(255, 215, 0, 0));
    background-size: 200% 200%, 300% 300%, 250% 250%, 350% 350%, 280% 280%;
    opacity: 0.1;
    pointer-events: none;
    z-index: 0;
}

main {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    padding-bottom: max(40px, env(safe-area-inset-bottom));
}

.nav-bar {
    background: rgba(22, 33, 62, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 2px solid #2a2a4a;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    flex: 1;
}

.mute-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    border: 2px solid #2a2a4a;
    background: transparent;
    color: #b0b0c0;
    border-radius: 20px;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s var(--bounce);
}

.mute-btn:hover {
    border-color: #4ecdc4;
    color: #4ecdc4;
}

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

.mute-btn.muted {
    opacity: 0.6;
}

.nav-button {
    padding: 12px 24px;
    border: 2px solid #2a2a4a;
    background: transparent;
    color: #b0b0c0;
    border-radius: 20px;
    cursor: pointer;
    font-family: 'Fredoka', sans-serif;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s var(--bounce);
}

.nav-button:hover {
    border-color: #4ecdc4;
    color: #4ecdc4;
    transform: translateY(-2px);
}

.nav-button:active {
    transform: scale(0.96);
}

.nav-button.active {
    background: linear-gradient(135deg, #ffd700, #4ecdc4);
    border-color: transparent;
    color: #1a1a2e;
    box-shadow: 0 8px 20px rgba(255, 215, 0, 0.3);
    animation: nav-bounce 0.5s var(--bounce);
}

@keyframes nav-bounce {
    0% { transform: scale(1); }
    50% { transform: scale(1.08); }
    100% { transform: scale(1); }
}

section {
    display: none;
    animation: fadeIn 0.4s var(--bounce);
}

section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.card {
    background: linear-gradient(135deg, #16213e, #1a2a4a);
    border: 2px solid #2a2a4a;
    border-radius: 20px;
    padding: 30px;
    margin: 20px 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

h1 {
    font-size: 36px;
    margin-bottom: 20px;
    color: #ffd700;
    text-align: center;
}

h2 {
    font-size: 24px;
    margin-bottom: 15px;
    color: #4ecdc4;
}

h3 {
    font-size: 18px;
    margin-bottom: 10px;
    color: #ffffff;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-family: 'Fredoka', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s var(--bounce);
    display: inline-block;
}

.btn:active {
    transform: scale(0.96);
}

.btn-primary {
    background: linear-gradient(135deg, #4ecdc4, #45b8ad);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(78, 205, 196, 0.4);
}

.btn-secondary {
    background: #2a2a4a;
    color: #b0b0c0;
    border: 2px solid #4ecdc4;
}

.btn-secondary:hover {
    background: #3a3a5a;
    color: #4ecdc4;
}

.btn-danger {
    background: #ff6b6b;
    color: white;
}

.btn-danger:hover {
    background: #ff5252;
    transform: translateY(-2px);
}

.btn-neutral {
    background: #3a3a5a;
    color: #b0b0c0;
    border: 2px solid #4a4a6a;
}

.btn-neutral:hover {
    background: #4a4a6a;
    color: #4ecdc4;
}

/* LEARN SECTION */
.difficulty-toggle {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 30px;
}

.difficulty-btn {
    padding: 10px 20px;
    border: 2px solid #2a2a4a;
    background: transparent;
    color: #b0b0c0;
    border-radius: 10px;
    cursor: pointer;
    font-family: 'Fredoka', sans-serif;
    font-weight: 600;
    transition: all 0.3s var(--bounce);
}

.difficulty-btn.active {
    background: #ffd700;
    color: #1a1a2e;
    border-color: #ffd700;
}

.difficulty-btn:active {
    transform: scale(0.96);
}

.quiz-container {
    background: linear-gradient(135deg, #16213e, #1a2a4a);
    border: 2px solid #2a2a4a;
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
}

.scene-svg {
    width: 100%;
    max-width: 520px;
    height: auto;
    margin: 20px auto;
    display: block;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 20px;
}

.piece-buttons {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
    margin: 30px 0;
    justify-items: center;
}

.piece-btn {
    width: 90px;
    height: 100px;
    min-width: 48px;
    min-height: 48px;
    border: 2px solid #3a3a5a;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s var(--bounce);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    animation: piece-entrance 0.4s var(--bounce) backwards;
}

.piece-btn-icon {
    font-size: 50px;
    line-height: 1;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.5));
}

.piece-btn-label {
    font-size: 11px;
    color: #b0b0c0;
    font-weight: 600;
}

.piece-btn:nth-child(1) { animation-delay: 0.05s; }
.piece-btn:nth-child(2) { animation-delay: 0.1s; }
.piece-btn:nth-child(3) { animation-delay: 0.15s; }
.piece-btn:nth-child(4) { animation-delay: 0.2s; }
.piece-btn:nth-child(5) { animation-delay: 0.25s; }
.piece-btn:nth-child(6) { animation-delay: 0.3s; }

@keyframes piece-entrance {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.piece-btn:hover {
    border-color: #4ecdc4;
    transform: scale(1.1);
}

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

.piece-btn.selected {
    background: #4ecdc4;
    border-color: #4ecdc4;
    box-shadow: 0 0 20px rgba(78, 205, 196, 0.5);
}

.piece-btn.correct {
    background: #4caf50;
    border-color: #4caf50;
    animation: pulse 0.6s ease, correct-glow 0.6s ease;
}

.piece-btn.incorrect {
    background: #ff6b6b;
    border-color: #ff6b6b;
    animation: shake 0.4s ease;
}

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

@keyframes correct-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.4); }
    50% { box-shadow: 0 0 25px 10px rgba(76, 175, 80, 0.35); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0) rotate(0deg); }
    20% { transform: translateX(-8px) rotate(-5deg); }
    40% { transform: translateX(8px) rotate(5deg); }
    60% { transform: translateX(-6px) rotate(-3deg); }
    80% { transform: translateX(6px) rotate(3deg); }
}

.feedback {
    text-align: center;
    margin: 20px 0;
    font-size: 18px;
    font-weight: 600;
    min-height: 30px;
}

.feedback.correct {
    color: #4caf50;
    animation: feedback-slide 0.4s var(--bounce);
}

.feedback.incorrect {
    color: #ff6b6b;
    animation: feedback-slide 0.4s var(--bounce);
}

@keyframes feedback-slide {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.stars {
    display: inline-block;
    font-size: 24px;
    margin-left: 10px;
    color: #ffd700;
}

.stars .star {
    display: inline-block;
    animation: star-pop 0.4s var(--bounce) forwards;
}

.stars .star:nth-child(1) { animation-delay: 0s; }
.stars .star:nth-child(2) { animation-delay: 0.1s; }
.stars .star:nth-child(3) { animation-delay: 0.2s; }

@keyframes star-pop {
    0% { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.reveal-card {
    background: rgba(78, 205, 196, 0.1);
    border: 2px solid #4ecdc4;
    border-radius: 15px;
    padding: 20px;
    margin: 20px 0;
    display: none;
}

.reveal-card.show {
    display: block;
    animation: slideDown 0.45s var(--bounce);
}

.learn-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

.learn-actions .btn {
    min-height: 44px;
    min-width: 120px;
}

.completion-screen {
    text-align: center;
    padding: 40px 20px;
    position: relative;
    overflow: hidden;
}

.completion-screen .confetti {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.completion-screen .confetti span {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: confetti-fall 2s ease-out forwards;
}

.completion-screen .confetti span:nth-child(1) { left: 10%; background: #ffd700; animation-delay: 0s; }
.completion-screen .confetti span:nth-child(2) { left: 20%; background: #4ecdc4; animation-delay: 0.1s; }
.completion-screen .confetti span:nth-child(3) { left: 30%; background: #ffd700; animation-delay: 0.2s; }
.completion-screen .confetti span:nth-child(4) { left: 40%; background: #4ecdc4; animation-delay: 0.05s; }
.completion-screen .confetti span:nth-child(5) { left: 50%; background: #ffd700; animation-delay: 0.15s; }
.completion-screen .confetti span:nth-child(6) { left: 60%; background: #4ecdc4; animation-delay: 0.25s; }
.completion-screen .confetti span:nth-child(7) { left: 70%; background: #ffd700; animation-delay: 0.08s; }
.completion-screen .confetti span:nth-child(8) { left: 80%; background: #4ecdc4; animation-delay: 0.18s; }
.completion-screen .confetti span:nth-child(9) { left: 90%; background: #ffd700; animation-delay: 0.03s; }
.completion-screen .confetti span:nth-child(10) { left: 95%; background: #4ecdc4; animation-delay: 0.22s; }

@keyframes confetti-fall {
    0% { top: -10px; opacity: 1; transform: translateX(0) rotate(0deg) scale(1); }
    50% { transform: translateX(15px) rotate(90deg) scale(1.2); }
    100% { top: 100%; opacity: 0; transform: translateX(25px) rotate(180deg) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    .completion-screen .confetti span {
        animation: none;
        opacity: 0;
    }
}

.completion-screen h2 {
    font-size: 28px;
    margin-bottom: 20px;
    color: #ffd700;
}

.completion-screen .stars-big {
    font-size: 48px;
    margin: 20px 0;
    color: #ffd700;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

@media (max-width: 480px) {
    .completion-screen .stars-big {
        font-size: 36px;
    }
}

.hint-btn {
    padding: 8px 16px;
    font-size: 13px;
    background: transparent;
    border: 2px dashed #4ecdc4;
    color: #4ecdc4;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Fredoka', sans-serif;
    margin-top: 10px;
}

.hint-btn {
    transition: transform 0.3s var(--bounce);
}

.hint-btn:hover {
    background: rgba(78, 205, 196, 0.1);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-15px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.mini-board {
    width: 240px;
    height: 240px;
    margin: 15px auto;
}

.puzzle-number {
    text-align: center;
    font-size: 14px;
    color: #b0b0c0;
    margin-bottom: 10px;
}

.score-display {
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    color: #ffd700;
    margin: 30px 0;
}

/* SANDBOX SECTION */
.sandbox-board {
    width: 100%;
    max-width: 600px;
    height: auto;
    margin: 30px auto;
    display: block;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 20px;
}

.piece-picker {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 30px 0;
}

.piece-picker-btn {
    width: 70px;
    height: 70px;
    min-width: 48px;
    min-height: 48px;
    border: 2px solid #3a3a5a;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    font-size: 46px;
    cursor: pointer;
    transition: all 0.3s var(--bounce);
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.4));
}

.piece-picker-btn:hover {
    border-color: #4ecdc4;
    transform: scale(1.1);
}

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

.piece-picker-btn.selected {
    background: #4ecdc4;
    border-color: #4ecdc4;
    box-shadow: 0 0 20px rgba(78, 205, 196, 0.5);
}

.piece-picker-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 70px;
}

.piece-picker-item .piece-picker-btn {
    margin: 0;
}

.piece-picker-item span {
    font-size: 11px;
    color: #b0b0c0;
    text-align: center;
    max-width: 70px;
}

.board-instructions {
    text-align: center;
    color: #b0b0c0;
    margin: 20px 0;
    font-size: 14px;
}

/* Board square hover highlight */
#sandbox.piece-selected .sandbox-board rect.square:hover {
    filter: brightness(1.2);
}

#setup-board rect.square.valid-move:hover {
    filter: brightness(1.15);
}

/* SAVE THE KING SECTION */
.sk-container {
    background: linear-gradient(135deg, #16213e, #1a2a4a);
    border: 2px solid #2a2a4a;
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
}

.sk-board-svg {
    width: 100%;
    max-width: 520px;
    height: auto;
    margin: 0 auto;
    display: block;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 10px;
}

.sk-board-wrapper {
    position: relative;
    max-width: 560px;
    margin: 0 auto 20px;
}

/* Intro screen */
.sk-intro {
    text-align: center;
}

.sk-story-board {
    max-width: 400px;
    margin: 0 auto 20px;
}

.sk-speech-bubble {
    background: #fff;
    color: #1a1a2e;
    border-radius: 20px;
    padding: 14px 24px;
    font-size: 18px;
    font-weight: 600;
    display: inline-block;
    position: relative;
    margin-bottom: 24px;
    animation: speech-pop 0.5s var(--bounce);
}

.sk-speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 12px solid #fff;
}

@keyframes speech-pop {
    0% { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.sk-intro-text {
    color: #b0b0c0;
    font-size: 16px;
    line-height: 2;
    margin-bottom: 24px;
}

.sk-start-btn {
    font-size: 18px;
    padding: 16px 36px;
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 10px rgba(78, 205, 196, 0.3); }
    50% { box-shadow: 0 0 25px rgba(78, 205, 196, 0.6); }
}

/* Puzzle screen */
.sk-progress {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
    color: #b0b0c0;
    margin-bottom: 16px;
}

.sk-stars-display {
    color: #ffd700;
    font-weight: 700;
}

.sk-story-line {
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    color: #ffd700;
    margin-bottom: 16px;
    min-height: 28px;
    animation: story-fade 0.6s ease;
}

@keyframes story-fade {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.sk-status {
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    min-height: 36px;
    margin: 12px 0;
}

.sk-status.check {
    color: #ff6b6b;
    animation: check-flash 0.8s ease;
}

.sk-status.safe {
    color: #4caf50;
    animation: feedback-slide 0.4s var(--bounce);
}

.sk-status.checkmate {
    color: #ff6b6b;
    font-size: 28px;
    animation: checkmate-appear 1s var(--bounce);
}

@keyframes check-flash {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes checkmate-appear {
    0% { transform: scale(0.3) rotate(-10deg); opacity: 0; }
    60% { transform: scale(1.2) rotate(3deg); }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* Action buttons */
.sk-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 16px 0;
}

.sk-action-btn {
    padding: 14px 24px;
    min-height: 52px;
    min-width: 130px;
    border: 3px solid #2a2a4a;
    background: rgba(22, 33, 62, 0.8);
    color: #b0b0c0;
    border-radius: 14px;
    font-family: 'Fredoka', sans-serif;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s var(--bounce);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.sk-action-btn:hover {
    transform: translateY(-3px);
    border-color: #4ecdc4;
    color: #fff;
}

.sk-action-btn:active {
    transform: scale(0.96);
}

.sk-action-btn.available {
    border-color: #4ecdc4;
    color: #4ecdc4;
    background: rgba(78, 205, 196, 0.1);
}

.sk-action-btn.available:hover {
    background: rgba(78, 205, 196, 0.25);
    box-shadow: 0 6px 20px rgba(78, 205, 196, 0.3);
}

.sk-action-btn.disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

.sk-action-btn.selected {
    border-color: #ffd700;
    color: #ffd700;
    background: rgba(255, 215, 0, 0.15);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.2);
}

/* Feedback */
.sk-feedback {
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    min-height: 30px;
    margin: 12px 0;
}

.sk-feedback.correct {
    color: #4caf50;
}

.sk-feedback.wrong {
    color: #ff6b6b;
}

/* King shake animation */
@keyframes king-shake {
    0%, 100% { transform: translateX(0) rotate(0); }
    10% { transform: translateX(-3px) rotate(-2deg); }
    20% { transform: translateX(3px) rotate(2deg); }
    30% { transform: translateX(-3px) rotate(-1deg); }
    40% { transform: translateX(3px) rotate(1deg); }
    50% { transform: translateX(-2px) rotate(-1deg); }
    60% { transform: translateX(2px) rotate(1deg); }
    70% { transform: translateX(-1px); }
    80% { transform: translateX(1px); }
}

.king-in-check {
    animation: king-shake 0.6s ease infinite;
}

/* Attack line pulse */
@keyframes attack-pulse {
    0%, 100% { opacity: 0.6; stroke-width: 4; }
    50% { opacity: 1; stroke-width: 6; }
}

.attack-line {
    animation: attack-pulse 1s ease infinite;
}

/* Piece slide animation */
@keyframes piece-slide {
    from { opacity: 0.5; }
    to { opacity: 1; }
}

/* King tip-over for checkmate */
@keyframes king-fall {
    0% { transform: rotate(0deg); opacity: 1; }
    30% { transform: rotate(-15deg); }
    60% { transform: rotate(-45deg); opacity: 0.7; }
    100% { transform: rotate(-90deg) translateY(10px); opacity: 0.3; }
}

.king-fallen {
    animation: king-fall 1.5s ease forwards;
    transform-origin: bottom center;
}

/* Shield flash for block */
@keyframes shield-flash {
    0% { opacity: 0; transform: scale(0.3); }
    50% { opacity: 1; transform: scale(1.2); }
    100% { opacity: 0; transform: scale(1.5); }
}

/* Poof for capture */
@keyframes poof {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.5); }
    100% { opacity: 0; transform: scale(0); }
}

/* Safe square glow */
@keyframes safe-glow {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.6; }
}

.safe-square {
    animation: safe-glow 1s ease infinite;
}

/* Danger square */
.danger-square {
    fill: rgba(255, 80, 80, 0.35) !important;
}

/* King bounce on save */
@keyframes king-bounce {
    0% { transform: translateY(0); }
    30% { transform: translateY(-12px); }
    50% { transform: translateY(0); }
    70% { transform: translateY(-6px); }
    100% { transform: translateY(0); }
}

.king-saved {
    animation: king-bounce 0.6s var(--bounce);
}

/* Finale */
.sk-finale-text {
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    margin: 20px 0;
    line-height: 1.8;
}

/* Summary */
.sk-summary {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin: 20px auto;
    max-width: 400px;
    text-align: left;
}

.sk-summary-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(78, 205, 196, 0.08);
    border: 1px solid #2a2a4a;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 15px;
    color: #b0b0c0;
}

/* Next puzzle button */
.sk-next-btn {
    margin-top: 16px;
    font-size: 16px;
    padding: 14px 32px;
}

/* Board dimmed state before action chosen */
.sk-board-svg.dimmed {
    opacity: 0.5;
    filter: brightness(0.7);
    pointer-events: none;
    transition: all 0.4s ease;
}

.sk-board-svg.active-board {
    opacity: 1;
    filter: brightness(1);
    pointer-events: auto;
    transition: all 0.4s ease;
}

/* Action prompt */
.sk-action-prompt {
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    color: #4ecdc4;
    margin-bottom: 8px;
    animation: prompt-bounce 1.5s ease infinite;
}

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

/* Staggered button entrance */
.sk-action-btn.entrance {
    animation: piece-entrance 0.4s var(--bounce) backwards;
}
.sk-action-btn.entrance:nth-child(1) { animation-delay: 0.3s; }
.sk-action-btn.entrance:nth-child(2) { animation-delay: 0.45s; }
.sk-action-btn.entrance:nth-child(3) { animation-delay: 0.6s; }

/* SETUP SECTION */
.setup-board {
    width: 100%;
    max-width: 600px;
    height: auto;
    margin: 30px auto;
    display: block;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 20px;
}

.piece-info {
    text-align: center;
    background: rgba(78, 205, 196, 0.1);
    border: 2px solid #4ecdc4;
    border-radius: 15px;
    padding: 20px;
    margin: 20px 0;
    min-height: 60px;
}

.piece-info-empty {
    color: #b0b0c0;
}

.piece-symbol {
    font-size: 48px;
    margin-bottom: 10px;
}

.piece-name {
    font-size: 20px;
    font-weight: 700;
    color: #4ecdc4;
    margin-bottom: 10px;
}

.piece-description {
    font-size: 14px;
    color: #b0b0c0;
    line-height: 1.6;
}

/* --- MOBILE: prevent zoom on double-tap, improve touch --- */
svg {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
button {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* --- Tablet (768px) --- */
@media (max-width: 768px) {
    .container {
        padding: 20px 12px;
    }

    h1 {
        font-size: 26px;
    }

    h2 {
        font-size: 19px;
    }

    .card {
        padding: 20px 16px;
        border-radius: 16px;
    }

    .piece-buttons {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }

    .piece-btn {
        width: 100%;
        height: 80px;
        min-height: 60px;
    }

    .piece-btn-icon {
        font-size: 42px;
    }

    .piece-btn-label {
        font-size: 10px;
    }

    .sk-container {
        padding: 20px 14px;
    }

    .sk-action-btn {
        min-width: 110px;
        padding: 12px 18px;
        font-size: 14px;
    }

    .sk-speech-bubble {
        font-size: 16px;
        padding: 12px 18px;
    }

    .sk-intro-text {
        font-size: 14px;
    }

    .nav-bar {
        gap: 6px;
        padding: 12px 10px;
    }

    .nav-button {
        padding: 10px 18px;
        font-size: 14px;
        flex: 1;
        text-align: center;
        min-width: 0;
        min-height: 44px;
    }

    .sandbox-board, .setup-board {
        max-width: 100%;
        padding: 10px;
    }

    .scene-svg {
        padding: 10px;
        max-width: 100%;
    }

    .piece-picker {
        gap: 10px;
    }

    .piece-picker-btn {
        width: 60px;
        height: 60px;
        min-width: 48px;
        min-height: 48px;
        font-size: 34px;
    }

    .mute-btn {
        min-width: 44px;
        min-height: 44px;
        width: 44px;
        height: 44px;
    }

    .mini-board {
        width: 200px;
        height: 200px;
    }

    .quiz-container {
        padding: 20px 14px;
    }

    .difficulty-toggle {
        gap: 8px;
    }

    .difficulty-btn {
        padding: 8px 16px;
        font-size: 14px;
    }

    .sk-board-svg {
        padding: 6px;
    }

    .sk-story-line {
        font-size: 16px;
    }

    .btn {
        min-height: 44px;
        font-size: 15px;
        padding: 12px 20px;
    }
}

/* --- Phone (480px) --- */
@media (max-width: 480px) {
    .container {
        padding: 14px 8px;
    }

    h1 {
        font-size: 22px;
        margin-bottom: 14px;
    }

    h2 {
        font-size: 17px;
    }

    .card {
        padding: 16px 12px;
        margin: 14px 0;
        border-radius: 14px;
    }

    .nav-bar {
        gap: 4px;
        padding: 10px 6px;
    }

    .nav-button {
        padding: 10px 14px;
        font-size: 13px;
        border-radius: 14px;
        min-height: 44px;
    }

    .piece-buttons {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .piece-btn {
        width: 100%;
        height: 72px;
        border-radius: 10px;
    }

    .piece-btn-icon {
        font-size: 36px;
    }

    .piece-btn-label {
        font-size: 9px;
    }

    .piece-picker-btn {
        width: 56px;
        height: 56px;
        min-width: 48px;
        min-height: 48px;
        font-size: 30px;
        border-radius: 8px;
    }

    .piece-picker-item span {
        font-size: 10px;
    }

    .piece-picker {
        gap: 8px;
    }

    .learn-actions .btn,
    .completion-screen .btn {
        min-height: 48px;
        padding: 14px 24px;
    }

    .sandbox-board, .setup-board {
        padding: 6px;
        border-radius: 10px;
    }

    .sk-container {
        padding: 16px 10px;
        border-radius: 14px;
    }

    .sk-action-btn {
        min-width: 100px;
        min-height: 48px;
        padding: 10px 14px;
        font-size: 13px;
    }

    .sk-status {
        font-size: 18px;
    }

    .sk-story-line {
        font-size: 15px;
    }

    .sk-speech-bubble {
        font-size: 14px;
        padding: 10px 16px;
    }

    .sk-summary-item {
        font-size: 13px;
        padding: 10px 12px;
    }

    .scene-svg {
        padding: 8px;
        border-radius: 10px;
    }

    .mini-board {
        width: 180px;
        height: 180px;
    }

    .quiz-container {
        padding: 16px 10px;
        border-radius: 14px;
    }

    .feedback {
        font-size: 16px;
    }

    .stars {
        font-size: 20px;
    }

    .score-display {
        font-size: 18px;
    }

    .piece-info {
        padding: 14px;
    }

    .piece-symbol {
        font-size: 40px;
    }

    .piece-name {
        font-size: 18px;
    }

    .piece-description {
        font-size: 13px;
    }

    .sk-progress {
        font-size: 14px;
    }

    .sk-finale-text {
        font-size: 17px;
    }

    .reveal-card {
        padding: 14px;
    }

    .board-instructions {
        font-size: 13px;
    }

    .difficulty-toggle {
        margin-bottom: 20px;
    }

    .difficulty-btn {
        padding: 8px 14px;
        font-size: 13px;
    }
}
