:root {
    --bg-primary: #1a1f2e;
    --bg-secondary: #242b3d;
    --bg-tertiary: #2d3548;
    --bg-card: #2a3245;
    --bg-card-hover: #343d52;
    --text-primary: #ffffff;
    --text-secondary: #8a919e;
    --accent-green: #22c55e;
    --accent-green-hover: #16a34a;
    --border-color: #3a4255;
}

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

html, body {
    height: auto;
    overflow: auto;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4rem 1.5rem 6rem;
    touch-action: manipulation;
}

/* Main Content */
.main-content {
    max-width: 680px;
    width: 100%;
}

/* Profile Header */
.profile-header {
    margin-bottom: 3rem;
}

.name {
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: 2px;
    margin-bottom: 0.25rem;
}

.title {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 400;
    letter-spacing: 1px;
    margin-bottom: 1rem;
}

.social-links {
    display: flex;
    gap: 1.25rem;
}

.social-links a {
    color: var(--text-secondary);
    font-size: 1.25rem;
    transition: color 0.2s ease, transform 0.2s ease;
}

.social-links a:hover {
    color: var(--text-primary);
    transform: translateY(-2px);
}

.profile-photo {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 1.5rem;
    border: 2px solid var(--border-color);
}

.profile-photo-placeholder {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background-color: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    font-size: 2.5rem;
    color: var(--text-secondary);
}

/* Sections */
.section {
    margin-bottom: 3rem;
}

.section-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* About Section */
.about-text {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-primary);
}

.about-text a {
    color: var(--accent-green);
    text-decoration: none;
    transition: color 0.2s ease;
}

.about-text a:hover {
    color: var(--accent-green-hover);
    text-decoration: underline;
}

/* Work Section */
.work-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.work-item {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    padding: 0.625rem 0.75rem;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.work-item:hover {
    background-color: var(--bg-card-hover);
    border-color: #4a5568;
}

.work-logo {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-tertiary);
    border-radius: 6px;
    font-size: 1rem;
    color: var(--text-secondary);
}

.work-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 8px;
}

.work-details {
    flex: 1;
    min-width: 0;
}

.work-company {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.125rem;
}

.work-company a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.work-company a:hover {
    color: var(--accent-green);
}

.work-role {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.125rem;
}

.work-dates {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

/* Projects Section */
.projects-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.project-card {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    padding: 0.625rem 0.75rem;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.project-card:hover {
    background-color: var(--bg-card-hover);
    border-color: #4a5568;
}

.project-logo {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-tertiary);
    border-radius: 6px;
    font-size: 1rem;
    color: var(--text-secondary);
}

.project-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 8px;
}

.project-details {
    flex: 1;
    min-width: 0;
}

.project-name {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.125rem;
}

.project-name a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.project-name a:hover {
    color: var(--accent-green);
}

.project-description {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Contact Section */
.contact-content {
    font-size: 0.95rem;
    line-height: 1.7;
}

.contact-question {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.contact-answer {
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
}

.contact-answer:last-child {
    margin-bottom: 0;
}

.contact-answer a {
    color: var(--accent-green);
    text-decoration: none;
    transition: color 0.2s ease;
}

.contact-answer a:hover {
    color: var(--accent-green-hover);
    text-decoration: underline;
}

/* Games Button */
.games-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.games-btn:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 100;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background-color: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-back,
.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.modal-close {
    font-size: 1.5rem;
}

.modal-back:hover,
.modal-close:hover {
    color: var(--text-primary);
}

/* Shared Game Styles */
.game-header {
    text-align: center;
    margin-bottom: 1rem;
}

.game-controls {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.game-btn {
    padding: 0.6rem 1.25rem;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.85rem;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    border-radius: 6px;
    background-color: var(--accent-green);
    color: var(--text-primary);
}

.game-btn:hover {
    background-color: var(--accent-green-hover);
}

.game-canvas-container {
    display: flex;
    justify-content: center;
}

.game-canvas {
    background-color: var(--bg-primary);
    border-radius: 4px;
}

.game-instructions {
    text-align: center;
    margin-top: 1.25rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.game-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1rem;
}

.game-stat {
    background-color: var(--bg-tertiary);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    text-align: center;
}

.game-stat-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.game-stat-value {
    font-size: 1.1rem;
    font-weight: 600;
}

.game-grid-container {
    position: relative;
}

/* Game Over / Win Overlay */
.game-status-overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.game-status-overlay.active {
    opacity: 1;
    visibility: visible;
}

.game-status-text {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.game-status-text.win {
    color: var(--accent-green);
}

.game-status-text.lose {
    color: #dc2626;
}

/* Games List Modal */
.games-modal .modal {
    width: 380px;
}

.game-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.game-card:last-child {
    margin-bottom: 0;
}

.game-card:hover {
    background-color: var(--bg-card-hover);
    border-color: #4a5568;
}

.game-card-icon {
    font-size: 1.5rem;
    color: var(--text-secondary);
    width: 30px;
    flex-shrink: 0;
}

.game-card-content h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.game-card-content p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Snake Modal */
.snake-modal .modal {
    width: 480px;
    padding: 1.5rem 2rem 2rem;
}

.snake-score {
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

/* Minesweeper Modal */
.minesweeper-modal .modal {
    width: 520px;
    padding: 1.5rem 2rem 2rem;
}

.flags-counter {
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.minesweeper-controls {
    display: flex;
    justify-content: center;
    gap: 0;
    margin-bottom: 1.5rem;
}

.minesweeper-btn {
    padding: 0.6rem 1.25rem;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.85rem;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.flag-btn {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border-radius: 6px 0 0 6px;
    border: 1px solid var(--border-color);
}

.flag-btn.active {
    background-color: var(--accent-green);
    border-color: var(--accent-green);
}

.flag-btn:hover:not(.active) {
    background-color: var(--bg-card-hover);
}

.new-game-btn {
    background-color: var(--accent-green);
    color: var(--text-primary);
    border-radius: 0 6px 6px 0;
}

.new-game-btn:hover {
    background-color: var(--accent-green-hover);
}

/* Minesweeper Grid */
.minesweeper-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 3px;
    background-color: var(--bg-primary);
    padding: 3px;
    border-radius: 4px;
    margin: 0 auto;
    max-width: 360px;
}

.minesweeper-cell {
    aspect-ratio: 1;
    background-color: var(--bg-tertiary);
    border: none;
    border-radius: 2px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background-color 0.1s ease;
}

.minesweeper-cell:hover:not(.revealed):not(.flagged) {
    background-color: var(--bg-card-hover);
}

.minesweeper-cell.revealed {
    background-color: var(--bg-card);
    cursor: default;
}

.minesweeper-cell.flagged {
    background-color: var(--bg-tertiary);
}

.minesweeper-cell.mine {
    background-color: #dc2626;
}

.minesweeper-cell.num-1 { color: #3b82f6; }
.minesweeper-cell.num-2 { color: #22c55e; }
.minesweeper-cell.num-3 { color: #ef4444; }
.minesweeper-cell.num-4 { color: #8b5cf6; }
.minesweeper-cell.num-5 { color: #f59e0b; }
.minesweeper-cell.num-6 { color: #06b6d4; }
.minesweeper-cell.num-7 { color: #ec4899; }
.minesweeper-cell.num-8 { color: #6b7280; }

/* Tetris Modal */
.tetris-modal .modal {
    width: 340px;
    padding: 1.5rem 2rem 2rem;
}

.tetris-stat {
    font-size: 0.9rem;
}

/* 2048 Modal */
.game2048-modal .modal {
    width: 400px;
    padding: 1.5rem 2rem 2rem;
}

.game2048-grid {
    position: relative;
    width: 328px;
    height: 328px;
    background-color: #bbada0;
    border-radius: 6px;
    margin: 0 auto;
}

.tile-2048-cell {
    position: absolute;
    width: 72px;
    height: 72px;
    background-color: rgba(238, 228, 218, 0.35);
    border-radius: 4px;
}

.tile-2048 {
    position: absolute;
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    border-radius: 4px;
    transition: left 0.15s ease-out, top 0.15s ease-out;
    z-index: 10;
}

.tile-2048.tile-large {
    font-size: 1.2rem;
}

.tile-2048.tile-new {
    animation: tile-appear 0.2s ease-out;
}

.tile-2048.tile-merged {
    animation: tile-pop 0.2s ease-out;
    z-index: 20;
}

@keyframes tile-appear {
    from { transform: scale(0); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes tile-pop {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* Number Connect Modal */
.numberconnect-modal .modal {
    width: 380px;
    padding: 1.5rem 2rem 2rem;
}

.nc-grid-container {
    position: relative;
    display: flex;
    justify-content: center;
}

.nc-preview {
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    background-color: var(--bg-tertiary);
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    z-index: 30;
}

.nc-preview.active {
    opacity: 1;
    visibility: visible;
}

.nc-preview-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.nc-preview-tile {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    background-color: var(--bg-card);
    color: var(--text-primary);
    transition: transform 0.15s ease, background-color 0.15s ease;
}

.nc-preview-tile.pulse {
    animation: nc-preview-pulse 0.3s ease;
}

@keyframes nc-preview-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.nc-grid {
    position: relative;
    background-color: #4b5563;
    border-radius: 8px;
}

.nc-canvas {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 20;
}

.nc-tile {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.15s ease;
    z-index: 10;
    user-select: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.nc-tile-falling {
    transition: top 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease;
}

.nc-tile-dropping {
    transition: top 0.25s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.nc-tile-merging {
    transition: left 0.2s ease, top 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
    z-index: 5;
}

.nc-tile-merged {
    animation: nc-pop 0.3s ease;
}

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

.nc-tile:hover {
    transform: scale(1.05);
}

.nc-tile.nc-selected {
    transform: scale(1.08);
    z-index: 15;
}

/* Mobile responsive adjustments */
@media (max-width: 480px) {
    body {
        padding: 2rem 1rem 5rem;
    }

    .name {
        font-size: 2rem;
    }

    .profile-photo,
    .profile-photo-placeholder {
        width: 80px;
        height: 80px;
    }

    .profile-photo-placeholder {
        font-size: 2rem;
    }

    .section {
        margin-bottom: 2rem;
    }

    .section-title {
        font-size: 0.75rem;
    }

    .about-text {
        font-size: 0.9rem;
    }

    .work-logo,
    .project-logo,
    .investment-logo {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }

    .investment-name {
        font-size: 0.85rem;
    }

    .investment-description {
        font-size: 0.7rem;
    }

    .contact-content {
        font-size: 0.9rem;
    }

    .work-company,
    .project-name {
        font-size: 0.85rem;
    }

    .work-role {
        font-size: 0.75rem;
    }

    .work-dates {
        font-size: 0.65rem;
    }

    .project-description {
        font-size: 0.7rem;
    }

    .modal {
        max-width: 95%;
        padding: 1rem;
    }

    .games-modal .modal,
    .snake-modal .modal,
    .minesweeper-modal .modal,
    .tetris-modal .modal,
    .game2048-modal .modal,
    .numberconnect-modal .modal {
        width: 95%;
        padding: 1rem;
    }

    .nc-tile {
        font-size: 1rem;
    }

    .minesweeper-grid {
        max-width: 280px;
    }

    .game2048-grid {
        width: 280px;
        height: 280px;
    }

    .tile-2048-cell,
    .tile-2048 {
        width: 60px;
        height: 60px;
    }

    .tile-2048 {
        font-size: 1.2rem;
    }

    .tile-2048.tile-large {
        font-size: 1rem;
    }

    .game-card {
        padding: 0.75rem;
    }

    .game-card-content p {
        font-size: 0.7rem;
    }
}
