:root {
    --primary: #d35400;
    --primary-light: #e67e22;
    --accent: #f1c40f;
    --bg-color: #fffbf0;
    --text-color: #2c3e50;
    --grid-gap: 1px;
    --cell-bg: #ffffff;
    --path-color: #27ae60;
    --modal-overlay: rgba(0, 0, 0, 0.85);
}

/* CSS Reset & Performance */
*,
*::before,
*::after {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Gotu', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    line-height: 1.5;
    overscroll-behavior: none;
}

/* Typography Fluidity */
h1 {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    margin: 0;
}

h2 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

p {
    font-size: 0.95rem;
    margin: 0;
}

.app-header {
    background: var(--primary);
    color: white;
    text-align: center;
    padding: 1rem 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    position: sticky;
    top: 0;
    z-index: 100;
}

.main-content {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.instructions {
    text-align: center;
    margin-bottom: 1rem;
    background: white;
    padding: 0.75rem;
    border-radius: 8px;
    width: 100%;
    border: 1px solid rgba(211, 84, 0, 0.1);
}

/* GRID OPTIMIZATIONS */
.game-board {
    width: 100%;
    aspect-ratio: 1/1;
    position: relative;
}

.grid-wrapper {
    display: grid;
    grid-template-columns: repeat(15, 1fr);
    gap: var(--grid-gap);
    background: var(--primary-light);
    border: 2px solid var(--primary);
    border-radius: 4px;
    width: 100%;
    height: 100%;
    touch-action: manipulation;
}

.cell {
    background: var(--cell-bg);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Tiro Devanagari Hindi', serif;
    font-size: clamp(10px, 2.5vw, 16px);
    font-weight: 700;
    cursor: pointer;
    user-select: none;
    will-change: transform, background-color;
    transition: background-color 0.1s ease;
}

.cell:active {
    background-color: var(--accent);
}

/* Animation Classes */
.path-active {
    background-color: var(--path-color) !important;
    color: white !important;
    animation: pulse 0.3s ease-out forwards;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease-in-out;
}

.modal[aria-hidden="false"] {
    opacity: 1;
    pointer-events: all;
}

.modal-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    background: var(--modal-overlay);
}

.modal-card {
    background: white;
    width: 90%;
    max-width: 400px;
    border-radius: 12px;
    position: relative;
    z-index: 1001;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    transform: translateY(20px);
    transition: transform 0.3s ease-out;
}

.modal[aria-hidden="false"] .modal-card {
    transform: translateY(0);
}

.modal-header {
    background: var(--primary);
    color: white;
    padding: 1rem;
    text-align: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
}

.modal-body {
    padding: 1.5rem;
}

.hindi-verse {
    font-family: 'Tiro Devanagari Hindi', serif;
    font-size: 1.3rem;
    color: var(--primary);
    text-align: center;
    background: #fff3e0;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--primary);
}

.detail-box h4 {
    color: #7f8c8d;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.25rem;
}

.detail-box p {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 1rem;
}

.result-box p {
    color: var(--path-color);
    font-weight: 700;
    font-size: 1.1rem;
}

.action-btn {
    width: 100%;
    padding: 1rem;
    background: var(--primary);
    color: white;
    border: none;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
}

.close-btn {
    position: absolute;
    top: 5px;
    right: 10px;
    background: transparent;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 1002;
}

.app-footer {
    margin-top: auto;
    padding: 2rem 0;
    text-align: center;
    font-size: 0.8rem;
    color: #95a5a6;
}