/**
 * Cell Dash Game - Standalone Version Styles
 * 
 * BEM methodology - Zip-style thick line path
 * Standalone page layout
 * Mobile-first responsive design
 */

/* ================================
   Page Level Styles
   ================================ */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(99, 102, 241, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(139, 92, 246, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.page-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 100vh;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

/* ================================
   Block: game
   ================================ */

.game {
    width: 100%;
    max-width: 650px;
    padding: 2rem 1.5rem;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    border: 2px solid #22c55e;
}

.game__container {
    position: relative;
    width: 100%;
}

/* ================================
   Element: Header
   ================================ */

.game__header {
    text-align: center;
    margin-bottom: 1rem;
}

.game__header--hidden {
    display: none;
}

.game__title {
    font-size: 1.5rem;
    font-weight: 800;
    color: #1a1a1a;
    margin: 0 0 0.25rem 0;
    letter-spacing: -0.02em;
}

.game__title-accent {
    color: #22c55e;
}

.game__subtitle {
    font-size: 0.875rem;
    color: #22c55e;
    margin: 0;
    font-weight: 500;
}

/* ================================
   Element: Victory Time Display
   ================================ */

.game__victory-time {
    text-align: center;
    margin-bottom: 0.75rem;
    animation: game-fade-in 0.5s ease;
}

.game__victory-time--hidden {
    display: none;
}

.game__victory-time-value {
    display: block;
    font-size: 2.5rem;
    font-weight: 800;
    color: #16a34a;
    line-height: 1;
    letter-spacing: -0.02em;
}

.game__victory-time-label {
    display: block;
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 500;
    margin-top: 0.25rem;
}

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

/* ================================
   Element: Grid
   ================================ */

.game__grid-container {
    position: relative;
    margin-bottom: 1rem;
}

.game__grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0;
    background: transparent;
    padding: 0;
    border-radius: 0;
    width: 100%;
    max-width: 400px;
    aspect-ratio: 1;
    margin: 0 auto;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    box-sizing: border-box;
    overflow: hidden;
    border: 2px solid #e2e8f0;
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.6s ease;
}

/* Victory tilt - tilts to the right like italic text */
.game__grid--victory {
    transform: rotate(3deg) scale(0.88);
    box-shadow: 12px 12px 30px rgba(0, 0, 0, 0.12);
    pointer-events: none;
}

/* ================================
   Element: Grid Cell
   ================================ */

.game__cell {
    background: #ffffff;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    box-sizing: border-box;
    min-width: 0;
    min-height: 0;
    border: 1px solid #e2e8f0;
}

/* ================================
   Modifier: Number cell - dark circle with white text
   ================================ */

.game__cell--number {
    background: #ffffff;
    z-index: 2;
}

.game__cell--number::before {
    content: attr(data-number);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 55%;
    height: 55%;
    background: #1e293b;
    color: #ffffff;
    border-radius: 50%;
    font-size: 0.875rem;
    font-weight: 700;
    z-index: 3;
    position: relative;
}

/* ================================
   Modifier: Start cell (Number 1) - light pink background
   ================================ */

.game__cell--start {
    background: #fce4ec;
}

.game__cell--path.game__cell--start {
    background: #fce4ec;
}

/* ================================
   Modifier: Path - thick line through cells with gradient
   ================================ */

/* Center dot for path */
.game__cell--path {
    background: #ffffff;
}

.game__cell--path::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 60%;
    height: 60%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #fb923c 0%, #f97316 50%, #ea580c 100%);
    border-radius: 50%;
    z-index: 1;
}

/* Connection lines between path cells with gradients */
.game__line-up {
    position: absolute;
    top: 0;
    left: 50%;
    width: 60%;
    height: 50%;
    transform: translateX(-50%);
    background: linear-gradient(180deg, #fb923c 0%, #f97316 50%, #ea580c 100%);
    z-index: 1;
}

.game__line-down {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 60%;
    height: 50%;
    transform: translateX(-50%);
    background: linear-gradient(180deg, #fb923c 0%, #f97316 50%, #ea580c 100%);
    z-index: 1;
}

.game__line-left {
    position: absolute;
    left: 0;
    top: 50%;
    width: 50%;
    height: 60%;
    transform: translateY(-50%);
    background: linear-gradient(90deg, #fb923c 0%, #f97316 50%, #ea580c 100%);
    z-index: 1;
}

.game__line-right {
    position: absolute;
    right: 0;
    top: 50%;
    width: 50%;
    height: 60%;
    transform: translateY(-50%);
    background: linear-gradient(90deg, #fb923c 0%, #f97316 50%, #ea580c 100%);
    z-index: 1;
}

/* Number on path - circle on top of orange line */
.game__cell--path.game__cell--number::before {
    z-index: 3;
    background: #1e293b;
    color: #ffffff;
}

/* Current position - slightly brighter with gradient */
.game__cell--current::after {
    background: linear-gradient(135deg, #fdba74 0%, #fb923c 50%, #f97316 100%);
}

/* ================================
   Modifier: Wall blockers - black lines blocking movement
   ================================ */

.game__cell--wall-top {
    border-top: 3px solid #000000;
}

.game__cell--wall-bottom {
    border-bottom: 3px solid #000000;
}

.game__cell--wall-left {
    border-left: 3px solid #000000;
}

.game__cell--wall-right {
    border-right: 3px solid #000000;
}

/* ================================
   Element: Controls
   ================================ */

.game__controls {
    display: flex;
    flex-direction: row;
    gap: 0.75rem;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    max-width: 100%;
    margin: 0 auto;
}

.game__controls--hidden {
    display: none;
}

.game__button--hidden {
    display: none;
}

.game__timer {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    min-width: 110px;
    height: 38px;
    box-sizing: border-box;
}

.game__timer-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: #22c55e;
}

.game__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    height: 38px;
    box-sizing: border-box;
}

.game__button--primary {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(22, 163, 74, 0.2);
}

.game__button--primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(22, 163, 74, 0.3);
}

.game__button--primary:active {
    transform: translateY(0);
}

.game__button--secondary {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #e5e7eb;
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
}

.game__button--secondary:hover {
    background: #e5e7eb;
}

.game__button--ghost {
    background: transparent;
    color: #6b7280;
    border: 1px solid #e5e7eb;
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
}

.game__button--ghost:hover {
    background: #f9fafb;
    color: #374151;
}

/* ================================
   Ad Slots - Sidebar Layout
   ================================ */

.ad-sidebar {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    position: sticky;
    top: 2rem;
}

.ad-sidebar--left {
    grid-column: 1;
}

.ad-sidebar--right {
    display: none;
}

/* ================================
   Ad Placeholders - Grid Layout
   ================================ */

/* Positioning */
.ad-top {
    width: 100%;
    max-width: 728px;
}

.game {
    flex-shrink: 0;
}

.ad-left {
    flex-shrink: 0;
}

.ad-right {
    display: none;
}

.ad-bottom {
    display: none;
}

/* Ad placeholder base styles */
.ad-placeholder {
    border: 3px solid #d1d5db;
    border-radius: 12px;
    background: #f9fafb;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.3s ease;
}

.ad-placeholder:hover {
    border-color: #9ca3af;
    background: #f3f4f6;
}

.ad-placeholder__text {
    font-size: 1.5rem;
    font-weight: 700;
    color: #9ca3af;
    text-align: center;
    letter-spacing: 0.05em;
    line-height: 1.3;
}

.ad-placeholder__size {
    position: absolute;
    bottom: 0.5rem;
    right: 0.75rem;
    font-size: 0.75rem;
    color: #d1d5db;
    font-weight: 600;
}

/* Specific ad sizes */
.ad-leaderboard {
    width: 728px;
    height: 90px;
    margin: 0 auto;
}

.ad-skyscraper {
    width: 160px;
    height: 600px;
}

.ad-medium-rect {
    width: 300px;
    height: 250px;
}

.ad-large-rect {
    width: 336px;
    height: 280px;
    margin: 0 auto;
}

/* Hide old banner */
.ad-banner {
    display: none;
}

.ad-sidebar {
    display: none;
}

.ad-slot {
    display: none;
}

/* ================================
   Element: Ad Overlay
   ================================ */

.game__ad-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    z-index: 1000;
    animation: game-fade-in 0.3s ease;
    padding: 1.5rem;
}

.game__ad-image {
    max-width: 100%;
    max-height: calc(100% - 120px);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    border: 3px solid #22c55e;
}

.game__ad-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 2.5rem;
    font-size: 1rem;
    font-weight: 700;
    background: #1a1a1a;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.game__ad-button:hover {
    background: #000000;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.game__ad-button:active {
    transform: translateY(0);
}

.game__ad-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: #22c55e;
    margin: 0;
    text-align: center;
    letter-spacing: 0.02em;
}

/* ================================
   Page Footer
   ================================ */

.page-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    text-align: center;
    background: rgba(255, 255, 255, 0.95);
    border-top: 1px solid #e5e7eb;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.page-footer__link {
    background: none;
    border: none;
    color: #6b7280;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.2s ease;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    padding: 0.25rem 0.5rem;
}

.page-footer__link:hover {
    color: #22c55e;
    text-decoration: underline;
}

.page-footer__separator {
    color: #d1d5db;
    font-size: 0.875rem;
}

/* ================================
   Modal Base Styles
   ================================ */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    animation: modal-fade-in 0.3s ease;
}

.modal--active {
    display: block;
}

.modal__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal__container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal__header {
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal__title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
}

.modal__close {
    background: none;
    border: none;
    font-size: 2rem;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
    line-height: 1;
}

.modal__close:hover {
    background: #f3f4f6;
    color: #1a1a1a;
}

.modal__body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal__body h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1a1a1a;
    margin: 1.5rem 0 0.75rem 0;
}

.modal__body h3:first-child {
    margin-top: 0;
}

.modal__body p {
    font-size: 0.9375rem;
    color: #374151;
    line-height: 1.6;
    margin: 0 0 1rem 0;
}

.modal__body ul {
    margin: 0 0 1rem 0;
    padding-left: 1.5rem;
}

.modal__body li {
    font-size: 0.9375rem;
    color: #374151;
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

.modal__footer {
    padding: 1.5rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.modal__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.modal__button--primary {
    background: #1a1a1a;
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.modal__button--primary:hover {
    background: #000000;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.modal__button--primary:active {
    transform: translateY(0);
}

@keyframes modal-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ================================
   Advertise Info Styles
   ================================ */

.advertise-info {
    text-align: center;
}

.advertise-info h3 {
    color: #22c55e;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.advertise-info__price {
    font-size: 1.25rem;
    color: #1a1a1a;
    margin-bottom: 1.5rem;
}

.advertise-info__features {
    background: #f9fafb;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    text-align: left;
}

.advertise-info__feature {
    font-size: 0.9375rem;
    color: #374151;
    padding: 0.75rem 0;
    border-bottom: 1px solid #e5e7eb;
}

.advertise-info__feature:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.advertise-info__feature strong {
    color: #1a1a1a;
    font-weight: 600;
    display: inline-block;
    min-width: 100px;
}

.advertise-info__note {
    font-size: 0.875rem;
    color: #6b7280;
    font-style: italic;
}

/* ================================
   Responsive
   ================================ */

@media (min-width: 768px) {
    .game__cell--number::before {
        font-size: 1rem;
    }
}

@media (max-width: 1200px) {
    .page-main {
        flex-direction: column;
        align-items: center;
    }
    
    .ad-left {
        display: none;
    }
    
    .ad-leaderboard {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .game {
        padding: 1.25rem 1rem;
        border-radius: 12px;
    }

    .game__title {
        font-size: 1.5rem;
    }
    
    .game__subtitle {
        font-size: 0.85rem;
    }

    .game__cell--number::before {
        font-size: 0.75rem;
    }

    .game__button {
        padding: 0.5rem 1rem;
        font-size: 0.8125rem;
    }

    .game__controls {
        gap: 0.5rem;
    }

    .game__victory-time-value {
        font-size: 2.5rem;
    }
    
    .ad-placeholder__text {
        font-size: 1.125rem;
    }
    
    .ad-leaderboard,
    .ad-medium-rect,
    .ad-large-rect {
        width: 100%;
        min-height: 100px;
    }
}

@media print {
    .game {
        display: none;
    }
}
