/**
 * Gem Sort - Crystal Marble Puzzle Stylesheet
 */
:root {
    --bg-dark: #0b1120;
    --bg-surface: #1e293b;
    --bg-card: #151f32;
    --accent-gem: #06b6d4;
    --accent-glow: rgba(6, 182, 212, 0.45);
    --gold: #f59e0b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --font-heading: 'Fredoka', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-heading);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
}

/* Page Layout & Skyscrapers */
.page-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    position: relative;
}

.main-content {
    width: 100%;
    max-width: 680px;
    padding: 12px 14px 40px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.ad-skyscraper {
    width: 160px;
    min-height: 600px;
    position: sticky;
    top: 80px;
    margin: 0 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

@media (max-width: 1140px) {
    .ad-skyscraper {
        display: none !important;
    }
}

/* Ad Containers */
.ad-container {
    width: 100%;
    max-width: 728px;
    min-height: 90px;
    margin: 14px auto;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.ad-container.top-ad {
    margin-top: 8px;
    margin-bottom: 16px;
}

.ad-container.bottom-ad {
    margin-top: 25px;
    margin-bottom: 25px;
}

/* Header & Controls */
.game-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.game-title-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.game-title {
    font-size: 1.6rem;
    font-weight: 700;
    background: linear-gradient(135deg, #38bdf8 0%, #818cf8 50%, #c084fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 0.5px;
}

.level-badge {
    background: #1e293b;
    border: 1px solid #38bdf8;
    color: #38bdf8;
    padding: 4px 12px;
    border-radius: 14px;
    font-size: 0.95rem;
    font-weight: 700;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
}

.header-controls {
    display: flex;
    gap: 8px;
}

.btn-icon {
    background: #1e293b;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 40px;
    height: 40px;
    border-radius: 12px;
    font-size: 1.15rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.btn-icon:hover:not(:disabled) {
    background: #334155;
    border-color: #38bdf8;
    transform: translateY(-2px);
}

.btn-icon:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Canvas Area */
.canvas-wrapper {
    width: 100%;
    max-width: 600px;
    position: relative;
    background: radial-gradient(circle at 50% 30%, #1e293b 0%, #0f172a 100%);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-canvas {
    display: block;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

/* Toolbar Buttons */
.toolbar-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 14px;
    width: 100%;
    max-width: 600px;
}

.btn-tool {
    flex: 1;
    max-width: 130px;
    padding: 10px 12px;
    background: #1e293b;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: 12px;
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.15s ease;
}

.btn-tool:hover:not(:disabled) {
    background: #334155;
    border-color: #38bdf8;
    transform: translateY(-1px);
}

.btn-tool:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-tool.special {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    border-color: #38bdf8;
}

/* Victory Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(11, 17, 32, 0.85);
    backdrop-filter: blur(6px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
    animation: fadeIn 0.25s ease-out;
}

.modal-card {
    background: #1e293b;
    border: 2px solid #38bdf8;
    border-radius: 24px;
    padding: 30px 24px;
    text-align: center;
    max-width: 360px;
    width: 100%;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), 0 0 25px rgba(56, 189, 248, 0.35);
    animation: popUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-badge {
    font-size: 3.5rem;
    margin-bottom: 10px;
    display: inline-block;
    animation: bounceSpin 1.2s infinite ease-in-out alternate;
}

.modal-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: #f8fafc;
    margin-bottom: 8px;
}

.modal-subtitle {
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 22px;
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
    color: #ffffff;
    border: none;
    border-radius: 14px;
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(56, 189, 248, 0.4);
    transition: all 0.2s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(56, 189, 248, 0.6);
}

/* SEO Content Section */
.seo-section {
    width: 100%;
    max-width: 600px;
    margin-top: 30px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 24px 22px;
}

.seo-section h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: #f8fafc;
    margin-top: 20px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.seo-section h2:first-of-type {
    margin-top: 0;
}

.seo-section p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #cbd5e1;
    margin-bottom: 14px;
}

.seo-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin: 16px 0;
}

.seo-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 14px;
}

.seo-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #38bdf8;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.seo-card p {
    font-size: 0.88rem;
    color: #94a3b8;
    margin-bottom: 0;
}

/* FAQ Accordion */
.faq-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 14px;
}

.faq-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 14px;
}

.faq-q {
    font-size: 1rem;
    font-weight: 600;
    color: #e2e8f0;
    margin-bottom: 6px;
}

.faq-a {
    font-size: 0.9rem;
    color: #94a3b8;
    line-height: 1.5;
}

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

@keyframes popUp {
    from { transform: scale(0.85); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes bounceSpin {
    from { transform: translateY(0) rotate(-6deg); }
    to { transform: translateY(-8px) rotate(6deg); }
}

@media (max-width: 500px) {
    .seo-grid {
        grid-template-columns: 1fr;
    }
    .game-title {
        font-size: 1.35rem;
    }
    .btn-tool {
        font-size: 0.85rem;
        padding: 8px 6px;
    }
}
